TECH7Fox / sip-hass-card

A SIP client inside home assistant!
MIT License
189 stars 39 forks source link

Contact is now Unreachable #109

Closed Regressor closed 1 year ago

Regressor commented 1 year ago

Hi. Trying to get SIP card working. I installed a FreePBX, enabled ws/wss transport, accepted certificate and added extensions. Then I added a card and tried to ring from microsip (6006 not available), but asterisk -rvvvvv shows:

  == WebSocket connection from '10.10.100.102:50528' for protocol 'sip' accepted using version '13'
    -- Added contact 'sip:3t96thn9@10.10.100.102:50528;transport=ws' to AOR '6006' with expiration of 600 seconds
  == WebSocket connection from '10.10.100.102:50509' closed
    -- Contact 6006/sip:3t96thn9@10.10.100.102:50528;transport=ws is now Unreachable.  RTT: 0.000 msec
   ........
   -- Executing [s@macro-dial-one:61] NoOp("PJSIP/6001-00000002", "Returned from dial-one with nothing to call and DIALSTATUS: CHANUNAVAIL") in new stack

Chrome F12 dev tool shows ws connection with:

=== Register ====
REGISTER sip:10.10.100.106 SIP/2.0
Via: SIP/2.0/WSS dqv5c64p0qoc.invalid;branch=z9hG4bK3743246
Max-Forwards: 69
To: <sip:6006@10.10.100.106>
From: <sip:6006@10.10.100.106>;tag=hhroe3hc6m
Call-ID: lmjol49hpomub07corita5
CSeq: 2 REGISTER
Authorization: Digest algorithm=MD5, username="6006", realm="asterisk", nonce="1696246793/81493e8b12cb1eb5d6f064203a05cd4a", uri="sip:10.10.100.106", response="6eb1e8058bf3a1d09117dc212a8ba472", opaque="0e9af52970b05a81", qop=auth, cnonce="69946sre5l1h", nc=00000001
Contact: <sip:3t96thn9@dqv5c64p0qoc.invalid;transport=ws>;+sip.ice;reg-id=1;+sip.instance="<urn:uuid:ad1e13e8-059b-45b0-a939-640419000e71>";expires=600
Expires: 600
Allow: INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY
Supported: path,gruu,outbound
User-Agent: JsSIP 3.9.0
Content-Length: 0

=== Register reply ===
SIP/2.0 200 OK
Via: SIP/2.0/WSS dqv5c64p0qoc.invalid;rport=50528;received=10.10.105.102;branch=z9hG4bK3743246
Call-ID: lmjol49hpomub07corita5
From: <sip:6006@10.10.105.106>;tag=hhroe3hc6m
To: <sip:6006@10.10.105.106>;tag=z9hG4bK3743246
CSeq: 2 REGISTER
Date: Mon, 02 Oct 2023 11:39:53 GMT
Contact: <sip:3t96thn9@10.10.105.102:50528;transport=ws>;expires=599
Expires: 600
Server: FPBX-15.0.37.1(17.9.4)
Content-Length:  0

=== Options from server ===
OPTIONS sip:3t96thn9@10.10.105.102:50528;transport=ws SIP/2.0
Via: SIP/2.0/WSS 172.19.0.2:8089;rport;branch=z9hG4bKPj85910c75-8ac4-4d78-bf7f-3a9684a4521b;alias
From: <sip:6006@9935b655ab16>;tag=6a3f5eb1-8cb5-4352-ab80-5d1e849059a3
To: <sip:3t96thn9@10.10.105.102>
Contact: <sip:6006@9935b655ab16:5060;transport=ws>
Call-ID: 57ee2fd9-b4fa-43fb-8b4d-b1d48859bcd7
CSeq: 64313 OPTIONS
Max-Forwards: 70
User-Agent: FPBX-15.0.37.1(17.9.4)
Content-Length:  0

And then nothing server keep sending options and there is no messages from sip card. Asterisk version: 17.9.4 HA version: 2023.7.2 SIP card version: 2.4.0

Am I doing something wrong?

Regressor commented 1 year ago

Ok. This is because of docker-packed asterisk. I sends its own internal rtp address. And card client doesn't reply with OK. Tried network_mode=host and this helped.