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

+6 -2
View File
@@ -372,8 +372,9 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
switch (ostate) {
case REG_STATE_NOREG:
if (!gateway_ptr->ping && !gateway_ptr->pinging) {
if (!gateway_ptr->ping && !gateway_ptr->pinging && gateway_ptr->status != SOFIA_GATEWAY_UP) {
gateway_ptr->status = SOFIA_GATEWAY_UP;
gateway_ptr->uptime = switch_time_now();
}
break;
case REG_STATE_REGISTER:
@@ -396,7 +397,10 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
gateway_ptr->expires = now + delta;
gateway_ptr->state = REG_STATE_REGED;
gateway_ptr->status = SOFIA_GATEWAY_UP;
if (gateway_ptr->status != SOFIA_GATEWAY_UP) {
gateway_ptr->status = SOFIA_GATEWAY_UP;
gateway_ptr->uptime = switch_time_now();
}
break;
case REG_STATE_UNREGISTER: