If regc.check_contact is disabled, and no Expires header has been found, but the server does return one single Contact header, assumes that the server is broken/unable to return the correct Contact. In this case, get the expiration from the single Contact header in the response (thanks Alan Bond)
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1946 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip/src/pjsip-ua/sip_reg.c b/pjsip/src/pjsip-ua/sip_reg.c
index a183f8f..b015170 100644
--- a/pjsip/src/pjsip-ua/sip_reg.c
+++ b/pjsip/src/pjsip-ua/sip_reg.c
@@ -769,6 +769,19 @@
}
}
+ /* If regc.check_contact is disabled, and no Expires header
+ * has been found, but the server does return one single
+ * Contact header, assumes that the server is broken/unable to
+ * return the correct Contact. In this case, get the expiration
+ * from the single Contact header in the response.
+ */
+ if (expiration==NOEXP && !pjsip_cfg()->regc.check_contact &&
+ contact_cnt==1)
+ {
+ if (contact[0]->expires >= 0)
+ expiration = contact[0]->expires;
+ }
+
/* When the response doesn't contain our Contact header, that
* means we have been unregistered.
*/