]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Show gateway uptime in seconds
authorTravis Cross <tc@traviscross.com>
Thu, 4 Sep 2014 05:29:25 +0000 (05:29 +0000)
committerTravis Cross <tc@traviscross.com>
Thu, 4 Sep 2014 05:39:26 +0000 (05:39 +0000)
In `sofia status gateway ...` let's show the uptime in seconds rather
than in microseconds.  We'll output the uptime in microseconds in
`xmlstatus` and we'll label it as such.

src/mod/endpoints/mod_sofia/mod_sofia.c

index 5f656b762cb5b36446ebf69405990f88153102f0..ff19465fb234bab1f8dcd915c61c2dd96aeabdd9 100644 (file)
@@ -2584,7 +2584,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
                                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)" : "");
-                               stream->write_function(stream, "Uptime  \t%ld\n", gp->status == SOFIA_GATEWAY_UP ? switch_time_now()-gp->uptime : 0);
+                               stream->write_function(stream, "Uptime  \t%lds\n", gp->status == SOFIA_GATEWAY_UP ? (switch_time_now()-gp->uptime)/1000000 : 0);
                                stream->write_function(stream, "CallsIN \t%u\n", gp->ib_calls);
                                stream->write_function(stream, "CallsOUT\t%u\n", gp->ob_calls);
                                stream->write_function(stream, "FailedCallsIN\t%u\n", gp->ib_failed_calls);
@@ -2828,7 +2828,7 @@ static void xml_gateway_status(sofia_gateway_t *gp, switch_stream_handle_t *stre
        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]);
-       stream->write_function(stream, "    <uptime>%ld</uptime>\n", gp->status == SOFIA_GATEWAY_UP ? switch_time_now()-gp->uptime : 0);
+       stream->write_function(stream, "    <uptime-usec>%ld</uptime-usec>\n", gp->status == SOFIA_GATEWAY_UP ? switch_time_now()-gp->uptime : 0);
        stream->write_function(stream, "    <calls-in>%u</calls-in>\n", gp->ib_calls);
        stream->write_function(stream, "    <calls-out>%u</calls-out>\n", gp->ob_calls);
        stream->write_function(stream, "    <failed-calls-in>%u</failed-calls-in>\n", gp->ib_failed_calls);