< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index Next in Thread >

Re: [reSIProcate-users] Checking if user=ip or user=phone in To/From field


Andrew Wood wrote:
How do you do this? I thought it was maybe the userParameters() method in the Uri class but it hasnt returned anything/

userParameters() will return parameters in the user portion of the URI. So, for example, if you have a URI like this:

   sip:adam;foo=bar@xxxxxxxxxxx;user=phone


Then you could get the "foo=bar" part of the user with uri.userParameters().

What you want is uri.param(p_user). Be sure to check uri.exists(p_user) before trying to read it (unless you're prepared to catch the exception that's thrown when you try to read a non-existent parameter).

/a