[SR-Users] Bug with avp's or feature ?

Daniel-Constantin Mierla miconda at gmail.com
Fri Apr 30 21:35:32 CEST 2010


Hello,

On 4/26/10 5:59 PM, Tristan Mahé wrote:
> Hi guys,
>
> I was debugging an install on kamailio 3.0, and was asked to add per 
> user custom outbound proxies.
>
> To do so, I used load_credentials from auth_db to store the custom 
> route in an avp, as you can see in the relevant part below.
>
> I noticed a strange thing, POINT 1 show "OK", but POINT 2 shows "KO".
>
> Is it a normal behaviour that avp got deleted after the Dialog PART ?
>
> Regards,
>
> Gled
>
> --------------------------------------------------------------------------------- 
>
> modparam("auth_db", "load_credentials", 
> "$avp(s:proxy)=outbound_override;$avp(s:rights)=rights;$avp(s:max_out)=max_out") 
>
>
> route[INVITE_FROM_UAC] {
>   if (!www_authorize("", "my_user_view")) {
>     www_challenge("", "1");
>   }
>
>   if ( !($tU =~ $avp(s:rights_ereg)) ) {
>     sl_send_reply("403","Forbidden");
>     t_release();
>     exit();
>   }

did you create a transaction, or why is the reason for t_release() here? 
Just use send_reply(...) everywhere and forget about stateless/stateful 
state at that time, just be sure tm module is loaded before sl module.

>   /* POINT 1 */
>   if (  is_avp_set("$avp(s:proxy)")  ) {
>     xlog("OK");
>   }
>   else {
>     xlog("KO");
>   }
>
>   get_profile_size("outbound","$fU","$avp(calls_out)");
>
>   if ( $avp(s:max_out) != 0 && $avp(calls_out) >= $avp(s:max_out) ) {
>     t_reply("403","Too Many calls");
>     t_release();
>     exit();
>   }
>   /* Dialog PART */
>   if (!is_in_profile("outbound")) {
>     dlg_manage();
>     set_dlg_profile("outbound","$fU");
>   }
>
>   /* POINT 2 */
>   if (  is_avp_set("$avp(s:proxy)")  ) {
>     xlog("OK");
>   }
>   else {
>     xlog("KO");
>   }
> }

Can you run with higher debug mode and use avp_print():

http://kamailio.org/docs/modules/stable/modules/avpops.html#id2948013

Will print the entire list of avps. Post the output for entire sip 
message processing in route[INVITE_FROM_UAC].

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
* http://www.asipto.com/
* http://twitter.com/miconda
* http://www.linkedin.com/in/danielconstantinmierla





More information about the sr-users mailing list