These mods are to solve the problem in bug 7506. It's a lot of rework to solve a fairly small problem... such is life.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@47303 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2006-11-07 23:46:41 +00:00
parent b3bf131dd8
commit 517978fd5f
23 changed files with 254 additions and 165 deletions

View File

@@ -3097,14 +3097,25 @@ static void update_name(struct ast_channel *tmp, int port, int c)
static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char *exten, char *callerid, int format, int port, int c)
{
struct ast_channel *tmp;
char *cid_name = 0, *cid_num = 0;
int chan_offset=0;
int tmp_port = misdn_cfg_get_next_port(0);
for (; tmp_port > 0; tmp_port=misdn_cfg_get_next_port(tmp_port)) {
if (tmp_port == port) break;
chan_offset+=misdn_lib_port_is_pri(tmp_port)?30:2;
}
if (c<0) c=0;
tmp = ast_channel_alloc(1);
if (callerid)
ast_callerid_parse(callerid, &cid_name, &cid_num);
tmp = ast_channel_alloc(1, state, cid_num, cid_name, "%s/%d-u%d", misdn_type, chan_offset + c, glob_channel++);
if (tmp) {
chan_misdn_log(2, 0, " --> * NEW CHANNEL dad:%s oad:%s\n",exten,callerid);
update_name(tmp,port,c);
tmp->nativeformats = prefformat;
tmp->readformat = format;
@@ -3135,7 +3146,7 @@ static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char
ast_callerid_parse(callerid, &cid_name, &cid_num);
/* Don't use ast_set_callerid() here because it will
* generate a NewCallerID event before the NewChannel event */
* generate a needless NewCallerID event */
tmp->cid.cid_num = ast_strdup(cid_num);
tmp->cid.cid_ani = ast_strdup(cid_num);
tmp->cid.cid_name = ast_strdup(cid_name);
@@ -3149,7 +3160,6 @@ static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char
}
ast_setstate(tmp, state);
if (state == AST_STATE_RING)
tmp->rings = 1;
else