Daniel,

 

I just did some tests the same way as Duarte’s and the parameter I think you mentioned ({uri.uparam}: “Return the value of user parameter”) does not work as expected:

 

URI sip:123456789;test=param;phone-context=abcd@1.1.1.1;user=phone

$(var(URI){uri. uparam}) = "phone"

 

URI sip:123456789;test=param;phone-context=abcd@1.1.1.1

$(var(URI){uri. uparam}) = ""

 

Am I missing something?

 

--

Julien

De : sr-users <sr-users-bounces@lists.kamailio.org> au nom de Duarte Rocha <duarterocha91@gmail.com>
Répondre à : "Kamailio (SER) - Users Mailing List" <sr-users@lists.kamailio.org>
Date : lundi 18 novembre 2019 à 14:19
À : Daniel-Constantin Mierla <miconda@gmail.com>
Cc : "Kamailio (SER) - Users Mailing List" <sr-users@lists.kamailio.org>
Objet : Re: [SR-Users] Problem with URI transformations

 

As far as i know, the URI transformations only provide the "user" parameter, not the user part parameters.

 

What i'm trying to do i build an object for Diversion and Contact. To do that i'm trying to parse the header and URI into it's elements. 

 

URI Example : <sip:123456;parameter=hello;parameter2=hey@1.1.1.1;kamailio=test>

 

Elements : 

  User : 123456

  User Parameters : parameter=hello;parameter2=hey

  Domain : 1.1.1.1

  URI Parameters = kamailio=teste

To achieve this i'm using uri.user , uri.domain , uri.port and uri.params.

 

uri.user will normally return "123456;parameter=hello;parameter2=hey" and after that i mannually split the user and teh user params. However, in the event of a TEL_URI with user=phone on uri.params, "parameter=hello;parameter2=hey" won't be present in the uri.user.

 

It seems like i should be doing a special case for when user=phone is present. What do you think ?

 

A segunda, 18/11/2019, 12:29, Daniel-Constantin Mierla <miconda@gmail.com> escreveu:

Hello,

check the URI transformation docs, iirc there is an option to get user parameters.

If not, can you give an example of what params you want to work with, likely you can get it with other transformations...

Cheers,
Daniel

On 18.11.19 13:13, Duarte Rocha wrote:

Greetings,

 

My issue was related to user part parameters being lost. I didn't know that the parse would work differently when user=phone was present. Thank you for pointing that out.

 

That being said, how should i proceed if i want to check user part parameters in this scenario? Like phone-context for example. 

 

Best Regards

 

A sexta, 15/11/2019, 20:38, Daniel-Constantin Mierla <miconda@gmail.com> escreveu:

Hello,

what did you expect to be? To be able to comment on the exact topic.

user=phone changes the structure of the URI in something similar to tel URI.

Cheers,
Daniel

On 15.11.19 17:51, Duarte Rocha wrote:

Greetings, 

 

I'm trying to parse some URI info on Kamailio but i'm having some troubles the URI transformations.

 

Here i have two examples of URIS from which i'm trying to extract username(with user parameters included) and URI Parameters : 

- sip:123456789;test=param@1.1.1.1

- sip:123456789;test=param@1.1.1.1;user=phone

In order to test this i made the following code : 

 

$var(URI) = "sip:123456789;test=param@1.1.1.1";

xerr("DEBUG 1 : URI $var(URI)"); 

$var(User) = $(var(URI){uri.user}); 

$var(Parameters) = $(var(URI){uri.params}); 

xerr("DEBUG 1 : User = $var(User)");

xerr("DEBUG 1 : Parameters = $var(Parameters)");

$var(URI) = "sip:123456789;test=param@1.1.1.1;user=phone";

xerr("DEBUG 2 : URI $var(URI)"); ;

$var(User) = $(var(URI){uri.user});

$var(Parameters) = $(var(URI){uri.params}); 

xerr("DEBUG 2 : User =  $var(User)"); 

xerr("DEBUG 2 : Parameters = $var(Parameters)");

The result is the following : 

DEBUG 1 : URI sip:123456789;test=param@1.1.1.1

DEBUG 1 : User = 123456789;test=param

DEBUG 1 : Parameters =

 

DEBUG 2 : URI sip:123456789;test=param@1.1.1.1;user=phone

DEBUG 2 : User =  123456789

DEBUG 2 : Parameters = user=phone

If the URI has parameters, the User parameters won't be included in the User part.

 

Is this a bug or is it working as intended? I'm running Kamailio 5.2.0 .

 

Thank you for your time.

 

Best Regards,

 

Duarte Rocha



_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com