[asterisk-users] Answered time on channel

Dovid Bender dovid at telecurve.com
Tue Dec 26 14:28:43 CST 2017


Hi,

I have a dial plan where I need to notify an external system when a call
was answered and when the call hung up. In both requests the start time
needs to be the same. My Dialplan looks something like this:


[outbound]
Exten => _X.,1,Dial(SIP/${EXTEN}@1.1.1.1,,U(call-answer-from-carrier))

Exten => h,1,NoOp(ANSWERED_TIME: ${ANSWEREDTIME} >>> DIAL_TIME:
${DIALEDTIME} >>> HANGUP_TIME: ${EPOCH} >>> ANSWERED TIME
${MATH(${EPOCH}-${ANSWEREDTIME},int)})

[call-answer-from-carrier]
Exten => s,1,Noop(CALL WAS ANSWERED AT ${EPOCH}
Exten => s,n,Agi(some_script.py)

Now in theory the hangup time of the call (${EPOCH} in the h extension)
minus the answered time should be the same as the noop from my subroutine.
I am finding that some times they match and some times they are off by a
second. My issue is that the external system expects the answered time to
the same for when we call it from the SubRoutine as well as from the h
extension. I assume the difference is based on the microsecond of when we
look at EPOCH how DIALEDTIME is rounded.

Any tips on how I can get the same answered time across the board?

TIA.

Dovid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20171226/2739dedc/attachment.html>


More information about the asterisk-users mailing list