Hello,
We're running into problems with pjsip being unable to parse a SIP URI with a '@' character in URI parameters.
FWIW reproduction code (tested with 2.5.5 and 2.6):
#include <pjsip.h>
int main(int argc, char** argv) {
if (argc < 2) {
fprintf(stderr, "Missing URI\n");
return 1;
}
pj_init();
pj_caching_pool cp;
pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
pj_pool_t* pool = pj_pool_create(
&cp.factory, // pool factory
"test", // pool name
4096, // init size
512, // increment size
NULL // callback on error
);
pjsip_endpoint* endpt;
pjsip_endpt_create(&cp.factory, "test", &endpt);
char* uri = argv[1];
printf("Trying to parse (%d): %s\n", strlen(uri), uri);
pjsip_uri* parsed_uri = pjsip_parse_uri(pool, uri, strlen(uri), PJSIP_PARSE_URI_AS_NAMEADDR);
if (parsed_uri)
printf("success\n");
else
printf("failure\n");
return 0;
}
A call to this program like this will print 'success': ./pjsip-bug '<sip:123@192.168.1.1>'
A call to this program like this will print 'failure': ./pjsip-bug '<sip:123@192.168.1.1;foo;bar=baz@quux>'
Currently our workaround consists of replacing all '@' characters with '_' just so that we can actually parse the URI, because (fortunately) we currently do not utilize the parameters in which these characters tend to occur in. However, we would like a better (more relaxed parsing) solution from pjsip in case other restricted characters are sent in URI parameters. Is such a (feasible) solution already possible?
_______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@xxxxxxxxxxxxxxx http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org