Hello all We’re using scripts now, in particular with the v8 engine. So far so good, but a couple of questions I’m hoping someone can answer: 1. How do we terminate the script early? I’ve tried ‘return;’ but that doesn’t seem to do it? 2. What’s the best way to invoke a delay? ...see the second part of the script below, the standard js ways of waiting generate syntax errors, and using ‘session.execute’ with sleep isn’t fixing it… the problem we’re getting is that either the outgoing message is part of the way through by the time it connects, or if the call is going to a person, it’s possible to answer the call before the audio has established (this might be two separate issues though I guess)... re = session.destination.match(/^555555555$/); if(re) { if(office_open) { session.setVariable("call_timeout", 8); session.setVariable("hangup_after_bridge", true); session.setVariable("continue_on_fail", true); session.execute("export", "alert_info=Bellcore-dr4"); session.execute("db", "insert/call_pickup_uuid/201/" + session.uuid); session.answer(); session.streamFile(“custom/open.wav"); session.execute("bridge", "user/201@" + domain); session.setVariable("call_timeout", 30); session.execute("bridge", "group/mainq@" + domain); } else { session.answer(); await sleep(1000); // tried this setTimeout(function() { // and this session.streamFile(“custom/closed.wav”); // but this has already started session.setVariable("skip_greeting", true); session.setVariable("skip_instructions", true); session.execute("voicemail", "default " + domain + " 201"); }, 1000); } }
participants (1)
-
Rick Jarvis