<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body>
<p style="margin-bottom: 0cm;"><span>I need to make an IVR as follows: </span></p>
<p style="margin-bottom: 0cm;"><span>1 an incoming call and run an AGI script to alert the database, everything perfect here.<br />2 Play a music on hold and executes a loop while searching the database for a change in a field when the field change, cut the music on hold and keep doing things. I can do this?<br />I solved it by doing the following:</span></p>
<p style="margin-bottom: 0cm;">&nbsp;</p>
<p style="margin-bottom: 0cm;">exten =&gt; 4321,n,Answer()</p>
<p style="margin-bottom: 0cm;">exten =&gt; 4321,n,AGI(script.agi,${UNIQUEID},WAITING)</p>
<p style="margin-bottom: 0cm;"><a name="result_box1"></a>;<span>Plays music with duration of 5 seconds</span></p>
<p style="margin-bottom: 0cm;">exten =&gt; 4321,n,Playback(waiting-bucle-audio)</p>
<p style="margin-bottom: 0cm;">exten =&gt; 4321,n,AGI(script-test.agi,${UNIQUEID})</p>
<p style="margin-bottom: 0cm;">;If script return variable ${state} with text &ldquo;TRANSFERING&rdquo; goto &ldquo;call&rdquo;</p>
<p style="margin-bottom: 0cm;">exten =&gt; 4321,n,GotoIf($["${state}" = "TRANSFERING"]?call)</p>
<p style="margin-bottom: 0cm;">exten =&gt; 4321,n,Goto(context,4321,3)</p>
<p style="margin-bottom: 0cm;">exten =&gt; 4321,n(call),Dial(SIP/${sip},,20)</p>
<p style="margin-bottom: 0cm;">exten =&gt; 4321,n,Hangup()</p>
<p style="margin-bottom: 0cm;">&nbsp;</p>
<p style="margin-bottom: 0cm;"><a name="result_box2"></a><span>anyone have any idea how I can run a script in a loop until I return what I want and cut the music on hold?</span></p>
<p style="margin-bottom: 0cm;"><span>any help is welcome</span></p>
<p>&nbsp;</p>
</body></html>