*
* Anthony Minessale II <anthm@freeswitch.org>
* Moises Silva <moises.silva@gmail.com> (Multiple endpoints work sponsored by Comrex Corporation)
+ * Raymond Chandler <intralanman@freeswitch.org>
*
*
* mod_portaudio.c -- PortAudio Endpoint Module
int indev;
int outdev;
int call_id;
+ int unload_device_fail;
switch_hash_t *call_hash;
switch_mutex_t *device_lock;
switch_mutex_t *pvt_lock;
globals.no_ring_during_call = 0;
globals.indev = globals.outdev = globals.ringdev = -1;
globals.sample_rate = 8000;
+ globals.unload_device_fail = 0;
if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
} else {
globals.ringdev = get_dev_by_name(val, 0);
}
+ } else if (!strcasecmp(var, "unload-on-device-fail")) {
+ globals.unload_device_fail = switch_true(val);
}
}
}
if (globals.indev < 0) {
globals.indev = get_dev_by_name(NULL, 1);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "global indev [%d]\n", globals.indev);
if (globals.indev > -1) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Switching to default input device\n");
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find an input device\n");
- status = SWITCH_STATUS_GENERR;
+ if (globals.unload_device_fail) {
+ status = SWITCH_STATUS_GENERR;
+ }
}
}
if (globals.outdev < 0) {
globals.outdev = get_dev_by_name(NULL, 0);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "global outdev [%d]\n", globals.outdev);
if (globals.outdev > -1) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Switching to default output device\n");
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find an output device\n");
- status = SWITCH_STATUS_GENERR;
+ if (globals.unload_device_fail) {
+ status = SWITCH_STATUS_GENERR;
+ }
}
}