08-15-2014 01:21 PM - edited 06-04-2019 02:15 AM
Im wanting to send a <CiscoIPPhoneExecute> xml command to a 7921G phone. When i send the command, the phone shows "Host Not Found" and the response from my stream say "The remote server returned an error: (500) Internal Server Error." I want to write this in c# but could do it in Java also. This used to work for me a while back but it is not anymore. Any help would be appreciated!
My Code:
WebResponse resp = null;
string ErrorCode = "";
string ResponseXML = "";
string pushXML = "<CiscoIPPhoneExecute>";
pushXML += "<ExecuteItem Priority=\"0\" URL=\"Play:Vibe.raw\"/>";
pushXML += "</CiscoIPPhoneExecute>";
pushXML = "XML=" + HttpUtility.UrlEncode(pushXML);
string PhoneURL = string.Format("http://{0}/CGI/Execute", "MyIPAddress");
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(PhoneURL);
req.Method = "POST";
req.AllowAutoRedirect = false;
req.ContentType = "application/x-www-form-urlencoded";
req.Credentials = GetCredentials("MyUsername", "MyPassword");
byte[] bytes = null;
bytes = System.Text.Encoding.UTF8.GetBytes(pushXML);
Stream outputStream = req.GetRequestStream();
outputStream.Write(bytes, 0, bytes.Length);
outputStream.Close();
resp = req.GetResponse();
Stream s = resp.GetResponseStream();
StreamReader stm = new StreamReader(s);
if (stm == null)
{
"Timed out or no response!";
}
else
{
ResponseXML = stm.ReadToEnd();
stm.Close();
}
s.Close();
resp.Close();
08-19-2014 01:56 PM
Hi Dexter,
Is web access enabled on the 7921 phone? If so, can you "Apply Config"?
What happens when you enter the IP address of the phone in your web browser?
Thanks,
Adrienne
08-20-2014 05:18 AM
Web access is enabled. Im not real sure what you mean by "Apply Config"? I can put in "http://<MyPhoneIP>/CGI/Execute" or just the IP address alone and i get a page with all of the phones info and network information.
08-20-2014 11:52 AM
Hi Dexter,
I see you created the same post in IP Phone Services which is the correct location for this post. I'll respond in that post instead of this one.
<CiscoIPPhoneExecute> Problem
Thanks,
Adrienne
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide