[Users] P-Asserted-Identity

Ty Manthey ty at doublehorncommunications.com
Wed May 24 15:06:55 CEST 2006


Thanks Klaus, you pointed me in the right direction, I dropped my p_assert
table and used the subscriber table instead. If you guys wouldn't mind
looking this over for me when you get a chance, I would appreciate it. It
seems to be working just fine, but I wouldn't mind a second opinion if there
is a better way to do something. Here is what I ended up with:

# ------------- avpops params --------------------

# define "from_hdr" as an alias to AVP ID 12
# 
modparam("avpops", "avp_aliases", "from_hdr=s:12")
modparam("avpops", "avp_table", "avptable")
modparam("avpops", "uuid_column", "contact")
modparam("avpops", "username_column", "username")
modparam("avpops", "domain_column", "domain")
modparam("avpops", "db_scheme",
"scheme0:table=subcriber;uuid_col=uuid;username_col=username;value_type=stri
ng")

I moved this up to the "if method=register" section after my www challenge:
# write sip_uri "from" as avp "from_hdr"
			avp_write("$from", "from_hdr");

And this is after "if method=invite":

#  Remove P-Asserted-Identity if it exist
				#
				remove_hf("P-Asserted-Identity");

				# If Privacy header is set to ID make
anonymous
				if (search("[Pp]rivacy:[^@][Ii][Dd][^@];")
				{
					append_hf("P-Asserted-Identity:
<anonymous at anonymous.invalid>");
	
uac_replace_from("Anonymous","sip:anonymous at anonymous.invalid");
				}

				# Else insert P-Asserted-Identity

				if (!search("[Pp]rivacy:[^@][Ii][Dd][^@];")
				{

				# P-Asserted-Identity Insertion
				#
					avp_printf("s:12",
"<sip:$fU at 64.192.174.8>");
					avp_pushto("$P-Asserted-Identity",
"s:12");
				}

Ty Manthey

-----Original Message-----
From: Klaus Darilion [mailto:klaus.mailinglists at pernau.at] 
Sent: Tuesday, May 23, 2006 5:05
To: Ty Manthey
Cc: users at openser.org
Subject: Re: [Users] P-Asserted-Identity

Ty Manthey wrote:
> This is kicking my butt.
> 
> OpenSER 1.0.1
> 
> I just want the P-Asserted-Identity field to populate with info it gets
out
> of the "from" header.
> 
> modules loaded:
> loadmodule "/usr/lib/openser/modules/mysql.so"
> 
> loadmodule "/usr/lib/openser/modules/avpops.so"
> loadmodule "/usr/lib/openser/modules/sl.so"
> loadmodule "/usr/lib/openser/modules/tm.so"
> loadmodule "/usr/lib/openser/modules/rr.so"
> loadmodule "/usr/lib/openser/modules/maxfwd.so"
> loadmodule "/usr/lib/openser/modules/usrloc.so"
> loadmodule "/usr/lib/openser/modules/registrar.so"
> loadmodule "/usr/lib/openser/modules/textops.so"
> 
> avpops params:
> 
> modparam("avpops", "avp_url", "mysql://openser:xxxxxxx@localhost/openser")
> modparam("avpops", "avp_aliases", "from=s:from")
> modparam("avpops", "avp_table", "avptable")
> modparam("avpops", "uuid_column", "contact")
> modparam("avpops", "username_column", "username")
> modparam("avpops", "domain_column", "domain")
> modparam("avpops", "attribute_column", "attribute")
> modparam("avpops", "value_column", "value")
> modparam("avpops", "type_column", "type")
> modparam("avpops", "db_scheme",
>
"scheme0:table=p_assert;uuid_col=uuid;username_col=username;value_type=strin
> g")
> 
> ( I built a table "p_assert" in the openser database with the above
columns,
> varchar(255) )
> 
> 
> attempted insertion:
> 
> # P-Asserted-Identity Insertion
> 				#
> 				avp_write("$from", "s:from");
> 				avp_db_load("$from", "s:pai/p_assert");
> 				avp_printf("s:from",
> "<sip:$fu(s:pai)@64.192.174.8>");		

Not sure if this overwrite the previously created AVP or it creates a 
second one with the same name.

Further - what is the problem? Pushing into the header or fetching from DB?

Have you tried it without loading from DB? If this works, make it 
dynamically loading from DB.

btw: I put the PAI into the rpid column in the subscriber table. Thus, 
the s:rpid gets loaded during authentication.

regards
klaus

> 				remove_hf("P-Asserted-Identity");
> 				#avp_pushto("$P-Asserted-Identity/request",
> "s:pai");
> 				append_hf("P-Asserted-Identity:
> <sip:7034633348 at 64.192.174.8>\r\n");
> 				log(1,"***P asserted ID  placed *** \n");
> 
> I think it's obvious I know enough to get myself into trouble, but I
thought
> populating the P-asserted header field with info out of the "From" header
> wouldn't be this complicated. What am I missing/doing wrong?
> 
> Thanks.
> 
> 
> Ty Manthey
> 
> 
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users





More information about the Users mailing list