[asterisk-commits] trunk r36726 - in /trunk: ./ channels/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Jul 2 21:25:22 MST 2006
Author: russell
Date: Sun Jul 2 23:25:21 2006
New Revision: 36726
URL: http://svn.digium.com/view/asterisk?rev=36726&view=rev
Log:
Blocked revisions 36725 via svnmerge
........
r36725 | russell | 2006-07-03 00:19:09 -0400 (Mon, 03 Jul 2006) | 4 lines
use ast_set_callerid to be more consistent and to make sure that the
"callerid" option in the conf files is always handled the same way and sets ANI
(issue #7285, gkloepfer)
........
Modified:
trunk/ (props changed)
trunk/channels/chan_agent.c
trunk/channels/chan_h323.c
trunk/channels/chan_iax2.c
trunk/channels/chan_jingle.c
trunk/channels/chan_mgcp.c
trunk/channels/chan_oss.c
trunk/channels/chan_phone.c
trunk/channels/chan_sip.c
trunk/channels/chan_skinny.c
trunk/channels/chan_vpb.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.
Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?rev=36726&r1=36725&r2=36726&view=diff
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Sun Jul 2 23:25:21 2006
@@ -640,12 +640,8 @@
/* Call on this agent */
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "outgoing agentcall, to agent '%s', on '%s'\n", p->agent, p->chan->name);
- if (p->chan->cid.cid_num)
- free(p->chan->cid.cid_num);
- p->chan->cid.cid_num = ast_strdup(ast->cid.cid_num);
- if (p->chan->cid.cid_name)
- free(p->chan->cid.cid_name);
- p->chan->cid.cid_name = ast_strdup(ast->cid.cid_name);
+ ast_set_callerid(p->chan,
+ ast->cid.cid_num, ast->cid.cid_name, NULL);
ast_channel_inherit_variables(ast, p->chan);
res = ast_call(p->chan, p->loginchan, 0);
CLEANUP(ast,p);
Modified: trunk/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_h323.c?rev=36726&r1=36725&r2=36726&view=diff
==============================================================================
--- trunk/channels/chan_h323.c (original)
+++ trunk/channels/chan_h323.c Sun Jul 2 23:25:21 2006
@@ -786,16 +786,15 @@
if (pvt->amaflags) {
ch->amaflags = pvt->amaflags;
}
- if (!ast_strlen_zero(pvt->cid_num)) {
- ch->cid.cid_num = strdup(pvt->cid_num);
- } else if (!ast_strlen_zero(pvt->cd.call_source_e164)) {
- ch->cid.cid_num = strdup(pvt->cd.call_source_e164);
- }
- if (!ast_strlen_zero(pvt->cid_name)) {
- ch->cid.cid_name = strdup(pvt->cid_name);
- } else if (!ast_strlen_zero(pvt->cd.call_source_name)) {
- ch->cid.cid_name = strdup(pvt->cd.call_source_name);
- }
+ /*
+ * 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);
}
Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?rev=36726&r1=36725&r2=36726&view=diff
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Sun Jul 2 23:25:21 2006
@@ -3287,12 +3287,7 @@
tmp->writeformat = ast_best_codec(capability);
tmp->tech_pvt = CALLNO_TO_PTR(i->callno);
- if (!ast_strlen_zero(i->cid_num))
- tmp->cid.cid_num = ast_strdup(i->cid_num);
- if (!ast_strlen_zero(i->cid_name))
- tmp->cid.cid_name = ast_strdup(i->cid_name);
- if (!ast_strlen_zero(i->ani))
- tmp->cid.cid_ani = ast_strdup(i->ani);
+ 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))
Modified: trunk/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_jingle.c?rev=36726&r1=36725&r2=36726&view=diff
==============================================================================
--- trunk/channels/chan_jingle.c (original)
+++ trunk/channels/chan_jingle.c Sun Jul 2 23:25:21 2006
@@ -761,10 +761,7 @@
ast_mutex_unlock(&usecnt_lock);
ast_copy_string(tmp->context, client->context, sizeof(tmp->context));
ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
- if (!ast_strlen_zero(i->cid_num))
- tmp->cid.cid_num = ast_strdup(i->cid_num);
- if (!ast_strlen_zero(i->cid_name))
- tmp->cid.cid_name = ast_strdup(i->cid_name);
+ ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num);
if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s"))
tmp->cid.cid_dnid = ast_strdup(i->exten);
tmp->priority = 1;
Modified: trunk/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_mgcp.c?rev=36726&r1=36725&r2=36726&view=diff
==============================================================================
--- trunk/channels/chan_mgcp.c (original)
+++ trunk/channels/chan_mgcp.c Sun Jul 2 23:25:21 2006
@@ -1485,8 +1485,7 @@
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));
- tmp->cid.cid_num = ast_strdup(i->cid_num);
- tmp->cid.cid_name = ast_strdup(i->cid_name);
+ ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num);
if (!i->adsi)
tmp->adsicpe = AST_ADSI_UNAVAILABLE;
tmp->priority = 1;
@@ -2677,21 +2676,10 @@
/*res = tone_zone_play_tone(p->subs[index].zfd, -1);*/
ast_indicate(chan, -1);
ast_copy_string(chan->exten, exten, sizeof(chan->exten));
- if (!ast_strlen_zero(p->cid_num)) {
- if (!p->hidecallerid) {
- /* SC: free existing chan->callerid */
- if (chan->cid.cid_num)
- free(chan->cid.cid_num);
- chan->cid.cid_num = ast_strdup(p->cid_num);
- /* SC: free existing chan->callerid */
- if (chan->cid.cid_name)
- free(chan->cid.cid_name);
- chan->cid.cid_name = ast_strdup(p->cid_name);
- }
- if (chan->cid.cid_ani)
- free(chan->cid.cid_ani);
- chan->cid.cid_ani = ast_strdup(p->cid_num);
- }
+ ast_set_callerid(chan,
+ p->hidecallerid ? "" : p->cid_num,
+ p->hidecallerid ? "" : p->cid_name,
+ chan->cid.cid_ani ? NULL : p->cid_num);
ast_setstate(chan, AST_STATE_RING);
/*zt_enable_ec(p);*/
if (p->dtmfmode & MGCP_DTMF_HYBRID) {
@@ -2748,12 +2736,7 @@
}
/* Disable Caller*ID if enabled */
p->hidecallerid = 1;
- if (chan->cid.cid_num)
- free(chan->cid.cid_num);
- chan->cid.cid_num = NULL;
- if (chan->cid.cid_name)
- free(chan->cid.cid_name);
- chan->cid.cid_name = NULL;
+ ast_set_callerid(chan, "", "", NULL);
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
len = 0;
@@ -2832,14 +2815,7 @@
}
/* Enable Caller*ID if enabled */
p->hidecallerid = 0;
- if (chan->cid.cid_num)
- free(chan->cid.cid_num);
- if (!ast_strlen_zero(p->cid_num))
- chan->cid.cid_num = strdup(p->cid_num);
- if (chan->cid.cid_name)
- free(chan->cid.cid_name);
- if (!ast_strlen_zero(p->cid_name))
- chan->cid.cid_name = strdup(p->cid_name);
+ ast_set_callerid(chan, p->cid_num, p->cid_name, NULL);
/*res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_DIALRECALL);*/
transmit_notify_request(sub, "L/sl");
len = 0;
Modified: trunk/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_oss.c?rev=36726&r1=36725&r2=36726&view=diff
==============================================================================
--- trunk/channels/chan_oss.c (original)
+++ trunk/channels/chan_oss.c Sun Jul 2 23:25:21 2006
@@ -991,12 +991,9 @@
ast_copy_string(c->exten, ext, sizeof(c->exten));
if (!ast_strlen_zero(o->language))
ast_string_field_set(c, language, o->language);
- if (!ast_strlen_zero(o->cid_num))
- c->cid.cid_num = ast_strdup(o->cid_num);
- if (!ast_strlen_zero(o->cid_name))
- c->cid.cid_name = ast_strdup(o->cid_name);
- if (!ast_strlen_zero(ext))
- c->cid.cid_dnid = strdup(ext);
+ ast_set_callerid(c, o->cid_num, o->cid_name, o->cid_num);
+ if (!ast_strlen_zero(ext))
+ c->cid.cid_dnid = ast_strdup(ext);
o->owner = c;
ast_setstate(c, state);
Modified: trunk/channels/chan_phone.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_phone.c?rev=36726&r1=36725&r2=36726&view=diff
==============================================================================
--- trunk/channels/chan_phone.c (original)
+++ trunk/channels/chan_phone.c Sun Jul 2 23:25:21 2006
@@ -857,10 +857,7 @@
strncpy(tmp->exten, "s", sizeof(tmp->exten) - 1);
if (!ast_strlen_zero(i->language))
ast_string_field_set(tmp, language, i->language);
- 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);
+ ast_set_callerid(tmp, i->cid_num, i->cid_name, i->cid_num);
i->owner = tmp;
ast_mutex_lock(&usecnt_lock);
usecnt++;
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=36726&r1=36725&r2=36726&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sun Jul 2 23:25:21 2006
@@ -3687,10 +3687,7 @@
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));
- if (!ast_strlen_zero(i->cid_num))
- tmp->cid.cid_num = ast_strdup(i->cid_num);
- if (!ast_strlen_zero(i->cid_name))
- tmp->cid.cid_name = ast_strdup(i->cid_name);
+ 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);
if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s"))
Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_skinny.c?rev=36726&r1=36725&r2=36726&view=diff
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Sun Jul 2 23:25:21 2006
@@ -2093,12 +2093,10 @@
} else {
ast_copy_string(chan->exten, exten, sizeof(chan->exten));
ast_copy_string(l->lastnumberdialed, exten, sizeof(l->lastnumberdialed));
- if (!ast_strlen_zero(l->cid_num)) {
- if (!l->hidecallerid) {
- chan->cid.cid_num = strdup(l->cid_num);
- chan->cid.cid_ani = strdup(l->cid_num);
- }
- }
+ ast_set_callerid(chan,
+ l->hidecallerid ? "" : l->cid_num,
+ l->hidecallerid ? "" : l->cid_name,
+ chan->cid.cid_ani ? NULL : l->cid_num);
ast_setstate(chan, AST_STATE_RING);
res = ast_pbx_run(chan);
if (res) {
@@ -2525,8 +2523,7 @@
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));
- tmp->cid.cid_num = ast_strdup(l->cid_num);
- tmp->cid.cid_name = ast_strdup(l->cid_name);
+ ast_set_callerid(tmp, l->cid_num, l->cid_name, l->cid_num);
tmp->priority = 1;
tmp->adsicpe = AST_ADSI_UNAVAILABLE;
@@ -2720,12 +2717,10 @@
if (ast_exists_extension(c, c->context, l->lastnumberdialed, 1, l->cid_num)) {
if (!ast_matchmore_extension(c, c->context, l->lastnumberdialed, 1, l->cid_num)) {
ast_copy_string(c->exten, l->lastnumberdialed, sizeof(c->exten));
- if (!ast_strlen_zero(l->cid_num)) {
- if (!l->hidecallerid) {
- c->cid.cid_num = strdup(l->cid_num);
- c->cid.cid_ani = strdup(l->cid_num);
- }
- }
+ ast_set_callerid(c,
+ l->hidecallerid ? "" : l->cid_num,
+ l->hidecallerid ? "" : l->cid_name,
+ c->cid.cid_ani ? NULL : l->cid_num);
ast_setstate(c, AST_STATE_RING);
res = ast_pbx_run(c);
if (res) {
@@ -2766,12 +2761,10 @@
if (!ast_matchmore_extension(c, c->context, sd->exten, 1, l->cid_num)) {
ast_copy_string(c->exten, sd->exten, sizeof(c->exten));
ast_copy_string(l->lastnumberdialed, sd->exten, sizeof(l->lastnumberdialed));
- if (!ast_strlen_zero(l->cid_num)) {
- if (!l->hidecallerid) {
- c->cid.cid_num = strdup(l->cid_num);
- c->cid.cid_ani = strdup(l->cid_num);
- }
- }
+ ast_set_callerid(c,
+ l->hidecallerid ? "" : l->cid_num,
+ l->hidecallerid ? "" : l->cid_name,
+ c->cid.cid_ani ? NULL : l->cid_num);
ast_setstate(c, AST_STATE_RING);
res = ast_pbx_run(c);
if (res) {
@@ -3422,12 +3415,10 @@
if (ast_exists_extension(c, c->context, l->lastnumberdialed, 1, l->cid_num)) {
if (!ast_matchmore_extension(c, c->context, l->lastnumberdialed, 1, l->cid_num)) {
ast_copy_string(c->exten, l->lastnumberdialed, sizeof(c->exten));
- if (!ast_strlen_zero(l->cid_num)) {
- if (!l->hidecallerid) {
- c->cid.cid_num = strdup(l->cid_num);
- c->cid.cid_ani = strdup(l->cid_num);
- }
- }
+ ast_set_callerid(c,
+ l->hidecallerid ? "" : l->cid_num,
+ l->hidecallerid ? "" : l->cid_name,
+ c->cid.cid_ani ? NULL : l->cid_num);
ast_setstate(c, AST_STATE_RING);
res = ast_pbx_run(c);
if (res) {
Modified: trunk/channels/chan_vpb.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_vpb.c?rev=36726&r1=36725&r2=36726&view=diff
==============================================================================
--- trunk/channels/chan_vpb.c (original)
+++ trunk/channels/chan_vpb.c Sun Jul 2 23:25:21 2006
@@ -804,18 +804,14 @@
}
if (number)
ast_shrink_phone_number(number);
- if (!ast_strlen_zero(number)) {
- owner->cid.cid_num = strdup(number);
- owner->cid.cid_ani = strdup(number);
- if (!ast_strlen_zero(name)){
- owner->cid.cid_name = strdup(name);
- snprintf(p->callerid,(sizeof(p->callerid)-1),"%s %s",number,name);
- }
- else {
- snprintf(p->callerid,(sizeof(p->callerid)-1),"%s",number);
- }
- }
-
+ ast_set_callerid(owner,
+ number, name,
+ owner->cid.cid_ani ? NULL : number);
+ if (!ast_strlen_zero(name)){
+ snprintf(p->callerid,(sizeof(p->callerid)-1),"%s %s",number,name);
+ } else {
+ snprintf(p->callerid,(sizeof(p->callerid)-1),"%s",number);
+ }
if (cs)
callerid_free(cs);
}
More information about the asterisk-commits
mailing list