diff options
author | Russell Bryant <russell@russellbryant.com> | 2006-07-03 04:25:21 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2006-07-03 04:25:21 +0000 |
commit | 73e8e2ab1fae6c7a83fd98b7997440631b39c912 (patch) | |
tree | 9e29310d1f0916eaa0b2301492a9ed5f1c5e093a /channels/chan_mgcp.c | |
parent | 03a277c5cc64577060d1e614a8e91dc1a30cd089 (diff) |
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)
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@36726 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_mgcp.c')
-rw-r--r-- | channels/chan_mgcp.c | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 9d9499fe6..df7db1b8a 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -1485,8 +1485,7 @@ 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)); - 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 @@ static void *mgcp_ss(void *data) /*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 @@ static void *mgcp_ss(void *data) } /* 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 @@ static void *mgcp_ss(void *data) } /* 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; |