[Freeswitch-users] Can API commands return something other than CSV?

Fraser Redmond fraserredmond at gmail.com
Wed Dec 18 23:30:04 MSK 2013


I'm connecting to FS from PHP over a socket, and parsing results using the
php function str_getcsv()

In my dialplan I have:
    <action application="playback" data="tone_stream://%(250,250,600,120)"/>

When I run "api show channels" if a channel is currently playing that tone,
then within the returned results I get these 3 headers and values:
<snip>,application,application_data,dialplan,<snip>
<snip>,playback,tone_stream://%(250,250,600,120);loops=3,XML,<snip>

So the data-separator is the comma, but the data also contains commas
without being escaped in any way.

Is there any way to change the results to be returned in json? Or change
the delimiter?

I've made a regex replace to get around this particular case by matching
parentheses... But I can see this happening again with some other value
that has a comma outside of parentheses, and would rather get the results
in a better format if possible.

(In the wiki, I can see that CDRs and events can be sent in json, and the
serialize command for events, but none of those would help this particular
case.)

Cheers,
Fraser
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20131218/bc73e92e/attachment-0001.html 


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