ESL in c : How to pass MyCallBack function a parameter ?
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
Global variable and it's sad. Usually in callback functions void* context supposed. Dmitry. 2013/4/24 julien terrasson <julien.terrasson@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@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (2)
-
Dmitry Lysenko
-
julien terrasson