Skip to content

Commit 2cd2a45

Browse files
committed
[uac_registrant] store the configured "expires" and use it for each re-REGISTER
...in order to avoid decreasing it if the registar is reducing it. Reported by @sindy39 Fixes #3659
1 parent 04637cb commit 2cd2a45

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

modules/uac_registrant/reg_records.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,13 @@ int reg_build_sr_identifier(const str *aor, const str *contact,
8989
}
9090

9191
void reg_print_record(reg_record_t *rec) {
92-
LM_DBG("checking uac=[%p] state=[%d][%.*s] expires=[%d]"
92+
LM_DBG("checking uac=[%p] state=[%d][%.*s] expires=[%d/%d]"
9393
" last_register_sent=[%d] registration_timeout=[%d]"
9494
" auth_user[%p][%d]->[%.*s] auth_password=[%p][%d]->[%.*s]"
9595
" sock=[%p] clustering=[%.*s/%d] enabled=[%s]\n",
9696
rec, rec->state,
97-
uac_reg_state[rec->state].len, uac_reg_state[rec->state].s, rec->expires,
97+
uac_reg_state[rec->state].len, uac_reg_state[rec->state].s,
98+
rec->expires, rec->wanted_expires,
9899
(unsigned int)rec->last_register_sent, (unsigned int)rec->registration_timeout,
99100
rec->auth_user.s, rec->auth_user.len, rec->auth_user.len, rec->auth_user.s,
100101
rec->auth_password.s, rec->auth_password.len,
@@ -244,6 +245,7 @@ int add_record(uac_reg_map_t *uac, str *now, unsigned int mode,
244245

245246
memset(record, 0, size);
246247

248+
record->wanted_expires = uac->expires;
247249
record->expires = uac->expires;
248250

249251
td = &(record->td);

modules/uac_registrant/reg_records.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ typedef struct reg_record {
8484
str auth_user;
8585
str auth_password;
8686
unsigned int state;
87+
unsigned int wanted_expires;
8788
unsigned int expires;
8889
time_t last_register_sent;
8990
time_t registration_timeout;

modules/uac_registrant/registrant.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ int send_register(unsigned int hash_index, reg_record_t *rec, str *auth_hdr)
831831
cb_param->uac = rec;
832832

833833
/* get the string version of expires */
834-
expires = int2str((unsigned long)(rec->expires), &expires_len);
834+
expires = int2str((unsigned long)(rec->wanted_expires), &expires_len);
835835

836836
p = extra_hdrs.s;
837837
memcpy(p, contact_hdr.s, contact_hdr.len);

0 commit comments

Comments
 (0)