[Users] AVPOPS manipulating header fields

Martin Kjeldsen martin.kjeldsen at cuatro.dk
Thu Apr 20 14:39:33 CEST 2006


Hi Bogdan

Thanks for the reply, and I'm sorry for first writing back now, but I've 
just come home from my easter holiday ;-).

I've been looking over what you've written, and there's some parts I'm 
not sure how to comprehend!

You tell me not to use the from uri as a string uuid, but as a key?

How would I do this?


I'm using the OpenSER 1.0.0, and are using this format now:

avp_db_load("$from","s:pai/$scheme0");

to load the username from the alias table into memory, via the scheme below:

modparam("avpops", "db_scheme", 
"scheme0:uuid_col=contact;value_col=username;
  value_type=string;table=aliases")

But still I'm not able to pull out the username from the aliases table.


Am I misunderstanding what you say?


Cause as I see it my usage of the avp_db_load, is exactly the same as yours!

And when you talk about populating the username and domain fields 
instead of the uuid in DB!

What do you mean by that?

As I understand, all I need is to use the from part to index the aliases 
table, in order to get the alias (username), which is connected to the 
from address (contact). And then push it to the P-Asserted-Header field!
So I cant see where the need to populate any username and domain fields 
in the DB!


Can you help me to understand this :-).


Thank you in advance.


Kind regards
Martin



Hi Martin,

do not use the from uri as a string uuid to perform loading, but use it
as key (username, domain):
     avp_db_load("$from","s:pai/$scheme0");   in 1.0.x
or
     avp_db_load("$fu","s:pai/$scheme0");   in 1.1.x

in DB you will have to populate the username and domain fields instead
of uuid.

regards,
bogdan

Martin Kjeldsen wrote:

 > > Hi all
 > >
 > > I am in the need for a little assistance on how to best use some data
 > > taken from a invite request, and then create an appropriate AVP.
 > >
 > > My idea was to take the from header field,
 > >
 > >         avp_write("$from", "$fromuri");
 > >
 > > Then use it to extract the alias which belongs to this user, and
 > > create the AVP,
 > >
 > >         avp_db_load("$fromuri","s:pai/$scheme0");
 > >
 > > And then incorperate it into another AVP, in order to add a callerid,
 > > via P-Asserted-Identity,
 > >
 > >        avp_printf("i:10","<sip:$avp(s:pai)@sip.domain.com>");
 > >        remove_hf("P-Asserted-Identity"); #remove org. hdr
 > >        avp_pushto("$P-Asserted-Identity/request","i:10"); # set new hdr
 > >
 > > My question is, how do I best remove the port (eg. :5060) indication
 > > at the end of the from header field?
 > > Because the clients on a private IP range and my alias table does not
 > > carry the port numbers (eg. 88888888 at sip.domain.com ).
 > >
 > > So I need to manipulate the $fromuri, by removing the port indication,
 > > before i do the avp_db_load!
 > >
 > > I was thinking of using the avp_subst function, but cant quite seem to
 > > get it to work.
 > >
 > >
 > > Can anyone help me with a smart way to solve this problem?
 > >
 > >
 > > All help greatly appreciated.
 > >
 > >
 > > Kind regards
 > > Martin Kjeldsen





More information about the Users mailing list