[Freeswitch-users] set channel variable using PERL

Sheeju Alex sheeju.alex at gmail.com
Sun Aug 17 02:34:40 PDT 2008


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




More information about the FreeSWITCH-users mailing list