arnonym / ha-plugins

Home-Assistant SIP Gateway
Apache License 2.0
157 stars 19 forks source link

Calling linphone users directly #56

Closed pergolafabio closed 1 year ago

pergolafabio commented 1 year ago

Hi, i have setup succesfyll your plugin with user 6002 (asterisk endpoint), when i do this service

service: hassio.addon_stdin
data_template:
    addon: c7744bff_ha-sip
    input:
        command: dial
        number: sip:xxx@sip.linphone.org

The linphone user doesnt ring ...

When i call 6001@192.168.0.17 (asterisk endpoint) it succeeds

INVITE sip:XXX@sip.linphone.org SIP/2.0
Via: SIP/2.0/UDP 192.168.0.17:5061;rport;branch=z9hG4bKPjZURLwhG0FAOuo5hSKHpcglRRN70RuRBh
Max-Forwards: 70
From: sip:6002@192.168.0.17;tag=I3sWO3YVt8F4RUbR-9jlS-V6s3jGCIF2
To: sip:XXX@sip.linphone.org
Contact: <sip:6002@192.168.0.17:5061;ob>;+sip.ice
Call-ID: TwjO4O.-OADeTF-9erI.V0R.0JrSjPKC
CSeq: 29161 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
Content-Type: application/sdp
Content-Length:  1201

v=0
o=- 3892704120 3892704120 IN IP4 192.168.0.17
s=pjmedia
b=AS:117
t=0 0
a=X-nat:0
m=audio 4031 RTP/AVP 96 97 98 99 3 0 8 9 100 120 121 122 123
c=IN IP4 192.168.0.17
b=TIAS:96000
a=rtcp:4034 IN IP4 192.168.0.17
a=sendrecv
a=rtpmap:96 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:98 speex/32000
a=rtpmap:99 iLBC/8000
a=fmtp:99 mode=30
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:100 opus/48000/2
a=fmtp:100 useinbandfec=1
a=rtpmap:120 telephone-event/16000
a=fmtp:120 0-16
a=rtpmap:121 telephone-event/8000
a=fmtp:121 0-16
a=rtpmap:122 telephone-event/32000
a=fmtp:122 0-16
a=rtpmap:123 telephone-event/48000
a=fmtp:123 0-16
a=ssrc:16499172 cname:33aa8ebe1b5caf7e
a=ice-ufrag:39a6a81a
a=ice-pwd:665644357bee0abf005d7f4b
a=candidate:Hc0a80011 1 UDP 2130706431 192.168.0.17 4031 typ host
a=candidate:Hac1e2001 1 UDP 2130706175 172.30.32.1 4031 typ host
a=candidate:Hac1ee801 1 UDP 2130705919 172.30.232.1 4031 typ host
a=candidate:Hc0a80011 2 UDP 2130706430 192.168.0.17 4034 typ host
a=candidate:Hac1e2001 2 UDP 2130706174 172.30.32.1 4034 typ host
a=candidate:Hac1ee801 2 UDP 2130705918 172.30.232.1 4034 typ host
--end msg--
pergolafabio commented 1 year ago

disregard, seems there was no diaplan in Asterisk configured for dialing it directly, once added, it worked fine

pergolafabio commented 1 year ago

hmm, gonna reopen this one, i was now testing without asterisk , so created 2 accounts on your plugin, as below

enabled: true
registrar_uri: sip:sip.linphone.org
id_uri: sip:USER1@sip.linphone.org
realm: "*"
user_name: USER1
password: xxxx
answer_mode: listen
settle_time: 1
incoming_call_file: ""

Both accounts are registered fine, when i try to call from USER1 to USER2 i see this:

13:17:02.418           pjsua_core.c  .TX 1844 bytes Request msg INVITE/cseq=15325 (tdta0x7fb57a217018) to UDP 147.135.128.132:5060:
INVITE sip:USER1@sip.linphone.org SIP/2.0
Via: SIP/2.0/UDP 192.168.0.17:5061;rport;branch=z9hG4bKPjgQK9pHRhwTWaeJxOGHcWWX-PIW.4MzEk
Max-Forwards: 70
From: sip:USER2@sip.linphone.org;tag=5-51tUhp2BsLuvjaS0BQsIEHsVoCYSA8
To: sip:USER1@sip.linphone.org
Contact: <sip:USER2@192.168.0.17:5061;ob>;+sip.ice
Call-ID: CBN2FBWKf7dy7ZVT1fXoxP.YysAeRMwj
CSeq: 15325 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
Content-Type: application/sdp
Content-Length:  1203

v=0
o=- 3892706190 3892706190 IN IP4 192.168.0.17
s=pjmedia
b=AS:117
t=0 0
a=X-nat:0
m=audio 4032 RTP/AVP 96 97 98 99 3 0 8 9 100 120 121 122 123
c=IN IP4 192.168.0.17
b=TIAS:96000
a=rtcp:4021 IN IP4 192.168.0.17
a=sendrecv
a=rtpmap:96 speex/16000
a=rtpmap:97 speex/8000
a=rtpmap:98 speex/32000
a=rtpmap:99 iLBC/8000
a=fmtp:99 mode=30
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:100 opus/48000/2
a=fmtp:100 useinbandfec=1
a=rtpmap:120 telephone-event/16000
a=fmtp:120 0-16
a=rtpmap:121 telephone-event/8000
a=fmtp:121 0-16
a=rtpmap:122 telephone-event/32000
a=fmtp:122 0-16
a=rtpmap:123 telephone-event/48000
a=fmtp:123 0-16
a=ssrc:2138496160 cname:1dd9de6e5e03d4d8
a=ice-ufrag:057e6b74
a=ice-pwd:29c714974ed126b05db4ff07
a=candidate:Hc0a80011 1 UDP 2130706431 192.168.0.17 4032 typ host
a=candidate:Hac1e2001 1 UDP 2130706175 172.30.32.1 4032 typ host
a=candidate:Hac1ee801 1 UDP 2130705919 172.30.232.1 4032 typ host
a=candidate:Hc0a80011 2 UDP 2130706430 192.168.0.17 4021 typ host
a=candidate:Hac1e2001 2 UDP 2130706174 172.30.32.1 4021 typ host
a=candidate:Hac1ee801 2 UDP 2130705918 172.30.232.1 4021 typ host
--end msg--
13:17:02.918          pjsua_media.c  ....Call 1: deinitializing media..
13:17:02.918          pjsua_media.c  .....
  [DISCONNCTD] To: sip:USER1@sip.linphone.org
    Call time: 00h:00m:00s, 1st res in 32006 ms, conn in 0ms
13:17:02.918          pjsua_media.c  .....Call 1: cleaning up provisional media, prov_med_cnt=1, med_cnt=0
13:17:02.918                icetp00  .....Stopping ICE, reason=media stop requested
13:17:02.918                icetp00  .....Destroying ICE session 0x7fb57a43d5a8
13:17:02.918          ice_session.c  .....ICE session 0x7fb57a43d5a8 destroyed
13:17:02.918                icetp00  .....ICE stream transport 0x7fb57a215c58 destroyed
| 13:17:02.918475 [3] Call disconnected
| 13:17:02.918557 [ ] Calling webhook sip_call_webhook_id with data {'event': 'call_disconnected', 'caller': 'sip:USER1@sip.linphone.org', 'parsed_caller': 'USER1', 'sip_account': 3}
| 13:17:02.926634 [ ] Webhook response 200 b''
| 13:17:02.926801 [ ] Remove from state: sip:USER1@sip.linphone.org
13:17:03.926            pjsua_aud.c  Closing sound device after idle for 1 second(s)
13:17:03.926            pjsua_aud.c  .Closing null sound device..
arnonym commented 1 year ago

Sorry, I can't support you with that. I have no idea what's going wrong.

pergolafabio commented 1 year ago

Ok, np, I think the issue is that it needs TLS support Although it's a nice plugin, don't think I can use it...

Keep up the good work!