set channel variable using PERL
Hello All, I am trying to figure out the way to set channel variable through perl script so I could fetch the data required from database and pass accordingly to the dialplan. Here is the example I am trying but was not successfull with it, It would be great if I get some advice on this. <extension name="perl"> <condition field="destination_number" expression="^77776$"> <action application="answer"/> <action application="send_display" data="Perl Execution"/> <action application="perl" data="test.pl"/> <action application="transfer" data="${transger_no} XML default"/> </condition> </extension>
test.pl
# Example Perl script to originate. perlrun freeswitch::console_log("info", "Perl in da house!!!\n"); $csession = freeswitch::CoreSession; $csession->setVariable('transger_no',4); #$csession->hangup(); I see setVariable function in class freeswitch::CoreSession but was not successfull to use this. I would appreciate if some one provide me simple example. Thanks, Sheeju
When you run any of the embedded languages like this as an app we "magically" create an object called "session" for you of the session that is running the app. Do the same thing you did in your script but don't create csession just use session instead. Mike On Aug 17, 2008, at 5:34 AM, "Sheeju Alex" <sheeju.alex@gmail.com> wrote:
Hello All,
I am trying to figure out the way to set channel variable through perl script so I could fetch the data required from database and pass accordingly to the dialplan.
Here is the example I am trying but was not successfull with it, It would be great if I get some advice on this.
<extension name="perl"> <condition field="destination_number" expression="^77776$"> <action application="answer"/> <action application="send_display" data="Perl Execution"/> <action application="perl" data="test.pl"/> <action application="transfer" data="${transger_no} XML default"/> </condition> </extension>
test.pl
# Example Perl script to originate. perlrun freeswitch::console_log("info", "Perl in da house!!!\n");
$csession = freeswitch::CoreSession; $csession->setVariable('transger_no',4); #$csession->hangup();
I see setVariable function in class freeswitch::CoreSession but was not successfull to use this. I would appreciate if some one provide me simple example.
Thanks, Sheeju
_______________________________________________ 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 http://www.freeswitch.org
In other words change $csession to $session in your script and remove the line with freeswitch::CoreSession and try again. -MC Sent from my iPhone On Aug 17, 2008, at 8:56 AM, Michael Jerris <mike@jerris.com> wrote:
When you run any of the embedded languages like this as an app we "magically" create an object called "session" for you of the session that is running the app. Do the same thing you did in your script but don't create csession just use session instead.
Mike
On Aug 17, 2008, at 5:34 AM, "Sheeju Alex" <sheeju.alex@gmail.com> wrote:
Hello All,
I am trying to figure out the way to set channel variable through perl script so I could fetch the data required from database and pass accordingly to the dialplan.
Here is the example I am trying but was not successfull with it, It would be great if I get some advice on this.
<extension name="perl"> <condition field="destination_number" expression="^77776$"> <action application="answer"/> <action application="send_display" data="Perl Execution"/> <action application="perl" data="test.pl"/> <action application="transfer" data="${transger_no} XML default"/> </condition> </extension>
test.pl
# Example Perl script to originate. perlrun freeswitch::console_log("info", "Perl in da house!!!\n");
$csession = freeswitch::CoreSession; $csession->setVariable('transger_no',4); #$csession->hangup();
I see setVariable function in class freeswitch::CoreSession but was not successfull to use this. I would appreciate if some one provide me simple example.
Thanks, Sheeju
_______________________________________________ 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 http://www.freeswitch.org
_______________________________________________ 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 http://www.freeswitch.org
Thanks Michael and Michael :) you get me going :) On Sun, Aug 17, 2008 at 11:36 PM, Michael S Collins <msc@freeswitch.org> wrote:
In other words change $csession to $session in your script and remove the line with freeswitch::CoreSession and try again.
-MC
Sent from my iPhone
On Aug 17, 2008, at 8:56 AM, Michael Jerris <mike@jerris.com> wrote:
When you run any of the embedded languages like this as an app we "magically" create an object called "session" for you of the session that is running the app. Do the same thing you did in your script but don't create csession just use session instead.
Mike
On Aug 17, 2008, at 5:34 AM, "Sheeju Alex" <sheeju.alex@gmail.com> wrote:
Hello All,
I am trying to figure out the way to set channel variable through perl script so I could fetch the data required from database and pass accordingly to the dialplan.
Here is the example I am trying but was not successfull with it, It would be great if I get some advice on this.
<extension name="perl"> <condition field="destination_number" expression="^77776$"> <action application="answer"/> <action application="send_display" data="Perl Execution"/> <action application="perl" data="test.pl"/> <action application="transfer" data="${transger_no} XML default"/> </condition> </extension>
test.pl
# Example Perl script to originate. perlrun freeswitch::console_log("info", "Perl in da house!!!\n");
$csession = freeswitch::CoreSession; $csession->setVariable('transger_no',4); #$csession->hangup();
I see setVariable function in class freeswitch::CoreSession but was not successfull to use this. I would appreciate if some one provide me simple example.
Thanks, Sheeju
_______________________________________________ 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 http://www.freeswitch.org
_______________________________________________ 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 http://www.freeswitch.org
_______________________________________________ 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 http://www.freeswitch.org
participants (3)
-
Michael Jerris
-
Michael S Collins
-
Sheeju Alex