Asterisk call exits

Hi All,

I’m trying to find out how I can tell from the Asterisk logs, which end of two SIP channels dropped/ended a call.


[2010-08-23 14:27:14] VERBOSE[19388] logger.c: -- SIP/myserver-0a78c568 is ringing [2010-08-23 14:27:23] VERBOSE[19388] logger.c: -- SIP/myserver-0a78c568 answered SIP/mysipaccount-b7793f88 [2010-08-23 14:30:47] VERBOSE[19388] logger.c: == Spawn extension (from-sip-UK, 2089, 2) exited non-zero on 'SIP/mysipaccount-b7793f88'

So I can tell the call answered. But I can’t tell which side of the call ended it. Unless the code 2 means anything ?

This is on Asterisk 1.4.15. One side of the call is a second A*k server, the other side is a local SIP client.


The two is the “priority” (step number).

The most reliable way is to turn on SIP tracing or history features.

You can always set the flag on the dial application that allows the dialplan to continue after the call clears. It will only continue if party A is still up.

Hi David,

Thanks for the reply. Any idea which flag that is ? I’ve already set autofallthrough=yes if thats what you mean.

I take it Party A is the first leg of the call ?

It’s the one for which the documentation says “Execution of the diaplan goes on in the current context…”

Oh ok, took me a while to find it, I believe you mean option “g”. Not the auto-followthrough global option then.

So I’ve tested that on a small 4 line macro, and that seems ok. But if I tried to implement it into one of my more complex macros, such as below, then I’ll need to know the call state after the Dial.

The macro below dials SIP phones, then after a timeout dials a passed parameter (usually a mobile), and failing that calls into Voicemail.

So, if I answer at the first dial (priority 3) at the moment, then the call exits there and doesn’t proceed.
But if I do add the “g”, then after the CALLED party hungup, the logic would continue to 4.

So I think I need an IF statement at 4 to check if the call was answered at priority 3 or not.
Am I right ??

[macro-04-sim_hunt_pstn_vm] ; Rings all extensions at the same time and then PSTN option, fallback to voicemail ; ${ARG1} - Channels to sim call ; ${ARG2} - PSTN number to call (e.g. 079032xxxxx) exten => s,1,ExecIF($["${RECORDSIP}"="TRUE"],Monitor,wav|${TIMESTAMP}-${CALLERID(num)}-${MACRO_EXTEN}-${UNIQUEID}.WAV) exten => s,2,GotoIf($["${CALLERID(num)}" = "${ARG2}"]?20) exten => s,3,Dial(${ARG1},${OFFICE_TIMEOUT},rw) exten => s,4,Macro(DialOut,${ARG2},'') exten => s,5,Voicemail(u${MACRO_EXTEN}) exten => s,6,Hangup exten => s,20,Macro(vm-pstn,${MACRO_EXTEN}) exten => s,21,Hangup exten => s,105,Voicemail(b${MACRO_EXTEN}) exten => s,106,Hangup

Normally you would examine ${DIALSTATUS}