[jitsi-dev] Attended transfer Bye delay (make Asterisk crash on stasis app)


I recently Report a bug when an attended transfer is performed by JITSI this make asterisk crash (over an stasis app), asterisk team will fix the crash however seems like the main cause of the issue is at SIP level in JITSI site,

this is the ticket : [https://issues.asterisk.org/jira/browse/ASTERISK-25771](Asterisk Ticket)

Comments from Asterisk Team

**Kevin Harwell / Asterisk Dev**

bridge.c: Crash during attended transfer when missing a local channel half
It's possible for the transferer channel to get hung up early during the
attended transfer process. For instance, a phone may send a "bye" immediately
upon receiving a sip notify that contains a sip frag 100 (I'm looking at you
Jitsi). When this occurs a race begins between the transferer being hung up
and completion of the transfer code.
If the channel hangs up too early during a transfer involving stasis bridging
for instance, then when the created local channel goes to look up its swap
channel (and associated datastore) it can't find it (since it is no longer in
the bridge) thus it fails to enter the stasis application. Consequently, the
created local channel(s) hang up as well. If the timing is just right then the
bridging code attempts to add the message link with missing local channel(s).
Hence the crash.
Unfortunately, there is no great way to solve the problem of the unexpected
"bye". While we can't guarantee we won't receive an early hangup, and in this
case still fail to enter the stasis application, we can make it so asterisk
does not crash.
This patch does just that by locking the local channel structure, checking
that the local channel's peer has not been lost, and then continuing. This
keeps the local channel's peer from being ripped out from underneath it by
the local/unreal hangup code while attempting to set the stasis message link.

Im attaching the capture.

Im using Jitsi (2.8.5426) on mac but seems that this is on all versions.

Anycase I think JITSI should take a look too if they consider this is relevant :slight_smile:

refer_crash_stasis_transfer.pcap.zip (1.22 MB)