arnonym / ha-plugins

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

command: answer hangs after a 2nd call. #18

Closed Bram-diederik closed 1 year ago

Bram-diederik commented 1 year ago

I made a phone assistant.

But If i make a call to home for the 2nd time the automation hangs after i Press a 2.

I think something is unstable in the menu code. Automations that directly trigger a action and hangup when a call is made dont have this particular issue.

code in community post.

https://community.home-assistant.io/t/asterisk-incomming-call-assistant/480823

13:30:24.602                icetp00  Stopping ICE, reason=No ICE found in SDP offer
13:30:24.602                icetp00  Destroying ICE session 0x3efe76a8
13:30:24.602           pjsua_call.c  Answering call 1: code=180
13:30:24.604           pjsua_core.c  ....TX 521 bytes Response msg 180/INVITE/cseq=4398 (tdta0x3efd97d8) to UDP 192.168.5.14:5060:
SIP/2.0 180 Ringing

Via: SIP/2.0/UDP 192.168.5.14:5060;rport=5060;received=192.168.5.14;branch=z9hG4bKPjf117efa4-97e7-4ba8-b726-e6b7860d488c

Call-ID: 0e0c1edc-d391-4b91-830b-9dd8a762f7a6

From: <sip:5555@192.168.5.14>;tag=2c9f594d-5c59-4698-b292-6270aaea6f4d

To: <sip:6010@192.168.5.20;ob>;tag=kTKXX-ovE7OeSBTcEnraYmsBzK.-zem-

CSeq: 4398 INVITE

Contact: <sip:6010@192.168.5.20:5060;ob>;+sip.ice

Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS

Content-Length:  0

--end msg--
| Early
| Got "answer" command for 5555
| Trigger answer of call (if not established already)
| Call will be answered now.
13:30:25.680           pjsua_call.c  Answering call 1: code=200
13:30:25.680          inv0x3efb6a68  ..SDP negotiation done: Success
13:30:25.680          pjsua_media.c  ...Call 1: updating media..
13:30:25.680          pjsua_media.c  .....Media stream call01:0 is destroyed
13:30:25.680            pjsua_aud.c  ....Audio channel update..
13:30:25.681         strm0x3efcc3d8  .....VAD temporarily disabled
13:30:25.681         strm0x3efcc3d8  .....Encoder stream started
13:30:25.681         strm0x3efcc3d8  .....Decoder stream started
13:30:25.681          pjsua_media.c  ....Audio updated, stream #0: PCMA (sendrecv)
| onCallMediaState call info state 3
| Connected media 1
13:30:25.682           pjsua_core.c  ....TX 967 bytes Response msg 200/INVITE/cseq=4398 (tdta0x3efdc328) to UDP 192.168.5.14:5060:
SIP/2.0 200 OK

Via: SIP/2.0/UDP 192.168.5.14:5060;rport=5060;received=192.168.5.14;branch=z9hG4bKPjf117efa4-97e7-4ba8-b726-e6b7860d488c

Call-ID: 0e0c1edc-d391-4b91-830b-9dd8a762f7a6

From: <sip:5555@192.168.5.14>;tag=2c9f594d-5c59-4698-b292-6270aaea6f4d

To: <sip:6010@192.168.5.20;ob>;tag=kTKXX-ovE7OeSBTcEnraYmsBzK.-zem-

CSeq: 4398 INVITE

Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS

Contact: <sip:6010@192.168.5.20:5060;ob>;+sip.ice

Supported: replaces, 100rel, timer, norefersub

Session-Expires: 1800;refresher=uac

Require: timer

Content-Type: application/sdp

Content-Length:   316

v=0

o=- 3876121824 3876121825 IN IP4 192.168.5.20

s=pjmedia

b=AS:84

t=0 0

a=X-nat:0

m=audio 4027 RTP/AVP 8 101

c=IN IP4 192.168.5.20

b=TIAS:64000

a=rtcp:4018 IN IP4 192.168.5.20

a=sendrecv

a=rtpmap:8 PCMA/8000

a=ssrc:1521919759 cname:330142fb00e29128

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-16

--end msg--
| Call connecting...
13:30:25.685           pjsua_core.c  .RX 431 bytes Request msg ACK/cseq=4398 (rdata0x3efad608) from UDP 192.168.5.14:5060:
ACK sip:6010@192.168.5.20:5060;ob SIP/2.0

Via: SIP/2.0/UDP 192.168.5.14:5060;rport;branch=z9hG4bKPj5162f819-35ed-430d-9214-220be191c771

From: <sip:5555@192.168.5.14>;tag=2c9f594d-5c59-4698-b292-6270aaea6f4d

To: <sip:6010@192.168.5.20;ob>;tag=kTKXX-ovE7OeSBTcEnraYmsBzK.-zem-

Call-ID: 0e0c1edc-d391-4b91-830b-9dd8a762f7a6

CSeq: 4398 ACK

Max-Forwards: 70

User-Agent: Asterisk PBX 16.16.1~dfsg-1+deb11u1

Content-Length:  0

--end msg--
| Call connected
| Call is established.
| Calling webhook sip_call_webhook_id with data {'event': 'call_established', 'caller': '<sip:5555@192.168.5.14>', 'parsed_caller': '5555'}
| Webhook response 200 b''
| Playing message: Goede Middag Bram Diederik. Bram is bezig Weekend vieren en kan waarschijnlijk niet de telefoon opnemen  Toets  2 voor toegang of 1 voor voicemail.
13:30:27.387            pjsua_aud.c  Creating file player: /tmp/tmpn2ler6ph.wav..
13:30:27.388           wav_player.c  .File player '/tmp/tmpn2ler6ph.wav' created: samp.rate=24000, ch=1, bufsize=4KB, filesize=544KB
13:30:27.389            pjsua_aud.c  .Player created, id=1, slot=3
13:30:27.389            pjsua_aud.c  Conf connect: 3 --> 1
13:30:27.389            pjsua_aud.c  .Set sound device: capture=-99, playback=-99, mode=0
13:30:27.389            pjsua_aud.c  ..Null sound device, mode setting is ignored
13:30:27.389            pjsua_aud.c  ..Setting null sound device..
13:30:27.389            pjsua_aud.c  ...Opening null sound device..
13:30:27.389           conference.c  .Port 3 (/tmp/tmpn2ler6ph.wav) transmitting to port 1 (sip:5555@192.168.5.14)
| No action supplied
13:30:28.032         strm0x3efcc3d8  VAD re-enabled
| Playback done.
| Scheduled post action: noop
| onDtmfDigit: digit 2
| Calling webhook sip_call_webhook_id with data {'event': 'dtmf_digit', 'caller': '<sip:5555@192.168.5.14>', 'parsed_caller': '5555', 'digit': '2'}
| Webhook response 200 b''
| Current input: 2
| Playing message: welkom
Bram-diederik commented 1 year ago

Fixed in next2 see #19 for logs