G
G
GeKskill2020-06-09 15:54:44
Asterisk
GeKskill, 2020-06-09 15:54:44

Set a variable after picking up the phone?

It is necessary to somehow save the time of raising the tube. The variable does not want to be established in any way.

[test]
exten => _XXXX,n,Dial(SIP/${EXTEN},10,m,U(sub-answ-call-start))
exten => h,1,Set(CALLS_HISTORY()=${answered -call-start})
[sub-answ-call-start]
exten => s,1,Set(answered-call-start=${STRFTIME(${EPOCH},,%Y-%m-%d %H :%M:%S)} )
exten => s,n,return

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Barbolin, 2020-06-09
@GeKskill

If so?

[test]
exten => _XXXX,n,Verbose(0,-----Call-Start-----)
 same => n,Set(CHANNEL(hangup_handler_push)=hdlr-call-end,s,1) 
 same => n,Dial(SIP/${EXTEN},10,U(sub-answ-call-start))
 same => n,HangUp()

[sub-answ-call-start]
exten => s,1,Set(__ANSWER_CALL_START=${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
 same => n,return

 [hdlr-call-end]
exten => s,1,Verbose(0,-----hdlr-call-stats-----)
 same => n,Set(ANSWER_CALL_END=${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} )
 same => n,Set(CALL_TIME=${MATH(${ANSWER_CALL_END}-${ANSWER_CALL_START},int)})
 same => n,return

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question