InitializeMediaEngine

 

The InitializeMediaEngine function allows you to initialize the telephony engine API interface. You must call this function before attempting to use any of the other API procedures. Generally this API procedure is called when your application first initializes.

 

 

TELEPHONY_RETURN_VALUE InitializeMediaEngine(

void *pData,

DWORD ThreadStackSizeInBytes

);

 

 

 

Parameters:

 

pData

[in] While you are developing your VOIP application, this parameter can be NULL (zero). When you are ready to deploy your VOIP application to end user machines, this parameter must be a pointer to a NULL terminates ASCII string that contains your media engine redistribution code. For complete details regarding redistribution of the media engine, see the document entitled "Redistributing LanScape VOIP Media Engine.pdf" located in the "Redist" folder of your product install directory.

 

ThreadStackSizeInBytes

[in] This value controls the stack size of each internal thread the media engine creates. It can only be used to increase media engine thread stack sizes from the default thread stack size the application uses.

To allow default stack size capability per media engine thread, you should set this value to zero. Default thread stack size is usually 1 megabyte (1,048,576 bytes) for 32 bit Windows applications. If you are using a multi-instance media engine, all engine instances will use the thread stack size as set by this parameter. Under most deployment scenarios, this parameter should always be set to zero.


Note:

 

If you want to dramatically reduce the virtual memory requirements of your application and the memory requirements of the media engine, you should specify a default thread stack size smaller than 1 megabyte in your applications EXE header. Values as low as 4096 bytes can logically be specified. The low range value of 4096 bytes is enforced by the operating system.


WARNING:


At LanScape, we routinely lower the default threads stack size in media engine based applications in an effort to greatly lower the memory requirements of large line density VOIP applications. These large line applications are generally 128 lines or greater. If you change the default thread stack size when your application is being linked, you must make sure that your VOIP application will not run out of stack space or generate stack related protected mode violations or stack related faults.

The VOIP Media Engine does not rely heavily on thread stack size in order to operate. In other words, the VOIP Media Engine does not require large thread stack space. However there is a limit to how low you can push thread stacks without generating stack related program crashes.

For additional details regarding how your application can reduce the virtual memory requirements of the media engine, please see the section entitled "Minimizing virtual memory requirements" in this developer's reference.


 

 

Return Value:

 

If the function succeeds, the return value will be SipSuccess.

 

If the function fails, the return value will be one of the following values as specified by the TELEPHONY_RETURN_VALUE data type.

 

 

 

Value

Description

SipInitializeError

 

Indicates that an unknown error condition was detected while initializing the telephony engine. User application software can not continue if this error is detected. Make sure the host machine is configured properly and is adequate for the intended application. This error is indicative of process space corruption.

 

SipMediaEngineAlreadyInitialized

Before attempting any telephony operation, the LanScape VOIP Media Engine must be initialized using the InitializeMediaEngine API procedure. This error is generated when you call the InitializeMediaEngine API procedure more than once.

 

SipThreadCreationError

Indicates a critical thread creation error within the telephony engine. User application software should not continue if this error is detected. Make sure the host machine is configured properly and is adequate for the intended application. This error indicates the operating system can not create additional threads of execution. Close all other non essential applications.