[OpenSER-Users] manipulate INVITES

Patrick Miccio patrick.miccio at upc.at
Wed Jun 27 15:42:26 CEST 2007


Hello everybody,

since this is my first post and I am kinda new to OpenSER, bare with
me ;)

I have been trying to manipulate invites for the last 2 days and cant
find the proper way to reach what is expected.

my goal:
send invites to specific PBX (Asterisk for example) with only the
desired extension and not the full username, this is based on a
avp_check if that UAC needs only extensions, some do, some don't ;)


Here is what I do:
First off all I extract the real username (in subscribers) and
extension from the R-URI and place it in "$avp(callee_user)" and
"$avp(callee_exten)"

#############
my solution No1 is "working"

 avp_pushto("$ru/username", "$avp(callee_user)");
 avp_copy("$avp(callee_exten)","$avp(callee_tmp)/gd");
 if( subst('/^To:(.*)sip:[^@]*(@[a-zA-Z0-9.]+.*)$/To:\1sip:$avp(callee_tmp)\2/ig') ){};

->	callee_user is 012345678
->	callee_exten is 200
->	$ru is sip:012345678 at xxx.xxx.xxx.xxx;user=phone
->	subst [ To: <sip:012345678200 at xxx.xxx.xxx.xxx;user=phone> ]  
	with [To: <sip:200 at xxx.xxx.xxx.xxx;user=phone> ]

Those 3 lines work "fine", the testing Asterisk PBX gets the call
correctly. The problem is that I should not change the "To:" part, it
will make problems with call forwards etc...


#############
my solution No.2 NOT working.

if (subst_uri('/^sip:([0-9]+)@(.*)$/sip:$avp(callee_tmp)@\2;/i')){$};

doesn't work because OpenSER of course cant find 200 in the userloc....

#############

Generally I would think that changing the INVITE uri itself like in
solution No.2 is the best way, couldn't find any proper way to make that
work though.

Does anyone have an idea how to realize this properly, or even if this
makes sense ;) ?

thx in advance,

Patrick.




More information about the Users mailing list