Bill H Posted May 18, 2011 Report Share Posted May 18, 2011 I have been trying to use CSTA to the PBX not to the phones. I followed the examples as best as I could and when I POST to the PBX this is what I receive from the Logfile: [8] 2011/05/18 09:59:33: SOAP: Request from IP address 192.168.111.123 without a session [5] 2011/05/18 09:59:33: Receive SOAP request via HTTP interface <?xml version="1.0" encoding="UTF-8"?> <StartApplicationSession xmlns="http://www.ecma-international.org/standards/ecma-354/appl_session/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <applicationInfo> <applicationID>My App</applicationID> <applicationSpecificInfo> <SessionLoginInfo xmlns="http:// www.pbxnsip.com/schemas/csta/login"> <userName>41</userName> <password>12345</password> <domain>localhost</domain> <sessionCleanupDelay>60</sessionCleanupDelay> </SessionLoginInfo> </applicationSpecificInfo> </applicationInfo> <requestedProtocolVersions> <protocolVersion>http://www.ecma-international.org/standards/ecma-323/csta/ed2</protocolVersion> <protocolVersion>http://www.ecma-international.org/standards/ecma-323/csta/ed3</protocolVersion> <protocolVersion>http://www.ecma-international.org/standards/ecma-323/csta/ed4</protocolVersion> <protocolVersion>http://www.ecma-international.org/standards/ecma-323/csta/ed5</protocolVersion> <protocolVersion>http://www.ecma-international.org/standards/ecma-323/csta</protocolVersion> </requestedProtocolVersions> <requestedSessionDuration>180</requestedSessionDuration> </StartApplicationSession> [5] 2011/05/18 09:59:33: SOAP: Unrecognized type StartApplicationSession, expect envelope I am using VB6 with XMLHTTP to POST. It says that I am sending in a SOAP Request, but I am not sure why. I can post the source code if needed. Thanks... Quote Link to comment Share on other sites More sharing options...
katerina Posted May 19, 2011 Report Share Posted May 19, 2011 Hi Bill, The following example works, please try it: http://wiki.snomone.com/index.php?title=CSTA_example Quote Link to comment Share on other sites More sharing options...
Bill H Posted May 19, 2011 Author Report Share Posted May 19, 2011 Hi Bill, The following example works, please try it: http://wiki.snomone.com/index.php?title=CSTA_example Thanks for the response. That is what I originally used, but it did not work for me. Any other ideas??? Quote Link to comment Share on other sites More sharing options...
katerina Posted May 20, 2011 Report Share Posted May 20, 2011 Are you sure you sent the exact same xml from the example, except for the login data? Can you post a pcap trace with the request and reply? Quote Link to comment Share on other sites More sharing options...
Bill H Posted May 20, 2011 Author Report Share Posted May 20, 2011 Are you sure you sent the exact same xml from the example, except for the login data? Can you post a pcap trace with the request and reply? I think the trouble in my Post/Header Method. There are no examples when Posting to the PBX. I see Posting to the phone, but I want to go to the PBX. I tried another Post way and I get this in return: HTTP/1.1 302 Moved Temporarily Location: login.htm Content-Type: text/html Cache-Control: no-cache Cache-Control: no-store Set-Cookie: session=848j1vjhpscwlorsjszk Content-Length: 156 <html><head> <title>Redirect</title> </head><body> If you don't get redirected automatically, please click <a href="login.htm">here</a> </body></html> Pcap Attached Thanks again for your response... csta1.zip Quote Link to comment Share on other sites More sharing options...
katerina Posted May 20, 2011 Report Share Posted May 20, 2011 Try removing the POST line and Content-type header. Here is a trace of a working example and a small test application you can run in python, I hope it helps: test5.zip test3.zip Quote Link to comment Share on other sites More sharing options...
Bill H Posted May 24, 2011 Author Report Share Posted May 24, 2011 Try removing the POST line and Content-type header. Here is a trace of a working example and a small test application you can run in python, I hope it helps: test5.zip test3.zip OK I am now able to communicate with the PBX. The main trouble was that the characters preceding the XML were affecting my display of the received data. Here they are '\x00\x00\x01\xc0l ve<?xml version="1.0" encoding="UTF-8"?> Once I removed them, I could see the data. Thank you for your assistance. Bill H Quote Link to comment Share on other sites More sharing options...
mattlandis Posted June 9, 2011 Report Share Posted June 9, 2011 Bill, You willing to share you working VB code? I'm starting down the same road and hopefully can save a little time. ;-) You can private msg me if you want and if not at all thats fine. tx Quote Link to comment Share on other sites More sharing options...
mattlandis Posted June 14, 2011 Report Share Posted June 14, 2011 ah, i figured it out. will post VB example once i clean it up. Quote Link to comment Share on other sites More sharing options...
mattlandis Posted June 16, 2011 Report Share Posted June 16, 2011 here is code to get others heading in the right direction with vb.net. you may not be able to use it verbatim. Public Sub CSTAPost() Try Dim PBX_Port As Int32 = 80 Dim PBX_IPAddress As IPAddress = IPAddress.Parse("192.168.1.10") Dim TCP_Client As New TcpClient() Dim TCP_Encoder As New UTF8Encoding TCP_Client.Connect(PBX_IPAddress, PBX_Port) Dim TCP_Stream As NetworkStream = TCP_Client.GetStream Dim bytes(TCP_Client.ReceiveBufferSize) As Byte Dim responseData As String ' Dim aresponse As String Dim message As String = "<?xml version=""1.0"" encoding=""UTF-8""><StartApplicationSession xmlns=""http://www.ecma-international.org/standards/ecma-354/appl_session/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><applicationInfo> <applicationID>My App</applicationID> <applicationSpecificInfo> <tns:SessionLoginInfo xmlns:tns=""http://www.pbxnsip.com/schemas/csta/login""> <tns:userName>40</tns:userName> <tns:password>40</tns:password>40<tns:domain>localhost</tns:domain> <tns:sessionCleanupDelay>60</tns:sessionCleanupDelay> </tns:SessionLoginInfo> </applicationSpecificInfo></applicationInfo><requestedProtocolVersions> <protocolVersion>http://www.ecma-international.org/standards/ecma-323/csta/ed3</protocolVersion> <protocolVersion>http://www.ecma-international.org/standards/ecma-323/csta/ed4</protocolVersion> <protocolVersion>http://www.ecma-international.org/standards/ecma-323/csta/ed5</protocolVersion></requestedProtocolVersions><requestedSessionDuration>1800</requestedSessionDuration></StartApplicationSession>" Dim data As Byte() = TCP_Encoder.GetBytes(message) TCP_Stream.Write(data, 0, data.Length) ' MsgBox(m_stream.DataAvailable) TCP_Stream.Read(bytes, 0, CInt(TCP_Client.ReceiveBufferSize)) ' Output the data received from the host to the console. responseData = Encoding.ASCII.GetString(bytes) CSTAResponseData = responseData CSTAResponseData = Mid(responseData, InStr(responseData, "<sessionID>"), 45) ' Close everything. TCP_Stream.Close() TCP_Client.Close() Catch e1 As ArgumentNullException 'Console.WriteLine("ArgumentNullException: {0}", e) MsgBox("argument null " & e1.ToString) Catch e1 As SocketException ' Console.WriteLine("SocketException: {0}", e) MsgBox("socket exp" & e1.ToString) End Try End Sub Quote Link to comment Share on other sites More sharing options...
katerina Posted June 16, 2011 Report Share Posted June 16, 2011 Thanks for sharing with us, mattlandis! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.