[Freeswitch-users] How to set callback for subclass CUSTOM event in perl with module ESL::Dispatch?

"Гришин В.С." Vladislav.Grishin at vts24.ru
Sun Mar 16 14:17:27 MSK 2014


I have FreeSWITCH Version 1.2.22~32bit ( 32bit) on Centos 5.9

In directory /usr/src/freeswitch-1.2.22/libs/esl/perl  is  script 
dispatch.pl

I changed it to see CUSTOM events and spandsp::rxfaxpageresult subclass 
events, but heither CUSTOM events hor spandsp::rxfaxpageresult subclass  
not captured.


#!/usr/bin/perl

use ESL::Dispatch;
use Data::Dumper;
my $daemon = init ESL::Dispatch({});

$| = 1;

sub worker {
   my $self = shift;
   print "I'm a worker\n";
}

sub heartbeat {
   my $self = shift;
   my $event = shift;
   print Dumper $event;
}

sub channel_hangup {
   my $self = shift;
   my $event = shift;
   print Dumper $event;
   print "DO SQL GOODIES HERE!\n";
}

sub custom {
   my $self = shift;
   my $event = shift;
   print Dumper $event;
   print "DO SQL GOODIES HERE!\n";
}

$0 = "ESL::Dispatch rocks!";

$daemon->set_worker(\&worker, 2000);
$daemon->set_callback("heartbeat", \&heartbeat);
$daemon->set_callback("channel_hangup", \&channel_hangup);
$daemon->set_callback("custom", \&custom);
$daemon->set_callback('spandsp::rxfaxpageresult', \&custom);

$daemon->run;

I need catch the evnet only subclass spandsp:: 
(https://wiki.freeswitch.org/wiki/Mod_spandsp#Events) into CUSTOM event.

Vladislav Grishin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140316/10d9d28e/attachment.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list