[asterisk-dev] capture the time before Answer of call in dialplan

Muteesa Fred fred.muteesa at infocom.ug
Mon May 18 01:08:34 CDT 2015

Thanks Ludovic,

I have tried the AMI,

But I only see the variables I need after the call has ended. Look below. I want to capture AnswerTime, and Starttime as soon as the call has been answered.



Event: Cdr

Privilege: cdr,all


Source: asterisk

Destination: 123456

DestinationContext: from_talklite

CallerID: "asterisk" <asterisk>

Channel: SIP/sip_virtual-00000001


LastApplication: Playback

LastData: custom/0414-holdmusic6

StartTime: 2015-05-18 08:48:59

AnswerTime: 2015-05-18 08:49:04

EndTime: 2015-05-18 08:49:25

Duration: 26

BillableSeconds: 21

Disposition: ANSWERED


UniqueID: 1431928139.2




Thanks and regards,



From: asterisk-dev-bounces at lists.digium.com [mailto:asterisk-dev-bounces at lists.digium.com] On Behalf Of Ludovic Gasc
Sent: Friday, May 15, 2015 1:37 PM
To: Asterisk Developers Mailing List
Subject: Re: [asterisk-dev] capture the time before Answer of call in dialplan



I've no idea to do that with pure dialplan, however you can do that via a daemon that talks AMI protocol, I already do that. Via AGI/FastAGI it may be possible, I'm not really sure. ARI should also usable for this use case, never tested yet.

For the AMI daemon, you can use the programming language you want, Personally, I use Python for that.

BTW, I recommend you to use an external daemon instead of to write a C module because if your business logic crashes, it's less grave outside of Asterisk instead of inside, it should crash all of your telephony.

However, apparently it's possible via dialplan, it's better to use that with an external daemon.


Ludovic Gasc (GMLudo)

Hello Everyone,

I apologise this might look like a user mailing list question but it's more
of a developers question. I think this is the only forum that can help me.

I have spent a week trying to achieve this. I realize I might have to write
a C or PERL extension to achieve it but I don't know where to start. Or
might need to rebuild the dial funtion.
I want to dial a number in asterisk via a sip-trunk, and when the other
party answers the call, I want to test if the call was answered before 5
seconds, or after 5 seconds.
If it was answered in less than 5 seconds I want to cancel the call,
otherwise the call should continue.

Your guidance will highly be appreciated.

Fred Muteesa

-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150518/16344030/attachment.html>

More information about the asterisk-dev mailing list