Issue with Second Re-INVITE Handling in FreeSWITCH
Describe the bug I am currently conducting a test involving a caller, a FreeSWITCH B2BUA, and a callee. The caller and callee are SIPp instances, and the call flow is as follows:
1. Starting the dialog:
- The caller sends an INVITE with only audio codec 8 to FreeSWITCH.
- FreeSWITCH creates an INVITE and send it to the callee on B leg.
- The callee accepts the call, and the ACK has been relayed.
2. First Re-INVITE:
- The callee sends a re-INVITE to the caller to add a video stream.
- The caller rejects this with a 488 Not Acceptable SIP Response.
- FreeSWITCH correctly relays these messages.
3. Problem with Second Re-INVITE:
- The caller then sends another re-INVITE to change the audio codec from 8 to 18 "I did this basic example, same behavior if the caller requested to add video stream or changing to an other codec".
- FreeSWITCH receives the re-INVITE and replies with a 100 Trying but does not send anything to the callee.
- I have disabled the SOA with this line the dialplan
<action application="export" data="sip_enable_soa=false"/>and still getting same behavior.
SIP messages in A leg "the caller and freeSWITCH":
SIP messages in B leg "freeSWTCH and the callee":
4. Important note:
- If the first re-INVITE had been accepted, the second re-INVITE is relayed and accepted as expected.
Here is the link of SIPp scenarios I am using for both the caller and callee:
- UAC "caller": https://github.com/medOualla/freeswitch_reinvite/blob/main/SIPp%20scenarios/0.uac.xml
- UAS "callee": https://github.com/medOualla/freeswitch_reinvite/blob/main/SIPp%20scenarios/1.uas.xml
Here is the link of SIP traces captured on freeSWITCH in case of succeed re-INVITE and failed scenario:
- re-INVITE with issue: https://github.com/medOualla/freeswitch_reinvite/blob/main/SIP%20traces/2.re_invite_issue.pcap
- re-INVITE success: https://github.com/medOualla/freeswitch_reinvite/blob/main/SIP%20traces/3.re_invite_succeed.pcap
To Reproduce Steps to reproduce the behavior:
- Using re-INVITE scenario, the callee rejects the first re-INVITE, then send an other re-INVITE
Expected behavior freeSWITCH should relay the second re-INVITE to the other leg like the case when the first re-INVITE has received a 200 OK.
Package version or git hash
- Version 1.10.9-release
Trace logs freeswitch@freeswitch> 2024-09-09 16:42:57.414267 98.30% [NOTICE] switch_channel.c:1123 New Channel sofia/TRUSTED/[email protected]:5080 [11695011-294a-4a68-81c6-96f4285b277b] 2024-09-09 16:42:57.414267 98.30% [DEBUG] switch_core_state_machine.c:581 (sofia/TRUSTED/[email protected]:5080) Running State Change CS_NEW (Cur 5 Tot 5) 2024-09-09 16:42:57.414267 98.30% [INFO] sofia.c:10453 sofia/TRUSTED/[email protected]:5080 receiving invite from 10.10.10.2:5080 version: 1.10.9-release git a615e85 2023-02-03 20:07:30Z 64bit call-id: [email protected] 2024-09-09 16:42:57.414267 98.30% [DEBUG] sofia.c:10547 verifying acl "INBOUND_PEERS_ACL" for ip/port 10.10.10.2:0. 2024-09-09 16:42:57.414267 98.30% [DEBUG] sofia.c:7487 Channel sofia/TRUSTED/[email protected]:5080 entering state [received][100] 2024-09-09 16:42:57.414267 98.30% [DEBUG] sofia.c:7497 Remote SDP: v=0 o=jack 48221196 8722611489 IN IP4 10.10.10.2 s=- c=IN IP4 10.10.10.2 t=0 0 m=audio 6000 RTP/AVP 8 a=rtpmap:8 PCMA/8000
2024-09-09 16:42:57.414267 98.30% [DEBUG] sofia.c:7900 (sofia/TRUSTED/[email protected]:5080) State Change CS_NEW -> CS_INIT
2024-09-09 16:42:57.414267 98.30% [DEBUG] switch_core_state_machine.c:600 (sofia/TRUSTED/[email protected]:5080) State NEW
2024-09-09 16:42:57.414267 98.30% [DEBUG] switch_core_state_machine.c:581 (sofia/TRUSTED/[email protected]:5080) Running State Change CS_INIT (Cur 5 Tot 5)
2024-09-09 16:42:57.414267 98.30% [DEBUG] switch_core_state_machine.c:624 (sofia/TRUSTED/[email protected]:5080) State INIT
2024-09-09 16:42:57.414267 98.30% [DEBUG] mod_sofia.c:97 sofia/TRUSTED/[email protected]:5080 SOFIA INIT
2024-09-09 16:42:57.414267 98.30% [DEBUG] switch_core_state_machine.c:40 sofia/TRUSTED/[email protected]:5080 Standard INIT
2024-09-09 16:42:57.414267 98.30% [DEBUG] switch_core_state_machine.c:48 (sofia/TRUSTED/[email protected]:5080) State Change CS_INIT -> CS_ROUTING
2024-09-09 16:42:57.414267 98.30% [DEBUG] switch_core_state_machine.c:624 (sofia/TRUSTED/[email protected]:5080) State INIT going to sleep
2024-09-09 16:42:57.414267 98.30% [DEBUG] switch_core_state_machine.c:581 (sofia/TRUSTED/[email protected]:5080) Running State Change CS_ROUTING (Cur 5 Tot 5)
2024-09-09 16:42:57.414267 98.30% [DEBUG] switch_channel.c:2380 (sofia/TRUSTED/[email protected]:5080) Callstate Change DOWN -> RINGING
2024-09-09 16:42:57.414267 98.30% [DEBUG] switch_core_state_machine.c:640 (sofia/TRUSTED/[email protected]:5080) State ROUTING
2024-09-09 16:42:57.414267 98.30% [DEBUG] mod_sofia.c:158 sofia/TRUSTED/[email protected]:5080 SOFIA ROUTING
2024-09-09 16:42:57.414267 98.30% [DEBUG] switch_core_state_machine.c:230 sofia/TRUSTED/[email protected]:5080 Standard ROUTING
2024-09-09 16:42:57.414267 98.30% [INFO] mod_dialplan_xml.c:639 Processing jack
2024-09-09 16:42:57.434058 98.30% [DEBUG] switch_core_state_machine.c:40 sofia/UNTRUSTED/[email protected]:5060 Standard INIT 2024-09-09 16:42:57.434058 98.30% [DEBUG] switch_core_state_machine.c:48 (sofia/UNTRUSTED/[email protected]:5060) State Change CS_INIT -> CS_ROUTING 2024-09-09 16:42:57.434058 98.30% [DEBUG] switch_core_state_machine.c:624 (sofia/UNTRUSTED/[email protected]:5060) State INIT going to sleep 2024-09-09 16:42:57.434058 98.30% [DEBUG] switch_core_state_machine.c:581 (sofia/UNTRUSTED/[email protected]:5060) Running State Change CS_ROUTING (Cur 6 Tot 6) 2024-09-09 16:42:57.434058 98.30% [DEBUG] switch_core_state_machine.c:640 (sofia/UNTRUSTED/[email protected]:5060) State ROUTING 2024-09-09 16:42:57.434058 98.30% [DEBUG] mod_sofia.c:158 sofia/UNTRUSTED/[email protected]:5060 SOFIA ROUTING 2024-09-09 16:42:57.434058 98.30% [DEBUG] switch_ivr_originate.c:67 (sofia/UNTRUSTED/[email protected]:5060) State Change CS_ROUTING -> CS_CONSUME_MEDIA 2024-09-09 16:42:57.434058 98.30% [DEBUG] switch_core_state_machine.c:640 (sofia/UNTRUSTED/[email protected]:5060) State ROUTING going to sleep 2024-09-09 16:42:57.434058 98.30% [DEBUG] switch_core_state_machine.c:581 (sofia/UNTRUSTED/[email protected]:5060) Running State Change CS_CONSUME_MEDIA (Cur 6 Tot 6) 2024-09-09 16:42:57.434058 98.30% [DEBUG] sofia.c:7487 Channel sofia/UNTRUSTED/[email protected]:5060 entering state [calling][0] 2024-09-09 16:42:57.434058 98.30% [DEBUG] switch_core_state_machine.c:659 (sofia/UNTRUSTED/[email protected]:5060) State CONSUME_MEDIA 2024-09-09 16:42:57.434058 98.30% [DEBUG] switch_core_state_machine.c:659 (sofia/UNTRUSTED/[email protected]:5060) State CONSUME_MEDIA going to sleep 2024-09-09 16:42:57.434058 98.30% [DEBUG] sofia.c:7487 Channel sofia/UNTRUSTED/[email protected]:5060 entering state [proceeding][180] 2024-09-09 16:42:57.434058 98.30% [NOTICE] sofia.c:7598 Ring-Ready sofia/UNTRUSTED/[email protected]:5060! 2024-09-09 16:42:57.434058 98.30% [DEBUG] switch_channel.c:3494 (sofia/UNTRUSTED/[email protected]:5060) Callstate Change DOWN -> RINGING 2024-09-09 16:42:57.434058 98.30% [DEBUG] sofia.c:7487 Channel sofia/UNTRUSTED/[email protected]:5060 entering state [completing][200] 2024-09-09 16:42:57.434058 98.30% [DEBUG] sofia.c:7497 Remote SDP: v=0 o=sara 48221196 8722611489 IN IP4 200.200.200.2 s=- c=IN IP4 200.200.200.2 t=0 0 m=audio 6008 RTP/AVP 8 a=rtpmap:8 PCMA/8000
2024-09-09 16:42:57.434058 98.30% [NOTICE] sofia.c:8637 Channel [sofia/UNTRUSTED/[email protected]:5060] has been answered 2024-09-09 16:42:57.434058 98.30% [DEBUG] switch_channel.c:3893 (sofia/UNTRUSTED/[email protected]:5060) Callstate Change RINGING -> ACTIVE 2024-09-09 16:42:57.454343 98.30% [NOTICE] switch_ivr_originate.c:565 Ring Ready sofia/TRUSTED/[email protected]:5080! 2024-09-09 16:42:57.454343 98.30% [DEBUG] switch_ivr_originate.c:3902 Originate Resulted in Success: [sofia/UNTRUSTED/[email protected]:5060] Peer UUID: 81e56a4e-1f86-4502-be60-95754031a453 2024-09-09 16:42:57.454343 98.30% [NOTICE] switch_ivr.c:820 Channel [sofia/TRUSTED/[email protected]:5080] has been answered 2024-09-09 16:42:57.454343 98.30% [DEBUG] switch_channel.c:3893 (sofia/TRUSTED/[email protected]:5080) Callstate Change RINGING -> ACTIVE 2024-09-09 16:42:57.454343 98.30% [DEBUG] sofia.c:7487 Channel sofia/TRUSTED/[email protected]:5080 entering state [completed][200] 2024-09-09 16:42:57.454343 98.30% [DEBUG] switch_ivr_bridge.c:1587 (sofia/TRUSTED/[email protected]:5080) State Change CS_EXECUTE -> CS_HIBERNATE 2024-09-09 16:42:57.454343 98.30% [DEBUG] switch_ivr_bridge.c:1588 (sofia/UNTRUSTED/[email protected]:5060) State Change CS_CONSUME_MEDIA -> CS_HIBERNATE 2024-09-09 16:42:57.454343 98.30% [DEBUG] switch_core_state_machine.c:581 (sofia/UNTRUSTED/[email protected]:5060) Running State Change CS_HIBERNATE (Cur 6 Tot 6) 2024-09-09 16:42:57.454343 98.30% [DEBUG] switch_core_state_machine.c:662 (sofia/UNTRUSTED/[email protected]:5060) State HIBERNATE 2024-09-09 16:42:57.454343 98.30% [DEBUG] mod_sofia.c:195 sofia/UNTRUSTED/[email protected]:5060 SOFIA HIBERNATE 2024-09-09 16:42:57.454343 98.30% [DEBUG] switch_core_state_machine.c:417 sofia/UNTRUSTED/[email protected]:5060 Standard HIBERNATE 2024-09-09 16:42:57.454343 98.30% [DEBUG] switch_core_state_machine.c:662 (sofia/UNTRUSTED/[email protected]:5060) State HIBERNATE going to sleep 2024-09-09 16:42:57.454343 98.30% [DEBUG] sofia.c:7487 Channel sofia/TRUSTED/[email protected]:5080 entering state [ready][200] 2024-09-09 16:42:57.454343 98.30% [DEBUG] sofia.c:7487 Channel sofia/UNTRUSTED/[email protected]:5060 entering state [ready][200] 2024-09-09 16:42:57.454343 98.30% [DEBUG] switch_core_state_machine.c:647 (sofia/TRUSTED/[email protected]:5080) State EXECUTE going to sleep 2024-09-09 16:42:57.454343 98.30% [DEBUG] switch_core_state_machine.c:581 (sofia/TRUSTED/[email protected]:5080) Running State Change CS_HIBERNATE (Cur 6 Tot 6) 2024-09-09 16:42:57.454343 98.30% [DEBUG] switch_core_state_machine.c:662 (sofia/TRUSTED/[email protected]:5080) State HIBERNATE 2024-09-09 16:42:57.454343 98.30% [DEBUG] mod_sofia.c:195 sofia/TRUSTED/[email protected]:5080 SOFIA HIBERNATE 2024-09-09 16:42:57.454343 98.30% [DEBUG] switch_core_state_machine.c:417 sofia/TRUSTED/[email protected]:5080 Standard HIBERNATE 2024-09-09 16:42:57.454343 98.30% [DEBUG] switch_core_state_machine.c:662 (sofia/TRUSTED/[email protected]:5080) State HIBERNATE going to sleep 2024-09-09 16:42:58.474089 98.23% [DEBUG] sofia.c:7487 Channel sofia/UNTRUSTED/[email protected]:5060 entering state [received][100] 2024-09-09 16:42:58.474089 98.23% [DEBUG] sofia.c:7497 Remote SDP: v=0 o=sara 48221196 8722611489 IN IP4 200.200.200.2 s=- c=IN IP4 200.200.200.2 t=0 0 m=audio 6008 RTP/AVP 8 a=rtpmap:8 PCMA/8000 m=video 6010 RTP/AVP 34 2024-09-09 16:42:58.474089 98.23% [DEBUG] sofia.c:8264 Passing SDP to other leg. v=0 o=sara 48221196 8722611489 IN IP4 200.200.200.2 s=- c=IN IP4 200.200.200.2 t=0 0 m=audio 6008 RTP/AVP 8 a=rtpmap:8 PCMA/8000 m=video 6010 RTP/AVP 34
2024-09-09 16:42:58.474089 98.23% [DEBUG] mod_sofia.c:1647 sofia/TRUSTED/[email protected]:5080 Sending media re-direct: v=0 o=sara 48221196 8722611489 IN IP4 200.200.200.2 s=- c=IN IP4 200.200.200.2 t=0 0 m=audio 6008 RTP/AVP 8 a=rtpmap:8 PCMA/8000 m=video 6010 RTP/AVP 34
2024-09-09 16:42:58.474089 98.23% [INFO] sofia_glue.c:1654 sofia/TRUSTED/[email protected]:5080 sending invite call-id: (null) 2024-09-09 16:42:58.474089 98.23% [DEBUG] sofia_glue.c:1657 sofia/TRUSTED/[email protected]:5080 sending invite version: 1.10.9-release git a615e85 2023-02-03 20:07:30Z 64bit Local SDP: v=0 o=sara 48221196 8722611489 IN IP4 200.200.200.2 s=- c=IN IP4 200.200.200.2 t=0 0 m=audio 6008 RTP/AVP 8 a=rtpmap:8 PCMA/8000 m=video 6010 RTP/AVP 34
2024-09-09 16:42:58.474089 98.23% [DEBUG] sofia.c:7487 Channel sofia/TRUSTED/[email protected]:5080 entering state [calling][0] 2024-09-09 16:42:58.474089 98.23% [DEBUG] sofia.c:7051 Passing 488 Not Acceptable to other leg
2024-09-09 16:42:58.474089 98.23% [DEBUG] sofia.c:7480 Channel sofia/TRUSTED/[email protected]:5080 skipping state [ready][488] 2024-09-09 16:42:58.474089 98.23% [DEBUG] mod_sofia.c:2352 Responding with 488 [Not Acceptable] 2024-09-09 16:42:58.474089 98.23% [DEBUG] sofia.c:7480 Channel sofia/UNTRUSTED/[email protected]:5060 skipping state [ready][488] 2024-09-09 16:43:01.474156 98.23% [DEBUG] sofia.c:7487 Channel sofia/TRUSTED/[email protected]:5080 entering state [received][100] 2024-09-09 16:43:01.474156 98.23% [DEBUG] sofia.c:7497 Remote SDP: v=0 o=jack 48221196 8722611489 IN IP4 10.10.10.2 s=- c=IN IP4 10.10.10.2 t=0 0 m=audio 6000 RTP/AVP 18 a=rtpmap:18 PCMU/8000
backtrace from core file I do not have it