<div dir="ltr"><div>1) You mean the session is not ended or the script is still running? doing a hangup doesn't automatically end the script. You can do <u><b>return</b><b> 'exit'</b></u> from the script (not from within a function in the script) to exit the script.</div><div>2) Why don't you put the entire functionality in the lua script using session:playAndGetDigits() and then use a goto if you want to ask again for the order number.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 24, 2020 at 12:41 PM Gandalf Corvotempesta <<a href="mailto:gandalf.corvotempesta@gmail.com">gandalf.corvotempesta@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi guys,<br>i'm trying to make a very simple IVR with a lua script. I'm calling the lua script in this way:<br><br><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><font face="monospace"><action application="play_and_get_digits" data="6 12 10 7000 # say:'Please inser order number.' silence_stream://250 order_number \d+" /><br></font><font face="monospace"><action application="lua" data="myivr.lua"/></font></blockquote><br>And myivr.lua has something like this:<br><br>----------------------------------------------------------------<br><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><font face="monospace">if session:getVariable("order_number") ~= "1234567" then<br></font><font face="monospace">   session:speak("Error");<br></font><font face="monospace">   session:hangup("NO_ROUTE_DESTINATION")<br></font><font face="monospace">end</font><font face="monospace"><br></font><font face="monospace">session:speak("connecting to customer. Please wait");</font><font face="monospace"><br></font><font face="monospace">session:setAutoHangup(false);<br></font><font face="monospace">session:execute("bridge", "{ignore_early_media=true,bridge_generate_comfort_noise=true,effective_caller_id=anonymous,hangup_after_bridge=true}sofia/gateway/mygateway/123456789");</font></blockquote>--------------------------------------------------------------------<br><br>Now, the questions:<div><br></div><div>1) Biggest issue is that when I call session:hangup() , the call is still running, how can I force hangup ?</div><div><br></div><div>2) as this lua script is called after a "play_and_get_digits" (in dialplan), how can I replace the "Error" inside IF with something that will re-execute the dialplan from scratch asking for a new number ? In other words, if numbers are not "1234567", I have to ask for the numbers again.</div><div><br></div><div>3) how can I set the bridge to be anonymous on the remote phone ? I don't want the remote user to be able to see the caller number. It would be better if remote user will se MY number and not the origin number (it's a bridge: ORIGIN -> PBX -> REMOTE, the remote will see origin number. I want to be anonymous or PBX number)</div><div><br></div><div>Tnx in advance.</div></div>
_________________________________________________________________________<br>
<br>
The FreeSWITCH project is sponsored by SignalWire <a href="https://signalwire.com" rel="noreferrer" target="_blank">https://signalwire.com</a><br>
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.<br>
Build your next product on our scalable cloud platform.<br>
<br>
Join our online community to chat in real time <a href="https://signalwire.community" rel="noreferrer" target="_blank">https://signalwire.community</a><br>
<br>
Professional FreeSWITCH Services<br>
<a href="mailto:sales@freeswitch.com" target="_blank">sales@freeswitch.com</a><br>
<a href="https://freeswitch.com" rel="noreferrer" target="_blank">https://freeswitch.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="https://freeswitch.com/oss" rel="noreferrer" target="_blank">https://freeswitch.com/oss</a><br>
<a href="https://freeswitch.org/confluence" rel="noreferrer" target="_blank">https://freeswitch.org/confluence</a><br>
<a href="https://cluecon.com" rel="noreferrer" target="_blank">https://cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="https://freeswitch.com" rel="noreferrer" target="_blank">https://freeswitch.com</a></blockquote></div>