|
From: | Aymeric Moizard |
Subject: | Re: [osip-dev] Sip uri parsing |
Date: | Mon, 23 Oct 2017 12:47:51 -0600 |
Hi Aymeric,
Thank you for quick response.
Indeed osip is parsing correctly.
Looks like this uri is result of tel: to sip: conversion (even described in RFC https://tools.ietf.org/html/rfc3261#section-19.1.6 ).
I will have to parse/analyze userinfo portion on my own.
I was confused with this "string" portion, because most uris I handle are tel: and in this case osip is just copying whole uri into "string".
Now it is more clear for me...
Best Regards,
Karol
On 23.10.2017 09:32, Aymeric Moizard wrote:
2017-10-22 17:58 GMT-06:00 Karol Rosłaniec <address@hidden>:
Hi,
Hi Karol!This looks fine to me.When analyzing IMS implementation, I've found out that osip library is (probably) incorrectly parsing sip uri.
Let's consider the field "From" like below (this is a real-world example):
From: <sip:0123456789;phone-context=ims.mnc001.mcc123.3gppnetwork. ;tag=address@hidden ork.org;user=phone> 0e20s135-DD-1008-OAC-24 is parsed by osip2 library (git master) to osip_uri_t:
scheme=sip username=0123456789;phone-context=ims.mnc001.mcc123.3gppnetw ork.org passowrd= host=ims.mnc001.mcc123.3gppnetwork.org port= string= url_params=1 url_headers=
The BNF is this:
SIP-URI = "sip:" [ userinfo ] hostport
uri-parameters [ headers ]
SIPS-URI = "sips:" [ userinfo ] hostport
uri-parameters [ headers ]
userinfo = ( user / telephone-subscriber ) [ ":" password ] "@"
user = 1*( unreserved / escaped / user-unreserved )
user-unreserved = "&" / "=" / "+" / "$" / "," / ";" / "?" / "/"
In osip, the username is the "(user / telephone-subscriber)". And thus it can
contains ";" and "=". This is why the complete "0123456789;phone-context=ims.mnc001.mcc123.3gppnetwork.org "
ends up being the "username".
Obviously I would expect rather "string=0123456789"
The "string" parameter is reserved to other URL scheme. For examplefor "http", "mailto", or any other url that osip is not able to parse. If suchURL is seen, the whole url will be saved untouched in "string". For SIPurl, "string" is always empty.And additionally two params: "phone-context" and "user".
I'm not sure what are the parsing rules according to RFC and if "@" sign is allowed inside phone-context.
The @ is not allowed (I didn't strictly verified... but I guess it is): according to me, the @is the end of userinfo in your example.
But even if it is not, the example above is from real IMS implementation and somehow I have to handle it even if it's not standard compliant.
Do you have any plans to fix or improve osip2 uri parsing methods?
I don't see any error here.
If you want to extract the number from "0123456789;phone-context=ims.mnc001.mcc123.3gppnetwork.org "you need to do it yourself. I do not provide a specific parser for such string!
All good on osip side? Just a little more work for you?Right?Aymeric
Best Regards,
Karol Roslaniec
_______________________________________________
osip-dev mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/osip-dev
--
_______________________________________________
osip-dev mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/osip-dev
[Prev in Thread] | Current Thread | [Next in Thread] |