[Freeswitch-users] ESL API command to get the status of Freeswitch

Steven Ayre steveayre at gmail.com
Thu Apr 25 23:10:14 UTC 2019


You're setting eslEvent as the return value of SendRecv but not inspecting
it and then overwriting it with RecvEvent.

Have you tried checking what the SendRecv return value looks like
serialised? It should be there.

On Thu, 25 Apr 2019 at 20:17, Ramesh Kandasamy <ramelcom at gmail.com> wrote:

> Thanks Anthony for the response!
>
> I am using ESL library that comes with Freeswitch source code.
> I am trying to use C# ESL APIs as below to send the 'api status' command
> to the Freeswitch VM from a remote server.
>
>             //Initializes a new instance of ESLconnection, and connects to
> the host $host on the port $port, and supplies $password to freeswitch
>             ESLconnection eslConnection = new ESLconnection(hostName,
> "8021", password);
>
>             if (eslConnection.Connected() != ESL_SUCCESS)
>             {
>                 Console.WriteLine("Error connecting to FreeSwitch");
>                 return null;
>             }
>
>             Console.WriteLine("successful connection");
>
>             ESLevent eslEvent = eslConnection.SendRecv("api status");
>             if (eslEvent == null)
>             {
>                 Console.WriteLine("Error sending command");
>                 return;
>             }
>             if (eslConnection.Connected() == ESL_SUCCESS)
>             {
>                eslEvent = eslConnection.RecvEvent();
>                Console.WriteLine(eslEvent.Serialize(String.Empty));
>             }
>
> With this am able to connect successfully. But unable to see any response.
> I see the same symptoms 'conference xml_list' etc.
>
> But If I subscribe for HEARTBEAT event as below instead of 'api status'
> shown above, I see the events coming at regular intervals.
>             ESLevent eslEvent = eslConnection.SendRecv("event xml
> HEARTBEAT");
>
> Am I using something wrong above?
>
> Thanks
> Ramesh
>
> On Thu, Apr 25, 2019 at 10:31 AM Anthony Minessale <
> anthony.minessale at gmail.com> wrote:
>
>> Maybe you have a bad client, are you using one of the official ones?
>> See below using raw protocol commands over basic telnet connection to
>> demonstrate.
>>
>> ------
>>
>> # telnet localhost 8021
>> Trying ::1...
>> Trying 127.0.0.1...
>> Connected to localhost.
>> Escape character is '^]'.
>> Content-Type: auth/request
>>
>> auth ClueCon
>>
>> Content-Type: command/reply
>> Reply-Text: +OK accepted
>>
>> api status
>>
>> Content-Type: api/response
>> Content-Length: 371
>>
>> UP 0 years, 1 day, 3 hours, 39 minutes, 51 seconds, 345 milliseconds, 930
>> microseconds
>> FreeSWITCH (Version 20.19.4-dev git 837c62c 2019-04-24 12:16:15Z 64bit)
>> is ready
>> 246 session(s) since startup
>> 14 session(s) - peak 25, last 5min 14
>> 0 session(s) per Sec out of max 30, peak 2, last 5min 0
>> 1000 session(s) max
>> min idle cpu 0.00/86.43
>> Current Stack Size/Max 240K/8192K
>>
>> exit
>>
>> Content-Type: command/reply
>> Reply-Text: +OK bye
>>
>> Content-Type: text/disconnect-notice
>> Content-Length: 67
>>
>> Disconnected, goodbye.
>> See you at ClueCon! http://www.cluecon.com/
>> Connection closed by foreign host.
>>
>>
>> On Wed, Apr 24, 2019 at 4:34 PM Ramesh Kandasamy <ramelcom at gmail.com>
>> wrote:
>>
>>> Hi everyone,
>>>
>>> I am looking for a way to get the status of a Freeswitch from a remote
>>> server through ESL API command. I tried using SendRecv and Api methods
>>> of ESLconnection class to send the 'status' command. But I don't receive
>>> the response. However, after further reading through the confluence, I
>>> realized that it is probably because, 'status' command output doesn't
>>> include with a header named "content-type" that has a value of
>>> "api/response" or "command/reply" and both SendRecv and Api methods look
>>> for this.
>>>
>>> So, the question is what other ESL methods shall be used to get the
>>> status of freeswitch?
>>>
>>> Thanks
>>> Ramesh
>>>
>>>
>>>
>>>
>>> _________________________________________________________________________
>>>
>>> The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
>>> Enhance your FreeSWITCH install with disruptive priced SMS and PSTN
>>> services.
>>> Build your next product on our scalable cloud platform.
>>>
>>> Join our online community to chat in real time
>>> https://signalwire.community
>>>
>>> Professional FreeSWITCH Services
>>> sales at freeswitch.com
>>> https://freeswitch.com
>>>
>>> Official FreeSWITCH Sites
>>> https://freeswitch.com/oss
>>> https://freeswitch.org/confluence
>>> https://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
>>> https://freeswitch.com
>>
>>
>>
>> --
>> Anthony Minessale II
>> Founder, FreeSWITCH.
>> http://freeswitch.com
>>
>>
>> https://youtu.be/l_hOxzCt6X4
>> https://www.youtube.com/watch?v=oAxXgyx5jUw
>> https://www.youtube.com/watch?v=9XXgW34t40s
>> https://www.youtube.com/watch?v=NLaDpGQuZDA
>> _________________________________________________________________________
>>
>> The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
>> Enhance your FreeSWITCH install with disruptive priced SMS and PSTN
>> services.
>> Build your next product on our scalable cloud platform.
>>
>> Join our online community to chat in real time
>> https://signalwire.community
>>
>> Professional FreeSWITCH Services
>> sales at freeswitch.com
>> https://freeswitch.com
>>
>> Official FreeSWITCH Sites
>> https://freeswitch.com/oss
>> https://freeswitch.org/confluence
>> https://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
>> https://freeswitch.com
>
> _________________________________________________________________________
>
> The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
> Enhance your FreeSWITCH install with disruptive priced SMS and PSTN
> services.
> Build your next product on our scalable cloud platform.
>
> Join our online community to chat in real time
> https://signalwire.community
>
> Professional FreeSWITCH Services
> sales at freeswitch.com
> https://freeswitch.com
>
> Official FreeSWITCH Sites
> https://freeswitch.com/oss
> https://freeswitch.org/confluence
> https://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
> https://freeswitch.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20190426/e4dd34fd/attachment.html>


More information about the FreeSWITCH-users mailing list