[Asterisk-code-review] res pjsip: Validate that contact uris start with sip: or sips: (asterisk[13])

Joshua Colp asteriskteam at digium.com
Thu Apr 23 10:28:25 CDT 2015


Joshua Colp has posted comments on this change.

Change subject: res_pjsip:  Validate that contact uris start with sip: or sips:
......................................................................


Patch Set 2: Code-Review-1

(1 comment)

I think this also exposes a problem in the create_out_of_dialog_request function. It currently assumes an endpoint will always be passed in and this is no longer true.

https://gerrit.asterisk.org/#/c/232/2/res/res_pjsip/location.c
File res/res_pjsip/location.c:

Line 309: 	if (!pjsip_parse_hdr(pool, &HCONTACT, contact_uri.ptr, contact_uri.slen, NULL)) {
I think instead of doing our own check we can leverage this instead. This will return a pjsip_contact_hdr which contains the parsed URI.

If no contact OR no URI is present OR if the scheme is not sip: or sips: then validation has failed.

There's also handy macros for this:

PJSIP_URI_SCHEME_IS_SIP
PJSIP_URI_SCHEME_IS_SIPS


-- 
To view, visit https://gerrit.asterisk.org/232
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifc17d16a4923e1045d37fe51e43bbe29fa556ca2
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list