diff options
author | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-07 21:47:49 +0000 |
---|---|---|
committer | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-11-07 21:47:49 +0000 |
commit | 4d6996c27ad2cc1e0055b06b18522a44036c4f5c (patch) | |
tree | c85e2036ae8d28edebee2af6cc055a51e39ba1da /channels/chan_misdn.c | |
parent | c347b4f11cda5733f217deac8c9f852fc46945f0 (diff) |
A fair number of changes for the sake of bug 7506
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47290 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_misdn.c')
-rw-r--r-- | channels/chan_misdn.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index e318bd267..74a6ce4e8 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -3103,14 +3103,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; @@ -3141,7 +3152,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); @@ -3155,7 +3166,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 |