« Back to CTIOS Toolkit Questions

RE: New Message from Guilherme Ferreira in Computer Telephony Integration O

Combination View Flat View Tree View
Threads [ Previous | Next ]
Doubts while connecting with CTI OS 8.0.1
ctios ctios .net monitor mode event filtering monitored agents
Answer
8/31/12 2:52 PM
Good Morning Guys,
 
I have a few doubts about integrate with CTI OS 8.0.1 server to resolve an issue in my company.
 
Here is what i want to develop:
 
When an agent, using the CTI Toolkit Agent Desktop 8.0.1, receive a call and it rings 3 times with no answer (the agent didn't answered), our application will show a Popup on Windows XP to alert the agent that he needs to answer.
 
Now, here is my doubts/situations:
 
- I'm using .NET Cil and testing some Cisco Samples, when i run more than 2 applications that monitors CTI OS, i receive a message "Monitor Mode Connection Is Denied. Number of supported monitor mode connections
{2} by one CTI OS Server pair has been reached.". How can i proceed if my application monitors CTI OS and i'll have more than 2 agents using it in differents workstations?
 
- Although i have the problem about the connection limit, i've already connected with CTI OS and received all the events for ALL agents connected to the CTI OS, but i want to receive all the call events from a specific agent (each workstation will monitor a different agent). Even following the development guide, i have no success when filtering the events from a specific agent (MessageId=*;AgentID=5003).
 
Can anyone help me?
 
Regards,
 
Guilherme

Only 2 instances of a filter (monitor) mode session is allowed per CTIOS Server. Why are you using monitor mode? You should be using an agent mode connection for each agent if you want to perform any agent state or call control.
Also, there is no way to count rings. You can trigger a timer by the CallDelivered event and then do your popup if the call is not established after say 30 seconds.

Try looking at the CTIOS Client and Server logs to determine why (MessageId=*;AgentID=5003). Isn’t working. Alternately specify the exact messages you want to receive separated by commas.

Thanks!

I'll figure out how to fix this!

Regards,

Guilherme

Only 2 instances of a filter (monitor) mode session is allowed per CTIOS Server. Why are you using monitor mode? You should be using an agent mode connection for each agent if you want to perform any agent state or call control.
Also, there is no way to count rings. You can trigger a timer by the CallDelivered event and then do your popup if the call is not established after say 30 seconds.

Try looking at the CTIOS Client and Server logs to determine why (MessageId=*;AgentID=5003). Isn’t working. Alternately specify the exact messages you want to receive separated by commas.

 
I'm using this code:
 

  System.Text.StringBuilder filterMessage = new StringBuilder("MessageId= ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallDeliveredEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallEstablishedEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallHeldEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallRetrievedEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallClearedEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallConnectionClearedEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallOriginatedEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallFailedEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallConferencedEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallTransferredEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallDivertedEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallServiceInitiatedEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallQueuedEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallBeginEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallEndEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallDataUpdateEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallReachedNetworkEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eCallDequeuedEvent).Append(", ");
            filterMessage.Append((int)CiscoAPI.EventID.eSnapshotCallConf).Append("; ");
            filterMessage.Append("AgentId=5003;");

 
There is anything wrong?
 
The connection is AgentMode, AgentId = 5003, AgentPeripheralId = 1002, AgentIntrument = 1002, AgentPassword = 123456
 
Regard,
 
Guilherme

You should not be setting a filter for an agent mode connection. Are you calling Session.SetAgent for the agent?

You should not be setting a filter for an agent mode connection. Are you calling Session.SetAgent for the agent?

David,
 
I'm really sorry to bother you again, but the SetAgent must be invoked in "OnConnection" or exactly before the Connect method?



            CiscoAPI.Arguments agentArgs = new CiscoAPI.Arguments();


            agentArgs.SetValue(Enum_CtiOs.CTIOS_AGENTID, "5003");
            agentArgs.SetValue(Enum_CtiOs.CTIOS_PERIPHERALID, "1002");


            Agent = new CiscoAPI.Agent(Session, agentArgs);
            Session.SetAgent(Agent);
            Agent = Session.GetCurrentAgent(); //just testing if the agent was assigned to session
 
Regards
 
Guilherme

Yes, in OnConnection. The session has to be connected before you call SetAgent.

If you are writing this in C# you may want to check out the .NET Combo desktop sample in the toolkit. Look at CtiObject.cs

In VB, something like:

Connect -> OnConnection -> OnSetAgentModeEvent

I have some globals:

Dim g_peripheralId As String
Dim g_agentId As String
Dim g_password As String
Dim g_instrument As String


Private Sub OnConnection(ByVal pIArguments As Cisco.CTIOSCLIENTLib.Arguments) Handles g_session.OnConnection
Dim id As Integer
Dim returnvalue As Integer

id = Thread.CurrentThread.ManagedThreadId
Log("OnConnection", id, "Connected to CTIOS server " & g_session.GetValueString("CurrentServer"))

Log("OnConnection", id, "Create an Agent object. Set values on the Agent object - agent ID = " & g_agentId & ", peripheral ID = " & g_peripheralId)
g_agent = New Cisco.CTIOSCLIENTLib.Agent
g_agent.SetValue("AgentID", g_agentId)
g_agent.SetValue("PeripheralID", g_peripheralId)

' Agent Mode: call SetAgent now.
Try
Log("OnConnection", id, "Set the agent on the session. This almost always succeeds.")
returnvalue = g_session.SetAgent(g_agent)
If returnvalue = Cisco.CTIOSCLIENTLib.enumCTIOS_ErrorCodes.CIL_OK Then
Log("OnConnection", id, "Session.SetAgent returned CIL_OK. Wait for OnSetAgentModeEvent to Log in.")
Else
Log("OnConnection", id, "Error: Session.SetAgent failed. Disconnect.")
g_session.Disconnect()
End If
Catch ctiosex As Exception
Dim ctiosExmsg As String
ctiosExmsg = ctiosex.Message & ". Session.SetAgent failed. Disconnect."
Log("OnConnection", id, ctiosExmsg)
g_session.Disconnect()
End Try
End Sub

Private Sub OnSetAgentModeEvent(ByVal pIArguments As Cisco.CTIOSCLIENTLib.Arguments) Handles g_session.OnSetAgentModeEvent
Dim id As Integer
id = System.Threading.Thread.CurrentThread.ManagedThreadId
Log("OnSetAgentModeEvent", id, "")

' Pack up the arguments and perform an agent login
Dim m_Args As New Cisco.CTIOSCLIENTLib.Arguments
Dim nRetVal As Integer

m_Args.AddItem("PeripheralID", g_peripheralId)
m_Args.AddItem("AgentID", g_agentId)
m_Args.AddItem("AgentPassword", g_password)
m_Args.AddItem("AgentInstrument", g_instrument)

' send login request
nRetVal = g_agent.Login(m_Args)
Log("OnSetAgentModeEvent", id, "Login request returned value = " & Str(nRetVal))
End Sub

Regards,
Geoff

Hello Guys,

Here i am again...

I'll try to explaing what am i trying to do:

- Connecting to Session, using there arguments:

connectArgs.SetValue(Enum_CtiOs.CTIOS_CTIOSA, CTIOSIP_A);
connectArgs.SetValue(Enum_CtiOs.CTIOS_PORTA, CTIOSPORT_A);
connectArgs.SetValue(Enum_CtiOs.CTIOS_HEARTBEAT, 100);
connectArgs.SetValue(Enum_CtiOs.CTIOS_AGENTMODE, 1);
connectArgs.SetValue(Enum_CtiOs.CTIOS_AGENTID, "5003");
connectArgs.SetValue(Enum_CtiOs.CTIOS_PERIPHERALID, "1002");
connectArgs.SetValue(Enum_CtiOs.CTIOS_AGENTINSTRUMENT, "1002");
connectArgs.SetValue(Enum_CtiOs.CTIOS_AGENTPASSWORD, "123456");

- Receiving event OnConnection, and than setting up filter for some call events and setting up the agent, with SETAGENT, code as follow:

LogManager.DefaultLogger.Info("OnConnection...");

//Filtra para receber os eventos de ligação
CiscoAPI.Arguments argFilter = new CiscoAPI.Arguments();

//Handlers de erro
CiscoAPI.CilError filterError = new CiscoAPI.CilError();
CiscoAPI.CilError setAgentError = new CiscoAPI.CilError();
bool connect = true;


System.Text.StringBuilder filterMessage = new StringBuilder("MessageId= ");
filterMessage.Append((int)CiscoAPI.EventID.eCallDeliveredEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallEstablishedEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallHeldEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallRetrievedEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallClearedEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallConnectionClearedEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallOriginatedEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallFailedEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallConferencedEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallTransferredEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallDivertedEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallServiceInitiatedEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallQueuedEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallBeginEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallEndEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallDataUpdateEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallReachedNetworkEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eCallDequeuedEvent).Append(", ");
filterMessage.Append((int)CiscoAPI.EventID.eSnapshotCallConf).Append("; ");

if (argFilter.SetValue(Enum_CtiOs.CTIOS_FILTER, filterMessage.ToString()))
{
LogManager.DefaultLogger.Info("Set filter to listen to call events...");

filterError = Session.SetMessageFilter(argFilter);

if (filterError != CiscoAPI.CilError.CIL_OK)
{
LogManager.DefaultLogger.Error(filterError.ToString());
connect = false;
}
else
{
LogManager.DefaultLogger.Info("Set filter to listen to call events - SUCCESS");
}
}

CiscoAPI.Arguments agentArgs = new CiscoAPI.Arguments();

agentArgs.SetValue(Enum_CtiOs.CTIOS_AGENTID, "5003");
agentArgs.SetValue(Enum_CtiOs.CTIOS_PERIPHERALID, "1002");

Agent = new CiscoAPI.Agent(Session, agentArgs);

LogManager.DefaultLogger.Info("Set Agent to the Session, to listen to call events...");

setAgentError = Session.SetAgent(Agent);

if (setAgentError != CiscoAPI.CilError.CIL_OK)
{
LogManager.DefaultLogger.Error(setAgentError.ToString());
connect = false;
}
else
{
LogManager.DefaultLogger.Info("Set Agent to the Session - SUCCESS");
}

if (connect)
{
LogManager.DefaultLogger.Info("OnConnection - SUCCESS");
}


The problem is that i have a message error E_CTIOS_SET_AGENT_SESSION_DISCONNECT_REQUIRED when Session.SetAgent(),
why?!

It's important to say that my application will only monitor call events for a AGENT that will be PREVIOUSLY logged in CTIOS Server through CTI Toolkit Agent Desktop.

Regards.

Guilherme

>>>>It's important to say that my application will only monitor call events for a AGENT that will be PREVIOUSLY logged in CTIOS Server through CTI Toolkit Agent Desktop.

I have a very similar requirement. I simply log the agent in (they already logged in, but this is perfectly legal and allows me to get the events) and put handlers on the callbacks I want to handle – like OnCallRTPStartedEvent(), OnCallEstablished() - and I exit the process when I hear OnPostLogoutByVal(). No need for the filters.

This agent-based process is actually launched by another CTIOS process acting as an “all events bridge”. It launches many of these agent-based processes, as required.

In the all events bridge process, I apply the filter for Agent State events.

I catch the login event (it’s actually a not ready event since there is no login event, but I use a hash map to figure it out) and launch the agent-based process for a single agent.

Comment out the Session.SetMessageFilter()

Regards,
Geoff

Hello there!

I finnaly could connect as Agent Mode and set up the agent to the session.

Now i have this event. on SetAgentMode:

[03/09/2012 10:21:25.669] [INFO ] [dotNET_Sess(58888299)_EvtThd(11)] [MainViewModel ] [ProcessSetAgentMode ] [ProcessSetAgentMode... (PeripheralID:5000 PeripheralType:0 AgentState:eUnknown AgentExtensionemoticonnull) AgentID:5003 AgentInstrument:1002 AgentPassword:123456 SkillGroupsemoticon) UniqueObjectID:agent.5000.5003 EventID:536870923 MessageID:eSetAgentModeEvent ClientAgentTemporaryID:agent.1346667686 ClassIdentifier:1 IsSupervisor:0 LastErroremoticondotNET_Sess(58888299)_EvtThd(11):0) ConnectionMode:1 Filter:filtertarget = agent.5000.5003 CILConnectionID:341 AutoLogin:0 SavedAgentState:9 WaitingforRecovery:0 SavedLoginInfoemoticon) StatusSystememoticonStatusCTIServer:True StatusCtiServerDriver:True StatusCentralController:True StatusPeripheralsemoticon5000:True)) CurrentProfileemoticonnull) IsAgentTeamMember:0 SavedAgentId:5003 OriginatingClientID:SP02-WPS030-6784-dotNET_Sess(58888299)_EvtThd(11) BlockAllEvents:True SilentMonitorTargetAgentUIDemoticonnull) SilentMonitorCallUIDemoticonnull))]

The message BlockAllEvents = true makes me receive no events after SetAgent();

How can i change this attribute?

Regards,

Guilherme

You get the eSetAgentModeEvent after you called SetAgentMode. All you need to do know is log in. You won’t get agent specific events until you do that.

As I explained in a previous email, “they already logged in, but this is perfectly legal and allows me to get the events”.

Just call log in for the agent - and attach some handlers to the events and you will see them (or turn up tracing so you see the toolkit layer tracing them)

Regards,
Geoff

Sorry – that should be “All you need to do NOW is log in”

Regards,
Geoff

David Lender (467)
Shannon McCoy (91)
Arthur Shats (57)
Christopher Nagel (47)
GEOFFREY THOMPSON (38)