diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c index 8e1c925..a5f77a8 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c @@ -864,6 +864,9 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi modem_id = atoi(modem_id_string); } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_ERROR, "use modem %d\n", modem_id); + + if (!(modem = acquire_modem(modem_id))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_ERROR, "Cannot find a modem.\n"); cause = SWITCH_CAUSE_USER_BUSY; goto fail; @@ -1400,14 +1403,21 @@ static modem_t *acquire_modem(int index) int64_t idle_debounce = 2000000; switch_mutex_lock(globals.mutex); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "look for modem %d\n", index); + + if (index > -1 && index < globals.SOFT_MAX_MODEMS) { modem = &globals.MODEM_POOL[index]; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "found modem %d %p %s:%s\n", index, (void *) modem, modem->devlink, modem->stty); } else { int x; for(x = 0; x < globals.SOFT_MAX_MODEMS; x++) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "search for index %d\n", x); if (globals.MODEM_POOL[x].state == MODEM_STATE_ONHOOK && (now - globals.MODEM_POOL[x].last_event) > idle_debounce) { modem = &globals.MODEM_POOL[x]; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "auto found modem %d %p %s:%s\n", x, (void *) modem, modem->devlink, modem->stty); break; } }