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
1.4
Russell Bryant 19 years ago
parent 03a277c5cc
commit 73e8e2ab1f

@ -640,12 +640,8 @@ static int agent_call(struct ast_channel *ast, char *dest, int timeout)
/* 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);

@ -786,16 +786,15 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c
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);
}

@ -3287,12 +3287,7 @@ 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);
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))

@ -761,10 +761,7 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt *
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;

@ -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;

@ -991,12 +991,9 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o,
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);

@ -857,10 +857,7 @@ 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))
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++;

@ -3687,10 +3687,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
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"))

@ -2093,12 +2093,10 @@ static void *skinny_ss(void *data)
} 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 @@ static struct ast_channel *skinny_new(struct skinny_line *l, int state)
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 @@ static int handle_stimulus_message(skinny_req *req, struct skinnysession *s)
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 @@ static int handle_stimulus_message(skinny_req *req, struct skinnysession *s)
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 @@ static int handle_soft_key_event_message(skinny_req *req, struct skinnysession *
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) {

@ -804,18 +804,14 @@ static void get_callerid_ast(struct vpb_pvt *p)
}
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);
}

Loading…
Cancel
Save