[Asterisk-code-review] res_pjsip_registrar: Don't specify an expiration for static contacts. (asterisk[master])

Kevin Harwell asteriskteam at digium.com
Tue Jul 28 09:48:23 CDT 2020


Kevin Harwell has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14707 )

Change subject: res_pjsip_registrar: Don't specify an expiration for static contacts.
......................................................................

res_pjsip_registrar: Don't specify an expiration for static contacts.

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
---
M res/res_pjsip_registrar.c
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Kevin Harwell: Looks good to me, approved; Approved for Submit
  George Joseph: Looks good to me, but someone else must approve



diff --git a/res/res_pjsip_registrar.c b/res/res_pjsip_registrar.c
index be40a20..44b59c1 100644
--- a/res/res_pjsip_registrar.c
+++ b/res/res_pjsip_registrar.c
@@ -233,7 +233,11 @@
 	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",

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14707
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I9f0e45eb2ccdedc9a0df5358634a19ccab0ad596
Gerrit-Change-Number: 14707
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200728/5fc2b86d/attachment.html>


More information about the asterisk-code-review mailing list