How to ensure Lua script runs completely before hangup is executed
Hi everyone, I have a Lua script running from dial plan. However, when the call hangs up, the Lua script stops. I need the script to run completely before being stopped by Hangup. Is this possible? Do I need to spawn another script using luarun to accomplish this? Thanks, T
by default the script should continue running after the the hangup unless you have something like hangup hook. On Tue, Jul 31, 2018 at 9:12 PM, Tom Fielding <tomfieldingpersonal@gmail.com
wrote:
Hi everyone,
I have a Lua script running from dial plan.
However, when the call hangs up, the Lua script stops. I need the script to run completely before being stopped by Hangup.
Is this possible?
Do I need to spawn another script using luarun to accomplish this?
Thanks, T
_________________________________________________________________________ Professional FreeSWITCH Services 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 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
There's a parameter, i forget which one it is... On Wed, Aug 1, 2018, 14:55 Abaci B <abaci64@gmail.com> wrote:
by default the script should continue running after the the hangup unless you have something like hangup hook.
On Tue, Jul 31, 2018 at 9:12 PM, Tom Fielding < tomfieldingpersonal@gmail.com> wrote:
Hi everyone,
I have a Lua script running from dial plan.
However, when the call hangs up, the Lua script stops. I need the script to run completely before being stopped by Hangup.
Is this possible?
Do I need to spawn another script using luarun to accomplish this?
Thanks, T
_________________________________________________________________________ Professional FreeSWITCH Services 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 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services 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 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
Thanks Abaci. I do have hangup hook set up. I see, so I can only have the Lua script called from the dial plan run to completion or a hangup script. On Wed, Aug 1, 2018 at 9:49 AM, Abaci B <abaci64@gmail.com> wrote:
by default the script should continue running after the the hangup unless you have something like hangup hook.
On Tue, Jul 31, 2018 at 9:12 PM, Tom Fielding < tomfieldingpersonal@gmail.com> wrote:
Hi everyone,
I have a Lua script running from dial plan.
However, when the call hangs up, the Lua script stops. I need the script to run completely before being stopped by Hangup.
Is this possible?
Do I need to spawn another script using luarun to accomplish this?
Thanks, T
_________________________________________________________________________ Professional FreeSWITCH Services 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 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services 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 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
if you have a hangup hook it will go to that at hangup time if you don't have a hangup it will continue the script, skipping anything session related, so you have to be careful as you might get unexpected results. On Wed, Aug 1, 2018 at 10:27 PM, Tom Fielding <tomfieldingpersonal@gmail.com
wrote:
Thanks Abaci.
I do have hangup hook set up.
I see, so I can only have the Lua script called from the dial plan run to completion or a hangup script.
On Wed, Aug 1, 2018 at 9:49 AM, Abaci B <abaci64@gmail.com> wrote:
by default the script should continue running after the the hangup unless you have something like hangup hook.
On Tue, Jul 31, 2018 at 9:12 PM, Tom Fielding < tomfieldingpersonal@gmail.com> wrote:
Hi everyone,
I have a Lua script running from dial plan.
However, when the call hangs up, the Lua script stops. I need the script to run completely before being stopped by Hangup.
Is this possible?
Do I need to spawn another script using luarun to accomplish this?
Thanks, T
____________________________________________________________ _____________ Professional FreeSWITCH Services 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 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services 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 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services 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 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
Thanks all. So what’s the best practice if I have: Main.lua -does a bunch of setup like creating user accounts for a caller that is not in the system Hangup.lua -cleanup after call hangs up If the call hangs up (e.g. short duration call) before the setup is complete, will Hangu.lua need to check that the setup was done and perform the setup tasks before the cleanup tasks? This would mean a bunch more work for checks and redundant code to perform setup tasks in Hangup.lua I was thinking about this as a solution - spawn a new Setup.lua in Main.lua and create some locks to make sure Setup.lua is done before Main.Lua proceeds, and in Hangup.lua make sure Setup.lua is done before Hangup.lua proceeds? Or am I overthinking this? Thanks! T On Thu, Aug 2, 2018 at 7:15 AM, Abaci B <abaci64@gmail.com> wrote:
if you have a hangup hook it will go to that at hangup time if you don't have a hangup it will continue the script, skipping anything session related, so you have to be careful as you might get unexpected results.
On Wed, Aug 1, 2018 at 10:27 PM, Tom Fielding < tomfieldingpersonal@gmail.com> wrote:
Thanks Abaci.
I do have hangup hook set up.
I see, so I can only have the Lua script called from the dial plan run to completion or a hangup script.
On Wed, Aug 1, 2018 at 9:49 AM, Abaci B <abaci64@gmail.com> wrote:
by default the script should continue running after the the hangup unless you have something like hangup hook.
On Tue, Jul 31, 2018 at 9:12 PM, Tom Fielding < tomfieldingpersonal@gmail.com> wrote:
Hi everyone,
I have a Lua script running from dial plan.
However, when the call hangs up, the Lua script stops. I need the script to run completely before being stopped by Hangup.
Is this possible?
Do I need to spawn another script using luarun to accomplish this?
Thanks, T
____________________________________________________________ _____________ Professional FreeSWITCH Services 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 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/free switch-users https://freeswitch.com
____________________________________________________________ _____________ Professional FreeSWITCH Services 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 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services 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 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
_________________________________________________________________________ Professional FreeSWITCH Services 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 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
If you have any code inside tests of session:ready those will all fail once it hangs up. Usually you can do a few catchall actions at the end of the script but it can't involve the session which no longer will allow any methods to be executed. You might want: https://freeswitch.org/confluence/display/FREESWITCH/api_hangup_hook On Tue, Jul 31, 2018 at 8:12 PM, Tom Fielding <tomfieldingpersonal@gmail.com
wrote:
Hi everyone,
I have a Lua script running from dial plan.
However, when the call hangs up, the Lua script stops. I need the script to run completely before being stopped by Hangup.
Is this possible?
Do I need to spawn another script using luarun to accomplish this?
Thanks, T
_________________________________________________________________________ Professional FreeSWITCH Services 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 http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
-- Anthony Minessale II Founder, FreeSWITCH. http://freeswitch.com https://youtu.be/l_hOxzCt6X4 https://www.youtube.com/watch?v=oAxXgyx5jUw https://www.youtube.com/watch?v=9XXgW34t40s https://www.youtube.com/watch?v=NLaDpGQuZDA
participants (4)
-
Abaci B
-
Anthony Minessale
-
David Villasmil
-
Tom Fielding