Why are you taking such a complicated approach? Wouldn’t it be simpler (and better) to just leverage on 3rd party libraries (such as netty) to handle everything related to sockets and forking processes (or triggering new threads), and focus on what your application actually has to do?

 

I would recommend you to take a look at the Java ESL Client library [http://wiki.freeswitch.org/wiki/Java_ESL_Client], a java nio (netty) library that can help you to accomplish what you’re trying to do. When working in outbound mode, FreeSWITCH will establish a new socket connection for each incoming call, and you don’t really have to worry about handling the sockets as every new connection is handled in its own thread.

 

From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Marwan Idriss
Sent: Tuesday, April 09, 2013 9:23 AM
To: freeswitch-users@lists.freeswitch.org
Subject: [Freeswitch-users] Java ESL example for outbound connection

 

Greeting,

I am trying to use Java API to control outbound socket,

But I am not finding any example

especially about this idea : listen for an incoming connection on a socket, accept the incoming connection from FreeSWITCH, fork a new copy of your process if you want to listen for more connections, and then pass the file number of the socket to new($fd).

so if you can provide me with can example

java example for using new($fd) is enough

thanks for your effort