[Freeswitch-users] Can API commands return something other than CSV?
Fraser Redmond
fraserredmond at gmail.com
Thu Dec 19 13:54:24 MSK 2013
Great, thanks Tony and Erik!
I've added a mention of that to
https://wiki.freeswitch.org/wiki/Mod_commands#Core_Commands so that anyone
else that searches the wiki for json might find it.
Could someone add it to the brief "help" output in fs_cli? (I haven't made
the leap to FS development yet.)
Cheers,
Fraser
On 18 December 2013 20:50, Anthony Minessale <anthony.minessale at gmail.com>wrote:
> show channels as json
> show channels as xml
> show channels as csv <optional delim>
>
>
>
> On Wed, Dec 18, 2013 at 2:30 PM, Fraser Redmond <fraserredmond at gmail.com>wrote:
>
>> 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
>>
>> _________________________________________________________________________
>> 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 ♬ @anthmfs ♬ @FreeSWITCH ♬
>
> ☞ http://freeswitch.org/ ☞ http://cluecon.com/ ☞
> http://twitter.com/FreeSWITCH
> ☞ irc.freenode.net #freeswitch ☞ *http://freeswitch.org/g+
> <http://freeswitch.org/g+>*
>
> ClueCon Weekly Development Call
> ☎ sip:888 at conference.freeswitch.org ☎ +19193869900
>
>
> _________________________________________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20131219/955704eb/attachment.html
Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users
mailing list