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
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@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@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
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_transfo...
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@gmail.com mailto:phillman25@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@lists.sip-router.org <mailto:sr-users@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@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users