From a68c60c1f1cc0f659d5e8b40bce2f208ca62629b Mon Sep 17 00:00:00 2001 From: Brian West Date: Sat, 26 Apr 2008 00:37:03 +0000 Subject: [PATCH] some small lua and perl examples.. they look very similar... git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8202 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- scripts/lua/mwi_event.lua | 8 ++++++++ scripts/lua/originate.lua | 6 ++++++ scripts/perl/mwi_event.pl | 8 ++++++++ scripts/perl/originate.pl | 6 ++++++ 4 files changed, 28 insertions(+) create mode 100644 scripts/lua/mwi_event.lua create mode 100644 scripts/lua/originate.lua create mode 100644 scripts/perl/mwi_event.pl create mode 100644 scripts/perl/originate.pl diff --git a/scripts/lua/mwi_event.lua b/scripts/lua/mwi_event.lua new file mode 100644 index 0000000000..80b0ef9606 --- /dev/null +++ b/scripts/lua/mwi_event.lua @@ -0,0 +1,8 @@ +-- This is an example of sending an event via luarun from the cli +-- Edit to your liking. luarun mwi_event.lua +freeswitch.console_log("info", "Sending MWI Event using Lua\n"); + +local event = freeswitch.Event("message_waiting"); +event:add_header("MWI-Messages-Waiting", "no"); +event:add_header("MWI-Message-Account", "sip:1002@10.0.1.100"); +event:fire(); diff --git a/scripts/lua/originate.lua b/scripts/lua/originate.lua new file mode 100644 index 0000000000..3ac8cfcd29 --- /dev/null +++ b/scripts/lua/originate.lua @@ -0,0 +1,6 @@ +-- Example Lua script to originate. luarun +freeswitch.console_log("info", "Lua in da house!!!\n"); + +local session = freeswitch.Session("sofia/10.0.1.100/1002"); +session:execute("playback", "/sr8k.wav"); +session:hangup(); diff --git a/scripts/perl/mwi_event.pl b/scripts/perl/mwi_event.pl new file mode 100644 index 0000000000..fc227e61c6 --- /dev/null +++ b/scripts/perl/mwi_event.pl @@ -0,0 +1,8 @@ +# This is an example of sending an event via perlrun from the cli +# Edit to your liking. perlrun mwi_event.pl +freeswitch::console_log("info", "Perl in da house!!!\n"); + +$event = new freeswitch::Event("message_waiting"); +$event->add_header("MWI-Messages-Waiting", "yes"); +$event->add_header("MWI-Message-Account", 'sip:1002@10.0.1.100'); +$event->fire(); diff --git a/scripts/perl/originate.pl b/scripts/perl/originate.pl new file mode 100644 index 0000000000..cbdfc820fb --- /dev/null +++ b/scripts/perl/originate.pl @@ -0,0 +1,6 @@ +# Example Perl script to originate. perlrun +freeswitch::console_log("info", "Perl in da house!!!\n"); + +$session = new freeswitch::Session("sofia/10.0.1.100/1002") ; +$session->execute("playback", "/sr8k.wav"); +$session->hangup();