diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 66cc8e6292..7a241231a7 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -191,6 +191,7 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l goto done; error: + skinny_log_l(listener, SWITCH_LOG_CRIT, "Failed to create incoming session for line instance %d", *line_instance_p); if (nsession) { switch_core_session_destroy(&nsession); } @@ -947,6 +948,10 @@ switch_status_t skinny_session_transfer(switch_core_session_t *session, listener /* TODO CallSelectStat */ skinny_log_ls_msg(listener, session2, SWITCH_LOG_INFO, "SST: creating incoming session\n"); 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->transfer_from_call_id = tech_pvt->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) { case SKINNY_BUTTON_LAST_NUMBER_REDIAL: 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, empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0); 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); if(strlen(button_speed_dial->line) > 0) { - if (!session) { + if ( !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); } break; @@ -1451,6 +1464,10 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess break; case SKINNY_BUTTON_VOICEMAIL: 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, empty_null2(listener->ext_voicemail, listener->profile->ext_voicemail), '\0', 0); 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); + 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); } 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); } else { /* start a new call */ 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); 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) { case SOFTKEY_REDIAL: 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, empty_null2(listener->ext_redial,listener->profile->ext_redial), '\0', 0); break; case SOFTKEY_NEWCALL: 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); break; case SOFTKEY_HOLD: @@ -2098,17 +2131,29 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn break; case SOFTKEY_MEETME: 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, empty_null2(listener->ext_meetme, listener->profile->ext_meetme), '\0', 0); break; case SOFTKEY_CALLPICKUP: case SOFTKEY_GRPCALLPICKUP: 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, empty_null2(listener->ext_pickup, listener->profile->ext_pickup), '\0', 0); break; case SOFTKEY_CFWDALL: 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, empty_null2(listener->ext_cfwdall, listener->profile->ext_cfwdall), '\0', 0); break;