diff options
author | Richard Mudgett <rmudgett@digium.com> | 2011-01-27 00:06:27 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2011-01-27 00:06:27 +0000 |
commit | ecdbb3d1d924163e38a91848816353953dd3d5ec (patch) | |
tree | 438a3a6bf7087d6269980a86954277c22ac4e923 | |
parent | 1c60cead78a942a334c181d40d41d8d26f31f724 (diff) |
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
..........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@304385 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | channels/chan_dahdi.c | 23 | ||||
-rw-r--r-- | channels/sig_pri.c | 39 | ||||
-rw-r--r-- | channels/sig_pri.h | 1 | ||||
-rw-r--r-- | configs/chan_dahdi.conf.sample | 59 |
4 files changed, 106 insertions, 16 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 7cf585a31..09f461259 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -12270,6 +12270,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf, 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,6 +16972,8 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct 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")) { @@ -16978,6 +16981,26 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct } 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; diff --git a/channels/sig_pri.c b/channels/sig_pri.c index 27e5dcf0b..2efc666ab 100644 --- a/channels/sig_pri.c +++ b/channels/sig_pri.c @@ -7253,6 +7253,9 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, i } 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,10 +7561,46 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi 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); } diff --git a/channels/sig_pri.h b/channels/sig_pri.h index 1c3750800..53a4b8604 100644 --- a/channels/sig_pri.h +++ b/channels/sig_pri.h @@ -404,6 +404,7 @@ struct sig_pri_span { 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) */ diff --git a/configs/chan_dahdi.conf.sample b/configs/chan_dahdi.conf.sample index 0c0bed722..c176789a6 100644 --- a/configs/chan_dahdi.conf.sample +++ b/configs/chan_dahdi.conf.sample @@ -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. +; 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 @@ -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) |