mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-17 14:58:34 +00:00
ftmod_libpri: Possible fix for call tear-down problems (+ locking cleanup)
Remove pri_destroycall() in on_hangup() and
use pri_hangup() instead of the deprecated pri_release().
NOTE: The original patch used PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION for the cause
code, which (without pri_enable_hangup_fix() enabled) emits a RELEASE COMPLETE
message. This version of the patch uses PRI_CAUSE_NORMAL_CLEARING (-1). (stkn)
Additionally, use ftdm_set_state() instead of ftdm_set_state_locked() because the channel
is already locked. (stkn)
Completely-untested-by: Stefan Knoblich <stkn@openisdn.net>
This commit is contained in:
1 parent
1447aec426
commit
6196a4199e
1 file changed
+2
-15
@@ -854,7 +854,6 @@ static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even
|
|||||||
{
|
{
|
||||||
ftdm_span_t *span = spri->span;
|
ftdm_span_t *span = spri->span;
|
||||||
ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->hangup.channel);
|
ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->hangup.channel);
|
||||||
/* q931_call *call = NULL; */
|
|
||||||
|
|
||||||
if (!chan) {
|
if (!chan) {
|
||||||
ftdm_log(FTDM_LOG_CRIT, "-- Hangup on channel %d:%d %s but it's not in use?\n", ftdm_span_get_id(spri->span), pevent->hangup.channel);
|
ftdm_log(FTDM_LOG_CRIT, "-- Hangup on channel %d:%d %s but it's not in use?\n", ftdm_span_get_id(spri->span), pevent->hangup.channel);
|
||||||
@@ -868,25 +867,13 @@ static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Make sure we can really tear-down a call, simply ignore the missing call_data and
|
|
||||||
* use the call handle from the event
|
|
||||||
*
|
|
||||||
if (!chan->call_data) {
|
|
||||||
ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s with no call data\n", ftdm_channel_get_state_str(chan));
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
call = (q931_call *)chan->call_data;
|
|
||||||
*/
|
|
||||||
ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", ftdm_span_get_id(spri->span), pevent->hangup.channel);
|
ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", ftdm_span_get_id(spri->span), pevent->hangup.channel);
|
||||||
|
|
||||||
pri_release(spri->pri, pevent->hangup.call, 0);
|
pri_hangup(spri->pri, pevent->hangup.call, -1);
|
||||||
pri_destroycall(spri->pri, pevent->hangup.call);
|
|
||||||
|
|
||||||
chan->caller_data.hangup_cause = pevent->hangup.cause;
|
chan->caller_data.hangup_cause = pevent->hangup.cause;
|
||||||
chan->call_data = NULL;
|
chan->call_data = NULL;
|
||||||
ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING);
|
ftdm_set_state(chan, FTDM_CHANNEL_STATE_TERMINATING);
|
||||||
done:
|
done:
|
||||||
ftdm_channel_unlock(chan);
|
ftdm_channel_unlock(chan);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in new issue
Block a user