cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1781
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: Abdelrahman Ogail on 29-07-2009 02:03:37 PM
Hello all,
I'm developing an application for CISCO IP Phone 7079 and I want to push sound to the IP Phone so I've wrote this method in C#
Code:
public void Phone_push(string PhoneIP, string ServiceUrl, string UserName, string PassWord, string mytext, string myfrom)
{
 string URLIPPHONE = "http://" + PhoneIP + "/CGI/Execute";
 // Create a request using a URL that can receive a post.
 WebRequest request = WebRequest.Create(URLIPPHONE);
 // Set the Method property of the request to POST.
 request.PreAuthenticate = true;
 request.Credentials = new NetworkCredential(UserName, PassWord);
 request.Method = "POST";
 string text = HttpUtility.UrlEncode(mytext);
 string from = HttpUtility.UrlEncode(myfrom);
 string amp = HttpUtility.UrlEncode("&");
 string postData = "XML=<CiscoIPPhoneExecute><ExecuteItem URL=\"" + ServiceUrl + "?Text=" + text + amp + "From=" + from + "\"/></CiscoIPPhoneExecute>";
 //string postData = "XML=<CiscoIPPhoneExecute><ExecuteItem Priority=\"0\" URL=\"Play:chime.raw\"/></CiscoIPPhoneExecute>";
 byte[] byteArray = Encoding.UTF8.GetBytes(postData);
 // Set the ContentType property of the WebRequest.
 request.ContentType = "application/x-www-form-urlencoded";
 // Set the ContentLength property of the WebRequest.
 request.ContentLength = byteArray.Length;
 // Get the request stream.
 Stream dataStream = request.GetRequestStream();
 // Write the data to the request stream.
 
 dataStream.Write(byteArray, 0, byteArray.Length);
 // Close the Stream object.
 dataStream.Close();
 // Get the response.
 WebResponse response = request.GetResponse();
 string s = response.ToString();
 // Get the stream containing content returned by the server.
 dataStream = response.GetResponseStream();
 dataStream.Close();
 response.Close();  
}
 
Where I'm sure from parameters passed and IP Phone is open and working correctly
I alwayes get the error "Error (504): Gateway Timeout", so why this error arise?
 
Thanks in advance

Subject: RE: Error (504): Gateway Timeout
Replied by: Ram Gopal Chockalingam on 10-08-2009 01:43:47 PM
With this we can't understand where the error comes from.... It would be helpful if you could do a IP packet capture at the phone side and see the interactions on the phone, the XML it received, what it's trying to do next kind of.
 
Most probably it's a C# implementation problem. Ethreal / wireshark trace will clear that out.
 
regards,
Ram
 
 
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links