@@ -392,6 +392,8 @@ struct sip_outbound_registration_client_state {
392
392
char * transport_name ;
393
393
/*! \brief The name of the registration sorcery object */
394
394
char * registration_name ;
395
+ /*! \brief Expected time of registration lapse/expiration */
396
+ unsigned int registration_expires ;
395
397
};
396
398
397
399
/*! \brief Outbound registration state information (persists for lifetime that registration should exist) */
@@ -738,6 +740,7 @@ static void schedule_registration(struct sip_outbound_registration_client_state
738
740
(int ) info .client_uri .slen , info .client_uri .ptr );
739
741
ao2_ref (client_state , -1 );
740
742
}
743
+ client_state -> registration_expires = ((int ) time (NULL )) + seconds ;
741
744
}
742
745
743
746
static void update_client_state_status (struct sip_outbound_registration_client_state * client_state , enum sip_outbound_registration_status status )
@@ -2261,7 +2264,7 @@ static int cli_print_header(void *obj, void *arg, int flags)
2261
2264
ast_assert (context -> output_buffer != NULL );
2262
2265
2263
2266
ast_str_append (& context -> output_buffer , 0 ,
2264
- " <Registration/ServerURI..............................> <Auth..........> <Status.......>\n" );
2267
+ " <Registration/ServerURI..............................> <Auth.................... > <Status.......>\n" );
2265
2268
2266
2269
return 0 ;
2267
2270
}
@@ -2272,19 +2275,22 @@ static int cli_print_body(void *obj, void *arg, int flags)
2272
2275
struct ast_sip_cli_context * context = arg ;
2273
2276
const char * id = ast_sorcery_object_get_id (registration );
2274
2277
struct sip_outbound_registration_state * state = get_state (id );
2278
+ int expsecs ;
2275
2279
#define REGISTRATION_URI_FIELD_LEN 53
2276
2280
2277
2281
ast_assert (context -> output_buffer != NULL );
2282
+ expsecs = state ? state -> client_state -> registration_expires - ((int ) time (NULL )) : 0 ;
2278
2283
2279
- ast_str_append (& context -> output_buffer , 0 , " %-s/%-*.*s %-16s %-16s\n" ,
2284
+ ast_str_append (& context -> output_buffer , 0 , " %-s/%-*.*s %-26s %-16s %s%d%s \n" ,
2280
2285
id ,
2281
2286
(int ) (REGISTRATION_URI_FIELD_LEN - strlen (id )),
2282
2287
(int ) (REGISTRATION_URI_FIELD_LEN - strlen (id )),
2283
2288
registration -> server_uri ,
2284
2289
AST_VECTOR_SIZE (& registration -> outbound_auths )
2285
2290
? AST_VECTOR_GET (& registration -> outbound_auths , 0 )
2286
2291
: "n/a" ,
2287
- (state ? sip_outbound_registration_status_str (state -> client_state -> status ) : "Unregistered" ));
2292
+ (state ? sip_outbound_registration_status_str (state -> client_state -> status ) : "Unregistered" ),
2293
+ state ? " (exp. " : "" , abs (expsecs ), state ? (expsecs < 0 ? "s ago)" : "s)" ) : "" );
2288
2294
ao2_cleanup (state );
2289
2295
2290
2296
if (context -> show_details
0 commit comments