[Users] AVPOPS manipulating header fields

Martin Kjeldsen martin.kjeldsen at cuatro.dk
Tue Apr 11 18:42:22 CEST 2006


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