<div dir="ltr">We also supply a C ESL lib that handles the encoding and also solves potential race conditions on the socket.<div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 28, 2015 at 8:48 AM, Martyn Davies <span dir="ltr">&lt;<a href="mailto:martyn@magiccow.co.uk" target="_blank">martyn@magiccow.co.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Andrew, <div><br></div><div>I just wanted to to add that I used an open library called JSMN (&#39;jasmine&#39;) to decode JSON messages in a &quot;C&quot; application.  This wasn&#39;t at all painful to use with the Freeswitch JSON-formatted events. This is another way of solving the problem.</div><div><br></div><div>Regards,</div><div>Martyn</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 26 October 2015 at 21:37, Andrew Keil <span dir="ltr">&lt;<a href="mailto:andrew.keil@visytel.com" target="_blank">andrew.keil@visytel.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Nathan,<br>
<br>
Thanks for your response.  I have since implemented a simple parser that converts any %xx to the ASCII character (which you are correct with my aim to simply make it more readable).  I have tested this and it works fine.  So if, in a future FreeSWITCH version, no %xx characters are used inside the values it will just work anyway.<br>
<br>
I take your point about the newline character.<br>
<br>
Andrew<br>
<div><div><br>
<br>
-----Original Message-----<br>
From: <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] On Behalf Of Nathan Neulinger<br>
Sent: Monday, 26 October 2015 2:16 PM<br>
To: FreeSWITCH Users Help &lt;<a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a>&gt;<br>
Subject: Re: [Freeswitch-users] Re- Hex values inside ESL &quot;plain&quot; event messages?<br>
<br>
A plain message couldn&#39;t safely (for parsing purposes) include all of the characters that would be completely valid in json.<br>
<br>
Take a newline for example. That would simply encode to \n in the text of a json message, but would completely screw up the plain format one.<br>
<br>
As for the selection of which characters get encoded, that I don&#39;t have any info on. Below I see colons and spaces inconsistently encoded. While probably not critical, it seems like a relatively safe choice.<br>
<br>
Simple matter - since the plain message can&#39;t possibly cover the entire character set - you have to support decoding, at which point, it shouldn&#39;t matter which ones are encoded for anything other than human readability.<br>
<br>
-- Nathan<br>
<br>
On 10/25/2015 05:24 PM, Andrew Keil wrote:<br>
&gt; To FreeSWITCH users,<br>
&gt;<br>
&gt; I just wanted to check if there is a reason why hex values are<br>
&gt; included inside the ESL &quot;plain&quot; event messages, since when I use JSON<br>
&gt; event messages they are correctly converted to the correct ASCII<br>
&gt; character.  I would prefer to use the plain messages since it is<br>
&gt; quicker for my back-end in &quot;C&quot; to work with, however obviously I need to switch the hex characters back to ASCII (which is easy I know), however I wondered if this is just a historic thing kept in or whether it should be changed to output the ASCII values?<br>
&gt;<br>
&gt; Any feedback will be of interest.<br>
&gt;<br>
&gt; For example (HEARTBEAT) from a simple TELNET session to FreeSWITCH:<br>
&gt;<br>
&gt; event plain HEARTBEAT<br>
&gt;<br>
&gt; Content-Type: command/reply<br>
&gt;<br>
&gt; Reply-Text: +OK event listener enabled plain<br>
&gt;<br>
&gt; Content-Length: 901<br>
&gt;<br>
&gt; Content-Type: text/event-plain<br>
&gt;<br>
&gt; Event-Name: HEARTBEAT<br>
&gt;<br>
&gt; Core-UUID: 92575721-6081-4b86-baed-c44e3bf0f3c8<br>
&gt;<br>
&gt; FreeSWITCH-Hostname: visytel-laptop<br>
&gt;<br>
&gt; FreeSWITCH-Switchname: visytel-laptop<br>
&gt;<br>
&gt; FreeSWITCH-IPv4: 192.168.15.13<br>
&gt;<br>
&gt; FreeSWITCH-IPv6: 2001%3A0%3A5ef5%3A79fd%3A2cd4%3A4228%3A876a%3Aad51<br>
&gt;<br>
&gt; Event-Date-Local: 2015-10-26%2009%3A09%3A44<br>
&gt;<br>
&gt; Event-Date-GMT: Sun,%2025%20Oct%202015%2022%3A09%3A44%20GMT<br>
&gt;<br>
&gt; Event-Date-Timestamp: 1445810984231200<br>
&gt;<br>
&gt; Event-Calling-File: switch_core.c<br>
&gt;<br>
&gt; Event-Calling-Function: send_heartbeat<br>
&gt;<br>
&gt; Event-Calling-Line-Number: 70<br>
&gt;<br>
&gt; Event-Sequence: 512<br>
&gt;<br>
&gt; Event-Info: System%20Ready<br>
&gt;<br>
&gt; Up-Time:<br>
&gt; 0%20years,%200%20days,%200%20hours,%201%20minute,%200%20seconds,%2019%<br>
&gt; 20milliseconds,%20180%20microseconds<br>
&gt;<br>
&gt; FreeSWITCH-Version: 1.5.15b~64bit<br>
&gt;<br>
&gt; Uptime-msec: 60019<br>
&gt;<br>
&gt; Session-Count: 0<br>
&gt;<br>
&gt; Max-Sessions: 1000<br>
&gt;<br>
&gt; Session-Per-Sec: 30<br>
&gt;<br>
&gt; Session-Per-Sec-Max: 0<br>
&gt;<br>
&gt; Session-Per-Sec-FiveMin: 0<br>
&gt;<br>
&gt; Session-Since-Startup: 0<br>
&gt;<br>
&gt; Session-Peak-Max: 0<br>
&gt;<br>
&gt; Session-Peak-FiveMin: 0<br>
&gt;<br>
&gt; Idle-CPU: 99.583980<br>
&gt;<br>
&gt; Regards,<br>
&gt;<br>
&gt; Andrew Keil<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; ______________________________________________________________________<br>
</div></div>&gt; ___ Professional FreeSWITCH Consulting Services:<br>
<div><div>&gt; <a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
&gt; <a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
&gt;<br>
&gt; Official FreeSWITCH Sites<br>
&gt; <a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
&gt; <a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
&gt; <a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
&gt;<br>
&gt; FreeSWITCH-users mailing list<br>
&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-use" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-use</a><br>
&gt; rs<br>
&gt; <a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
&gt;<br>
<br>
--<br>
------------------------------------------------------------<br>
Nathan Neulinger                       <a href="mailto:nneul@mst.edu" target="_blank">nneul@mst.edu</a><br>
Missouri S&amp;T Information Technology    <a href="tel:%28573%29%20612-1412" value="+15736121412" target="_blank">(573) 612-1412</a><br>
System Administrator - Architect<br>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Anthony Minessale II       ♬ @anthmfs  ♬ @FreeSWITCH  ♬<div><br><div>☞ <a href="http://freeswitch.org/" target="_blank">http://freeswitch.org/</a>  ☞ <a href="http://cluecon.com/" target="_blank">http://cluecon.com/</a>  ☞ <a href="http://twitter.com/FreeSWITCH" target="_blank">http://twitter.com/FreeSWITCH</a></div><div><div>☞ <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch ☞ <u><a href="http://freeswitch.org/g+" target="_blank">http://freeswitch.org/g+</a></u><br><br></div><div>ClueCon Weekly Development Call <br></div><div>☎ <a href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a>  ☎ +19193869900 </div><div><br></div></div></div><div><a href="https://www.youtube.com/watch?v=9XXgW34t40s" style="color:rgb(17,85,204);font-size:12.8000001907349px" target="_blank">https://www.youtube.com/watch?v=9XXgW34t40s</a></div><div><a href="https://www.youtube.com/watch?v=NLaDpGQuZDA" target="_blank">https://www.youtube.com/watch?v=NLaDpGQuZDA</a><br></div></div></div></div></div></div></div>
</div>