Channel hangs up soon after answering

I have a call scenario on Asterisk 18 where the channel hangs up soon after answering it.
The call is a simple peer to peer call using SIP technology and both phones reside on the same server.

Below are the codecs in my configuration:

>core show translation
         Translation times between formats (in microseconds) for one second of data
          Source Format (Rows) Destination Format (Columns)

          codec2  ulaw  alaw   gsm  g726 g726aal2 adpcm slin8 slin12 slin16 slin24 slin32 slin44 slin48 slin96 slin192 lpc10 speex8 speex16 speex32  g722 testlaw
   codec2      - 15000 15000 15000 15000    15000 15000  9000  17000  17000  17000  17000  17000  17000  17000   17000 15000  15000   23000   23000 17250   15000
     ulaw  15000     -  9150 15000 15000    15000 15000  9000  17000  17000  17000  17000  17000  17000  17000   17000 15000  15000   23000   23000 17250   15000
     alaw  15000  9150     - 15000 15000    15000 15000  9000  17000  17000  17000  17000  17000  17000  17000   17000 15000  15000   23000   23000 17250   15000
      gsm  15000 15000 15000     - 15000    15000 15000  9000  17000  17000  17000  17000  17000  17000  17000   17000 15000  15000   23000   23000 17250   15000
     g726  15000 15000 15000 15000     -    15000 15000  9000  17000  17000  17000  17000  17000  17000  17000   17000 15000  15000   23000   23000 17250   15000
 g726aal2  15000 15000 15000 15000 15000        - 15000  9000  17000  17000  17000  17000  17000  17000  17000   17000 15000  15000   23000   23000 17250   15000
    adpcm  15000 15000 15000 15000 15000    15000     -  9000  17000  17000  17000  17000  17000  17000  17000   17000 15000  15000   23000   23000 17250   15000
    slin8   6000  6000  6000  6000  6000     6000  6000     -   8000   8000   8000   8000   8000   8000   8000    8000  6000   6000   14000   14000  8250    6000
   slin12  14500 14500 14500 14500 14500    14500 14500  8500      -   8000   8000   8000   8000   8000   8000    8000 14500  14500   14000   14000 14000   14500
   slin16  14500 14500 14500 14500 14500    14500 14500  8500   8500      -   8000   8000   8000   8000   8000    8000 14500  14500    6000   14000  6000   14500
   slin24  14500 14500 14500 14500 14500    14500 14500  8500   8500   8500      -   8000   8000   8000   8000    8000 14500  14500   14500   14000 14500   14500
   slin32  14500 14500 14500 14500 14500    14500 14500  8500   8500   8500   8500      -   8000   8000   8000    8000 14500  14500   14500    6000 14500   14500
   slin44  14500 14500 14500 14500 14500    14500 14500  8500   8500   8500   8500   8500      -   8000   8000    8000 14500  14500   14500   14500 14500   14500
   slin48  14500 14500 14500 14500 14500    14500 14500  8500   8500   8500   8500   8500   8500      -   8000    8000 14500  14500   14500   14500 14500   14500
   slin96  14500 14500 14500 14500 14500    14500 14500  8500   8500   8500   8500   8500   8500   8500      -    8000 14500  14500   14500   14500 14500   14500
  slin192  14500 14500 14500 14500 14500    14500 14500  8500   8500   8500   8500   8500   8500   8500   8500       - 14500  14500   14500   14500 14500   14500
    lpc10  15000 15000 15000 15000 15000    15000 15000  9000  17000  17000  17000  17000  17000  17000  17000   17000     -  15000   23000   23000 17250   15000
   speex8  15000 15000 15000 15000 15000    15000 15000  9000  17000  17000  17000  17000  17000  17000  17000   17000 15000      -   23000   23000 17250   15000
  speex16  23500 23500 23500 23500 23500    23500 23500 17500  17500   9000  17000  17000  17000  17000  17000   17000 23500  23500       -   23000 15000   23500
  speex32  23500 23500 23500 23500 23500    23500 23500 17500  17500  17500  17500   9000  17000  17000  17000   17000 23500  23500   23500       - 23500   23500
     g722  15600 15600 15600 15600 15600    15600 15600  9600  17500   9000  17000  17000  17000  17000  17000   17000 15600  15600   15000   23000     -   15600
  testlaw  15000 15000 15000 15000 15000    15000 15000  9000  17000  17000  17000  17000  17000  17000  17000   17000 15000  15000   23000   23000 17250       -

Below is my general context setting in sip.conf:

[general]
registertimeout=20
context=default 
allowguest=no 
allowoverlap=no 
realm=voip 
bindport=5060 
bindaddr=0.0.0.0
srvlookup=no 
pedantic=no 
tos_sip=cs3 
tos_audio=ef 
maxexpiry=180
minexpiry=60 
defaultexpiry=120 
disallow=all 
allow=alaw 
allow=ulaw
language=en
useragent=pbx
dtmfmode=auto 
relaxdtmf=yes
rtptimeout=60 
rtpholdtimeout=900 
rtpkeepalive=5 
notifyringing=yes 
nat=force_rport,comedia
rtcachefriends=no 
rtupdate=yes 
qualify=yes 
t38pt_udptl=yes 
checkmwi=30 
videosupport=yes 
rtautoclear=5 
ignoreregexpire=yes 
limitonpeers=yes 
pedantic=yes 
rtsavesysname=yes 
allow=h261
allow=h263
allow=h263p
allow=h264
context=default
subscribecontext=default
dumphistory=yes
notifyhold = yes
notifycid = yes 
qualifyfreq=120
qualifypeers=1
qualifygap=10
canreinvite=no
directmedia=no
directrtpsetup = yes
tos=0x10
trustrpid=yes
rpid_update=yes
callingpres=allowed
callerid=Withheld 
promiscredir = no 
timert1=500

I am attaching the pcap screenshot of the failed call:

can anyone guide me what the isse might be?

Please enable the full log and issue the CLI command “sip set debug on”, and make sure verbosity is at least three. Provide the full log as text.

If this is a new installation, please throw away sip.conf and start again with pjsip.conf. chan_sip no longer exists in Asterisk 21. If not new, please make plans to move to chan_pjsip, in the near future.

You have an unusually large number of options explicitly set, including at least one under both its current and deprecated names.

These are the latest call logs…

<--- SIP read from UDP:10.10.7.84:5060 --->
INVITE sip:7405@10.10.7.31;user=phone SIP/2.0
Via: SIP/2.0/UDP 10.10.7.84:5060;branch=z9hG4bK2530259951433717288
From: 1*7403 <sip:1*7403@10.10.7.31:5060>;tag=324626869
To: "7405" <sip:7405@10.10.7.31;user=phone>
Call-ID: 26403207688085-180471502717797@10.10.7.84
CSeq: 1 INVITE
Contact: <sip:1*7403@10.10.7.84:5060>
Max-Forwards: 70
Supported: replaces, join, path
User-Agent: Fanvil C62 2.1.11.11
Allow: INVITE, ACK, OPTIONS, BYE, CANCEL, REFER, NOTIFY, INFO, PRACK, UPDATE, MESSAGE
Content-Type: application/sdp
Content-Length: 290

v=0
o=1*7403 678322367 1384932460 IN IP4 10.10.7.84
s=A conversation
c=IN IP4 10.10.7.84
t=0 0
m=audio 10242 RTP/AVP 9 18 0 8 101
a=rtpmap:9 G722/16000
a=rtpmap:18 G729/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
<------------->
--- (13 headers 13 lines) ---
Sending to 10.10.7.84:5060 (NAT)
Sending to 10.10.7.84:5060 (NAT)
Using INVITE request as basis request - 26403207688085-180471502717797@10.10.7.84
[Jul  2 13:51:06] WARNING[3209][C-00000084]: sip/config_parser.c:818 sip_parse_nat_option: nat=yes is deprecated, use nat=force_rport,comedia instead
[Jul  2 13:51:06] WARNING[3209][C-00000084]: sip/config_parser.c:818 sip_parse_nat_option: nat=yes is deprecated, use nat=force_rport,comedia instead
[Jul  2 13:51:06] WARNING[3209][C-00000084]: sip/config_parser.c:818 sip_parse_nat_option: nat=yes is deprecated, use nat=force_rport,comedia instead
Found peer '1*7403' for '1*7403' from 10.10.7.84:5060

<--- Reliably Transmitting (NAT) to 10.10.7.84:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.10.7.84:5060;branch=z9hG4bK2530259951433717288;received=10.10.7.84;rport=5060
From: 1*7403 <sip:1*7403@10.10.7.31:5060>;tag=324626869
To: "7405" <sip:7405@10.10.7.31;user=phone>;tag=as46ba2982
Call-ID: 26403207688085-180471502717797@10.10.7.84
CSeq: 1 INVITE
Server: pbx
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="voip", nonce="75affddf"
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '26403207688085-180471502717797@10.10.7.84' in 6400 ms (Method: INVITE)
Reliably Transmitting (NAT) to 10.10.7.84:5060:
OPTIONS sip:1*6498@10.10.7.84:5060;sip:1*7403@10.10.7.84:5060 SIP/2.0
Via: SIP/2.0/UDP 10.10.7.31:5060;branch=z9hG4bK7abaa88e;rport
Max-Forwards: 70
From: "Withheld" <sip:Withheld@10.10.7.31>;tag=as481e7d52
To: <sip:1*6498@10.10.7.84:5060;sip:1*7403@10.10.7.84:5060>
Contact: <sip:Withheld@10.10.7.31:5060>
Call-ID: 7c172d2a626454ac114a40ca6620bedd@10.10.7.31:5060
CSeq: 102 OPTIONS
User-Agent: pbx
Date: Tue, 02 Jul 2024 09:51:06 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---

<--- SIP read from UDP:10.10.7.84:5060 --->
ACK sip:7405@10.10.7.31;user=phone SIP/2.0
Via: SIP/2.0/UDP 10.10.7.84:5060;branch=z9hG4bK2530259951433717288
From: 1*7403 <sip:1*7403@10.10.7.31:5060>;tag=324626869
To: "7405" <sip:7405@10.10.7.31;user=phone>;tag=as46ba2982
Call-ID: 26403207688085-180471502717797@10.10.7.84
CSeq: 1 ACK
Contact: <sip:1*7403@10.10.7.84:5060>
Max-Forwards: 70
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---

<--- SIP read from UDP:10.10.7.84:5060 --->
INVITE sip:7405@10.10.7.31;user=phone SIP/2.0
Via: SIP/2.0/UDP 10.10.7.84:5060;branch=z9hG4bK147232383689032244
From: 1*7403 <sip:1*7403@10.10.7.31:5060>;tag=324626869
To: "7405" <sip:7405@10.10.7.31;user=phone>
Call-ID: 26403207688085-180471502717797@10.10.7.84
CSeq: 2 INVITE
Contact: <sip:1*7403@10.10.7.84:5060>
Authorization: Digest username="1*7403", realm="voip", nonce="75affddf", uri="sip:7405@10.10.7.31;user=phone", response="907155430984c5898a6de88bdf344cfd", algorithm=MD5
Max-Forwards: 70
Supported: replaces, join, path
User-Agent: Fanvil C62 2.1.11.11
Allow: INVITE, ACK, OPTIONS, BYE, CANCEL, REFER, NOTIFY, INFO, PRACK, UPDATE, MESSAGE
Content-Type: application/sdp
Content-Length: 290

v=0
o=1*7403 678322367 1384932460 IN IP4 10.10.7.84
s=A conversation
c=IN IP4 10.10.7.84
t=0 0
m=audio 10242 RTP/AVP 9 18 0 8 101
a=rtpmap:9 G722/16000
a=rtpmap:18 G729/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
<------------->
--- (14 headers 13 lines) ---
Sending to 10.10.7.84:5060 (NAT)
Using INVITE request as basis request - 26403207688085-180471502717797@10.10.7.84
[Jul  2 13:51:06] WARNING[3209][C-00000084]: sip/config_parser.c:818 sip_parse_nat_option: nat=yes is deprecated, use nat=force_rport,comedia instead
[Jul  2 13:51:06] WARNING[3209][C-00000084]: sip/config_parser.c:818 sip_parse_nat_option: nat=yes is deprecated, use nat=force_rport,comedia instead
[Jul  2 13:51:06] WARNING[3209][C-00000084]: sip/config_parser.c:818 sip_parse_nat_option: nat=yes is deprecated, use nat=force_rport,comedia instead
Found peer '1*7403' for '1*7403' from 10.10.7.84:5060
  == Using SIP VIDEO CoS mark 6
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
Got SDP version 1384932460 and unique parts [1*7403 678322367 IN IP4 10.10.7.84]
Found RTP audio format 9
Found RTP audio format 18
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 101
Found unknown media description format G722 for ID 9
Found audio description format G729 for ID 18
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Found audio description format telephone-event for ID 101
Capabilities: us - (alaw|ulaw|h261|h263|h263p|h264), peer - audio=(ulaw|alaw|g729)/video=(nothing)/text=(nothing), combined - (alaw|ulaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 10.10.7.84:10242
Peer doesn't provide video
Looking for 7405 in default (domain 10.10.7.31)
[Jul  2 13:51:06] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7403-0000009b
[Jul  2 13:51:06] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7403-0000009b
[Jul  2 13:51:06] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7403-0000009b
sip_route_dump: route/path hop: <sip:1*7403@10.10.7.84:5060>

<--- Transmitting (NAT) to 10.10.7.84:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.10.7.84:5060;branch=z9hG4bK147232383689032244;received=10.10.7.84;rport=5060
From: 1*7403 <sip:1*7403@10.10.7.31:5060>;tag=324626869
To: "7405" <sip:7405@10.10.7.31;user=phone>
Call-ID: 26403207688085-180471502717797@10.10.7.84
CSeq: 2 INVITE
Server: pbx
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:7405@10.10.7.31:5060>
Content-Length: 0


<------------>
Reliably Transmitting (NAT) to 10.10.7.84:5060:
OPTIONS sip:1*6498@10.10.7.84:5060;sip:1*7403@10.10.7.84:5060 SIP/2.0
Via: SIP/2.0/UDP 10.10.7.31:5060;branch=z9hG4bK38cd521d;rport
Max-Forwards: 70
From: "Withheld" <sip:Withheld@10.10.7.31>;tag=as12aa993c
To: <sip:1*6498@10.10.7.84:5060;sip:1*7403@10.10.7.84:5060>
Contact: <sip:Withheld@10.10.7.31:5060>
Call-ID: 2b4a0faf4e6fe2de39a825a006976159@10.10.7.31:5060
CSeq: 102 OPTIONS
User-Agent: pbx
Date: Tue, 02 Jul 2024 09:51:06 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
    -- Executing [7405@default:1] AGI("SIP/1*7403-0000009b", "agi.php") in new stack

<--- SIP read from UDP:10.10.7.84:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.10.7.31:5060;branch=z9hG4bK7abaa88e;rport
From: "Withheld" <sip:Withheld@10.10.7.31>;tag=as481e7d52
To: <sip:1*6498@10.10.7.84:5060;sip:1*7403%4010.10.7.84:5060>;tag=1980429310
Call-ID: 7c172d2a626454ac114a40ca6620bedd@10.10.7.31:5060
CSeq: 102 OPTIONS
Contact: <sip:1*6498@10.10.7.84:5060>
Supported: 100rel, replaces, timer
Allow: INVITE, ACK, OPTIONS, BYE, CANCEL, REFER, NOTIFY, INFO, PRACK, UPDATE, MESSAGE
Accept: application/sdp, message/sipfrag, application/dtmf-relay
Content-Length: 0

<------------->
--- (11 headers 0 lines) ---
    -- Launched AGI Script /var/lib/asterisk/agi-bin/agi.php

<--- SIP read from UDP:10.10.7.84:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.10.7.31:5060;branch=z9hG4bK38cd521d;rport
From: "Withheld" <sip:Withheld@10.10.7.31>;tag=as12aa993c
To: <sip:1*6498@10.10.7.84:5060;sip:1*7403%4010.10.7.84:5060>;tag=84826063
Call-ID: 2b4a0faf4e6fe2de39a825a006976159@10.10.7.31:5060
CSeq: 102 OPTIONS
Contact: <sip:1*6498@10.10.7.84:5060>
Supported: 100rel, replaces, timer
Allow: INVITE, ACK, OPTIONS, BYE, CANCEL, REFER, NOTIFY, INFO, PRACK, UPDATE, MESSAGE
Accept: application/sdp, message/sipfrag, application/dtmf-relay
Content-Length: 0

<------------->
--- (11 headers 0 lines) ---
Really destroying SIP dialog '7c172d2a626454ac114a40ca6620bedd@10.10.7.31:5060' Method: OPTIONS
Really destroying SIP dialog '2b4a0faf4e6fe2de39a825a006976159@10.10.7.31:5060' Method: OPTIONS

    -- AGI Script Executing Application: (DIAL) Options: (SIP/1*7405,30,rRwM(recording^^vm-1719913866.180))
  == Using SIP VIDEO CoS mark 6
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
[Jul  2 13:51:06] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7405-0000009c
[Jul  2 13:51:06] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7405-0000009c
[Jul  2 13:51:06] ERROR[3183]: cdr.c:3397 ast_cdr_getvar: Unable to find CDR for channel SIP/1*7405-0000009c
Audio is at 17478
Adding codec alaw to SDP
Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 10.10.7.36:5060:
INVITE sip:1*7405@10.10.7.36:5060 SIP/2.0
Via: SIP/2.0/UDP 10.10.7.31:5060;branch=z9hG4bK7949485d;rport
Max-Forwards: 70
From: "7403" <sip:7403@10.10.7.31>;tag=as33b2c34d
To: <sip:1*7405@10.10.7.36:5060>
Contact: <sip:7403@10.10.7.31:5060>
Call-ID: 75cd5f957d039eb87c8596ae5d4e7b5a@10.10.7.31:5060
CSeq: 102 INVITE
User-Agent: tpadpbx
Date: Tue, 02 Jul 2024 09:51:06 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Remote-Party-ID: "7403" <sip:7403@10.10.7.31>;party=calling;privacy=off;screen=no
Content-Type: application/sdp
Content-Length: 258

v=0
o=root 996767497 996767497 IN IP4 10.10.7.31
s=Asterisk PBX 18.22.0
c=IN IP4 10.10.7.31
t=0 0
m=audio 17478 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:140
a=sendrecv

---
    -- Called SIP/1*7405

<--- Transmitting (NAT) to 10.10.7.84:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 10.10.7.84:5060;branch=z9hG4bK147232383689032244;received=10.10.7.84;rport=5060
From: 1*7403 <sip:1*7403@10.10.7.31:5060>;tag=324626869
To: "7405" <sip:7405@10.10.7.31;user=phone>;tag=as671625a2
Call-ID: 26403207688085-180471502717797@10.10.7.84
CSeq: 2 INVITE
Server: tpadpbx
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:7405@10.10.7.31:5060>
Content-Length: 0


<------------>

<--- SIP read from UDP:10.10.7.36:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.10.7.31:5060;branch=z9hG4bK7949485d;rport=5060
From: "7403" <sip:7403@10.10.7.31>;tag=as33b2c34d
To: <sip:1*7405@10.10.7.36:5060>
Call-ID: 75cd5f957d039eb87c8596ae5d4e7b5a@10.10.7.31:5060
CSeq: 102 INVITE
User-Agent: Yealink SIP-T43U 108.86.0.70
Content-Length: 0

<------------->
--- (8 headers 0 lines) ---

<--- SIP read from UDP:10.10.7.36:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 10.10.7.31:5060;branch=z9hG4bK7949485d;rport=5060
From: "7403" <sip:7403@10.10.7.31>;tag=as33b2c34d
To: <sip:1*7405@10.10.7.36:5060>;tag=2898243835
Call-ID: 75cd5f957d039eb87c8596ae5d4e7b5a@10.10.7.31:5060
CSeq: 102 INVITE
Contact: <sip:1*7405@10.10.7.36:5060>
Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
User-Agent: Yealink SIP-T43U 108.86.0.70
Allow-Events: talk,hold,conference,refer,check-sync
Content-Length: 0

<------------->
--- (11 headers 0 lines) ---
sip_route_dump: route/path hop: <sip:1*7405@10.10.7.36:5060>
    -- SIP/1*7405-0000009c is ringing

<--- Transmitting (NAT) to 10.10.7.84:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 10.10.7.84:5060;branch=z9hG4bK147232383689032244;received=10.10.7.84;rport=5060
From: 1*7403 <sip:1*7403@10.10.7.31:5060>;tag=324626869
To: "7405" <sip:7405@10.10.7.31;user=phone>;tag=as671625a2
Call-ID: 26403207688085-180471502717797@10.10.7.84
CSeq: 2 INVITE
Server: tpadpbx
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:7405@10.10.7.31:5060>
Remote-Party-ID: "7405" <sip:7405@10.10.7.31>;party=called;privacy=off;screen=no
Content-Length: 0


<------------>

<--- SIP read from UDP:10.10.7.36:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.10.7.31:5060;branch=z9hG4bK7949485d;rport=5060
From: "7403" <sip:7403@10.10.7.31>;tag=as33b2c34d
To: <sip:1*7405@10.10.7.36:5060>;tag=2898243835
Call-ID: 75cd5f957d039eb87c8596ae5d4e7b5a@10.10.7.31:5060
CSeq: 102 INVITE
Contact: <sip:1*7405@10.10.7.36:5060>
Content-Type: application/sdp
Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE
User-Agent: Yealink SIP-T43U 108.86.0.70
Allow-Events: talk,hold,conference,refer,check-sync
Supported: replaces
Content-Length: 207

v=0
o=- 20113 20113 IN IP4 10.10.7.36
s=SDP data
c=IN IP4 10.10.7.36
t=0 0
m=audio 12536 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=ptime:20
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
<------------->
--- (13 headers 11 lines) ---
Got SDP version 20113 and unique parts [- 20113 IN IP4 10.10.7.36]
Found RTP audio format 8
Found RTP audio format 101
Found audio description format PCMA for ID 8
Found audio description format telephone-event for ID 101
Capabilities: us - (alaw|ulaw|h261|h263|h263p|h264), peer - audio=(alaw)/video=(nothing)/text=(nothing), combined - (alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 10.10.7.36:12536
sip_route_dump: route/path hop: <sip:1*7405@10.10.7.36:5060>
Transmitting (NAT) to 10.10.7.36:5060:
ACK sip:1*7405@10.10.7.36:5060 SIP/2.0
Via: SIP/2.0/UDP 10.10.7.31:5060;branch=z9hG4bK792c5bcc;rport
Max-Forwards: 70
From: "7403" <sip:7403@10.10.7.31>;tag=as33b2c34d
To: <sip:1*7405@10.10.7.36:5060>;tag=2898243835
Contact: <sip:7403@10.10.7.31:5060>
Call-ID: 75cd5f957d039eb87c8596ae5d4e7b5a@10.10.7.31:5060
CSeq: 102 ACK
User-Agent: tpadpbx
Content-Length: 0

---
    -- SIP/1*7405-0000009c answered SIP/1*7403-0000009b
    -- Executing [s@macro-recording:1] AGI("SIP/1*7405-0000009c", "livecall.php,LIVEUPDATE,vm-1719913866.180") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/livecall.php
    -- <SIP/1*7405-0000009c>AGI Script livecall.php completed, returning 0
    -- Executing [s@macro-recording:2] NoOp("SIP/1*7405-0000009c", "") in new stack
    -- Executing [s@macro-recording:3] NoOp("SIP/1*7405-0000009c", "") in new stack
    -- Executing [s@macro-recording:4] GotoIf("SIP/1*7405-0000009c", "0?agnet:rec") in new stack
    -- Goto (macro-recording,s,7)
    -- Executing [s@macro-recording:7] GotoIf("SIP/1*7405-0000009c", "0?rec1:hang") in new stack
    -- Goto (macro-recording,s,10)
    -- Executing [s@macro-recording:10] NoOp("SIP/1*7405-0000009c", "") in new stack
    -- Executing [s@macro-recording:11] Hangup("SIP/1*7405-0000009c", "") in new stack
  == Spawn extension (macro-recording, s, 11) exited non-zero on 'SIP/1*7405-0000009c' in macro 'recording'
Scheduling destruction of SIP dialog '75cd5f957d039eb87c8596ae5d4e7b5a@10.10.7.31:5060' in 6400 ms (Method: INVITE)
Reliably Transmitting (NAT) to 10.10.7.36:5060:
BYE sip:1*7405@10.10.7.36:5060 SIP/2.0
Via: SIP/2.0/UDP 10.10.7.31:5060;branch=z9hG4bK66dcae93;rport
Max-Forwards: 70
From: "7403" <sip:7403@10.10.7.31>;tag=as33b2c34d
To: <sip:1*7405@10.10.7.36:5060>;tag=2898243835
Call-ID: 75cd5f957d039eb87c8596ae5d4e7b5a@10.10.7.31:5060
CSeq: 103 BYE
User-Agent: tpadpbx
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0


---
    -- <SIP/1*7403-0000009b>AGI Script agi.php completed, returning 0
    -- Auto fallthrough, channel 'SIP/1*7403-0000009b' status is 'ANSWER'
    -- Executing [h@default:1] AGI("SIP/1*7403-0000009b", "agi.php,CDR") in new stack

<--- SIP read from UDP:10.10.7.36:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.10.7.31:5060;branch=z9hG4bK66dcae93;rport=5060
From: "7403" <sip:7403@10.10.7.31>;tag=as33b2c34d
To: <sip:1*7405@10.10.7.36:5060>;tag=2898243835
Call-ID: 75cd5f957d039eb87c8596ae5d4e7b5a@10.10.7.31:5060
CSeq: 103 BYE
User-Agent: Yealink SIP-T43U 108.86.0.70
Content-Length: 0

<------------->
    -- Launched AGI Script /var/lib/asterisk/agi-bin/agi.php
--- (8 headers 0 lines) ---

    -- <SIP/1*7403-0000009b>AGI Script agi.php completed, returning 0
Scheduling destruction of SIP dialog '26403207688085-180471502717797@10.10.7.84' in 6400 ms (Method: INVITE)

<--- Reliably Transmitting (NAT) to 10.10.7.84:5060 --->
SIP/2.0 603 Declined
Via: SIP/2.0/UDP 10.10.7.84:5060;branch=z9hG4bK147232383689032244;received=10.10.7.84;rport=5060
From: 1*7403 <sip:1*7403@10.10.7.31:5060>;tag=324626869
To: "7405" <sip:7405@10.10.7.31;user=phone>;tag=as671625a2
Call-ID: 26403207688085-180471502717797@10.10.7.84
CSeq: 2 INVITE
Server: tpadpbx
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<------------>

<--- SIP read from UDP:10.10.7.84:5060 --->
ACK sip:7405@10.10.7.31;user=phone SIP/2.0
Via: SIP/2.0/UDP 10.10.7.84:5060;branch=z9hG4bK147232383689032244
From: 1*7403 <sip:1*7403@10.10.7.31:5060>;tag=324626869
To: "7405" <sip:7405@10.10.7.31;user=phone>;tag=as671625a2
Call-ID: 26403207688085-180471502717797@10.10.7.84
CSeq: 2 ACK
Contact: <sip:1*7403@10.10.7.84:5060>
Max-Forwards: 70
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---

I migrated my server from Asterisk 1.8 to Asterisk 18 actually and most of the sip.conf settings are coming from there…what should I get rid of from the sip.conf settings, in this case?

It aborts the outgoing leg because macro-recording tells it to. Without details of what your macro does, I can’t say why it ended up on that line of the macro. In any case, you should not be calling Hangup from such a macro. If you want to abort a call, you should set the appropriate status variable, so that Dial does the hangup.

Note that macros no longer exist in Asterisk 21.

my [macro-recording] context in extensions.conf is:

[macro-recording]
exten => s,1,AGI(livecall.php,LIVEUPDATE,${ARG2})
exten => s,n,NoOp(${ARG3})
exten => s,n,NoOp(${ARG1})
exten => s,n,GotoIf($["${ARG3}" != "" ]?agnet:rec)
exten => s,n(agnet),GotoIf($["${ARG3}" != "" ]?agnet1:rec)
exten => s,n(agnet1),QueueLog(NONE,NONE,${ARG3},${ARG4})
exten => s,n(rec),GotoIf($["${ARG1}" != "" ]?rec1:hang)
exten => s,n(rec1),NoOp(${ARG2})
exten => s,n(rec1),MixMonitor(${ARG1}.wav,,/usr/bin/lame  -v -o -m m -B 8 -s 44.2 ${ARG1}.wav ${ARG1}.mp3 && /bin/rm  -rf  ${ARG1}.wav)
exten => s,n(hang),NoOp(${BRIDGEPVTCALLID})
exten => s,n(hang),hangup

I am using Asterisk 18 and yes, macros are deprecated but i loaded it manually because my older asterisk box, asterisk 1.8 was using it.

I would say that was wrong even under 1.8, but 1.8 may have, somehow, ignored the invalid hangup.

Hangup is not a control flow operation; it is an instruction to the channel. Priority 11, which invokes it, is executed on all paths through that code.

Macro was deprecated in 1.8, although, when the deprecation process got more formalised, the clock was reset. Actually, it was deprecated in 1.6.

So what do you suggest me to do now?

I checked the database as well, |allow | disallow | defaultuser | ipaddr|
|— | — | — | —|
|alaw,ulaw | gsm,g729 | 17403 | 10.10.7.84|
|alaw,ulaw | gsm,g729 | 1
7403 | 10.10.7.84|

This is inline with the working model.

Exit the macro without hanging up the channel.

The codecs are irrelevant to this. Your macro will always call Hangup on the outgoing channel, once it is answered. You’ve got past the point where the channel driver would issue BYE because of unacceptable codec or encryption offer, in the response; you are now in user space and that user space code is closing the session.

I haven’t used macro since I converted them to subroutines, when they were deprecated in one of the 1.6.x versions, so I’d have to look up the correct way of terminating a macro, in case my recollection was faulty.

Thanks, @david551!!

You are a genius!! :smiley:

I fixed my code from the above to:

exten => s,1,AGI(livecall.php,LIVEUPDATE,${ARG2})
exten => s,n,GotoIf($["${ARG3}" != "" ]?agnet:rec)
exten => s,n(agnet),GotoIf($["${ARG3}" != "" ]?agnet1:rec)
exten => s,n(agnet1),QueueLog(NONE,NONE,${ARG3},${ARG4})
exten => s,n(rec),GotoIf($["${ARG1}" != "" ]?rec1:hang)
exten => s,n(rec1),NoOp(${ARG2})
exten => s,n(rec1),MixMonitor(${ARG1}.wav,,/usr/bin/lame  -v -o -m m -B 8 -s 44.2 ${ARG1}.wav ${ARG1}.mp3 && /bin/rm  -rf  ${ARG1}.wav)
;exten => s,n(hang),hangup
exten => s,n(hang),AGI(agi.php,CDR)

The AGI(agi.php,CDR) was part of the [default] context as:

[default]
exten => _XXXX,1,AGI(agi.php)
exten => h,1,AGI(agi.php,CDR)

The line has been commented out now and after reloading the dialplan it works fine!!!

This will change the end of the call at which agi.php is run with the CDR parameter. I don’t think you meant to do that. It will also run it on a different channel.

It seems to be working fine now, however, I will check its pcap as well to see the call flow for further clarification.

In terms of the call flow, it will avoid the hang up, but it will run agi.php, with the CDR option, before the A side has been answered, and will run it on the B side. You would have fixed the hangup by replacing the last priority with Noop or MacroExit (I gave in and looked up MacroExit).

I will definitely look into that as well.
So, you’re suggesting what i did was not the correct solution, right?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.