NAME
POE::Filter::FSSocket - a POE filter that parses FreeSWITCH events into hashes
SYNOPSIS
#!/usr/bin/perl
use warnings;
use strict;
use POE qw(Component::Client::TCP Filter::FSSocket);
use Data::Dumper;
POE::Component::Client::TCP->new(
'RemoteAddress' => '127.0.0.1',
'RemotePort' => '8021',
'ServerInput' => \&handle_server_input,
'Filter' => 'POE::Filter::FSSocket',
);
POE::Kernel->run();
exit;
my $auth_sent = 0;
my $password = "ClueCon";
sub handle_server_input {
my ($heap,$input) = @_[HEAP,ARG0];
print Dumper $input;
if($input->{'Content-Type'} eq "auth/request") {
$auth_sent = 1;
$heap->{'server'}->put("auth $password");
} elsif ($input->{'Content-Type'} eq "command/reply") {
if($auth_sent == 1) {
$auth_sent = -1;
#do post auth stuff
$heap->{'server'}->put("events plain all");
}
}
}
DESCRIPTION
POE::Filter::FSSocket parses output from FreeSWITCH into hashes. FreeSWITCH events have a very wide range of keys, the only consistant one being Content-Type. The keys are dependant on the type of events. You must use the plain event type as that is what the filter knows how to parse. You can ask for as many event types as you like or all for everything. You specify a list of event types by putting spaces between them ex: "events plain api log talk"
Currently known event types (Event-Name):
CUSTOM
CHANNEL_CREATE
CHANNEL_DESTROY
CHANNEL_STATE
CHANNEL_ANSWER
CHANNEL_HANGUP
CHANNEL_EXECUTE
CHANNEL_BRIDGE
CHANNEL_UNBRIDGE
CHANNEL_PROGRESS
CHANNEL_OUTGOING
CHANNEL_PARK
CHANNEL_UNPARK
API
LOG
INBOUND_CHAN
OUTBOUND_CHAN
STARTUP
SHUTDOWN
PUBLISH
UNPUBLISH
TALK
NOTALK
SESSION_CRASH
MODULE_LOAD
DTMF
MESSAGE
CODEC
BACKGROUND_JOB
ALL
Currently handled FreeSWITCH messages (Content-Type):
auth/request
command/response
text/event-plain
api/response (data in __DATA__ variable)
log/data (data in __DATA__ variable)
SEE ALSO
FreeSWITCH - http://www.freeswitch.org/
AUTHORS
POE::Filter::FSSocket is written by Paul Tinsley. You can reach him by e-mail at pdt@jackhammer.org.
COPYRIGHT
Copyright 2006, Paul Tinsley. All rights are reserved.
POE::Filter::FSSocket is free software; it is currently licensed under the MPL license version 1.1.