<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi,<o:p></o:p></p><p class=MsoNormal> I am trying to use ESL with Perl but I am having difficulties receiving events from the FS. I tested a simple Perl script to connect to FS (inbound connection) and execute an API command (show status). I can connect successfully but not receiving the response of the API command. I have listed the simple Perl script and the error I receive. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>However I can telnet and execute the same API command successfully using telnet command (> telnet 127.0.0.1 8021).<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I am running FS 1.4.6 on Debian release 7.5 32-bit.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Any suggestion on how to troubleshoot this is appreciated.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Here is the Perl script I am using to test ESL inbound connection. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal># perl test.pl <o:p></o:p></p><p class=MsoNormal>$VAR1 = undef;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Can't call method "serialize" on an undefined value at test1.pl line 29.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>----------------------------------------------------------------------------------------<o:p></o:p></p><p class=MsoNormal>use Data::Dumper;<o:p></o:p></p><p class=MsoNormal>require ESL;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>my $host = "localhost";<o:p></o:p></p><p class=MsoNormal>my $port = "8021";<o:p></o:p></p><p class=MsoNormal>my $pass = "ClueCon";<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal># Establish an event socket connection to FreeSWITCH<o:p></o:p></p><p class=MsoNormal>my $con = new ESL::ESLconnection($host, $port, $pass);<o:p></o:p></p><p class=MsoNormal>if (! $con) { <o:p></o:p></p><p class=MsoNormal> die "Unable to establish connection to $host:$port\n";<o:p></o:p></p><p class=MsoNormal>}<o:p></o:p></p><p class=MsoNormal>my $cmd = "sofia status";<o:p></o:p></p><p class=MsoNormal>my $args = "";<o:p></o:p></p><p class=MsoNormal>my $e = $con->api($cmd, $args);<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>print Dumper $e;<o:p></o:p></p><p class=MsoNormal>print $e->serialize("plain");<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal># disconnect from FreeSWITCH<o:p></o:p></p><p class=MsoNormal>$con->disconnect();<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div>
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
        <tr>
                <td style='border:none;padding:0px 15px 0px 8px'>
                        <a href="http://www.avast.com/">
                                <img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" />
                        </a>
                </td>
                <td>
                        <p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
                                This email is free from viruses and malware because <a href="http://www.avast.com/">avast! Antivirus</a> protection is active.
                        </p>
                </td>
        </tr>
</table>
<br />
</body></html>