Hang up the call after x seconds after the called party has answered the call using ARI in Asterisk

663 Views Asked by At

We've been using Asterisk's Dial plans for quite some time and now we've decided to switch to ARI. I'm wondering is there a way to hang up the call after x seconds after the called party has answered the call using originate or any other method from /channels resource in ARI. Note that I can do this using dial plan with L(x:y:z) or S(duration) functions but unfortunately can not find a way to use this feature in Stasis mode. here is a part of my dial plan in extensions.conf

exten => 8952XXXX,1,NoOp(${CALLERID(num)})
same => n,Set(ENDPOINT=${SIP_HEADER(X-Endpoint)})
same => n,Stasis(myapp,incoming,${EXTEN},unknown,unknown,none)
same => n,Hangup()
1

There are 1 best solutions below

2
On BEST ANSWER
[context1]
exten => 8952XXXX,1,NoOp(${CALLERID(num)})
same => n,Set(__ENDPOINT=${SIP_HEADER(X-Endpoint)})
same => n,Dial(Local/${EXTEN}@context2/n,,L(x:y:z))
same => n,Hangup()
[context2]
exten => 8952XXXX,1,NoOp(${CALLERID(num)})
same => n,Stasis(myapp,incoming,${EXTEN},unknown,unknown,none)
same => n,Hangup()

Other option is use TIMEOUT(absolute)