[Spce-user] change forwarder_cli_userprov if not matching subscriber/alias

sven.roehrig at web.de sven.roehrig at web.de
Thu Jan 3 08:30:40 EST 2019


Hi,

 

is there something wrong with the if else check ordering?

 

        if(avp_check("$var(userprov_cli)",
"fm/$xavp(caller_contract_prefs[0]=>allowed_clis[*])/g"))

        {

                xlog("L_NOTICE", "$var(ccli_desc) '$var(userprov_cli)'
accepted (matched contract preference) - R=$ru ID=$ci UA='$ua'\n");

        }

 

        else if(avp_check("$var(userprov_cli)",
"fm/$xavp(caller_real_prefs[0]=>allowed_clis[*])/g"))

        {

                xlog("L_NOTICE", "$var(ccli_desc) '$var(userprov_cli)'
accepted (matched user preference) - R=$ru ID=$ci UA='$ua'\n");

        }

 

        else if(pv_isset("$avp(s:skip_upn_check_on_diversion)") &&
$avp(s:skip_upn_check_on_diversion) == "check_allowed_clis") {

                xlog("L_NOTICE", "Previous forwarder's number
'$var(userprov_cli)' did not match allowed_clis, using network-provided CLI
'$avp(s:caller_cli_netprov)' - R=$ru ID=$ci UA='$ua'\n");

                $var(userprov_cli) = $avp(s:caller_cli_netprov);

                $var(userprov_domain) = $avp(s:caller_domain_netprov);

                return;

        }

        else if($avp(s:allowed_clis_reject_policy) == "reject")

        {

                xlog("L_NOTICE", "$var(ccli_desc) '$var(userprov_cli)'
rejected, block call - R=$ru ID=$ci UA='$ua'\n");

                $(avp(s:announce_code)[*]) = 403;

                $(avp(s:announce_reason)[*]) = "Forbidden";

                route(ROUTE_ACC_FAILURE);

                route(ROUTE_EARLY_REJECT);

                route(ROUTE_EXIT);

        }

        else

 

On the second run it is not checking
“if(pv_isset("$avp(s:skip_upn_check_on_diversion)") &&
$avp(s:skip_upn_check_on_diversion) == "check_aliases")” for whatever
reason.

 

route[ROUTE_CHECK_CLI_ALLOWED]

{

        if(pv_isset("$avp(s:skip_upn_check_on_diversion)") &&
$avp(s:skip_upn_check_on_diversion) == "check_aliases") {

                xlog("L_NOTICE", "Previous forwarder's number
'$var(userprov_cli)' did not match aliases, using network-provided CLI
'$avp(s:caller_cli_netprov)' - R=$ru ID=$ci UA='$ua'\n");

                $var(userprov_cli) = $avp(s:caller_cli_netprov);

                $var(userprov_domain) = $avp(s:caller_domain_netprov);

                return;

        }

        xlog("L_INFO", "Checking $var(ccli_desc) against allowed CLIs -
R=$ru ID=$ci UA='$ua'\n");

 
if(pv_isset("$xavp(caller_usr_prefs[0]=>allowed_clis_reject_policy)"))

        {

                $(avp(s:allowed_clis_reject_policy)[*]) =
$xavp(caller_usr_prefs[0]=>allowed_clis_reject_policy);

        }

 

So the next hit is 

 

if(avp_check("$var(userprov_cli)",
"fm/$xavp(caller_contract_prefs[0]=>allowed_clis[*])/g"))

        {

                xlog("L_NOTICE", "$var(ccli_desc) '$var(userprov_cli)'
accepted (matched contract preference) - R=$ru ID=$ci UA='$ua'\n");

        }

 

        else if(avp_check("$var(userprov_cli)",
"fm/$xavp(caller_real_prefs[0]=>allowed_clis[*])/g"))

        {

                xlog("L_NOTICE", "$var(ccli_desc) '$var(userprov_cli)'
accepted (matched user preference) - R=$ru ID=$ci UA='$ua'\n");

        }

 

When “allowed_clis” is set to * (match all) it is always true even when
“skip_upn_check_on_diversion” is not configured to check “allowed_clis”.

 

The DIVERSION is set correct on peer if there is no match on “allowed_clis”.
A´m I correct that there is a missing check against
“skip_upn_check_on_diversion” regarding “allowed_clis”?

 

Only if “skip_upn_check_on_diversion” is configured to check against
“allowed_clis” the “if(avp_check("$var(userprov_cli)",
"fm/$xavp(caller_contract_prefs[0]=>allowed_clis[*])/g"))

“

check should be done correct?

 

Mit freundlichen Grüßen,

Best regards,

 

Sven

 

Von: Spce-user <spce-user-bounces at lists.sipwise.com> Im Auftrag von
sven.roehrig at web.de
Gesendet: Donnerstag, 3. Januar 2019 13:45
An: spce-user at lists.sipwise.com
Betreff: [Spce-user] change forwarder_cli_userprov if not matching
subscriber/alias

 

Hi,

 

i have a client that´s sending an invalid number in DIVERSION that need to
be replaced with the network provided number if it does not match an allowed
number.

If I set "skip_upn_check_on_diversion" to "skip checking upn if user in
received Diversion or alias list" everything works like expected but it
looks like the check is done twice. 

The first test is failing like expected but the second run is passed.

 

NOTICE: <script>: Rewriting Diversion number '162' to '162' -
R=sip:01719458948 at sip.sipwise-test.net:5060
ID=a4cb4345-99e3-46ad-8515-594d629020c8 UA='FPBX-14.0.5.2(13.22.0)'

INFO: <script>: Checking Diversion number against subscriber aliases -
R=sip:01719458948 at sip.sipwise-test.net:5060
ID=a4cb4345-99e3-46ad-8515-594d629020c8 UA='FPBX-14.0.5.2(13.22.0)'

NOTICE: <script>: Previous forwarder's number '162' did not match aliases,
using network-provided CLI '4937125620050' -
R=sip:01719458948 at sip.sipwise-test.net:5060
ID=a4cb4345-99e3-46ad-8515-594d629020c8 UA='FPBX-14.0.5.2(13.22.0)'

INFO: <script>: Check of previous forwarder via Diversion header failed -
R=sip:01719458948 at sip.sipwise-test.net:5060
ID=a4cb4345-99e3-46ad-8515-594d629020c8 UA='FPBX-14.0.5.2(13.22.0)'

INFO: <script>: Checking User-provided CLI against subscriber aliases -
R=sip:01719458948 at sip.sipwise-test.net:5060
ID=a4cb4345-99e3-46ad-8515-594d629020c8 UA='FPBX-14.0.5.2(13.22.0)'

INFO: <script>: User-provided CLI '4937125620076' accepted - matches alias
number '493712562007' - R=sip:01719458948 at sip.sipwise-test.net:5060
ID=a4cb4345-99e3-46ad-8515-594d629020c8 UA='FPBX-14.0.5.2(13.22.0)'

INFO: <script>: Checking User-provided Redirecting CLI against subscriber
aliases - R=sip:01719458948 at sip.sipwise-test.net:5060
ID=a4cb4345-99e3-46ad-8515-594d629020c8 UA='FPBX-14.0.5.2(13.22.0)'

INFO: <script>: Checking User-provided Redirecting CLI against allowed CLIs
- R=sip:01719458948 at sip.sipwise-test.net:5060
ID=a4cb4345-99e3-46ad-8515-594d629020c8 UA='FPBX-14.0.5.2(13.22.0)'

NOTICE: <script>: User-provided Redirecting CLI '162' accepted (matched user
preference) - R=sip:01719458948 at sip.sipwise-test.net:5060
ID=a4cb4345-99e3-46ad-8515-594d629020c8 UA='FPBX-14.0.5.2(13.22.0)'

.

.

.

NOTICE: <script>: Setting forwarder_cli_userprov/forwarder_domain_userprov
'00162 at 10.40.70.13' for uprn -
R=sip:491719458948 at sia-btsccca146.sipwise-test.net
ID=a4cb4345-99e3-46ad-8515-594d629020c8 UA='FPBX-14.0.5.2(13.22.0)'

NOTICE: <script>: Setting Diversion to
'<sip:00162 at 10.40.70.13>;privacy=off;counter=1' -
R=sip:491719458948 at sia-btsccca146.sipwise-test.net
ID=a4cb4345-99e3-46ad-8515-594d629020c8 UA='FPBX-14.0.5.2(13.22.0)'

 

When the call is leaving the peer I have set outbound_diversion to be UPRN.
I guess because of the failing test the DIVERSION that gets send to the peer
is the invalid number instead of the network provides as excpected.

 

Is this the correct behaviour ore is there something wron with my
configuration?

Should avp "forwarder_cli_userprov" need to be replaced with NPN if
"skip_upn_check_on_diversion" is enabled and failing for checking against
known numbers?

 

For my understanding if a client is sending a DIVERSION header spce should
check UPRN against known numbers (alias numbers, primary numbers, allowed
cli) configured in skip_upn_check_on_diversion.

If this is failing UPRN should be set to a known number (NPN) and the UPN
(taken from e.g. FROM Header should be passed as send). If the client is
sending a known UPRN the DIVERSON and FROM header can be passed as send.

If there is a DIVERSION present on a peer trunk this must be handled like a
PAI because its important for e.g. billing on peer side. 

 

 

Mit freundlichen Grüßen,

Best regards,

 

Sven

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sipwise.com/pipermail/spce-user_lists.sipwise.com/attachments/20190103/9f7e6d24/attachment-0001.html>


More information about the Spce-user mailing list