[asterisk-commits] rmudgett: branch rmudgett/cid r264382 - in /team/rmudgett/cid: addons/ apps/ ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed May 19 15:26:55 CDT 2010
Author: rmudgett
Date: Wed May 19 15:26:49 2010
New Revision: 264382
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=264382
Log:
* Eliminated uses of the following old ast_party_id members:
number, name, number_type, and number_presentation.
* Made ast_party_id, ast_party_name, ast_party_number, ast_party_called,
ast_party_redirecting, and ast_party_dialed helper functions public.
* Created ast_channel_set_caller() and ast_channel_set_caller_event() to
use in place of ast_set_callerid().
Modified:
team/rmudgett/cid/addons/chan_ooh323.c
team/rmudgett/cid/apps/app_amd.c
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_h323.c
team/rmudgett/cid/channels/chan_iax2.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_phone.c
team/rmudgett/cid/channels/chan_sip.c
team/rmudgett/cid/channels/chan_skinny.c
team/rmudgett/cid/channels/chan_unistim.c
team/rmudgett/cid/channels/sig_analog.c
team/rmudgett/cid/channels/sig_pri.c
team/rmudgett/cid/funcs/func_callerid.c
team/rmudgett/cid/funcs/func_connectedline.c
team/rmudgett/cid/funcs/func_redirecting.c
team/rmudgett/cid/include/asterisk/channel.h
team/rmudgett/cid/main/cel.c
team/rmudgett/cid/main/channel.c
team/rmudgett/cid/res/res_agi.c
team/rmudgett/cid/res/snmp/agent.c
Modified: team/rmudgett/cid/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/addons/chan_ooh323.c?view=diff&rev=264382&r1=264381&r2=264382
==============================================================================
--- team/rmudgett/cid/addons/chan_ooh323.c (original)
+++ team/rmudgett/cid/addons/chan_ooh323.c Wed May 19 15:26:49 2010
@@ -919,24 +919,23 @@
}
ast_mutex_lock(&p->lock);
ast_set_flag(p, H323_OUTGOING);
- if (ast->connected.id.number) {
- if(p->callerid_num) free(p->callerid_num);
- p->callerid_num = strdup(ast->connected.id.number);
- }
-
- if (ast->connected.id.name) {
- if(p->callerid_name)
- free(p->callerid_name);
- p->callerid_name = strdup(ast->connected.id.name);
- } else if (ast->connected.id.number) {
- if(p->callerid_name)
- free(p->callerid_name);
- p->callerid_name = strdup(ast->connected.id.number);
+ if (ast->connected.id.XXX_number.valid && ast->connected.id.XXX_number.str) {
+ free(p->callerid_num);
+ p->callerid_num = strdup(ast->connected.id.XXX_number.str);
+ }
+
+ if (ast->connected.id.XXX_name.valid && ast->connected.id.XXX_name.str) {
+ free(p->callerid_name);
+ p->callerid_name = strdup(ast->connected.id.XXX_name.str);
+ } else if (ast->connected.id.XXX_number.valid && ast->connected.id.XXX_number.str) {
+ free(p->callerid_name);
+ p->callerid_name = strdup(ast->connected.id.XXX_number.str);
} else {
- ast->connected.id.name = strdup(gCallerID);
- if(p->callerid_name)
- free(p->callerid_name);
- p->callerid_name = strdup(ast->connected.id.name);
+ ast->connected.id.XXX_name.valid = 1;
+ free(ast->connected.id.XXX_name.str);
+ ast->connected.id.XXX_name.str = strdup(gCallerID);
+ free(p->callerid_name);
+ p->callerid_name = strdup(ast->connected.id.XXX_name.str);
}
/* Retrieve vars */
@@ -1239,10 +1238,13 @@
ast_rtp_instance_change_source(p->rtp);
break;
case AST_CONTROL_CONNECTED_LINE:
+ if (!ast->connected.id.XXX_name.valid || !ast->connected.id.XXX_name.str) {
+ break;
+ }
if (gH323Debug)
ast_log(LOG_DEBUG, "Sending connected line info for %s (%s)\n",
- callToken, ast->connected.id.name);
- ooSetANI(callToken, ast->connected.id.name);
+ callToken, ast->connected.id.XXX_name.str);
+ ooSetANI(callToken, ast->connected.id.XXX_name.str);
break;
case AST_CONTROL_T38_PARAMETERS:
@@ -1535,7 +1537,8 @@
if (call->remoteDisplayName) {
struct ast_party_connected_line connected;
ast_party_connected_line_init(&connected);
- connected.id.name = (char *) call->remoteDisplayName;
+ connected.id.XXX_name.valid = 1;
+ connected.id.XXX_name.str = (char *) call->remoteDisplayName;
connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
ast_channel_queue_connected_line_update(c, &connected);
}
@@ -1586,7 +1589,8 @@
if (call->remoteDisplayName) {
struct ast_party_connected_line connected;
ast_party_connected_line_init(&connected);
- connected.id.name = (char *) call->remoteDisplayName;
+ connected.id.XXX_name.valid = 1;
+ connected.id.XXX_name.str = (char *) call->remoteDisplayName;
connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
ast_channel_queue_connected_line_update(c, &connected);
}
@@ -1979,7 +1983,8 @@
if (call->remoteDisplayName) {
struct ast_party_connected_line connected;
ast_party_connected_line_init(&connected);
- connected.id.name = (char *) call->remoteDisplayName;
+ connected.id.XXX_name.valid = 1;
+ connected.id.XXX_name.str = (char *) call->remoteDisplayName;
connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
ast_channel_queue_connected_line_update(c, &connected);
}
Modified: team/rmudgett/cid/apps/app_amd.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_amd.c?view=diff&rev=264382&r1=264381&r2=264382
==============================================================================
--- team/rmudgett/cid/apps/app_amd.c (original)
+++ team/rmudgett/cid/apps/app_amd.c Wed May 19 15:26:49 2010
@@ -188,8 +188,10 @@
AST_APP_ARG(argMaximumWordLength);
);
- ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", chan->name, chan->cid.cid_ani,
- chan->redirecting.from.number, ast_getformatname(chan->readformat));
+ ast_verb(3, "AMD: %s %s %s (Fmt: %s)\n", chan->name,
+ S_OR(chan->caller.ani, "(N/A)"),
+ S_COR(chan->redirecting.from.XXX_number.valid, chan->redirecting.from.XXX_number.str, "(N/A)"),
+ ast_getformatname(chan->readformat));
/* Lets parse the arguments. */
if (!ast_strlen_zero(parse)) {
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=264382&r1=264381&r2=264382
==============================================================================
--- team/rmudgett/cid/apps/app_dial.c (original)
+++ team/rmudgett/cid/apps/app_dial.c Wed May 19 15:26:49 2010
@@ -717,13 +717,6 @@
}
}
-/*! \brief free the buffer if allocated, and set the pointer to the second arg */
-#define S_REPLACE(s, new_val) \
- do { \
- ast_free(s); \
- s = (new_val); \
- } while (0)
-
static int onedigit_goto(struct ast_channel *chan, const char *context, char exten, int pri)
{
char rexten[2] = { exten, '\0' };
@@ -859,20 +852,26 @@
while (ast_channel_trylock(in)) {
CHANNEL_DEADLOCK_AVOIDANCE(c);
}
- if (ast_strlen_zero(c->redirecting.from.number)) {
+ if (!c->redirecting.from.XXX_number.valid
+ || ast_strlen_zero(c->redirecting.from.XXX_number.str)) {
/*
* The call was not previously redirected so it is
* now redirected from this number.
*/
- S_REPLACE(c->redirecting.from.number,
- ast_strdup(S_OR(in->macroexten, in->exten)));
+ ast_party_number_free(&c->redirecting.from.XXX_number);
+ ast_party_number_init(&c->redirecting.from.XXX_number);
+ c->redirecting.from.XXX_number.valid = 1;
+ c->redirecting.from.XXX_number.str =
+ ast_strdup(S_OR(in->macroexten, in->exten));
}
c->dialed.transit_network_select = in->dialed.transit_network_select;
if (ast_test_flag64(o, OPT_FORCECLID)) {
- S_REPLACE(c->cid.cid_num, ast_strdup(S_OR(in->macroexten, in->exten)));
- S_REPLACE(c->cid.cid_name, NULL);
+ ast_party_id_free(&c->caller.id);
+ ast_party_id_init(&c->caller.id);
+ c->caller.id.XXX_number.valid = 1;
+ c->caller.id.XXX_number.str = ast_strdup(S_OR(in->macroexten, in->exten));
ast_string_field_set(c, accountcode, c->accountcode);
} else {
ast_party_caller_copy(&c->caller, &in->caller);
@@ -1920,12 +1919,10 @@
datastore = ast_channel_datastore_find(chan, &dialed_interface_info, NULL);
/* If the incoming channel has previously had connected line information
* set on it (perhaps through the CONNECTED_LINE dialplan function) then
- * seed the calllist's connected line information with this previously
+ * seed the chanlist's connected line information with this previously
* acquired info
*/
- if (chan->connected.id.number) {
- ast_party_connected_line_copy(&tmp->connected, &chan->connected);
- }
+ ast_party_connected_line_copy(&tmp->connected, &chan->connected);
ast_channel_unlock(chan);
if (datastore)
@@ -2026,9 +2023,14 @@
memset(&tc->whentohangup, 0, sizeof(tc->whentohangup));
/* If the new channel has no callerid, try to guess what it should be */
- if (ast_strlen_zero(tc->cid.cid_num)) {
- if (!ast_strlen_zero(chan->connected.id.number)) {
- ast_set_callerid(tc, chan->connected.id.number, chan->connected.id.name, chan->connected.ani);
+ if (!tc->caller.id.XXX_number.valid) {
+ if (chan->connected.id.XXX_number.valid) {
+ struct ast_party_caller caller;
+
+ ast_party_caller_set_init(&caller, &tc->caller);
+ 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)) {
ast_set_callerid(tc, chan->dialed.number.str, NULL, NULL);
@@ -2043,17 +2045,25 @@
int pres;
ast_party_connected_line_set_init(&connected, &tmp->chan->connected);
- connected.id.number = cid_num;
- connected.id.name = cid_name;
- connected.id.tag = cid_tag;
if (cid_pres) {
pres = ast_parse_caller_presentation(cid_pres);
- if (pres >= 0) {
- connected.id.number_presentation = pres;
+ if (pres < 0) {
+ pres = AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN;
}
} else {
- connected.id.number_presentation = AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN;
- }
+ pres = AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN;
+ }
+ if (cid_num) {
+ connected.id.XXX_number.valid = 1;
+ connected.id.XXX_number.str = cid_num;
+ connected.id.XXX_number.presentation = pres;
+ }
+ if (cid_name) {
+ connected.id.XXX_name.valid = 1;
+ connected.id.XXX_name.str = cid_name;
+ connected.id.XXX_name.presentation = pres;
+ }
+ connected.id.tag = cid_tag;
ast_channel_set_connected_line(tmp->chan, &connected);
} else {
ast_connected_line_copy_from_caller(&tc->connected, &chan->caller);
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=264382&r1=264381&r2=264382
==============================================================================
--- team/rmudgett/cid/apps/app_dumpchan.c (original)
+++ team/rmudgett/cid/apps/app_dumpchan.c Wed May 19 15:26:49 2010
@@ -116,10 +116,10 @@
c->name,
c->tech->type,
c->uniqueid,
- S_OR(c->cid.cid_num, "(N/A)"),
- S_OR(c->cid.cid_name, "(N/A)"),
+ 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->redirecting.from.number, "(N/A)"),
+ S_COR(c->redirecting.from.XXX_number.valid, c->redirecting.from.XXX_number.str, "(N/A)"),
c->parkinglot,
c->language,
ast_state2str(c->_state),
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=264382&r1=264381&r2=264382
==============================================================================
--- team/rmudgett/cid/apps/app_queue.c (original)
+++ team/rmudgett/cid/apps/app_queue.c Wed May 19 15:26:49 2010
@@ -2861,10 +2861,14 @@
memset(&tmp->chan->whentohangup, 0, sizeof(tmp->chan->whentohangup));
/* If the new channel has no callerid, try to guess what it should be */
- if (ast_strlen_zero(tmp->chan->cid.cid_num)) {
- if (!ast_strlen_zero(qe->chan->connected.id.number)) {
- ast_set_callerid(tmp->chan, qe->chan->connected.id.number, qe->chan->connected.id.name, qe->chan->connected.ani);
- tmp->chan->cid.cid_pres = qe->chan->connected.id.number_presentation;
+ if (!tmp->chan->caller.id.XXX_number.valid) {
+ if (qe->chan->connected.id.XXX_number.valid) {
+ struct ast_party_caller caller;
+
+ ast_party_caller_set_init(&caller, &tmp->chan->caller);
+ 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)) {
ast_set_callerid(tmp->chan, qe->chan->dialed.number.str, NULL, NULL);
@@ -3360,13 +3364,16 @@
ast_string_field_set(o->chan, accountcode, in->accountcode);
ast_channel_set_redirecting(o->chan, &original->redirecting);
- if (ast_strlen_zero(o->chan->redirecting.from.number)) {
+ if (!o->chan->redirecting.from.XXX_number.valid
+ || ast_strlen_zero(o->chan->redirecting.from.XXX_number.str)) {
/*
* The call was not previously redirected so it is
* now redirected from this number.
*/
- ast_free(o->chan->redirecting.from.number);
- o->chan->redirecting.from.number =
+ ast_party_number_free(&o->chan->redirecting.from.XXX_number);
+ ast_party_number_init(&o->chan->redirecting.from.XXX_number);
+ o->chan->redirecting.from.XXX_number.valid = 1;
+ o->chan->redirecting.from.XXX_number.str =
ast_strdup(S_OR(in->macroexten, in->exten));
}
@@ -4239,9 +4246,7 @@
* to seed the connected line information. It may, of course, be updated
* during the call
*/
- if (qe->chan->connected.id.number) {
- ast_party_connected_line_copy(&tmp->connected, &qe->chan->connected);
- }
+ ast_party_connected_line_copy(&tmp->connected, &qe->chan->connected);
ast_channel_unlock(qe->chan);
if (di) {
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=264382&r1=264381&r2=264382
==============================================================================
--- team/rmudgett/cid/channels/chan_dahdi.c (original)
+++ team/rmudgett/cid/channels/chan_dahdi.c Wed May 19 15:26:49 2010
@@ -2801,16 +2801,20 @@
{
struct dahdi_pvt *p = pvt;
- ast_copy_string(p->cid_num, S_OR(caller->id.number, ""), sizeof(p->cid_num));
- ast_copy_string(p->cid_name, S_OR(caller->id.name, ""), sizeof(p->cid_name));
+ ast_copy_string(p->cid_num,
+ S_COR(caller->id.XXX_number.valid, caller->id.XXX_number.str, ""),
+ sizeof(p->cid_num));
+ 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';
}
- p->cid_ton = caller->id.number_type;
- p->callingpres = caller->id.number_presentation;
+ p->cid_ton = caller->id.XXX_number.plan;
+ p->callingpres = ast_party_id_presentation(&caller->id);
ast_copy_string(p->cid_ani, S_OR(caller->ani, ""), sizeof(p->cid_ani));
p->cid_ani2 = caller->ani2;
}
@@ -4926,7 +4930,7 @@
}
if (!p->hidecallerid) {
- l = ast->connected.id.number;
+ l = ast->connected.id.XXX_number.valid ? ast->connected.id.XXX_number.str : NULL;
} else {
l = NULL;
}
@@ -4975,8 +4979,8 @@
}
}
isup_set_calling(p->ss7call, l ? (l + calling_nai_strip) : NULL, ss7_calling_nai,
- p->use_callingpres ? cid_pres2ss7pres(ast->connected.id.number_presentation) : (l ? SS7_PRESENTATION_ALLOWED : SS7_PRESENTATION_RESTRICTED),
- p->use_callingpres ? cid_pres2ss7screen(ast->connected.id.number_presentation) : SS7_SCREENING_USER_PROVIDED );
+ p->use_callingpres ? cid_pres2ss7pres(ast->connected.id.XXX_number.presentation) : (l ? SS7_PRESENTATION_ALLOWED : SS7_PRESENTATION_RESTRICTED),
+ p->use_callingpres ? cid_pres2ss7screen(ast->connected.id.XXX_number.presentation) : SS7_SCREENING_USER_PROVIDED );
isup_set_oli(p->ss7call, ast->connected.ani2);
isup_init_call(p->ss7->ss7, p->ss7call, p->cic, p->dpc);
@@ -9018,8 +9022,10 @@
tmp->adsicpe = AST_ADSI_UNAVAILABLE;
if (!ast_strlen_zero(i->exten))
ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
- if (!ast_strlen_zero(i->rdnis))
- tmp->redirecting.from.number = ast_strdup(i->rdnis);
+ if (!ast_strlen_zero(i->rdnis)) {
+ tmp->redirecting.from.XXX_number.valid = 1;
+ 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);
@@ -9029,16 +9035,17 @@
* generate a needless NewCallerID event */
#ifdef PRI_ANI
if (!ast_strlen_zero(i->cid_ani))
- tmp->cid.cid_ani = ast_strdup(i->cid_ani);
+ tmp->caller.ani = ast_strdup(i->cid_ani);
else
- tmp->cid.cid_ani = ast_strdup(i->cid_num);
+ tmp->caller.ani = ast_strdup(i->cid_num);
#else
- tmp->cid.cid_ani = ast_strdup(i->cid_num);
+ tmp->caller.ani = ast_strdup(i->cid_num);
#endif
- tmp->cid.cid_pres = i->callingpres;
- tmp->cid.cid_ton = i->cid_ton;
- tmp->cid.cid_ani2 = i->cid_ani2;
- tmp->cid.cid_tag = ast_strdup(i->cid_tag);
+ tmp->caller.id.XXX_name.presentation = i->callingpres;
+ tmp->caller.id.XXX_number.presentation = i->callingpres;
+ tmp->caller.id.XXX_number.plan = i->cid_ton;
+ tmp->caller.ani2 = i->cid_ani2;
+ tmp->caller.id.tag = ast_strdup(i->cid_tag);
#if defined(HAVE_SS7)
tmp->transfercapability = transfercapability;
pbx_builtin_setvar_helper(tmp, "TRANSFERCAPABILITY", ast_transfercapability2str(transfercapability));
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=264382&r1=264381&r2=264382
==============================================================================
--- team/rmudgett/cid/channels/chan_h323.c (original)
+++ team/rmudgett/cid/channels/chan_h323.c Wed May 19 15:26:49 2010
@@ -609,18 +609,20 @@
/* make sure null terminated */
called_addr[sizeof(called_addr) - 1] = '\0';
- if (c->connected.id.number)
- ast_copy_string(pvt->options.cid_num, c->connected.id.number, sizeof(pvt->options.cid_num));
-
- if (c->connected.id.name)
- ast_copy_string(pvt->options.cid_name, c->connected.id.name, sizeof(pvt->options.cid_name));
-
- if (c->redirecting.from.number) {
- ast_copy_string(pvt->options.cid_rdnis, c->redirecting.from.number, sizeof(pvt->options.cid_rdnis));
- }
-
- pvt->options.presentation = c->connected.id.number_presentation;
- pvt->options.type_of_number = c->connected.id.number_type;
+ if (c->connected.id.XXX_number.valid && c->connected.id.XXX_number.str) {
+ ast_copy_string(pvt->options.cid_num, c->connected.id.XXX_number.str, sizeof(pvt->options.cid_num));
+ }
+
+ if (c->connected.id.XXX_name.valid && c->connected.id.XXX_name.str) {
+ ast_copy_string(pvt->options.cid_name, c->connected.id.XXX_name.str, sizeof(pvt->options.cid_name));
+ }
+
+ if (c->redirecting.from.XXX_number.valid && c->redirecting.from.XXX_number.str) {
+ ast_copy_string(pvt->options.cid_rdnis, c->redirecting.from.XXX_number.str, sizeof(pvt->options.cid_rdnis));
+ }
+
+ pvt->options.presentation = ast_party_id_presentation(c->connected.id);
+ pvt->options.type_of_number = c->connected.id.XXX_number.plan;
if ((addr = pbx_builtin_getvar_helper(c, "PRIREDIRECTREASON"))) {
if (!strcasecmp(addr, "UNKNOWN"))
@@ -1075,14 +1077,16 @@
/* Don't use ast_set_callerid() here because it will
* generate a needless NewCallerID event */
- ch->cid.cid_ani = ast_strdup(cid_num);
+ ch->caller.ani = ast_strdup(cid_num);
if (pvt->cd.redirect_reason >= 0) {
- ch->redirecting.from.number = ast_strdup(pvt->cd.redirect_number);
+ ch->redirecting.from.XXX_number.valid = 1;
+ ch->redirecting.from.XXX_number.str = ast_strdup(pvt->cd.redirect_number);
pbx_builtin_setvar_helper(ch, "PRIREDIRECTREASON", redirectingreason2str(pvt->cd.redirect_reason));
}
- ch->cid.cid_pres = pvt->cd.presentation;
- ch->cid.cid_ton = pvt->cd.type_of_number;
+ ch->caller.id.XXX_name.presentation = pvt->cd.presentation;
+ ch->caller.id.XXX_number.presentation = pvt->cd.presentation;
+ 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;
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=264382&r1=264381&r2=264382
==============================================================================
--- team/rmudgett/cid/channels/chan_iax2.c (original)
+++ team/rmudgett/cid/channels/chan_iax2.c Wed May 19 15:26:49 2010
@@ -4913,8 +4913,8 @@
if (pds.port)
sin.sin_port = htons(atoi(pds.port));
- l = c->connected.id.number;
- n = c->connected.id.name;
+ l = c->connected.id.XXX_number.valid ? c->connected.id.XXX_number.str : NULL;
+ n = c->connected.id.XXX_name.valid ? c->connected.id.XXX_name.str : NULL;
/* Now build request */
memset(&ied, 0, sizeof(ied));
@@ -4932,15 +4932,16 @@
if (l) {
iax_ie_append_str(&ied, IAX_IE_CALLING_NUMBER, l);
- iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, c->connected.id.number_presentation);
+ iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES,
+ ast_party_id_presentation(&c->connected.id));
+ } else if (n) {
+ iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES,
+ ast_party_id_presentation(&c->connected.id));
} else {
- if (n)
- iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, c->connected.id.number_presentation);
- else
- iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, AST_PRES_NUMBER_NOT_AVAILABLE);
- }
-
- iax_ie_append_byte(&ied, IAX_IE_CALLINGTON, c->connected.id.number_type);
+ iax_ie_append_byte(&ied, IAX_IE_CALLINGPRES, AST_PRES_NUMBER_NOT_AVAILABLE);
+ }
+
+ iax_ie_append_byte(&ied, IAX_IE_CALLINGTON, c->connected.id.XXX_number.plan);
iax_ie_append_short(&ied, IAX_IE_CALLINGTNS, c->dialed.transit_network_select);
if (n)
@@ -4953,8 +4954,10 @@
if (c->dialed.number.valid && !ast_strlen_zero(c->dialed.number.str)) {
iax_ie_append_str(&ied, IAX_IE_DNID, c->dialed.number.str);
}
- if (!ast_strlen_zero(c->redirecting.from.number))
- iax_ie_append_str(&ied, IAX_IE_RDNIS, c->redirecting.from.number);
+ if (c->redirecting.from.XXX_number.valid
+ && !ast_strlen_zero(c->redirecting.from.XXX_number.str)) {
+ iax_ie_append_str(&ied, IAX_IE_RDNIS, c->redirecting.from.XXX_number.str);
+ }
if (pds.context)
iax_ie_append_str(&ied, IAX_IE_CALLED_CONTEXT, pds.context);
@@ -5551,7 +5554,8 @@
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.number = ast_strdup(i->rdnis);
+ tmp->redirecting.from.XXX_number.valid = 1;
+ tmp->redirecting.from.XXX_number.str = ast_strdup(i->rdnis);
tmp->cid.cid_pres = i->calling_pres;
tmp->cid.cid_ton = i->calling_ton;
tmp->dialed.transit_network_select = i->calling_tns;
@@ -11263,16 +11267,21 @@
/* Initialize defaults */
ast_party_connected_line_init(&connected);
- connected.id.number_presentation = iaxs[fr->callno]->calling_pres;
+ connected.id.XXX_number.presentation = iaxs[fr->callno]->calling_pres;
+ connected.id.XXX_name.presentation = iaxs[fr->callno]->calling_pres;
if (!ast_connected_line_parse_data(f.data.ptr, f.datalen, &connected)) {
- ast_string_field_set(iaxs[fr->callno], cid_num, connected.id.number);
- ast_string_field_set(iaxs[fr->callno], cid_name, connected.id.name);
- iaxs[fr->callno]->calling_pres = connected.id.number_presentation;
+ ast_string_field_set(iaxs[fr->callno], cid_num, connected.id.XXX_number.str);
+ ast_string_field_set(iaxs[fr->callno], cid_name, connected.id.XXX_name.str);
+ iaxs[fr->callno]->calling_pres = ast_party_id_presentation(&connected.id);
if (iaxs[fr->callno]->owner) {
- ast_set_callerid(iaxs[fr->callno]->owner, S_OR(connected.id.number, ""), S_OR(connected.id.name, ""), NULL);
- iaxs[fr->callno]->owner->cid.cid_pres = connected.id.number_presentation;
+ ast_set_callerid(iaxs[fr->callno]->owner,
+ S_COR(connected.id.XXX_number.valid, connected.id.XXX_number.str, ""),
+ S_COR(connected.id.XXX_name.valid, connected.id.XXX_name.str, ""),
+ NULL);
+ iaxs[fr->callno]->owner->caller.id.XXX_number.presentation = connected.id.XXX_number.presentation;
+ iaxs[fr->callno]->owner->caller.id.XXX_name.presentation = connected.id.XXX_name.presentation;
}
}
ast_party_connected_line_free(&connected);
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=264382&r1=264381&r2=264382
==============================================================================
--- team/rmudgett/cid/channels/chan_mgcp.c (original)
+++ team/rmudgett/cid/channels/chan_mgcp.c Wed May 19 15:26:49 2010
@@ -898,7 +898,9 @@
transmit_modify_request(sub->next);
}
- transmit_notify_request_with_callerid(sub, tone, ast->connected.id.number, ast->connected.id.name);
+ transmit_notify_request_with_callerid(sub, tone,
+ S_COR(ast->connected.id.XXX_number.valid, ast->connected.id.XXX_number.str, ""),
+ S_COR(ast->connected.id.XXX_name.valid, ast->connected.id.XXX_name.str, ""));
ast_setstate(ast, AST_STATE_RINGING);
if (sub->next->owner && !ast_strlen_zero(sub->next->cxident) && !ast_strlen_zero(sub->next->callid)) {
@@ -918,6 +920,7 @@
{
struct mgcp_subchannel *sub = ast->tech_pvt;
struct mgcp_endpoint *p = sub->parent;
+ struct ast_channel *bridged;
ast_debug(1, "mgcp_hangup(%s)\n", ast->name);
if (!ast->tech_pvt) {
@@ -967,7 +970,10 @@
if (p->hookstate == MGCP_OFFHOOK) {
if (sub->next->owner && ast_bridged_channel(sub->next->owner)) {
/* ncs fix! */
- transmit_notify_request_with_callerid(p->sub, (p->ncs ? "L/wt1" : "L/wt"), ast_bridged_channel(sub->next->owner)->cid.cid_num, ast_bridged_channel(sub->next->owner)->cid.cid_name);
+ bridged = ast_bridged_channel(sub->next->owner);
+ transmit_notify_request_with_callerid(p->sub, (p->ncs ? "L/wt1" : "L/wt"),
+ S_COR(bridged->caller.id.XXX_number.valid, bridged->caller.id.XXX_number.str, ""),
+ S_COR(bridged->caller.id.XXX_name.valid, bridged->caller.id.XXX_name.str, ""));
}
} else {
/* set our other connection as the primary and swith over to it */
@@ -975,7 +981,10 @@
p->sub->cxmode = MGCP_CX_RECVONLY;
transmit_modify_request(p->sub);
if (sub->next->owner && ast_bridged_channel(sub->next->owner)) {
- transmit_notify_request_with_callerid(p->sub, "L/rg", ast_bridged_channel(sub->next->owner)->cid.cid_num, ast_bridged_channel(sub->next->owner)->cid.cid_name);
+ bridged = ast_bridged_channel(sub->next->owner);
+ transmit_notify_request_with_callerid(p->sub, "L/rg",
+ S_COR(bridged->caller.id.XXX_number.valid, bridged->caller.id.XXX_number.str, ""),
+ S_COR(bridged->caller.id.XXX_name.valid, bridged->caller.id.XXX_name.str, ""));
}
}
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=264382&r1=264381&r2=264382
==============================================================================
--- team/rmudgett/cid/channels/chan_misdn.c (original)
+++ team/rmudgett/cid/channels/chan_misdn.c Wed May 19 15:26:49 2010
@@ -5706,12 +5706,12 @@
chan_misdn_log(2, port, " --> pres: %d screen: %d\n", pres, screen);
if (pres < 0 || screen < 0) {
- chan_misdn_log(2, port, " --> pres: %x\n", ast->connected.id.number_presentation);
-
- bc->caller.presentation = ast_to_misdn_pres(ast->connected.id.number_presentation);
+ chan_misdn_log(2, port, " --> pres: %x\n", ast->connected.id.XXX_number.presentation);
+
+ bc->caller.presentation = ast_to_misdn_pres(ast->connected.id.XXX_number.presentation);
chan_misdn_log(2, port, " --> PRES: %s(%d)\n", misdn_to_str_pres(bc->caller.presentation), bc->caller.presentation);
- bc->caller.screening = ast_to_misdn_screen(ast->connected.id.number_presentation);
+ bc->caller.screening = ast_to_misdn_screen(ast->connected.id.XXX_number.presentation);
chan_misdn_log(2, port, " --> SCREEN: %s(%d)\n", misdn_to_str_screen(bc->caller.screening), bc->caller.screening);
} else {
bc->caller.screening = screen;
@@ -6016,10 +6016,11 @@
struct ast_party_connected_line connected;
ast_party_connected_line_init(&connected);
- connected.id.number = (char *) id->number;
- connected.id.number_type = misdn_to_ast_ton(id->number_type)
+ connected.id.XXX_number.valid = 1;
+ connected.id.XXX_number.str = (char *) id->number;
+ connected.id.XXX_number.plan = misdn_to_ast_ton(id->number_type)
| misdn_to_ast_plan(id->number_plan);
- connected.id.number_presentation = misdn_to_ast_pres(id->presentation)
+ connected.id.XXX_number.presentation = misdn_to_ast_pres(id->presentation)
| misdn_to_ast_screen(id->screening);
connected.id.tag = cid_tag;
connected.source = source;
@@ -6043,16 +6044,26 @@
if (originator == ORG_MISDN) {
/* ORIGINATOR MISDN (incoming call) */
- ast_copy_string(bc->connected.name, S_OR(ast->connected.id.name, ""), sizeof(bc->connected.name));
- ast_copy_string(bc->connected.number, S_OR(ast->connected.id.number, ""), sizeof(bc->connected.number));
- bc->connected.presentation = ast_to_misdn_pres(ast->connected.id.number_presentation);
- bc->connected.screening = ast_to_misdn_screen(ast->connected.id.number_presentation);
+ ast_copy_string(bc->connected.name,
+ S_COR(ast->connected.id.XXX_name.valid, ast->connected.id.XXX_name.str, ""),
+ sizeof(bc->connected.name));
+ if (ast->connected.id.XXX_number.valid) {
+ ast_copy_string(bc->connected.number, S_OR(ast->connected.id.XXX_number.str, ""),
+ sizeof(bc->connected.number));
+ bc->connected.presentation = ast_to_misdn_pres(ast->connected.id.XXX_number.presentation);
+ bc->connected.screening = ast_to_misdn_screen(ast->connected.id.XXX_number.presentation);
+ bc->connected.number_type = ast_to_misdn_ton(ast->connected.id.XXX_number.plan);
+ bc->connected.number_plan = ast_to_misdn_plan(ast->connected.id.XXX_number.plan);
+ } else {
+ bc->connected.number[0] = '\0';
+ bc->connected.presentation = 0;/* Allowed */
+ bc->connected.screening = 0;/* Unscreened */
+ bc->connected.number_type = NUMTYPE_UNKNOWN;
+ bc->connected.number_plan = NUMPLAN_UNKNOWN;
+ }
misdn_cfg_get(bc->port, MISDN_CFG_CPNDIALPLAN, &number_type, sizeof(number_type));
- if (number_type < 0) {
- bc->connected.number_type = ast_to_misdn_ton(ast->connected.id.number_type);
- bc->connected.number_plan = ast_to_misdn_plan(ast->connected.id.number_type);
- } else {
+ if (0 <= number_type) {
/* Force us to send in CONNECT message */
bc->connected.number_type = number_type;
bc->connected.number_plan = NUMPLAN_ISDN;
@@ -6061,16 +6072,26 @@
} else {
/* ORIGINATOR Asterisk (outgoing call) */
- ast_copy_string(bc->caller.name, S_OR(ast->connected.id.name, ""), sizeof(bc->caller.name));
- ast_copy_string(bc->caller.number, S_OR(ast->connected.id.number, ""), sizeof(bc->caller.number));
- bc->caller.presentation = ast_to_misdn_pres(ast->connected.id.number_presentation);
- bc->caller.screening = ast_to_misdn_screen(ast->connected.id.number_presentation);
+ ast_copy_string(bc->caller.name,
+ S_COR(ast->connected.id.XXX_name.valid, ast->connected.id.XXX_name.str, ""),
+ sizeof(bc->caller.name));
+ if (ast->connected.id.XXX_number.valid) {
+ ast_copy_string(bc->caller.number, S_OR(ast->connected.id.XXX_number.str, ""),
+ sizeof(bc->caller.number));
+ bc->caller.presentation = ast_to_misdn_pres(ast->connected.id.XXX_number.presentation);
+ bc->caller.screening = ast_to_misdn_screen(ast->connected.id.XXX_number.presentation);
+ bc->caller.number_type = ast_to_misdn_ton(ast->connected.id.XXX_number.plan);
+ bc->caller.number_plan = ast_to_misdn_plan(ast->connected.id.XXX_number.plan);
+ } else {
+ bc->caller.number[0] = '\0';
+ bc->caller.presentation = 0;/* Allowed */
+ bc->caller.screening = 0;/* Unscreened */
+ bc->caller.number_type = NUMTYPE_UNKNOWN;
+ bc->caller.number_plan = NUMPLAN_UNKNOWN;
+ }
misdn_cfg_get(bc->port, MISDN_CFG_LOCALDIALPLAN, &number_type, sizeof(number_type));
- if (number_type < 0) {
- bc->caller.number_type = ast_to_misdn_ton(ast->connected.id.number_type);
- bc->caller.number_plan = ast_to_misdn_plan(ast->connected.id.number_type);
- } else {
+ if (0 <= number_type) {
/* Force us to send in SETUP message */
bc->caller.number_type = number_type;
bc->caller.number_plan = NUMPLAN_ISDN;
@@ -6150,19 +6171,41 @@
*/
static void misdn_copy_redirecting_from_ast(struct misdn_bchannel *bc, struct ast_channel *ast)
{
- ast_copy_string(bc->redirecting.from.name, S_OR(ast->redirecting.from.name, ""), sizeof(bc->redirecting.from.name));
- ast_copy_string(bc->redirecting.from.number, S_OR(ast->redirecting.from.number, ""), sizeof(bc->redirecting.from.number));
- bc->redirecting.from.presentation = ast_to_misdn_pres(ast->redirecting.from.number_presentation);
- bc->redirecting.from.screening = ast_to_misdn_screen(ast->redirecting.from.number_presentation);
- bc->redirecting.from.number_type = ast_to_misdn_ton(ast->redirecting.from.number_type);
- bc->redirecting.from.number_plan = ast_to_misdn_plan(ast->redirecting.from.number_type);
-
- ast_copy_string(bc->redirecting.to.name, S_OR(ast->redirecting.to.name, ""), sizeof(bc->redirecting.to.name));
- ast_copy_string(bc->redirecting.to.number, S_OR(ast->redirecting.to.number, ""), sizeof(bc->redirecting.to.number));
- bc->redirecting.to.presentation = ast_to_misdn_pres(ast->redirecting.to.number_presentation);
- bc->redirecting.to.screening = ast_to_misdn_screen(ast->redirecting.to.number_presentation);
- bc->redirecting.to.number_type = ast_to_misdn_ton(ast->redirecting.to.number_type);
- bc->redirecting.to.number_plan = ast_to_misdn_plan(ast->redirecting.to.number_type);
+ ast_copy_string(bc->redirecting.from.name,
+ S_COR(ast->redirecting.from.XXX_name.valid, ast->redirecting.from.XXX_name.str, ""),
+ sizeof(bc->redirecting.from.name));
+ if (ast->redirecting.from.XXX_number.valid) {
+ ast_copy_string(bc->redirecting.from.number, S_OR(ast->redirecting.from.XXX_number.str, ""),
+ sizeof(bc->redirecting.from.number));
+ bc->redirecting.from.presentation = ast_to_misdn_pres(ast->redirecting.from.XXX_number.presentation);
+ bc->redirecting.from.screening = ast_to_misdn_screen(ast->redirecting.from.XXX_number.presentation);
+ bc->redirecting.from.number_type = ast_to_misdn_ton(ast->redirecting.from.XXX_number.plan);
+ bc->redirecting.from.number_plan = ast_to_misdn_plan(ast->redirecting.from.XXX_number.plan);
+ } else {
+ bc->redirecting.from.number[0] = '\0';
+ bc->redirecting.from.presentation = 0;/* Allowed */
+ bc->redirecting.from.screening = 0;/* Unscreened */
+ bc->redirecting.from.number_type = NUMTYPE_UNKNOWN;
+ bc->redirecting.from.number_plan = NUMPLAN_UNKNOWN;
+ }
+
+ ast_copy_string(bc->redirecting.to.name,
+ S_COR(ast->redirecting.to.XXX_name.valid, ast->redirecting.to.XXX_name.str, ""),
+ sizeof(bc->redirecting.to.name));
+ if (ast->redirecting.to.XXX_number.valid) {
+ ast_copy_string(bc->redirecting.to.number, S_OR(ast->redirecting.to.XXX_number.str, ""),
+ sizeof(bc->redirecting.to.number));
+ bc->redirecting.to.presentation = ast_to_misdn_pres(ast->redirecting.to.XXX_number.presentation);
+ bc->redirecting.to.screening = ast_to_misdn_screen(ast->redirecting.to.XXX_number.presentation);
+ bc->redirecting.to.number_type = ast_to_misdn_ton(ast->redirecting.to.XXX_number.plan);
+ bc->redirecting.to.number_plan = ast_to_misdn_plan(ast->redirecting.to.XXX_number.plan);
+ } else {
+ bc->redirecting.to.number[0] = '\0';
+ bc->redirecting.to.presentation = 0;/* Allowed */
+ bc->redirecting.to.screening = 0;/* Unscreened */
+ bc->redirecting.to.number_type = NUMTYPE_UNKNOWN;
+ bc->redirecting.to.number_plan = NUMPLAN_UNKNOWN;
+ }
bc->redirecting.reason = ast_to_misdn_reason(ast->redirecting.reason);
bc->redirecting.count = ast->redirecting.count;
@@ -6184,20 +6227,22 @@
ast_party_redirecting_set_init(&redirecting, &ast->redirecting);
- redirecting.from.number = (char *) redirect->from.number;
- redirecting.from.number_type =
+ redirecting.from.XXX_number.valid = 1;
+ redirecting.from.XXX_number.str = (char *) redirect->from.number;
+ redirecting.from.XXX_number.plan =
misdn_to_ast_ton(redirect->from.number_type)
| misdn_to_ast_plan(redirect->from.number_plan);
- redirecting.from.number_presentation =
+ redirecting.from.XXX_number.presentation =
misdn_to_ast_pres(redirect->from.presentation)
| misdn_to_ast_screen(redirect->from.screening);
redirecting.from.tag = tag;
- redirecting.to.number = (char *) redirect->to.number;
- redirecting.to.number_type =
+ redirecting.to.XXX_number.valid = 1;
+ redirecting.to.XXX_number.str = (char *) redirect->to.number;
+ redirecting.to.XXX_number.plan =
misdn_to_ast_ton(redirect->to.number_type)
| misdn_to_ast_plan(redirect->to.number_plan);
- redirecting.to.number_presentation =
+ redirecting.to.XXX_number.presentation =
misdn_to_ast_pres(redirect->to.presentation)
| misdn_to_ast_screen(redirect->to.screening);
redirecting.to.tag = tag;
@@ -6393,12 +6438,16 @@
ast_copy_string(ast->exten, args.ext, sizeof(ast->exten));
ast_copy_string(newbc->dialed.number, args.ext, sizeof(newbc->dialed.number));
- if (ast_strlen_zero(newbc->caller.name) && !ast_strlen_zero(ast->connected.id.name)) {
- ast_copy_string(newbc->caller.name, ast->connected.id.name, sizeof(newbc->caller.name));
+ if (ast_strlen_zero(newbc->caller.name)
+ && ast->connected.id.XXX_name.valid
+ && !ast_strlen_zero(ast->connected.id.XXX_name.str)) {
+ ast_copy_string(newbc->caller.name, ast->connected.id.XXX_name.str, sizeof(newbc->caller.name));
chan_misdn_log(3, port, " --> * set caller:\"%s\" <%s>\n", newbc->caller.name, newbc->caller.number);
}
- if (ast_strlen_zero(newbc->caller.number) && !ast_strlen_zero(ast->connected.id.number)) {
- ast_copy_string(newbc->caller.number, ast->connected.id.number, sizeof(newbc->caller.number));
+ if (ast_strlen_zero(newbc->caller.number)
+ && ast->connected.id.XXX_number.valid
+ && !ast_strlen_zero(ast->connected.id.XXX_number.str)) {
+ ast_copy_string(newbc->caller.number, ast->connected.id.XXX_number.str, sizeof(newbc->caller.number));
chan_misdn_log(3, port, " --> * set caller:\"%s\" <%s>\n", newbc->caller.name, newbc->caller.number);
}
@@ -6412,8 +6461,13 @@
misdn_cfg_get(port, MISDN_CFG_LOCALDIALPLAN, &number_type, sizeof(number_type));
if (number_type < 0) {
- newbc->caller.number_type = ast_to_misdn_ton(ast->connected.id.number_type);
- newbc->caller.number_plan = ast_to_misdn_plan(ast->connected.id.number_type);
+ if (ast->connected.id.XXX_number.valid) {
+ newbc->caller.number_type = ast_to_misdn_ton(ast->connected.id.XXX_number.plan);
+ newbc->caller.number_plan = ast_to_misdn_plan(ast->connected.id.XXX_number.plan);
+ } else {
+ newbc->caller.number_type = NUMTYPE_UNKNOWN;
+ newbc->caller.number_plan = NUMPLAN_ISDN;
+ }
} else {
/* Force us to send in SETUP message */
newbc->caller.number_type = number_type;
@@ -8932,7 +8986,7 @@
bc->div_leg_3_rx_wanted = 0;
if (ch && ch->ast) {
[... 3112 lines stripped ...]
More information about the asterisk-commits
mailing list