... how I listen for these events. Is it just a case of polling the
socket for them at frequent enough intervals?

You subscribe to the events you're interested in with 'events'
http://wiki.freeswitch.org/wiki/Event_socket#event

There's no polling involved. FS will send all subscribed events through the socket, you just need to receive them. Use select()/poll()/equivalent to detect when data has arrived.

Since you already have xml_cdr working that would be the best place to collect it, if you can add an extra DB insert in the handler.

-Steve


On 29 November 2012 11:58, Richard Gration <richgration@gmail.com> wrote:
Hi,

Thanks for your reply. I was wondering ...

> If you listen to events then you should be able to reliably receive a hangup
> event containing the variables if you are still connected at that time.

... how I listen for these events. Is it just a case of polling the
socket for them at frequent enough intervals?

> If you want a 100% reliable method use CDRs.
>
> mod_xml_cdr can submit call CDRs to a webserver just after call hangup. The
> XML is verbose and will contain a full call history and all channel
> variables. Because it's submitted ASAP you get the results in real time and
> reliable. If the module can't submit the CDRs it writes them to an error
> folder on disk where you can resubmit them.
>
> Real time seems useful for your use-case, as your script would just need to
> check your DB whether the CDR had been submitted yet. The channel UUID can
> either be captured from events or specified in advance in the originate
> (originate_uuid). There's a uuid api call to generate them for you. I'd
> suggest looking at this method.

This is all great info, thanks :-) I'm capturing the uuid from the
response from the originate command, that's no problem.

The box I'm doing this on is being a B2BUA for us at the moment. The
CDRs are already being HTTP POSTed to a URL, I can't change that as
our billing depends on it. I can see the channel variable coming
though in the POST content, so maybe I can frob the CDR script to give
me what I want.

Thanks again for the info.

Cheers,
Rich

--
Once our basic material needs are met - in my utopia, anyway - life
becomes a perpetual celebration in which everyone has a talent to
contribute. But we cannot levitate ourselves into that blessed
condition by wishing it. We need to brace ourselves for a struggle
against terrifying obstacles, both of our own making and imposed by
the natural world. And the first step is to recover from the delusion
that is positive thinking.
       -- Barbara Ehrenreich

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org