VAPI API Reference Documentation
2.18.x

Announcement related API functions

Functions

VSTATUS VAPI_StartRecord (IN CONNID ConnId, IN SRecData *pstRecData, IN SRequest *pstRequest)
VSTATUS VAPI_StartRecording (IN CONNID ConnId, IN EMediaHostType eMediaHost, IN ECodingScheme eCodingScheme, IN EAnnounceType eSourceType, IN U32 uiTimeOut, IN U8 *pucBuffer, IN U32 uiBufferLength, IN PFNIoCompCallback pfnFrameHndlr, IN SRequest *pstRequest)
VSTATUS VAPI_StartRecordFile (IN CONNID ConnId, IN SRecData *pstRecData, IN SRequest *pstRequest)
VSTATUS VAPI_StopRecord (IN CONNID ConnId, IN EStopAnnType eStopAnnType, IN SRequest *pstRequest)
VSTATUS VAPI_StopRecording (IN CONNID ConnId, IN SRequest *pstRequest)
VSTATUS VAPI_StartPlayback (IN CONNID ConnId, IN SPlayData *pstPlayData, IN SRequest *pstRequest)
VSTATUS VAPI_StartPlaying (IN CONNID ConnId, IN EMediaHostType eMediaHost, IN ECodingScheme eCodingScheme, IN EAnnounceType eDestinationType, IN U32 uiTimeOut, IN U8 *pucBuffer, IN U32 uiBufferLength, IN SRequest *pstRequest)
VSTATUS VAPI_StartPlaybackFile (IN CONNID ConnId, IN SPlayData *pstPlayData, IN SRequest *pstRequest)
VSTATUS VAPI_StopPlayback (IN CONNID ConnId, IN EStopAnnType eStopAnnType, IN SRequest *pstRequest)
VSTATUS VAPI_StopPlaying (IN CONNID ConnId, IN SRequest *pstRequest)
VSTATUS VAPI_PlaybackSetRate (IN CONNID ConnId, EPlaybackRate ePlaybackRate, IN SRequest *pstRequest)
VSTATUS VAPI_ConvertHostSpeechData (IN CONNID ConnId, IN SConvertData *pstConvertData, IN SRequest *pstRequest)

Function Documentation

VSTATUS VAPI_ConvertHostSpeechData ( IN CONNID  ConnId,
IN SConvertData pstConvertData,
IN SRequest pstRequest 
)


Description:
This API will convert the Host speech frames in the buffer to ucNewCoding scheme.

Note: not tested yet.


Inputs-Outputs
ConnId Connection on which the speech frames have to be converted.
pstConvertData Pointer to struct with host speech data to be processed.
pstRequest If NULL then the call is in blocking mode (synchronous).


Returns:

  • SUCCESS or VAPI_ERR_PENDING
  • VAPI_ERR_LIB_NOT_INITIALIZED
  • VAPI_ERR_INVALID_CONNID
  • VAPI_ERR_DEV_IS_NOT_UP
  • VAPI_ERR_DEVICE_NOT_INITIALIZED
  • VAPI_ERR_NOMEM
  • VAPI_ERR_INVALID_PARAM


Commands:

  • SET_CHANNEL_MODE
  • SYNCDAT
  • SYNCEOF
  • SET_FLOWCON


Usage:

...
        /* allocate a buffer to hold the samples */
        U8 out_buffer[1024 * 512];
        
        SConvertData stConvertData;

        stConvertData.pucSrcBuffer = src_buffer;
        stConvertData.uiSrcBufferLength = sizeof (src_buffer);
        stConvertData.ucCurrentCoding = eCS_G711_ULAW;
        stConvertData.pucOutBuffer = out_buffer;
        stConvertData.uiOutBufferLength = sizeof (out_buffer)
        stConvertData.ucNewCoding = eCS_G729_A;

        Status = VAPI_ConvertHostSpeechData (my_connection_id, &stConvertData, NULL);                                                   

        if (Status != SUCCESS) 
                return Status;
...
VSTATUS VAPI_PlaybackSetRate ( IN CONNID  ConnId,
EPlaybackRate  ePlaybackRate,
IN SRequest pstRequest 
)


Description:
VAPI_PlaybackSetRate() makes the playback speed faster or slower.
For example, a message that takes 20 seconds, can be played in 10 seconds if the API is called with ePlaybackRate_2_1.


Inputs-Outputs
ConnId The identifier of connection that is to be destroyedr
ePlaybackRate Enumeration of supported fast-slow rates
pstRequest If NULL then the call is in blocking mode (synchronous).


Returns:

  • SUCCESS or VAPI_ERR_PENDING
  • VAPI_ERR_LIB_NOT_INITIALIZED
  • VAPI_ERR_DEVICE_NOT_INITIALIZED
  • VAPI_ERR_INVALID_CONNID
  • VAPI_ERR_DEV_IS_NOT_UP
  • VAPI_ERR_NOMEM


Usage:

...
        /* fast playback with rate 2:1*/
        
        Status = VAPI_PlaybackSetRate(my_connection_id, ePlaybackRate_2_1, NULL); 
        
        if (Status != SUCCESS) 
                return Status;
...
VSTATUS VAPI_StartPlayback ( IN CONNID  ConnId,
IN SPlayData pstPlayData,
IN SRequest pstRequest 
)


Description:
This API will start the playback from the buffer/file on the channel till the complete buffer/file is exhausted or timeout occurs.
The buffer/file should have data in Host Speech Frame format as given in CRM Section "Formatting of Recorded Speech Data".
VAPI_StopPlaying() / VAPI_StopPlayback() API can be called at any time to stop the ongoing playout.


Inputs-Outputs
ConnId Connection on which to start the playing.
pstPlayData Pointer to play data .
pstRequest If NULL then the call is in blocking mode (synchronous).


Returns:

  • SUCCESS or VAPI_ERR_PENDING
  • VAPI_ERR_LIB_NOT_INITIALIZED
  • VAPI_ERR_INVALID_CONNID
  • VAPI_ERR_DEV_IS_NOT_UP
  • VAPI_ERR_DEVICE_NOT_INITIALIZED
  • VAPI_ERR_NOMEM
  • VAPI_ERR_INVALID_PARAM


Usage:

...

        /* a my_buffer holds the samples */
        /* Blocking call example to playback voice in G.711u-law from Host Speech Frame format
        for 10 seconds max to PCM */ 
        
        SPlayData stPlayData;

        stPlayData.eMediaHost = eCSMENCAPS;
        stPlayData.eCodingScheme = eCS_G711_ULAW;
        stPlayData.eDestinationType = ePCM;
        stPlayData.ePlaybackMode = ePlaybackExt;
        stPlayData.uiTimeOut = 10; /* play 10 sec max*/
        stPlayData.pucBuffer = &my_buffer;
        stPlayData.uiBufferLength = sizeof(my_buffer);
        stPlayData.uiHostSpeechDataFormat = eHedFormat;

        Status = VAPI_StartPlayback(my_connection_id, &stPlayData, NULL); 
        
        if (Status != SUCCESS) 
                return Status;
...


Commands:

  • SET_CHANNEL_MODE
  • SYNCDAT
  • SYNCEOF
  • VOIP_AS_SET_RATE
  • AS_STOP
  • DRAIN_PLAYREC_BUFFER
VSTATUS VAPI_StartPlaybackFile ( IN CONNID  ConnId,
IN SPlayData pstPlayData,
IN SRequest pstRequest 
)


Description:
This API will start the playback from the file on the channel till the complete file is exhausted or timeout occurs.
The file should have data in Host Speech Frame format as given in CRM Section "Formatting of Recorded Speech Data".
VAPI_StopPlaying() / VAPI_StopPlayback() API can be called at any time to stop the ongoing playout.


Inputs-Outputs
ConnId Connection on which to start the playing.
pstPlayData Pointer to play data .
pstRequest If NULL then the call is in blocking mode (synchronous).


Returns:

  • SUCCESS or VAPI_ERR_PENDING
  • VAPI_ERR_LIB_NOT_INITIALIZED
  • VAPI_ERR_INVALID_CONNID
  • VAPI_ERR_DEV_IS_NOT_UP
  • VAPI_ERR_DEVICE_NOT_INITIALIZED
  • VAPI_ERR_NOMEM
  • VAPI_ERR_INVALID_PARAM


Usage:

...

        /* a media_file_7.rec holds the samples */
        /* Blocking call example to playback voice in G.711u-law from Host Speech Frame format
        for 10 seconds max to PCM */ 
        SPlayData stPlayData;

        stPlayData.eMediaHost = eCSMENCAPS;
        stPlayData.eCodingScheme = eCS_G711_ULAW;
        stPlayData.eDestinationType = ePCM;
        stPlayData.ePlaybackMode = ePlaybackExt;
        stPlayData.uiTimeOut = 10; /* play 10 sec max*/
        UT_StrCpy(stPlayData.strAnnFileName,"media_file_7.rec");
        stPlayData.uiHostSpeechDataFormat = eHedFormat;

        Status = VAPI_StartPlaybackFile (my_connection_id, &stPlayData, NULL); 

        if (Status != SUCCESS) 
                return Status;
...


Commands:

  • SET_FLOWCON
  • SET_CHANNEL_MODE
  • SYNCDAT
  • SYNCEOF
  • VOIP_AS_SET_RATE
  • AS_STOP
  • DRAIN_PLAYREC_BUFFER
VSTATUS VAPI_StartPlaying ( IN CONNID  ConnId,
IN EMediaHostType  eMediaHost,
IN ECodingScheme  eCodingScheme,
IN EAnnounceType  eDestinationType,
IN U32  uiTimeOut,
IN U8 pucBuffer,
IN U32  uiBufferLength,
IN SRequest pstRequest 
)


Description:
This one is now obsolete and replaced by VAPI_StartPlayback(). It is kept in this version for backward compatibility but may be removed in the next releases.

This API will start the playback from the buffer on the channel till the complete buffer is exhausted or timeout occurs.
The buffer should have data in Host Speech Frame format as given in CRM Section "Formatting of Recorded Speech Data".
VAPI_StopPlaying() / VAPI_StopPlayback() API can be called at any time to stop the ongoing playout.


Inputs-Outputs
ConnId Connection on which to start the playing.
eMediaHost Supported values:
  • 0 for PCI
  • 1 for CSM_ENCAPS Not being used in current implementation.
eCodingScheme Source coding schemes for Host Speech Frame for playing e.g. G.711u-law PCM audio, G.723 audio etc.
eDestinationType Destination can be one of the following:
  • 8-bit PCM
  • RTP
  • Both.
uiTimeOut Specifies the time (in Sec) for which playback needs to be done.
If its value is 0 ignore this parameter.
pucBuffer Pointer to the Buffer from which play out is done.
uiBufferLength Length of the Buffer passed to the API.
pstRequest If NULL then the call is in blocking mode (synchronous).


Returns:

  • SUCCESS or VAPI_ERR_PENDING
  • VAPI_ERR_LIB_NOT_INITIALIZED
  • VAPI_ERR_INVALID_CONNID
  • VAPI_ERR_DEV_IS_NOT_UP
  • VAPI_ERR_DEVICE_NOT_INITIALIZED
  • VAPI_ERR_NOMEM
  • VAPI_ERR_INVALID_PARAM


Usage:

...

        /* a my_buffer holds the samples */
        /* Blocking call example to playback voice in G.711u-law from Host Speech Frame format
        for 10 seconds max to PCM */ 
        Status = VAPI_StartPlaying (my_connection_id, eCSMENCAPS, eCS_G711_ULAW, ePCM,
                                        10,             /* play 10 sec max*/
                                        &my_buffer, sizeof(my_buffer),NULL); 

        if (Status != SUCCESS) 
                return Status;
...


Commands:

  • SET_CHANNEL_MODE
  • SYNCDAT
  • SYNCEOF
  • VOIP_AS_SET_RATE
  • AS_STOP
  • DRAIN_PLAYREC_BUFFER
VSTATUS VAPI_StartRecord ( IN CONNID  ConnId,
IN SRecData pstRecData,
IN SRequest pstRequest 
)

Description:
This API is used handle host speech frames coming on the channel
for recording the input frames in host speech frame format as given in CRM Section "Formatting of Recorded Speech Data".
If application passes a non-NULL pfnFrameHndlr then VAPI will call the pfnFrameHndlr
as soon as it retrieves a complete frame from SYNCDAT/SYNEOF indications.
If application provides a pointer to a buffer and pfnFrameHndlr is NULL then VAPI will write the frames
it will receive into the buffer till the buffer is full or timeout occurs.
VAPI_StopRecording() API can be called any time to stop recording.


Inputs-Outputs
ConnId Connection on which to start the recording.
pstRecData Pointer to rec data.
pstRequest If NULL then the call is in blocking mode (synchronous).


Returns:

  • SUCCESS or VAPI_ERR_PENDING
  • VAPI_ERR_LIB_NOT_INITIALIZED
  • VAPI_ERR_INVALID_CONNID
  • VAPI_ERR_DEV_IS_NOT_UP
  • VAPI_ERR_DEVICE_NOT_INITIALIZED
  • VAPI_ERR_NOMEM


Usage:

...

        /* allocate a buffer to hold the samples */
        U8 my_buffer[1024 * 512];
        /* Blocking call example to record voice from G.711u-law to Host Speech Frame format to PCM
        until the my_buffer is not full (or recording stopped by 
        VAPI_StopRecording() / VAPI_StopRecord() */ 
        
        SRecData stRecData;
        
        stRecData.eMediaHost = eCSMENCAPS;
        stRecData.eCodingScheme = eCS_G711_ULAW;
        stRecData.eSourceType = ePCM;
        stRecData.uiTimeOut = 10;
        stRecData.pucBuffer = &my_buffer;
        stRecData.uiBufferLength = sizeof(my_buffer);   
        stRecData.pfnFrameHndlr = NULL;
        stRecData.uiHostSpeechDataFormat = eHedFormat;

        Status = VAPI_StartRecord (my_connection_id, &stRecData, NULL);                                                 

        if (Status != SUCCESS) 
                return Status;
...


Commands:

  • SET_FLOWCON
  • SET_CHANNEL_MODE
  • SYNCDAT
  • SYNCEOF
  • AS_STOP
  • DRAIN_PLAYREC_BUFFER
VSTATUS VAPI_StartRecordFile ( IN CONNID  ConnId,
IN SRecData pstRecData,
IN SRequest pstRequest 
)

Description:
This API is used handle host speech frames coming on the channel
for recording the input frames in host speech frame format as given in CRM Section "Formatting of Recorded Speech Data".
If application passes a non-NULL pfnFrameHndlr then VAPI will call the pfnFrameHndlr
as soon as it retrieves a complete frame from SYNCDAT/SYNEOF indications.
If pfnFrameHndlr is NULL then VAPI will write the frames
it will receive into the file till timeout occurs.
VAPI_StopRecording() / VAPI_StopRecord() APIs can be called any time to stop recording.


Inputs-Outputs
ConnId Connection on which to start the recording.
pstRecData Pointer to rec data.
pstRequest If NULL then the call is in blocking mode (synchronous).


Returns:

  • SUCCESS or VAPI_ERR_PENDING
  • VAPI_ERR_LIB_NOT_INITIALIZED
  • VAPI_ERR_INVALID_CONNID
  • VAPI_ERR_DEV_IS_NOT_UP
  • VAPI_ERR_DEVICE_NOT_INITIALIZED
  • VAPI_ERR_NOMEM


Usage:

...

        /* Blocking call example to record voice from G.711u-law to Host Speech Frame format to PCM
        until recording stopped by VAPI_StopRecording() / VAPI_StopRecord() */ 

        SRecData stRecData;

        stRecData.eMediaHost = eCSMENCAPS;
        stRecData.eCodingScheme = eCS_G711_ULAW;
        stRecData.eSourceType = ePCM;
        stRecData.uiTimeOut = 10;
        UT_StrCpy(stRecData.strAnnFileName,"media_file_7.rec");
        stRecData.pfnFrameHndlr = NULL;
        stRecData.uiHostSpeechDataFormat = eHedFormat;

        Status = VAPI_StartRecordFile (my_connection_id, &stRecData, NULL);

        if (Status != SUCCESS) 
                return Status;
...


Commands:

  • SET_FLOWCON
  • SET_CHANNEL_MODE
  • SYNCDAT
  • SYNCEOF
  • AS_STOP
  • DRAIN_PLAYREC_BUFFER
VSTATUS VAPI_StartRecording ( IN CONNID  ConnId,
IN EMediaHostType  eMediaHost,
IN ECodingScheme  eCodingScheme,
IN EAnnounceType  eSourceType,
IN U32  uiTimeOut,
IN U8 pucBuffer,
IN U32  uiBufferLength,
IN PFNIoCompCallback  pfnFrameHndlr,
IN SRequest pstRequest 
)

Description:
This one is now obsolete and replaced by VAPI_StartRecord(). It is kept in this version for backward compatibility but may be removed in the next releases.

This API is used handle host speech frames coming on the channel
for recording the input frames in host speech frame format as given in CRM Section "Formatting of Recorded Speech Data".
If application passes a non-NULL pfnFrameHndlr then VAPI will call the pfnFrameHndlr
as soon as it retrieves a complete frame from SYNCDAT/SYNEOF indications.
If application provides a pointer to a buffer and pfnFrameHndlr is NULL then VAPI will write the frames
it will receive into the buffer till the buffer is full or timeout occurs.
VAPI_StopRecording() API can be called any time to stop recording.


Inputs-Outputs
ConnId Connection on which to start the recording.
eMediaHost Supported values:
  • 0 for PCI
  • 1 for CSM_ENCAPS Not being used in current implementation.
eCodingScheme Destination coding scheme for Host Speech.
eSourceType Source can be one of the following:
  • 8-bit PCM
  • RTP
  • Both.
uiTimeOut Specifies the time (in Sec) for which recording needs to be done.
If its value is 0 ignore this parameter.
pucBuffer Pointer to the Buffer in which recorded data needs to be stored.
uiBufferLength Length of the Buffer passed to the API.
pfnFrameHndlr If not NULL, pfnFrameHndlr is called for each complete frame received from SYNCDAT/SYNEOF.
pstRequest If NULL then the call is in blocking mode (synchronous).


Returns:

  • SUCCESS or VAPI_ERR_PENDING
  • VAPI_ERR_LIB_NOT_INITIALIZED
  • VAPI_ERR_INVALID_CONNID
  • VAPI_ERR_DEV_IS_NOT_UP
  • VAPI_ERR_DEVICE_NOT_INITIALIZED
  • VAPI_ERR_NOMEM


Usage:

...

        /* allocate a buffer to hold the samples */
        U8 my_buffer[1024 * 512];
        /* Blocking call example to record voice from G.711u-law to Host Speech Frame format to PCM
        until the my_buffer is not full (or recording stopped by VAPI_StopRecording() */ 

        Status = VAPI_StartRecording (my_connection_id, eCSMENCAPS, eCS_G711_ULAW, ePCM,
                                        0, &my_buffer, sizeof(my_buffer), NULL, NULL);
        if (Status != SUCCESS) 
                return Status;
...


Commands:

  • SET_FLOWCON
  • SET_CHANNEL_MODE
  • SYNCDAT
  • SYNCEOF
  • AS_STOP
  • DRAIN_PLAYREC_BUFFER
VSTATUS VAPI_StopPlayback ( IN CONNID  ConnId,
IN EStopAnnType  eStopAnnType,
IN SRequest pstRequest 
)


Description:
This API will start any ongoing playback on this channel.


Inputs-Outputs
ConnId Connection on which the playback has to be stopped.
eStopAnnType Stop type of announcement API.
pstRequest If NULL then the call is in blocking mode (synchronous).


Returns:

  • SUCCESS or VAPI_ERR_PENDING
  • VAPI_ERR_LIB_NOT_INITIALIZED
  • VAPI_ERR_INVALID_CONNID
  • VAPI_ERR_DEV_IS_NOT_UP
  • VAPI_ERR_DEVICE_NOT_INITIALIZED
  • VAPI_ERR_NOMEM


Usage:

...

        Status = VAPI_StopPlayback (my_connection_id,  eAS_STOP, NULL);
        
        if (Status != SUCCESS) 
                return Status;
...

VSTATUS VAPI_StopPlaying ( IN CONNID  ConnId,
IN SRequest pstRequest 
)


Description:
This one is now obsolete and replaced by VAPI_StopPlayback(). It is kept in this version for backward compatibility but may be removed in the next releases.

This API will start any ongoing playback on this channel.


Inputs-Outputs
ConnId Connection on which the playback has to be stopped.
pstRequest If NULL then the call is in blocking mode (synchronous).


Returns:

  • SUCCESS or VAPI_ERR_PENDING
  • VAPI_ERR_LIB_NOT_INITIALIZED
  • VAPI_ERR_INVALID_CONNID
  • VAPI_ERR_DEV_IS_NOT_UP
  • VAPI_ERR_DEVICE_NOT_INITIALIZED
  • VAPI_ERR_NOMEM


Usage:

...

        Status = VAPI_StopPlaying (my_connection_id,  NULL);

        if (Status != SUCCESS) 
                return Status;
...

VSTATUS VAPI_StopRecord ( IN CONNID  ConnId,
IN EStopAnnType  eStopAnnType,
IN SRequest pstRequest 
)


Description:
This API will stop any ongoing recording on this channel.


Inputs-Outputs
ConnId Connection on which the recording has to be stopped.
eStopAnnType Stop type of announcement API.
pstRequest If NULL then the call is in blocking mode (synchronous).


Returns:

  • SUCCESS or VAPI_ERR_PENDING
  • VAPI_ERR_LIB_NOT_INITIALIZED
  • VAPI_ERR_INVALID_CONNID
  • VAPI_ERR_DEV_IS_NOT_UP
  • VAPI_ERR_DEVICE_NOT_INITIALIZED
  • VAPI_ERR_NOMEM


Usage:

...

        Status = VAPI_StopRecord (my_connection_id, eAS_STOP, NULL);

        if (Status != SUCCESS) 
                return Status;
...

VSTATUS VAPI_StopRecording ( IN CONNID  ConnId,
IN SRequest pstRequest 
)


Description:
This one is now obsolete and replaced by VAPI_StopRecord(). It is kept in this version for backward compatibility but may be removed in the next releases.

This API will stop any ongoing recording on this channel.


Inputs-Outputs
ConnId Connection on which the recording has to be stopped.
pstRequest If NULL then the call is in blocking mode (synchronous).


Returns:

  • SUCCESS or VAPI_ERR_PENDING
  • VAPI_ERR_LIB_NOT_INITIALIZED
  • VAPI_ERR_INVALID_CONNID
  • VAPI_ERR_DEV_IS_NOT_UP
  • VAPI_ERR_DEVICE_NOT_INITIALIZED
  • VAPI_ERR_NOMEM


Usage:

...

        Status = VAPI_StopRecording (my_connection_id, NULL);

        if (Status != SUCCESS) 
                return Status;
...




Mindspeed Technologies ®
Mindspeed Proprietary and Confidential