The purpose of this document is to assist CUCM Connector client applications developers to understand the flow of messages between CC and CC-Client.
Before You Start
You’re expected to have a good understanding of JMS and broker-based communication using ActiveMQ. You should know what are Topics and Queues, what is the difference between them, and how they can be used in different contexts. While you are exploring ActiveMQ, many questions arise in your mind and those are answered here.
Apache ActiveMQ is the most popular and powerful open source messaging and Integration Patterns server.
Apache ActiveMQ is fast, supports many Cross Language Clients and Protocols, and comes with easy-to-use Enterprise Integration Patterns and many advanced features while fully supporting JMS 1.1 and J2EE 1.4. Apache ActiveMQ is released under the Apache 2.0 License
First of all, download, install and run ActiveMQ Broker. You can find some samples on the ActiveMQ site. A basic Hello World program can be found here. You can find more complex examples here. All of these examples are implemented in java. If you are writing clients in a language other than Java, you can find examples in the respective technology on the ActiveMQ site.
ActiveMQ supports different types of topologies for communication. GC is using a Client-Server topology with TCP protocol for communication. You need to develop at least a simple application that communicates on given specifications.
CUCM Connector Communication Architecture
<Make diagram here showing CC-Client, CC, AMQ, CUCM>
Describe a little bit about broker-based communication using AMQ
On which protocol and ports CC communicate with AMQ
The client is expected to subscribe to AMQ <Topic>Destination
GC listens on AMQ <Queue>Destination
A message broker is an intermediary program module that translates a message from the formal messaging protocol of the sender to the formal messaging protocol of the receiver. Message brokers are elements in telecommunication or computer networks where software applications communicate by exchanging formally-defined messages. Apache ActiveMQ is fast, supports many Cross Language Clients and Protocols, and comes with easy-to-use Enterprise Integration Patterns.
CC uses ActiveMQ as a message broker for communication. By default, CC communicates with AMQ on port 61616 (openwire) using TCP protocol. You can change port in AMQ configurations. CC listens on Queue “Connector1”, all the commands from the client should be published to Queue “Connector1” and CC replies on Topic, specified by the client in the Hello command.
Message Pattern
CC communicates via AMQ that follows simple open text JMS messaging over OpenWire. A message could either be a request/command from the CC-Client or it could be an event/response sent by CC. In the rest of the document, the term “Command” is used to mention the message sent by the CC client, and the term “Event” is used to mention the message sent by CC.
Command Pattern
In a Command, JMS-Type contains the command and JMS-Body contains command arguments.
Commands are grouped into categories for the sake of clean and easier-to-interpret documentation.
If GC-Client receives System#IN_SERVICE, the GC is assumed to be connected and ready to listen.
Note: If CC-Client doesn’t receive System#IN_SERVICE after CONNECT_TIMEOUT (Max. 3 seconds suggested) period, it should periodically keep sending the Hello command.
All Commands
Following is the list of all possible commands supported by CC. Each of the commands is explained with parameters supplied, events expected against the command, and possible errors that can occur for that particular command.
Note: While sending a command message, set the value for the property Time To Live for the message to a certain time(milliseconds), after the specified time that message/command will automatically be discarded by AMQ. It needs to do so that the old command should not be processed.
CC supports synchronous requests. To achieve this, you need to send JMSCorrelationID along with the command, CC will send the same JMSCorrelationID with the event that corresponds to that particular command.
Set ReplyTo attribute of command message to the topic on which the client is subscribed to receive events.
Hello
Hello is the first command sent from Client to CC for handshake purposes. If CC replies with some event mean that your connection with CC has been established and the client is able to send further commands to CC. If the client does not receive any response from CC, either CC is dead or the command is not delivered to CC. Before sending a Hello command you should know on which topic the client will listen from CC. You need to create that topic on ActiveMQ explicitly and subscribe to it. Specify that particular topic in the hello command as <Client_Destination> parameter. If the client receives System#IN_SERVICE, you can supply further commands to CC (other than the hello command). Normally, Connect and Logincommands are sent after a successful handshake to CC in order to start your session (Make and receive calls). If the client receives System#OUT_OF_SERVICE or no response from CC, keep sending the hello command.
Command: Hello
JMS-Type
Hello#<Client_Destination>
JMS-Body
<Client_Destination>
ActiveMQ Topic name on which CC will send events to the client. The client should subscribe to this Topic in order to receive the events.
Expected Event (s)
Default Formate
There can be two possible events:
System#IN_SERVICE: GC is connected to CUCM and can process commands. You can send further commands to GC.
System#OUT_OF_SERVICE: GC is not connected to CUCM. Your commands will not be processed by GC. You are expected to send the Hello command continuously until you didn’t receive System#IN_SERVICE.
Login
The Login command is used to actually log in to CUCM. This command actually registers the IP phone with CUCM. Login command parameters are agent extension, dummy_value, and dummy_value. In case of a successful login, CC raises Agent Info, AgentState, and Dialog state events. Now the agent will be able to make and receive calls on the client application.
The Login command is used to actually log in to CUCM. This command actually registers the IP phone with CUCM. Login command parameters are agent extension, dummy_value, and dummy_value. In case of a successful login, CC raises Agent Info, AgentState, and Dialog state events. Now the agent will be able to make and receive calls on the client application.
This command allows a user to initiate a consult call with another agent. Once the call is accepted by the other agent, the user can either transfer this call to the other agent or can initiate the conference call between all parties.
Command: CosultCall
JMS-Type
ConsultCall#<agent_login_Id>
JMS-Body
<Other_Party_Extension_Number>,<ConnectionId>
<agent_login_Id>
Login id of the agent.
<Connection_ID>
Id of the call connection, to whom we have to transfer
This command allows a user to transfer the customer call to the consulted agent. This will drop the consult call between agents and transfer the customer call to the other agent.
Command: TransferCall
JMS-Type
TransferCall#<agent_login_Id>
JMS-Body
<Connection_ID>
<agent_login_Id>
Login id of the agent.
<Connection_ID>
ID of new inbound call (Main Call Dialog Id)
<Agent_Extension>
Extension of the agent. (Extension of the 2nd agent)
System#IN_SERVICE is the event that a client connected to CC receives frequently. Normally it is the response of Hello or Beat commands. It indicates that the GC is connected to CUCM and can perform actions in response to the command.
Default Format
Event: System#IN_SERVICE
JMS-Type
NULL
JMS-Body
System#IN_SERVICE
Event Category
System
JSON Format
Attribute
Value
Description
JSON Payload
type
System
Name of the event type
System
JS
{
"type": "System",
"status": "IN_SERVICE"
}
status
IN_SERVICE
OUT_OF_SERVICE
Status of the CUCM
System#OUT_OF_SERVICE
Normally it is the response of Hello or Beat commands. It indicates that the GC is not connected to CUCM and is unable to perform an action in response to the commands. After sending this event, GC will stop receiving further commands from clients. The client should send Hello until it didn’t receive System#IN_SERVICE.
Default Format
Event: System#OUT_OF_SERVICE
JMS-Type
NULL
JMS-Body
System#OUT_OF_SERVICE
Event Category
System
JSON Format
Attribute
Value
Description
JSON Payload
type
System
Name of the event type
System
JS
{
"type": "System",
"status": "OUT_OF_SERVICE"
}
status
IN_SERVICE
OUT_OF_SERVICE
Status of the CUCM
Note: Above events can also be received in case of CUCM is down or up!
System#IN_SERVICE is the event that a client connected to CC receives frequently. Normally it is the response of Hello or Beat commands. It indicates that the GC is connected to CUCM and can perform actions in response to the command.
All the possible errors are listed below with the suggested action on the client side. You can display friendly messages against these messages on the client end. Error origin is mentioned with each error that helps the developer to debug the issue.
MISSING_EXTENSION
Extension is missing in request.
Default Format
Error: MISSING_EXTENSION
JMS-Type
NULL
JMS-Body
<Error_For>#Error#MISSING_EXTENSION
<Error_For>
Possible values are:
<Agent_Extension>
Error Origin
CUCM Connector
Error Summary
The extension is missing in the request.
Expected Client’s Behaviour
Display the error message and ask the user to enter valid Extension. Send the request again.
An InvalidPartyException indicates that a party given as an argument to the method call was invalid. This may either be the originating party of a telephone call or the destination party of a telephone call.
{
"type": "Error",
"agentId": "42021",
"errorType": "INVALID_PARTY",
"message": "party given as an argument to the method call was invalid"
}
message
INVALID_PARTY
Error Message
PRIVILLEGE_VIOLATION
A PrivilegeViolationException indicates that an action pertaining to a certain object failed because the application did not have the proper security permissions to execute that command.
{
"type": "Error",
"agentId": "42021",
"errorType": "PREVILLEGE_VIOLATION",
"message": "a certain object failed because the application did not have the proper security permissions to execute that command"
}
message
PREVILLEGE_VIOLATION
Error Message
LICENSES_EXCEEDED
A LICENSES_EXCEEDED indicates that a client has crossed the max number of agents licensesed.