home-assistant-libs / voip-utils

Apache License 2.0
1 stars 5 forks source link

unable to call from asterisk: Unexpected error handling SIP INVITE #15

Closed 532910 closed 6 months ago

532910 commented 7 months ago
2024-01-30 07:13:59.925 ERROR (MainThread) [voip_utils.sip] Unexpected error handling SIP INVITE
Traceback (most recent call last): 
  File "/usr/local/lib/python3.11/site-packages/voip_utils/sip.py", line 131, in datagram_received
    self.on_call(
  File "/usr/local/lib/python3.11/site-packages/voip_utils/voip.py", line 104, in on_call
    self.answer(call_info, rtp_port)
  File "/usr/local/lib/python3.11/site-packages/voip_utils/sip.py", line 175, in answer
    "Via": call_info.headers["via"],
           ~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: 'via'

asterisk extensions.conf:

exten => 7,1,Dial(PJSIP/ha/sip:ha@<IP>)

pjsip.conf:

[ha]
        type=endpoint
        context=users
        disallow=all
        allow=opus
        callerid="Home Assistant"

HA conf: Settings > Devices & Services > Add integration > add the Voice over IP integration

jaminh commented 6 months ago

What version of Asterisk are you using? I am also using Asterisk for routing calls to Home Assistant but my INVITE messages do have a "via" header. Any chance you could get a packet capture or something and look at what your SIP messages look like?

532910 commented 6 months ago

Asterisk 20.3.0 self-backported from sid to buster, client: latest linphone from f-droid

532910 commented 6 months ago

oh, sorry, looks like it was some misconfiguration on my side, I rewrote config from scratch and now it works fine!