[Freeswitch-users] ESL socket outbound in C++

João Mesquita jmesquita at freeswitch.org
Sat Feb 19 07:11:46 MSK 2011


There is some C implementations of ESL stuff on my contrib dir as well if
anyone is interested...

Also, FSGui is all ESL with Qt and can also be found on my contrib dir.

Regards,
João Mesquita



On Fri, Feb 18, 2011 at 10:27 PM, Michael Collins <msc at freeswitch.org>wrote:

> We appreciate you sharing! Feel free to add this to the wiki as well.
> -MC
>
> On Fri, Feb 18, 2011 at 8:25 AM, Stephen Wilde <wstephen80 at gmail.com>wrote:
>
>> I'm learning to use ESL in C++ to do a call control and I want to share my
>> code with the community.
>>
>> I had a little difficult at startup so I hope that this code can help
>> someone.
>>
>> The code is: http://pastebin.freeswitch.org/15418
>>
>> Using "esl_oop" module, I have implemented a basic ESL Channel class (that
>> can be extended) so the "main" event handling loop can be very simple, for
>> example for an unuseful esl bridge application, can be:
>>
>>     ESLchannel legA(&connection, inbound_uuid);
>>
>>     ESLchannel legB(&connection);
>>     legB.Originate(dialstring)
>>
>>     while (1)
>>      {
>>         ESLevent * event = connection.recvEventTimed(1000);
>>
>>         if (event)
>>         {
>>             const char * ename = event->getHeader("Event-Name");
>>             const char * event_uuid = event->getHeader("unique-id");
>>
>>             // It's an event for LegB ?
>>             //-------------------------
>>             if (legB.Uuid() == event_uuid)
>>             {
>>                 if (!strcmp(ename, "CHANNEL_PROGRESS_MEDIA"))
>>                 {
>>                     legA.PreAnswer();
>>                     legA.BridgeTo(legB);
>>                 }
>>                 else if (!strcmp(ename, "CHANNEL_ANSWER"))
>>                 {
>>                     legA.Answer();
>>                     legA.BridgeTo(legB);
>>                 }
>>                 else if (!strcmp(ename,"CHANNEL_HANGUP"))
>>                 {
>>                     const char * cause = event->getHeader("Hangup-Cause");
>>
>>                     legA.Hangup(cause);
>>                 }
>>             }
>>             // It's an event for LegA ?
>>             //-------------------------
>>             else if (legA.Uuid() == event_uuid)
>>             {
>>                 if (!strcmp(ename,"CHANNEL_HANGUP"))
>>                 {
>>                     const char * cause = event->getHeader("Hangup-Cause");
>>
>>                     legB.Hangup(cause);
>>                 }
>>             }
>>
>>             delete event;
>>         }
>>     }
>>
>> _______________________________________________
>> 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
>>
>>
>
> _______________________________________________
> 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/20110219/14f69804/attachment-0001.html 


More information about the FreeSWITCH-users mailing list