Dear Expert,<br> Thanks for you reply....<br><br>My Perl Script is,<br>use strict;<br>use warnings;<br><br>#---------------------------------------------------------------------------<br># Event socket library.<br># Socket programming<br>
# printing the data structures<br># Using posix parametered functions.<br>#---------------------------------------------------------------------------<br>use lib('/root/freeswitch-1.0.3/libs/esl/perl/');<br>require ESL;<br>
use IO::Socket::INET;<br>use Data::Dumper qw(Dumper);<br>use POSIX;<br>use Config::IniFiles;<br><br><br># Global variables to store the socket connection and eneterd DTM digits.<br>my ($conn,$digit);<br>$digit='';<br>
<br>#Registering the ALARM signal.<br>$SIG{ALRM}=\&sub_alr;<br><br># When alarm signal occurs call the play_digit function<br>sub sub_alr {<br> print "IN Sigalarm---\n";<br> &play_digit;<br>
return ;<br>} # ---------- end of subroutine sub_alr ----------<br><br><br><br># Play the voice files for menu.<br>sub play(){<br> $conn->execute("playback","ivr/ivr-please.wav");<br>
$conn->execute("playback","ivr/ivr-enter_ext.wav");<br>}<br><br><br>sub play_digit {<br> print "In Play Digit....\n";<br> my ( $par1 ) = $digit; #$digit is global variable<br>
<br> print "Eneterd Digits=",$digit,"\n";<br> ################################################################<br> # Here what is my problem the execute function is not working #<br>
################################################################<br> $conn->execute("phrase", "spell,$par1");<br> return ;<br>} # ---------- end of subroutine play_digit ----------<br>
<br><br>#---------------------------------------------------------------------------<br># IP address and port of the server.<br># Sound path file.<br>#---------------------------------------------------------------------------<br>
my $ip = "192.168.1.222"; my $port = '5057';<br>my $sound_path = "/usr/local/freeswitch/sounds/en/us/callie/";<br><br><br># Creating a socket<br>my $sock = new IO::Socket::INET (<br> LocalHost => $ip,<br>
LocalPort => $port,<br> Proto => 'tcp',<br> Listen => 1,<br> Reuse => 1<br>);<br># Checking the error.<br>die "Cannot create a socket:$!\n" unless $sock;<br>
<br><br>for(;;){<br><br> my $new_socket = $sock->accept();<br> print "Current Process Id:".POSIX::getpid()."\n";<br> my $pid = fork();<br><br> if($pid){<br> close($new_socket);<br>
next;<br> }<br><br> print "Child Process Id:".POSIX::getpid()."\n";<br><br> my $fd = fileno($new_socket);<br> print "File Number:$fd\n";<br><br> # Create a conenction with Event socket library.<br>
$conn = new ESL::ESLconnection($fd);<br><br> # Getting the connection informations and values of the variables.<br> my $info = $conn->getInfo();<br><br> # Getting the caller id and print the statement.<br>
my $caller_id =$info->getHeader("caller-caller-id-number");<br> printf "Connected from %s\n", $caller_id;<br><br> # Receive the events from only in this switch.<br> $conn->sendRecv("myevents");<br>
<br> # Answer the call.<br> $conn->execute("answer");<br><br> # playback the welcome message.<br> $conn->setEventLock("true");<br> $conn->execute("playback",$sound_path."ivr/ivr-welcome_to_freeswitch.wav");<br>
$conn->execute("sleep", "1000");<br><br> &play;<br><br><br> alarm(10);<br> while($conn->connected()){<br><br> # Receive the event<br> my $event = $conn->recvEvent();<br>
<br> # Check the event is received<br> if($event){<br> # Get the event name and print it.<br> my $name = $event->getHeader("event-name");<br>
print "EVENT:[$name]\n";<br><br> # If the event name is DTMF then print the enterted digit.<br> if($name eq 'DTMF'){<br> my $digi = $event->getHeader("dtmf-digit");<br>
# Here concatenate the eneterd digits<br> $digit.=$digi;<br> }<br> }<br> }<br> # Kill the child process.<br>
print "Disconnected:$caller_id\n"; kill 9,POSIX::getpid();<br>}<br><br><br>My dial plan is,<br><!-- Testing IVR --><br> <extension name="Test"><br> <condition field="destination_number" expression="^(200)$"><br>
<action application="socket" data="<a href="http://192.168.1.222:5057">192.168.1.222:5057</a> async full"/><br> </condition><br> </extension><br><br>The output of the Script is,<br>
<br>Current Process Id:2906<br>Child Process Id:2908<br>File Number:4<br>Connected from 1000<br>EVENT:[CHANNEL_EXECUTE]<br>EVENT:[CHANNEL_ANSWER]<br>EVENT:[CHANNEL_EXECUTE_COMPLETE]<br>EVENT:[CHANNEL_EXECUTE]<br>EVENT:[CHANNEL_EXECUTE_COMPLETE]<br>
EVENT:[CHANNEL_EXECUTE]<br>EVENT:[CHANNEL_EXECUTE_COMPLETE]<br>EVENT:[CHANNEL_EXECUTE]<br>EVENT:[CHANNEL_EXECUTE_COMPLETE]<br>EVENT:[CHANNEL_EXECUTE]<br>EVENT:[CHANNEL_EXECUTE_COMPLETE]<br>EVENT:[DTMF]<br>EVENT:[DTMF]<br>
EVENT:[DTMF]<br>EVENT:[DTMF]<br>IN Sigalarm---<br>In Play Digit....<br>Eneterd Digits=7485<br>Disconnected:1000<br><br>When alarm signal generated, it prints digits but it won't execute the "execute" function..<br>
<br>Please any one give suggestions where I made wrong...<br><br>Thanks...<br><br>Regards,<br>Velusamy. <br><br><br><div class="gmail_quote">On Thu, Aug 6, 2009 at 11:24 AM, Michael Collins <span dir="ltr"><<a href="mailto:msc@freeswitch.org">msc@freeswitch.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br><br><div class="gmail_quote"><div class="im">On Wed, Aug 5, 2009 at 11:38 PM, velusamy velu <span dir="ltr"><<a href="mailto:velu.technical@gmail.com" target="_blank">velu.technical@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Please any one help for this problem..<div><div></div><div><br></div></div></blockquote></div><div><br>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?<br>
<br>Thanks,<br>MC<br></div></div>
<br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>