mod_stress attempts to detect stress in a person's voice and generates FreeSWITCH events based on that data.
The module uses FFT to calculate the power spectrum of the call. It then attempts to recognise patterns that may imply stress. For example a strong tremor or volume.
Please note that this will be highly unreliable, generating many false positives/negatives.
The stress app attaches hooks to the channel to listen to the media in one direction.
stress [ read | write | stop ]
The read parameter (default) listens for stress on the caller's direction, write for stress on the callee's direction and stop removes any previously attached hooks.
The dialplan app can also be invoked on a channel from the console or via ESL (eg fs_cli):
uuid_broadcast <uuid> stress::read uuid_broadcast <uuid> stress::stop
When stress is detected this event is fired. Note both Event-Name and Speech-Type, other modules will raise DETECTED_SPEECH but with a different Speech-Type. Example:
Event-Name: DETECTED_SPEECH Core-UUID: 82054370-3b7c-452d-aade-e77d2eead7fe FreeSWITCH-Hostname: fs01.telefaks.biz FreeSWITCH-Switchname: fs01.telefaks.biz FreeSWITCH-IPv4: 192.168.178.221 FreeSWITCH-IPv6: %3A%3A1 Event-Date-Local: 2013-01-22%2023%3A29%3A11 Event-Date-GMT: Tue,%2022%20Jan%202013%2022%3A29%3A11%20GMT Event-Date-Timestamp: 1358893751566924 Event-Calling-File: mod_stress.cpp Event-Calling-Function: stress_callback Event-Calling-Line-Number: 175 Event-Sequence: 117716 Speech-Type: stress-level Stress-Level: 20000.00 Unique-ID: 178a661c-e135-4e50-8275-9285908287d7
If you whistle into your phone you should see the following messages (example):
2013-01-22 15:51:50.546923 [DEBUG] mod_stress.cpp:173 Stress 20000.00 2013-01-22 15:51:51.566922 [DEBUG] mod_stress.cpp:173 Stress 20000.00 2013-01-22 15:51:53.606924 [DEBUG] mod_stress.cpp:173 Stress 20000.00 2013-01-22 15:51:54.626923 [DEBUG] mod_stress.cpp:173 Stress 20000.00 2013-01-22 15:51:55.666926 [DEBUG] mod_stress.cpp:173 Stress 392.78 2013-01-22 15:51:56.686923 [DEBUG] mod_stress.cpp:173 Stress 0.17
This will confirm the module is listening to speech on the line.