[Freeswitch-users] api_hangup_hook question

Madovsky infos at madovsky.org
Wed Dec 8 09:01:28 MSK 2010


Ok now it seems that the perl script is called (even php script called inside perl script works)
but $session is empty, despite of session_in_hangup_hook=true

my Perl script is very simple :

----------------------------------------

#!/usr/local/bin/perl
use strict;
our $session;
my %VARS;

        sub fprint($) #Dump string to the console
        {
                my ($msg) = @_;
                freeswitch::consoleLog("CRIT",$msg . "\n");
        }


        sub GETV #takes one or more variables names to import in
        {
                my @arr = @_;
                foreach my $var (@arr)
                {
                        $VARS{$var} = $session->getVariable($var);
                }
                &QWPHP();
        }

        sub QWPHP
        {
                my $shell_result;
                if($VARS{fax_mode} eq "recv")
                {
                        $shell_result = `/usr/local/bin/php /usr/local/freeswitch/scripts/php/faxCallBack.php $VARS{account_email} $VARS{effective_caller_id_name} $VARS{caller_id_number} $VARS{fax_file} $VARS{fax_status} $VARS{fax_result_text}`;
                }
                elsif($VARS{fax_mode} eq "send")
                {
                        $shell_result = `/usr/local/bin/php /usr/local/freeswitch/scripts/php/faxCallBack.php $VARS{php_session} $VARS{fax_status} $VARS{fax_result_text}`;
                }
        }

GETV(qw/fax_mode destination_number effective_caller_id_name effective_caller_id_number caller_id_number fax_file fax_status fax_result_text/);

1;

----------------------


Stucked.... help



  ----- Original Message ----- 
  From: Madovsky 
  To: freeswitch-users at lists.freeswitch.org 
  Sent: Tuesday, December 07, 2010 11:04 PM
  Subject: Re: [Freeswitch-users] api_hangup_hook question


  arrrgh,

  why I put parenthesis, this is the right syntax :

  <action application="set" data="api_hangup_hook=system /usr/local/freeswitch/scripts/perl/faxStatus.pl"/>

  thanks

  Franck
    ----- Original Message ----- 
    From: Madovsky 
    To: freeswitch-users at lists.freeswitch.org 
    Sent: Tuesday, December 07, 2010 10:58 PM
    Subject: Re: [Freeswitch-users] api_hangup_hook question


    Sorry correction for the last code it shows

    2010-12-07 22:57:25.262675 [DEBUG] switch_core_state_machine.c:492 Hangup Command with Session system(/usr/local/freeswitch/scripts/perl/faxStatus.pl)():
    INVALID COMMAND!

    for 

    <action application="set" data="api_hangup_hook=system(/usr/local/freeswitch/scripts/perl/faxStatus.pl)"/>
      ----- Original Message ----- 
      From: Madovsky 
      To: FreeSWITCH Users Help 
      Sent: Tuesday, December 07, 2010 10:53 PM
      Subject: Re: [Freeswitch-users] api_hangup_hook question


      mmmhmm, weird in the logs I can see :

      /usr/local/freeswitch/scripts/perl/faxStatus.pl(): ///////////// what is these parenthesis at the last?
      INVALID COMMAND!

      if I use this xml
      <action application="set" data="api_hangup_hook=/usr/local/freeswitch/scripts/perl/faxStatus.pl"/>

      and

      system(usr/local/freeswitch/scripts/perl/faxStatus.pl()): 
      INVALID COMMAND!

      if

      <action application="set" data="api_hangup_hook=system(/usr/local/freeswitch/scripts/perl/faxStatus.pl)"/>

      if you think this log is not enough I will pastebin, but the rest of logs are ok....

       


        ----- Original Message ----- 
        From: Michael Collins 
        To: FreeSWITCH Users Help 
        Sent: Tuesday, December 07, 2010 3:51 PM
        Subject: Re: [Freeswitch-users] api_hangup_hook question


        Can you pastebin your logs? There might be a clue as to what is happening. 
        -MC


        On Tue, Dec 7, 2010 at 10:27 AM, Madovsky <infos at madovsky.org> wrote:

          I have this in dialplan/default

                  <extension name="9999999999">
                          <condition field="destination_number" expression="^(9999999999)$">
                                  <action application="set" data="domain_name=$${domain}"/>
                                  <action application="export" data="dialed_extension=$1"/>
                                  <action application="set" data="hangup_after_bridge=true"/>
                                  <action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,CALL_REJECTED,USER_NOT_REGISTERED,NO_ANSWER,NO_USER_RESPONSE,USER_BUSY"/>
                                  <action application="ring_ready"/>
                                  <action application="tone_detect" data="fax 1100 r +5000 transfer 'receivefax XML features' 1" />
                                  <action application="export" data="originate_timeout=15"/>
                                  <action application="bridge" data="{absolute_codec_string='speex at 16000k,G729,GSM,G726,PCMU,PCMA',sip_from_uri=${sip_from_user}@${sip_from_host},origination_caller_id_name=${caller_id_name},origination_caller_id_number=${caller_id_number}}user/${dialed_extension}"/>
                                  <action application="sleep" data="3000"/>
                                  <action application="answer"/>
                                  <action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
                          </condition>
                  </extension>


          and this in dialplan/features


              <extension name="receivefax">
                <condition field="destination_number" expression="^receivefax$">
                  <action application="set" data="session_in_hangup_hook=true"/>
                  <action application="set" data="fax_file=/usr/local/freeswitch/storage/fax/${caller_id_number}-${uuid}.rxfax.tiff"/>
                  <action application="set" data="fax_mode=recv"/>
                  <action application="set" data="api_hangup_hook=perl /usr/local/freeswitch/scripts/perl/faxStatus.pl"/>
                  <action application="answer" />
                  <action application="playback" data="silence_stream://2000"/>
                  <action application="set" data="fax_enable_t38_request=true"/>
                  <action application="set" data="fax_enable_t38=true"/>
                  <action application="rxfax" data="/usr/local/freeswitch/storage/fax/${caller_id_number}-${uuid}.rxfax.tiff"/>
                  <action application="hangup"/>
                </condition>
              </extension>


          the fax is received well, but the perl script is not executed.

          Am I missing anything ?

          Thanks

          Franck



          _______________________________________________
          FreeSWITCH-users mailing list
          FreeSWITCH-users at 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 at lists.freeswitch.org
        http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
        UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
        http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20101208/a3e03222/attachment.html 


More information about the FreeSWITCH-users mailing list