Caller hung up before dial

Hi,

I am using Asterisk 13.13cert4 and using pjsip with ARA and using the below dynamic value

exten => _X.,1,Dial(${exten => _X.,n,Dial(${MAINTRUNK})})

where MAINTRUNK=PJSIP/911234567890@SIPAccount,10,Tt,

so first time it rings and I have put the logic if somebody does not pick up the call then it will run again the above line which is in loop and put the different number at this time but the issue is it says
Caller hung up before dial and nothing happens.

Can you shed some light on this?

Thanks

Your dialplan logic doesn’t appear to be correct, it may have been a result of copying it here. As well you’ll need to provide the console output and the SIP traffic (pjsip set logger on).

Can I share you the console and sip traffic here publicly?

If you provide it here then someone may be able to provide an answer. You can make them available on pastebin for example.

<— Received SIP request (1102 bytes) from UDP:192.168.2.169:5060 —>
INVITE sip:18001234567@192.168.2.151 SIP/2.0
Record-Route: sip:192.168.2.169;lr;ftag=as5eeec9dd;fromcor=ejFwbUZxUmpUUFNBejFwbUZxUmpUUFNBejFwbUY-;proxy_media=yes;dlgcor=e66.2442
Via: SIP/2.0/UDP 192.168.2.169;branch=z9hG4bKf358.f5efcccfe48d84208704f3f938c712e2.0
Via: SIP/2.0/UDP 192.168.2.211:5060;branch=z9hG4bK765985bc
Max-Forwards: 32
From: sip:3213331247@192.168.2.211;tag=as5eeec9dd
To: sip:18001234567@192.168.2.169
Contact: sip:3213331247@192.168.2.211:5060
Call-ID: 6451fb8f612624653f8c9f74668e581f@192.168.2.211:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 11.4.0
Date: Wed, 11 Oct 2017 11:28:34 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 284
Privacy: off

v=0
o=root 644201486 644201486 IN IP4 192.168.2.168
s=Asterisk PBX 11.4.0
c=IN IP4 192.168.2.168
t=0 0
m=audio 56128 RTP/AVP 0 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

<— Transmitting SIP response (578 bytes) to UDP:192.168.2.169:5060 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.2.169;rport=5060;received=192.168.2.169;branch=z9hG4bKf358.f5efcccfe48d84208704f3f938c712e2.0
Via: SIP/2.0/UDP 192.168.2.211:5060;branch=z9hG4bK765985bc
Record-Route: sip:192.168.2.169;lr;ftag=as5eeec9dd;fromcor=ejFwbUZxUmpUUFNBejFwbUZxUmpUUFNBejFwbUY-;proxy_media=yes;dlgcor=e66.2442
Call-ID: 6451fb8f612624653f8c9f74668e581f@192.168.2.211:5060
From: sip:3213331247@192.168.2.211;tag=as5eeec9dd
To: sip:18001234567@192.168.2.169
CSeq: 102 INVITE
Server: Asterisk PBX certified/13.13-cert4
Content-Length: 0

-- Executing [18001234567@CAPPING:1] AGI("PJSIP/mytrunk_IN-00000098", "Identify.php,18001234567") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/Identify.php
-- <PJSIP/mytrunk_IN-00000098>AGI Script Identify.php completed, returning 0
-- Executing [18001234567@CAPPING:2] NoOp("PJSIP/mytrunk_IN-00000098", "Static") in new stack
-- Executing [18001234567@CAPPING:3] NoOp("PJSIP/mytrunk_IN-00000098", "3213331247") in new stack
-- Executing [18001234567@CAPPING:4] Set("PJSIP/mytrunk_IN-00000098", "priority=1") in new stack
-- Executing [18001234567@CAPPING:5] NoOp("PJSIP/mytrunk_IN-00000098", "396") in new stack
-- Executing [18001234567@CAPPING:6] Set("PJSIP/mytrunk_IN-00000098", "CHANNEL(accountcode)=396-18001234567") in new stack
-- Executing [18001234567@CAPPING:7] GotoIf("PJSIP/mytrunk_IN-00000098", "396>0?BLACKLIST,18001234567,1:NOTEXIST,18001234567,1") in new stack
-- Goto (BLACKLIST,18001234567,1)
-- Executing [18001234567@BLACKLIST:1] AGI("PJSIP/mytrunk_IN-00000098", "Blacklist.php,18001234567,396,3213331247,0") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/Blacklist.php
-- <PJSIP/mytrunk_IN-00000098>AGI Script Blacklist.php completed, returning 0
-- Executing [18001234567@BLACKLIST:2] Goto("PJSIP/mytrunk_IN-00000098", "DIVERSION,18001234567,1") in new stack
-- Goto (DIVERSION,18001234567,1)
-- Executing [18001234567@DIVERSION:1] AGI("PJSIP/mytrunk_IN-00000098", "diversion_route.php,18001234567,396,1,2") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/diversion_route.php
-- <PJSIP/mytrunk_IN-00000098>AGI Script diversion_route.php completed, returning 0
-- Executing [18001234567@DIVERSION:2] Set("PJSIP/mytrunk_IN-00000098", "GROUP()=3961") in new stack
-- Executing [18001234567@DIVERSION:3] NoOp("PJSIP/mytrunk_IN-00000098", ">>>>>>> Total Channels : 1 AND CID: 396 AND Current Call is: 1 AND INBOUND") in new stack
-- Executing [18001234567@DIVERSION:4] Goto("PJSIP/mytrunk_IN-00000098", "COUNTER,18001234567,1") in new stack
-- Goto (COUNTER,18001234567,1)
-- Executing [18001234567@COUNTER:1] NoOp("PJSIP/mytrunk_IN-00000098", "Check If counter enabled and available") in new stack
-- Executing [18001234567@COUNTER:2] AGI("PJSIP/mytrunk_IN-00000098", "attempted_calls.php,,,3213331247,18001234567,396,,1507721445.229") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/attempted_calls.php
-- <PJSIP/mytrunk_IN-00000098>AGI Script attempted_calls.php completed, returning 0
-- Executing [18001234567@COUNTER:3] AGI("PJSIP/mytrunk_IN-00000098", "counter.php,18001234567,396,0,1,12,11,1,18001234567") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/counter.php
-- <PJSIP/mytrunk_IN-00000098>AGI Script counter.php completed, returning 0
-- Executing [18001234567@COUNTER:4] Goto("PJSIP/mytrunk_IN-00000098", "Dial-OUT,18001234567,1") in new stack
-- Goto (Dial-OUT,18001234567,1)
-- Executing [18001234567@Dial-OUT:1] NoOp("PJSIP/mytrunk_IN-00000098", "Diversion") in new stack
-- Executing [18001234567@Dial-OUT:2] AGI("PJSIP/mytrunk_IN-00000098", "Div-OUT.php,396") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/Div-OUT.php
-- <PJSIP/mytrunk_IN-00000098>AGI Script Div-OUT.php completed, returning 0
-- Executing [18001234567@Dial-OUT:3] Set("PJSIP/mytrunk_IN-00000098", "GROUP()=396") in new stack
-- Executing [18001234567@Dial-OUT:4] NoOp("PJSIP/mytrunk_IN-00000098", ">>>>>>> Total Channels : 10 AND CID: 396 AND Current Call is: 1 AND INBOUND") in new stack
-- Executing [18001234567@Dial-OUT:5] Gosub("PJSIP/mytrunk_IN-00000098", "RECIN,18001234567,1") in new stack
-- Executing [18001234567@RECIN:1] Set("PJSIP/mytrunk_IN-00000098", "TIME=11:30:46") in new stack
-- Executing [18001234567@RECIN:2] Set("PJSIP/mytrunk_IN-00000098", "CALLERID2=3213331247") in new stack
-- Executing [18001234567@RECIN:3] Set("PJSIP/mytrunk_IN-00000098", "DIRNAME=18001234567/2017/10/11") in new stack
-- Executing [18001234567@RECIN:4] Set("PJSIP/mytrunk_IN-00000098", "FILENAME=paid/396/IN/18001234567/2017/10/11/1507721445.229-113046-3213331247") in new stack
-- Executing [18001234567@RECIN:5] System("PJSIP/mytrunk_IN-00000098", "/bin/mkdir -p paid/396/IN/18001234567/2017/10/11") in new stack
-- Executing [18001234567@RECIN:6] Set("PJSIP/mytrunk_IN-00000098", "FILE=paid/396/IN/18001234567/2017/10/11/1507721445.229-113046-3213331247.mp3") in new stack
-- Executing [18001234567@RECIN:7] AGI("PJSIP/mytrunk_IN-00000098", "Report.php,paid/396/IN/18001234567/2017/10/11/1507721445.229-113046-3213331247.mp3,1507721445.229,11:30:46") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/Report.php
-- <PJSIP/mytrunk_IN-00000098>AGI Script Report.php completed, returning 0
-- Executing [18001234567@RECIN:8] MixMonitor("PJSIP/mytrunk_IN-00000098", "paid/396/IN/18001234567/2017/10/11/1507721445.229-113046-3213331247.wav,b") in new stack
-- Executing [18001234567@RECIN:9] Return("PJSIP/mytrunk_IN-00000098", "") in new stack

== Begin MixMonitor Recording PJSIP/mytrunk_IN-00000098
– Executing [18001234567@Dial-OUT:6] NoOp(“PJSIP/mytrunk_IN-00000098”, “PJSIP/911234567004@SIPACCOUNT,10,TtrR,”) in new stack
– Executing [18001234567@Dial-OUT:7] Set(“PJSIP/mytrunk_IN-00000098”, “CDR(priority)=1”) in new stack
– Executing [18001234567@Dial-OUT:8] Set(“PJSIP/mytrunk_IN-00000098”, “CDR(cid)=396”) in new stack
– Executing [18001234567@Dial-OUT:9] Set(“PJSIP/mytrunk_IN-00000098”, “CDR(diversion)=911234567004”) in new stack
– Executing [18001234567@Dial-OUT:10] Dial(“PJSIP/mytrunk_IN-00000098”, “PJSIP/911234567004@SIPACCOUNT,10,TtrR,”) in new stack
– Called PJSIP/911234567004@SIPACCOUNT
<— Transmitting SIP response (767 bytes) to UDP:192.168.2.169:5060 —>
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 192.168.2.169;rport=5060;received=192.168.2.169;branch=z9hG4bKf358.f5efcccfe48d84208704f3f938c712e2.0
Via: SIP/2.0/UDP 192.168.2.211:5060;branch=z9hG4bK765985bc
Record-Route: sip:192.168.2.169;lr;ftag=as5eeec9dd;fromcor=ejFwbUZxUmpUUFNBejFwbUZxUmpUUFNBejFwbUY-;proxy_media=yes;dlgcor=e66.2442
Call-ID: 6451fb8f612624653f8c9f74668e581f@192.168.2.211:5060
From: sip:3213331247@192.168.2.211;tag=as5eeec9dd
To: sip:18001234567@192.168.2.169;tag=5b4794c6-cad3-40de-806a-d3df185f8147
CSeq: 102 INVITE
Server: Asterisk PBX certified/13.13-cert4
Contact: sip:192.168.2.151:5060
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Content-Length: 0

<— Transmitting SIP request (1009 bytes) to UDP:192.168.2.189:5060 —>
INVITE sip:911234567004@192.168.2.189:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.151:5060;rport;branch=z9hG4bKPj3edd9be9-24f9-4ebc-8db3-c6616f5b3f75
From: sip:3213331247@192.168.2.151;tag=955b19c3-2f5c-4491-a853-6765b9dc8ce1
To: sip:911234567004@192.168.2.189
Contact: sip:asterisk@192.168.2.151:5060
Call-ID: 2b5e136c-e942-47e9-9702-b6a5909872d7
CSeq: 32031 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk PBX certified/13.13-cert4
Content-Type: application/sdp
Content-Length: 312

v=0
o=- 1448945094 1448945094 IN IP4 192.168.2.151
s=Asterisk
c=IN IP4 192.168.2.151
t=0 0
m=audio 12786 RTP/AVP 0 18 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<— Received SIP response (324 bytes) from UDP:192.168.2.189:5060 —>
SIP/2.0 100 Trying
CSeq: 32031 INVITE
Via: SIP/2.0/UDP 192.168.2.151:5060;rport;branch=z9hG4bKPj3edd9be9-24f9-4ebc-8db3-c6616f5b3f75
From: sip:3213331247@192.168.2.151;tag=955b19c3-2f5c-4491-a853-6765b9dc8ce1
Call-ID: 2b5e136c-e942-47e9-9702-b6a5909872d7
To: sip:911234567004@192.168.2.189
Content-Length: 0

<— Received SIP response (461 bytes) from UDP:192.168.2.189:5060 —>
SIP/2.0 407 Proxy Authentication Required
CSeq: 32031 INVITE
Via: SIP/2.0/UDP 192.168.2.151:5060;rport;branch=z9hG4bKPj3edd9be9-24f9-4ebc-8db3-c6616f5b3f75
From: sip:3213331247@192.168.2.151;tag=955b19c3-2f5c-4491-a853-6765b9dc8ce1
Call-ID: 2b5e136c-e942-47e9-9702-b6a5909872d7
To: sip:911234567004@192.168.2.189;tag=113039276951133
Proxy-Authenticate: DIGEST realm=“VoipSwitch”, nonce="1081f05d07530871-11111128410303941341"
Content-Length: 0

<— Transmitting SIP request (438 bytes) to UDP:192.168.2.189:5060 —>
ACK sip:911234567004@192.168.2.189:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.151:5060;rport;branch=z9hG4bKPj3edd9be9-24f9-4ebc-8db3-c6616f5b3f75
From: sip:3213331247@192.168.2.151;tag=955b19c3-2f5c-4491-a853-6765b9dc8ce1
To: sip:911234567004@192.168.2.189;tag=113039276951133
Call-ID: 2b5e136c-e942-47e9-9702-b6a5909872d7
CSeq: 32031 ACK
Max-Forwards: 70
User-Agent: Asterisk PBX certified/13.13-cert4
Content-Length: 0

<— Transmitting SIP request (1218 bytes) to UDP:192.168.2.189:5060 —>
INVITE sip:911234567004@192.168.2.189:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.151:5060;rport;branch=z9hG4bKPj9f4f90d1-4bf3-4ae0-bb2b-48c0d62976a5
From: sip:3213331247@192.168.2.151;tag=955b19c3-2f5c-4491-a853-6765b9dc8ce1
To: sip:911234567004@192.168.2.189
Contact: sip:asterisk@192.168.2.151:5060
Call-ID: 2b5e136c-e942-47e9-9702-b6a5909872d7
CSeq: 32032 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk PBX certified/13.13-cert4
Proxy-Authorization: Digest username=“SIPACCOUNT”, realm=“VoipSwitch”, nonce=“1081f05d07530871-11111128410303941341”, uri=“sip:911234567004@192.168.2.189:5060”, response="191ca1abeac695f86707b7ce5046f0bc"
Content-Type: application/sdp
Content-Length: 312

v=0
o=- 1448945094 1448945094 IN IP4 192.168.2.151
s=Asterisk
c=IN IP4 192.168.2.151
t=0 0
m=audio 12786 RTP/AVP 0 18 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<— Received SIP response (324 bytes) from UDP:192.168.2.189:5060 —>
SIP/2.0 100 Trying
CSeq: 32032 INVITE
Via: SIP/2.0/UDP 192.168.2.151:5060;rport;branch=z9hG4bKPj9f4f90d1-4bf3-4ae0-bb2b-48c0d62976a5
From: sip:3213331247@192.168.2.151;tag=955b19c3-2f5c-4491-a853-6765b9dc8ce1
Call-ID: 2b5e136c-e942-47e9-9702-b6a5909872d7
To: sip:911234567004@192.168.2.189
Content-Length: 0

<— Received SIP response (646 bytes) from UDP:192.168.2.189:5060 —>
SIP/2.0 183 Session Progress
CSeq: 32032 INVITE
Via: SIP/2.0/UDP 192.168.2.151:5060;rport;branch=z9hG4bKPj9f4f90d1-4bf3-4ae0-bb2b-48c0d62976a5
From: sip:3213331247@192.168.2.151;tag=955b19c3-2f5c-4491-a853-6765b9dc8ce1
Call-ID: 2b5e136c-e942-47e9-9702-b6a5909872d7
To: sip:911234567004@192.168.2.189;tag=113039276951148
Contact: sip:192.168.2.189:5060;transport=udp
Content-Type: application/sdp
Content-Length: 209

v=0
o=- 408196632 276951133 IN IP4 192.168.2.189
s=VoipSIP
c=IN IP4 192.168.2.189
t=0 0
m=audio 7230 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv

-- PJSIP/SIPACCOUNT-00000099 is making progress passing it to PJSIP/mytrunk_IN-00000098

<— Received SIP response (637 bytes) from UDP:192.168.2.189:5060 —>
SIP/2.0 180 Ringing
CSeq: 32032 INVITE
Via: SIP/2.0/UDP 192.168.2.151:5060;rport;branch=z9hG4bKPj9f4f90d1-4bf3-4ae0-bb2b-48c0d62976a5
From: sip:3213331247@192.168.2.151;tag=955b19c3-2f5c-4491-a853-6765b9dc8ce1
Call-ID: 2b5e136c-e942-47e9-9702-b6a5909872d7
To: sip:911234567004@192.168.2.189;tag=113039276951148
Contact: sip:192.168.2.189:5060;transport=udp
Content-Type: application/sdp
Content-Length: 209

v=0
o=- 408196632 276951133 IN IP4 192.168.2.189
s=VoipSIP
c=IN IP4 192.168.2.189
t=0 0
m=audio 7230 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv

-- PJSIP/SIPACCOUNT-00000099 is ringing

<— Transmitting SIP response (767 bytes) to UDP:192.168.2.169:5060 —>
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 192.168.2.169;rport=5060;received=192.168.2.169;branch=z9hG4bKf358.f5efcccfe48d84208704f3f938c712e2.0
Via: SIP/2.0/UDP 192.168.2.211:5060;branch=z9hG4bK765985bc
Record-Route: sip:192.168.2.169;lr;ftag=as5eeec9dd;fromcor=ejFwbUZxUmpUUFNBejFwbUZxUmpUUFNBejFwbUY-;proxy_media=yes;dlgcor=e66.2442
Call-ID: 6451fb8f612624653f8c9f74668e581f@192.168.2.211:5060
From: sip:3213331247@192.168.2.211;tag=as5eeec9dd
To: sip:18001234567@192.168.2.169;tag=5b4794c6-cad3-40de-806a-d3df185f8147
CSeq: 102 INVITE
Server: Asterisk PBX certified/13.13-cert4
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Contact: sip:192.168.2.151:5060
Content-Length: 0

-- Nobody picked up in 10000 ms
-- Auto fallthrough, channel 'PJSIP/mytrunk_IN-00000098' status is 'NOANSWER'
-- Executing [h@Dial-OUT:1] NoOp("PJSIP/mytrunk_IN-00000098", "NOANSWER") in new stack
-- Executing [h@Dial-OUT:2] GotoIf("PJSIP/mytrunk_IN-00000098", "0?AnsweredCounter,18001234567,1:NoAnsweredCounter,18001234567,1") in new stack
-- Goto (NoAnsweredCounter,18001234567,1)
-- Executing [18001234567@NoAnsweredCounter:1] Set("PJSIP/mytrunk_IN-00000098", "priority=2") in new stack
-- Executing [18001234567@NoAnsweredCounter:2] Goto("PJSIP/mytrunk_IN-00000098", "DIVERSION,18001234567,1") in new stack
-- Goto (DIVERSION,18001234567,1)
-- Executing [18001234567@DIVERSION:1] AGI("PJSIP/mytrunk_IN-00000098", "diversion_route.php,18001234567,396,2,2") in new stack

<— Transmitting SIP request (447 bytes) to UDP:192.168.2.189:5060 —>
CANCEL sip:911234567004@192.168.2.189:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.151:5060;rport;branch=z9hG4bKPj9f4f90d1-4bf3-4ae0-bb2b-48c0d62976a5
From: sip:3213331247@192.168.2.151;tag=955b19c3-2f5c-4491-a853-6765b9dc8ce1
To: sip:911234567004@192.168.2.189
Call-ID: 2b5e136c-e942-47e9-9702-b6a5909872d7
CSeq: 32032 CANCEL
Reason: Q.850;cause=0
Max-Forwards: 70
User-Agent: Asterisk PBX certified/13.13-cert4
Content-Length: 0

<— Received SIP response (356 bytes) from UDP:192.168.2.189:5060 —>
SIP/2.0 487 Request Terminated
CSeq: 32032 INVITE
Via: SIP/2.0/UDP 192.168.2.151:5060;rport;branch=z9hG4bKPj9f4f90d1-4bf3-4ae0-bb2b-48c0d62976a5
From: sip:3213331247@192.168.2.151;tag=955b19c3-2f5c-4491-a853-6765b9dc8ce1
Call-ID: 2b5e136c-e942-47e9-9702-b6a5909872d7
To: sip:911234567004@192.168.2.189;tag=113039276951148
Content-Length: 0

-- Launched AGI Script /var/lib/asterisk/agi-bin/diversion_route.php

<— Received SIP response (340 bytes) from UDP:192.168.2.189:5060 —>
SIP/2.0 200 OK
CSeq: 32032 CANCEL
Via: SIP/2.0/UDP 192.168.2.151:5060;rport;branch=z9hG4bKPj9f4f90d1-4bf3-4ae0-bb2b-48c0d62976a5
From: sip:3213331247@192.168.2.151;tag=955b19c3-2f5c-4491-a853-6765b9dc8ce1
Call-ID: 2b5e136c-e942-47e9-9702-b6a5909872d7
To: sip:911234567004@192.168.2.189;tag=113039276951148
Content-Length: 0

<— Transmitting SIP request (438 bytes) to UDP:192.168.2.189:5060 —>
ACK sip:911234567004@192.168.2.189:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.151:5060;rport;branch=z9hG4bKPj9f4f90d1-4bf3-4ae0-bb2b-48c0d62976a5
From: sip:3213331247@192.168.2.151;tag=955b19c3-2f5c-4491-a853-6765b9dc8ce1
To: sip:911234567004@192.168.2.189;tag=113039276951148
Call-ID: 2b5e136c-e942-47e9-9702-b6a5909872d7
CSeq: 32032 ACK
Max-Forwards: 70
User-Agent: Asterisk PBX certified/13.13-cert4
Content-Length: 0

-- <PJSIP/mytrunk_IN-00000098>AGI Script diversion_route.php completed, returning 0
-- Executing [18001234567@DIVERSION:2] Set("PJSIP/mytrunk_IN-00000098", "GROUP()=3962") in new stack
-- Executing [18001234567@DIVERSION:3] NoOp("PJSIP/mytrunk_IN-00000098", ">>>>>>> Total Channels : 2 AND CID: 396 AND Current Call is: 1 AND INBOUND") in new stack
-- Executing [18001234567@DIVERSION:4] Goto("PJSIP/mytrunk_IN-00000098", "COUNTER,18001234567,1") in new stack
-- Goto (COUNTER,18001234567,1)
-- Executing [18001234567@COUNTER:1] NoOp("PJSIP/mytrunk_IN-00000098", "Check If counter enabled and available") in new stack
-- Executing [18001234567@COUNTER:2] AGI("PJSIP/mytrunk_IN-00000098", "attempted_calls.php,,,3213331247,18001234567,396,,1507721445.229") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/attempted_calls.php
-- <PJSIP/mytrunk_IN-00000098>AGI Script attempted_calls.php completed, returning 0
-- Executing [18001234567@COUNTER:3] AGI("PJSIP/mytrunk_IN-00000098", "counter.php,18001234567,396,0,2,10,6,2,18001234567") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/counter.php
-- <PJSIP/mytrunk_IN-00000098>AGI Script counter.php completed, returning 0
-- Executing [18001234567@COUNTER:4] Goto("PJSIP/mytrunk_IN-00000098", "Dial-OUT,18001234567,1") in new stack
-- Goto (Dial-OUT,18001234567,1)
-- Executing [18001234567@Dial-OUT:1] NoOp("PJSIP/mytrunk_IN-00000098", "Diversion") in new stack
-- Executing [18001234567@Dial-OUT:2] AGI("PJSIP/mytrunk_IN-00000098", "Div-OUT.php,396") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/Div-OUT.php
-- <PJSIP/mytrunk_IN-00000098>AGI Script Div-OUT.php completed, returning 0
-- Executing [18001234567@Dial-OUT:3] Set("PJSIP/mytrunk_IN-00000098", "GROUP()=396") in new stack
-- Executing [18001234567@Dial-OUT:4] NoOp("PJSIP/mytrunk_IN-00000098", ">>>>>>> Total Channels : 10 AND CID: 396 AND Current Call is: 1 AND INBOUND") in new stack
-- Executing [18001234567@Dial-OUT:5] Gosub("PJSIP/mytrunk_IN-00000098", "RECIN,18001234567,1") in new stack
-- Executing [18001234567@RECIN:1] Set("PJSIP/mytrunk_IN-00000098", "TIME=11:30:57") in new stack
-- Executing [18001234567@RECIN:2] Set("PJSIP/mytrunk_IN-00000098", "CALLERID2=3213331247") in new stack
-- Executing [18001234567@RECIN:3] Set("PJSIP/mytrunk_IN-00000098", "DIRNAME=18001234567/2017/10/11") in new stack
-- Executing [18001234567@RECIN:4] Set("PJSIP/mytrunk_IN-00000098", "FILENAME=paid/396/IN/18001234567/2017/10/11/1507721445.229-113057-3213331247") in new stack
-- Executing [18001234567@RECIN:5] System("PJSIP/mytrunk_IN-00000098", "/bin/mkdir -p paid/396/IN/18001234567/2017/10/11") in new stack
-- Executing [18001234567@RECIN:6] Set("PJSIP/mytrunk_IN-00000098", "FILE=paid/396/IN/18001234567/2017/10/11/1507721445.229-113057-3213331247.mp3") in new stack
-- Executing [18001234567@RECIN:7] AGI("PJSIP/mytrunk_IN-00000098", "Report.php,paid/396/IN/18001234567/2017/10/11/1507721445.229-113057-3213331247.mp3,1507721445.229,11:30:57") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/Report.php
-- <PJSIP/mytrunk_IN-00000098>AGI Script Report.php completed, returning 0
-- Executing [18001234567@RECIN:8] MixMonitor("PJSIP/mytrunk_IN-00000098", "paid/396/IN/18001234567/2017/10/11/1507721445.229-113057-3213331247.wav,b") in new stack
-- Executing [18001234567@RECIN:9] Return("PJSIP/mytrunk_IN-00000098", "") in new stack

== Begin MixMonitor Recording PJSIP/mytrunk_IN-00000098
– Executing [18001234567@Dial-OUT:6] NoOp(“PJSIP/mytrunk_IN-00000098”, “PJSIP/911234561102@SIPACCOUNT,10,TtrR,”) in new stack
– Executing [18001234567@Dial-OUT:7] Set(“PJSIP/mytrunk_IN-00000098”, “CDR(priority)=2”) in new stack
– Executing [18001234567@Dial-OUT:8] Set(“PJSIP/mytrunk_IN-00000098”, “CDR(cid)=396”) in new stack
– Executing [18001234567@Dial-OUT:9] Set(“PJSIP/mytrunk_IN-00000098”, “CDR(diversion)=911234561102”) in new stack
– Executing [18001234567@Dial-OUT:10] Dial(“PJSIP/mytrunk_IN-00000098”, “PJSIP/911234561102@SIPACCOUNT,10,TtrR,”) in new stack
– Caller hung up before dial.
== Spawn extension (Dial-OUT, 18001234567, 10) exited non-zero on ‘PJSIP/mytrunk_IN-00000098’
== MixMonitor close filestream (mixed)
== MixMonitor close filestream (mixed)
<— Transmitting SIP response (754 bytes) to UDP:192.168.2.169:5060 —>
SIP/2.0 603 Decline
Via: SIP/2.0/UDP 192.168.2.169;rport=5060;received=192.168.2.169;branch=z9hG4bKf358.f5efcccfe48d84208704f3f938c712e2.0
Via: SIP/2.0/UDP 192.168.2.211:5060;branch=z9hG4bK765985bc
Record-Route: sip:192.168.2.169;lr;ftag=as5eeec9dd;fromcor=ejFwbUZxUmpUUFNBejFwbUZxUmpUUFNBejFwbUY-;proxy_media=yes;dlgcor=e66.2442
Call-ID: 6451fb8f612624653f8c9f74668e581f@192.168.2.211:5060
From: sip:3213331247@192.168.2.211;tag=as5eeec9dd
To: sip:18001234567@192.168.2.169;tag=5b4794c6-cad3-40de-806a-d3df185f8147
CSeq: 102 INVITE
Server: Asterisk PBX certified/13.13-cert4
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Reason: Q.850;cause=0
Content-Length: 0

== End MixMonitor Recording PJSIP/mytrunk_IN-00000098
== End MixMonitor Recording PJSIP/mytrunk_IN-00000098
<— Received SIP request (381 bytes) from UDP:192.168.2.169:5060 —>
ACK sip:18001234567@192.168.2.151 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.169;branch=z9hG4bKf358.f5efcccfe48d84208704f3f938c712e2.0
Max-Forwards: 32
From: sip:3213331247@192.168.2.211;tag=as5eeec9dd
To: sip:18001234567@192.168.2.169;tag=5b4794c6-cad3-40de-806a-d3df185f8147
Call-ID: 6451fb8f612624653f8c9f74668e581f@192.168.2.211:5060
CSeq: 102 ACK
Content-Length: 0

You are using things incorrectly. The ‘h’ extension is executed when the channel has been hung up, you can’t then place another outgoing call from it. You need to have the dialplan logic immediately after the Dial() so the channel is not hung up.

Oh I See, But I need to have the dial status so without using h how can i get current call’s dial status

The dial status can be retrieved afterwards using the DIALSTATUS dialplan variable. This is done by many people in order to use voicemail so they can direct it properly.

Thanks @jcolp let me try that.

DIALSTATUS doesnot work when call is answered or not answered as I need to take the action accordingly, can you let me know how to use DIALSTATUS dialplan variable after call is answered or no answer

To get it after the call is answered, you need the g option on Dial and you also need to use the h extension. If the h extension gets used, there is no longer an A leg on the call and you will not be able to do anything that requires a caller to be present.

If the B side clears, the ANSWERED status will be available in the priorities after the Dial, if g is used.

No answer is always available after the Dial, as it implies a B side failure, with the A side still up.

1 Like

@david551 Thnaks, Let me try

Hi @david551,

It is going on next context as expected after having gG option in dial app as I need to take some action on Answered channel but as soon as I pick the call it disconnects the call and reading 2 times the same context what we have defined in G option

can you please check what is wrong on the dialplan

Executing [18000000786@Dial-OUT:10] Dial(“PJSIP/mytrunk_IN-000000bf”, “PJSIP/919999999144@SIPACCOUNT,20,TtrRgG(AnsweredCounter,18000000786,1),”) in new stack
– Called PJSIP/919999999144@SIPACCOUNT
– PJSIP/SIPACCOUNT-000000c0 is making progress passing it to PJSIP/mytrunk_IN-000000bf
– PJSIP/SIPACCOUNT-000000c0 is ringing
– PJSIP/SIPACCOUNT-000000c0 answered PJSIP/mytrunk_IN-000000bf
– Executing [18000000786@AnsweredCounter:1] AGI(“PJSIP/mytrunk_IN-000000bf”, “counter_update.php,18000000786,396,1”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/counter_update.php
– Executing [18000000786@AnsweredCounter:2] System(“PJSIP/SIPACCOUNT-000000c0”, “/usr/local/bin/lame -V0 -h -b 160 --vbr-new /var/spool/asterisk/monitor/.wav /var/spool/asterisk/monitor/.mp3”) in new stack
– Executing [18000000786@AnsweredCounter:3] System(“PJSIP/SIPACCOUNT-000000c0”, “rm /var/spool/asterisk/monitor/.wav”) in new stack
– Auto fallthrough, channel ‘PJSIP/SIPACCOUNT-000000c0’ status is ‘UNKNOWN’
– <PJSIP/mytrunk_IN-000000bf>AGI Script counter_update.php completed, returning 0
– Executing [18000000786@AnsweredCounter:2] System(“PJSIP/mytrunk_IN-000000bf”, “/usr/local/bin/lame -V0 -h -b 160 --vbr-new /var/spool/asterisk/monitor/paid/396/IN/18000000786/2017/10/12/1507786239.292-053040-3213331247.wav /var/spool/asterisk/monitor/paid/396/IN/18000000786/2017/10/12/1507786239.292-053040-3213331247.mp3”) in new stack
– Executing [18000000786@AnsweredCounter:3] System(“PJSIP/mytrunk_IN-000000bf”, “rm /var/spool/asterisk/monitor/paid/396/IN/18000000786/2017/10/12/1507786239.292-053040-3213331247.wav”) in new stack
– Auto fallthrough, channel ‘PJSIP/mytrunk_IN-000000bf’ status is ‘ANSWER’
== MixMonitor close filestream (mixed)
== End MixMonitor Recording PJSIP/mytrunk_IN-000000bf

I have read the G option and it seems I used it in an incorrect way so sorry for replying you without knowing the syntax and rule

Just to be clear, you should not be using G at all, for this purpose.

Hi @david551,

Thanks, I have corrected and it is working as expected and I am using G because I want to do some action in AGI after answering the call so that is why I used G

Thanks once again…