[asterisk-commits] rmudgett: branch rmudgett/cid r270258 - in /team/rmudgett/cid: ./ channels/ c...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jun 14 14:24:05 CDT 2010
Author: rmudgett
Date: Mon Jun 14 14:24:01 2010
New Revision: 270258
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=270258
Log:
Merged revisions 270219 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r270219 | rmudgett | 2010-06-14 10:55:35 -0500 (Mon, 14 Jun 2010) | 6 lines
Add digit manipulation tag support to chan_dahdi/sig_pri like chan_misdn.
Add the append_msn_to_cid_tag option to chan_dahdi like chan_misdn.
Review: https://reviewboard.asterisk.org/r/696/
........
Modified:
team/rmudgett/cid/ (props changed)
team/rmudgett/cid/channels/chan_dahdi.c
team/rmudgett/cid/channels/sig_pri.c
team/rmudgett/cid/channels/sig_pri.h
team/rmudgett/cid/configs/chan_dahdi.conf.sample
Propchange: team/rmudgett/cid/
------------------------------------------------------------------------------
automerge = *
Propchange: team/rmudgett/cid/
------------------------------------------------------------------------------
--- cid-integrated (original)
+++ cid-integrated Mon Jun 14 14:24:01 2010
@@ -1,1 +1,1 @@
-/trunk:1-270207
+/trunk:1-270257
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=270258&r1=270257&r2=270258
==============================================================================
--- team/rmudgett/cid/channels/chan_dahdi.c (original)
+++ team/rmudgett/cid/channels/chan_dahdi.c Mon Jun 14 14:24:01 2010
@@ -2859,6 +2859,9 @@
}
p->cid_ton = caller->id.XXX_number.plan;
p->callingpres = ast_party_id_presentation(&caller->id);
+ if (caller->id.tag) {
+ ast_copy_string(p->cid_tag, caller->id.tag, sizeof(p->cid_tag));
+ }
ast_copy_string(p->cid_ani, S_OR(caller->ani, ""), sizeof(p->cid_ani));
p->cid_ani2 = caller->ani2;
}
@@ -5816,6 +5819,7 @@
p->subs[SUB_REAL].owner = NULL;
p->subs[SUB_REAL].needbusy = 0;
p->owner = NULL;
+ p->cid_tag[0] = '\0';
p->ringt = 0;/* Probably not used in this mode. Reset anyway. */
p->distinctivering = 0;/* Probably not used in this mode. Reset anyway. */
p->confirmanswer = 0;/* Probably not used in this mode. Reset anyway. */
@@ -11934,6 +11938,8 @@
pris[span].pri.aoc_passthrough_flag = conf->pri.pri.aoc_passthrough_flag;
pris[span].pri.aoce_delayhangup = conf->pri.pri.aoce_delayhangup;
#endif /* defined(HAVE_PRI_AOC_EVENTS) */
+ pris[span].pri.append_msn_to_user_tag = conf->pri.pri.append_msn_to_user_tag;
+ ast_copy_string(pris[span].pri.initial_user_tag, conf->chan.cid_tag, sizeof(pris[span].pri.initial_user_tag));
ast_copy_string(pris[span].pri.msn_list, conf->pri.pri.msn_list, sizeof(pris[span].pri.msn_list));
#if defined(HAVE_PRI_MWI)
ast_copy_string(pris[span].pri.mwi_mailboxes,
@@ -12177,7 +12183,14 @@
tmp->cid_num[0] = '\0';
tmp->cid_name[0] = '\0';
}
- ast_copy_string(tmp->cid_tag, conf->chan.cid_tag, sizeof(tmp->cid_tag));
+#if defined(HAVE_PRI)
+ if (dahdi_sig_pri_lib_handles(tmp->sig)) {
+ tmp->cid_tag[0] = '\0';
+ } else
+#endif /* defined(HAVE_PRI) */
+ {
+ ast_copy_string(tmp->cid_tag, conf->chan.cid_tag, sizeof(tmp->cid_tag));
+ }
tmp->cid_subaddr[0] = '\0';
ast_copy_string(tmp->mailbox, conf->chan.mailbox, sizeof(tmp->mailbox));
if (channel != CHAN_PSEUDO && !ast_strlen_zero(tmp->mailbox)) {
@@ -16781,6 +16794,8 @@
ast_copy_string(confp->pri.pri.mwi_mailboxes, v->value,
sizeof(confp->pri.pri.mwi_mailboxes));
#endif /* defined(HAVE_PRI_MWI) */
+ } else if (!strcasecmp(v->name, "append_msn_to_cid_tag")) {
+ confp->pri.pri.append_msn_to_user_tag = ast_true(v->value);
#endif /* HAVE_PRI */
#if defined(HAVE_SS7)
} else if (!strcasecmp(v->name, "ss7type")) {
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=270258&r1=270257&r2=270258
==============================================================================
--- team/rmudgett/cid/channels/sig_pri.c (original)
+++ team/rmudgett/cid/channels/sig_pri.c Mon Jun 14 14:24:01 2010
@@ -222,6 +222,7 @@
//caller.id.subaddress.odd_even_indicator = 0;
caller.id.subaddress.str = p->cid_subaddr;
}
+ caller.id.tag = p->user_tag;
caller.ani = p->cid_ani;
caller.ani2 = p->cid_ani2;
p->calls->set_callerid(p->chan_pvt, &caller);
@@ -1215,6 +1216,7 @@
new_chan->aoc_s_request_invoke_id = old_chan->aoc_s_request_invoke_id;
new_chan->aoc_e = old_chan->aoc_e;
#endif /* defined(HAVE_PRI_AOC_EVENTS) */
+ strcpy(new_chan->user_tag, old_chan->user_tag);
if (new_chan->no_b_channel) {
/* Copy the real channel configuration to the no B channel interface. */
@@ -1557,6 +1559,17 @@
} else {
ast_free(chan->dialed.number.str);
chan->dialed.number.str = ast_strdup(exten);
+
+ if (p->pri->append_msn_to_user_tag && p->pri->nodetype != PRI_NETWORK) {
+ /*
+ * Update the user tag for party id's from this device for this call
+ * now that we have a complete MSN from the network.
+ */
+ snprintf(p->user_tag, sizeof(p->user_tag), "%s_%s", p->pri->initial_user_tag,
+ exten);
+ ast_free(chan->caller.id.tag);
+ chan->caller.id.tag = ast_strdup(p->user_tag);
+ }
}
sig_pri_play_tone(p, -1);
if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num)) {
@@ -3593,6 +3606,7 @@
ast_party_connected_line_init(&ast_connected);
sig_pri_party_id_convert(&ast_connected.id, &subcmd->u.connected_line.id,
pri);
+ ast_connected.id.tag = ast_strdup(pri->pvts[chanpos]->user_tag);
caller_id_update = 0;
if (ast_connected.id.XXX_name.str) {
@@ -3650,6 +3664,8 @@
if (owner) {
sig_pri_redirecting_convert(&ast_redirecting, &subcmd->u.redirecting,
&owner->redirecting, pri);
+ ast_redirecting.from.tag = ast_strdup(pri->pvts[chanpos]->user_tag);
+ ast_redirecting.to.tag = ast_strdup(pri->pvts[chanpos]->user_tag);
/*! \todo XXX Original called data can be put in a channel data store that is inherited. */
@@ -3701,6 +3717,8 @@
}
sig_pri_redirecting_convert(&ast_redirecting, &pri_deflection,
&owner->redirecting, pri);
+ ast_redirecting.from.tag = ast_strdup(pri->pvts[chanpos]->user_tag);
+ ast_redirecting.to.tag = ast_strdup(pri->pvts[chanpos]->user_tag);
ast_channel_set_redirecting(owner, &ast_redirecting, NULL);
ast_party_redirecting_free(&ast_redirecting);
@@ -4585,6 +4603,19 @@
pri->pvts[chanpos]->cid_ton = 0;
pri->pvts[chanpos]->callingpres = 0;
}
+
+ /* Setup the user tag for party id's from this device for this call. */
+ if (pri->append_msn_to_user_tag) {
+ snprintf(pri->pvts[chanpos]->user_tag,
+ sizeof(pri->pvts[chanpos]->user_tag), "%s_%s",
+ pri->initial_user_tag,
+ pri->nodetype == PRI_NETWORK
+ ? plancallingnum : e->ring.callednum);
+ } else {
+ ast_copy_string(pri->pvts[chanpos]->user_tag,
+ pri->initial_user_tag, sizeof(pri->pvts[chanpos]->user_tag));
+ }
+
sig_pri_set_caller_id(pri->pvts[chanpos]);
/* Set DNID on all incoming calls -- even immediate */
@@ -5626,6 +5657,7 @@
p->cid_num[0] = '\0';
p->cid_subaddr[0] = '\0';
p->cid_name[0] = '\0';
+ p->user_tag[0] = '\0';
p->exten[0] = '\0';
sig_pri_set_dialing(p, 0);
@@ -6034,6 +6066,24 @@
}
#endif /* defined(HAVE_PRI_AOC_EVENTS) */
+ /* Setup the user tag for party id's from this device for this call. */
+ if (p->pri->append_msn_to_user_tag) {
+ snprintf(p->user_tag, sizeof(p->user_tag), "%s_%s", p->pri->initial_user_tag,
+ p->pri->nodetype == PRI_NETWORK
+ ? c + p->stripmsd + dp_strip
+ : S_COR(ast->connected.id.XXX_number.valid,
+ ast->connected.id.XXX_number.str, ""));
+ } else {
+ ast_copy_string(p->user_tag, p->pri->initial_user_tag, sizeof(p->user_tag));
+ }
+
+ /*
+ * Replace the caller id tag from the channel creation
+ * with the actual tag value.
+ */
+ ast_free(ast->caller.id.tag);
+ ast->caller.id.tag = ast_strdup(p->user_tag);
+
ldp_strip = 0;
prilocaldialplan = p->pri->localdialplan - 1;
if ((l != NULL) && (prilocaldialplan == -2 || prilocaldialplan == -3)) { /* compute dynamically */
Modified: team/rmudgett/cid/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/channels/sig_pri.h?view=diff&rev=270258&r1=270257&r2=270258
==============================================================================
--- team/rmudgett/cid/channels/sig_pri.h (original)
+++ team/rmudgett/cid/channels/sig_pri.h Mon Jun 14 14:24:01 2010
@@ -190,6 +190,8 @@
char cid_subaddr[AST_MAX_EXTENSION];
char cid_name[AST_MAX_EXTENSION];
char cid_ani[AST_MAX_EXTENSION];
+ /*! \brief User tag for party id's sent from this device driver. */
+ char user_tag[AST_MAX_EXTENSION];
char exten[AST_MAX_EXTENSION];
/* Internal variables -- Don't touch */
@@ -316,6 +318,11 @@
/*! \brief TRUE if we will allow incoming ISDN call waiting calls. */
unsigned int allow_call_waiting_calls:1;
#endif /* defined(HAVE_PRI_CALL_WAITING) */
+ /*!
+ * TRUE if a new call's sig_pri_chan.user_tag[] has the MSN
+ * appended to the initial_user_tag[].
+ */
+ unsigned int append_msn_to_user_tag:1;
int dialplan; /*!< Dialing plan */
int localdialplan; /*!< Local dialing plan */
char internationalprefix[10]; /*!< country access code ('00' for european dialplans) */
@@ -335,6 +342,11 @@
*/
char mwi_mailboxes[SIG_PRI_MAX_MWI_MAILBOX_STR];
#endif /* defined(HAVE_PRI_MWI) */
+ /*!
+ * \brief Initial user tag for party id's sent from this device driver.
+ * \note String set by config file.
+ */
+ char initial_user_tag[AST_MAX_EXTENSION];
char msn_list[AST_MAX_EXTENSION]; /*!< Comma separated list of MSNs to handle. Empty if disabled. */
char idleext[AST_MAX_EXTENSION]; /*!< Where to idle extra calls */
char idlecontext[AST_MAX_CONTEXT]; /*!< What context to use for idle */
Modified: team/rmudgett/cid/configs/chan_dahdi.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/configs/chan_dahdi.conf.sample?view=diff&rev=270258&r1=270257&r2=270258
==============================================================================
--- team/rmudgett/cid/configs/chan_dahdi.conf.sample (original)
+++ team/rmudgett/cid/configs/chan_dahdi.conf.sample Mon Jun 14 14:24:01 2010
@@ -727,7 +727,23 @@
; return to the caller performing the transfer (default is yes).
;
;transfertobusy=no
-;
+
+; Calls will have the party id user tag set to this string value.
+;
+;cid_tag=
+
+; With this set, you can automatically append the MSN of a party
+; to the cid_tag. An '_' is used to separate the tag from the MSN.
+; Applies to ISDN spans.
+; Default is no.
+;
+; Table of what number is appended:
+; outgoing incoming
+; net dialed caller
+; cpe caller dialed
+;
+;append_msn_to_cid_tag=no
+
; caller ID can be set to "asreceived" or a specific number if you want to
; override it. Note that "asreceived" only applies to trunk interfaces.
; fullname sets just the
More information about the asterisk-commits
mailing list