[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [osip-dev] Sip uri parsing

From: Karol Rosłaniec
Subject: Re: [osip-dev] Sip uri parsing
Date: Mon, 23 Oct 2017 16:56:52 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

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,

On 23.10.2017 09:32, Aymeric Moizard wrote:

2017-10-22 17:58 GMT-06:00 Karol Rosłaniec <address@hidden>:


Hi Karol! 

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.address@hidden3gppnetwork.org;user=phone>;tag=0e20s135-DD-1008-OAC-24

is parsed by osip2 library (git master) to osip_uri_t:

 This looks fine to me.

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 example
for "http", "mailto", or any other url that osip is not able to parse. If such
URL is seen, the whole url will be saved untouched in "string". For SIP
url, "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?

Best Regards,
Karol Roslaniec

osip-dev mailing list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]