diff options
-rw-r--r-- | channel.c | 2 | ||||
-rw-r--r-- | channels/chan_h323.c | 23 | ||||
-rw-r--r-- | channels/chan_iax2.c | 19 | ||||
-rw-r--r-- | channels/chan_mgcp.c | 8 | ||||
-rw-r--r-- | channels/chan_misdn.c | 8 | ||||
-rw-r--r-- | channels/chan_phone.c | 8 | ||||
-rw-r--r-- | channels/chan_sip.c | 12 | ||||
-rw-r--r-- | channels/chan_skinny.c | 8 | ||||
-rw-r--r-- | channels/chan_zap.c | 13 |
9 files changed, 71 insertions, 30 deletions
@@ -3625,7 +3625,7 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha } for (/* ever */;;) { - struct timeval now; + struct timeval now = { 0, }; int to; to = -1; diff --git a/channels/chan_h323.c b/channels/chan_h323.c index b5e3b18d0..5a4a400b2 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -796,18 +796,19 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c if (pvt->amaflags) { ch->amaflags = pvt->amaflags; } - /* - * If cid_num and cd.call_source_e164 are both null, then - * ast_set_callerid will do the right thing and leave the - * cid_num and cid_ani for the channel alone. - */ - ast_set_callerid(ch, - !ast_strlen_zero(pvt->cid_num) ? pvt->cid_num : pvt->cd.call_source_e164, - !ast_strlen_zero(pvt->cid_name) ? pvt->cid_name : pvt->cd.call_source_name, - !ast_strlen_zero(pvt->cid_num) ? pvt->cid_num : pvt->cd.call_source_e164); - if (!ast_strlen_zero(pvt->rdnis)) { - ch->cid.cid_rdnis = strdup(pvt->rdnis); + + /* Don't use ast_set_callerid() here because it will + * generate a NewCallerID event before the NewChannel event */ + if (!ast_strlen_zero(pvt->cid_num)) { + ch->cid.cid_num = ast_strdup(pvt->cid_num); + ch->cid.cid_ani = ast_strdup(pvt->cid_num); + } else { + ch->cid.cid_num = ast_strdup(pvt->cd.call_source_e164); + ch->cid.cid_ani = ast_strdup(pvt->cd.call_source_e164); } + ch->cid.cid_name = ast_strdup(pvt->cid_name); + ch->cid.cid_rdnis = ast_strdup(pvt->rdnis); + if (!ast_strlen_zero(pvt->exten) && strcmp(pvt->exten, "s")) { ch->cid.cid_dnid = strdup(pvt->exten); } diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 5493d3a31..9a14d1d09 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -3259,16 +3259,21 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability) tmp->writeformat = ast_best_codec(capability); tmp->tech_pvt = CALLNO_TO_PTR(i->callno); - ast_set_callerid(tmp, i->cid_num, i->cid_name, S_OR(i->ani, i->cid_num)); - if (!ast_strlen_zero(i->language)) - ast_string_field_set(tmp, language, i->language); - if (!ast_strlen_zero(i->dnid)) - tmp->cid.cid_dnid = ast_strdup(i->dnid); - if (!ast_strlen_zero(i->rdnis)) - tmp->cid.cid_rdnis = ast_strdup(i->rdnis); + /* Don't use ast_set_callerid() here because it will + * generate a NewCallerID event before the NewChannel event */ + tmp->cid.cid_num = ast_strdup(i->cid_num); + tmp->cid.cid_name = ast_strdup(i->cid_name); + if (!ast_strlen_zero(i->ani)) + tmp->cid.cid_ani = ast_strdup(i->ani); + else + tmp->cid.cid_ani = ast_strdup(i->cid_num); + tmp->cid.cid_dnid = ast_strdup(i->dnid); + tmp->cid.cid_rdnis = ast_strdup(i->rdnis); tmp->cid.cid_pres = i->calling_pres; tmp->cid.cid_ton = i->calling_ton; tmp->cid.cid_tns = i->calling_tns; + if (!ast_strlen_zero(i->language)) + ast_string_field_set(tmp, language, i->language); if (!ast_strlen_zero(i->accountcode)) ast_string_field_set(tmp, accountcode, i->accountcode); if (i->amaflags) diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index b70e17154..7b56b8c98 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -1415,7 +1415,13 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state) ast_string_field_set(tmp, call_forward, i->call_forward); ast_copy_string(tmp->context, i->context, sizeof(tmp->context)); ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten)); - ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num); + + /* Don't use ast_set_callerid() here because it will + * generate a NewCallerID event before the NewChannel event */ + tmp->cid.cid_num = ast_strdup(i->cid_num); + tmp->cid.cid_ani = ast_strdup(i->cid_num); + tmp->cid.cid_name = ast_strdup(i->cid_name); + if (!i->adsi) tmp->adsicpe = AST_ADSI_UNAVAILABLE; tmp->priority = 1; diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index 68f319cd1..f093af080 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -3099,9 +3099,11 @@ static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char char *cid_name, *cid_num; ast_callerid_parse(callerid, &cid_name, &cid_num); - ast_set_callerid(tmp, cid_num,cid_name,cid_num); - } else { - ast_set_callerid(tmp, NULL,NULL,NULL); + /* Don't use ast_set_callerid() here because it will + * generate a NewCallerID event before the NewChannel 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); } { diff --git a/channels/chan_phone.c b/channels/chan_phone.c index 12ccba585..668db2fb3 100644 --- a/channels/chan_phone.c +++ b/channels/chan_phone.c @@ -864,7 +864,13 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *conte strncpy(tmp->exten, "s", sizeof(tmp->exten) - 1); if (!ast_strlen_zero(i->language)) ast_string_field_set(tmp, language, i->language); - ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num); + + /* Don't use ast_set_callerid() here because it will + * generate a NewCallerID event before the NewChannel event */ + tmp->cid.cid_num = ast_strdup(i->cid_num); + tmp->cid.cid_ani = ast_strdup(i->cid_num); + tmp->cid.cid_name = ast_strdup(i->cid_name); + i->owner = tmp; ast_mutex_lock(&usecnt_lock); usecnt++; diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 6fcd10d86..3b5b10048 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3682,11 +3682,17 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit ast_update_use_count(); ast_copy_string(tmp->context, i->context, sizeof(tmp->context)); ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten)); - ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num); - if (!ast_strlen_zero(i->rdnis)) - tmp->cid.cid_rdnis = ast_strdup(i->rdnis); + + /* Don't use ast_set_callerid() here because it will + * generate a NewCallerID event before the NewChannel event */ + tmp->cid.cid_num = ast_strdup(i->cid_num); + tmp->cid.cid_ani = ast_strdup(i->cid_num); + tmp->cid.cid_name = ast_strdup(i->cid_name); + tmp->cid.cid_rdnis = ast_strdup(i->rdnis); + if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s")) tmp->cid.cid_dnid = ast_strdup(i->exten); + tmp->priority = 1; if (!ast_strlen_zero(i->uri)) pbx_builtin_setvar_helper(tmp, "SIPURI", i->uri); diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index c5feda2da..00b54f015 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -2582,7 +2582,13 @@ static struct ast_channel *skinny_new(struct skinny_line *l, int state) ast_string_field_set(tmp, call_forward, l->call_forward); ast_copy_string(tmp->context, l->context, sizeof(tmp->context)); ast_copy_string(tmp->exten, l->exten, sizeof(tmp->exten)); - ast_set_callerid(tmp, l->cid_num, l->cid_name, l->cid_num); + + /* Don't use ast_set_callerid() here because it will + * generate a NewCallerID event before the NewChannel event */ + tmp->cid.cid_num = ast_strdup(l->cid_num); + tmp->cid.cid_ani = ast_strdup(l->cid_num); + tmp->cid.cid_name = ast_strdup(l->cid_name); + tmp->priority = 1; tmp->adsicpe = AST_ADSI_UNAVAILABLE; diff --git a/channels/chan_zap.c b/channels/chan_zap.c index b0578e776..ad3d2281b 100644 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -5217,9 +5217,18 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int tmp->cid.cid_dnid = ast_strdup(i->dnid); #ifdef PRI_ANI - ast_set_callerid(tmp, i->cid_num, i->cid_name, S_OR(i->cid_ani, i->cid_num)); + /* Don't use ast_set_callerid() here because it will + * generate a NewCallerID event before the NewChannel event */ + tmp->cid.cid_num = ast_strdup(i->cid_num); + tmp->cid.cid_name = ast_strdup(i->cid_name); + if (!ast_strlen_zero(i->cid_ani)) + tmp->cid.cid_ani = ast_strdup(i->cid_num); + else + tmp->cid.cid_ani = ast_strdup(i->cid_num); #else - ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num); + tmp->cid.cid_num = ast_strdup(i->cid_num); + tmp->cid.cid_ani = ast_strdup(i->cid_num); + tmp->cid.cid_name = ast_strdup(i->cid_name); #endif tmp->cid.cid_pres = i->callingpres; tmp->cid.cid_ton = i->cid_ton; |