aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_skinny.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_skinny.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_skinny.c')
-rw-r--r--channels/chan_skinny.c38
1 files changed, 8 insertions, 30 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 37321a355..c35b02810 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -1741,11 +1741,12 @@ static void *skinny_ss(void *data)
getforward = 0;
} else {
strncpy(chan->exten, exten, sizeof(chan->exten)-1);
+
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) {
@@ -1792,14 +1793,7 @@ static void *skinny_ss(void *data)
}
/* Disable Caller*ID if enabled */
l->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);
transmit_tone(s, SKINNY_DIALTONE);
len = 0;
memset(exten, 0, sizeof(exten));
@@ -1873,18 +1867,7 @@ static void *skinny_ss(void *data)
}
/* Enable Caller*ID if enabled */
l->hidecallerid = 0;
- if (chan->cid.cid_num) {
- free(chan->cid.cid_num);
- }
- if (!ast_strlen_zero(l->cid_num)) {
- chan->cid.cid_num = strdup(l->cid_num);
- }
- if (chan->cid.cid_name) {
- free(chan->cid.cid_name);
- }
- if (!ast_strlen_zero(l->cid_name)) {
- chan->cid.cid_name = strdup(l->cid_name);
- }
+ ast_set_callerid(chan, l->cid_num, l->cid_name, NULL);
transmit_tone(s, SKINNY_DIALTONE);
len = 0;
memset(exten, 0, sizeof(exten));
@@ -2296,12 +2279,7 @@ 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);
- if (!ast_strlen_zero(l->cid_num)) {
- tmp->cid.cid_num = strdup(l->cid_num);
- }
- if (!ast_strlen_zero(l->cid_name)) {
- tmp->cid.cid_name = 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;