Feb 6 21:14:57 test-server kernel: [97024.384424] Killed process 14314 (freeswitch) total-vm:1282524kB, anon-rss:58856kB, file-rss:0kB
I use this code.
require ESL;
use IO::Socket::INET;
my $ip = "127.0.0.1";
my $sock = new IO::Socket::INET ( LocalHost => $ip, LocalPort => '8083', 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 $uuidLegB = $info->getHeader("unique-id");
#This $uuidLegA is a temp variable where I store uuid leg A for post bridge
my $uuidLegA = $info->getHeader("variable_outbound_caller_id_name");
my $joinUUID = 'resp'.$uuidLegA.'|'.$uuidLegB.' XML default';
print("UUID Leg A is $uuidLegA and B is $uuidLegB\n");
$con->events("plain","all");
$con->execute("spandsp_start_tone_detect","34");
my $connectedSession = 1;
while($con->connected() & $connectedSession == 1) {
my $e = $con->recvEvent();
my $ev_name = $e->getHeader("Event-Name");
print("$ev_name\n");
if($ev_name eq 'DETECTED_TONE'){
my $tone_name = $e->getHeader("Detected-Tone");
print "DETECTED_TONE [$tone_name]\n";
if ($tone_name eq 'RING_TONE') {
$command = 'spandsp_stop_tone_detect '.$uuidLegB;
$con->api($command);
$con->execute("transfer",$joinUUID);
$connectedSession = 0;
}
}
}
print "BYE\n";
close($new_sock);
}