diff options
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_dahdi.c | 15 | ||||
-rw-r--r-- | channels/sig_pri.c | 11 | ||||
-rw-r--r-- | channels/sig_pri.h | 1 |
3 files changed, 23 insertions, 4 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 7df0b592b..8a93673d0 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -5403,7 +5403,7 @@ static int dahdi_func_read(struct ast_channel *chan, const char *function, char { struct dahdi_pvt *p = chan->tech_pvt; int res = 0; - + if (!strcasecmp(data, "rxgain")) { ast_mutex_lock(&p->lock); snprintf(buf, len, "%f", p->rxgain); @@ -5412,8 +5412,19 @@ static int dahdi_func_read(struct ast_channel *chan, const char *function, char ast_mutex_lock(&p->lock); snprintf(buf, len, "%f", p->txgain); ast_mutex_unlock(&p->lock); +#ifdef HAVE_PRI + } else if (!strcasecmp(data, "reversecharge")) { + ast_mutex_lock(&p->lock); + if (p->sig == SIG_PRI || p->sig == SIG_BRI || p->sig == SIG_BRI_PTMP) { + snprintf(buf, len, "%d", ((struct sig_pri_chan *) p->sig_pvt)->reverse_charging_indication); + } else { + *buf = '\0'; + res = -1; + } + ast_mutex_unlock(&p->lock); +#endif } else { - ast_copy_string(buf, "", len); + *buf = '\0'; res = -1; } diff --git a/channels/sig_pri.c b/channels/sig_pri.c index 464dde23a..aac40616e 100644 --- a/channels/sig_pri.c +++ b/channels/sig_pri.c @@ -1163,7 +1163,8 @@ static void *pri_dchannel(void *vpri) pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr); if (e->ring.redirectingreason >= 0) pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason)); - + pri->pvts[chanpos]->reverse_charging_indication = e->ring.reversecharge; + sig_pri_lock_private(pri->pvts[chanpos]); ast_mutex_lock(&pri->lock); @@ -1208,7 +1209,8 @@ static void *pri_dchannel(void *vpri) if (e->ring.redirectingreason >= 0) pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason)); - + pri->pvts[chanpos]->reverse_charging_indication = e->ring.reversecharge; + snprintf(calledtonstr, sizeof(calledtonstr)-1, "%d", e->ring.calledplan); pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr); @@ -1888,6 +1890,11 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, i case 'r': pridialplan = PRI_NPI_RESERVED | (pridialplan & 0xf0); break; +#if defined(PRI_REVERSECHARGE_REQUESTED) + case 'C': + pri_sr_set_reversecharge(sr, PRI_REVERSECHARGE_REQUESTED); + break; +#endif default: if (isalpha(c[p->stripmsd])) { ast_log(LOG_WARNING, "Unrecognized pridialplan %s modifier: %c\n", diff --git a/channels/sig_pri.h b/channels/sig_pri.h index 80cfdd190..10f3618ac 100644 --- a/channels/sig_pri.h +++ b/channels/sig_pri.h @@ -162,6 +162,7 @@ struct sig_pri_chan { struct sig_pri_callback *calls; void *chan_pvt; ast_mutex_t service_lock; /*!< Mutex for service messages */ + int reverse_charging_indication; }; struct sig_pri_pri { |