How to connect Cisco webdialer service using VB.NET

CISCO webdialer VB.NET

Un cliente doveva interfacciare il centralino CISCO per avviare delle chiamate telefoniche da una appliazione scritta in il linguaggio Microsoft vb.net.

Abbiamo così mappato il webservice del centralino:

https://ipCentralino:8443/webdialer/services/WebdialerSoapService

Abbiamo poi scritto i due metodi per avviare una nuova chiamata ed interromperne una in corso:

[code language=”vb”]
Public Function MakeCall(ByVal userId As String, ByVal password As String, ByVal phoneToCall As String) As String
ByPassCertificate()
Dim service As New CiscoService.WebdialerSoapServiceClient

Dim cred As New CiscoService.Credential
cred.userID = userId
cred.password = password

phoneToCall = phoneToCall

Dim profList = service.getProfileSoap(cred, userId)
Dim prof As New CiscoService.UserProfile
prof.user = userId
prof.lineNumber = "?"
prof.deviceName = profList.deviceInfoList(0).deviceName
prof.supportEM = False
prof.locale = "?"
Dim response = service.makeCallSoap(cred, phoneToCall, prof)

Return response.ToString()
End Function

Public Function EndCall(ByVal userId As String, ByVal password As String) As String
ByPassCertificate()
Dim service As New CiscoService.WebdialerSoapServiceClient

Dim cred As New CiscoService.Credential
cred.userID = userId
cred.password = password

Dim profList = service.getProfileSoap(cred, userId)
Dim prof As New CiscoService.UserProfile
prof.user = userId
prof.lineNumber = "?"
prof.deviceName = profList.deviceInfoList(0).deviceName
prof.supportEM = False
prof.locale = "?"

Dim response = service.endCallSoap(cred, prof)

Return response.ToString()
End Function

Private Sub ByPassCertificate()
System.Net.ServicePointManager.ServerCertificateValidationCallback = _
Function(se As Object, _
cert As System.Security.Cryptography.X509Certificates.X509Certificate, _
chain As System.Security.Cryptography.X509Certificates.X509Chain, _
sslerror As System.Net.Security.SslPolicyErrors) True
End Sub
[/code]