ANSWER is not working in ${DIALSTATUS}?

Hi could anyone help me with this problem?

I have a macro in my dialplan, for example:

exten=s,1,Answer()
exten=s,n,Dial(${ARG2},20,A(blah))
exten=s,n,Goto(s-${DIALSTATUS},1)
exten=s-NOANSWER,1,TrySystem(echo "no answer" > /tmp/log.txt)
exten=s-NOANSWER,n,Voicemail(${ARG1},u)
exten=s-NOANSWER,n,Goto(default,s,1)
exten=s-BUSY,1,TrySystem(echo "busy" > /tmp/log.txt)
exten=s-BUSY,n,Voicemail(${ARG1},b)
exten=s-BUSY,n,Goto(default,s,1)
exten=s-ANSWER,1,TrySystem(echo "Answered" > /tmp/log.txt)
exten=s-ANSWER,n,Goto(default,s,1)
exten=s-CHANUNAVAIL,1,TrySystem(echo "CHANUNAVAIL" > /tmp/log.txt)
exten=s-CHANUNAVAIL,n,Goto(default,s,1)
exten=_s-.,1,TrySystem(echo "${DIALSTATUS}" > /tmp/log.txt)
exten=_s-.,n,Goto(default,s,1)
exten=a,1,VoicemailMain(${ARG1})

However, when the call is “BUSY” or “NOANSWER”, i can receive the newly created log file, but if I answered the call, nothing happened.

So could anyone help me that how i can track the “answered” channel and do stuff according to it, say for example, i want to log the call time?

Thanks in advance!

Hi, can anyone help me out of this problem? I still can not do it in Macro.

Thanks in advance!

Flag “g” will help you. Please read documentation carefully :smile:

of course you need the g option, otherwise you will not come back from the dial… and you cannot catch the status of the call

Oh! Are you Guru? That’s fine!!! What about if the calling party hangs up the call, not the called one? What will be DIALSTATUS? :wink:

Oh! Are you Guru? That’s fine!!! What about if the calling party hangs up the call, not the called one? What will be DIALSTATUS? :wink:[/quote]

:unamused: who stole your marmelade?
I was just explaining to the guy the reason why for the g.

anyway the status would be CANCEL… :unamused:

but you cannot pick it up in the same extension, you need the “h” one

man… chill out

I really cannot chill out right now, because I have a big problem getting CANCEL. I have a very complex dialplan, containing 5 strings :smile:

exten => s,1,Answer()
exten => s,n,WaitExten()
exten => _X.,1,Dial(SIP/Trunk/${EXTEN})
exten => _X.,n,NoOp(${DIALSTATUS})
exten => _X.,n,Hangup

In this case I am able to get only BUSY and CHANUNAVAIL with NoOp. If I add “g” to the Dial command I can get ANSWER, but only if the called party hangs up first. And I never get CANCEL if I hang up first. Is this case NoOp does not work at all and a call attempt ends somewhere within the Dial().
What did you mean writing that: “but you cannot pick it up in the same extension, you need the “h” one”?

yes, you need the h if the caller hangs up…

so you will pick up inside

context some_context {

h => {
// some action to perfom here
};

};

sorry for the language, but i just use ael since years… so I am not really into normal .conf

i am facing the exact same issue i would appreciate if you will help how you resolved the issue.

Hello would u please guide more how to use h extension

http://the-asterisk-book.com/1.6/besondere-extensions.html

Note that you can now also use hangup handlers.