mod_skinny: improvements to error handling/detection

This commit is contained in:
Nathan Neulinger 2014-09-09 08:30:46 -05:00
parent c3d65e902d
commit 8973ffcc35
1 changed files with 46 additions and 1 deletions

View File

@ -191,6 +191,7 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l
goto done; goto done;
error: error:
skinny_log_l(listener, SWITCH_LOG_CRIT, "Failed to create incoming session for line instance %d", *line_instance_p);
if (nsession) { if (nsession) {
switch_core_session_destroy(&nsession); switch_core_session_destroy(&nsession);
} }
@ -947,6 +948,10 @@ switch_status_t skinny_session_transfer(switch_core_session_t *session, listener
/* TODO CallSelectStat */ /* TODO CallSelectStat */
skinny_log_ls_msg(listener, session2, SWITCH_LOG_INFO, "SST: creating incoming session\n"); skinny_log_ls_msg(listener, session2, SWITCH_LOG_INFO, "SST: creating incoming session\n");
status = skinny_create_incoming_session(listener, &line_instance, &session2); status = skinny_create_incoming_session(listener, &line_instance, &session2);
if ( ! session2 ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "SST: Unable to create incoming session for transfer.\n");
return SWITCH_STATUS_FALSE;
}
tech_pvt2 = switch_core_session_get_private(session2); tech_pvt2 = switch_core_session_get_private(session2);
tech_pvt2->transfer_from_call_id = tech_pvt->call_id; tech_pvt2->transfer_from_call_id = tech_pvt->call_id;
tech_pvt->transfer_to_call_id = tech_pvt2->call_id; tech_pvt->transfer_to_call_id = tech_pvt2->call_id;
@ -1421,6 +1426,10 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
switch(request->data.stimulus.instance_type) { switch(request->data.stimulus.instance_type) {
case SKINNY_BUTTON_LAST_NUMBER_REDIAL: case SKINNY_BUTTON_LAST_NUMBER_REDIAL:
skinny_create_incoming_session(listener, &line_instance, &session); skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle last number redial stimulus message, couldn't create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance, skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0); empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0);
break; break;
@ -1429,9 +1438,13 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
session = skinny_profile_find_session(listener->profile, listener, &line_instance, 0); session = skinny_profile_find_session(listener->profile, listener, &line_instance, 0);
if(strlen(button_speed_dial->line) > 0) { if(strlen(button_speed_dial->line) > 0) {
if (!session) { if ( !session ) {
skinny_create_incoming_session(listener, &line_instance, &session); skinny_create_incoming_session(listener, &line_instance, &session);
} }
if ( !session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle speed dial stimulus message, couldn't create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance, button_speed_dial->line, '\0', 0); skinny_session_process_dest(session, listener, line_instance, button_speed_dial->line, '\0', 0);
} }
break; break;
@ -1451,6 +1464,10 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
break; break;
case SKINNY_BUTTON_VOICEMAIL: case SKINNY_BUTTON_VOICEMAIL:
skinny_create_incoming_session(listener, &line_instance, &session); skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle stimulus message, couldn't create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance, skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_voicemail, listener->profile->ext_voicemail), '\0', 0); empty_null2(listener->ext_voicemail, listener->profile->ext_voicemail), '\0', 0);
break; break;
@ -1485,6 +1502,10 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess
} }
skinny_create_incoming_session(listener, &line_instance, &session); skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle stimulus message, couldn't create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0); skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0);
} }
break; break;
@ -1523,6 +1544,10 @@ switch_status_t skinny_handle_off_hook_message(listener_t *listener, skinny_mess
skinny_session_answer(session, listener, line_instance); skinny_session_answer(session, listener, line_instance);
} else { /* start a new call */ } else { /* start a new call */
skinny_create_incoming_session(listener, &line_instance, &session); skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle off hook message, could not create session.\n");
return SWITCH_STATUS_FALSE;
}
tech_pvt = switch_core_session_get_private(session); tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL); assert(tech_pvt != NULL);
@ -2037,11 +2062,19 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
switch(request->data.soft_key_event.event) { switch(request->data.soft_key_event.event) {
case SOFTKEY_REDIAL: case SOFTKEY_REDIAL:
status = skinny_create_incoming_session(listener, &line_instance, &session); status = skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance, skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0); empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0);
break; break;
case SOFTKEY_NEWCALL: case SOFTKEY_NEWCALL:
status = skinny_create_incoming_session(listener, &line_instance, &session); status = skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0); skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0);
break; break;
case SOFTKEY_HOLD: case SOFTKEY_HOLD:
@ -2098,17 +2131,29 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn
break; break;
case SOFTKEY_MEETME: case SOFTKEY_MEETME:
skinny_create_incoming_session(listener, &line_instance, &session); skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance, skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_meetme, listener->profile->ext_meetme), '\0', 0); empty_null2(listener->ext_meetme, listener->profile->ext_meetme), '\0', 0);
break; break;
case SOFTKEY_CALLPICKUP: case SOFTKEY_CALLPICKUP:
case SOFTKEY_GRPCALLPICKUP: case SOFTKEY_GRPCALLPICKUP:
skinny_create_incoming_session(listener, &line_instance, &session); skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance, skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_pickup, listener->profile->ext_pickup), '\0', 0); empty_null2(listener->ext_pickup, listener->profile->ext_pickup), '\0', 0);
break; break;
case SOFTKEY_CFWDALL: case SOFTKEY_CFWDALL:
skinny_create_incoming_session(listener, &line_instance, &session); skinny_create_incoming_session(listener, &line_instance, &session);
if ( ! session ) {
skinny_log_l_msg(listener, SWITCH_LOG_CRIT, "Unable to handle soft key event, could not create incoming session.\n");
return SWITCH_STATUS_FALSE;
}
skinny_session_process_dest(session, listener, line_instance, skinny_session_process_dest(session, listener, line_instance,
empty_null2(listener->ext_cfwdall, listener->profile->ext_cfwdall), '\0', 0); empty_null2(listener->ext_cfwdall, listener->profile->ext_cfwdall), '\0', 0);
break; break;