[svn-commits] mattf: branch mattf/bug13454 r148502 - in /team/mattf/bug13454: channels/ con...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Oct 13 11:31:27 CDT 2008
Author: mattf
Date: Mon Oct 13 11:31:26 2008
New Revision: 148502
URL: http://svn.digium.com/view/asterisk?view=rev&rev=148502
Log:
Add patch in from bug 13454, with minor cleanups
Modified:
team/mattf/bug13454/channels/chan_dahdi.c
team/mattf/bug13454/configs/chan_dahdi.conf.sample
Modified: team/mattf/bug13454/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/mattf/bug13454/channels/chan_dahdi.c?view=diff&rev=148502&r1=148501&r2=148502
==============================================================================
--- team/mattf/bug13454/channels/chan_dahdi.c (original)
+++ team/mattf/bug13454/channels/chan_dahdi.c Mon Oct 13 11:31:26 2008
@@ -226,6 +226,10 @@
/*! \brief Protect the interface list (of dahdi_pvt's) */
AST_MUTEX_DEFINE_STATIC(iflock);
+/* QSIG channel mapping option types */
+#define DAHDI_CHAN_MAPPING_LOGICAL 0
+#define DAHDI_CHAN_MAPPING_PHYSICAL 1
+
static int ifcount = 0;
@@ -320,6 +324,8 @@
int prilogicalspan; /*!< Logical span number within trunk group */
int numchans; /*!< Num of channels we represent */
int overlapdial; /*!< In overlap dialing mode */
+ int qsigchannelmapping; /*!< QSIG channel mapping type */
+ int discardremoteholdretrieval; /*!< shall remote hold or remote retrieval notifications be discarded? */
int facilityenable; /*!< Enable facility IEs */
struct pri *dchans[NUM_DCHANS]; /*!< Actual d-channels */
int dchanavail[NUM_DCHANS]; /*!< Whether each channel is available */
@@ -2421,6 +2427,88 @@
{
ast_log(LOG_WARNING, "Use of the command %s is deprecated, please use %s instead.\n", zap_send_keypad_facility_app, dahdi_send_keypad_facility_app);
return send_keypad_facility_exec(chan, data);
+}
+
+static char *dahdi_send_callrerouting_facility_app = "DAHDISendCallreroutingFacility";
+
+static char *dahdi_send_callrerouting_facility_synopsis = "Send QSIG call rerouting facility over a PRI";
+
+static char *dahdi_send_callrerouting_facility_descrip =
+" DAHDISendCallreroutingFacility(): This application will send a Callrerouting Facility\n"
+" IE over the current channel.\n";
+
+static int dahdi_send_callrerouting_facility_exec(struct ast_channel *chan, void *data)
+{
+ /* Data will be our digit string */
+ struct dahdi_pvt *p;
+ char *parse, *tok, *tokb;
+ char *dest = NULL;
+ char *original = NULL;
+ char *reason = NULL;
+ int res = -1;
+
+ if (ast_strlen_zero(data)) {
+ ast_log(LOG_DEBUG, "No data sent to application!\n");
+ return -1;
+ }
+
+ p = (struct dahdi_pvt *)chan->tech_pvt;
+
+ if (!p) {
+ ast_log(LOG_DEBUG, "Unable to find technology private\n");
+ return -1;
+ }
+
+
+ parse = ast_strdupa(data);
+ tok = strtok_r(parse, "|", &tokb);
+
+ if (!tok) {
+ ast_log(LOG_WARNING, "callrerouting facility requires at least destination number argument\n");
+ return -1;
+ }
+ dest = tok;
+
+ tok = strtok_r(NULL, "|", &tokb);
+ if (!tok) {
+ ast_log(LOG_WARNING, "Callrerouting Facility without original called number argument\n");
+ } else {
+ original = tok;
+ }
+
+ tok = strtok_r(NULL, "|", &tokb);
+ if (!tok) {
+ ast_log(LOG_WARNING, "Callrerouting Facility without diversion reason argument\n");
+ return -1;
+ } else {
+ reason = tok;
+ }
+
+ ast_mutex_lock(&p->lock);
+
+ if (!p->pri || !p->call) {
+ ast_log(LOG_DEBUG, "Unable to find pri or call on channel!\n");
+ ast_mutex_unlock(&p->lock);
+ return -1;
+ }
+
+ switch (p->sig) {
+ case SIG_PRI:
+ if (!pri_grab(p, p->pri)) {
+ if (chan->_state == AST_STATE_RING)
+ res = pri_callrerouting_facility(p->pri->pri, p->call, dest, original, reason);
+ pri_rel(p->pri);
+ } else {
+ ast_log(LOG_DEBUG, "Unable to grab pri to send callrerouting facility on span %d!\n", p->span);
+ ast_mutex_unlock(&p->lock);
+ return -1;
+ }
+ break;
+ }
+
+ ast_mutex_unlock(&p->lock);
+
+ return res;
}
static int pri_is_up(struct dahdi_pri *pri)
@@ -5163,7 +5251,7 @@
} else if (!p->progress && p->sig==SIG_PRI && p->pri && !p->outgoing) {
if (p->pri->pri) {
if (!pri_grab(p, p->pri)) {
- pri_progress(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1);
+ pri_progress_with_cause(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1, PRI_CAUSE_USER_BUSY); /* cause = 17 */
pri_rel(p->pri);
}
else
@@ -5223,7 +5311,7 @@
if (!p->progress && p->sig==SIG_PRI && p->pri && !p->outgoing) {
if (p->pri->pri) {
if (!pri_grab(p, p->pri)) {
- pri_progress(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1);
+ pri_progress_with_cause(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1, -1); /* no cause at all */
pri_rel(p->pri);
}
else
@@ -5245,7 +5333,7 @@
} else if (!p->progress && p->sig==SIG_PRI && p->pri && !p->outgoing) {
if (p->pri) {
if (!pri_grab(p, p->pri)) {
- pri_progress(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1);
+ pri_progress_with_cause(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1, PRI_CAUSE_SWITCH_CONGESTION); /* cause = 42 */
pri_rel(p->pri);
} else
ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->span);
@@ -7480,6 +7568,8 @@
pris[span].minunused = conf->pri.minunused;
pris[span].minidle = conf->pri.minidle;
pris[span].overlapdial = conf->pri.overlapdial;
+ pris[span].qsigchannelmapping = conf->pri.qsigchannelmapping;
+ pris[span].discardremoteholdretrieval = conf->pri.discardremoteholdretrieval;
#ifdef HAVE_PRI_INBANDDISCONNECT
pris[span].inbanddisconnect = conf->pri.inbanddisconnect;
#endif
@@ -9595,7 +9685,7 @@
if (chanpos < 0) {
ast_log(LOG_WARNING, "Received NOTIFY on unconfigured channel %d/%d span %d\n",
PRI_SPAN(e->notify.channel), PRI_CHANNEL(e->notify.channel), pri->span);
- } else {
+ } else if (!pri->discardremoteholdretrieval) {
struct ast_frame f = { AST_FRAME_CONTROL, };
ast_mutex_lock(&pri->pvts[chanpos]->lock);
switch (e->notify.info) {
@@ -9677,6 +9767,9 @@
if (pri->switchtype == PRI_SWITCH_GR303_TMC)
pri->overlapdial = 1;
pri_set_overlapdial(pri->dchans[i],pri->overlapdial);
+#ifdef PRI_SET_CHAN_MAPPING_LOGICAL
+ pri_set_chan_mapping_logical(pri->dchans[i], pri->qsigchannelmapping == DAHDI_CHAN_MAPPING_LOGICAL);
+#endif
#ifdef HAVE_PRI_INBANDDISCONNECT
pri_set_inbanddisconnect(pri->dchans[i], pri->inbanddisconnect);
#endif
@@ -10818,6 +10911,7 @@
if (*dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) {
ast_unregister_application(dahdi_send_keypad_facility_app);
+ ast_unregister_application(dahdi_send_callrerouting_facility_app);
}
ast_unregister_application(zap_send_keypad_facility_app);
#endif
@@ -11477,6 +11571,16 @@
ast_copy_string(confp->pri.idledial, v->value, sizeof(confp->pri.idledial));
} else if (!strcasecmp(v->name, "overlapdial")) {
confp->pri.overlapdial = ast_true(v->value);
+ } else if (!strcasecmp(v->name, "qsigchannelmapping")) {
+ if (!strcasecmp(v->value, "logical")) {
+ confp->pri.qsigchannelmapping = DAHDI_CHAN_MAPPING_LOGICAL;
+ } else if (!strcasecmp(v->value, "physical")) {
+ confp->pri.qsigchannelmapping = DAHDI_CHAN_MAPPING_PHYSICAL;
+ } else {
+ confp->pri.qsigchannelmapping = DAHDI_CHAN_MAPPING_PHYSICAL;
+ }
+ } else if (!strcasecmp(v->name, "discardremoteholdretrieval")) {
+ confp->pri.discardremoteholdretrieval = ast_true(v->value);
#ifdef HAVE_PRI_INBANDDISCONNECT
} else if (!strcasecmp(v->name, "inbanddisconnect")) {
confp->pri.inbanddisconnect = ast_true(v->value);
@@ -11837,6 +11941,8 @@
if (*dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) {
ast_register_application(dahdi_send_keypad_facility_app, dahdi_send_keypad_facility_exec,
dahdi_send_keypad_facility_synopsis, dahdi_send_keypad_facility_descrip);
+ ast_register_application(dahdi_send_callrerouting_facility_app, dahdi_send_callrerouting_facility_exec,
+ dahdi_send_callrerouting_facility_synopsis, dahdi_send_callrerouting_facility_descrip);
}
ast_register_application(zap_send_keypad_facility_app, zap_send_keypad_facility_exec,
zap_send_keypad_facility_synopsis, zap_send_keypad_facility_descrip);
Modified: team/mattf/bug13454/configs/chan_dahdi.conf.sample
URL: http://svn.digium.com/view/asterisk/team/mattf/bug13454/configs/chan_dahdi.conf.sample?view=diff&rev=148502&r1=148501&r2=148502
==============================================================================
--- team/mattf/bug13454/configs/chan_dahdi.conf.sample (original)
+++ team/mattf/bug13454/configs/chan_dahdi.conf.sample Mon Oct 13 11:31:26 2008
@@ -133,6 +133,15 @@
; If you need to override the existing channels selection routine and force all
; PRI channels to be marked as exclusively selected, set this to yes.
; priexclusive = yes
+;
+;
+; If you need to use the logical channel mapping with your Q.SIG PRI instead
+; of the physical mapping you must use the qsigchannelmapping option.
+;
+; logical: Use the logical channel mapping
+; physical: Use physical channel mapping (default)
+;
+;qsigchannelmapping=logical
;
; ISDN Timers
; All of the ISDN timers and counters that are used are configurable. Specify
More information about the svn-commits
mailing list