[asterisk-commits] rmudgett: trunk r276393 - in /trunk: apps/ channels/ funcs/ include/asterisk/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 14 11:58:15 CDT 2010
Author: rmudgett
Date: Wed Jul 14 11:58:03 2010
New Revision: 276393
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=276393
Log:
Expand the caller ANI field to an ast_party_id
Expand the ani field in ast_party_caller and ast_party_connected_line to
an ast_party_id.
This is an extension to the ast_callerid restructuring patch in review:
https://reviewboard.asterisk.org/r/702/
Review: https://reviewboard.asterisk.org/r/744/
Modified:
trunk/apps/app_amd.c
trunk/channels/chan_dahdi.c
trunk/channels/chan_h323.c
trunk/channels/chan_iax2.c
trunk/channels/chan_jingle.c
trunk/channels/chan_mgcp.c
trunk/channels/chan_misdn.c
trunk/channels/chan_oss.c
trunk/channels/chan_phone.c
trunk/channels/chan_sip.c
trunk/channels/chan_skinny.c
trunk/channels/chan_usbradio.c
trunk/channels/chan_vpb.cc
trunk/channels/sig_analog.c
trunk/channels/sig_pri.c
trunk/channels/sig_ss7.c
trunk/funcs/func_callerid.c
trunk/include/asterisk/channel.h
trunk/main/cdr.c
trunk/main/cel.c
trunk/main/channel.c
trunk/res/snmp/agent.c
Modified: trunk/apps/app_amd.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_amd.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/apps/app_amd.c (original)
+++ trunk/apps/app_amd.c Wed Jul 14 11:58:03 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.number.valid, chan->caller.ani.number.str, "(N/A)"),
S_COR(chan->redirecting.from.number.valid, chan->redirecting.from.number.str, "(N/A)"),
ast_getformatname(chan->readformat));
Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Wed Jul 14 11:58:03 2010
@@ -2923,18 +2923,17 @@
ast_copy_string(p->cid_name,
S_COR(caller->id.name.valid, caller->id.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.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.number.valid, caller->ani.number.str, ""),
+ sizeof(p->cid_ani));
p->cid_ani2 = caller->ani2;
}
#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
@@ -8187,10 +8186,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.number.valid,
+ p->owner->caller.ani.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.number.valid,
+ p->owner->caller.ani.number.str, ""));
break;
case 1:
ast_copy_string(p->dop.dialstr, p->finaldial, sizeof(p->dop.dialstr));
@@ -9201,12 +9202,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.number.valid = 1;
+ tmp->caller.ani.number.str = ast_strdup(i->cid_ani);
+ } else if (!ast_strlen_zero(i->cid_num)) {
+ tmp->caller.ani.number.valid = 1;
+ tmp->caller.ani.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.number.valid = 1;
+ tmp->caller.ani.number.str = ast_strdup(i->cid_num);
+ }
#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
tmp->caller.id.name.presentation = i->callingpres;
tmp->caller.id.number.presentation = i->callingpres;
Modified: trunk/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_h323.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/chan_h323.c (original)
+++ trunk/channels/chan_h323.c Wed Jul 14 11:58:03 2010
@@ -1082,7 +1082,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.number.valid = 1;
+ ch->caller.ani.number.str = ast_strdup(cid_num);
+ }
if (pvt->cd.redirect_reason >= 0) {
ch->redirecting.from.number.valid = 1;
Modified: trunk/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Wed Jul 14 11:58:03 2010
@@ -4971,8 +4971,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.number.valid
+ && c->connected.ani.number.str) {
+ iax_ie_append_str(&ied, IAX_IE_CALLING_ANI, c->connected.ani.number.str);
+ }
if (!ast_strlen_zero(c->language))
iax_ie_append_str(&ied, IAX_IE_LANGUAGE, c->language);
@@ -5604,9 +5607,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.number.valid = 1;
+ tmp->caller.ani.number.str = ast_strdup(i->ani);
+ } else if (!ast_strlen_zero(i->cid_num)) {
+ tmp->caller.ani.number.valid = 1;
+ tmp->caller.ani.number.str = ast_strdup(i->cid_num);
}
tmp->dialed.number.str = ast_strdup(i->dnid);
tmp->redirecting.from.number.valid = 1;
Modified: trunk/channels/chan_jingle.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_jingle.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/chan_jingle.c (original)
+++ trunk/channels/chan_jingle.c Wed Jul 14 11:58:03 2010
@@ -868,7 +868,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.number.valid = 1;
+ tmp->caller.ani.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: trunk/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_mgcp.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/chan_mgcp.c (original)
+++ trunk/channels/chan_mgcp.c Wed Jul 14 11:58:03 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.number.valid = 1;
+ tmp->caller.ani.number.str = ast_strdup(i->cid_num);
+ }
if (!i->adsi) {
tmp->adsicpe = AST_ADSI_UNAVAILABLE;
@@ -3002,7 +3005,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.number.valid ? NULL : p->cid_num);
ast_setstate(chan, AST_STATE_RING);
/*dahdi_enable_ec(p);*/
if (p->dtmfmode & MGCP_DTMF_HYBRID) {
Modified: trunk/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_misdn.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/chan_misdn.c (original)
+++ trunk/channels/chan_misdn.c Wed Jul 14 11:58:03 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.number.valid = 1;
+ tmp->caller.ani.number.str = ast_strdup(cid_num);
}
if (pipe(chlist->pipe) < 0) {
Modified: trunk/channels/chan_oss.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_oss.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/chan_oss.c (original)
+++ trunk/channels/chan_oss.c Wed Jul 14 11:58:03 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.number.valid = 1;
+ c->caller.ani.number.str = ast_strdup(o->cid_num);
+ }
if (!ast_strlen_zero(ext)) {
c->dialed.number.str = ast_strdup(ext);
}
Modified: trunk/channels/chan_phone.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_phone.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/chan_phone.c (original)
+++ trunk/channels/chan_phone.c Wed Jul 14 11:58:03 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.number.valid = 1;
+ tmp->caller.ani.number.str = ast_strdup(i->cid_num);
+ }
i->owner = tmp;
ast_module_ref(ast_module_info->self);
Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed Jul 14 11:58:03 2010
@@ -6524,7 +6524,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.number.valid = 1;
+ tmp->caller.ani.number.str = ast_strdup(i->cid_num);
+ }
if (!ast_strlen_zero(i->rdnis)) {
tmp->redirecting.from.number.valid = 1;
tmp->redirecting.from.number.str = ast_strdup(i->rdnis);
Modified: trunk/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Wed Jul 14 11:58:03 2010
@@ -3774,7 +3774,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.number.valid ? NULL : l->cid_num);
#if 1 /* XXX This code is probably not necessary */
ast_party_number_free(&c->connected.id.number);
ast_party_number_init(&c->connected.id.number);
@@ -4573,7 +4573,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.number.valid = 1;
+ tmp->caller.ani.number.str = ast_strdup(l->cid_num);
+ }
tmp->priority = 1;
tmp->adsicpe = AST_ADSI_UNAVAILABLE;
Modified: trunk/channels/chan_usbradio.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_usbradio.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/chan_usbradio.c (original)
+++ trunk/channels/chan_usbradio.c Wed Jul 14 11:58:03 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.number.valid = 1;
+ c->caller.ani.number.str = ast_strdup(o->cid_num);
+ }
if (!ast_strlen_zero(ext)) {
c->dialed.number.str = ast_strdup(ext);
}
Modified: trunk/channels/chan_vpb.cc
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_vpb.cc?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/chan_vpb.cc (original)
+++ trunk/channels/chan_vpb.cc Wed Jul 14 11:58:03 2010
@@ -788,7 +788,7 @@
ast_shrink_phone_number(number);
ast_set_callerid(owner,
number, name,
- owner->caller.ani ? NULL : number);
+ owner->caller.ani.number.valid ? NULL : number);
if (!ast_strlen_zero(name)){
snprintf(p->callerid, sizeof(p->callerid), "%s %s", number, name);
} else {
Modified: trunk/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_analog.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/sig_analog.c (original)
+++ trunk/channels/sig_analog.c Wed Jul 14 11:58:03 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.number.valid,
+ p->owner->caller.ani.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.number.valid,
+ p->owner->caller.ani.number.str, ""));
break;
case 1:
ast_copy_string(p->dop.dialstr, p->finaldial, sizeof(p->dop.dialstr));
Modified: trunk/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Wed Jul 14 11:58:03 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.number.str = p->cid_ani;
+ //caller.ani.number.plan = p->xxx;
+ //caller.ani.number.presentation = p->xxx;
+ caller.ani.number.valid = 1;
+
caller.ani2 = p->cid_ani2;
p->calls->set_callerid(p->chan_pvt, &caller);
}
Modified: trunk/channels/sig_ss7.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_ss7.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/channels/sig_ss7.c (original)
+++ trunk/channels/sig_ss7.c Wed Jul 14 11:58:03 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.number.str = p->cid_ani;
+ //caller.ani.number.plan = p->xxx;
+ //caller.ani.number.presentation = p->xxx;
+ caller.ani.number.valid = 1;
+
caller.ani2 = p->cid_ani2;
p->calls->set_callerid(p->chan_pvt, &caller);
}
Modified: trunk/funcs/func_callerid.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_callerid.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/funcs/func_callerid.c (original)
+++ trunk/funcs/func_callerid.c Wed Jul 14 11:58:03 2010
@@ -43,6 +43,9 @@
*
* Do not document the CALLERID(ton) datatype.
* It is an alias for num-plan.
+ *
+ * Do not document the CALLERID(ANI-subaddr-...) datatype.
+ * This is not used.
*
* Do not document the CONNECTEDLINE(source) datatype.
* It has turned out to not be needed. The source value is really
@@ -93,7 +96,16 @@
<enum name = "subaddr-type" />
<enum name = "subaddr-odd" />
<enum name = "tag" />
- <enum name = "ANI" />
+ <enum name = "ANI-all" />
+ <enum name = "ANI-name" />
+ <enum name = "ANI-name-valid" />
+ <enum name = "ANI-name-charset" />
+ <enum name = "ANI-name-pres" />
+ <enum name = "ANI-num" />
+ <enum name = "ANI-num-valid" />
+ <enum name = "ANI-num-plan" />
+ <enum name = "ANI-num-pres" />
+ <enum name = "ANI-tag" />
<enum name = "RDNIS" />
<enum name = "DNID" />
<enum name = "dnid-num-plan" />
@@ -946,9 +958,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 +1114,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: trunk/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/channel.h?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Wed Jul 14 11:58:03 2010
@@ -369,10 +369,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;
@@ -385,6 +386,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;
};
/*!
@@ -399,12 +402,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)
@@ -428,6 +430,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: trunk/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cdr.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Wed Jul 14 11:58:03 2010
@@ -853,7 +853,7 @@
}
/* Grab source from ANI or normal Caller*ID */
- num = S_OR(c->caller.ani,
+ num = S_COR(c->caller.ani.number.valid, c->caller.ani.number.str,
S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL));
ast_callerid_merge(cdr->clid, sizeof(cdr->clid),
S_COR(c->caller.id.name.valid, c->caller.id.name.str, NULL), num, "");
Modified: trunk/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cel.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/main/cel.c (original)
+++ trunk/main/cel.c Wed Jul 14 11:58:03 2010
@@ -441,7 +441,8 @@
tchan->caller.id.name.str = ast_strdup(record.caller_id_name);
tchan->caller.id.number.valid = 1;
tchan->caller.id.number.str = ast_strdup(record.caller_id_num);
- tchan->caller.ani = ast_strdup(record.caller_id_ani);
+ tchan->caller.ani.number.valid = 1;
+ tchan->caller.ani.number.str = ast_strdup(record.caller_id_ani);
tchan->redirecting.from.number.valid = 1;
tchan->redirecting.from.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.number.valid, chan->caller.id.number.str, ""),
AST_EVENT_IE_CEL_CIDANI, AST_EVENT_IE_PLTYPE_STR,
- S_OR(chan->caller.ani, ""),
+ S_COR(chan->caller.ani.number.valid, chan->caller.ani.number.str, ""),
AST_EVENT_IE_CEL_CIDRDNIS, AST_EVENT_IE_PLTYPE_STR,
S_COR(chan->redirecting.from.number.valid, chan->redirecting.from.number.str, ""),
AST_EVENT_IE_CEL_CIDDNID, AST_EVENT_IE_PLTYPE_STR,
Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Wed Jul 14 11:58:03 2010
@@ -2136,7 +2136,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;
}
@@ -2148,44 +2148,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;
}
@@ -2198,10 +2188,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;
}
@@ -2209,7 +2196,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;
}
@@ -2217,12 +2204,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;
}
@@ -2238,9 +2220,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)
@@ -6205,8 +6185,9 @@
chan->caller.id.name.str = ast_strdup(cid_name);
}
if (cid_ani) {
- ast_free(chan->caller.ani);
- chan->caller.ani = ast_strdup(cid_ani);
+ chan->caller.ani.number.valid = 1;
+ ast_free(chan->caller.ani.number.str);
+ chan->caller.ani.number.str = ast_strdup(cid_ani);
}
report_new_callerid(chan);
@@ -7497,19 +7478,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: trunk/res/snmp/agent.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/snmp/agent.c?view=diff&rev=276393&r1=276392&r2=276393
==============================================================================
--- trunk/res/snmp/agent.c (original)
+++ trunk/res/snmp/agent.c Wed Jul 14 11:58:03 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.number.valid && chan->caller.ani.number.str) {
+ strncpy(string_ret, chan->caller.ani.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