hasan özgilik Posted March 21, 2012 Report Posted March 21, 2012 Hi,My IvrHandler.aspx as ivr soap server works correctly sends response to snom and executes ivrnode(421). But web version sometimes works slowly and sends responses late. I write windows service version of this code but I can not achive send response to snom. Getting Ivr request but can not send response. My code examples are below please help me. IvrHandler.aspx IvrHelper ivrHelper = new IvrHelper(); byte[] array = Request.BinaryRead(Request.TotalBytes); string ivrData = ASCIIEncoding.ASCII.GetString(array); IvrRequest ivrRequest = ivrHelper.GetIvrRequest(ivrData); IvrResponse ivrResponse = new IvrResponse(); ivrResponse.CallID = ivrRequest.CallID; ivrResponse.Destination = "421"; // IVR Node string responseString = ivrResponse.Serialize(); Response.Write(responseString); My Windows Service this.listener.Start(); Byte[] bytes = new Byte[256]; while (true) { TcpClient client = listener.AcceptTcpClient(); client.NoDelay = true; StringBuilder data = new StringBuilder(); NetworkStream stream = client.GetStream(); int i = 0; do { i = stream.Read(bytes, 0, bytes.Length); data.Append(System.Text.Encoding.ASCII.GetString(bytes, 0, i)); } while (i == bytes.Length); string ivrData = data.ToString(); IvrHelper ivrHelper = new IvrHelper(); IvrRequest ivrRequest = ivrHelper.GetIvrRequest(ivrData); IvrResponse ivrResponse = new IvrResponse(); ivrResponse.CallID = ivrRequest.CallID; ivrResponse.Destination = "421"; string responseString = ivrResponse.Serialize(); ASCIIEncoding asen = new ASCIIEncoding(); byte[] responseArray = asen.GetBytes(responseString); //THIS CODE IS SENDING RESPONSE BUT NOT WORK stream.Write(responseArray, 0, responseArray.Length); stream.Flush(); //client.Close(); //When I close call is closing //I have Tried this not work //StreamWriter streamWriter = new StreamWriter(networkStream); //streamWriter.Write(responseString); //streamWriter.Flush(); } Quote
pbx support Posted March 21, 2012 Report Posted March 21, 2012 Did you already did a wireshark (or any network trace) to see if the response is leaving your application? Quote
hasan özgilik Posted March 22, 2012 Author Report Posted March 22, 2012 For IVRHandler.aspx I want to user, enter 11 number and I am reading those numbers one by one. No problem until 8th number character .Reads 8 IVR nodes succesfully. Then suddenly break down call connection. Snom doesn't send following IVR node soap information to External Soap Server. Wireshark trace says : 192.168.5.220(Source PBX server) 192.168.9.10(Destination Client) ICMP(Protocol) 138 Destination unreachable (Port unreachable) For Windows Service I can not get any wireshark trace about getting response from service. Suppose that response can not be sent. I use for sending response. stream.Write(responseArray, 0, responseArray.Length); stream.Flush(); I didn' use client.Close(); or stream.Close(); because breaking down call connection. Quote
Vodia PBX Posted March 22, 2012 Report Posted March 22, 2012 It is a little difficult to tell from the code what is wrong. I would use Wireshark and look at the message on TCP level that are being exchanged. A working example can be found on the old Wiki at http://kiwi.pbxnsip.com/index.php/Linking_External_Application_Server_to_an_IVR_Node. I am not sure if that kind of documentation make it to the new wiki (I did not find anything). Quote
hasan özgilik Posted March 22, 2012 Author Report Posted March 22, 2012 Thanks. As I sad no problem with soap format.Anyway It works for first 8 ivr node correctly but then suddenly break down call connection. Is there a limit for consecutive ivr executes or IIS issues. This is for IvrHandler.aspx. For Windows service, sending response to snom can not be achive yet. I wonder, Is it impossible with windows service? Quote
Vodia PBX Posted March 22, 2012 Report Posted March 22, 2012 I dont think it will be a IIS issue with the limitations on how many requests you can have. The PBX sends the requests one by one. I would at this point really look at whats going on on the IP level, AKA Wireshark. Quote
hasan özgilik Posted March 23, 2012 Author Report Posted March 23, 2012 I have found that Snom Log says: [5] 20120323134706: Too many redirection loops, configured 10, current 11 The scenario is : After user enters his 11 character number , nodes speech 11 character one by one with help of external soap server.Soap server holds number and decide which character of number will be speech. [6] 20120323134642: Received DTMF 9[8] 20120323134642: Call state for call object 110: idle[8] 20120323134642: call port 171: state code from 200 to 200[8] 20120323134642: Call state for call object 110: connected[8] 20120323134642: Play recordings/ivr63.wav[8] 20120323134642: call port 171: state code from 200 to 200[6] 20120323134647: Received DTMF 1[8] 20120323134647: call port 171: state code from 200 to 200[6] 20120323134647: Received DTMF 2[6] 20120323134648: Received DTMF 3[6] 20120323134648: Received DTMF 4[6] 20120323134649: Received DTMF 5[6] 20120323134649: Received DTMF 6[6] 20120323134650: Received DTMF 7[6] 20120323134650: Received DTMF 8[6] 20120323134651: Received DTMF 9[6] 20120323134652: Received DTMF 1[6] 20120323134652: Received DTMF 2[8] 20120323134652: HTTP client: Connect to 192.168.5.220:111, pending requests 0[8] 20120323134652: Received response code 200 with destination 421[8] 20120323134652: Call state for call object 110: idle[8] 20120323134652: Call state for call object 110: connected[8] 20120323134652: Play recordings/ivr120.wav[8] 20120323134652: call port 171: state code from 200 to 200[8] 20120323134656: Play recordings/ivr120.wav[8] 20120323134656: call port 171: state code from 200 to 200[8] 20120323134656: Last message repeated 2 times[8] 20120323134656: HTTP client: Connect to 192.168.5.220:111, pending requests 0[8] 20120323134656: Received response code 200 with destination 9001[8] 20120323134656: Call state for call object 110: idle[8] 20120323134656: Call state for call object 110: connected[8] 20120323134656: Play recordings/ivr111.wav[8] 20120323134656: call port 171: state code from 200 to 200[8] 20120323134658: Play recordings/ivr111.wav[8] 20120323134658: call port 171: state code from 200 to 200[8] 20120323134658: Last message repeated 2 times[8] 20120323134658: HTTP client: Connect to 192.168.5.220:111, pending requests 0[8] 20120323134658: Received response code 200 with destination 9002[8] 20120323134658: Call state for call object 110: idle[8] 20120323134658: Call state for call object 110: connected[8] 20120323134658: Play recordings/ivr112.wav[8] 20120323134658: call port 171: state code from 200 to 200[8] 20120323134659: Play recordings/ivr112.wav[8] 20120323134659: call port 171: state code from 200 to 200[8] 20120323134659: Last message repeated 2 times[8] 20120323134659: HTTP client: Connect to 192.168.5.220:111, pending requests 0[8] 20120323134659: Received response code 200 with destination 9003[8] 20120323134659: Call state for call object 110: idle[8] 20120323134659: Call state for call object 110: connected[8] 20120323134659: Play recordings/ivr113.wav[8] 20120323134659: call port 171: state code from 200 to 200[8] 20120323134700: Play recordings/ivr113.wav[8] 20120323134700: call port 171: state code from 200 to 200[8] 20120323134700: Last message repeated 2 times[8] 20120323134700: HTTP client: Connect to 192.168.5.220:111, pending requests 0[8] 20120323134700: Received response code 200 with destination 9004[8] 20120323134700: Call state for call object 110: idle[8] 20120323134700: Call state for call object 110: connected[8] 20120323134700: Play recordings/ivr119.wav[8] 20120323134700: call port 171: state code from 200 to 200[8] 20120323134701: Play recordings/ivr119.wav[8] 20120323134701: call port 171: state code from 200 to 200[8] 20120323134701: Last message repeated 2 times[8] 20120323134701: HTTP client: Connect to 192.168.5.220:111, pending requests 0[8] 20120323134701: Received response code 200 with destination 9005[8] 20120323134701: Call state for call object 110: idle[8] 20120323134701: Call state for call object 110: connected[8] 20120323134701: Play recordings/ivr114.wav[8] 20120323134701: call port 171: state code from 200 to 200[8] 20120323134703: Play recordings/ivr114.wav[8] 20120323134703: call port 171: state code from 200 to 200[8] 20120323134703: Last message repeated 2 times[8] 20120323134703: HTTP client: Connect to 192.168.5.220:111, pending requests 0[8] 20120323134703: Received response code 200 with destination 9006[8] 20120323134703: Call state for call object 110: idle[8] 20120323134703: Call state for call object 110: connected[8] 20120323134703: Play recordings/ivr115.wav[8] 20120323134703: call port 171: state code from 200 to 200[8] 20120323134704: Play recordings/ivr115.wav[8] 20120323134704: call port 171: state code from 200 to 200[8] 20120323134704: Last message repeated 2 times[8] 20120323134704: HTTP client: Connect to 192.168.5.220:111, pending requests 0[8] 20120323134704: Received response code 200 with destination 9007[8] 20120323134704: Call state for call object 110: idle[8] 20120323134704: Call state for call object 110: connected[8] 20120323134704: Play recordings/ivr116.wav[8] 20120323134704: call port 171: state code from 200 to 200[8] 20120323134705: Play recordings/ivr116.wav[8] 20120323134705: call port 171: state code from 200 to 200[8] 20120323134705: Last message repeated 2 times[8] 20120323134705: HTTP client: Connect to 192.168.5.220:111, pending requests 0[8] 20120323134705: Received response code 200 with destination 9008[8] 20120323134705: Call state for call object 110: idle[8] 20120323134705: Call state for call object 110: connected[8] 20120323134705: Play recordings/ivr117.wav[8] 20120323134705: call port 171: state code from 200 to 200[8] 20120323134706: Play recordings/ivr117.wav[8] 20120323134706: call port 171: state code from 200 to 200[8] 20120323134706: Last message repeated 2 times[8] 20120323134706: HTTP client: Connect to 192.168.5.220:111, pending requests 0[8] 20120323134706: Received response code 200 with destination 9009[5] 20120323134706: Too many redirection loops, configured 10, current 11[8] 20120323134706: call port 171: state code from 200 to 482 [/Code] Quote
pbx support Posted March 23, 2012 Report Posted March 23, 2012 Ok, there is a setting on the PBX to avoid the same call being looped around. This is controlled by a global variable called "max_loop". You can change this value either opening the pbx.xml file (you need to restart the PBX after the change) or use the web interface to change it (http://wiki.snomone.com/index.php?title=Global_Configuration_File:). Ex: http://<pbx-ip>/reg_status.htm?save=save&max_loop=50 Quote
hasan özgilik Posted March 24, 2012 Author Report Posted March 24, 2012 Thanks for your assistance. Web Http version has worked. Also I will be very happy, You share solution for windows service over Tcp version if you have solution or it is possible. And one more thing Is it possible text to speech with Snom Ivr mechanism. Is there a way to achive this? Quote
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.