[asterisk-commits] rmudgett: trunk r304385 - in /trunk: channels/ configs/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jan 26 18:06:31 CST 2011
Author: rmudgett
Date: Wed Jan 26 18:06:27 2011
New Revision: 304385
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=304385
Log:
Merged from revision 304341
https://origsvn.digium.com/svn/asterisk/be/branches/C.3-bier
..........
r304341 | rmudgett | 2011-01-26 16:38:39 -0600 (Wed, 26 Jan 2011) | 7 lines
Add connected line chan_dahdi.conf pricpndialplan option.
* Added from_channel value to prilocaldialplan option.
JIRA ABE-2731
JIRA SWP-2842
..........
Modified:
trunk/channels/chan_dahdi.c
trunk/channels/sig_pri.c
trunk/channels/sig_pri.h
trunk/configs/chan_dahdi.conf.sample
Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=304385&r1=304384&r2=304385
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Wed Jan 26 18:06:27 2011
@@ -12270,6 +12270,7 @@
pris[span].pri.nsf = conf->pri.pri.nsf;
pris[span].pri.dialplan = conf->pri.pri.dialplan;
pris[span].pri.localdialplan = conf->pri.pri.localdialplan;
+ pris[span].pri.cpndialplan = conf->pri.pri.cpndialplan;
pris[span].pri.pvts[pris[span].pri.numchans++] = tmp->sig_pvt;
pris[span].pri.minunused = conf->pri.pri.minunused;
pris[span].pri.minidle = conf->pri.pri.minidle;
@@ -16971,12 +16972,34 @@
confp->pri.pri.localdialplan = PRI_INTERNATIONAL_ISDN + 1;
} else if (!strcasecmp(v->value, "local")) {
confp->pri.pri.localdialplan = PRI_LOCAL_ISDN + 1;
+ } else if (!strcasecmp(v->value, "from_channel")) {
+ confp->pri.pri.localdialplan = 0;
} else if (!strcasecmp(v->value, "dynamic")) {
confp->pri.pri.localdialplan = -1;
} else if (!strcasecmp(v->value, "redundant")) {
confp->pri.pri.localdialplan = -2;
} else {
ast_log(LOG_WARNING, "Unknown PRI localdialplan '%s' at line %d.\n", v->value, v->lineno);
+ }
+ } else if (!strcasecmp(v->name, "pricpndialplan")) {
+ if (!strcasecmp(v->value, "national")) {
+ confp->pri.pri.cpndialplan = PRI_NATIONAL_ISDN + 1;
+ } else if (!strcasecmp(v->value, "unknown")) {
+ confp->pri.pri.cpndialplan = PRI_UNKNOWN + 1;
+ } else if (!strcasecmp(v->value, "private")) {
+ confp->pri.pri.cpndialplan = PRI_PRIVATE + 1;
+ } else if (!strcasecmp(v->value, "international")) {
+ confp->pri.pri.cpndialplan = PRI_INTERNATIONAL_ISDN + 1;
+ } else if (!strcasecmp(v->value, "local")) {
+ confp->pri.pri.cpndialplan = PRI_LOCAL_ISDN + 1;
+ } else if (!strcasecmp(v->value, "from_channel")) {
+ confp->pri.pri.cpndialplan = 0;
+ } else if (!strcasecmp(v->value, "dynamic")) {
+ confp->pri.pri.cpndialplan = -1;
+ } else if (!strcasecmp(v->value, "redundant")) {
+ confp->pri.pri.cpndialplan = -2;
+ } else {
+ ast_log(LOG_WARNING, "Unknown PRI cpndialplan '%s' at line %d.\n", v->value, v->lineno);
}
} else if (!strcasecmp(v->name, "switchtype")) {
if (!strcasecmp(v->value, "national"))
Modified: trunk/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.c?view=diff&rev=304385&r1=304384&r2=304385
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Wed Jan 26 18:06:27 2011
@@ -7253,6 +7253,9 @@
} else {
prilocaldialplan = PRI_LOCAL_ISDN;
}
+ } else if (prilocaldialplan == -1) {
+ /* Use the numbering plan passed in. */
+ prilocaldialplan = ast->connected.id.number.plan;
}
if (l != NULL) {
while (*l > '9' && *l != '*' && *l != '#') {
@@ -7558,9 +7561,45 @@
ast_debug(1, "Received AST_CONTROL_CONNECTED_LINE on %s\n", chan->name);
if (p->pri && !pri_grab(p, p->pri)) {
struct pri_party_connected_line connected;
+ int dialplan;
+ int prefix_strip;
memset(&connected, 0, sizeof(connected));
sig_pri_party_id_from_ast(&connected.id, &chan->connected.id);
+
+ /* Determine the connected line numbering plan to actually use. */
+ switch (p->pri->cpndialplan) {
+ case -2:/* redundant */
+ case -1:/* dynamic */
+ /* compute dynamically */
+ prefix_strip = 0;
+ if (!strncmp(connected.id.number.str, p->pri->internationalprefix,
+ strlen(p->pri->internationalprefix))) {
+ prefix_strip = strlen(p->pri->internationalprefix);
+ dialplan = PRI_INTERNATIONAL_ISDN;
+ } else if (!strncmp(connected.id.number.str, p->pri->nationalprefix,
+ strlen(p->pri->nationalprefix))) {
+ prefix_strip = strlen(p->pri->nationalprefix);
+ dialplan = PRI_NATIONAL_ISDN;
+ } else {
+ dialplan = PRI_LOCAL_ISDN;
+ }
+ connected.id.number.plan = dialplan;
+
+ if (prefix_strip && p->pri->cpndialplan != -2) {
+ /* Strip the prefix from the connected line number. */
+ memmove(connected.id.number.str,
+ connected.id.number.str + prefix_strip,
+ strlen(connected.id.number.str + prefix_strip) + 1);
+ }
+ break;
+ case 0:/* from_channel */
+ /* Use the numbering plan passed in. */
+ break;
+ default:
+ connected.id.number.plan = p->pri->cpndialplan - 1;
+ break;
+ }
pri_connected_line_update(p->pri->pri, p->call, &connected);
pri_rel(p->pri);
Modified: trunk/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.h?view=diff&rev=304385&r1=304384&r2=304385
==============================================================================
--- trunk/channels/sig_pri.h (original)
+++ trunk/channels/sig_pri.h Wed Jan 26 18:06:27 2011
@@ -404,6 +404,7 @@
unsigned int append_msn_to_user_tag:1;
int dialplan; /*!< Dialing plan */
int localdialplan; /*!< Local dialing plan */
+ int cpndialplan; /*!< Connected party dialing plan */
char internationalprefix[10]; /*!< country access code ('00' for european dialplans) */
char nationalprefix[10]; /*!< area access code ('0' for european dialplans) */
char localprefix[20]; /*!< area access code + area code ('0'+area code for european dialplans) */
Modified: trunk/configs/chan_dahdi.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/chan_dahdi.conf.sample?view=diff&rev=304385&r1=304384&r2=304385
==============================================================================
--- trunk/configs/chan_dahdi.conf.sample (original)
+++ trunk/configs/chan_dahdi.conf.sample Wed Jan 26 18:06:27 2011
@@ -92,33 +92,59 @@
; Send out the specified digits as keypad digits.
;
; PRI Dialplan: The ISDN-level Type Of Number (TON) or numbering plan, used for
-; the dialed number. For most installations, leaving this as 'unknown' (the
-; default) works in the most cases. In some very unusual circumstances, you
-; may need to set this to 'dynamic' or 'redundant'. Note that if you set one
-; of the others, you will be unable to dial another class of numbers. For
-; example, if you set 'national', you will be unable to dial local or
-; international numbers.
-;
-; PRI Local Dialplan: Only RARELY used for PRI (sets the calling number's
-; numbering plan). In North America, the typical use is sending the 10 digit
-; callerID number and setting the prilocaldialplan to 'national' (the default).
-; Only VERY rarely will you need to change this.
-;
-; Neither pridialplan nor prilocaldialplan can be changed on reload.
+; the dialed number. Leaving this as 'unknown' (the default) works for most
+; cases. In some very unusual circumstances, you may need to set this to
+; 'dynamic' or 'redundant'.
;
; unknown: Unknown
; private: Private ISDN
; local: Local ISDN
; national: National ISDN
; international: International ISDN
-; dynamic: Dynamically selects the appropriate dialplan
+; dynamic: Dynamically selects the appropriate dialplan using the
+; prefix settings.
; redundant: Same as dynamic, except that the underlying number is not
; changed (not common)
;
+; pridialplan cannot be changed on reload.
;pridialplan=unknown
+;
+; PRI Local Dialplan: Only RARELY used for PRI (sets the calling number's
+; numbering plan). In North America, the typical use is sending the 10 digit
+; callerID number and setting the prilocaldialplan to 'national' (the default).
+; Only VERY rarely will you need to change this.
+;
+; unknown: Unknown
+; private: Private ISDN
+; local: Local ISDN
+; national: National ISDN
+; international: International ISDN
+; from_channel: Use the CALLERID(ton) value from the channel.
+; dynamic: Dynamically selects the appropriate dialplan using the
+; prefix settings.
+; redundant: Same as dynamic, except that the underlying number is not
+; changed (not common)
+;
+; prilocaldialplan cannot be changed on reload.
;prilocaldialplan=national
;
-; pridialplan may be also set at dialtime, by prefixing the dialled number with
+; PRI Connected Line Dialplan: Sets the connected party number's numbering plan.
+;
+; unknown: Unknown
+; private: Private ISDN
+; local: Local ISDN
+; national: National ISDN
+; international: International ISDN
+; from_channel: Use the CONNECTEDLINE(ton) value from the channel.
+; dynamic: Dynamically selects the appropriate dialplan using the
+; prefix settings.
+; redundant: Same as dynamic, except that the underlying number is not
+; changed (not common)
+;
+; pricpndialplan cannot be changed on reload.
+;pricpndialplan=from_channel
+;
+; pridialplan may be also set at dialtime, by prefixing the dialed number with
; one of the following letters:
; U - Unknown
; I - International
@@ -129,7 +155,7 @@
; R - Reserved (should probably never be used but is included for completeness)
;
; Additionally, you may also set the following NPI bits (also by prefixing the
-; dialled string with one of the following letters):
+; dialed string with one of the following letters):
; u - Unknown
; e - E.163/E.164 (ISDN/telephony)
; x - X.121 (Data)
@@ -139,10 +165,11 @@
; r - Reserved (should probably never be used but is included for completeness)
;
; You may also set the prilocaldialplan in the same way, but by prefixing the
-; Caller*ID Number, rather than the dialled number. Please note that telcos
-; which require this kind of additional manipulation of the TON/NPI are *rare*.
-; Most telco PRIs will work fine simply by setting pridialplan to unknown or
-; dynamic.
+; Caller*ID Number rather than the dialed number.
+
+; Please note that telcos which require this kind of additional manipulation
+; of the TON/NPI are *rare*. Most telco PRIs will work fine simply by
+; setting pridialplan to unknown or dynamic.
;
;
; PRI caller ID prefixes based on the given TON/NPI (dialplan)
More information about the asterisk-commits
mailing list