presence (BLFs) not working via wss
Open
gmaruzz
opened this issue 6 years ago
•
12 comments
if you subscribe via wss you get a correct 202 Accepted
But you will never get any NOTIFYs, they are not sent at all by FS
`SUBSCRIBE sip:[email protected] SIP/2.0
Via: SIP/2.0/WSS sfrf189ajb4d.invalid;branch=z9hG4bK1361360
Max-Forwards: 70
To: sip:[email protected]
From: sip:[email protected] ;tag=daqq4ltf69
Call-ID: 7f897lg1unplj6hqbnef
CSeq: 9414 SUBSCRIBE
Proxy-Authorization: Digest algorithm=MD5, username="1010", realm="192.168.10.1", nonce="61d1bc7a-ccc4-4ef7-975f-9ebe9507b249", uri="sip:[email protected] ", response="8366b2a0e852276ddc3a22bddefb08d8", qop=auth, cnonce="5vpou1gt696t", nc=00000001
Event: presence
Expires: 3600
Contact: sip:[email protected] ;transport=wss
Allow: ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER
Supported: outbound
User-Agent: SIP.js
Content-Length: 0
SIP/2.0 202 Accepted
Via: SIP/2.0/WSS sfrf189ajb4d.invalid;branch=z9hG4bK1361360;received=192.168.10.32;rport=42396
From: sip:[email protected] ;tag=daqq4ltf69
To: sip:[email protected] ;tag=T7acd6tRLtjW
Call-ID: 7f897lg1unplj6hqbnef
CSeq: 9414 SUBSCRIBE
Contact: sip:[email protected] :5060
Expires: 3600
User-Agent: FreeSWITCH
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
Subscription-State: active;expires=3600
Content-Length: 0
`
FreeSWITCH Version 1.10.2-release-13-f7bdd3845a~64bit (-release-13-f7bdd3845a 64bit)
on a later run, with a different subscription, I saw with presence debug that it tries to send the notify, but nothing goes out...
`2020-02-20 19:09:19.181709 [NOTICE] sofia_presence.c:2790 SEND PRESENCE
To: [email protected]
From: [email protected]
Call-ID: 7f897lg1unplj6hqbnef
Profile: internal [internal]
2020-02-20 19:09:19.181709 [ERR] sofia_presence.c:2304 SEND PRES NOTIFY:
file[sofia_presence.c]
func[sofia_presence_sub_callback]
line[3222]
profile[internal]
via[]
ip[192.168.10.32]
port[42396]
route[(null)]
contact["user" sip:[email protected] ;transport=wss ]
to[sip:[email protected] ;tag=T7acd6tRLtjW]
from[sip:[email protected] ;tag=daqq4ltf69]
url[sip:[email protected] ;transport=wss]
call_id[7f897lg1unplj6hqbnef]
expires_str[]
event[presence]
ct[application/pidf+xml]
pl[
open
<dm:person id='p06360c4a'>
dm:note Available</dm:note>
</dm:person>
]
call_info[]
exptime[2320]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 0[proto] = [sip]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 1[sip_user] = [1010]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 2[sip_host] = [192.168.10.1]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 3[sub_to_user] = [1011]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 4[sub_to_host] = [192.168.10.1]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 5[event] = [presence]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 6[contact] = ["user" sip:[email protected] ;transport=wss ]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 7[call_id] = [8fuamjh3109dpb8caj9d]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 8[full_from] = [sip:[email protected] ;tag=ucb9ksd538]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 9[full_via] = [SIP/2.0/WSS pbi2s1qtb1dp.invalid;branch=z9hG4bK3165754;received=192.168.10.32;rport=45100]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 10[expires] = [1582228401]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 11[user_agent] = [SIP.js]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 12[accept] = []
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 13[profile_name] = [internal]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 14['Available'] = [Available]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 15['unknown'] = [unknown]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 16['192.168.10.1'] = [192.168.10.1]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 17[status] = []
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 18[rpid] = []
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 19[open_closed] = [open]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 20[''] = []
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 21[''] = []
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 22[version] = [10]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 23[''] = []
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 24[orig_proto] = []
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 25[full_to] = [sip:[email protected] ;tag=VsBwhAYwLCS2]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 26[network_ip] = [192.168.10.32]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2654 arg 27[network_port] = [45100]
2020-02-20 19:09:19.181709 [CRIT] sofia_presence.c:2656 DUMP
Event-Name: [PRESENCE_IN]
Core-UUID: [4d677114-43d2-4077-8283-df546dd28307]
FreeSWITCH-Hostname: [stretch01]
FreeSWITCH-Switchname: [stretch01]
FreeSWITCH-IPv4: [192.168.10.1]
FreeSWITCH-IPv6: [::1]
Event-Date-Local: [2020-02-20 19:09:19]
Event-Date-GMT: [Thu, 20 Feb 2020 19:09:19 GMT]
Event-Date-Timestamp: [1582225759161708]
Event-Calling-File: [switch_channel.c]
Event-Calling-Function: [switch_channel_perform_presence]
Event-Calling-Line-Number: [799]
Event-Sequence: [9142]
Channel-State: [CS_HANGUP]
Channel-Call-State: [HANGUP]
Channel-State-Number: [11]
Channel-Name: [sofia/internal/[email protected] ]
Unique-ID: [fb5c4335-32d2-4fda-ad40-3db1290574fb]
Call-Direction: [inbound]
Presence-Call-Direction: [inbound]
Channel-HIT-Dialplan: [true]
Channel-Presence-ID: [[email protected] ]
Channel-Call-UUID: [fb5c4335-32d2-4fda-ad40-3db1290574fb]
Answer-State: [hangup]
Hangup-Cause: [NORMAL_CLEARING]
Channel-Read-Codec-Name: [PCMA]
Channel-Read-Codec-Rate: [8000]
Channel-Read-Codec-Bit-Rate: [64000]
Channel-Write-Codec-Name: [PCMA]
Channel-Write-Codec-Rate: [8000]
Channel-Write-Codec-Bit-Rate: [64000]
Caller-Direction: [inbound]
Caller-Logical-Direction: [inbound]
Caller-Username: [1011]
Caller-Dialplan: [XML]
Caller-Caller-ID-Name: [1011]
Caller-Caller-ID-Number: [1011]
Caller-Orig-Caller-ID-Name: [1011]
Caller-Orig-Caller-ID-Number: [1011]
Caller-Network-Addr: [192.168.10.32]
Caller-ANI: [1011]
Caller-Destination-Number: [*9664]
Caller-Unique-ID: [fb5c4335-32d2-4fda-ad40-3db1290574fb]
Caller-Source: [mod_sofia]
Caller-Context: [192.168.10.1]
Caller-Channel-Name: [sofia/internal/[email protected] ]
Caller-Profile-Index: [1]
Caller-Profile-Created-Time: [1582225755601706]
Caller-Channel-Created-Time: [1582225755601706]
Caller-Channel-Answered-Time: [1582225755621712]
Caller-Channel-Progress-Time: [0]
Caller-Channel-Progress-Media-Time: [0]
Caller-Channel-Hangup-Time: [1582225759161708]
Caller-Channel-Transfer-Time: [0]
Caller-Channel-Resurrect-Time: [0]
Caller-Channel-Bridged-Time: [0]
Caller-Channel-Last-Hold: [0]
Caller-Channel-Hold-Accum: [0]
Caller-Screen-Bit: [true]
Caller-Privacy-Hide-Name: [false]
Caller-Privacy-Hide-Number: [false]
proto: [any]
login: [src/switch_channel.c]
from: [[email protected] ]
rpid: [unknown]
status: [CS_HANGUP]
event_type: [presence]
alt_event_type: [dialog]
presence-call-info-state: [idle]
presence-call-direction: [inbound]
event_count: [2]
Presence-Calling-File: [src/switch_core_state_machine.c]
Presence-Calling-Function: [check_presence]
Presence-Calling-Line: [525]
2020-02-20 19:09:19.181709 [NOTICE] sofia_presence.c:2790 SEND PRESENCE
To: [email protected]
From: [email protected]
Call-ID: 8fuamjh3109dpb8caj9d
Profile: internal [internal]
2020-02-20 19:09:19.181709 [ERR] sofia_presence.c:2304 SEND PRES NOTIFY:
file[sofia_presence.c]
func[sofia_presence_sub_callback]
line[3222]
profile[internal]
via[]
ip[192.168.10.32]
port[45100]
route[(null)]
contact["user" sip:[email protected] ;transport=wss ]
to[sip:[email protected] ;tag=VsBwhAYwLCS2]
from[sip:[email protected] ;tag=ucb9ksd538]
url[sip:[email protected] ;transport=wss]
call_id[8fuamjh3109dpb8caj9d]
expires_str[]
event[presence]
ct[application/pidf+xml]
pl[
open
<dm:person id='p06360c4a'>
dm:note Available</dm:note>
</dm:person>
]
call_info[]
exptime[2642]
2020-02-20 19:09:19.181709 [INFO] sofia_presence.c:1530 IN END_PRESENCE_SQL (internal)
`
sofia_contact [email protected] sofia/internal/sip:[email protected] ;transport=wss;fs_nat=yes;fs_path=sip%3Ah0nfvc11%40192.168.10.32%3A45100%3Btransport%3Dwss
I don't think this was ever intended to work via WSS.
ping... is probably not such a big bug... just getting the outbound socket right... or there is more to it?
@gmaruzz seems it isn't bug from FreeSWITCH. It seems you are using SIP.js, right? If yes then seems bug from SIP.js because it's sending contact header Contact: sip:[email protected] ;transport=wss I'm facing same issue.
While I gave a try to SIPml5 for the same FreeSWITCH without any changes and it works. After differentiating SUBSCRIBE packets send by both (SIP.js and SIPml5), I found difference for contact header only.
anshkatriya:
seems to me is a bug in freeswitch, fixed by my patch, included: patch.diff.txt
patch.diff.txt
Brian:
I don't think this was ever intended to work via WSS.
I made a quick and dirty patch, attached
patch.diff.txt
@mjerris : I added a patch ^ that makes it work, is probably a bad patch in many aspects, but gives you an hint :)
I'm also having the same problem. I was be able to fix the problem setting these params. However it's not working right now.
<param name="aggressive-nat-detection" value="true"/>
Jul 27
'20 17:07
zek
switch_strdup allocates memory, so you should call switch_safe_free(username) later otherwise there's a small leak.
We adapted the patch also for the ws case and can confirm that's working correctly on our side, with or without aggressive-nat-detection enabled (with aggressive-nat-detection there's no need for the patch, it works by default).