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;
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")) {
} 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"))
confp->pri.pri.switchtype = PRI_SWITCH_NI2;
} 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 != '#') {
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);
}
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) */
; 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.
+; 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 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.
;
-; Neither pridialplan nor prilocaldialplan can be changed on reload.
-;
; unknown: Unknown
; private: Private ISDN
; local: Local ISDN
; national: National ISDN
; international: International ISDN
-; dynamic: Dynamically selects the appropriate dialplan
+; 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)
;
-;pridialplan=unknown
+; 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
; 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)
; 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)