aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormartinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b>2003-08-05 01:25:43 +0000
committermartinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b>2003-08-05 01:25:43 +0000
commitcdf786eef5325bef38b468ceab52adf257d4d840 (patch)
tree08cc87dde65aae7dfcb9a521d276b7f670f76afa /channels
parentdccb0f55b7f4591afa557ddf4d86b0989f3086e5 (diff)
Fix and improve the new pri hangup routines
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1262 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_zap.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 0d46dbb84..1be12ccb5 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -1614,6 +1614,7 @@ static int zt_hangup(struct ast_channel *ast)
if (p->sig == SIG_PRI) {
if (p->call) {
if (!pri_grab(p, p->pri)) {
+#ifndef NEW_PRI_HANGUP
if (!p->alreadyhungup) {
res = pri_disconnect(p->pri->pri, p->call, PRI_CAUSE_NORMAL_CLEARING);
} else {
@@ -1621,6 +1622,12 @@ static int zt_hangup(struct ast_channel *ast)
p->call = NULL;
p->alreadyhungup = 0;
}
+#else
+#ifndef PRI_HANGUP
+#error Please update libpri. The new hangup routines were implemented. You can debug then using "pri debug span <span_no>". If you dont want to update libpri code simply comment out OPTIONS += -DNEW_PRI_HANGUP in asterisk/Makefile
+#endif
+ pri_hangup(p->pri->pri, p->call, -1);
+#endif
if (res < 0)
ast_log(LOG_WARNING, "pri_disconnect failed\n");
pri_rel(p->pri);
@@ -5685,7 +5692,11 @@ static void *pri_dchannel(void *vpri)
zt_enable_ec(pri->pvt[chan]);
} else {
ast_log(LOG_WARNING, "Unable to start PBX on channel %d, span %d\n", chan, pri->span);
+#if NEW_PRI_HANGUP
+ pri_hangup(pri->pri, e->ring.call, PRI_CAUSE_SWITCH_CONGESTION);
+#else
pri_release(pri->pri, e->ring.call, PRI_CAUSE_SWITCH_CONGESTION);
+#endif
pri->pvt[chan]->call = 0;
}
} else {
@@ -5696,11 +5707,19 @@ static void *pri_dchannel(void *vpri)
} else {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Extension '%s' in context '%s' from '%s' does not exist. Rejecting call on channel %d, span %d\n",pri->pvt[chan]->exten, pri->pvt[chan]->context, pri->pvt[chan]->callerid, chan, pri->span);
+#ifdef NEW_PRI_HANGUP
+ pri_hangup(pri->pri, e->ring.call, PRI_CAUSE_UNALLOCATED);
+#else
pri_release(pri->pri, e->ring.call, PRI_CAUSE_UNALLOCATED);
+#endif
}
}
} else
+#ifdef NEW_PRI_HANGUP
+ pri_hangup(pri->pri, e->ring.call, PRI_CAUSE_REQUESTED_CHAN_UNAVAIL);
+#else
pri_release(pri->pri, e->ring.call, PRI_CAUSE_REQUESTED_CHAN_UNAVAIL);
+#endif
break;
case PRI_EVENT_RINGING:
chan = e->ringing.channel;