[Freeswitch-users] Receiving SEGV on Outbound ESL

lakshmanan ganapathy lakindia89 at gmail.com
Wed Jun 9 05:06:58 PDT 2010


Hi all,
I'm trying to do the following scenario.
I've created an Inbound socket. I issue the following command in the Inbound
ESL

api originate
{origination_caller_id_name='lakshmanan',origination_caller_id_number=227,call=1,user=2,type=test,id=1001,refid=847,enabled=0,ignore_early_media=true,originate_timeout=30}user/1006
202 XML default

My dialplan looks like follows:

       <context name="default">
                <extension name="outbound_soc">
                        <condition field="destination_number"
expression="^.*$">
                                <action application="set"
data="continue_on_fail=true"/>
                                <action application="set"
data="bypass_media=false"/>
                                <action application="set"
data="ignore_early_media=true"/>
                                <action application="set"
data="exec_after_bridge_app=park"/>
                                <action application="socket" data="
0.0.0.0:8447 async full"/>
                        </condition>
                </extension>
        </context>

So once the user 1006 answers the call, it will connect to an Outbound
socket.
And here is my program in perl for controlling the Outbound ESL.

use lib '/root/freeswitch/libs/esl/perl/';
require ESL;
use IO::Socket::INET;
my $ip = "localhost";
my $sock = new IO::Socket::INET ( LocalHost => $ip,  LocalPort => '8447',
Proto => 'tcp',  Listen => 1,  Reuse => 1 );
die "Could not create socket: $!\n" unless $sock;

for(;;) {
        printf "Going to wait for clients to connect\n\n";
        my $new_sock = $sock->accept();
        my $pid = fork();
        if ($pid) {
                close($new_sock);
                next;
        }
        &registerSignals();
        my $host = $new_sock->sockhost();
        my $fd = fileno($new_sock);

        printf "Before making a ESL connection $fd\n";

        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");
        print "BYE\n";
        close($new_sock);
}

sub registerSignals() {
        foreach ( keys %SIG ) {
                $SIG{$_} = 'sig_Handler';
        }
}
sub sig_Handler() {
        my $handle = shift;
        print "Got signal $handle\n";
        if($handle eq "CHLD") {
                wait();
        }
}

But as soon as the call comes to the Outbound ESL program, it receives
SIGSEGV.
The child program prints the following:
       Before making a ESL connection 4
       Got signal SEGV


Can any one please tell me why this is happening??

And one more thing. If I execute the following API, it works fine as
expected.

api originate
{origination_caller_id_name='lakshmanan',origination_caller_id_number=227,call=1}user/1006
202 XML default

The child prints as follows:
Before making a ESL connection 4
Connected call 01200ab6-73bf-11df-af54-55cf82f02c9b, from 227
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100609/0d22b8b6/attachment.html 


More information about the FreeSWITCH-users mailing list