[Freeswitch-users] Call Detail Record via Event Socket Layer

Anthony Minessale anthony.minessale at gmail.com
Thu Dec 8 04:15:58 MSK 2011


Wait, there's more!

if you have channel variable hangup_complete_with_xml=true , then the body
of that event will be a full XML CDR



On Wed, Dec 7, 2011 at 6:51 PM, Michael Collins <msc at freeswitch.org> wrote:

> well, actually it is possible because in the upcoming FS cookbook I have
> this exact recipe! You'll have to buy the book to get the full monty, but
> here's the example script from that recipe, which will also be freely
> downloadable from Packt's web site once the CB is done:
>
> #!/usr/bin/perl
>
>
> # handle_cdr.pl
>
>
> # Connect to event socket, listen for CHANNEL_HANGUP_COMPLETE events
>
>
> # Uses event data to create custom CDRs
>
>
> use strict;
> use warnings;
> use lib '/usr/src/freeswitch.git/libs/esl/perl';
> use ESL;
> my $host = "localhost";
> my $port = "8021";
> my $pass = "ClueCon";
> my $con  = new ESL::ESLconnection($host, $port, $pass);
> if ( ! $con ) {
>     die "Unable to establish connection to FreeSWITCH.\n";
> }
> ## Listen for events, filter in only CHANNEL_HANGUP_COMPLETE
>
>
> $con->events('plain','all');
> $con->filter('Event-Name','CHANNEL_HANGUP_COMPLETE');
> print "Connected to FreeSWITCH $host:$port and waiting for events...\n\n";
> while (1) {
> my @raw_data = split "\n",$e->serialize();
>     my %cdr;
>     foreach my $item ( @raw_data ) {
>         #print "$item\n";
>
>
>         my ($header, $value) = split ': ', $item;
>         $header =~ s/^variable_//;
>         $cdr{$header} = $value
>     }
>     # %cdr contains a complete list of channel variables
>     print "New CDR: ";
>     print $cdr{uuid} . ', ' . $cdr{direction} . ', ';
>     print $cdr{answer_epoch} . ', ' . $cdr{end_epoch} . ', ';
>     print $cdr{hangup_cause} . "\n";
> }
>
>
> -MC
>
> On Wed, Dec 7, 2011 at 6:15 AM, Tux Tux <tha_tux at hotmail.com> wrote:
>
>>  Hi,
>>
>> Is it possible to request the CDR via a ESL event?
>>
>> I found the possibilities to save it to disk and/or database but not to
>> get it via the ESL.
>> Maybe this is because the CDR can grow large in size, but I want to be
>> certain.
>>
>> Thanks,
>> Nico
>>
>>
>> _________________________________________________________________________
>> 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
>
>


-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
googletalk:conf+888 at conference.freeswitch.org
pstn:+19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20111207/7b7de0f0/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list