signalwire / freeswitch

FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device.
https://freeswitch.com/#getting-started
Other
3.65k stars 1.44k forks source link

FreeSWITCH Not Compliant with RFC3515 - Not Processing REFER - $250 Bounty #592

Open palmtown opened 4 years ago

palmtown commented 4 years ago

Hello,

Can you please modify FreeSWITCH so that it processes a REFER packet if there is no exten? In some cases, a REFER may simply be sent to a music on hold server which does not require an exten. In sofia.c, line 9437, it has an if statement if (exten) and if it is not present, it will not process the REFER. However, for the music on hold server that it is being referred to, an exten is not required to play the hold music.

I found that https://tools.ietf.org/html/rfc3515#section-2.1 does not specially state that an exten is required, and in theory, is not required in all cases. For example, in the case of a music moh server, an exten is not required.

briankwest commented 4 years ago

Please attach all logs, debug, and packet captures.

briankwest commented 4 years ago

Also have you tried to remove that line of code in the bug report and let us know?

palmtown commented 4 years ago

Hey Brian,

I hope you are doing well. No, I have not modified the code, however, I have traced the issue to that line. Also, note that FreeSWITCH simply sends an Accepted immediately and no further packets afterwards which creates a problem for the call.

Here's the info:

Logs

2020-04-28 14:41:21.665867 [DEBUG] sofia.c:7301 Channel sofia/external/%2B13232472525@sip.extensionone.com:5061 entering state [completed][200]
2020-04-28 14:41:21.745866 [DEBUG] sofia.c:7301 Channel sofia/external/%2B13232472525@sip.extensionone.com:5061 entering state [ready][200]
2020-04-28 14:41:22.425866 [DEBUG] sofia.c:8810 Process REFER to [(null)@sip.extensionone.com]

Packets

recv 1064 bytes from udp/[192.168.0.219]:5060 at 13:48:11.842984:
------------------------------------------------------------------------
REFER sip:mod_sofia@192.168.0.84:5060 SIP/2.0
FROM: <sip:+13232472525@sip.extensionone.com:5061;transport=tls>;tag=2274d851e95949d98eb51bab358927b9
TO: <sip:13232471133@192.168.0.84>;tag=FUgpHaD0Fpy8c
CSEQ: 3 REFER
CALL-ID: 5012c6ec-7705-4b39-876a-506e23d16832
MAX-FORWARDS: 30
Via: SIP/2.0/UDP sip.internalone.com:5060;branch=z9hG4bK55d4.92d35fa6.0;cid=3;i=3bbd8485
CONTACT: <sip:X.did.02d.163cc6f4@sip.internalone.com>
CONTENT-LENGTH: 0
REFER-TO: <sip:sip.extensionone.com:5061;transport=tls;x-m=8:cusid:8ddb935b-eadb-41f5-82a4-5364c79445;x-t=4f6f34c5-7400-48fd-a0db-a397c179445>
REFERRED-BY: <sip:sip.extensionone.com:5061;x-m=8:cusid:8ddb935b-eadb-41f5-82a4-5364c79445;x-t=4f6f34c5-7400-48fd-a0db-a397c179445;x-ti=97571c7e-ca07-43b8-831d-4a21779445;x-tt=aHR0cHM6Ly9hcGktZHUtYi11c2VhLnBzdG5odWIubWljcm9zb2Z0LmNvbS92MS9uZ2MvY2FsbG5vdGlmaWNhdGlvbj9kY2k9NmIwM2I5MDQ0ZWJjNGRiM2FhMGNjOGQ1NzIxZjAyMDI%3D>
USER-AGENT: Client Softphone v1.2
ALLOW: INVITE,ACK,OPTIONS,CANCEL,BYE,NOTIFYsend 820 bytes to udp/[192.168.0.219]:5060 at 13:48:11.856719:
------------------------------------------------------------------------
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP sip.internalone.com:5060;branch=z9hG4bK55d4.92d35fa6.0;cid=3;i=3bbd8485;received=192.168.0.219
FROM: <sip:+13232472525@sip.extensionone.com:5061;transport=tls>;tag=2274d851e95949d98eb51bab358927b9
TO: <sip:13232471133@192.168.0.84>;tag=FUgpHaD0Fpy8c
CALL-ID: 5012c6ec-7705-4b39-876a-506e23d16832
CSEQ: 3 REFER
Contact: <sip:mod_sofia@192.168.0.84:5060>
Expires: 60
User-Agent: FreeSWITCH
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, PRACK, NOTIFY, PUBLISH, SUBSCRIBE
Supported: precondition, 100rel, timer, path, replaces
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Content-Length: 0
briankwest commented 4 years ago

You'll need to build a SIPP scenario that replicates this issue and attach it here. Its because the user part of your refer to url is missing.