[Freeswitch-users] How to originate a session from outside
Gayatri Kulkarni
xtpl.gayatri at gmail.com
Tue Aug 26 06:01:39 PDT 2008
Hey guys,
I got an XmlRpcClientException when I executed this code!
The stacktrace goes this way:
org.apache.xmlrpc.client.XmlRpcClientException: Failed to send request to server
: Connection refused: connect
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.newInputStream(XmlRpc
SunHttpTransport.java:79)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.getInputStream(XmlRpcS
treamTransport.java:159)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.getInputStream(XmlRpcHtt
pTransport.java:49)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStre
amTransport.java:213)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorke
r.java:53)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:136)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:125)
at RMIServer.makeACall(RMIServer.java:36)
at RMIServer.main(RMIServer.java:49)
Caused by:
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown
Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Sour
ce)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown S
ource)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.newInputStream(XmlRpc
SunHttpTransport.java:75)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.getInputStream(XmlRpcS
treamTransport.java:159)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.getInputStream(XmlRpcHtt
pTransport.java:49)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStre
amTransport.java:213)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorke
r.java:53)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:136)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:125)
at RMIServer.makeACall(RMIServer.java:36)
at RMIServer.main(RMIServer.java:49)
Do I need to do any special configuration?
Regards,
Gayatri Kulkarni
From: Adeel Ansari
Sent: Friday, August 22, 2008 5:58 AM
To: freeswitch-users at lists.freeswitch.org
Subject: Re: [Freeswitch-users] How to originate a session from outside
Borris, you are great. Actually, this code worked like charm, with no changes.
I will edit the xmlrpc-example wiki page to include the Java example, shortly.
Thanks once again.
On Fri, Aug 22, 2008 at 6:26 PM, Boris Krivonog <boris.krivonog at gmail.com> wrote:
The easiest way would be using XML-RPC
(http://wiki.freeswitch.org/wiki/Freeswitch_XML-RPC), with Apache
XML-RPC (http://ws.apache.org/xmlrpc/client.html) libraries the code
would look something like:
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL( new URL("http://<freeswitchip>:8080/RPC2") );
config.setBasicPassword("freeswitch");
config.setBasicUserName("works");
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Object[] params = new Object[]{ "originate",
"sofia/gateway/gizmo2/01160176xxxxxx &park()" };
client.execute( "freeswitch.api", params );
Since the code above is written "from my memory", take it for
illustrative purpose only, however you should get the idea.
If you need more control over the call(s), consider using
http://wiki.freeswitch.org/wiki/Event_Socket.
Hope this helps,
Boris
On Fri, Aug 22, 2008 at 12:24 PM, Boris Krivonog
<boris.krivonog at gmail.com> wrote:
>
> The easiest way would be using XML-RPC (http://wiki.freeswitch.org/wiki/Freeswitch_XML-RPC), with Apache XML-RPC (http://ws.apache.org/xmlrpc/client.html) libraries the code would look something like:
>
> XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
> config.setServerURL( new URL("http://<freeswitchip>:8080/RPC2") );
> XmlRpcClient client = new XmlRpcClient();
> client.setConfig(config);
> Object[] params = new Object[]{ "originate", "sofia/gateway/gizmo2/01160176xxxxxx &park()" };
> client.execute( "freeswitch.api", params );
>
> Since the code above is written "from my memory",
>
>
>
> Adeel Ansari wrote:
>
> Hi All,
>
> I had success in bridging a session, using my Java Program as a hook, and manage to connect one mobile phone to another. It goes like below.
>
> ===
> --> originate sofia/gateway/gizmo2/01160176xxxxxx &java(net.digitalapps.freeswitch.CallTest)
> ===
>
> In this case, freeswitch call my Java program. Now, My intension is to not use console at all, instead use my java program to originate a session in freeswitch and then bridge the session. So, call freeswitch from my program, not the other way around.
>
> Is it possible? Need suggestions in any case. I mean if I need to come up with my own client. Actually, I was looking JAIN-SIP to achieve this. But then thought of asking your suggestions. With JAIN I might go like this, place a call, hit the dial plan invoke my Java Hook Program and bridge the call. But I am afraid that it might connect my client with the mobile phone, not one phone to another.
>
> Thanks.
>
> --
> Best,
> Adeel Ansari
>
> http://www.linkedin.com/in/adeelansari
>
> ________________________________
> _______________________________________________
> 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
--
Best,
Adeel Ansari
http://www.linkedin.com/in/adeelansari
--------------------------------------------------------------------------------
_______________________________________________
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/20080826/bb43dcfc/attachment-0002.html
More information about the FreeSWITCH-users
mailing list