<%@ Language=VBScript CodePage=65001 %>
<%option explicit%>
<%
'--------------------------------------------------------------------------------------------------------
' Classic ASP implementation of Anveo API to initiate DIAL.CONNECT API function
'
' The rest of Anveo API functions can be implemented by simply changing XML stored in $data variable
' 2008 - Anveo team.
'--------------------------------------------------------------------------------------------------------
function DoApiCall(sXml)
dim XmlHttp
dim PostURL
dim ResponseXml
PostURL="https://www.anveo.com/api/v2.asp"
Set XmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")
XmlHttp.Open "POST", PostUrl, false
XmlHttp.SetRequestHeader "Content-Type", "application/xml; charset=UTF-8"
XmlHttp.SetRequestHeader "Accept", "application/xml; charset=UTF-8"
XmlHttp.Send sXml
ResponseXml = XmlHttp.ResponseText
DoApiCall=ResponseXml
end function
dim sAPICALLXML
dim sAPIRESULTXML
dim oXML
sAPICALLXML="<?xml version=""1.0"" standalone=""no"" ?>" &_
"<REQUEST>" &_
"<USERTOKEN>" &_
"<USERKEY>----------- YOUR API USERKEY -----------</USERKEY>" &_
"</USERTOKEN>" &_
"<ACTION NAME=""DIAL.CONNECT"">" &_
"<PARAMETER NAME=""TEST"">TRUE</PARAMETER>" &_
"<PARAMETER NAME=""PHONENUMBER"">1215215215</PARAMETER>" &_
"<PARAMETER NAME=""DESTPHONENUMBER"">1212121212</PARAMETER>" &_
"<PARAMETER NAME=""CALLERID"">12157010680</PARAMETER>" &_
"<PARAMETER NAME=""DELAY"">1440</PARAMETER>" &_
"<PARAMETER NAME=""MEMO"">DIAL.CONNECT API Action example to connect 1215215215 with 1212121212 delayed by 24 hours</PARAMETER>" &_
"</ACTION>" &_
"</REQUEST>"
sAPIRESULTXML=DoApiCall(sAPICALLXML)
'sAPIRESULTXML holds API result in XML format
response.write sAPIRESULTXML
'TODO Add error handling
'Parse XML Results
Set oXML = Server.CreateObject("MSXML.DOMDocument")
oXML.Async = false
oXML.loadXml( sAPIRESULTXML )
If (oXML.parseError.errorCode <> 0) Then
'ERROR loading XML
else
'oXML object has XML result parsed and SelectSingleNode,GetNamedItem, methods can be used to retrieve result details
end if
%>