I am scripting in js

I have both analogue and digital trunks out (analogue trunks out don’t give me the “answer” event)

Lets say we have a “totTime” variable for max length of call

I need to play a warning at totTime – 30

And hangup at totTime..

I have tried using:

 

 

sessOut.execute("set", "execute_on_answer_1=sched_hangup +” + totTime + “ alloted_timeout");

sessOut.execute("set", "execute_on_answer_2=sched_broadcast +” + (totTime – 30) + “layback::" + soundDir + "time_off.wav both");

 

But I can only get one or the other to work.. never both!

 

Also, how would I schedule there two events for analogue lines (where I don’t have “on_answer”)

 

Thanks all