[SR-Users] Diversion header authentication

Daniel-Constantin Mierla miconda at gmail.com
Tue Apr 9 16:43:56 CEST 2013


Hello,

just adding that the tobody transformation could be handy to extract the 
user or uri part of a Diversion header, not to fight with subst expressions:

- 
http://www.kamailio.org/wiki/cookbooks/devel/transformations#to-body_transformations

Cheers,
Daniel

On 4/9/13 3:16 PM, Morten Isaksen wrote:
> Hi,
>
> I have not tested this, but try:
>
> $avp(s:divhdr) = $(hdr(Diversion)[$var(i)]);
> avp_subst("$avp(s:divhdr)", "/.*sip:\+45(.*)(@.*)/\1/"); # Extract 
> number between +45 and @
>
> if (is_user_in("$avp(s:divhdr)", "1") { ... }
>
> Please note that there can be more than one Diverseion header. In that 
> case you can use:
>
>                         $var(i)=0;
>                         while($(hdr(Diversion)[$var(i)]) != $null ) {
>                                 $avp(s:divhdr) = 
> $(hdr(Diversion)[$var(i)]);
>                                 xlog("L_WARN", "$avp(s:divhdr)");
>
>
>                                 $var(i) = $var(i) +1;
>                         }
>
>
>
> /Morten
>
>
>
>
>
> On Tue, Apr 9, 2013 at 11:12 AM, phillman25 <phillman25 at gmail.com 
> <mailto:phillman25 at gmail.com>> wrote:
>
>     Dear List
>
>     I am currently using the group module to authenticate inbound
>     calls using the From header using the below code:
>
>              if (!is_user_in("From", "1")) {
>              sl_send_reply("403", "NOT ALLOWED");
>              exit;
>              };
>              };
>
>     I want to now authenticate the Diversion header, when the call is
>     diverted, the same way as above using the group module how could i
>     proceed with this?
>
>     thanking you in advance
>     Phillip
>
>
>
>     _______________________________________________
>     SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
>     list
>     sr-users at lists.sip-router.org <mailto:sr-users at lists.sip-router.org>
>     http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
>
>
> -- 
> Morten Isaksen
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, April 16-17, 2013, Berlin
  - http://conference.kamailio.com -

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130409/312464fc/attachment.htm>


More information about the sr-users mailing list