TT#82409 Add support of 'peer_auth_hf_user' preference in createRegistration

Change-Id: I86bd04d19f12604cd64981ba07651526298b2b5f
mr10.0
Marco Capetta 4 years ago committed by Donat Zenichev
parent 131fe8e270
commit 7fc4e776bc

@ -2575,7 +2575,7 @@ sub update_sems_peer_auth {
sub get_peer_auth_params {
my ($c, $prov_subscriber, $prefs) = @_;
foreach my $attribute (qw/peer_auth_user peer_auth_realm peer_auth_pass peer_auth_register/){
foreach my $attribute (qw/peer_auth_user peer_auth_hf_user peer_auth_realm peer_auth_pass peer_auth_register/){
my $rs;
$rs = get_usr_preference_rs(
c => $c,

@ -50,6 +50,10 @@ sub create_peer_registration {
$transport = $outbound_sock->{transport};
}
# if no specific username defined for the Authorization header
# use the value of the peer_auth_user instead
my $authorization_username = $$prefs{peer_auth_hf_user} // $$prefs{peer_auth_user};
my @ret = NGCP::Panel::Utils::XMLDispatcher::dispatch($c, "appserver", $all, 1, <<EOF);
<?xml version="1.0"?>
<methodCall>
@ -60,6 +64,7 @@ sub create_peer_registration {
<param><value><string>$$prefs{peer_auth_pass}</string></value></param>
<param><value><string>$$prefs{peer_auth_realm}</string></value></param>
<param><value><string>sip:$$prefs{peer_auth_user}\@$contact;uuid=$uuid$transport</string></value></param>
<param><value><string>$authorization_username</string></value></param>
</params>
</methodCall>
EOF
@ -122,6 +127,10 @@ sub update_peer_registration {
$c->log->debug("+++++++++++++++++++ uuid=$uuid");
$c->log->debug("+++++++++++++++++++ contact=$contact");
# if no specific username defined for the Authorization header
# use the value of the peer_auth_user instead
my $authorization_username = $$prefs{peer_auth_hf_user} // $$prefs{peer_auth_user};
my @ret = NGCP::Panel::Utils::XMLDispatcher::dispatch($c, "appserver", $all, 1, <<EOF);
<?xml version="1.0"?>
<methodCall>
@ -132,6 +141,7 @@ sub update_peer_registration {
<param><value><string>$$prefs{peer_auth_pass}</string></value></param>
<param><value><string>$$prefs{peer_auth_realm}</string></value></param>
<param><value><string>sip:$$prefs{peer_auth_user}\@$contact;uuid=$uuid$transport</string></value></param>
<param><value><string>$authorization_username</string></value></param>
</params>
</methodCall>
EOF
@ -140,6 +150,10 @@ EOF
return 1;
}
# if no specific username defined for the Authorization header
# use the value of the peer_auth_user instead
my $old_authorization_username = $$oldprefs{peer_auth_hf_user} // $$oldprefs{peer_auth_user};
if(grep { $$_[1] == 0 or $$_[2] !~ m#<value>OK</value># } @ret) { # error
$c->log->error("Failed XML-RPC call to appserver: ". Dumper \@ret);
@ -155,6 +169,7 @@ EOF
<param><value><string>$$oldprefs{peer_auth_pass}</string></value></param>
<param><value><string>$$oldprefs{peer_auth_realm}</string></value></param>
<param><value><string>sip:$$oldprefs{peer_auth_user}\@$contact;uuid=$uuid</string></value></param>
<param><value><string>$old_authorization_username</string></value></param>
</params>
</methodCall>
EOF
@ -198,6 +213,10 @@ EOF
return 1;
}
# if no specific username defined for the Authorization header
# use the value of the peer_auth_user instead
my $old_authorization_username = $$oldprefs{peer_auth_hf_user} // $$oldprefs{peer_auth_user};
if(grep { $$_[1] == 0 or $$_[2] !~ m#<value>OK</value># } @ret) { # error
$c->log->error("Failed XML-RPC call to appserver: ". Dumper \@ret);
@ -213,6 +232,7 @@ EOF
<param><value><string>$$oldprefs{peer_auth_pass}</string></value></param>
<param><value><string>$$oldprefs{peer_auth_realm}</string></value></param>
<param><value><string>sip:$$oldprefs{peer_auth_user}\@$contact;uuid=$uuid</string></value></param>
<param><value><string>$old_authorization_username</string></value></param>
</params>
</methodCall>
EOF

Loading…
Cancel
Save