[Freeswitch-users] ESL in c : How to pass MyCallBack function a parameter ?

julien terrasson julien.terrasson at gmail.com
Thu Apr 25 00:02:36 MSD 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130424/b89e592f/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list