diff options
-rw-r--r-- | channel.c | 2 | ||||
-rw-r--r-- | channels/chan_h323.c | 18 | ||||
-rw-r--r-- | channels/chan_iax2.c | 25 | ||||
-rw-r--r-- | channels/chan_mgcp.c | 9 | ||||
-rw-r--r-- | channels/chan_misdn.c | 7 | ||||
-rw-r--r-- | channels/chan_modem.c | 7 | ||||
-rw-r--r-- | channels/chan_phone.c | 9 | ||||
-rw-r--r-- | channels/chan_sip.c | 17 | ||||
-rw-r--r-- | channels/chan_skinny.c | 9 | ||||
-rw-r--r-- | channels/chan_vpb.c | 7 | ||||
-rw-r--r-- | channels/chan_zap.c | 16 |
11 files changed, 95 insertions, 31 deletions
@@ -3440,7 +3440,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 d9057a16c..814c546f9 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -770,15 +770,15 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c ch->amaflags = pvt->amaflags; } - /* - * If cid_num and cdi.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, - pvt->cid_name, - !ast_strlen_zero(pvt->cid_num) ? pvt->cid_num : pvt->cd.call_source_e164); + if (!ast_strlen_zero(pvt->cid_num)) { + ch->cid.cid_num = strdup(pvt->cid_num); + ch->cid.cid_ani = strdup(pvt->cid_num); + } else if (!ast_strlen_zero(pvt->cd.call_source_e164)) { + ch->cid.cid_num = strdup(pvt->cd.call_source_e164); + ch->cid.cid_ani = strdup(pvt->cd.call_source_e164); + } + if (!ast_strlen_zero(pvt->cid_name)) + ch->cid.cid_name = strdup(pvt->cid_name); if (!ast_strlen_zero(pvt->rdnis)) { ch->cid.cid_rdnis = strdup(pvt->rdnis); diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index d1e33f408..61fc2ca36 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -3442,15 +3442,22 @@ 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, - i->ani ? i->ani : i->cid_num); + if (!ast_strlen_zero(i->cid_num)) + tmp->cid.cid_num = strdup(i->cid_num); + if (!ast_strlen_zero(i->cid_name)) + tmp->cid.cid_name = strdup(i->cid_name); + if (!ast_strlen_zero(i->ani)) + tmp->cid.cid_ani = strdup(i->ani); + else if (!ast_strlen_zero(i->cid_num)) + tmp->cid.cid_ani = strdup(i->cid_num); + 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_copy_string(tmp->language, i->language, sizeof(tmp->language)); if (!ast_strlen_zero(i->dnid)) tmp->cid.cid_dnid = strdup(i->dnid); - 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->accountcode)) ast_copy_string(tmp->accountcode, i->accountcode, sizeof(tmp->accountcode)); if (i->amaflags) @@ -3461,10 +3468,6 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability) i->owner = tmp; i->capability = capability; ast_setstate(tmp, state); - ast_mutex_lock(&usecnt_lock); - usecnt++; - ast_mutex_unlock(&usecnt_lock); - ast_update_use_count(); if (state != AST_STATE_DOWN) { if (ast_pbx_start(tmp)) { ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name); @@ -3475,6 +3478,10 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability) for (v = i->vars ; v ; v = v->next) pbx_builtin_setvar_helper(tmp,v->name,v->value); + ast_mutex_lock(&usecnt_lock); + usecnt++; + ast_mutex_unlock(&usecnt_lock); + ast_update_use_count(); } return tmp; } diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 9fca447b0..8190d9e3a 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -1428,7 +1428,14 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state) strncpy(tmp->call_forward, i->call_forward, sizeof(tmp->call_forward) - 1); strncpy(tmp->context, i->context, sizeof(tmp->context)-1); strncpy(tmp->exten, i->exten, sizeof(tmp->exten)-1); - ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num); + + if (!ast_strlen_zero(i->cid_num)) { + tmp->cid.cid_num = strdup(i->cid_num); + tmp->cid.cid_ani = strdup(i->cid_num); + } + if (!ast_strlen_zero(i->cid_name)) + tmp->cid.cid_name = 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 2538d3583..a170105ff 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -2164,7 +2164,12 @@ struct ast_channel *misdn_new(struct chan_list *chlist, int state, char * name, char *cid_name, *cid_num; ast_callerid_parse(callerid, &cid_name, &cid_num); - ast_set_callerid(tmp, cid_num, cid_name, cid_num); + if (!ast_strlen_zero(cid_num)) { + tmp->cid.cid_num = strdup(cid_num); + tmp->cid.cid_ani = strdup(cid_num); + } + if (!ast_strlen_zero(cid_name)) + tmp->cid.cid_name = strdup(cid_name); } { diff --git a/channels/chan_modem.c b/channels/chan_modem.c index 6718db141..8be355ea5 100644 --- a/channels/chan_modem.c +++ b/channels/chan_modem.c @@ -573,7 +573,12 @@ struct ast_channel *ast_modem_new(struct ast_modem_pvt *i, int state) tmp->tech_pvt = i; strncpy(tmp->context, i->context, sizeof(tmp->context)-1); - ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num); + if (!ast_strlen_zero(i->cid_num)) { + tmp->cid.cid_num = strdup(i->cid_num); + tmp->cid.cid_ani = strdup(i->cid_num); + } + if (!ast_strlen_zero(i->cid_name)) + tmp->cid.cid_name = strdup(i->cid_name); if (!ast_strlen_zero(i->language)) strncpy(tmp->language,i->language, sizeof(tmp->language)-1); diff --git a/channels/chan_phone.c b/channels/chan_phone.c index 0cb57fc11..18fc8eaf8 100644 --- a/channels/chan_phone.c +++ b/channels/chan_phone.c @@ -825,7 +825,14 @@ 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)) strncpy(tmp->language, i->language, sizeof(tmp->language)-1); - ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num); + + if (!ast_strlen_zero(i->cid_num)) { + tmp->cid.cid_num = strdup(i->cid_num); + tmp->cid.cid_ani = strdup(i->cid_num); + } + if (!ast_strlen_zero(i->cid_name)) + tmp->cid.cid_name = 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 30e1b725a..8c52d3526 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -2859,16 +2859,20 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, char *title) if (!ast_strlen_zero(i->musicclass)) ast_copy_string(tmp->musicclass, i->musicclass, sizeof(tmp->musicclass)); i->owner = tmp; - ast_mutex_lock(&usecnt_lock); - usecnt++; - ast_mutex_unlock(&usecnt_lock); 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->cid_num)) { + tmp->cid.cid_num = strdup(i->cid_num); + tmp->cid.cid_ani = strdup(i->cid_num); + } + if (!ast_strlen_zero(i->cid_name)) + tmp->cid.cid_name = strdup(i->cid_name); if (!ast_strlen_zero(i->rdnis)) tmp->cid.cid_rdnis = strdup(i->rdnis); if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s")) tmp->cid.cid_dnid = strdup(i->exten); + tmp->priority = 1; if (!ast_strlen_zero(i->uri)) { pbx_builtin_setvar_helper(tmp, "SIPURI", i->uri); @@ -2898,6 +2902,11 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, char *title) for (v = i->chanvars ; v ; v = v->next) pbx_builtin_setvar_helper(tmp,v->name,v->value); + ast_mutex_lock(&usecnt_lock); + usecnt++; + ast_mutex_unlock(&usecnt_lock); + ast_update_use_count(); + return tmp; } diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index c35b02810..e4ffe8165 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -2279,7 +2279,14 @@ static struct ast_channel *skinny_new(struct skinny_subchannel *sub, int state) strncpy(tmp->call_forward, l->call_forward, sizeof(tmp->call_forward) - 1); strncpy(tmp->context, l->context, sizeof(tmp->context)-1); strncpy(tmp->exten,l->exten, sizeof(tmp->exten)-1); - ast_set_callerid(tmp, l->cid_num, l->cid_name, l->cid_num); + + if (!ast_strlen_zero(l->cid_num)) { + tmp->cid.cid_num = strdup(l->cid_num); + tmp->cid.cid_ani = strdup(l->cid_num); + } + if (!ast_strlen_zero(l->cid_name)) + tmp->cid.cid_name = strdup(l->cid_name); + tmp->priority = 1; tmp->adsicpe = AST_ADSI_UNAVAILABLE; diff --git a/channels/chan_vpb.c b/channels/chan_vpb.c index f735e3d16..0b067124b 100644 --- a/channels/chan_vpb.c +++ b/channels/chan_vpb.c @@ -2647,7 +2647,12 @@ static struct ast_channel *vpb_new(struct vpb_pvt *me, int state, char *context) cid_name[0] = '\0'; cid_num[0] = '\0'; ast_callerid_split(me->callerid, cid_name, sizeof(cid_name), cid_num, sizeof(cid_num)); - ast_set_callerid(tmp, cid_num, cid_name, cid_num); + if (!ast_strlen_zero(cid_num)) { + tmp->cid.cid_num = strdup(cid_num); + tmp->cid.cid_ani = strdup(cid_num); + } + if (!ast_strlen_zero(cid_name)) + tmp->cid.cid_name = strdup(cid_name); } tmp->tech_pvt = me; diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 2cd028a01..aea308534 100644 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -5118,9 +5118,21 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int tmp->cid.cid_dnid = strdup(i->dnid); #ifdef PRI_ANI - ast_set_callerid(tmp, i->cid_num, i->cid_name, ast_strlen_zero(i->cid_ani) ? i->cid_num : i->cid_ani); + if (!ast_strlen_zero(i->cid_num)) + tmp->cid.cid_num = strdup(i->cid_num); + if (!ast_strlen_zero(i->cid_name)) + tmp->cid.cid_name = strdup(i->cid_name); + if (!ast_strlen_zero(i->cid_ani)) + tmp->cid.cid_ani = strdup(i->cid_num); + else if (!ast_strlen_zero(i->cid_num)) + tmp->cid.cid_ani = strdup(i->cid_num); #else - ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num); + if (!ast_strlen_zero(i->cid_num)) { + tmp->cid.cid_num = strdup(i->cid_num); + tmp->cid.cid_ani = strdup(i->cid_num); + } + if (!ast_strlen_zero(i->cid_name)) + tmp->cid.cid_name = strdup(i->cid_name); #endif tmp->cid.cid_pres = i->callingpres; tmp->cid.cid_ton = i->cid_ton; |