diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.c b/src/mod/endpoints/mod_skinny/skinny_protocol.c index fc4ee532a0..1e1c539150 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.c +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.c @@ -506,9 +506,11 @@ switch_status_t perform_send_register_ack(listener_t *listener, message->data.reg_ack.secondary_keep_alive = keep_alive; switch_copy_string(message->data.reg_ack.reserved2, reserved2, 4); - skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Sending Register Ack with Keep Alive (%d), Date Format (%s), Secondary Keep Alive (%d)\n", - keep_alive, date_format, secondary_keep_alive); + if ( listener->profile->debug >= 9 ) { + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Sending Register Ack with Keep Alive (%d), Date Format (%s), Secondary Keep Alive (%d)\n", + keep_alive, date_format, secondary_keep_alive); + } return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } @@ -527,9 +529,11 @@ switch_status_t perform_send_speed_dial_stat_res(listener_t *listener, switch_copy_string(message->data.speed_dial_res.line, speed_line, 24); switch_copy_string(message->data.speed_dial_res.label, speed_label, 40); - skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Sending Speed Dial Stat Res with Number (%d), Line (%s), Label (%s)\n", - number, speed_line, speed_label); + if ( listener->profile->debug >= 9 ) { + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Sending Speed Dial Stat Res with Number (%d), Line (%s), Label (%s)\n", + number, speed_line, speed_label); + } return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } @@ -791,8 +795,10 @@ switch_status_t perform_send_call_info(listener_t *listener, message->data.call_info.call_security_status = call_security_status; message->data.call_info.party_pi_restriction_bits = party_pi_restriction_bits; - skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Send Call Info with Line Instance (%d)...\n", line_instance); + if ( listener->profile->debug >= 9 ) { + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Call Info with Line Instance (%d)...\n", line_instance); + } return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } @@ -823,9 +829,11 @@ switch_status_t perform_send_define_time_date(listener_t *listener, message->data.define_time_date.milliseconds = milliseconds; message->data.define_time_date.timestamp = timestamp; - skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Send Define Time Date with %.4d-%.2d-%.2d %.2d:%.2d:%.2d.%d, Timestamp (%d), DOW (%d)\n", - year, month, day, hour, minute, seconds, milliseconds, timestamp, day_of_week); + if ( listener->profile->debug >= 9 ) { + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Define Time Date with %.4d-%.2d-%.2d %.2d:%.2d:%.2d.%d, Timestamp (%d), DOW (%d)\n", + year, month, day, hour, minute, seconds, milliseconds, timestamp, day_of_week); + } return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } @@ -857,8 +865,10 @@ switch_status_t perform_send_capabilities_req(listener_t *listener, skinny_create_empty_message(message, CAPABILITIES_REQ_MESSAGE); - skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Send Capabilities Req%s\n", ""); + if ( listener->profile->debug >= 9 ) { + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Capabilities Req%s\n", ""); + } return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } @@ -873,8 +883,10 @@ switch_status_t perform_send_version(listener_t *listener, memcpy(message->data.version.version, version, 16); - skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Send Version with Version(%s)\n", version); + if ( listener->profile->debug >= 9 ) { + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Version with Version(%s)\n", version); + } return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } @@ -973,9 +985,11 @@ switch_status_t perform_send_select_soft_keys(listener_t *listener, message->data.select_soft_keys.soft_key_set = soft_key_set; message->data.select_soft_keys.valid_key_mask = valid_key_mask; - skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, - "Send Select Soft Keys with Line Instance (%d), Call ID (%d), Soft Key Set (%d), Valid Key Mask (%x)\n", + if ( listener->profile->debug >= 9 ) { + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Select Soft Keys with Line Instance (%d), Call ID (%d), Soft Key Set (%d), Valid Key Mask (%x)\n", line_instance, call_id, soft_key_set, valid_key_mask); + } return skinny_send_reply_quiet(listener, message, SWITCH_TRUE); } @@ -1299,7 +1313,8 @@ switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file ptr = (char *) reply; if (listener_is_ready(listener)) { - if (listener->profile->debug >= 10 || reply->type != KEEP_ALIVE_ACK_MESSAGE) { + if (listener->profile->debug >= 10 || + (listener->profile->debug >= 9 && reply->type != KEEP_ALIVE_ACK_MESSAGE)) { skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, "Sending %s (type=%x,length=%d).\n", skinny_message_type2str(reply->type), reply->type, reply->length); diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 64b6d16831..5a581de463 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1621,8 +1621,10 @@ switch_status_t skinny_handle_forward_stat_req_message(listener_t *listener, ski message->data.forward_stat.line_instance = request->data.forward_stat_req.line_instance; - skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Forward Stat Req Message with Line Instance (%d)\n", - request->data.forward_stat_req.line_instance); + if ( listener->profile->debug >= 9 ) { + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Forward Stat Req Message with Line Instance (%d)\n", + request->data.forward_stat_req.line_instance); + } skinny_send_reply_quiet(listener, message, SWITCH_TRUE); return SWITCH_STATUS_SUCCESS; @@ -1634,7 +1636,9 @@ switch_status_t skinny_handle_speed_dial_stat_request(listener_t *listener, skin skinny_check_data_length(request, sizeof(request->data.speed_dial_req)); - skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Speed Dial Stat Request for Number (%d)\n", request->data.speed_dial_req.number); + if ( listener->profile->debug >= 9 ) { + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Speed Dial Stat Request for Number (%d)\n", request->data.speed_dial_req.number); + } skinny_speed_dial_get(listener, request->data.speed_dial_req.number, &button); @@ -1906,7 +1910,9 @@ switch_status_t skinny_handle_capabilities_response(listener_t *listener, skinny skinny_execute_sql(profile, sql, profile->sql_mutex); switch_safe_free(sql); } - skinny_log_l(listener, SWITCH_LOG_DEBUG, "Codecs %s supported.\n", codec_string); + if ( listener->profile->debug >= 9 ) { + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Codecs %s supported.\n", codec_string); + } switch_safe_free(codec_string); return SWITCH_STATUS_SUCCESS; } @@ -2036,11 +2042,15 @@ switch_status_t skinny_handle_soft_key_set_request(listener_t *listener, skinny_ if (listener->soft_key_set_set) { message = switch_core_hash_find(listener->profile->soft_key_set_sets_hash, listener->soft_key_set_set); - skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Soft Key Set Request with Set (%s)\n", listener->soft_key_set_set); + if ( listener->profile->debug >= 9 ) { + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Soft Key Set Request with Set (%s)\n", listener->soft_key_set_set); + } } if (!message) { message = switch_core_hash_find(listener->profile->soft_key_set_sets_hash, "default"); - skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Soft Key Set Request with Set (%s)\n", "default"); + if ( listener->profile->debug >= 9 ) { + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Soft Key Set Request with Set (%s)\n", "default"); + } } if (message) { skinny_send_reply_quiet(listener, message, SWITCH_FALSE); @@ -2231,7 +2241,9 @@ switch_status_t skinny_handle_soft_key_template_request(listener_t *listener, sk message->data.soft_key_template.soft_key[i].soft_key_event = soft_key_template_default_events[i]; } - skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, "Handle Soft Key Template Request with Default Template\n"); + if ( listener->profile->debug >= 9 ) { + skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, "Handle Soft Key Template Request with Default Template\n"); + } skinny_send_reply_quiet(listener, message, SWITCH_TRUE); @@ -2254,8 +2266,10 @@ switch_status_t skinny_headset_status_message(listener_t *listener, skinny_messa switch_safe_free(sql); } - skinny_log_l(listener, SWITCH_LOG_DEBUG, "Update headset accessory status (%s)\n", - skinny_accessory_state2str(request->data.headset_status.mode)); + if ( listener->profile->debug >= 9 ) { + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Update headset accessory status (%s)\n", + skinny_accessory_state2str(request->data.headset_status.mode)); + } return SWITCH_STATUS_SUCCESS; } @@ -2274,7 +2288,9 @@ switch_status_t skinny_handle_register_available_lines_message(listener_t *liste { skinny_check_data_length(request, sizeof(request->data.reg_lines)); - skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, "Handle Register Available Lines\n"); + if ( listener->profile->debug >= 9 ) { + skinny_log_l_msg(listener, SWITCH_LOG_DEBUG, "Handle Register Available Lines\n"); + } /* Do nothing */ return SWITCH_STATUS_SUCCESS; @@ -2531,7 +2547,7 @@ switch_status_t skinny_handle_xml_alarm(listener_t *listener, skinny_message_t * switch_event_t *event = NULL; char *tmp = NULL; - skinny_log_l(listener, SWITCH_LOG_INFO, "Received XML alarm (length=%d).\n", request->length); + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Received XML alarm (length=%d).\n", request->length); /* skinny::xml_alarm event */ skinny_device_event(listener, &event, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_XML_ALARM); /* Ensure that the body is null-terminated */ @@ -2547,7 +2563,8 @@ switch_status_t skinny_handle_xml_alarm(listener_t *listener, skinny_message_t * switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *request) { - if (listener->profile->debug >= 10 || request->type != KEEP_ALIVE_MESSAGE) { + if (listener->profile->debug >= 10 || + (listener->profile->debug >= 9 && request->type != KEEP_ALIVE_MESSAGE)) { skinny_log_l(listener, SWITCH_LOG_DEBUG, "Received %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length); }