# vceRecordMessage

Records a message in an open voice object.

#### Prototype

DWORD vceRecordMessage ( VCEHD vh, unsigned message, unsigned maxtime, VCE_RECORD_PARMS *parms)

Argument | Description
vh | Handle of an open voice object.
message | Message number to record.
maxtime | Maximum amount to record, in milliseconds. Specify VCE_NO_TIME_LIMIT to record with no time limit.
parms | Pointer to a parameter structure. Set this to NULL to use default values. The VCE_RECORD_PARMS structure is: typedef struct { DWORD size; DWORD DTMFabort; INT32 gain; DWORD novoicetime; DWORD silencetime; INT32 silenceampl; DWORD beepfreq; INT32 beepampl; DWORD beeptime; DWORD AGCenable; } VCE_RECORD_PARMS; Refer to VCE_RECORD_PARMS for a description of these fields.

#### Return values

Return value | Description
SUCCESS |
CTAERR_FUNCTION_ACTIVE | Playing or recording is already active on the context.
CTAERR_INVALID_HANDLE | vh is not a valid handle to an open voice object.
CTAERR_OUTPUT_ACTIVE | Another function is controlling the MVIP output timeslot of the context.
CTAERR_RESOURCE_CONFLICT | Energy detector is in use in the ADI Service.
CTAERR_SVR_COMM | Server communication error.
VCEERR_INVALID_MESSAGE | Message number is out of range for the object.
VCEERR_OUT_OF_INDICES | No free header entries in the destination VOX file.
VCEERR_PLAY_ONLY | Voice file was not opened for record.

#### Events

Event | Description
VCEEVN_RECORD_DONE | Recording completed. The value field of the event contains one of the following reasons or an error code: CTA_REASON_DIGIT Touch-tone digit was received and the corresponding bit in the DTMF abort parameter was set. CTA_REASON_FINISHED No more space is available or recording in overwrite mode reached the end of the existing message. CTA_REASON_NO_VOICE No voice detected for novoicetime milliseconds at the beginning of recording. CTA_REASON_RELEASED Stopped because the call was disconnected. CTA_REASON_STOPPED Stopped by vceStop or the current message was invalidated because one of the referenced voice objects was closed. CTA_REASON_TIMEOUT Time limit maxtime was reached. CTA_REASON_VOICE_END Silence detected for silencetime milliseconds after some voice detected. CTAERR_FUNCTION_NOT_AVAIL Recorded object has encoding that is not supported. CTAERR_RESOURCE_CONFLICT Energy detector is in use in the ADI service.

#### Details

vceRecordMessage starts recording to the specified message number in the voice object that vh specified. Any existing data in the message is erased. vceRecordMessage always returns immediately. If the return is SUCCESS, a VCEEVN_RECORD_DONE event occurs when recording completes.

After recording ends, call vceGetContextInfo to get the number of milliseconds actually recorded and look in the position field of the status.

The voice handle and message number become the current message for the context in which the voice handle was opened. After recording stops, you can resume recording at the end of the current message with vceRecord. Refer to Recording for more information.

To trim data at the end of the recording:

- Use vceSetPosition to back up the desired amount.

- Use vceErase to erase data to the end of the message.

When the ADI energy detector is active, initiate a record operation (which uses the ADI Service) by setting novoicetime and silencetime to zero.

Refer to VCE_RECORD_PARMS for more information about the record parameters.

#### See also

vceStop

#### Example

/* Record to an existing VOX file. */
extern CTAQUEUEHD CtaQueueHd;
void myRecordFile (CTAHD ctahd, char *filename, unsigned msgnum)
{
VCEHD vh;
CTA_EVENT event;
vceOpenFile (ctahd, filename, VCE_FILETYPE_VOX,
VCE_PLAY_RECORD, 0, &vh) ;
vceRecordMessage (vh, msgnum, VCE_NO_TIME_LIMIT, NULL) ;
do
{
ctaWaitEvent( CtaQueueHd, &event, CTA_WAIT_FOREVER);
} while (event.id != VCEEVN_RECORD_DONE);/* Ignore other events */
vceClose (vh);
}