<p>N A has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18517">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_outbound_registration: Show time until expiration<br><br>Adjusts the pjsip show registration(s) commands to show<br>the amount of seconds remaining until a registration<br>expires.<br><br>ASTERISK-29845 #close<br><br>Change-Id: Ic4fea15a1a1056c424416def49d1ca8e776c0483<br>---<br>M res/res_pjsip_outbound_registration.c<br>1 file changed, 9 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/17/18517/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c</span><br><span>index 2cf5713..add3ddf 100644</span><br><span>--- a/res/res_pjsip_outbound_registration.c</span><br><span>+++ b/res/res_pjsip_outbound_registration.c</span><br><span>@@ -374,6 +374,8 @@</span><br><span> char *transport_name;</span><br><span> /*! \brief The name of the registration sorcery object */</span><br><span> char *registration_name;</span><br><span style="color: hsl(120, 100%, 40%);">+ /*! \brief Expected time of registration lapse/expiration */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int registration_expires;</span><br><span> };</span><br><span> </span><br><span> /*! \brief Outbound registration state information (persists for lifetime that registration should exist) */</span><br><span>@@ -686,6 +688,7 @@</span><br><span> (int) info.client_uri.slen, info.client_uri.ptr);</span><br><span> ao2_ref(client_state, -1);</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ client_state->registration_expires = ((int) time(NULL)) + seconds;</span><br><span> }</span><br><span> </span><br><span> static void update_client_state_status(struct sip_outbound_registration_client_state *client_state, enum sip_outbound_registration_status status)</span><br><span>@@ -2012,7 +2015,7 @@</span><br><span> ast_assert(context->output_buffer != NULL);</span><br><span> </span><br><span> ast_str_append(&context->output_buffer, 0,</span><br><span style="color: hsl(0, 100%, 40%);">- " <Registration/ServerURI..............................> <Auth..........> <Status.......>\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ " <Registration/ServerURI..............................> <Auth....................> <Status.......>\n");</span><br><span> </span><br><span> return 0;</span><br><span> }</span><br><span>@@ -2023,11 +2026,13 @@</span><br><span> struct ast_sip_cli_context *context = arg;</span><br><span> const char *id = ast_sorcery_object_get_id(registration);</span><br><span> struct sip_outbound_registration_state *state = get_state(id);</span><br><span style="color: hsl(120, 100%, 40%);">+ int expsecs;</span><br><span> #define REGISTRATION_URI_FIELD_LEN 53</span><br><span> </span><br><span> ast_assert(context->output_buffer != NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ expsecs = state ? state->client_state->registration_expires - ((int) time(NULL)) : 0;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_str_append(&context->output_buffer, 0, " %-s/%-*.*s %-16s %-16s\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_str_append(&context->output_buffer, 0, " %-s/%-*.*s %-26s %-16s %s%d%s\n",</span><br><span> id,</span><br><span> (int) (REGISTRATION_URI_FIELD_LEN - strlen(id)),</span><br><span> (int) (REGISTRATION_URI_FIELD_LEN - strlen(id)),</span><br><span>@@ -2035,7 +2040,8 @@</span><br><span> AST_VECTOR_SIZE(®istration->outbound_auths)</span><br><span> ? AST_VECTOR_GET(®istration->outbound_auths, 0)</span><br><span> : "n/a",</span><br><span style="color: hsl(0, 100%, 40%);">- (state ? sip_outbound_registration_status_str(state->client_state->status) : "Unregistered"));</span><br><span style="color: hsl(120, 100%, 40%);">+ (state ? sip_outbound_registration_status_str(state->client_state->status) : "Unregistered"),</span><br><span style="color: hsl(120, 100%, 40%);">+ state ? " (exp. " : "", abs(expsecs), state ? (expsecs < 0 ? "s ago)" : "s)") : "");</span><br><span> ao2_cleanup(state);</span><br><span> </span><br><span> if (context->show_details</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18517">change 18517</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/18517"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: Ic4fea15a1a1056c424416def49d1ca8e776c0483 </div>
<div style="display:none"> Gerrit-Change-Number: 18517 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>