FS-6927 #resolve #comment This display option ping times in the gateway status on sofia status gateways or individual gateway status output
This commit is contained in:
parent
e3e267f462
commit
15e9e68064
|
@ -2523,7 +2523,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
|
|||
uint32_t ob_failed = 0;
|
||||
uint32_t ob = 0;
|
||||
|
||||
stream->write_function(stream, "%25s\t%32s\t%s\t%s\t%s\n", "Profile::Gateway-Name", " Data ", "State", "IB Calls(F/T)", "OB Calls(F/T)");
|
||||
stream->write_function(stream, "%25s\t%32s\t%s\t%9s\t%s\t%s\n", "Profile::Gateway-Name", " Data ", "State", "Ping Time", "IB Calls(F/T)", "OB Calls(F/T)");
|
||||
stream->write_function(stream, "%s\n", line);
|
||||
switch_mutex_lock(mod_sofia_globals.hash_mutex);
|
||||
for (hi = switch_core_hash_first(mod_sofia_globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) {
|
||||
|
@ -2543,8 +2543,8 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
|
|||
ob_failed += gp->ob_failed_calls;
|
||||
ob += gp->ob_calls;
|
||||
|
||||
stream->write_function(stream, "%25s\t%32s\t%s\t%u/%u\t%u/%u",
|
||||
pkey, gp->register_to, sofia_state_names[gp->state],
|
||||
stream->write_function(stream, "%25s\t%32s\t%s\t%9u\t%u/%u\t%u/%u",
|
||||
pkey, gp->register_to, sofia_state_names[gp->state], gp->ping_time,
|
||||
gp->ib_failed_calls, gp->ib_calls, gp->ob_failed_calls, gp->ob_calls);
|
||||
|
||||
if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) {
|
||||
|
@ -2589,6 +2589,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
|
|||
stream->write_function(stream, "Freq \t%d\n", gp->freq);
|
||||
stream->write_function(stream, "Ping \t%d\n", gp->ping);
|
||||
stream->write_function(stream, "PingFreq\t%d\n", gp->ping_freq);
|
||||
stream->write_function(stream, "PingTime\t%d\n", gp->ping_time);
|
||||
stream->write_function(stream, "PingState\t%d/%d/%d\n", gp->ping_min, gp->ping_count, gp->ping_max);
|
||||
stream->write_function(stream, "State \t%s\n", sofia_state_names[gp->state]);
|
||||
stream->write_function(stream, "Status \t%s%s\n", status_names[gp->status], gp->pinging ? " (ping)" : "");
|
||||
|
@ -2831,8 +2832,9 @@ static void xml_gateway_status(sofia_gateway_t *gp, switch_stream_handle_t *stre
|
|||
stream->write_function(stream, " <ping>%d</ping>\n", gp->ping);
|
||||
stream->write_function(stream, " <pingfreq>%d</pingfreq>\n", gp->ping_freq);
|
||||
stream->write_function(stream, " <pingmin>%d</pingmin>\n", gp->ping_min);
|
||||
stream->write_function(stream, " <pingcount>%d</pingcount>\n", gp->ping_count);
|
||||
stream->write_function(stream, " <pingcount>%d</pingcount>\n", gp->ping_count);
|
||||
stream->write_function(stream, " <pingmax>%d</pingmax>\n", gp->ping_max);
|
||||
stream->write_function(stream, " <pingtime>%d</pingtime>\n", gp->ping_time);
|
||||
stream->write_function(stream, " <pinging>%d</pinging>\n", gp->pinging);
|
||||
stream->write_function(stream, " <state>%s</state>\n", sofia_state_names[gp->state]);
|
||||
stream->write_function(stream, " <status>%s</status>\n", status_names[gp->status]);
|
||||
|
|
|
@ -504,6 +504,8 @@ struct sofia_gateway {
|
|||
int ping_count;
|
||||
int ping_max;
|
||||
int ping_min;
|
||||
switch_time_t ping_sent;
|
||||
uint32_t ping_time;
|
||||
switch_bool_t ping_monitoring;
|
||||
uint8_t flags[REG_FLAG_MAX];
|
||||
int32_t retry_seconds;
|
||||
|
|
|
@ -3350,6 +3350,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
|||
gateway->ping_freq = 0;
|
||||
gateway->ping_max = 0;
|
||||
gateway->ping_min = 0;
|
||||
gateway->ping_sent = 0;
|
||||
gateway->ping_time = 0;
|
||||
gateway->ping_count = 0;
|
||||
gateway->ping_monitoring = SWITCH_FALSE;
|
||||
gateway->ib_calls = 0;
|
||||
|
@ -5679,10 +5681,15 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu
|
|||
"Ping succeeded %s with code %d - count %d/%d/%d, state %s\n",
|
||||
gateway->name, status, gateway->ping_min, gateway->ping_count, gateway->ping_max, sofia_gateway_status_name(gateway->status));
|
||||
}
|
||||
if (gateway->ping_sent) {
|
||||
gateway->ping_time = (switch_micro_time_now() - gateway->ping_sent) / 1000;
|
||||
gateway->ping_sent = 0;
|
||||
}
|
||||
} else {
|
||||
if (gateway->state == REG_STATE_REGED) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unregister %s\n", gateway->name);
|
||||
gateway->state = REG_STATE_FAILED;
|
||||
gateway->ping_time = 0;
|
||||
}
|
||||
|
||||
if (gateway->ping_count > 0) {
|
||||
|
@ -5692,6 +5699,7 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu
|
|||
if (gateway->ping_count < gateway->ping_min && gateway->status != SOFIA_GATEWAY_DOWN) {
|
||||
gateway->status = SOFIA_GATEWAY_DOWN;
|
||||
do_fire_gateway_state_event = SWITCH_TRUE;
|
||||
gateway->ping_time = 0;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
|
||||
|
|
|
@ -379,6 +379,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
|
|||
nua_handle_bind(nh, pvt);
|
||||
|
||||
gateway_ptr->pinging = 1;
|
||||
gateway_ptr->ping_sent = switch_micro_time_now();
|
||||
nua_options(nh,
|
||||
TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)),
|
||||
TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
|
||||
|
|
Loading…
Reference in New Issue