From 133bf03274eceaac4950e62f8f66c6c077474fbb Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Tue, 13 Sep 2016 16:37:22 -0400 Subject: [PATCH] LP1579144: Let admin decide on the precedence of the location codes per institution Signed-off-by: Mike Rylander --- SIPconfig.xml | 8 ++++---- Sip/MsgType.pm | 13 ++++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/SIPconfig.xml b/SIPconfig.xml index 6ba05a2..180f4d4 100644 --- a/SIPconfig.xml +++ b/SIPconfig.xml @@ -1,7 +1,7 @@ + 127.0.0.1:11211 @@ -64,7 +64,7 @@ - @@ -77,7 +77,7 @@ diff --git a/Sip/MsgType.pm b/Sip/MsgType.pm index 0f51459..29751f8 100644 --- a/Sip/MsgType.pm +++ b/Sip/MsgType.pm @@ -856,7 +856,18 @@ sub handle_login { syslog("LOG_WARNING", "MsgType::handle_login: Invalid password for login '$uid'"); $status = 0; } else { - $sc_loc ||= $server->{config}->{accounts}->{$uid}->{location_code}; + if (to_bool( + $server + ->{config} + ->{institutions} + ->{ $server->{config}->{accounts}->{$uid}->{institution} } + ->{policy} + ->{client_location_code} + )) { + $sc_loc ||= $server->{config}->{accounts}->{$uid}->{location_code}; + } else { + $sc_loc = $server->{config}->{accounts}->{$uid}->{location_code} || $sc_loc; + } _load_ils_handler($server, $uid, $sc_loc); } -- 2.11.0