[asterisk-commits] rmudgett: branch rmudgett/ani r271087 - in /team/rmudgett/ani: apps/ channels...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jun 16 18:27:22 CDT 2010
Author: rmudgett
Date: Wed Jun 16 18:27:16 2010
New Revision: 271087
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=271087
Log:
Convert ANI in ast_party_caller and ast_party_connected_line into an ast_party_id.
Modified:
team/rmudgett/ani/apps/app_amd.c
team/rmudgett/ani/channels/chan_dahdi.c
team/rmudgett/ani/channels/chan_h323.c
team/rmudgett/ani/channels/chan_iax2.c
team/rmudgett/ani/channels/chan_jingle.c
team/rmudgett/ani/channels/chan_mgcp.c
team/rmudgett/ani/channels/chan_misdn.c
team/rmudgett/ani/channels/chan_oss.c
team/rmudgett/ani/channels/chan_phone.c
team/rmudgett/ani/channels/chan_sip.c
team/rmudgett/ani/channels/chan_skinny.c
team/rmudgett/ani/channels/chan_usbradio.c
team/rmudgett/ani/channels/chan_vpb.cc
team/rmudgett/ani/channels/sig_analog.c
team/rmudgett/ani/channels/sig_pri.c
team/rmudgett/ani/channels/sig_ss7.c
team/rmudgett/ani/funcs/func_callerid.c
team/rmudgett/ani/include/asterisk/channel.h
team/rmudgett/ani/main/cdr.c
team/rmudgett/ani/main/cel.c
team/rmudgett/ani/main/channel.c
team/rmudgett/ani/res/snmp/agent.c
Modified: team/rmudgett/ani/apps/app_amd.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/apps/app_amd.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/apps/app_amd.c (original)
+++ team/rmudgett/ani/apps/app_amd.c Wed Jun 16 18:27:16 2010
@@ -189,7 +189,7 @@
);
ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", chan->name,
- S_OR(chan->caller.ani, "(N/A)"),
+ S_COR(chan->caller.ani.XXX_number.valid, chan->caller.ani.XXX_number.str, "(N/A)"),
S_COR(chan->redirecting.from.XXX_number.valid, chan->redirecting.from.XXX_number.str, "(N/A)"),
ast_getformatname(chan->readformat));
Modified: team/rmudgett/ani/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/chan_dahdi.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/chan_dahdi.c (original)
+++ team/rmudgett/ani/channels/chan_dahdi.c Wed Jun 16 18:27:16 2010
@@ -2851,18 +2851,17 @@
ast_copy_string(p->cid_name,
S_COR(caller->id.XXX_name.valid, caller->id.XXX_name.str, ""),
sizeof(p->cid_name));
- if (caller->id.subaddress.valid) {
- ast_copy_string(p->cid_subaddr, S_OR(caller->id.subaddress.str, ""),
- sizeof(p->cid_subaddr));
- } else {
- p->cid_subaddr[0] = '\0';
- }
+ ast_copy_string(p->cid_subaddr,
+ S_COR(caller->id.subaddress.valid, caller->id.subaddress.str, ""),
+ sizeof(p->cid_subaddr));
p->cid_ton = caller->id.XXX_number.plan;
p->callingpres = ast_party_id_presentation(&caller->id);
if (caller->id.tag) {
ast_copy_string(p->cid_tag, caller->id.tag, sizeof(p->cid_tag));
}
- ast_copy_string(p->cid_ani, S_OR(caller->ani, ""), sizeof(p->cid_ani));
+ ast_copy_string(p->cid_ani,
+ S_COR(caller->ani.XXX_number.valid, caller->ani.XXX_number.str, ""),
+ sizeof(p->cid_ani));
p->cid_ani2 = caller->ani2;
}
#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
@@ -8112,10 +8111,12 @@
switch (p->whichwink) {
case 0:
ast_debug(1, "ANI2 set to '%d' and ANI is '%s'\n", p->owner->caller.ani2,
- S_OR(p->owner->caller.ani, ""));
+ S_COR(p->owner->caller.ani.XXX_number.valid,
+ p->owner->caller.ani.XXX_number.str, ""));
snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*%d%s#",
p->owner->caller.ani2,
- S_OR(p->owner->caller.ani, ""));
+ S_COR(p->owner->caller.ani.XXX_number.valid,
+ p->owner->caller.ani.XXX_number.str, ""));
break;
case 1:
ast_copy_string(p->dop.dialstr, p->finaldial, sizeof(p->dop.dialstr));
@@ -9126,12 +9127,18 @@
/* Don't use ast_set_callerid() here because it will
* generate a needless NewCallerID event */
#if defined(HAVE_PRI) || defined(HAVE_SS7)
- if (!ast_strlen_zero(i->cid_ani))
- tmp->caller.ani = ast_strdup(i->cid_ani);
- else
- tmp->caller.ani = ast_strdup(i->cid_num);
+ if (!ast_strlen_zero(i->cid_ani)) {
+ tmp->caller.ani.XXX_number.valid = 1;
+ tmp->caller.ani.XXX_number.str = ast_strdup(i->cid_ani);
+ } else if (!ast_strlen_zero(i->cid_num)) {
+ tmp->caller.ani.XXX_number.valid = 1;
+ tmp->caller.ani.XXX_number.str = ast_strdup(i->cid_num);
+ }
#else
- tmp->caller.ani = ast_strdup(i->cid_num);
+ if (!ast_strlen_zero(i->cid_num)) {
+ tmp->caller.ani.XXX_number.valid = 1;
+ tmp->caller.ani.XXX_number.str = ast_strdup(i->cid_num);
+ }
#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
tmp->caller.id.XXX_name.presentation = i->callingpres;
tmp->caller.id.XXX_number.presentation = i->callingpres;
Modified: team/rmudgett/ani/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/chan_h323.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/chan_h323.c (original)
+++ team/rmudgett/ani/channels/chan_h323.c Wed Jun 16 18:27:16 2010
@@ -1077,7 +1077,10 @@
/* Don't use ast_set_callerid() here because it will
* generate a needless NewCallerID event */
- ch->caller.ani = ast_strdup(cid_num);
+ if (!ast_strlen_zero(cid_num)) {
+ ch->caller.ani.XXX_number.valid = 1;
+ ch->caller.ani.XXX_number.str = ast_strdup(cid_num);
+ }
if (pvt->cd.redirect_reason >= 0) {
ch->redirecting.from.XXX_number.valid = 1;
Modified: team/rmudgett/ani/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/chan_iax2.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/chan_iax2.c (original)
+++ team/rmudgett/ani/channels/chan_iax2.c Wed Jun 16 18:27:16 2010
@@ -4963,8 +4963,11 @@
if (n)
iax_ie_append_str(&ied, IAX_IE_CALLING_NAME, n);
- if (ast_test_flag64(iaxs[callno], IAX_SENDANI) && c->connected.ani)
- iax_ie_append_str(&ied, IAX_IE_CALLING_ANI, c->connected.ani);
+ if (ast_test_flag64(iaxs[callno], IAX_SENDANI)
+ && c->connected.ani.XXX_number.valid
+ && c->connected.ani.XXX_number.str) {
+ iax_ie_append_str(&ied, IAX_IE_CALLING_ANI, c->connected.ani.XXX_number.str);
+ }
if (!ast_strlen_zero(c->language))
iax_ie_append_str(&ied, IAX_IE_LANGUAGE, c->language);
@@ -5596,9 +5599,11 @@
/* Don't use ast_set_callerid() here because it will
* generate a NewCallerID event before the NewChannel event */
if (!ast_strlen_zero(i->ani)) {
- tmp->caller.ani = ast_strdup(i->ani);
- } else {
- tmp->caller.ani = ast_strdup(i->cid_num);
+ tmp->caller.ani.XXX_number.valid = 1;
+ tmp->caller.ani.XXX_number.str = ast_strdup(i->ani);
+ } else if (!ast_strlen_zero(i->cid_num)) {
+ tmp->caller.ani.XXX_number.valid = 1;
+ tmp->caller.ani.XXX_number.str = ast_strdup(i->cid_num);
}
tmp->dialed.number.str = ast_strdup(i->dnid);
tmp->redirecting.from.XXX_number.valid = 1;
Modified: team/rmudgett/ani/channels/chan_jingle.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/chan_jingle.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/chan_jingle.c (original)
+++ team/rmudgett/ani/channels/chan_jingle.c Wed Jun 16 18:27:16 2010
@@ -860,7 +860,10 @@
ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
/* Don't use ast_set_callerid() here because it will
* generate an unnecessary NewCallerID event */
- tmp->caller.ani = ast_strdup(i->cid_num);
+ if (!ast_strlen_zero(i->cid_num)) {
+ tmp->caller.ani.XXX_number.valid = 1;
+ tmp->caller.ani.XXX_number.str = ast_strdup(i->cid_num);
+ }
if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s")) {
tmp->dialed.number.str = ast_strdup(i->exten);
}
Modified: team/rmudgett/ani/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/chan_mgcp.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/chan_mgcp.c (original)
+++ team/rmudgett/ani/channels/chan_mgcp.c Wed Jun 16 18:27:16 2010
@@ -1533,7 +1533,10 @@
/* Don't use ast_set_callerid() here because it will
* generate a needless NewCallerID event */
- tmp->caller.ani = ast_strdup(i->cid_num);
+ if (!ast_strlen_zero(i->cid_num)) {
+ tmp->caller.ani.XXX_number.valid = 1;
+ tmp->caller.ani.XXX_number.str = ast_strdup(i->cid_num);
+ }
if (!i->adsi) {
tmp->adsicpe = AST_ADSI_UNAVAILABLE;
@@ -2973,7 +2976,7 @@
ast_set_callerid(chan,
p->hidecallerid ? "" : p->cid_num,
p->hidecallerid ? "" : p->cid_name,
- chan->caller.ani ? NULL : p->cid_num);
+ chan->caller.ani.XXX_number.valid ? NULL : p->cid_num);
ast_setstate(chan, AST_STATE_RING);
/*dahdi_enable_ec(p);*/
if (p->dtmfmode & MGCP_DTMF_HYBRID) {
Modified: team/rmudgett/ani/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/chan_misdn.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/chan_misdn.c (original)
+++ team/rmudgett/ani/channels/chan_misdn.c Wed Jun 16 18:27:16 2010
@@ -7893,7 +7893,8 @@
static struct ast_channel *misdn_new(struct chan_list *chlist, int state, char *exten, char *callerid, int format, const char *linkedid, int port, int c)
{
struct ast_channel *tmp;
- char *cid_name = 0, *cid_num = 0;
+ char *cid_name = NULL;
+ char *cid_num = NULL;
int chan_offset = 0;
int tmp_port = misdn_cfg_get_next_port(0);
int bridging;
@@ -7938,10 +7939,11 @@
chan_misdn_log(1, 0, "misdn_new: no exten given.\n");
}
- if (callerid) {
+ if (!ast_strlen_zero(cid_num)) {
/* Don't use ast_set_callerid() here because it will
* generate a needless NewCallerID event */
- tmp->caller.ani = ast_strdup(cid_num);
+ tmp->caller.ani.XXX_number.valid = 1;
+ tmp->caller.ani.XXX_number.str = ast_strdup(cid_num);
}
if (pipe(chlist->pipe) < 0) {
Modified: team/rmudgett/ani/channels/chan_oss.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/chan_oss.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/chan_oss.c (original)
+++ team/rmudgett/ani/channels/chan_oss.c Wed Jun 16 18:27:16 2010
@@ -807,7 +807,10 @@
ast_string_field_set(c, language, o->language);
/* Don't use ast_set_callerid() here because it will
* generate a needless NewCallerID event */
- c->caller.ani = ast_strdup(o->cid_num);
+ if (!ast_strlen_zero(o->cid_num)) {
+ c->caller.ani.XXX_number.valid = 1;
+ c->caller.ani.XXX_number.str = ast_strdup(o->cid_num);
+ }
if (!ast_strlen_zero(ext)) {
c->dialed.number.str = ast_strdup(ext);
}
Modified: team/rmudgett/ani/channels/chan_phone.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/chan_phone.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/chan_phone.c (original)
+++ team/rmudgett/ani/channels/chan_phone.c Wed Jun 16 18:27:16 2010
@@ -888,7 +888,10 @@
/* Don't use ast_set_callerid() here because it will
* generate a NewCallerID event before the NewChannel event */
- tmp->caller.ani = ast_strdup(i->cid_num);
+ if (!ast_strlen_zero(i->cid_num)) {
+ tmp->caller.ani.XXX_number.valid = 1;
+ tmp->caller.ani.XXX_number.str = ast_strdup(i->cid_num);
+ }
i->owner = tmp;
ast_module_ref(ast_module_info->self);
Modified: team/rmudgett/ani/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/chan_sip.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/chan_sip.c (original)
+++ team/rmudgett/ani/channels/chan_sip.c Wed Jun 16 18:27:16 2010
@@ -6525,7 +6525,10 @@
/* Don't use ast_set_callerid() here because it will
* generate an unnecessary NewCallerID event */
- tmp->caller.ani = ast_strdup(i->cid_num);
+ if (!ast_strlen_zero(i->cid_num)) {
+ tmp->caller.ani.XXX_number.valid = 1;
+ tmp->caller.ani.XXX_number.str = ast_strdup(i->cid_num);
+ }
if (!ast_strlen_zero(i->rdnis)) {
tmp->redirecting.from.XXX_number.valid = 1;
tmp->redirecting.from.XXX_number.str = ast_strdup(i->rdnis);
Modified: team/rmudgett/ani/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/chan_skinny.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/chan_skinny.c (original)
+++ team/rmudgett/ani/channels/chan_skinny.c Wed Jun 16 18:27:16 2010
@@ -3768,7 +3768,7 @@
ast_set_callerid(c,
l->hidecallerid ? "" : l->cid_num,
l->hidecallerid ? "" : l->cid_name,
- c->caller.ani ? NULL : l->cid_num);
+ c->caller.ani.XXX_number.valid ? NULL : l->cid_num);
#if 1 /* XXX This code is probably not necessary */
ast_party_number_free(&c->connected.id.XXX_number);
ast_party_number_init(&c->connected.id.XXX_number);
@@ -4567,7 +4567,10 @@
/* Don't use ast_set_callerid() here because it will
* generate a needless NewCallerID event */
- tmp->caller.ani = ast_strdup(l->cid_num);
+ if (!ast_strlen_zero(l->cid_num)) {
+ tmp->caller.ani.XXX_number.valid = 1;
+ tmp->caller.ani.XXX_number.str = ast_strdup(l->cid_num);
+ }
tmp->priority = 1;
tmp->adsicpe = AST_ADSI_UNAVAILABLE;
Modified: team/rmudgett/ani/channels/chan_usbradio.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/chan_usbradio.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/chan_usbradio.c (original)
+++ team/rmudgett/ani/channels/chan_usbradio.c Wed Jun 16 18:27:16 2010
@@ -2201,7 +2201,10 @@
ast_string_field_set(c, language, o->language);
/* Don't use ast_set_callerid() here because it will
* generate a needless NewCallerID event */
- c->caller.ani = ast_strdup(o->cid_num);
+ if (!ast_strlen_zero(o->cid_num)) {
+ c->caller.ani.XXX_number.valid = 1;
+ c->caller.ani.XXX_number.str = ast_strdup(o->cid_num);
+ }
if (!ast_strlen_zero(ext)) {
c->dialed.number.str = ast_strdup(ext);
}
Modified: team/rmudgett/ani/channels/chan_vpb.cc
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/chan_vpb.cc?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/chan_vpb.cc (original)
+++ team/rmudgett/ani/channels/chan_vpb.cc Wed Jun 16 18:27:16 2010
@@ -788,7 +788,7 @@
ast_shrink_phone_number(number);
ast_set_callerid(owner,
number, name,
- owner->caller.ani ? NULL : number);
+ owner->caller.ani.XXX_number.valid ? NULL : number);
if (!ast_strlen_zero(name)){
snprintf(p->callerid, sizeof(p->callerid), "%s %s", number, name);
} else {
Modified: team/rmudgett/ani/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/sig_analog.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/sig_analog.c (original)
+++ team/rmudgett/ani/channels/sig_analog.c Wed Jun 16 18:27:16 2010
@@ -3039,10 +3039,12 @@
switch (p->whichwink) {
case 0:
ast_debug(1, "ANI2 set to '%d' and ANI is '%s'\n", p->owner->caller.ani2,
- S_OR(p->owner->caller.ani, ""));
+ S_COR(p->owner->caller.ani.XXX_number.valid,
+ p->owner->caller.ani.XXX_number.str, ""));
snprintf(p->dop.dialstr, sizeof(p->dop.dialstr), "M*%d%s#",
p->owner->caller.ani2,
- S_OR(p->owner->caller.ani, ""));
+ S_COR(p->owner->caller.ani.XXX_number.valid,
+ p->owner->caller.ani.XXX_number.str, ""));
break;
case 1:
ast_copy_string(p->dop.dialstr, p->finaldial, sizeof(p->dop.dialstr));
Modified: team/rmudgett/ani/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/sig_pri.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/sig_pri.c (original)
+++ team/rmudgett/ani/channels/sig_pri.c Wed Jun 16 18:27:16 2010
@@ -223,7 +223,12 @@
caller.id.subaddress.str = p->cid_subaddr;
}
caller.id.tag = p->user_tag;
- caller.ani = p->cid_ani;
+
+ caller.ani.XXX_number.str = p->cid_ani;
+ //caller.ani.XXX_number.plan = p->xxx;
+ //caller.ani.XXX_number.presentation = p->xxx;
+ caller.ani.XXX_number.valid = 1;
+
caller.ani2 = p->cid_ani2;
p->calls->set_callerid(p->chan_pvt, &caller);
}
Modified: team/rmudgett/ani/channels/sig_ss7.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/channels/sig_ss7.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/channels/sig_ss7.c (original)
+++ team/rmudgett/ani/channels/sig_ss7.c Wed Jun 16 18:27:16 2010
@@ -140,7 +140,12 @@
//caller.id.subaddress.odd_even_indicator = 0;
caller.id.subaddress.str = p->cid_subaddr;
}
- caller.ani = p->cid_ani;
+
+ caller.ani.XXX_number.str = p->cid_ani;
+ //caller.ani.XXX_number.plan = p->xxx;
+ //caller.ani.XXX_number.presentation = p->xxx;
+ caller.ani.XXX_number.valid = 1;
+
caller.ani2 = p->cid_ani2;
p->calls->set_callerid(p->chan_pvt, &caller);
}
Modified: team/rmudgett/ani/funcs/func_callerid.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/funcs/func_callerid.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/funcs/func_callerid.c (original)
+++ team/rmudgett/ani/funcs/func_callerid.c Wed Jun 16 18:27:16 2010
@@ -946,9 +946,21 @@
}
} else if (member.argc == 1 && !strcasecmp("ani2", member.argv[0])) {
snprintf(buf, len, "%d", chan->caller.ani2);
- } else if (member.argc == 1 && !strcasecmp("ani", member.argv[0])) {
- if (chan->caller.ani) {
- ast_copy_string(buf, chan->caller.ani, len);
+ } else if (!strcasecmp("ani", member.argv[0])) {
+ if (member.argc == 1) {
+ /* Setup as if user had given ani-num instead. */
+ member.argc = 2;
+ member.argv[1] = "num";
+ }
+ status = party_id_read(buf, len, member.argc - 1, member.argv + 1,
+ &chan->caller.ani);
+ switch (status) {
+ case ID_FIELD_VALID:
+ case ID_FIELD_INVALID:
+ break;
+ default:
+ ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
+ break;
}
} else {
status = party_id_read(buf, len, member.argc, member.argv, &chan->caller.id);
@@ -1090,13 +1102,26 @@
} else {
ast_log(LOG_ERROR, "Unknown callerid ani2 '%s', value unchanged\n", val);
}
- } else if (member.argc == 1 && !strcasecmp("ani", member.argv[0])) {
+ } else if (!strcasecmp("ani", member.argv[0])) {
ast_party_caller_set_init(&caller, &chan->caller);
- caller.ani = ast_strdup(value);
- ast_trim_blanks(caller.ani);
- ast_party_caller_set(&chan->caller, &caller, NULL);
- if (chan->cdr) {
- ast_cdr_setcid(chan->cdr, chan);
+ if (member.argc == 1) {
+ /* Setup as if user had given ani-num instead. */
+ member.argc = 2;
+ member.argv[1] = "num";
+ }
+ status = party_id_write(&caller.ani, member.argc - 1, member.argv + 1, value);
+ switch (status) {
+ case ID_FIELD_VALID:
+ ast_party_caller_set(&chan->caller, &caller, NULL);
+ if (chan->cdr) {
+ ast_cdr_setcid(chan->cdr, chan);
+ }
+ break;
+ case ID_FIELD_INVALID:
+ break;
+ default:
+ ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
+ break;
}
ast_party_caller_free(&caller);
} else {
Modified: team/rmudgett/ani/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/include/asterisk/channel.h?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/include/asterisk/channel.h (original)
+++ team/rmudgett/ani/include/asterisk/channel.h Wed Jun 16 18:27:16 2010
@@ -370,10 +370,11 @@
struct ast_party_id id;
/*!
- * \brief Automatic Number Identification (ANI) (Malloced)
- * \todo BUGBUG This should be made an ast_party_id.
+ * \brief Automatic Number Identification (ANI)
+ * \note The name subcomponent is only likely to be used by SIP.
+ * \note The subaddress subcomponent is not likely to be used.
*/
- char *ani;
+ struct ast_party_id ani;
/*! \brief Automatic Number Identification 2 (Info Digits) */
int ani2;
@@ -386,6 +387,8 @@
struct ast_set_party_caller {
/*! What caller id information to set. */
struct ast_set_party_id id;
+ /*! What ANI id information to set. */
+ struct ast_set_party_id ani;
};
/*!
@@ -400,12 +403,11 @@
struct ast_party_id id;
/*!
- * \brief Automatic Number Identification (ANI) (Malloced)
+ * \brief Automatic Number Identification (ANI)
* \note Not really part of connected line data but needed to
* save the corresponding caller id value.
- * \todo BUGBUG This should be made an ast_party_id.
*/
- char *ani;
+ struct ast_party_id ani;
/*!
* \brief Automatic Number Identification 2 (Info Digits)
@@ -429,6 +431,8 @@
struct ast_set_party_connected_line {
/*! What connected line id information to set. */
struct ast_set_party_id id;
+ /*! What ANI id information to set. */
+ struct ast_set_party_id ani;
};
/*!
Modified: team/rmudgett/ani/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/main/cdr.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/main/cdr.c (original)
+++ team/rmudgett/ani/main/cdr.c Wed Jun 16 18:27:16 2010
@@ -852,7 +852,7 @@
}
/* Grab source from ANI or normal Caller*ID */
- num = S_OR(c->caller.ani,
+ num = S_COR(c->caller.ani.XXX_number.valid, c->caller.ani.XXX_number.str,
S_COR(c->caller.id.XXX_number.valid, c->caller.id.XXX_number.str, NULL));
ast_callerid_merge(cdr->clid, sizeof(cdr->clid),
S_COR(c->caller.id.XXX_name.valid, c->caller.id.XXX_name.str, NULL), num, "");
Modified: team/rmudgett/ani/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/main/cel.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/main/cel.c (original)
+++ team/rmudgett/ani/main/cel.c Wed Jun 16 18:27:16 2010
@@ -441,7 +441,8 @@
tchan->caller.id.XXX_name.str = ast_strdup(record.caller_id_name);
tchan->caller.id.XXX_number.valid = 1;
tchan->caller.id.XXX_number.str = ast_strdup(record.caller_id_num);
- tchan->caller.ani = ast_strdup(record.caller_id_ani);
+ tchan->caller.ani.XXX_number.valid = 1;
+ tchan->caller.ani.XXX_number.str = ast_strdup(record.caller_id_ani);
tchan->redirecting.from.XXX_number.valid = 1;
tchan->redirecting.from.XXX_number.str = ast_strdup(record.caller_id_rdnis);
tchan->dialed.number.str = ast_strdup(record.caller_id_dnid);
@@ -538,7 +539,7 @@
AST_EVENT_IE_CEL_CIDNUM, AST_EVENT_IE_PLTYPE_STR,
S_COR(chan->caller.id.XXX_number.valid, chan->caller.id.XXX_number.str, ""),
AST_EVENT_IE_CEL_CIDANI, AST_EVENT_IE_PLTYPE_STR,
- S_OR(chan->caller.ani, ""),
+ S_COR(chan->caller.ani.XXX_number.valid, chan->caller.ani.XXX_number.str, ""),
AST_EVENT_IE_CEL_CIDRDNIS, AST_EVENT_IE_PLTYPE_STR,
S_COR(chan->redirecting.from.XXX_number.valid, chan->redirecting.from.XXX_number.str, ""),
AST_EVENT_IE_CEL_CIDDNID, AST_EVENT_IE_PLTYPE_STR,
Modified: team/rmudgett/ani/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/main/channel.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/main/channel.c (original)
+++ team/rmudgett/ani/main/channel.c Wed Jun 16 18:27:16 2010
@@ -1928,7 +1928,7 @@
void ast_party_caller_init(struct ast_party_caller *init)
{
ast_party_id_init(&init->id);
- init->ani = NULL;
+ ast_party_id_init(&init->ani);
init->ani2 = 0;
}
@@ -1940,44 +1940,34 @@
}
ast_party_id_copy(&dest->id, &src->id);
-
- ast_free(dest->ani);
- dest->ani = ast_strdup(src->ani);
-
+ ast_party_id_copy(&dest->ani, &src->ani);
dest->ani2 = src->ani2;
}
void ast_party_caller_set_init(struct ast_party_caller *init, const struct ast_party_caller *guide)
{
ast_party_id_set_init(&init->id, &guide->id);
- init->ani = NULL;
+ ast_party_id_set_init(&init->ani, &guide->ani);
init->ani2 = guide->ani2;
}
void ast_party_caller_set(struct ast_party_caller *dest, const struct ast_party_caller *src, const struct ast_set_party_caller *update)
{
ast_party_id_set(&dest->id, &src->id, update ? &update->id : NULL);
-
- if (src->ani && src->ani != dest->ani) {
- ast_free(dest->ani);
- dest->ani = ast_strdup(src->ani);
- }
-
+ ast_party_id_set(&dest->ani, &src->ani, update ? &update->ani : NULL);
dest->ani2 = src->ani2;
}
void ast_party_caller_free(struct ast_party_caller *doomed)
{
ast_party_id_free(&doomed->id);
-
- ast_free(doomed->ani);
- doomed->ani = NULL;
+ ast_party_id_free(&doomed->ani);
}
void ast_party_connected_line_init(struct ast_party_connected_line *init)
{
ast_party_id_init(&init->id);
- init->ani = NULL;
+ ast_party_id_init(&init->ani);
init->ani2 = 0;
init->source = AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN;
}
@@ -1990,10 +1980,7 @@
}
ast_party_id_copy(&dest->id, &src->id);
-
- ast_free(dest->ani);
- dest->ani = ast_strdup(src->ani);
-
+ ast_party_id_copy(&dest->ani, &src->ani);
dest->ani2 = src->ani2;
dest->source = src->source;
}
@@ -2001,7 +1988,7 @@
void ast_party_connected_line_set_init(struct ast_party_connected_line *init, const struct ast_party_connected_line *guide)
{
ast_party_id_set_init(&init->id, &guide->id);
- init->ani = NULL;
+ ast_party_id_set_init(&init->ani, &guide->ani);
init->ani2 = guide->ani2;
init->source = guide->source;
}
@@ -2009,12 +1996,7 @@
void ast_party_connected_line_set(struct ast_party_connected_line *dest, const struct ast_party_connected_line *src, const struct ast_set_party_connected_line *update)
{
ast_party_id_set(&dest->id, &src->id, update ? &update->id : NULL);
-
- if (src->ani && src->ani != dest->ani) {
- ast_free(dest->ani);
- dest->ani = ast_strdup(src->ani);
- }
-
+ ast_party_id_set(&dest->ani, &src->ani, update ? &update->ani : NULL);
dest->ani2 = src->ani2;
dest->source = src->source;
}
@@ -2030,9 +2012,7 @@
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
{
ast_party_id_free(&doomed->id);
-
- ast_free(doomed->ani);
- doomed->ani = NULL;
+ ast_party_id_free(&doomed->ani);
}
void ast_party_redirecting_init(struct ast_party_redirecting *init)
@@ -5997,8 +5977,9 @@
chan->caller.id.XXX_name.str = ast_strdup(cid_name);
}
if (cid_ani) {
- ast_free(chan->caller.ani);
- chan->caller.ani = ast_strdup(cid_ani);
+ chan->caller.ani.XXX_number.valid = 1;
+ ast_free(chan->caller.ani.XXX_number.str);
+ chan->caller.ani.XXX_number.str = ast_strdup(cid_ani);
}
report_new_callerid(chan);
@@ -7244,19 +7225,14 @@
void ast_connected_line_copy_from_caller(struct ast_party_connected_line *dest, const struct ast_party_caller *src)
{
ast_party_id_copy(&dest->id, &src->id);
-
- ast_free(dest->ani);
- dest->ani = ast_strdup(src->ani);
-
+ ast_party_id_copy(&dest->ani, &src->ani);
dest->ani2 = src->ani2;
}
void ast_connected_line_copy_to_caller(struct ast_party_caller *dest, const struct ast_party_connected_line *src)
{
ast_party_id_copy(&dest->id, &src->id);
-
- ast_free(dest->ani);
- dest->ani = ast_strdup(src->ani);
+ ast_party_id_copy(&dest->ani, &src->ani);
dest->ani2 = src->ani2;
}
Modified: team/rmudgett/ani/res/snmp/agent.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/ani/res/snmp/agent.c?view=diff&rev=271087&r1=271086&r2=271087
==============================================================================
--- team/rmudgett/ani/res/snmp/agent.c (original)
+++ team/rmudgett/ani/res/snmp/agent.c Wed Jun 16 18:27:16 2010
@@ -443,8 +443,8 @@
}
break;
case ASTCHANCIDANI:
- if (chan->caller.ani) {
- strncpy(string_ret, chan->caller.ani, sizeof(string_ret));
+ if (chan->caller.ani.XXX_number.valid && chan->caller.ani.XXX_number.str) {
+ strncpy(string_ret, chan->caller.ani.XXX_number.str, sizeof(string_ret));
string_ret[sizeof(string_ret) - 1] = '\0';
*var_len = strlen(string_ret);
ret = (u_char *)string_ret;
More information about the asterisk-commits
mailing list