Possible to communicate with FS using event_socket without ESL?
Hello, Am I correct in assuming that an app can talk directly to FS using event_socket without the use of the ESL? I am attempting to do this, but having trouble authenticating. I wanted to make sure I was not overlooking something basis in my approach. I have successfully loaded FS on a windows XP server and can register phones and make calls. Further I can talk to the server, authenticate and make calls using telnet, but when attempting to do the same via an app written in .net and using a socket, I am unable to authenticate. Running my app using a tcpSocket, I receive the "Content-Type: auth/request" upon connection of the socket, but when sending "auth password\n\n" it appears that the connection times out after about 10 seconds and I receive: "Content-Type: text/disconnect-notice" & vbLf & "Content-Length: 67". mod_event_socket is enabled in modules.conf.xml . Is there something obvious that I am missing conceptually, or should this work? Thanks!
On Sun, Feb 13, 2011 at 12:27 PM, Bert Jones <rmbertjones@comcast.net>wrote:
Hello,
Am I correct in assuming that an app can talk directly to FS using event_socket without the use of the ESL? I am attempting to do this, but having trouble authenticating. I wanted to make sure I was not overlooking something basis in my approach.
I have successfully loaded FS on a windows XP server and can register phones and make calls. Further I can talk to the server, authenticate and make calls using telnet, but when attempting to do the same via an app written in .net and using a socket, I am unable to authenticate.
Running my app using a tcpSocket, I receive the "Content-Type: auth/request" upon connection of the socket, but when sending “auth password\n\n” it appears that the connection times out after about 10 seconds and I receive: “Content-Type: text/disconnect-notice" & vbLf & "Content-Length: 67". mod_event_socket is enabled in modules.conf.xml .
Is there something obvious that I am missing conceptually, or should this work?
Maybe the .NET component is set to buffer data before sending it. There might be some method to flush the data immediately. If this doesn't solve it. I would get a packet capture. r, takeshi
Thanks mayamatakeshi. I added flushes after each send, but still not working. Setting up packet capture now. From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of mayamatakeshi Sent: Sunday, February 13, 2011 4:28 AM To: FreeSWITCH Users Help Subject: Re: [Freeswitch-users] Possible to communicate with FS using event_socket without ESL? On Sun, Feb 13, 2011 at 12:27 PM, Bert Jones <rmbertjones@comcast.net> wrote: Hello, Am I correct in assuming that an app can talk directly to FS using event_socket without the use of the ESL? I am attempting to do this, but having trouble authenticating. I wanted to make sure I was not overlooking something basis in my approach. I have successfully loaded FS on a windows XP server and can register phones and make calls. Further I can talk to the server, authenticate and make calls using telnet, but when attempting to do the same via an app written in .net and using a socket, I am unable to authenticate. Running my app using a tcpSocket, I receive the "Content-Type: auth/request" upon connection of the socket, but when sending "auth password\n\n" it appears that the connection times out after about 10 seconds and I receive: "Content-Type: text/disconnect-notice" & vbLf & "Content-Length: 67". mod_event_socket is enabled in modules.conf.xml . Is there something obvious that I am missing conceptually, or should this work? Maybe the .NET component is set to buffer data before sending it. There might be some method to flush the data immediately. If this doesn't solve it. I would get a packet capture. r, takeshi
Bert Jones wrote:
Further I can talk to the server, authenticate and make calls using telnet, I am just curious how you do this. Do care to explain how to do this using telnet?
----- don't and stop are the ONLY two 4-letter words considered offensive to men, but not when used together. -- View this message in context: http://freeswitch-users.2379917.n2.nabble.com/Possible-to-communicate-with-F... Sent from the freeswitch-users mailing list archive at Nabble.com.
The ESL is a plain text protocol. You can connect to the ESL port via telnet and type in the ESL protocol commands manually and it'll connect fine. -Steve On 13 February 2011 12:16, mazilo <Nabble@slickdeals.endjunk.com> wrote:
Bert Jones wrote:
Further I can talk to the server, authenticate and make calls using telnet, I am just curious how you do this. Do care to explain how to do this using telnet?
----- don't and stop are the ONLY two 4-letter words considered offensive to men, but not when used together. -- View this message in context: http://freeswitch-users.2379917.n2.nabble.com/Possible-to-communicate-with-F... Sent from the freeswitch-users mailing list archive at Nabble.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
Yes, thanks for the clarification Steve. Bert From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Steven Ayre Sent: Sunday, February 13, 2011 7:28 AM To: FreeSWITCH Users Help Subject: Re: [Freeswitch-users] Possible to communicate with FS using event_socket without ESL? The ESL is a plain text protocol. You can connect to the ESL port via telnet and type in the ESL protocol commands manually and it'll connect fine. -Steve On 13 February 2011 12:16, mazilo <Nabble@slickdeals.endjunk.com> wrote: Bert Jones wrote:
Further I can talk to the server, authenticate and make calls using telnet,
I am just curious how you do this. Do care to explain how to do this using telnet? ----- don't and stop are the ONLY two 4-letter words considered offensive to men, but not when used together. -- View this message in context: http://freeswitch-users.2379917.n2.nabble.com/Possible-to-communicate-with-F S-using-event-socket-without-ESL-tp6020307p6020712.html Sent from the freeswitch-users mailing list archive at Nabble.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
Sure, here is what worked for me using Putty First: enable mod_event_socket module in modules.conf.xml (It is enabled by default ) <load module="mod_event_socket"/> Next: configure in autoload_configs/event_socket.conf.xml as follows: <settings> <param name="nat-map" value="false"/> <param name="listen-ip" value="192.168.0.15"/> <param name="listen-port" value="8021"/> <param name="password" value="myPassword"/> <param name="apply-inbound-acl" value="lan"/> </settings> Then: configure Putty client as follows Set Putty to talk to server running FS over port 8021 using telnet protocol, open session, Finally: Open a telnet session and: Send blank line, Send "auth yourPassword", Send blank line. Receive "Ok" Bert -----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of mazilo Sent: Sunday, February 13, 2011 7:16 AM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Possible to communicate with FS using event_socket without ESL? Bert Jones wrote:
Further I can talk to the server, authenticate and make calls using telnet, I am just curious how you do this. Do care to explain how to do this using telnet?
----- don't and stop are the ONLY two 4-letter words considered offensive to men, but not when used together. -- View this message in context: http://freeswitch-users.2379917.n2.nabble.com/Possible-to-communicate-with-F S-using-event-socket-without-ESL-tp6020307p6020712.html Sent from the freeswitch-users mailing list archive at Nabble.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
Without the use of the ESL *protocol* - no. Without the use of the supplied ESL *libraries* - correct. You're along the right lines on implementing your own protocol. If you can connect and authenticate via telnet from the same computer you're trying your app from then there should be no problem with FS. The fact you say it takes 10s for FS to respond indicates you're not sending the auth line. You should get either a success or failure message straight away in reply to that. So it sounds like the auth isn't getting sent at all. Try using Wireshark to view what's going over the network to check it's what you expect. -Steve On 13 February 2011 03:27, Bert Jones <rmbertjones@comcast.net> wrote:
Hello,
Am I correct in assuming that an app can talk directly to FS using event_socket without the use of the ESL? I am attempting to do this, but having trouble authenticating. I wanted to make sure I was not overlooking something basis in my approach.
I have successfully loaded FS on a windows XP server and can register phones and make calls. Further I can talk to the server, authenticate and make calls using telnet, but when attempting to do the same via an app written in .net and using a socket, I am unable to authenticate.
Running my app using a tcpSocket, I receive the "Content-Type: auth/request" upon connection of the socket, but when sending “auth password\n\n” it appears that the connection times out after about 10 seconds and I receive: “Content-Type: text/disconnect-notice" & vbLf & "Content-Length: 67". mod_event_socket is enabled in modules.conf.xml .
Is there something obvious that I am missing conceptually, or should this work?
Thanks!
_______________________________________________ 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
Thanks for the clarification. I too suspect something in my communications. Just wanted to make sure I was not missing something. Will move my communication app to a separate machine from the FS server and run Wireshark. Thanks for recommendation. Bert From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Steven Ayre Sent: Sunday, February 13, 2011 7:29 AM To: FreeSWITCH Users Help Subject: Re: [Freeswitch-users] Possible to communicate with FS using event_socket without ESL? Without the use of the ESL *protocol* - no. Without the use of the supplied ESL *libraries* - correct. You're along the right lines on implementing your own protocol. If you can connect and authenticate via telnet from the same computer you're trying your app from then there should be no problem with FS. The fact you say it takes 10s for FS to respond indicates you're not sending the auth line. You should get either a success or failure message straight away in reply to that. So it sounds like the auth isn't getting sent at all. Try using Wireshark to view what's going over the network to check it's what you expect. -Steve On 13 February 2011 03:27, Bert Jones <rmbertjones@comcast.net> wrote: Hello, Am I correct in assuming that an app can talk directly to FS using event_socket without the use of the ESL? I am attempting to do this, but having trouble authenticating. I wanted to make sure I was not overlooking something basis in my approach. I have successfully loaded FS on a windows XP server and can register phones and make calls. Further I can talk to the server, authenticate and make calls using telnet, but when attempting to do the same via an app written in .net and using a socket, I am unable to authenticate. Running my app using a tcpSocket, I receive the "Content-Type: auth/request" upon connection of the socket, but when sending "auth password\n\n" it appears that the connection times out after about 10 seconds and I receive: "Content-Type: text/disconnect-notice" & vbLf & "Content-Length: 67". mod_event_socket is enabled in modules.conf.xml . Is there something obvious that I am missing conceptually, or should this work? Thanks! _______________________________________________ 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
This is why I stopped and took the time to write the ESL library. If you want to do it yourself that's fine but were batting 1000 on people who try to write their own and ask for help or report their own mistakes as bugs along the way. I'm not sure why you would want to take the risk to properly implement the interface we have already spent the time on. On Sun, Feb 13, 2011 at 10:40 PM, Bert Jones <rmbertjones@comcast.net> wrote:
Thanks for the clarification. I too suspect something in my communications. Just wanted to make sure I was not missing something. Will move my communication app to a separate machine from the FS server and run Wireshark. Thanks for recommendation.
Bert
From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Steven Ayre Sent: Sunday, February 13, 2011 7:29 AM To: FreeSWITCH Users Help Subject: Re: [Freeswitch-users] Possible to communicate with FS using event_socket without ESL?
Without the use of the ESL *protocol* - no. Without the use of the supplied ESL *libraries* - correct.
You're along the right lines on implementing your own protocol. If you can connect and authenticate via telnet from the same computer you're trying your app from then there should be no problem with FS.
The fact you say it takes 10s for FS to respond indicates you're not sending the auth line. You should get either a success or failure message straight away in reply to that. So it sounds like the auth isn't getting sent at all.
Try using Wireshark to view what's going over the network to check it's what you expect.
-Steve
On 13 February 2011 03:27, Bert Jones <rmbertjones@comcast.net> wrote:
Hello,
Am I correct in assuming that an app can talk directly to FS using event_socket without the use of the ESL? I am attempting to do this, but having trouble authenticating. I wanted to make sure I was not overlooking something basis in my approach.
I have successfully loaded FS on a windows XP server and can register phones and make calls. Further I can talk to the server, authenticate and make calls using telnet, but when attempting to do the same via an app written in .net and using a socket, I am unable to authenticate.
Running my app using a tcpSocket, I receive the "Content-Type: auth/request" upon connection of the socket, but when sending “auth password\n\n” it appears that the connection times out after about 10 seconds and I receive: “Content-Type: text/disconnect-notice" & vbLf & "Content-Length: 67". mod_event_socket is enabled in modules.conf.xml .
Is there something obvious that I am missing conceptually, or should this work?
Thanks!
_______________________________________________ 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
_______________________________________________ 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
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org googletalk:conf+888@conference.freeswitch.org pstn:+19193869900
Hi Again Steve, This is resolved now. It appears that I was not doing the initiation and authentication with the proper number of linefeeds and with the proper sequence of writes AND reads. For those interested, here is a working function written in vb.net to do the communications on the localhost machine. The assumption is made that the password has been changed from ClueCon to myPassword in modules.config.xml and that mod_event_socket is loaded in modules.conf.xml using the entry: <load module="mod_event_socket"/>. Thanks to all for the help. Bert Function SendCommands_socket(ByVal id, ByVal Cmnd) 'Funciton to initiate conneciton with FreeSWITCH event_socket via a tcpsocket, authenticate and send a command. 'Note that the writes AND reads are all mandatory, as are the double linefeeds. 'Dims Dim returndata As String = "" 'Holds return data Dim sendBytes As [Byte]() ' byte array used to hold outbound data after conversion from ascii to byte array Dim tcpClient As New System.Net.Sockets.TcpClient() ' the tcp socket client used to communicate with the host Dim rcvBytes(tcpClient.ReceiveBufferSize) As Byte 'byte array used to receive bytes returned from host Try 'Initiate conneciton with event_socket via the socket-------------------- tcpClient.Connect("localhost", 8021) Dim stream As NetworkStream = tcpClient.GetStream() 'open the socket stream.Read(rcvBytes, 0, CInt(tcpClient.ReceiveBufferSize)) returndata = Encoding.ASCII.GetString(rcvBytes) MsgBox(returndata) 'should say "Content-Type: auth/request" If stream.CanWrite And stream.CanRead Then 'Do authentication.------------------------------------------------- ' convert text to byte array sendBytes = Encoding.ASCII.GetBytes("auth myPassword" & vbCrLf & vbCrLf) '(The 2 crlf are mandatory ) ' write data to stream stream.Write(sendBytes, 0, sendBytes.Length) ' read the NetworkStream into a seperate byte buffer. stream.Read(rcvBytes, 0, CInt(tcpClient.ReceiveBufferSize)) ' convert binary bytes received into ascii returndata = Encoding.ASCII.GetString(rcvBytes) MsgBox(returndata) 'should say "Content-Type: command/reply Reply-Text: +Ok accepted" 'Send the command.------------------------------------------------- sendBytes = Encoding.ASCII.GetBytes(Cmnd & vbCrLf & vbCrLf) stream.Write(sendBytes, 0, sendBytes.Length) stream.Read(rcvBytes, 0, CInt(tcpClient.ReceiveBufferSize)) returndata = Encoding.ASCII.GetString(rcvBytes) MsgBox(returndata) Else If Not stream.CanRead Then Console.WriteLine("cannot not write data to this stream") tcpClient.Close() Else If Not stream.CanWrite Then Console.WriteLine("cannot read data from this stream") tcpClient.Close() End If End If End If ' Disconnect tcpClient.Close() Return returndata Catch oEX As SocketException ' Disconnect tcpClient.Close() Return oEX.ToString Exit Function End Try End Function From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Bert Jones Sent: Sunday, February 13, 2011 11:41 PM To: 'FreeSWITCH Users Help' Subject: Re: [Freeswitch-users] Possible to communicate with FS using event_socket without ESL? Thanks for the clarification. I too suspect something in my communications. Just wanted to make sure I was not missing something. Will move my communication app to a separate machine from the FS server and run Wireshark. Thanks for recommendation. Bert From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Steven Ayre Sent: Sunday, February 13, 2011 7:29 AM To: FreeSWITCH Users Help Subject: Re: [Freeswitch-users] Possible to communicate with FS using event_socket without ESL? Without the use of the ESL *protocol* - no. Without the use of the supplied ESL *libraries* - correct. You're along the right lines on implementing your own protocol. If you can connect and authenticate via telnet from the same computer you're trying your app from then there should be no problem with FS. The fact you say it takes 10s for FS to respond indicates you're not sending the auth line. You should get either a success or failure message straight away in reply to that. So it sounds like the auth isn't getting sent at all. Try using Wireshark to view what's going over the network to check it's what you expect. -Steve On 13 February 2011 03:27, Bert Jones <rmbertjones@comcast.net> wrote: Hello, Am I correct in assuming that an app can talk directly to FS using event_socket without the use of the ESL? I am attempting to do this, but having trouble authenticating. I wanted to make sure I was not overlooking something basis in my approach. I have successfully loaded FS on a windows XP server and can register phones and make calls. Further I can talk to the server, authenticate and make calls using telnet, but when attempting to do the same via an app written in .net and using a socket, I am unable to authenticate. Running my app using a tcpSocket, I receive the "Content-Type: auth/request" upon connection of the socket, but when sending "auth password\n\n" it appears that the connection times out after about 10 seconds and I receive: "Content-Type: text/disconnect-notice" & vbLf & "Content-Length: 67". mod_event_socket is enabled in modules.conf.xml . Is there something obvious that I am missing conceptually, or should this work? Thanks! _______________________________________________ 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
If your using .Net use this from the source tree - libs\esl\managed\managed_esl* works great and uses the esl lib as its base -- View this message in context: http://freeswitch-users.2379917.n2.nabble.com/Possible-to-communicate-with-F... Sent from the freeswitch-users mailing list archive at Nabble.com.
participants (6)
-
Anthony Minessale
-
Bert Jones
-
Jeff Lenk
-
mayamatakeshi
-
mazilo
-
Steven Ayre