Unfortunately not.  pjsip_parse_uri fails if you pass it a string which has anything after the URI.  The above code is simply finding the end of the URI so it can pass in a string of the right length.  The better would probably be to implement a custom parser for this header rather than leave it as a string header, but as I found from the identity headers, this turns in to a lot of work.