[asterisk-commits] rmudgett: branch rmudgett/cid r264574 - in /team/rmudgett/cid: apps/ channels...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu May 20 11:24:34 CDT 2010
Author: rmudgett
Date: Thu May 20 11:24:30 2010
New Revision: 264574
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=264574
Log:
Eliminate the ast_channel.dialed.number.valid flag.
It is not really needed. An incoming call should always have a DNID
number. An outgoing call channel structure does not have a DNID value
unless it is copied from the bridged incoming channel. The fact that the
dialed number string is a NULL pointer can be used to infer if it is
valid.
Modified:
team/rmudgett/cid/apps/app_dial.c
team/rmudgett/cid/apps/app_dumpchan.c
team/rmudgett/cid/apps/app_queue.c
team/rmudgett/cid/channels/chan_dahdi.c
team/rmudgett/cid/channels/chan_gtalk.c
team/rmudgett/cid/channels/chan_h323.c
team/rmudgett/cid/channels/chan_iax2.c
team/rmudgett/cid/channels/chan_jingle.c
team/rmudgett/cid/channels/chan_mgcp.c
team/rmudgett/cid/channels/chan_misdn.c
team/rmudgett/cid/channels/chan_oss.c
team/rmudgett/cid/channels/chan_sip.c
team/rmudgett/cid/channels/chan_usbradio.c
team/rmudgett/cid/channels/sig_pri.c
team/rmudgett/cid/funcs/func_callerid.c
team/rmudgett/cid/include/asterisk/channel.h
team/rmudgett/cid/main/cdr.c
team/rmudgett/cid/main/cel.c
team/rmudgett/cid/main/channel.c
team/rmudgett/cid/main/cli.c
team/rmudgett/cid/res/res_agi.c
team/rmudgett/cid/res/snmp/agent.c
Modified: team/rmudgett/cid/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_dial.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/apps/app_dial.c (original)
+++ team/rmudgett/cid/apps/app_dial.c Thu May 20 11:24:30 2010
@@ -2032,8 +2032,7 @@
caller.id = chan->connected.id;
caller.ani = chan->connected.ani;
ast_channel_set_caller_event(tc, &caller);
- } else if (chan->dialed.number.valid
- && !ast_strlen_zero(chan->dialed.number.str)) {
+ } else if (!ast_strlen_zero(chan->dialed.number.str)) {
ast_set_callerid(tc, chan->dialed.number.str, NULL, NULL);
} else if (!ast_strlen_zero(S_OR(chan->macroexten, chan->exten))) {
ast_set_callerid(tc, S_OR(chan->macroexten, chan->exten), NULL, NULL);
Modified: team/rmudgett/cid/apps/app_dumpchan.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_dumpchan.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/apps/app_dumpchan.c (original)
+++ team/rmudgett/cid/apps/app_dumpchan.c Thu May 20 11:24:30 2010
@@ -118,7 +118,7 @@
c->uniqueid,
S_COR(c->caller.id.XXX_number.valid, c->caller.id.XXX_number.str, "(N/A)"),
S_COR(c->caller.id.XXX_name.valid, c->caller.id.XXX_name.str, "(N/A)"),
- S_COR(c->dialed.number.valid, c->dialed.number.str, "(N/A)"),
+ S_OR(c->dialed.number.str, "(N/A)"),
S_COR(c->redirecting.from.XXX_number.valid, c->redirecting.from.XXX_number.str, "(N/A)"),
c->parkinglot,
c->language,
Modified: team/rmudgett/cid/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_queue.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/apps/app_queue.c (original)
+++ team/rmudgett/cid/apps/app_queue.c Thu May 20 11:24:30 2010
@@ -2869,8 +2869,7 @@
caller.id = qe->chan->connected.id;
caller.ani = qe->chan->connected.ani;
ast_channel_set_caller_event(tmp->chan, &caller);
- } else if (qe->chan->dialed.number.valid
- && !ast_strlen_zero(qe->chan->dialed.number.str)) {
+ } else if (!ast_strlen_zero(qe->chan->dialed.number.str)) {
ast_set_callerid(tmp->chan, qe->chan->dialed.number.str, NULL, NULL);
} else if (!ast_strlen_zero(S_OR(qe->chan->macroexten, qe->chan->exten))) {
ast_set_callerid(tmp->chan, S_OR(qe->chan->macroexten, qe->chan->exten), NULL, NULL);
Modified: team/rmudgett/cid/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_dahdi.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/channels/chan_dahdi.c (original)
+++ team/rmudgett/cid/channels/chan_dahdi.c Thu May 20 11:24:30 2010
@@ -9027,7 +9027,6 @@
tmp->redirecting.from.XXX_number.str = ast_strdup(i->rdnis);
}
if (!ast_strlen_zero(i->dnid)) {
- tmp->dialed.number.valid = 1;
tmp->dialed.number.str = ast_strdup(i->dnid);
}
Modified: team/rmudgett/cid/channels/chan_gtalk.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_gtalk.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/channels/chan_gtalk.c (original)
+++ team/rmudgett/cid/channels/chan_gtalk.c Thu May 20 11:24:30 2010
@@ -1061,7 +1061,6 @@
ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s")) {
- tmp->dialed.number.valid = 1;
tmp->dialed.number.str = ast_strdup(i->exten);
}
tmp->priority = 1;
Modified: team/rmudgett/cid/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_h323.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/channels/chan_h323.c (original)
+++ team/rmudgett/cid/channels/chan_h323.c Thu May 20 11:24:30 2010
@@ -1089,7 +1089,6 @@
ch->caller.id.XXX_number.plan = pvt->cd.type_of_number;
if (!ast_strlen_zero(pvt->exten) && strcmp(pvt->exten, "s")) {
- ch->dialed.number.valid = 1;
ch->dialed.number.str = ast_strdup(pvt->exten);
}
if (pvt->cd.transfer_capability >= 0)
Modified: team/rmudgett/cid/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_iax2.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/channels/chan_iax2.c (original)
+++ team/rmudgett/cid/channels/chan_iax2.c Thu May 20 11:24:30 2010
@@ -4951,7 +4951,7 @@
if (!ast_strlen_zero(c->language))
iax_ie_append_str(&ied, IAX_IE_LANGUAGE, c->language);
- if (c->dialed.number.valid && !ast_strlen_zero(c->dialed.number.str)) {
+ if (!ast_strlen_zero(c->dialed.number.str)) {
iax_ie_append_str(&ied, IAX_IE_DNID, c->dialed.number.str);
}
if (c->redirecting.from.XXX_number.valid
@@ -5552,7 +5552,6 @@
tmp->cid.cid_ani = ast_strdup(i->ani);
else
tmp->cid.cid_ani = ast_strdup(i->cid_num);
- tmp->dialed.number.valid = 1;
tmp->dialed.number.str = ast_strdup(i->dnid);
tmp->redirecting.from.XXX_number.valid = 1;
tmp->redirecting.from.XXX_number.str = ast_strdup(i->rdnis);
Modified: team/rmudgett/cid/channels/chan_jingle.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_jingle.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/channels/chan_jingle.c (original)
+++ team/rmudgett/cid/channels/chan_jingle.c Thu May 20 11:24:30 2010
@@ -861,7 +861,6 @@
* generate an unnecessary NewCallerID event */
tmp->cid.cid_ani = ast_strdup(i->cid_num);
if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s")) {
- tmp->dialed.number.valid = 1;
tmp->dialed.number.str = ast_strdup(i->exten);
}
tmp->priority = 1;
Modified: team/rmudgett/cid/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_mgcp.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/channels/chan_mgcp.c (original)
+++ team/rmudgett/cid/channels/chan_mgcp.c Thu May 20 11:24:30 2010
@@ -2968,7 +2968,6 @@
/*res = tone_zone_play_tone(p->subs[index].zfd, -1);*/
ast_indicate(chan, -1);
ast_copy_string(chan->exten, p->dtmf_buf, sizeof(chan->exten));
- chan->dialed.number.valid = 1;
chan->dialed.number.str = ast_strdup(p->dtmf_buf);
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
ast_set_callerid(chan,
Modified: team/rmudgett/cid/channels/chan_misdn.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_misdn.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/channels/chan_misdn.c (original)
+++ team/rmudgett/cid/channels/chan_misdn.c Thu May 20 11:24:30 2010
@@ -8650,7 +8650,6 @@
return;
}
chan->priority = notify->priority;
- chan->dialed.number.valid = 1;
ast_free(chan->dialed.number.str);
chan->dialed.number.str = ast_strdup(notify->exten);
Modified: team/rmudgett/cid/channels/chan_oss.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_oss.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/channels/chan_oss.c (original)
+++ team/rmudgett/cid/channels/chan_oss.c Thu May 20 11:24:30 2010
@@ -603,7 +603,7 @@
ast_verbose(" << Call to device '%s' dnid '%s' rdnis '%s' on console from '%s' <%s> >>\n",
dest,
- S_COR(c->dialed.number.valid, c->dialed.number.str, ""),
+ S_OR(c->dialed.number.str, ""),
S_COR(c->redirecting.from.XXX_number.valid, c->redirecting.from.XXX_number.str, ""),
S_COR(c->caller.id.XXX_name.valid, c->caller.id.XXX_name.str, ""),
S_COR(c->caller.id.XXX_number.valid, c->caller.id.XXX_number.str, ""));
@@ -809,7 +809,6 @@
* generate a needless NewCallerID event */
c->cid.cid_ani = ast_strdup(o->cid_num);
if (!ast_strlen_zero(ext)) {
- c->dialed.number.valid = 1;
c->dialed.number.str = ast_strdup(ext);
}
Modified: team/rmudgett/cid/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_sip.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/channels/chan_sip.c (original)
+++ team/rmudgett/cid/channels/chan_sip.c Thu May 20 11:24:30 2010
@@ -6413,7 +6413,6 @@
}
if (!ast_strlen_zero(i->exten) && strcmp(i->exten, "s")) {
- tmp->dialed.number.valid = 1;
tmp->dialed.number.str = ast_strdup(i->exten);
}
Modified: team/rmudgett/cid/channels/chan_usbradio.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/chan_usbradio.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/channels/chan_usbradio.c (original)
+++ team/rmudgett/cid/channels/chan_usbradio.c Thu May 20 11:24:30 2010
@@ -2206,7 +2206,6 @@
c->cid.cid_ani = ast_strdup(o->cid_num);
c->cid.cid_name = ast_strdup(o->cid_name);
if (!ast_strlen_zero(ext)) {
- c->dialed.number.valid = 1;
c->dialed.number.str = ast_strdup(ext);
}
Modified: team/rmudgett/cid/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/sig_pri.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/channels/sig_pri.c (original)
+++ team/rmudgett/cid/channels/sig_pri.c Thu May 20 11:24:30 2010
@@ -1480,7 +1480,6 @@
exten[0] = 's';
exten[1] = '\0';
} else {
- chan->dialed.number.valid = 1;
ast_free(chan->dialed.number.str);
chan->dialed.number.str = ast_strdup(exten);
}
Modified: team/rmudgett/cid/funcs/func_callerid.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/funcs/func_callerid.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/funcs/func_callerid.c (original)
+++ team/rmudgett/cid/funcs/func_callerid.c Thu May 20 11:24:30 2010
@@ -197,7 +197,7 @@
}
}
} else { /* dnid */
- if (chan->dialed.number.valid && chan->dialed.number.str) {
+ if (chan->dialed.number.str) {
ast_copy_string(buf, chan->dialed.number.str, len);
}
}
@@ -292,7 +292,6 @@
chan->dialed.subaddress.str = ast_strdup(value);
}
} else { /* dnid */
- chan->dialed.number.valid = 1;
ast_free(chan->dialed.number.str);
chan->dialed.number.str = ast_strdup(value);
}
Modified: team/rmudgett/cid/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/include/asterisk/channel.h?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/include/asterisk/channel.h (original)
+++ team/rmudgett/cid/include/asterisk/channel.h Thu May 20 11:24:30 2010
@@ -389,9 +389,15 @@
struct ast_party_dialed {
/*!
* \brief Dialed/Called number
- * \note ast_party_dialed.number.presentation is not used.
+ * \note Done this way in case we ever really need to use ast_party_number.
+ * We currently do not need all of the ast_party_number fields.
*/
- struct ast_party_number number;
+ struct {
+ /*! \brief Subscriber phone number (Malloced) */
+ char *str;
+ /*! \brief Q.931 Type-Of-Number and Numbering-Plan encoded fields */
+ int plan;
+ } number;
/*! \brief Dialed/Called subaddress */
struct ast_party_subaddress subaddress;
/*!
Modified: team/rmudgett/cid/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/main/cdr.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/main/cdr.c (original)
+++ team/rmudgett/cid/main/cdr.c Thu May 20 11:24:30 2010
@@ -860,7 +860,7 @@
cdr->clid[0] = '\0';
}
ast_copy_string(cdr->src, S_OR(num, ""), sizeof(cdr->src));
- ast_cdr_setvar(cdr, "dnid", S_COR(c->dialed.number.valid, c->dialed.number.str, ""), 0);
+ ast_cdr_setvar(cdr, "dnid", S_OR(c->dialed.number.str, ""), 0);
if (c->cid.subaddress.valid) {
ast_cdr_setvar(cdr, "callingsubaddr", S_OR(c->cid.subaddress.str, ""), 0);
Modified: team/rmudgett/cid/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/main/cel.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/main/cel.c (original)
+++ team/rmudgett/cid/main/cel.c Thu May 20 11:24:30 2010
@@ -444,7 +444,6 @@
tchan->caller.ani = 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.valid = 1;
tchan->dialed.number.str = ast_strdup(record.caller_id_dnid);
ast_copy_string(tchan->exten, record.extension, sizeof(tchan->exten));
@@ -543,7 +542,7 @@
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,
- S_COR(chan->dialed.number.valid, chan->dialed.number.str, ""),
+ S_OR(chan->dialed.number.str, ""),
AST_EVENT_IE_CEL_EXTEN, AST_EVENT_IE_PLTYPE_STR, chan->exten,
AST_EVENT_IE_CEL_CONTEXT, AST_EVENT_IE_PLTYPE_STR, chan->context,
AST_EVENT_IE_CEL_CHANNAME, AST_EVENT_IE_PLTYPE_STR, chan->name,
Modified: team/rmudgett/cid/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/main/channel.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/main/channel.c (original)
+++ team/rmudgett/cid/main/channel.c Thu May 20 11:24:30 2010
@@ -1818,21 +1818,30 @@
void ast_party_dialed_init(struct ast_party_dialed *init)
{
- ast_party_number_init(&init->number);
+ init->number.str = NULL;
+ init->number.plan = 0;/* Unknown */
ast_party_subaddress_init(&init->subaddress);
init->transit_network_select = 0;
}
void ast_party_dialed_copy(struct ast_party_dialed *dest, const struct ast_party_dialed *src)
{
- ast_party_number_copy(&dest->number, &src->number);
+ if (dest == src) {
+ /* Don't copy to self */
+ return;
+ }
+
+ ast_free(dest->number.str);
+ dest->number.str = ast_strdup(src->number.str);
+ dest->number.plan = src->number.plan;
ast_party_subaddress_copy(&dest->subaddress, &src->subaddress);
dest->transit_network_select = src->transit_network_select;
}
void ast_party_dialed_free(struct ast_party_dialed *doomed)
{
- ast_party_number_free(&doomed->number);
+ ast_free(doomed->number.str);
+ doomed->number.str = NULL;
ast_party_subaddress_free(&doomed->subaddress);
}
Modified: team/rmudgett/cid/main/cli.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/main/cli.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/main/cli.c (original)
+++ team/rmudgett/cid/main/cli.c Thu May 20 11:24:30 2010
@@ -1419,7 +1419,7 @@
c->name, c->tech->type, c->uniqueid, c->linkedid,
S_OR(c->cid.cid_num, "(N/A)"),
S_OR(c->cid.cid_name, "(N/A)"),
- S_COR(c->dialed.number.valid, c->dialed.number.str, "(N/A)"),
+ S_OR(c->dialed.number.str, "(N/A)"),
c->language,
ast_state2str(c->_state), c->_state, c->rings,
ast_getformatname_multiple(nf, sizeof(nf), c->nativeformats),
Modified: team/rmudgett/cid/res/res_agi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/res/res_agi.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/res/res_agi.c (original)
+++ team/rmudgett/cid/res/res_agi.c Thu May 20 11:24:30 2010
@@ -1635,8 +1635,7 @@
ast_agi_send(fd, chan, "agi_callingani2: %d\n", chan->caller.ani2);
ast_agi_send(fd, chan, "agi_callington: %d\n", chan->caller.id.XXX_number.plan);
ast_agi_send(fd, chan, "agi_callingtns: %d\n", chan->dialed.transit_network_select);
- ast_agi_send(fd, chan, "agi_dnid: %s\n",
- S_COR(chan->dialed.number.valid, chan->dialed.number.str, "unknown"));
+ ast_agi_send(fd, chan, "agi_dnid: %s\n", S_OR(chan->dialed.number.str, "unknown"));
ast_agi_send(fd, chan, "agi_rdnis: %s\n",
S_COR(chan->redirecting.from.XXX_number.valid, chan->redirecting.from.XXX_number.str, "unknown"));
Modified: team/rmudgett/cid/res/snmp/agent.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/res/snmp/agent.c?view=diff&rev=264574&r1=264573&r2=264574
==============================================================================
--- team/rmudgett/cid/res/snmp/agent.c (original)
+++ team/rmudgett/cid/res/snmp/agent.c Thu May 20 11:24:30 2010
@@ -419,7 +419,7 @@
ret = (u_char *)&long_ret;
break;
case ASTCHANCIDDNID:
- if (chan->dialed.number.valid && chan->dialed.number.str) {
+ if (chan->dialed.number.str) {
strncpy(string_ret, chan->dialed.number.str, sizeof(string_ret));
string_ret[sizeof(string_ret) - 1] = '\0';
*var_len = strlen(string_ret);
More information about the asterisk-commits
mailing list