]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_registrar: Don't specify an expiration for static contacts.
authorJoshua C. Colp <jcolp@sangoma.com>
Wed, 22 Jul 2020 09:41:59 +0000 (06:41 -0300)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Mon, 27 Jul 2020 22:44:42 +0000 (17:44 -0500)
Statically configured contacts on an AOR don't have an expiration
time so when adding them to the resulting 200 OK if an endpoint
registers ensure they are marked as such.

ASTERISK-28995

Change-Id: I9f0e45eb2ccdedc9a0df5358634a19ccab0ad596

res/res_pjsip_registrar.c

index 571b0e9a3469ce883b27623e0898fb0c5f229096..625f8126347f1e0b1df4b6a16d77334484994da6 100644 (file)
@@ -233,7 +233,11 @@ static int registrar_add_contact(void *obj, void *arg, int flags)
        if (parsed && (PJSIP_URI_SCHEME_IS_SIP(parsed) || PJSIP_URI_SCHEME_IS_SIPS(parsed))) {
                pjsip_contact_hdr *hdr = pjsip_contact_hdr_create(tdata->pool);
                hdr->uri = parsed;
-               hdr->expires = ast_tvdiff_ms(contact->expiration_time, ast_tvnow()) / 1000;
+               if (!ast_tvzero(contact->expiration_time)) {
+                       hdr->expires = ast_tvdiff_ms(contact->expiration_time, ast_tvnow()) / 1000;
+               } else {
+                       hdr->expires = PJSIP_EXPIRES_NOT_SPECIFIED;
+               }
                pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr *) hdr);
        } else {
                ast_log(LOG_WARNING, "Skipping invalid Contact URI \"%.*s\" for AOR %s\n",