Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] Fwd: execute function in ESL.pm module is not working


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
velu.technical at gmai...
Guest





PostPosted: Wed Aug 05, 2009 11:43 pm    Post subject: [Freeswitch-users] Fwd: execute function in ESL.pm module is Reply with quote

Please any one help for this problem..

---------- Forwarded message ----------
From: velusamy velu <velu.technical@gmail.com (velu.technical@gmail.com)>
Date: Wed, Aug 5, 2009 at 11:44 AM
Subject: execute function in ESL.pm module is not working
To: freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)


Dear All,
   I registered alarm signal in my Perl server program.
   If ALARM signal occurred I execute the following statement in signal handler.
    "$conn->execute("playback",$sound_path."voicemail/vm-goodbye.wav")"
  The above statement didn't play that wave file. But before generating the ALARM signal it worked.

What is the problem?

Please help me in this problem....

Also Is there any idea to do timeout for DTMF digits?

Thanks...

Regards,
K.Velusamy
Back to top
msc at freeswitch.org
Guest





PostPosted: Thu Aug 06, 2009 1:03 am    Post subject: [Freeswitch-users] Fwd: execute function in ESL.pm module is Reply with quote

On Wed, Aug 5, 2009 at 11:38 PM, velusamy velu <velu.technical@gmail.com (velu.technical@gmail.com)> wrote:
Quote:
Please any one help for this problem..




Sorry for the delay but many of the FreeSWITCH experts are at ClueCon right now so we'll ask for your patience... in the meantime could you pastebin your script and your dialplan entry so that we can take a look at them?

Thanks,
MC
Back to top
velu.technical at gmai...
Guest





PostPosted: Fri Aug 07, 2009 12:13 am    Post subject: [Freeswitch-users] Fwd: execute function in ESL.pm module is Reply with quote

Dear Expert,
   Thanks for you reply....

My Perl Script is,
use strict;
use warnings;

#---------------------------------------------------------------------------
# Event socket library.
# Socket programming
# printing the data structures
# Using posix parametered functions.
#---------------------------------------------------------------------------
use lib('/root/freeswitch-1.0.3/libs/esl/perl/');
require ESL;
use IO::Socket::INET;
use Data::Dumper qw(Dumper);
use POSIX;
use Config::IniFiles;


# Global variables to store the socket connection and eneterd DTM digits.
my ($conn,$digit);
$digit='';

#Registering the ALARM signal.
$SIG{ALRM}=\&sub_alr;

# When alarm signal occurs call the play_digit function
sub sub_alr {
        print "IN Sigalarm---\n";
        &play_digit;
        return ;
}       # ----------  end of subroutine sub_alr  ----------



# Play the voice files for menu.
sub play(){
                $conn->execute("playback","ivr/ivr-please.wav");
                $conn->execute("playback","ivr/ivr-enter_ext.wav");
}


sub play_digit {
        print "In Play Digit....\n";
        my      ( $par1 )       = $digit; #$digit is global variable

        print "Eneterd Digits=",$digit,"\n";
        ################################################################
        # Here what is my problem the execute function is not working  #
        ################################################################
        $conn->execute("phrase", "spell,$par1");
        return ;
}       # ----------  end of subroutine play_digit  ----------


#---------------------------------------------------------------------------
# IP address and port of the server.
# Sound path file.
#---------------------------------------------------------------------------
my $ip = "192.168.1.222"; my $port = '5057';
my $sound_path = "/usr/local/freeswitch/sounds/en/us/callie/";


# Creating a socket
my $sock = new IO::Socket::INET (
        LocalHost => $ip,
        LocalPort => $port,
        Proto     => 'tcp',
        Listen    => 1,
        Reuse     => 1
);
# Checking the error.
die "Cannot create a socket:$!\n" unless $sock;


for(;Wink{

        my $new_socket = $sock->accept();
        print "Current Process Id:".POSIX::getpid()."\n";
        my $pid = fork();

        if($pid){
                close($new_socket);
                next;
        }

        print "Child Process Id:".POSIX::getpid()."\n";

        my $fd = fileno($new_socket);
        print "File Number:$fd\n";

        # Create a conenction with Event socket library.
        $conn = new ESL::ESLconnection($fd);

        # Getting the connection informations and values of the variables.
        my $info = $conn->getInfo();

        # Getting the caller id and print the statement.
        my $caller_id =$info->getHeader("caller-caller-id-number");
        printf  "Connected from %s\n", $caller_id;

        # Receive the events from only in this switch.
        $conn->sendRecv("myevents");

        # Answer the call.
        $conn->execute("answer");

        # playback the welcome message.
        $conn->setEventLock("true");
        $conn->execute("playback",$sound_path."ivr/ivr-welcome_to_freeswitch.wav");
        $conn->execute("sleep", "1000");

        &play;


        alarm(10);
        while($conn->connected()){

                # Receive the event
                my $event = $conn->recvEvent();

                # Check the event is received
                if($event){
                        # Get the event name  and print it.
                        my $name = $event->getHeader("event-name");
                        print "EVENT:[$name]\n";

                        # If the event name is DTMF then print the  enterted digit.
                        if($name eq 'DTMF'){
                                my $digi = $event->getHeader("dtmf-digit");
                                # Here concatenate the eneterd digits
                                $digit.=$digi;
                        }
                }
        }
        # Kill the child process.
        print "Disconnected:$caller_id\n"; kill 9,POSIX::getpid();
}


My dial plan is,
<!-- Testing IVR -->
    <extension name="Test">
      <condition field="destination_number" expression="^(200)$">
            <action application="socket" data="192.168.1.222:5057 async full"/>
      </condition>
    </extension>

The output of the Script is,

Current Process Id:2906
Child Process Id:2908
File Number:4
Connected from 1000
EVENT:[CHANNEL_EXECUTE]
EVENT:[CHANNEL_ANSWER]
EVENT:[CHANNEL_EXECUTE_COMPLETE]
EVENT:[CHANNEL_EXECUTE]
EVENT:[CHANNEL_EXECUTE_COMPLETE]
EVENT:[CHANNEL_EXECUTE]
EVENT:[CHANNEL_EXECUTE_COMPLETE]
EVENT:[CHANNEL_EXECUTE]
EVENT:[CHANNEL_EXECUTE_COMPLETE]
EVENT:[CHANNEL_EXECUTE]
EVENT:[CHANNEL_EXECUTE_COMPLETE]
EVENT:[DTMF]
EVENT:[DTMF]
EVENT:[DTMF]
EVENT:[DTMF]
IN Sigalarm---
In Play Digit....
Eneterd Digits=7485
Disconnected:1000

When alarm signal generated, it prints digits but it won't execute the "execute" function..

Please  any one give suggestions where I made wrong...

Thanks...

Regards,
Velusamy.


On Thu, Aug 6, 2009 at 11:24 AM, Michael Collins <msc@freeswitch.org (msc@freeswitch.org)> wrote:
Quote:


On Wed, Aug 5, 2009 at 11:38 PM, velusamy velu <velu.technical@gmail.com (velu.technical@gmail.com)> wrote:
Quote:
Please any one help for this problem..





Sorry for the delay but many of the FreeSWITCH experts are at ClueCon right now so we'll ask for your patience... in the meantime could you pastebin your script and your dialplan entry so that we can take a look at them?

Thanks,
MC



_______________________________________________
FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (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

Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services