[Freeswitch-users] perl ESL outbound socket, no DTMF if not async ???
Giovanni Maruzzelli
gmaruzz at gmail.com
Tue Apr 21 16:18:27 MSD 2015
Ciao FreeSWITCHers,
on FS 1.4.18:
using perl ESL outbound socket, I see FS receives DTMF 2833 only when
socket is declared "async" in dialplan.
NB: not only the outbound socket does not receives DTMF events, is
FreeSWITCH itself that does not receives DTMFs.
Is this correct? Is this the expected behavior?
If I delete "async" from dialplan, DTMFs are not received
es:
<action application="socket" data="127.0.0.1:8040 async"/> works,
while with
<action application="socket" data="127.0.0.1:8040"/> no DTMFs at all.
====
btw, this is an example of outbound_socket in perl ESL
#!/usr/bin/perl
require ESL;
use IO::Socket::INET;
my $ip = "127.0.0.1";
my $sock = new IO::Socket::INET ( LocalHost => $ip,
LocalPort => '8040',
Proto => 'tcp',
Listen => 1,
Reuse => 1 );
die "Could not create socket: $!\n" unless $sock;
for(;;) {
my $new_sock = $sock->accept();
my $pid = fork();
if ($pid) {
print "New child pid $pid created...\n";
close($new_sock);
next;
}
my $fd = fileno($new_sock);
my $con = new ESL::ESLconnection($fd);
my $info = $con->getInfo();
my $uuid = $info->getHeader("unique-id");
printf "Connected call %s, from %s\n", $uuid,
$info->getHeader("caller-caller-id-number");
$con->sendRecv("myevents $uuid");
$con->setEventLock("1"); # need this for forcing execution order on
async, has no effect if no "async" in dialplan
$con->execute("sleep","500");
$con->execute("answer");
$con->execute("sleep","500");
$con->execute("playback",
"ivr/ivr-welcome_to_freeswitch.wav");
$con->execute("sleep","500");
$con->execute("playback",
"ivr/ivr-finished_pound_hash_key.wav");
while($con->connected()) {
my $e = $con->recvEvent();
if ($e) {
my $name = $e->getHeader("event-name");
print "EVENT [$name]\n";
if ($name eq "DTMF") {
my $digit = $e->getHeader("dtmf-digit");
my $duration = $e->getHeader("dtmf-duration");
print "DTMF digit $digit ($duration)\n";
$con->execute("hangup");
}
}
}
print "BYE\n";
close($new_sock);
}
--
Sincerely,
Giovanni Maruzzelli
Cell : +39-347-2665618
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20150421/6cbac1c8/attachment.html
Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users
mailing list