[asterisk-commits] moy: branch 1.6.2 r213791 - in /branches/1.6.2: ./ channels/chan_dahdi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Aug 23 23:54:42 CDT 2009
Author: moy
Date: Sun Aug 23 23:54:38 2009
New Revision: 213791
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=213791
Log:
Merged revisions 213790 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r213790 | moy | 2009-08-24 00:46:28 -0400 (Mon, 24 Aug 2009) | 1 line
improve handling of openr2_chan_disconnect_call API failure, unlikely, but happened on openr2 library bug
........
Modified:
branches/1.6.2/ (props changed)
branches/1.6.2/channels/chan_dahdi.c
Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.2/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/channels/chan_dahdi.c?view=diff&rev=213791&r1=213790&r2=213791
==============================================================================
--- branches/1.6.2/channels/chan_dahdi.c (original)
+++ branches/1.6.2/channels/chan_dahdi.c Sun Aug 23 23:54:38 2009
@@ -1737,6 +1737,19 @@
ast_mutex_unlock(&mfcr2->monitored_count_lock);
}
+static void dahdi_r2_disconnect_call(struct dahdi_pvt *p, openr2_call_disconnect_cause_t cause)
+{
+ if (openr2_chan_disconnect_call(p->r2chan, cause)) {
+ ast_log(LOG_NOTICE, "Bad! failed to disconnect call on channel %d with reason %s, hope for the best!\n",
+ p->channel, openr2_proto_get_disconnect_string(cause));
+ /* force the chan to idle and release the call flag now since we will not see a clean on_call_end */
+ openr2_chan_set_idle(p->r2chan);
+ ast_mutex_lock(&p->lock);
+ p->mfcr2call = 0;
+ ast_mutex_unlock(&p->lock);
+ }
+}
+
static void dahdi_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, const char *dnis, openr2_calling_party_category_t category)
{
struct dahdi_pvt *p;
@@ -1748,7 +1761,7 @@
/* if collect calls are not allowed and this is a collect call, reject it! */
if (!p->mfcr2_allow_collect_calls && category == OR2_CALLING_PARTY_CATEGORY_COLLECT_CALL) {
ast_log(LOG_NOTICE, "Rejecting MFC/R2 collect call\n");
- openr2_chan_disconnect_call(r2chan, OR2_CAUSE_COLLECT_CALL_REJECTED);
+ dahdi_r2_disconnect_call(p, OR2_CAUSE_COLLECT_CALL_REJECTED);
return;
}
ast_mutex_lock(&p->lock);
@@ -1769,7 +1782,7 @@
if (!ast_exists_extension(NULL, p->context, p->exten, 1, p->cid_num)) {
ast_log(LOG_NOTICE, "MFC/R2 call on channel %d requested non-existent extension '%s' in context '%s'. Rejecting call.\n",
p->channel, p->exten, p->context);
- openr2_chan_disconnect_call(r2chan, OR2_CAUSE_UNALLOCATED_NUMBER);
+ dahdi_r2_disconnect_call(p, OR2_CAUSE_UNALLOCATED_NUMBER);
return;
}
if (!p->mfcr2_accept_on_offer) {
@@ -1783,7 +1796,7 @@
return;
}
ast_log(LOG_WARNING, "Unable to create PBX channel in DAHDI channel %d\n", p->channel);
- openr2_chan_disconnect_call(r2chan, OR2_CAUSE_OUT_OF_ORDER);
+ dahdi_r2_disconnect_call(p, OR2_CAUSE_OUT_OF_ORDER);
} else if (p->mfcr2_charge_calls) {
ast_log(LOG_DEBUG, "Accepting MFC/R2 call with charge on chan %d\n", p->channel);
openr2_chan_accept_call(r2chan, OR2_CALL_WITH_CHARGE);
@@ -1835,7 +1848,7 @@
}
ast_log(LOG_WARNING, "Unable to create PBX channel in DAHDI channel %d\n", p->channel);
/* failed to create the channel, bail out and report it as an out of order line */
- openr2_chan_disconnect_call(r2chan, OR2_CAUSE_OUT_OF_ORDER);
+ dahdi_r2_disconnect_call(p, OR2_CAUSE_OUT_OF_ORDER);
return;
}
/* this is an outgoing call, no need to launch the PBX thread, most likely we're in one already */
@@ -1888,10 +1901,10 @@
if (!p->owner) {
ast_mutex_unlock(&p->lock);
/* no owner, therefore we can't use dahdi_hangup to disconnect, do it right now */
- openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING);
+ dahdi_r2_disconnect_call(p, OR2_CAUSE_NORMAL_CLEARING);
return;
}
- /* when we have an owner we don't call openr2_chan_disconnect_call here, that will
+ /* when we have an owner we don't call dahdi_r2_disconnect_call here, that will
be done in dahdi_hangup */
if (p->owner->_state == AST_STATE_UP) {
p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
@@ -4529,13 +4542,13 @@
ast_log(LOG_DEBUG, "disconnecting MFC/R2 call on chan %d\n", p->channel);
/* If it's an incoming call, check the mfcr2_forced_release setting */
if (openr2_chan_get_direction(p->r2chan) == OR2_DIR_BACKWARD && p->mfcr2_forced_release) {
- openr2_chan_disconnect_call(p->r2chan, OR2_CAUSE_FORCED_RELEASE);
+ dahdi_r2_disconnect_call(p, OR2_CAUSE_FORCED_RELEASE);
} else {
const char *r2causestr = pbx_builtin_getvar_helper(ast, "MFCR2_CAUSE");
int r2cause_user = r2causestr ? atoi(r2causestr) : 0;
openr2_call_disconnect_cause_t r2cause = r2cause_user ? dahdi_ast_cause_to_r2_cause(r2cause_user)
: dahdi_ast_cause_to_r2_cause(ast->hangupcause);
- openr2_chan_disconnect_call(p->r2chan, r2cause);
+ dahdi_r2_disconnect_call(p, r2cause);
}
dahdi_r2_update_monitor_count(p->mfcr2, 1);
} else if (p->mfcr2call) {
@@ -14163,6 +14176,7 @@
openr2_chan_set_idle(p->r2chan);
ast_mutex_lock(&p->lock);
p->locallyblocked = 0;
+ p->mfcr2call = 0;
ast_mutex_unlock(&p->lock);
if (channo != -1) {
break;
More information about the asterisk-commits
mailing list