int sm_listen_for(struct sm_listen_for_parms *listenp)
typedef struct sm_listen_for_parms { tSMChannelId channel; /* in */ enum kSMToneDetection { kSMToneDetectionNone, kSMToneDetectionNoMinDuration, kSMToneDetectionMinDuration64, kSMToneDetectionMinDuration40, kSMToneEndDetectionNoMinDuration, kSMToneEndDetectionMinDuration64, kSMToneEndDetectionMinDuration40, kSMToneLenDetectionNoMinDuration, kSMToneLenDetectionMinDuration64, kSMToneLenDetectionMinDuration40, kSMToneDetectionAsListenFor, } tone_detection_mode; /* in */ tSM_INT active_tone_set_id; /* in */ enum kSMDigitMapping { kSMNoDigitMapping, kSMDTMFToneSetDigitMapping, } map_tones_to_digits; /* in */ tSM_INT enable_cptone_recognition; /* in */ tSM_INT enable_grunt_detection; /* in */ tSM_INT grunt_latency; /* in */ double min_noise_level; /* in */ double grunt_threshold; /* in */ tSM_UT32 grunt_holdoff; /* in */ } SM_LISTEN_FOR_PARMS;
This call controls the simple tones, call-progress tones and digits that may be recognised on the specified channel channel.
It may be called at any time to alter the tone and digit recognition properties for a particular channel.
Contact Aculab technical support for details of an application library which can detect pulse-dialled digits.
The parameters tone_detection_mode and active_tone_set_id determine if and by what criteria simple tones are recognised on the input channel. If tone detection is enabled then any simple tone that occurs on the channel and that meets the recognition criteria will be notified to the application.
In order to be recognised, a tone must be a member of the input tone set active_tone_set_id (see Prosody speech processing: pre-loaded input tones for predefined tone sets, and sm_add_input_tone_set() for application defined tone sets). It must also fulfil the criteria for the specified mode (see Prosody speech processing: pre-loaded input tones for more details).
When a tone is recognised, the recognition event associated with
the channel is set and the application can then retrieve a tone
identifier for the recognised tone by calling
sm_get_recognised().
However if
map_tones_to_digits
is set to a value of kSMDTMFToneSetDigitMapping
then when a tone occurs on the channel corresponding to a DTMF
digit,
sm_get_recognised()
reports the digit directly, with the mapping between DTMF
tones and DTMF digits already done.
If enable_cptone_recognition is set to a non-zero value, then any call-progress tone that occurs on the channel and that corresponds to a member of set of call-progress tones currently recognisable by the module will be notified to the application. See Prosody speech processing: pre-loaded call-progress tones, for a list of default set of call-progress tones recognisable by the module. To alter the default set of recognisable call-progress tones, see the calls sm_reset_input_cptones() and sm_add_input_cptone().
Note that call-progress tone detection may not be used simultaneously with tone or digit detection on the same channel.
If enable_grunt_detection is set to a non-zero value, then the application will be notified when the signal energy on the input channel goes above an adaptive threshold, which is grunt_threshold above the estimated ambient background noise level. The application will be notified again when this signal burst ends. The grunt_latency parameter, if non-zero, enables holding back of the "end of grunt" notification by grunt_latency milliseconds so if the signal restarts during this period, a premature "end of grunt" notification is not given. The grunt detection algorithm makes the assumption that there is activity on the line at initialisation. Therefore, the first notification will always be an "end of grunt". If the line is silent when grunt detection is enabled, an "end of grunt" notification will happen within grunt_latency milliseconds from the start. For natural speech grunt_latency should be set to 1000 milliseconds or longer.
If a recognition event has been previously associated with channel (see sm_channel_set_event()), then the driver will notify the application with that event whenever one of the above is recognised on the input channel.
0 if call completed successfully, otherwise a standard error such as:
This function is part of the Prosody speech processing API.