Add uptime property to mod_sofia gateways

The 'UP' status indicates a gateway is online as determined by
registration and/or SIP OPTIONS pinging.

The time the gateway has been in the 'UP' status is recorded,
and can be monitored using 'sofia status' and 'sofia xmlstatus'.

This can be used to detect and graph when there are outages.

ref: FS-6772

Reviewed-by: Travis Cross <tc@traviscross.com>
This commit is contained in:
Steven Ayre authored and Travis Cross committed 2014-09-04 03:43:36 +00:00
1 parent 5fadb52758
commit 93bd5833c2
4 files changed
+11 -2

No files matched your search

+2
View File
@@ -3487,6 +3487,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
if (!switch_true(register_str)) {
gateway->state = REG_STATE_NOREG;
gateway->status = SOFIA_GATEWAY_UP;
gateway->uptime = switch_time_now();
}
if (zstr(auth_username)) {
@@ -5563,6 +5564,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_UP) {
gateway->status = SOFIA_GATEWAY_UP;
gateway->uptime = switch_time_now();
sofia_reg_fire_custom_gateway_state_event(gateway, status, phrase);
}