HomeRegistration is free!CalendarFind other membersHere you can view your subscribed threads, work with private messages and 
  edit your profile and preferencesFrequently Asked QuestionsSearch

Go Back   Community for Avaya Users > Solution Forums > Contact Centers and CRM
  Today's Posts Mark Forums Read

Contact Centers and CRM Discuss contact center and customer relationship management products and solutions.

Reply
 
Thread Tools Display Modes
  #1  
Old 10-08-09, 11:00 AM
jlo jlo is offline
Member
 
Join Date: Aug 2009
Location: Central Time Zo
Posts: 11
Default Custom app to query CMS data using cvsApp

I am using CMS Supervisor 14.0.IA.06

I am having problems when trying to run a report from my VB.NET code. I stripped out the report part, trying to focus solely on the login aspect and make it as simple as possible. Even whenever I had the report section added, it was still failing on the login.

I've refrenced the DLLs that allow me to use the same calls the CMS Supervisor tools do, but i'm failing to be able to log in.

I notice in my log file, that the last line stamped is "Failed to log in." You can see from my code which line that is. It looks like the cvsApp.CreateServer line is working fine, however the cvsConn.Login line is not seeming to make connection.

I've checked and rechecked the userid and the password. I'm using the same one that I use to log in through cmsSupervisor.

If anyone could help, I would greatly appreciate it.

Below is my code:
Code:
    Sub CustomCMSReport()
        WriteToFile("Dimming Vars")

        Dim sServerIP As String = "x.x.x.x"
        Dim iACD As Integer = 99
        Dim lang As String = "ENU"
        Dim report_name As String = "Real-Time\Queue/Agent\Queue/Top Agent Status"
        Const Username As String = "user"
        Const Password As String = "pass"
        Dim export_file As String = "c:\....\."

        Dim cvsApp As ACSUP.cvsApplication = CreateObject("ACSUP.cvsApplication")
        Dim cvsConn As ACSCN.cvsConnection = CreateObject("ACSCN.cvsConnection")
        Dim cvsSrv As ACSUPSRV.cvsServer = CreateObject("ACSUPSRV.cvsServer")
        Dim cvsRpt As ACSREP.cvsReport = CreateObject("ACSREP.cvsReport")
        Dim cvsCatalog As ACSCTLG.cvsCatalog = CreateObject("ACSCTLG.cvsCatalog")

        WriteToFile("Vars Dimmed")

        WriteToFile("Attempting to create a server connection")
        If (cvsApp.CreateServer(Username, Password, "", sServerIP, False, lang, cvsSrv, cvsConn)) Then
            WriteToFile("Server is created -- attempting login")
            If (cvsConn.Login(Username, Password, sServerIP, lang)) Then
                WriteToFile("Successfully logged in")
            Else
                WriteToFile("Failed to log in")
            End If
        Else
            WriteToFile("Failed to create server")
        End If

        cvsConn.Disconnect()
        cvsCatalog = Nothing
        cvsRpt = Nothing
        cvsSrv = Nothing
        cvsConn = Nothing
        cvsApp = Nothing

    End Sub
Reply With Quote
  #2  
Old 10-08-09, 11:18 AM
jlo jlo is offline
Member
 
Join Date: Aug 2009
Location: Central Time Zo
Posts: 11
Default

By the way, I just looked in the ..\Avaya\CMS Supervisor R14 \ Logs\ and found the following log entries:

CVS_os.Log:
10\08\09 13:40:11 Could not start transporter
10\08\09 13:40:52 CMem::~CMem Closing Cache.
10\08\09 13:50:35 CMem::Create Force reinitialization.

CVS_Trace.LOG:
**Trace Log Start** (CVS V14.0 IA.06) Thu Oct 08 14:13:33 2009
141336 16 2 -28601 [05]ACSTRANS WinMain:00497 The server does not exist '*No Server Name extracted from server index=1'
**Trace Log Stop** (CVS V14.0 IA.06) Thu Oct 08 14:14:36 2009

CVS_Error.LOG:
**Error Log Start** (CVS V14.0 IA.06) Thu Oct 08 14:13:33 2009
141336 16 2 -28601 [05]ACSTRANS WinMain:00497 The server does not exist '*No Server Name extracted from server index=1'
**Error Log Stop** (CVS V14.0 IA.06) Thu Oct 08 14:14:36 2009

cvs.log:
10-08-2009 14:14:35 Application Terminated

I'm investigating still. I think the CVS_Error.LOG line might help a lot in fixing this, hopefully.

Any input would be welcome.
Reply With Quote
  #3  
Old 10-14-09, 12:57 AM
thepfy thepfy is offline
Senior Consultant
 
Join Date: Apr 2006
Location: Newcastle Upon Tyne
Posts: 616
Default

Try killing all CMS components through task manager and deleting the CMS cache file.

I did do some tests and got it to connect. Note that it is harder to run the reports through VB.NET as you can't pass the report name directly. I have seen an example in C# which uses a hash table to get around this but I couldn't get the hash table lookup to work in VB but I only had a quick look.

http://www.callcenterops.com/forum/t...reports-c.html has an example in C#

http://www.callcenterops.com/forum/t...s-reports.html may also be of interest
Reply With Quote
  #4  
Old 10-14-09, 11:23 AM
jlo jlo is offline
Member
 
Join Date: Aug 2009
Location: Central Time Zo
Posts: 11
Default

I reinstalled CMS Supervisor and that seemed to fix that problem. I have it all working fine, and it even spits the data out to a txt file, then parses it and inserts it into a database.

My next problem came whenever I needed to make it run continuously so i would always have fresh data. I put the connection/report running into it's own sub, then called that sub over and over in a loop. Unfortunately, after so long, it seems that the transporter thread is hanging/dieing. Please see below code:

It seems to be hanging on the following line:

Code:
If cvsConn.Login(cmsUser, cmsPass, cmsServer, cmsLang, "", False) Then
It just sits there and does nothing. It will run like 15 iterations through, running the reporting, generating the txt file, parsing it, and updating the database just fine. But around iteration number 16 or so, it seems to just crash.

I also noticed that each time it iterates, it spawns two acsSrv, two acsRep, and one ACSTrans in memory. It seems that the ACSTrans is timing out so the whole process is just hanging.

I see in my log files the following line:

**Error Log Start** (CVS V14.0 IA.06) Wed Oct 14 13:50:27 2009
140112 16 2 -28018 [26]ACSTRANS XportErr:01123 Operation Failed to start on CMS '*Function: CPROTOCOL::ProcessCntl, Transporter Error: -28018, Last System Error: 0, Stop Frame Received'


Code:
    Sub Main()
        For x = 1 To 150 'This spins the program into a loop, the sleep command at bottom keeps it from going crazy
            Dim CurrDateTime As Date = System.DateTime.Now 'This is the clock for the whole program, very very important.
            runReport(CurrDateTime)
            parseFile(CurrDateTime)
            WriteToFile("Completed successfully!", CurrDateTime)
            DeleteNonUpdatedUsers(CurrDateTime)
            'KillProcs()
            Console.WriteLine("Iteration: " & x)
            Console.WriteLine("Sleeping for " & sleeptime / 1000 & " seconds.")
            System.Threading.Thread.Sleep(sleeptime)

        Next
        objWriter.Close()
    End Sub

    Sub runReport(ByVal CurrDateTime As DateTime)
        On Error Resume Next

        Dim cvsSrv As Object
        Dim cvsConn As Object
        Dim cvsApp As Object
        Dim Rep As Object

        'Connecting to CMS Server
        cvsConn = CreateObject("ACSCN.cvsConnection")
        cvsSrv = CreateObject("ACSUPSRV.cvsServer")
        cvsApp = CreateObject("ACSUP.cvsApplication")
        Rep = CreateObject("ACSREP.cvsReport")

        Console.WriteLine("Connecting to CMS Server")
        If cvsApp.CreateServer(cmsUser, cmsPass, "", cmsServer, False, cmsLang, cvsSrv, cvsConn) Then
            Console.WriteLine("Successfully created server instance.")
            WriteToFile("Successfully created server instance", CurrDateTime)
            If cvsConn.Login(cmsUser, cmsPass, cmsServer, cmsLang, "", False) Then
                Console.WriteLine("Succesfully logged in to cms server.")
                WriteToFile("Successfully logged in to cms server", CurrDateTime)

                'Run the report!
                Console.WriteLine("Running CMS Reports")
                cvsSrv.Reports.ACD = 1
                Info = cvsSrv.Reports.Reports("Real-Time\Queue/Agent\Queue/Top Agent Status")

                If Info Is Nothing Then
                    WriteToFile("Report was not found", CurrDateTime)
                    If cvsSrv.Interactive Then
                    Else
                        Log = CreateObject("ACSERR.cvsLog")
                        Log.AutoLogWrite("The report was not found on ACD 1.")
                        Log = Nothing
                    End If
                Else
                    WriteToFile("Running Report", CurrDateTime)
                    b = cvsSrv.Reports.CreateReport(Info, Rep)
                    If b Then
                        Rep.Window.Top = 4260
                        Rep.Window.Left = 7687
                        Rep.Window.width = 9825
                        Rep.Window.Height = 7230
                        Rep.SetProperty("Split/Skill", "20")
                        b = Rep.ExportData(cmsExportFile, 44, 0, False, True, True)
                    End If
                End If

                'Need to disconnect and clean up variables here.
                Console.WriteLine("Disconnecting from CMS Server")
                Rep.Quit()
                cvsSrv.ActiveTasks.Remove(Rep.TaskID)
                cvsConn.Logout()
                cvsConn.Disconnect()

                cvsSrv.dispose()
                cvsConn.dispose()
                cvsApp.dispose()
                Info.dispose()
                Rep.dispose()

                'cvsSrv = Nothing
                'cvsConn = Nothing
                'cvsApp = Nothing
                'Info = Nothing
                'Rep = Nothing

            Else
                WriteToFile("Failed to log in to cms server :( ", CurrDateTime)
                Console.WriteLine("Failed to log in to the CMS Server")
            End If
        Else
            Console.WriteLine("Failed to log in to the cms server")
            WriteToFile("Failed to create cms server :( ", CurrDateTime)
        End If
    End Sub
Reply With Quote
  #5  
Old 10-14-09, 11:28 AM
jlo jlo is offline
Member
 
Join Date: Aug 2009
Location: Central Time Zo
Posts: 11
Default

One more thing, every six iterations, it seems all of the acsRep.exe, acsSrv.exe, and acsTrans.exe that are running die, and reload whenever my sub runs again, like I would expect them to do each time it runs, not every six times.
Reply With Quote
  #6  
Old 10-14-09, 11:57 AM
jlo jlo is offline
Member
 
Join Date: Aug 2009
Location: Central Time Zo
Posts: 11
Default

Also, is there a way to get it to try to login (the 'If cvsConn.Login' line) for only a certain number of seconds, then give up and continue through to the next iteration?
Reply With Quote
  #7  
Old 10-14-09, 12:27 PM
jlo jlo is offline
Member
 
Join Date: Aug 2009
Location: Central Time Zo
Posts: 11
Default

By the way:
http://www.callcenterops.com/forum/t...s-reports.html

Is an AWESOME read. I'm working through understanding it fully now. I think it might have some solutions to my problems here.
Reply With Quote
  #8  
Old 10-14-09, 10:23 PM
thepfy thepfy is offline
Senior Consultant
 
Join Date: Apr 2006
Location: Newcastle Upon Tyne
Posts: 616
Default

Check that it is closing the CMS components properly and you don't have orphaned processes.

I would be tempted to login once then run the reports looped as neccessary and logout at the finish. This is what I do when I use VBA to run multiple reports.

Glad the link was useful.
Reply With Quote
  #9  
Old 10-15-09, 05:44 AM
jlo jlo is offline
Member
 
Join Date: Aug 2009
Location: Central Time Zo
Posts: 11
Default

Thanks.

That was my initial design, login/logout only every so often. I set it at two minutes to test.

I logged in, then ran the report, slept for 15 seconds, ran report, slept 15 secs, etc. Then logout after 2 minutes.

Log back in, loop for 2 minutes running reports every 15 seconds, then log out, etc.

However, the transporter thread was still timing out here too, so that's why i went to the log in/log out every time approach.

I think i'm just going to make one executable that runs the report, then another executable to loop over and over calling the first executable, and cleaning up any still running in memory.

I think I am ending up with orphaned processes, I cannot figure out how to get them to close out properly.
Reply With Quote
  #10  
Old 10-15-09, 06:02 AM
thepfy thepfy is offline
Senior Consultant
 
Join Date: Apr 2006
Location: Newcastle Upon Tyne
Posts: 616
Default

To be honest the little play I had with VB 2008 but I also had problems with orphaned processes, which I didn't have with VBA. If you have too many CMS processes then it tends to fail.

As it is a real time report you I suppose you could set a cvsrpt.refreshinterval
and writing some code to grab the data when the window updates. Not sure how to do this though.
Reply With Quote
  #11  
Old 10-15-09, 11:51 AM
jlo jlo is offline
Member
 
Join Date: Aug 2009
Location: Central Time Zo
Posts: 11
Default

Well, i just changed my code back to run only once, then exit. I also, at the beginning of the code, check for any cvsApp, cvsSRV, cvsRep and kill them prior to creating my new ones.

Then, we went into sql server agent and scheduled it to run every minute twice.

It's working like a charm, and now we have real-time web graphs. Yay.
Reply With Quote
  #12  
Old 10-15-09, 10:13 PM
thepfy thepfy is offline
Senior Consultant
 
Join Date: Apr 2006
Location: Newcastle Upon Tyne
Posts: 616
Default

Glad you got it working
Reply With Quote
  #13  
Old 03-11-10, 03:55 PM
marcuspere's Avatar
marcuspere marcuspere is offline
Member
 
Join Date: Dec 2007
Location: Sacramento
Posts: 18
Exclamation A Solution to the Original Problem

Although logging in, running the report, then logging out works, I'd love it if someone had a suggestion on the original problem: processes (exes) hanging open when looping a report...

Most of the posted code on automated VBA reports goes:

<Log in>
<Run report>
<Log out>

Which generally closes all the processes. And jlo's solution is:

<Loop>
<Log in>
<Run report>
<Log out>
</Loop>


I have a program that monitors our call center for us and checks if callers start to hold (and if they do, notify management real time). So my problem is I want to:

<Log in> (when program runs)
<Loop> (about every minute)
<Run Report>
</Loop>
</Log out> (when program closes)


Although I could have the code log in and out every time I refresh the report data, it just seems unessisary (and resourse sapping). When I run my program, everything runs fine except that the acsRep.exe opens on the cvsApp.CreateServer command and never closes. After 10 minutes, I have 10 ascRep.exe running.


Here is my Code:
Code:
    Public Function LOGIN() As Boolean

        cvsApp = New ACSUP.cvsApplication
        cvsConn = New ACSCN.cvsConnection
        cvsSrv = New ACSUPSRV.cvsServer
        cvsCatalog = New ACSCTLG.cvsCatalog
        cvsRpt = New ACSREP.cvsReport

        cvsApp = CreateObject("acsup.cvsApplication")

        If cvsApp.CreateServer(userId, userPass, "", userServ, False, "ENU", cvsSrv, cvsConn) Then
            If cvsConn.Login(userId, userPass, userServ, "ENU") Then
                logIntoAvaya = TRUE
''''''''''''''''Start Running the RunExportScript every minute
                Exit Function
            End If
        End If

        logIntoAvaya = False
    End Function


    Public Sub runExportScript()
        cvsCatalog = cvsSrv.Reports
        cvsSrv.Reports.ACD = 1

        cvsCatalog.CreateReport(cvsCatalog.Reports.Item("Integrated\Designer\CC Available Agents Export"), cvsRpt)
        cvsRpt.SetProperty("Splits/Skills", "43;48;45;42;44;40;47")

        cvsRpt.Run()
        cvsRpt.ExportData("C:\Documents and Settings\nbkouf8\My Documents\Visual Studio 2005\Projects\Visual Studio 2005\Projects\SelfThinkingAvaya\SelfThinkingAvaya\AvailableAgentsExport.txt", 9, 0, True, True, True)

        cvsRpt.Quit()
    End Sub

    Private Sub LOGOUT()
        On Error Resume Next
        cvsConn.Disconnect()
        cvsSrv.Connected = False
        
        cvsRpt = Nothing
        cvsCatalog = Nothing
        cvsSrv = Nothing
        cvsApp = Nothing
        cvsConn = Nothing
    End Sub
__________________
Marcus
Reply With Quote
  #14  
Old 03-14-10, 10:41 PM
thepfy thepfy is offline
Senior Consultant
 
Join Date: Apr 2006
Location: Newcastle Upon Tyne
Posts: 616
Default

You could set the refresh interval for the report and get the macro to export it after every refresh.

Another possibility would be to quit the report and rerun it.
Reply With Quote
  #15  
Old 03-22-10, 06:40 AM
marcuspere's Avatar
marcuspere marcuspere is offline
Member
 
Join Date: Dec 2007
Location: Sacramento
Posts: 18
Default

The problem with trying to close/quit the report and rerunning it, is that it leaves a process running each time it reruns--that is what I would like to avoid and have not found a clean way of disposing of that process.

Ive never tried the refresh option before. I'll have to explore that. Seems to be a good solution because it leaves the report open the whole time--no multiple instances of the report process.

I'll post back if it works.
__________________
Marcus
Reply With Quote
  #16  
Old 03-22-10, 09:42 AM
harrjf's Avatar
harrjf harrjf is offline
Senior Member
 
Join Date: Jan 2007
Location: USA
Posts: 480
Default

A few suggestions.

First:

cvsRpt.Run()
cvsRpt.ExportData("C:\Documents and Settings\nbkouf8\My Documents\Visual Studio 2005\Projects\Visual Studio 2005\Projects\SelfThinkingAvaya\SelfThinkingAvaya\ AvailableAgentsExport.txt", 9, 0, True, True, True)

The cvsRpt.Run() is not needed. The cvsExportData will execute the report.

Second:

For a single execution of the report, after the cvsRep.Quit, add

If Not cvsSrv.Interactive Then
cvsSrv.ActiveTasks.Remove cvsRep.taskid
End If
Set cvsRep = Nothing

Third:

Do a single logon. I logon for days and never end up with multiple reports. I create a specific logid to process these types of reports so I don't accidentally step on top of it by doing something manually.

Fourth:

You want to have a perpetual loop, so create a DO WHILE (1=1) type of loop and after the "Set cvsRep = Nothing" add a line "cvsConn.wait (#secs)"


cvsSrv.Reports.ACD = 1
Set Info = cvsSrv.Reports.Reports("Integrated\Designer\CC Available Agents Export")

DO

b = cvsSrv.Reports.CreateReport(Info,cvsRpt)
cvsRpt.SetProperty "Splits/Skills", "43;48;45;42;44;40;47"

b = cvsRpt.ExportData("C:\Documents and Settings\nbkouf8\My Documents\Visual Studio 2005\Projects\Visual Studio 2005\Projects\SelfThinkingAvaya\SelfThinkingAvaya\ AvailableAgentsExport.txt", 9, 0, True, True, True)
cvsRpt.Quit
cvsSrv.ActiveTasks.Remove cvsRpt.TaskID
Set cvsRpt= Nothing
b=cvsConn.wait(60) ' wait 60 seconds

LOOP

You may not like what happens when you execute the cvsConn.wait. The application goes off to lah lah land until the time expires.
Reply With Quote
  #17  
Old 03-24-10, 02:41 PM
marcuspere's Avatar
marcuspere marcuspere is offline
Member
 
Join Date: Dec 2007
Location: Sacramento
Posts: 18
Default Got it to work!

Thank you thepfy and harrjf... I got a working solution to run without floating/hanging on/orphaned processes. The only part I looped was the Rep.ExportData and cvsConn.Wait and that did the trick.

<Log in>
Run Report
<Loop>
Rep.ExportData
DO SOMETHING WITH THE EXPORT
cvsConn.Wait
</Loop>
Quit Report
</Log out>

The problem I found was looping the cvsSrv.Reports.CreateReport(cvsSrv.Reports.Reports ("Integrated\Designer\CC Available Agents Export"), Rep) as this created a new instance of the acsRep.exe process which never died--even if you Rep.quit, Rep = nothing, etc...

Here is the code in the simpliest form:
Code:
        Dim cvsApp = CreateObject("acsup.cvsApplication")
        Dim cvsConn = CreateObject("ACSCN.cvsConnection")
        Dim cvsSrv = CreateObject("ACSUPSRV.cvsServer")
        Dim Rep = CreateObject("ACSREP.cvsReport")

        If cvsApp.CreateServer(userId, userPass, "", userServ, False, "ENU", cvsSrv, cvsConn) Then
            If cvsConn.Login(userId, userPass, userServ, "ENU") Then
                cvsSrv.Reports.ACD = 1
                If cvsSrv.Reports.CreateReport(cvsSrv.Reports.Reports("Integrated\Designer\CC Available Agents Export"), Rep) Then
                    'Set all the properties of the report
                    Rep.SetProperty("Splits/Skills", "43;48;45;42;44;40;47")
                    'Rep.RefreshInterval = 
                    Do While 1
                        If Not Rep.ExportData("C:\", 9, 0, True, True, True) Then
                            MsgBox("Export was not successful")
                            Exit Do
                        End If
                        ''''''''''''''Do whatever you want with the export file now
                        cvsConn.Wait(20) 'FYI There are better wait/pause functions that allow the program to keep working. This one makes any GUI look frozen.
                    Loop
                    Rep.Quit()
                    Rep = Nothing
                Else
                    MsgBox("Report creation not successful")
                End If
            Else
                MsgBox("Login not successful")
            End If
        Else
            MsgBox("Server creation not successful")
        End If

        On Error Resume Next
        cvsConn.Disconnect()
        cvsSrv.Connected = False

        cvsSrv = Nothing
        cvsApp = Nothing
        cvsConn = Nothing

Didn’t know the report.run() wasn’t necessary and when I took it out, worked just fine! Personally I try to remove any unnecessary code I see in these posts so knowing the .run() doesn’t have to be in there cleans the code up nicely.

I didn’t put in the cvsSrv.ActiveTasks.Remove because the only time I am done with the report is when I am logging out/closing the program and it takes care of itself.


I am developing a program that sits on our manager’s computers and monitors the call center for us. When calls start to hold (as indicated in the report I am looping) it notifies our call center. The goal is to replace the need for reader boards/monitors. If this helps anyone else--great!
__________________
Marcus
Reply With Quote
  #18  
Old 03-24-10, 02:50 PM
marcuspere's Avatar
marcuspere marcuspere is offline
Member
 
Join Date: Dec 2007
Location: Sacramento
Posts: 18
Default Btw

By the way... For you data people, you might find using Rep.SaveHTML instead of Rep.ExportData as a great alternitive. You might like the html format better for data.

Even better than that, you can save that HTML to some shared business web portal and anyone can monitor your call center that has internet/intranet access. One idea our managers always come up with is, "Lets just give everyone AVAYA access and they can run their own real-time reports." That never is a good idea, but having real-time webpages that are AVAYA reports is just as effective.
__________________
Marcus
Reply With Quote
  #19  
Old 05-08-10, 11:42 PM
malalation malalation is offline
Member
 
Join Date: Mar 2010
Location: Bahrain
Posts: 3
Question why??

Hello,

From what I understood from reading the topic (plz correct me if I'm wrong) is that you are porting the CMS vb script code to .Net, I don't get what advantage this can give when compared to running the .acsauto script and reading the resulted file

Can I have a link to download the DLL that you're using in order to test the method?

Thnx
Reply With Quote
  #20  
Old 07-26-10, 05:00 PM
Barindelli Barindelli is offline
Member
 
Join Date: Feb 2010
Location: Montevideo
Posts: 6
Default references

For cvsApplication:
C:\Program Files\Avaya\CMS Supervisor R13\acsApp.exe
For cvsConnection:
C:\Program Files\Avaya\CMS Supervisor R13\cvsCONN.DLL
For cvsServer:
C:\Program Files\Avaya\CMS Supervisor R13\acsSRV.exe
For cvsAgentMgmt:
C:\Program Files\Avaya\CMS Supervisor R13\acsAA.exe
And for cvsReport:
C:\Program Files\Avaya\CMS Supervisor R13\acsRep.exe

Hope it helps!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -7. The time now is 05:06 PM.

< Contact Us - Home - Disclaimer - Privacy >


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.