aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_mgcp.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-03 04:19:09 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-03 04:19:09 +0000
commit60f32b41b9db75c382cc8339aa4e2c713b3b5b2a (patch)
treef3793ab046d5cd71925de15d7fd949e84ea541b9 /channels/chan_mgcp.c
parentc7bae4c5900fb330ea3125bb184ada50d929cea4 (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.2@36725 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_mgcp.c')
-rw-r--r--channels/chan_mgcp.c40
1 files changed, 7 insertions, 33 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 7538fd9d7..9fca447b0 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -1428,10 +1428,7 @@ 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);
- 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);
if (!i->adsi)
tmp->adsicpe = AST_ADSI_UNAVAILABLE;
tmp->priority = 1;
@@ -2621,21 +2618,10 @@ static void *mgcp_ss(void *data)
/*res = tone_zone_play_tone(p->subs[index].zfd, -1);*/
ast_indicate(chan, -1);
strncpy(chan->exten, exten, sizeof(chan->exten)-1);
- 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 = strdup(p->cid_num);
- /* SC: free existing chan->callerid */
- if (chan->cid.cid_name)
- free(chan->cid.cid_name);
- chan->cid.cid_name = strdup(p->cid_name);
- }
- if (chan->cid.cid_ani)
- free(chan->cid.cid_ani);
- chan->cid.cid_ani = 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) {
@@ -2692,12 +2678,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;
@@ -2776,14 +2757,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;