[Freeswitch-users] ESL in c : How to pass MyCallBack function a parameter ?
Dmitry Lysenko
dvl36.ripe.nick at gmail.com
Thu Apr 25 04:51:26 MSD 2013
Global variable and it's sad. Usually in callback functions void* context
supposed.
Dmitry.
2013/4/24 julien terrasson <julien.terrasson at gmail.com>
> Hi again,
>
> While trying to build my own esl outbound server (server_esl.c)
>
> I found that a callback function was called from the main block whenever a
> socket is opened.
>
> Prototype of MyCallBack is :
> static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock,
> struct sockaddr_in *addr)
>
> I would like to extend this prototype to communicate this callback
> function a Queue structure that is defined in the main thread.
>
> Let's take an example :
>
> int main(void)
> {
>
> Queue *Q = createQueue(MaxNumberOfElements);
> if(pthread_create(&thread1, NULL, processQueue, Q)) {
> esl_listen_threaded("localhost", 8084, mycallback, 100000);
> }
>
> I would like to be able to pass myCallBack the Q structure so that i can
> queue up all the request incoming from freeswitch. But my knowledge of C is
> a bit dusty.
> So it would be nice if i can get in touch with esl_listen_threaded coder
> so i can define the smartest way to extend the code to transmit a C struct
> to the callBack Function.. Can you help me to contact him ?
>
> Regards,
>
> Julien
>
>
>
>
> _________________________________________________________________________
> 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/20130425/27ff1d40/attachment.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list