[Freeswitch-users] Catch events from ESL socket
Michael Collins
msc at freeswitch.org
Sat Apr 20 00:14:24 MSD 2013
while($con->connected() && $running) {
$e = $con->recvEventTimed(100);
if ($e and $e->getHeader("content-type") eq "log/data") {
#print $e->getBody();
my $var = $e->getBody();
if ( $var =~ m/skypopen sk1 PING/ ) {
# Do something...
}
}
}
On Fri, Apr 19, 2013 at 12:54 PM, Anton Vojlenko <stargray at bigmir.net>wrote:
> I know about this, but i need catch only 'skypopen sk1 PING' command
> messages.
>
>
> 2013/4/19 Michael Collins <msc at freeswitch.org>
>
>> You can infer what to do by looking in src/libs/esl/perl/logger.pl...
>> Specifically these lines:
>>
>> $e = $con->sendRecv("log 7");
>> print STDERR $e->getBody() . "\n" if ($e);
>>
>> while($con->connected() && $running) {
>> $e = $con->recvEventTimed(100);
>> if ($e and $e->getHeader("content-type") eq "log/data") {
>> print $e->getBody();
>> }
>> }
>>
>>
>> -MC
>>
>>
>> On Fri, Apr 19, 2013 at 12:29 AM, Anton Vojlenko <stargray at bigmir.net>wrote:
>>
>>> If i need catch logs, how can i do that with ESL?
>>>
>>>
>>> 2013/4/18 Dmitry Lysenko <dvl36.ripe.nick at gmail.com>
>>>
>>>> Logs for humans, but events api for programs. )
>>>> But seriously, this is different entities at all.
>>>>
>>>>
>>>>
>>>> 2013/4/18 Anton Vojlenko <stargray at bigmir.net>
>>>>
>>>>> Hmm, can you explain difference between logs and events?
>>>>>
>>>>>
>>>>> 2013/4/18 João Mesquita <jmesquita at freeswitch.org>
>>>>>
>>>>>> Let me get this straight, these are logs, not events... Correct? You
>>>>>> want to parse logs with ESL? That's possible as well, but just want to make
>>>>>> sure that's you want. I am not familiar with skypopen to know this much but
>>>>>> I can help you with ESL.
>>>>>>
>>>>>>
>>>>>> João Mesquita
>>>>>> FreeSWITCH™ Solutions
>>>>>>
>>>>>>
>>>>>> On Thu, Apr 18, 2013 at 11:12 AM, Anton Vojlenko <stargray at bigmir.net
>>>>>> > wrote:
>>>>>>
>>>>>>> Thank for you explanation. I need catch this output:
>>>>>>> 2013-04-18 16:22:11.045518 [DEBUG] skypopen_protocol.c:1767 [|]
>>>>>>> [DEBUG_SKYPE 1767 ][sk1 ][IDLE,IDLE] SENDING: |||PING||||
>>>>>>> 2013-04-18 16:22:11.045518 [DEBUG] skypopen_protocol.c:207 [|]
>>>>>>> [DEBUG_SKYPE 207 ][sk1 ][IDLE,IDLE] READING: |||PONG|||
>>>>>>> But sometimes in array i see this:
>>>>>>> 2013-04-18 16:22:13.025304 [DEBUG] skypopen_protocol.c:734 [|]
>>>>>>> [DEBUG_SKYPE 734 ][sk1 ][IDLE,IDLE] NO ACTIVE calls in this
>>>>>>> moment, skype_call 1347 is RINGING, to ask PARTNER_DISPNAME and
>>>>>>> PARTNER_HANDLE
>>>>>>> 2013-04-18 16:22:13.025304 [DEBUG] skypopen_protocol.c:1767 [|]
>>>>>>> [DEBUG_SKYPE 1767 ][sk1 ][IDLE,IDLE] SENDING: |||GET CALL 1347
>>>>>>> PARTNER_DISPNAME||||
>>>>>>>
>>>>>>> Can you explain how to catch only command output?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 2013/4/18 João Mesquita <jmesquita at freeswitch.org>
>>>>>>>
>>>>>>>> Recveventtimed might return null if an event does not arrive in
>>>>>>>> those ms time. Make sure to use recvevent only if you don't want that.
>>>>>>>>
>>>>>>>> Sent from my iPhone
>>>>>>>>
>>>>>>>> On Apr 18, 2013, at 4:14 AM, Anton Vojlenko <stargray at bigmir.net>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> > Hello,
>>>>>>>> > I am using skypopen module and i need catch API answers from
>>>>>>>> skype client. I wrote simple perl script:
>>>>>>>> >
>>>>>>>> > require ESL;
>>>>>>>> > my $con = new ESL::ESLconnection("localhost", "8021", "ClueCon");
>>>>>>>> > while (1){
>>>>>>>> > $con->sendRecv("log 7");
>>>>>>>> > $e = $con->bgapi("skypopen sk1 PING");
>>>>>>>> > #$uuid = $e->getHeader("Job-UUID");
>>>>>>>> > #print $e->serialize("plain");
>>>>>>>> > $n = 2;
>>>>>>>> > while($n){
>>>>>>>> > $event = $con->recvEventTimed(100);
>>>>>>>> > if ($event and $event->getHeader("Log-File") eq
>>>>>>>> "skypopen_protocol.c") {
>>>>>>>> > push(@dmesg, $event->getBody());
>>>>>>>> >
>>>>>>>> > }
>>>>>>>> > $n--;
>>>>>>>> > }
>>>>>>>> > print "@dmesg\n";
>>>>>>>> > sleep(3);
>>>>>>>> > @dmesg = ();
>>>>>>>> > }
>>>>>>>> >
>>>>>>>> > But sometimes I get empty array, because script catch differect
>>>>>>>> events. How to catch events from ESL socket by UUID?
>>>>>>>> >
>>>>>>>> _________________________________________________________________________
>>>>>>>> > Professional FreeSWITCH Consulting Services:
>>>>>>>> > consulting at freeswitch.org
>>>>>>>> > http://www.freeswitchsolutions.com
>>>>>>>> >
>>>>>>>> >
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > Official FreeSWITCH Sites
>>>>>>>> > http://www.freeswitch.org
>>>>>>>> > http://wiki.freeswitch.org
>>>>>>>> > http://www.cluecon.com
>>>>>>>> >
>>>>>>>> > FreeSWITCH-users mailing list
>>>>>>>> > FreeSWITCH-users at lists.freeswitch.org
>>>>>>>> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>>>>> > UNSUBSCRIBE:
>>>>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>>>> > http://www.freeswitch.org
>>>>>>>>
>>>>>>>>
>>>>>>>> _________________________________________________________________________
>>>>>>>> Professional FreeSWITCH Consulting Services:
>>>>>>>> consulting at freeswitch.org
>>>>>>>> http://www.freeswitchsolutions.com
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Official FreeSWITCH Sites
>>>>>>>> http://www.freeswitch.org
>>>>>>>> http://wiki.freeswitch.org
>>>>>>>> http://www.cluecon.com
>>>>>>>>
>>>>>>>> FreeSWITCH-users mailing list
>>>>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>>>>> UNSUBSCRIBE:
>>>>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>>>> http://www.freeswitch.org
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _________________________________________________________________________
>>>>>>> Professional FreeSWITCH Consulting Services:
>>>>>>> consulting at freeswitch.org
>>>>>>> http://www.freeswitchsolutions.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Official FreeSWITCH Sites
>>>>>>> http://www.freeswitch.org
>>>>>>> http://wiki.freeswitch.org
>>>>>>> http://www.cluecon.com
>>>>>>>
>>>>>>> FreeSWITCH-users mailing list
>>>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>>>> UNSUBSCRIBE:
>>>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>>> http://www.freeswitch.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> _________________________________________________________________________
>>>>>> Professional FreeSWITCH Consulting Services:
>>>>>> consulting at freeswitch.org
>>>>>> http://www.freeswitchsolutions.com
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Official FreeSWITCH Sites
>>>>>> http://www.freeswitch.org
>>>>>> http://wiki.freeswitch.org
>>>>>> http://www.cluecon.com
>>>>>>
>>>>>> FreeSWITCH-users mailing list
>>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>>> UNSUBSCRIBE:
>>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>> http://www.freeswitch.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> _________________________________________________________________________
>>>>> Professional FreeSWITCH Consulting Services:
>>>>> consulting at freeswitch.org
>>>>> http://www.freeswitchsolutions.com
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Official FreeSWITCH Sites
>>>>> http://www.freeswitch.org
>>>>> http://wiki.freeswitch.org
>>>>> http://www.cluecon.com
>>>>>
>>>>> FreeSWITCH-users mailing list
>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>> UNSUBSCRIBE:
>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>> http://www.freeswitch.org
>>>>>
>>>>>
>>>>
>>>>
>>>> _________________________________________________________________________
>>>> Professional FreeSWITCH Consulting Services:
>>>> consulting at freeswitch.org
>>>> http://www.freeswitchsolutions.com
>>>>
>>>>
>>>>
>>>>
>>>> Official FreeSWITCH Sites
>>>> http://www.freeswitch.org
>>>> http://wiki.freeswitch.org
>>>> http://www.cluecon.com
>>>>
>>>> FreeSWITCH-users mailing list
>>>> FreeSWITCH-users at lists.freeswitch.org
>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>> UNSUBSCRIBE:
>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>> http://www.freeswitch.org
>>>>
>>>>
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>>
>>>
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>>
>>
>>
>> --
>> Michael S Collins
>> Twitter: @mercutioviz
>> http://www.FreeSWITCH.org
>> http://www.ClueCon.com
>> http://www.OSTAG.org
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>>
>>
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
>
>
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
--
Michael S Collins
Twitter: @mercutioviz
http://www.FreeSWITCH.org
http://www.ClueCon.com
http://www.OSTAG.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130419/d6d25a84/attachment-0001.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list