CMC library

From TBwiki
(Difference between revisions)
Jump to: navigation, search
(Adding example code)
 
(15 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The CMC library is a C message-driven API that removes the complexity of media resource management and eases the
+
CMC Library – CMC stands for Call & Media Control – is a C-based message-driven [[API]] that was designed to enable object-oriented, asynchronous event handling of call legs. It removes the complexity of media resource management while easing the bridging of call legs that employ different protocols ([[SS7]], [[ISDN]], [[CAS]], [[SIP]], etc.). Through the use of a [[Signaling protocols|signaling]]-agnostic message API, CMC Library simplifies the requirement for the customer’s application to control signaling along with the associated media.
bridging of call legs of different protocols. Through the use of signaling-agnostic message API, this creates a simpler
+
customer’s application to control signaling along with the associated media. Although it is still possible to ’tweak’
+
parameters (i.e. information elements, SDPs, etc), it is optional to do so. Therefore, applications requiring special
+
control over the signaling will still be able to do their things as long as it is not state affecting. A typical example
+
is for an application to send proprietary information into a SS7 primitive using the user-to-user information elements
+
or fill a specific IE with network-specific information. This API also removes the responsibility of the customer’s
+
application of creating and managing resources (e.g. resources allocation for IVR functions, resources allocation
+
for Voip functions, Stream server access). The high-level functions provided allow the user to focus on value-added
+
features and services instead of creating adaptation layer software. (E.g. an API ’CMD_PLAY’ that automatically
+
allocated the IVR resources and control the stream server to play an audio or video file onto a call leg). Although the
+
protocols and resources handling are simplified, event driven handling of call legs is required. This users guide will
+
later show in details the different wrapper C++ classes available to create an easy to read code while retaining all the
+
versatility of a complex API.
+
  
Key features of the CMC library include:
+
CMC Library sits between [[Toolpack_Application:toolpack_engine|Toolpack Engine]] and the customer application. It provides the customer application with a message-based API to communicate with Toolpack Engine. CMC Library forwards requests from the customer application to Toolpack Engine and returns response/event messages from Toolpack Engine to the customer application and is responsible for thread management.
<ul>
+
<li>Automatic [[CMC Server]] detection
+
<li>Automatic resynchronization of already created call legs and associated media.
+
<li>Providing automatic High Availability (HA) resynchronization capabilities in case of application failure/restart
+
<li>Automatic load sharing among running instances of CMC Server
+
  
<li>
+
CMC Library is an asynchronous framework used by the [[Customer Application Framework]] (CAF) and is not normally accessed by developers who would usually interact with the [[CAF Call API|CAFClass library]]. The CAFClass library provides C++ wrapper classes that ease the handling of call leg state machines and remove the burden of creating an asynchronous framework while allowing synchronous operations within a call flow (e.g., access to a database) to work without affecting other legs. However, if an existing application already has its own asynchronous framework for handling call states, the software developer might choose to use CMC Library API directly.
<ul>Thread pooling and call context serialization
+
<li>Allowing a more efficient use of CPU resources (thread, semaphores, etc).
+
<li>Synchronous operations on one call leg without affecting other legs.
+
</ul>
+
</ul>
+
  
 +
Although it is still possible to ‘tweak’ parameters (i.e., information elements, SDPs, etc.) with CMC Library, doing so is optional. Therefore, applications requiring special control over signaling will still be able to do their things as long as they do not affect the system state.
 +
A typical example is for an application to send proprietary information into a SS7 primitive using the user-to-user information elements (IE) or to fill a specific IE with network-specific information. The CMC Library API also removes the responsibility of the customer’s application for creating and managing resources (e.g., resource allocation for [[IVR]] functions, resource allocation for [[VoIP]] functions, [[Toolpack Application:tbstreamserver|TB StreamServer]] access). These high-level functions enable the user to focus on value-added features and services instead of creating adaptation layer software. (e.g., an API ’CMD_PLAY’ that automatically allocated the IVR resources and tells the stream server to play an audio or video file onto a call leg). Although the protocols and resources handling are simplified, event driven handling of call legs is still required.
  
'''HA applications'''
 
  
<li>
+
== Initialization ==
<li>Application can register as a backup application
+
This module should be initialized through the ''GlobalSetParams'' function.
<li>Automatic takeover of the service in the event an application goes down
+
Parameters for this module are contained in class ''CTBCMCLibParams''.
</ul>
+
Please refer to documentation in the C++ header files for class ''CTBCMCLibParams'' to know more about available parameters.
 +
 
 +
== Key features ==
 +
Key features of CMC Library include:
 +
*Automatic CMC Server detection
 +
*Automatic resynchronization of already created call legs and associated media.
 +
*Providing automatic High Availability (HA) resynchronization capabilities in case of application failure/restart
 +
*Automatic load sharing among running instances of CMC Server
 +
*Thread pooling and call context serialization
 +
*Enables more efficient use of CPU resources (thread, semaphores, etc).
 +
*Synchronous operations on one call leg without affecting other legs.
 +
 
 +
 
 +
== High availability applications ==
 +
CMC Library supports the high availability capabilities of Toolpack. This includes:
 +
*Application can register as a backup application  
 +
*Automatic takeover of the service in the event an application goes down  
 +
 
 +
 
 +
== Message types ==
 +
CMC Library handles both request messages and event messages sent by the application to Toolpack engine through the CMC library.
 +
*'''Request messages'''
 +
**Make call
 +
**Alert/Accept/Answer call
 +
**Join / unjoin legs
 +
**Play Stream, Record Stream, Stop Stream
 +
**Start/stop digit collection
 +
**Play digits
 +
 
 +
*'''Event messages'''
 +
**Incoming call present
 +
**Leg resync
 +
**Call terminating indication
 +
**Call alerting/accepted/answered
 +
**Stream play done, record stream done
 +
**Digit collected
 +
**Error report
 +
 
 +
== Example usage ==
 +
Documentation on how to use CMC Library can be found here:
 +
 
 +
[[CAF:_Working_With_Caf_Call_Legs]]
 +
 
 +
and here
 +
 
 +
[[CAF:_Leg_Creation_Samples]]
 +
 
 +
Below is an example that show how to initialize and terminate the ''CTBCMCLib'' module:
 +
 
 +
class MyApplication : public CTBCMCLibUser
 +
{
 +
// your class definition
 +
 +
// Functions inherited from CTBCMCLibUser
 +
  TBX_VOID OnCallLegPresent( TBCMC_LEG_ID in_LegId, CTBCMC_CALL_LEG_ATTRIBUTE_COMMON & in_CallLegAttribute, CTBCMC_PROTOCOL_ATTRIBUTE & in_ProtocolAttribute );
 +
// ... and many more...
 +
};
 +
 +
TBX_RESULT MyApplication::Init()
 +
{
 +
TBX_RESULT Result = TBX_RESULT_OK;
 +
CTBCAFGlobalsParams CafGlobalParams;
 +
CTBCMCLibParams CmcLibParams;
 +
 +
CafGlobalParams.mpCmcLibParams = &CmcLibParams;
 +
// CafGlobalParams.mpLogParams = [your paramters...]
 +
// CafGlobalParams.mpCliParams = [your paramters...]
 +
// etc...
 +
 +
Result = TBCAF::GlobalSetParam( &CafGlobalParams );
 +
 +
if( TBX_RESULT_SUCCESS( Result ) )
 +
{
 +
// Attach this class to CMC library as receiver for callbacks such as OnCallLegPresent()
 +
Result = CTBCMCLib::Attach( this );
 +
}
 +
 +
return Result;
 +
}
 +
 +
TBX_RESULT MyApplication::UnInit()
 +
{
 +
TBX_RESULT Result = TBX_RESULT_OK;
 +
CTBCAFGlobalsParams EmptyGlobalParams;
 +
 +
// Terminate all CAF modules
 +
Result = TBCAF::GlobalSetParam( &EmptyGlobalParams );
 +
 +
return Result;
 +
}
 +
 +
 +
TBX_VOID MyApplication::OnCallLegPresent
 +
(
 +
  IN TBCMC_LEG_ID in_LegId,
 +
  IN CTBCMC_CALL_LEG_ATTRIBUTE_COMMON & in_CallLegAttribute,
 +
  IN CTBCMC_PROTOCOL_ATTRIBUTE & in_ProtocolAttribute
 +
)
 +
{
 +
// Handle new incoming call...
 +
}

Latest revision as of 10:21, 30 May 2011

CMC Library – CMC stands for Call & Media Control – is a C-based message-driven API that was designed to enable object-oriented, asynchronous event handling of call legs. It removes the complexity of media resource management while easing the bridging of call legs that employ different protocols (SS7, ISDN, CAS, SIP, etc.). Through the use of a signaling-agnostic message API, CMC Library simplifies the requirement for the customer’s application to control signaling along with the associated media.

CMC Library sits between Toolpack Engine and the customer application. It provides the customer application with a message-based API to communicate with Toolpack Engine. CMC Library forwards requests from the customer application to Toolpack Engine and returns response/event messages from Toolpack Engine to the customer application and is responsible for thread management.

CMC Library is an asynchronous framework used by the Customer Application Framework (CAF) and is not normally accessed by developers who would usually interact with the CAFClass library. The CAFClass library provides C++ wrapper classes that ease the handling of call leg state machines and remove the burden of creating an asynchronous framework while allowing synchronous operations within a call flow (e.g., access to a database) to work without affecting other legs. However, if an existing application already has its own asynchronous framework for handling call states, the software developer might choose to use CMC Library API directly.

Although it is still possible to ‘tweak’ parameters (i.e., information elements, SDPs, etc.) with CMC Library, doing so is optional. Therefore, applications requiring special control over signaling will still be able to do their things as long as they do not affect the system state. A typical example is for an application to send proprietary information into a SS7 primitive using the user-to-user information elements (IE) or to fill a specific IE with network-specific information. The CMC Library API also removes the responsibility of the customer’s application for creating and managing resources (e.g., resource allocation for IVR functions, resource allocation for VoIP functions, TB StreamServer access). These high-level functions enable the user to focus on value-added features and services instead of creating adaptation layer software. (e.g., an API ’CMD_PLAY’ that automatically allocated the IVR resources and tells the stream server to play an audio or video file onto a call leg). Although the protocols and resources handling are simplified, event driven handling of call legs is still required.


Contents

Initialization

This module should be initialized through the GlobalSetParams function. Parameters for this module are contained in class CTBCMCLibParams. Please refer to documentation in the C++ header files for class CTBCMCLibParams to know more about available parameters.

Key features

Key features of CMC Library include:

  • Automatic CMC Server detection
  • Automatic resynchronization of already created call legs and associated media.
  • Providing automatic High Availability (HA) resynchronization capabilities in case of application failure/restart
  • Automatic load sharing among running instances of CMC Server
  • Thread pooling and call context serialization
  • Enables more efficient use of CPU resources (thread, semaphores, etc).
  • Synchronous operations on one call leg without affecting other legs.


High availability applications

CMC Library supports the high availability capabilities of Toolpack. This includes:

  • Application can register as a backup application
  • Automatic takeover of the service in the event an application goes down


Message types

CMC Library handles both request messages and event messages sent by the application to Toolpack engine through the CMC library.

  • Request messages
    • Make call
    • Alert/Accept/Answer call
    • Join / unjoin legs
    • Play Stream, Record Stream, Stop Stream
    • Start/stop digit collection
    • Play digits
  • Event messages
    • Incoming call present
    • Leg resync
    • Call terminating indication
    • Call alerting/accepted/answered
    • Stream play done, record stream done
    • Digit collected
    • Error report

Example usage

Documentation on how to use CMC Library can be found here:

CAF:_Working_With_Caf_Call_Legs

and here

CAF:_Leg_Creation_Samples

Below is an example that show how to initialize and terminate the CTBCMCLib module:

class MyApplication : public CTBCMCLibUser
{
	// your class definition

	// Functions inherited from CTBCMCLibUser
 	TBX_VOID OnCallLegPresent( TBCMC_LEG_ID in_LegId, CTBCMC_CALL_LEG_ATTRIBUTE_COMMON & in_CallLegAttribute, CTBCMC_PROTOCOL_ATTRIBUTE & in_ProtocolAttribute );
	// ... and many more...
};

TBX_RESULT MyApplication::Init()
{
	TBX_RESULT			Result = TBX_RESULT_OK;
	CTBCAFGlobalsParams	CafGlobalParams;
	CTBCMCLibParams		CmcLibParams;

	CafGlobalParams.mpCmcLibParams		= &CmcLibParams;
	// CafGlobalParams.mpLogParams		= [your paramters...]
	// CafGlobalParams.mpCliParams		= [your paramters...]
	// etc...

	Result = TBCAF::GlobalSetParam( &CafGlobalParams );

	if( TBX_RESULT_SUCCESS( Result ) )
	{
		// Attach this class to CMC library as receiver for callbacks such as OnCallLegPresent()
		Result = CTBCMCLib::Attach( this );
	}

	return Result;
}

TBX_RESULT MyApplication::UnInit()
{
	TBX_RESULT			Result = TBX_RESULT_OK;
	CTBCAFGlobalsParams	EmptyGlobalParams;

	// Terminate all CAF modules
	Result = TBCAF::GlobalSetParam( &EmptyGlobalParams );

	return Result;
}


TBX_VOID MyApplication::OnCallLegPresent
(
  IN	TBCMC_LEG_ID						in_LegId, 
  IN	CTBCMC_CALL_LEG_ATTRIBUTE_COMMON &	in_CallLegAttribute, 
  IN	CTBCMC_PROTOCOL_ATTRIBUTE &			in_ProtocolAttribute
)
{
	// Handle new incoming call...
}
Personal tools