Prosody generic: API: sm_channel_alloc_placed
Prototype Definition
int sm_channel_alloc_placed(struct sm_channel_alloc_placed_parms *channelp)
Parameters
- *channelp
-
a structure of the following type:
typedef struct sm_channel_alloc_placed_parms {
tSMChannelId channel; /* out */
enum kSMChannelType {
kSMChannelTypeInput,
kSMChannelTypeOutput,
kSMChannelTypeHalfDuplex,
kSMChannelTypeFullDuplex,
} type; /* in */
tSMModuleId module; /* in */
tSM_INT caps_mask; /* in */
} SM_CHANNEL_ALLOC_PLACED_PARMS;
Description
Allocates, on a specific module, a new channel to generate
output data and/or process input data. The
type
parameter determines which kind of channel is allocated
If the call completes successfully, the parameter
channel
will be set to the identifier for that channel.
The task of supporting this channel is assigned by the driver to
the module specified by the
module
parameter.
The
caps_mask
parameter is ignored.
Fields
- channel
- The allocated channel.
- type
- The type of channel to allocate.
One of these values:
- kSMChannelTypeInput
- An input channel, which can be used to record data, recognise
digits and tones etc.
- kSMChannelTypeOutput
- An output channel, which can be used to replay data, generate
tones, dial DTMF digits etc.
- kSMChannelTypeHalfDuplex
- A channel that may operate either in input mode or in output
mode (but not both simultaneously, except for DTMF
detection).
Resources required by a channel are allocated only as soon as they are
needed, so there is no advantage in using a half-duplex channel
over a full-duplex channel, and since it is typically more
complicated for an application to handle half-duplex channels
than full-duplex channels, it is recommended that full-duplex
channels always be used in preference to half-duplex channels.
- kSMChannelTypeFullDuplex
- A channel that may operate both in input mode and in output mode
(simultaneous input and output possible).
- module
- A value obtained from
sm_open_module()
which indicates the module where the channel is to be allocated.
- caps_mask
- Bitmask of required capabilities, or zero to indicate that the
default capabilities are required.
This field is ignored.
Returns
0
if call completed successfully, otherwise a standard error such as:
- ERR_SM_DEVERR - device error
- ERR_SM_NO_RESOURCES - if no suitable output channel free
- ERR_SM_NO_SUCH_MODULE - if invalid module identifier specified
This function is part of the Prosody generic API.