cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
782
Views
0
Helpful
4
Replies

function to restart phone

Davide Fiumi
Level 1
Level 1

I'm developing an Ip Phone Service and I must restart the phone that uses it.

How can I restart the phone by script.asp ?

4 Replies 4

jbond_c24
Level 1
Level 1

There is an AXL method to reset devices.

here is the source

source

Performs either a hard or soft reset on the specified device. If resetting an MGCP box, then set isMGCP attribute to true.

but how can I call doDeviceReset from my asp page after db query and ?

My Code:

----------------------------------

<%@ Language=JavaScript%>

<%

Response.ContentType = "text/xml";

Response.Buffer = true;

var deviceName = String(Request.QueryString("devicename"));

connStrSQLServer = "DRIVER={SQL Server};SERVER=mcs33;DATABASE=CCM0301;UID=sa;PWD=88cxfc482y"

connSQLServer = Server.createobject("ADODB.Connection");

connSQLServer.Open(connStrSQLServer);

connStrDBAccess = "Provider=Microsoft.Jet.OLEDB.4.0; DataSource='C:/CiscoWebs/IPPhoneServices/ForwardAllService/ForwardAllDestinations.mdb'";

connDBAccess = Server.createobject("ADODB.Connection");

connDBAccess.Open(connStrDBAccess);

strSQLServer = "SELECT NumPlan.dNOrPattern FROM Device,DeviceNumPlanMap,NumPlan WHERE Device.name='" + deviceName + "' AND Device.pkID=DeviceNumPlanMap.fkDevice AND NumPlan.pkID=DeviceNumPlanMap.fkNumPlan";

rsSQLServer = connSQLServer.Execute(strSQLServer)

strDBAccess = "SELECT ExtensionDestination FROM ForwardAllDestinations WHERE ExtensionSource='" + rsSQLServer("dNOrPattern") + "'"

rsDBAccess = connDBAccess.Execute(strDBAccess)

ExtensionDestination=rsDBAccess("ExtensionDestination");

strSQLServerUpdate = "UPDATE Numplan SET CFADestination ='" + ExtensionDestination + "' WHERE dNOrPattern='" + rsSQLServer("dNOrPattern") + "'"

connSQLServer.Execute(strSQLServerUpdate)

Response.Write("\r\n");

Response.Write("Da...: " + rsSQLServer("dNOrPattern") + " - A: " + ExtensionDestination + serverIP + "\r");

Response.Flush;

Response.End();

Session.Abandon();

%>

I hate to be the bearer of bad news but... Making direct calls to the CCM database is a big no-no.

The AXL api provides you with the connection to the CCM database.

You will need to install SOAP it is available from Microsoft and freely distributable. You will then need the CCM Administrator user name and password as well as the device id. for the following axl request

strEnvelope = _

"http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi = ""http://www.w3.org/2000/10/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2000/XMLSchema"">" & _

"" & _

"http://www.cisco.com/AXL/1.0"" xmlns:xsi = ""http://www.w3.org/2000/10/XMLSchema-instance"" xsi:schemaLocation = ""http://www.cisco.com/AXL/1.0 http://gkar.cisco.com/schema/axlsoap.xsd"" sequence=""123"">" & _

"" & deviceId & "" & _

"true" & _

"" & _

"" & _

""

Regards,

James

Is this code correct?

----------------------------------------

<%@LANGUAGE="VBScript"%>

<%

Response.ContentType = "text/xml"

Response.Buffer = true

Response.AddHeader "POST", "/CCMApi/AXL/V1/soapisapi.dll"

Response.AddHeader "Host", "172.20.10.2:80"

Response.AddHeader "Accept", "text/*"

Response.AddHeader "Authorization", "Basic bGFycnk6Y3VybHkgYW5kIG1vZQ=="

Response.AddHeader "Content-Length", "613"

Response.Flush

...

deviceId = "{DE6CA1DA-AD17-490C-A933-CC8FD2DF418C}"

strEnvelope = _

"http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi = ""http://www.w3.org/2000/10/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2000/XMLSchema"">" & _

"" & _

"http://www.cisco.com/AXL/1.0"" xmlns:xsi = ""http://www.w3.org/2000/10/XMLSchema-instance"" xsi:schemaLocation = ""http://www.cisco.com/AXL/1.0 http://172.20.10.2/CCMApi/AXL/V1/axlsoap.xsd"" sequence=""123"">" & _

"" & deviceId & "" & _

"true" & _

"" & _

"" & _

""

Set oXMLHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")

oXMLHttp.open "POST", strEnvelop, False

Response.End()

%>

-------------------------------------------

Thanks.