[asterisk-commits] rmudgett: branch rmudgett/cid r264668 - in /team/rmudgett/cid: apps/ channels...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu May 20 13:57:39 CDT 2010
Author: rmudgett
Date: Thu May 20 13:57:36 2010
New Revision: 264668
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=264668
Log:
Move ast_channel.cid.cid_pres to ast_channel.caller.id.number.presentation and ast_channel.caller.id.name.presentation.
Corrected some weirdness with app_privacy.c's use of caller presentation.
Note:
The test_substitution.c can no longer test the CALLINGPRES value because
it is now a calculated value from the name and number presentation
information to get a combined presentation value.
Modified:
team/rmudgett/cid/apps/app_privacy.c
team/rmudgett/cid/apps/app_setcallerid.c
team/rmudgett/cid/channels/chan_gtalk.c
team/rmudgett/cid/channels/chan_iax2.c
team/rmudgett/cid/channels/chan_jingle.c
team/rmudgett/cid/channels/chan_misdn.c
team/rmudgett/cid/channels/chan_sip.c
team/rmudgett/cid/include/asterisk/channel.h
team/rmudgett/cid/main/pbx.c
team/rmudgett/cid/tests/test_substitution.c
Modified: team/rmudgett/cid/apps/app_privacy.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_privacy.c?view=diff&rev=264668&r1=264667&r2=264668
==============================================================================
--- team/rmudgett/cid/apps/app_privacy.c (original)
+++ team/rmudgett/cid/apps/app_privacy.c Thu May 20 13:57:36 2010
@@ -96,8 +96,9 @@
AST_APP_ARG(checkcontext);
);
- if (!ast_strlen_zero(chan->cid.cid_num)) {
- ast_verb(3, "CallerID Present: Skipping\n");
+ if (chan->caller.id.XXX_number.valid
+ && !ast_strlen_zero(chan->caller.id.XXX_number.str)) {
+ ast_verb(3, "CallerID number present: Skipping\n");
} else {
/*Answer the channel if it is not already*/
if (chan->_state != AST_STATE_UP) {
@@ -181,14 +182,19 @@
res = ast_waitstream(chan, "");
}
+ /*
+ * This is a caller entered number that is going to be used locally.
+ * Therefore, the given number presentation is allowed and should
+ * be passed out to other channels. This is the point of the
+ * privacy application.
+ */
+ chan->caller.id.XXX_name.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
+ chan->caller.id.XXX_number.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
+ chan->caller.id.XXX_number.plan = 0;/* Unknown */
+
ast_set_callerid(chan, phone, "Privacy Manager", NULL);
- /* Clear the unavailable presence bit so if it came in on PRI
- * the caller id will now be passed out to other channels
- */
- chan->cid.cid_pres &= (AST_PRES_UNAVAILABLE ^ 0xFF);
-
- ast_verb(3, "Changed Caller*ID to '%s', callerpres to %d\n", phone, chan->cid.cid_pres);
+ ast_verb(3, "Changed Caller*ID number to '%s'\n", phone);
pbx_builtin_setvar_helper(chan, "PRIVACYMGRSTATUS", "SUCCESS");
} else {
Modified: team/rmudgett/cid/apps/app_setcallerid.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/apps/app_setcallerid.c?view=diff&rev=264668&r1=264667&r2=264668
==============================================================================
--- team/rmudgett/cid/apps/app_setcallerid.c (original)
+++ team/rmudgett/cid/apps/app_setcallerid.c Thu May 20 13:57:36 2010
@@ -105,7 +105,9 @@
return 0;
}
- chan->cid.cid_pres = pres;
+ /* Set the combined caller id presentation. */
+ chan->caller.id.XXX_name.presentation = pres;
+ chan->caller.id.XXX_number.presentation = pres;
return 0;
}
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=264668&r1=264667&r2=264668
==============================================================================
--- team/rmudgett/cid/channels/chan_gtalk.c (original)
+++ team/rmudgett/cid/channels/chan_gtalk.c Thu May 20 13:57:36 2010
@@ -1044,7 +1044,8 @@
tmp->callgroup = client->callgroup;
tmp->pickupgroup = client->pickupgroup;
- tmp->cid.cid_pres = client->callingpres;
+ tmp->caller.id.XXX_name.presentation = client->callingpres;
+ tmp->caller.id.XXX_number.presentation = client->callingpres;
if (!ast_strlen_zero(client->accountcode))
ast_string_field_set(tmp, accountcode, client->accountcode);
if (client->amaflags)
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=264668&r1=264667&r2=264668
==============================================================================
--- team/rmudgett/cid/channels/chan_iax2.c (original)
+++ team/rmudgett/cid/channels/chan_iax2.c Thu May 20 13:57:36 2010
@@ -5556,7 +5556,8 @@
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);
- tmp->cid.cid_pres = i->calling_pres;
+ tmp->caller.id.XXX_name.presentation = i->calling_pres;
+ tmp->caller.id.XXX_number.presentation = i->calling_pres;
tmp->caller.id.XXX_number.plan = i->calling_ton;
tmp->dialed.transit_network_select = i->calling_tns;
if (!ast_strlen_zero(i->language))
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=264668&r1=264667&r2=264668
==============================================================================
--- team/rmudgett/cid/channels/chan_jingle.c (original)
+++ team/rmudgett/cid/channels/chan_jingle.c Thu May 20 13:57:36 2010
@@ -845,7 +845,8 @@
tmp->callgroup = client->callgroup;
tmp->pickupgroup = client->pickupgroup;
- tmp->cid.cid_pres = client->callingpres;
+ tmp->caller.id.XXX_name.presentation = client->callingpres;
+ tmp->caller.id.XXX_number.presentation = client->callingpres;
if (!ast_strlen_zero(client->accountcode))
ast_string_field_set(tmp, accountcode, client->accountcode);
if (client->amaflags)
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=264668&r1=264667&r2=264668
==============================================================================
--- team/rmudgett/cid/channels/chan_misdn.c (original)
+++ team/rmudgett/cid/channels/chan_misdn.c Thu May 20 13:57:36 2010
@@ -9847,7 +9847,7 @@
chan_misdn_log(2, bc->port, " --> PRES: %s(%d)\n", misdn_to_str_pres(bc->caller.presentation), bc->caller.presentation);
chan_misdn_log(2, bc->port, " --> SCREEN: %s(%d)\n", misdn_to_str_screen(bc->caller.screening), bc->caller.screening);
- chan->cid.cid_pres = misdn_to_ast_pres(bc->caller.presentation)
+ chan->caller.id.XXX_number.presentation = misdn_to_ast_pres(bc->caller.presentation)
| misdn_to_ast_screen(bc->caller.screening);
ast_set_callerid(chan, bc->caller.number, NULL, bc->caller.number);
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=264668&r1=264667&r2=264668
==============================================================================
--- team/rmudgett/cid/channels/chan_sip.c (original)
+++ team/rmudgett/cid/channels/chan_sip.c Thu May 20 13:57:36 2010
@@ -5017,7 +5017,7 @@
ast->hangupcause = AST_CAUSE_USER_BUSY;
return res;
}
- p->callingpres = ast->cid.cid_pres;
+ p->callingpres = ast_party_id_presentation(&ast->caller.id);
p->jointcapability = ast_rtp_instance_available_formats(p->rtp, p->capability, p->prefcodec);
p->jointnoncodeccapability = p->noncodeccapability;
@@ -13281,7 +13281,8 @@
if (p->owner) {
ast_set_callerid(p->owner, cid_num, cid_name, NULL);
- p->owner->cid.cid_pres = callingpres;
+ p->owner->caller.id.XXX_name.presentation = callingpres;
+ p->owner->caller.id.XXX_number.presentation = callingpres;
}
return 1;
@@ -13380,7 +13381,8 @@
if (p->owner) {
ast_set_callerid(p->owner, cid_num, cid_name, NULL);
- p->owner->cid.cid_pres = callingpres;
+ p->owner->caller.id.XXX_name.presentation = callingpres;
+ p->owner->caller.id.XXX_number.presentation = callingpres;
}
return 1;
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=264668&r1=264667&r2=264668
==============================================================================
--- team/rmudgett/cid/include/asterisk/channel.h (original)
+++ team/rmudgett/cid/include/asterisk/channel.h Thu May 20 13:57:36 2010
@@ -308,12 +308,6 @@
* (Field will eventually move to struct ast_channel.caller.id.name)
*/
char *cid_name;
-
- /*!
- * \brief Callerid Q.931 encoded number presentation/screening fields
- * (Field will eventually move to struct ast_channel.caller.id.number_presentation)
- */
- int cid_pres;
};
/*!
Modified: team/rmudgett/cid/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/main/pbx.c?view=diff&rev=264668&r1=264667&r2=264668
==============================================================================
--- team/rmudgett/cid/main/pbx.c (original)
+++ team/rmudgett/cid/main/pbx.c Thu May 20 13:57:36 2010
@@ -3011,7 +3011,8 @@
if (!strncmp(var, "CALL", 4)) {
if (!strncmp(var + 4, "ING", 3)) {
if (!strcmp(var + 7, "PRES")) { /* CALLINGPRES */
- ast_str_set(str, maxlen, "%d", c->cid.cid_pres);
+ ast_str_set(str, maxlen, "%d",
+ ast_party_id_presentation(&c->caller.id));
s = ast_str_buffer(*str);
} else if (!strcmp(var + 7, "ANI2")) { /* CALLINGANI2 */
ast_str_set(str, maxlen, "%d", c->caller.ani2);
Modified: team/rmudgett/cid/tests/test_substitution.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/tests/test_substitution.c?view=diff&rev=264668&r1=264667&r2=264668
==============================================================================
--- team/rmudgett/cid/tests/test_substitution.c (original)
+++ team/rmudgett/cid/tests/test_substitution.c Thu May 20 13:57:36 2010
@@ -220,7 +220,15 @@
c = ast_channel_alloc(0, 0, "", "", "", "", "", "", 0, "Test/substitution");
#define TEST(t) if (t == AST_TEST_FAIL) { res = AST_TEST_FAIL; }
- TEST(test_chan_integer(test, c, &c->cid.cid_pres, "${CALLINGPRES}"));
+#if 0
+ /* BUGBUG need new test? */
+ /*
+ * We can no longer test the CALLINGPRES value this way because it is now
+ * a calculated value from the name and number presentation information to
+ * get a combined presentation value.
+ */
+ TEST(test_chan_integer(test, c, &c->caller.id.XXX_number.presentation, "${CALLINGPRES}"));
+#endif
TEST(test_chan_integer(test, c, &c->caller.ani2, "${CALLINGANI2}"));
TEST(test_chan_integer(test, c, &c->caller.id.XXX_number.plan, "${CALLINGTON}"));
TEST(test_chan_integer(test, c, &c->dialed.transit_network_select, "${CALLINGTNS}"));
More information about the asterisk-commits
mailing list