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.62k stars 1.43k forks source link

cannot send call when sip_invite_domain=${ipv6} #930

Open sergey-safarov opened 4 years ago

sergey-safarov commented 4 years ago

Describe the bug FS cannot send a call when "sip_invite_domain" contains IPv6 address string.

To Reproduce Steps to reproduce the behavior: 1) required to originate a call using command like

originate [sip_invite_domain='2605::1']sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 &park()

Expected behavior The call will send with From header realm defined in sip_invite_domain variable.

Package version or git hash 1010c6c55c35b9df738c67bc80cb353c873dab76

Trace logs

freeswitch@safarov-dell.home> originate [sip_invite_domain='2605::1']sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 &park()
-ERR NORMAL_UNSPECIFIED

2020-10-27 08:46:18.089150 [DEBUG] switch_ivr_originate.c:2242 Parsing global variables
2020-10-27 08:46:18.089150 [DEBUG] switch_ivr_originate.c:2804 Parsing session specific variables
2020-10-27 08:46:18.089150 [NOTICE] switch_channel.c:1118 New Channel sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 [e1389fb6-1830-11eb-991f-2bb451d37c43]
2020-10-27 08:46:18.089150 [DEBUG] mod_sofia.c:5089 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) State Change CS_NEW -> CS_INIT
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:585 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) Running State Change CS_INIT (Cur 1 Tot 41)
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:628 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) State INIT
2020-10-27 08:46:18.089150 [DEBUG] mod_sofia.c:93 sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 SOFIA INIT
nua_common.c:108 nh_create_handle() nua: nh_create_handle: entering
nua.c:346 nua_handle_bind() nua: nua_handle_bind: entering
2020-10-27 08:46:18.089150 [DEBUG] sofia_glue.c:1618 sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 sending invite version: 1.10.6-dev git 1010c6c 2020-10-08 16:25:54Z 64bit
Local SDP:
v=0
o=FreeSWITCH 1603760166 1603760167 IN IP6 2600:1f1c:99b:fd00::300
s=FreeSWITCH
c=IN IP6 2600:1f1c:99b:fd00::300
t=0 0
m=audio 28212 RTP/AVP 102 9 0 8 105 101
a=rtpmap:102 opus/48000/2
a=fmtp:102 useinbandfec=1; maxaveragebitrate=30000; maxplaybackrate=48000; ptime=20; minptime=10; maxptime=40
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:105 telephone-event/48000
a=fmtp:105 0-16
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
m=video 30148 RTP/AVP 103 104
b=AS:3072
a=rtpmap:103 H264/90000
a=rtpmap:104 VP8/90000
a=sendrecv
a=rtcp-fb:103 ccm fir
a=rtcp-fb:103 ccm tmmbr
a=rtcp-fb:103 nack
a=rtcp-fb:103 nack pli
a=rtcp-fb:104 ccm fir
a=rtcp-fb:104 ccm tmmbr
a=rtcp-fb:104 nack
a=rtcp-fb:104 nack pli

nua.c:637 nua_invite() nua: nua_invite: entering
nua_stack.c:528 nua_signal() nua(0x7f74f000bc50): sent signal r_invite
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:40 sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 Standard INIT
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:48 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) State Change CS_INIT -> CS_ROUTING
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:628 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) State INIT going to sleep
nua_stack.c:569 nua_stack_signal() nua(0x7f74f000bc50): recv signal r_invite
nua_params.c:482 nua_stack_set_params() nua: nua_stack_set_params: entering
soa.c:278 soa_clone() soa_clone(static::0x7f754c001b90, 0x7f754c001390, 0x7f74f000bc50) called
soa.c:402 soa_set_params() soa_set_params(static::0x7f754c0299f0, ...) called
soa.c:402 soa_set_params() soa_set_params(static::0x7f754c0299f0, ...) called
soa.c:1051 soa_set_user_sdp() soa_set_user_sdp(static::0x7f754c0299f0, (nil), 0x7f74f001d35d, -1) called
soa.c:889 soa_set_capability_sdp() soa_set_capability_sdp(static::0x7f754c0299f0, (nil), 0x7f74f001d35d, -1) called
nua_stack.c:271 nua_stack_event() nua(0x7f74f000bc50): event r_invite 900 Internal error at nua_client.c:552
nua_session.c:4135 signal_call_state_change() nua(0x7f74f000bc50): call state changed: init -> terminated
nua_stack.c:271 nua_stack_event() nua(0x7f74f000bc50): event i_state 900 Internal error at nua_client.c:552
nua_stack.c:271 nua_stack_event() nua(0x7f74f000bc50): event i_terminated 900 Internal error at nua_client.c:552
nua_stack.c:359 nua_application_event() nua: nua_application_event: entering
nua_stack.c:359 nua_application_event() nua: nua_application_event: entering
nua_stack.c:359 nua_application_event() nua: nua_application_event: entering
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:585 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) Running State Change CS_ROUTING (Cur 1 Tot 41)
nua.c:370 nua_handle_magic() nua: nua_handle_magic: entering
nua.c:370 nua_handle_magic() nua: nua_handle_magic: entering
nua.c:370 nua_handle_magic() nua: nua_handle_magic: entering
2020-10-27 08:46:18.089150 [DEBUG] sofia.c:7327 Channel sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 entering state [terminated][900]
2020-10-27 08:46:18.089150 [NOTICE] sofia.c:8560 Hangup sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 [CS_ROUTING] [NORMAL_UNSPECIFIED]
nua.c:346 nua_handle_bind() nua: nua_handle_bind: entering
nua.c:925 nua_handle_destroy() nua: nua_handle_destroy: entering
nua_stack.c:528 nua_signal() nua(0x7f74f000bc50): sent signal r_destroy
nua.c:370 nua_handle_magic() nua: nua_handle_magic: entering
nua.c:346 nua_handle_bind() nua: nua_handle_bind: entering
nua.c:925 nua_handle_destroy() nua: nua_handle_destroy: entering
nua.c:370 nua_handle_magic() nua: nua_handle_magic: entering
nua.c:370 nua_handle_magic() nua: nua_handle_magic: entering
nua.c:925 nua_handle_destroy() nua: nua_handle_destroy: entering
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:644 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) State ROUTING
2020-10-27 08:46:18.089150 [DEBUG] mod_sofia.c:154 sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 SOFIA ROUTING
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:644 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) State ROUTING going to sleep
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:585 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) Running State Change CS_HANGUP (Cur 1 Tot 41)
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:848 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) Callstate Change DOWN -> HANGUP
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:850 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) State HANGUP
2020-10-27 08:46:18.089150 [DEBUG] mod_sofia.c:453 Channel sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 hanging up, cause: NORMAL_UNSPECIFIED
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:60 sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 Standard HANGUP, cause: NORMAL_UNSPECIFIED
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:850 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) State HANGUP going to sleep
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:620 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) State Change CS_HANGUP -> CS_REPORTING
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:585 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) Running State Change CS_REPORTING (Cur 1 Tot 41)
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:936 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) State REPORTING
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:174 sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 Standard REPORTING, cause: NORMAL_UNSPECIFIED
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:936 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) State REPORTING going to sleep
2020-10-27 08:46:18.089150 [DEBUG] switch_core_state_machine.c:611 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) State Change CS_REPORTING -> CS_DESTROY
2020-10-27 08:46:18.089150 [DEBUG] switch_core_session.c:1726 Session 41 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) Locked, Waiting on external entities
nua_stack.c:569 nua_stack_signal() nua(0x7f74f000bc50): recv signal r_destroy
nta.c:4476 nta_leg_destroy() nta_leg_destroy((nil))
soa.c:355 soa_destroy() soa_destroy(static::0x7f754c0299f0) called
2020-10-27 08:46:18.109132 [DEBUG] switch_ivr_originate.c:3995 Originate Resulted in Error Cause: 31 [NORMAL_UNSPECIFIED]
2020-10-27 08:46:18.109132 [NOTICE] switch_core_session.c:1744 Session 41 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) Ended
2020-10-27 08:46:18.109132 [NOTICE] switch_core_session.c:1748 Close Channel sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 [CS_DESTROY]
2020-10-27 08:46:18.109132 [DEBUG] switch_core_state_machine.c:739 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) Running State Change CS_DESTROY (Cur 0 Tot 41)
2020-10-27 08:46:18.109132 [DEBUG] switch_core_state_machine.c:749 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) State DESTROY
2020-10-27 08:46:18.109132 [DEBUG] mod_sofia.c:364 sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 SOFIA DESTROY
2020-10-27 08:46:18.109132 [DEBUG] switch_core_state_machine.c:181 sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080 Standard DESTROY
2020-10-27 08:46:18.109132 [DEBUG] switch_core_state_machine.c:749 (sofia/external-ipv6/911@[2600:1f1c:99b:fd00::300]:5080) State DESTROY going to sleep
freeswitch@safarov-dell.home>
nttranbao commented 4 years ago

I tried without '', like "sip_invite_domain=2001:4958:4:3132:10:137:20:205", and it works on 1.10.5...

originate {codec_string=PCMU,sip_invite_domain=2001:4958:4:3132:10:137:20:205,dtmf_type=rfc2833}sofia/caller/911@domain.ca &playback(phrase:funny_prompts)

briankwest commented 4 years ago

sip_invite_domain needs to wrap the IPv6 address in [] to make it valid, you can't put bare IPv6 addresses here.

nttranbao commented 4 years ago

I don't know, but on 1.10.5, it still works without []... But if we can make it work with [], then perfect.

_fs_cli -x "originate {codec_string=PCMU,return_ring_ready=false,rtp_info_when_no_2833=false,origination_caller_id_name=a,origination_caller_id_number=+14166666666,sip_invite_domain=2001:4958:4:3132:10:137:20:205,sip_contact_user=emergency-caller,sip_cid_type=none,originate_timeout=30,rtp_liberal_dtmf=true,dtmf_type=rfc2833}sofia/caller/911@emergency.local.ca;fs_path=sip:10.120.27.4:5060 &playback(phrase:funnyprompts)"

INVITE sip:911@emergency.local.ca SIP/2.0
Via: SIP/2.0/UDP 10.120.27.4:5060;branch=z9hG4bK1cbb.c6a41101.0
Via: SIP/2.0/UDP 10.120.27.4:5080;received=10.120.27.4;rport=5080;branch=z9hG4bK3aX5pXKQvrtjc
Max-Forwards: 69
From: "a" <sip:+14166666666@[2001:4958:4:3132:10:137:20:205]>;tag=yQBU0BB35atKc
To: <sip:911@emergency.local.ca>
Call-ID: 6a500f69-9aec-1239-d3b9-005056a9f3f7
CSeq: 27785504 INVITE
Contact: <sip:emergency-caller@10.120.27.4:5060>
User-Agent: FreeSWITCH-mod_sofia/1.10.5-release~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: 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-Disposition: session
Content-Length: 1278
X-FS-Support: update_display,send_info
Content-Type: application/sdp

v=0
o=FreeSWITCH 1604649539 1604649540 IN IP4 10.120.27.4
s=FreeSWITCH
c=IN IP4 10.120.27.4
t=0 0
m=audio 29054 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
sergey-safarov commented 4 years ago

Two tests above using current master, commit b7b83db66d6d7e60a6a27bc08b7b4ad447c1cd3a.

Mohamed-Abujami commented 8 months ago

I am facing similar issue with sofia recover. is there any release corrected the issue ? running FreeSWITCH (Version 1.10.11-release git 8061d77 2024-01-16 22:35:34Z 64bit)