06-18-2008 11:48 AM - edited 03-14-2019 02:24 AM
I'm using the VB version of the softphone and CTIOS version 7.2.1. In our call center our agents have another application that needs to trigger the agent making a call. To do this, the other application modifies a file, "c:\cache\dial.dat". The file contains the account number and the number to be dialed. The softphone is watching the file and when it sees that it has been modified, it reads the file and makes a call for the agent to the number in the file and sticks the account number into CallVariable1. At least that is what it is supposed to do.
To test the functionality, I placed a button on the softphone main form and then attached the following code to that button's OnClick event.
<code>
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim args As New CTIOSCLIENTLib.Arguments
Dim temp As String
Dim path As String = "c:\cache\dial.dat"
Dim fs As FileStream
Dim sr As StreamReader
Dim flag As Boolean = True
Dim acctNum As New String("")
Dim dialNum As New String("")
Dim tempArray As Array
fs = File.OpenRead(path)
sr = New StreamReader(fs)
Try
While flag
temp = sr.ReadLine()
If temp.IndexOf("ACCT_NUM") > -1 Then
tempArray = temp.Split(",")
acctNum = tempArray(2)
acctNum = acctNum.Replace("""", "")
acctNum = acctNum.Replace(" ", "")
args.AddItem("CallVariable1", acctNum)
ElseIf temp.IndexOf("_DIAL_OUT") > -1 Then
tempArray = temp.Split(",")
dialNum = tempArray(2)
dialNum = dialNum.Replace("""", "")
dialNum = dialNum.Replace(" ", "")
If dialNum.Substring(1, 3) = "615" Then
dialNum = dialNum.Substring(4)
End If
dialNum = "9" + dialNum
args.AddItem("DialedNumber", dialNum)
End If
If (acctNum.Length > 0 And dialNum.Length > 0) Or temp.Length = 0 Then
flag = False
End If
End While
' send makecall request
m_Agent = m_Session.GetCurrentAgent()
m_Agent.MakeCall(args)
Catch ex As Cisco.CtiOs.Util.CtiOsException
MsgBox(ex.ToString)
End Try
End Sub
</code>
This works fine. Clicking the button reads the file and then makes the call. No big deal. So, at this point I create a FileSystemWatcher object and give it the following properties.
<code>
watcher.Path = "c:\cache\"
watcher.Filter = "dial.dat"
watcher.NotifyFilter = NotifyFilters.LastWrite
watcher.EnableRaisingEvents = True
</code>
And then I copy/paste the exact code that was in the Buttons Click event into the FileSystemWatcher's OnChange event. I start the softphone and then modify the file to test the application. At this point the application throws the following CTIOS exception.
System.Runtime.InteropServices.COMException(0x800101050; The server threw an exception
at Cisco.CTIOSCLIENTLib.AgentClass.MakeCall(Arguments pIArguments)
at CTIOSSoftphone.frmCTIOSSoftphone.watcher_Changed(Object sender, FileSystemEventsArgs e) in C:\NotifyMD_Code_Working\OutboundDesktop\frmCTIOSSoftphone.vb:line 2412
I can still hit the button and the code executes fine. Does anyone have any idea what might be causing this error? Normally I might take this to the Microsoft VB.NET boards but this seems to be a CTIOS thing, so I figured I'd bring it up here. Any help at all would be greatly appreciated.
Andrew Cooper
06-18-2008 12:12 PM
Hi Andrew,
did a quick check at the code and I could not find anything wrong on it. I can confirm we didn't register a similar error so far, which would point possibly to some VB dependency.
As always for this and similar issues i truly recommend using the dev support services group.
Regards,
Riccardo
06-18-2008 12:47 PM
Where is this mythical land of Dev Support Services Group? I wish to journey there and partake of their vast wisdom.
Andrew
06-18-2008 04:28 PM
That was a good one.
Regards,
Geoff
06-18-2008 10:00 PM
Ask and you will be given ;-)))
http://www.cisco.com/en/US/products/svcs/ps3034/ps5408/ps5418/serv_home.html
Cheers,
Riccardo
06-19-2008 04:24 AM
You guys kick much buttocks.
Thanks,
Andrew
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