Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] hangup from LUA script


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
gandalf.corvotempesta ...
Guest





PostPosted: Tue Nov 24, 2020 2:24 pm    Post subject: [Freeswitch-users] hangup from LUA script Reply with quote

Hi guys,
i'm trying to make a very simple IVR with a lua script. I'm calling the lua script in this way:

Quote:
<action application="play_and_get_digits" data="6 12 10 7000 # say:'Please inser order number.' silence_stream://250 order_number \d+" />
<action application="lua" data="myivr.lua"/>

And myivr.lua has something like this:

----------------------------------------------------------------
Quote:
if session:getVariable("order_number") ~= "1234567" then
   session:speak("Error");
   session:hangup("NO_ROUTE_DESTINATION")
end
session:speak("connecting to customer. Please wait");
session:setAutoHangup(false);
session:execute("bridge", "{ignore_early_media=true,bridge_generate_comfort_noise=true,effective_caller_id=anonymous,hangup_after_bridge=true}sofia/gateway/mygateway/123456789");
--------------------------------------------------------------------

Now, the questions:

1) Biggest issue is that when I call session:hangup() , the call is still running, how can I force hangup ?


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.


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)


Tnx in advance.
Back to top
abaci64 at gmail.com
Guest





PostPosted: Tue Nov 24, 2020 2:38 pm    Post subject: [Freeswitch-users] hangup from LUA script Reply with quote

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 return 'exit' from the script (not from within a function in the script) to exit the script.
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.



On Tue, Nov 24, 2020 at 12:41 PM Gandalf Corvotempesta <gandalf.corvotempesta@gmail.com (gandalf.corvotempesta@gmail.com)> wrote:

Quote:
Hi guys,
i'm trying to make a very simple IVR with a lua script. I'm calling the lua script in this way:

Quote:
<action application="play_and_get_digits" data="6 12 10 7000 # say:'Please inser order number.' silence_stream://250 order_number \d+" />
<action application="lua" data="myivr.lua"/>

And myivr.lua has something like this:

----------------------------------------------------------------
Quote:
if session:getVariable("order_number") ~= "1234567" then
   session:speak("Error");
   session:hangup("NO_ROUTE_DESTINATION")
end
session:speak("connecting to customer. Please wait");
session:setAutoHangup(false);
session:execute("bridge", "{ignore_early_media=true,bridge_generate_comfort_noise=true,effective_caller_id=anonymous,hangup_after_bridge=true}sofia/gateway/mygateway/123456789");
--------------------------------------------------------------------

Now, the questions:

1) Biggest issue is that when I call session:hangup() , the call is still running, how can I force hangup ?


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.


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)


Tnx in advance.

_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
gandalf.corvotempesta ...
Guest





PostPosted: Wed Nov 25, 2020 5:07 am    Post subject: [Freeswitch-users] hangup from LUA script Reply with quote

Il giorno mar 24 nov 2020 alle ore 20:07 Abaci B <abaci64@gmail.com (abaci64@gmail.com)> ha scritto:

Quote:
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 return 'exit' from the script (not from within a function in the script) to exit the script.



Even with return 'exit' the calling mobile phone is still connected to the PBX. I need to close the call hanging up all sides.
 
Quote:
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.




Good idea, i'll do in that way.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services