summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsua-lib/pjsua_acc.c
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-08-05 20:14:39 +0000
committerBenny Prijono <bennylp@teluu.com>2008-08-05 20:14:39 +0000
commite73b94482189299eaf05fdca2850650d1f033663 (patch)
tree63c06c4610e9003ce8488437218030119d13693c /pjsip/src/pjsua-lib/pjsua_acc.c
parentc99d9cd5ab9be3bce89f84a54abbe87348529a2e (diff)
Ticket #585: Handle non-SIP URI in Contact header of incoming INVITE and SUBSCRIBE requests
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2194 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_acc.c')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_acc.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c
index a234964c..f2853fa6 100644
--- a/pjsip/src/pjsua-lib/pjsua_acc.c
+++ b/pjsip/src/pjsua-lib/pjsua_acc.c
@@ -1674,15 +1674,30 @@ PJ_DEF(pj_status_t) pjsua_acc_create_uas_contact( pj_pool_t *pool,
sip_uri = (pjsip_sip_uri*)
pjsip_uri_get_uri(rdata->msg_info.record_route->name_addr.uri);
} else {
+ pjsip_hdr *pos = NULL;
pjsip_contact_hdr *h_contact;
pjsip_uri *uri = NULL;
- /* Otherwise URI is Contact URI */
- h_contact = (pjsip_contact_hdr*)
- pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT,
- NULL);
- if (h_contact)
- uri = (pjsip_uri*) pjsip_uri_get_uri(h_contact->uri);
+ /* Otherwise URI is Contact URI.
+ * Iterate the Contact URI until we find sip: or sips: scheme.
+ */
+ do {
+ h_contact = (pjsip_contact_hdr*)
+ pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT,
+ pos);
+ if (h_contact) {
+ uri = (pjsip_uri*) pjsip_uri_get_uri(h_contact->uri);
+ if (!PJSIP_URI_SCHEME_IS_SIP(uri) &&
+ !PJSIP_URI_SCHEME_IS_SIPS(uri))
+ {
+ pos = (pjsip_hdr*)h_contact->next;
+ if (pos == &rdata->msg_info.msg->hdr)
+ h_contact = NULL;
+ } else {
+ break;
+ }
+ }
+ } while (h_contact);
/* Or if Contact URI is not present, take the remote URI from