[asterisk-users] Dial() application 'g' option

Geoff Lane geoff at gjctech.co.uk
Sun Feb 22 04:06:13 CST 2009


On Sunday, February 22, 2009, Mindaugas Kezys wrote:

> How to determine which channel hung up first?

It doesn't seem to matter on my system since including the following
line in extension h always seems to record the channel that made the
call.

exten => h,n,Log(NOTICE,Call made via channel ${CHANNEL} terminated)

So, incoming calls always log the channel name of the trunk on which
the call was received and outgoing calls log the name of the peer that
made the call. Unfortunately, for outgoing calls I need the name of
the trunk via which the call was routed and I can't see a way of
getting that once in extension h.

I wonder whether CDR will give me the information I need, but at first
glance I'm having difficulty finding info on how to turn on CDR, which
information is recorded, and whether I can retrieve that info via the
dialplan.

However, my failure could be your salvation. This is because if you
use the "g" option with Dial(), the next priority after Dial() is only
taken if the destination channel hangs up. So you could (for example)
add a GoTo after Dial() to direct processing to another context. Thus,
if the source party hung up, extension h in the current context is
executed; if the destination party hung up, the context, extension,
and priority specified in the GoTo is executed.

At least, that's my best guess and how my interpretation of the docs
says it should work!

HTH,

-- 
Geoff




More information about the asterisk-users mailing list