MT#57376 Add support of 'peer_auth_registrar_server' preference

We have to support new preference for:
- `create_peer_registration`
- `update_peer_registration`
- `delete_peer_registration`

If there is no `peer_auth_registrar_server` value provided,
then use a realm value instead.

Change-Id: I39d3a917c9f11c1d4cfa0781fe5a3cee11d9eeea
mr11.4
Donat Zenichev 2 years ago
parent ce6884ebab
commit 565c25481b

@ -2778,7 +2778,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_hf_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_registrar_server peer_auth_pass peer_auth_register/){
my $rs;
$rs = get_usr_preference_rs(
c => $c,

@ -97,6 +97,9 @@ sub create_peer_registration {
# use the value of the peer_auth_user instead
my $authorization_username = $$prefs{peer_auth_hf_user} // $$prefs{peer_auth_user};
# if there a specific registrar server defined, provide it. Otherwise use realm's value.
my $registrar_server = $$prefs{peer_auth_registrar_server} // $$prefs{peer_auth_realm};
my @ret = NGCP::Panel::Utils::XMLDispatcher::dispatch($c, "appserver", $all, 1, <<EOF);
<?xml version="1.0"?>
<methodCall>
@ -109,6 +112,7 @@ sub create_peer_registration {
<param><value><string>sip:$$prefs{peer_auth_user}\@$contact;uuid=$uuid$transport</string></value></param>
<param><value><string>$authorization_username</string></value></param>
<param><value><string>$type</string></value></param>
<param><value><string>$registrar_server</string></value></param>
</params>
</methodCall>
EOF
@ -219,6 +223,9 @@ sub update_peer_registration {
# use the value of the peer_auth_user instead
my $authorization_username = $$prefs{peer_auth_hf_user} // $$prefs{peer_auth_user};
# if there a specific registrar server defined, provide it. Otherwise use realm's value.
my $registrar_server = $$prefs{peer_auth_registrar_server} // $$prefs{peer_auth_realm};
my @ret = NGCP::Panel::Utils::XMLDispatcher::dispatch($c, "appserver", $all, 1, <<EOF);
<?xml version="1.0"?>
<methodCall>
@ -231,6 +238,7 @@ sub update_peer_registration {
<param><value><string>sip:$$prefs{peer_auth_user}\@$contact;uuid=$uuid$transport</string></value></param>
<param><value><string>$authorization_username</string></value></param>
<param><value><string>$type</string></value></param>
<param><value><string>$registrar_server</string></value></param>
</params>
</methodCall>
EOF
@ -243,6 +251,9 @@ EOF
# use the value of the peer_auth_user instead
my $old_authorization_username = $$oldprefs{peer_auth_hf_user} // $$oldprefs{peer_auth_user};
# if there a specific registrar server defined, provide it. Otherwise use realm's value.
my $old_registrar_server = $$oldprefs{peer_auth_registrar_server} // $$oldprefs{peer_auth_realm};
if(grep { $$_[1] == 0 or $$_[2] !~ m#<value>OK</value># } @ret) { # error
$c->log->error("Failed XML-RPC call to appserver: ". Dumper \@ret);
@ -260,6 +271,7 @@ EOF
<param><value><string>sip:$$oldprefs{peer_auth_user}\@$contact;uuid=$uuid</string></value></param>
<param><value><string>$old_authorization_username</string></value></param>
<param><value><string>$type</string></value></param>
<param><value><string>$old_registrar_server</string></value></param>
</params>
</methodCall>
EOF
@ -328,6 +340,9 @@ EOF
# use the value of the peer_auth_user instead
my $old_authorization_username = $$oldprefs{peer_auth_hf_user} // $$oldprefs{peer_auth_user};
# if there a specific registrar server defined, provide it. Otherwise use realm's value.
my $old_registrar_server = $$oldprefs{peer_auth_registrar_server} // $$oldprefs{peer_auth_realm};
if(grep { $$_[1] == 0 or $$_[2] !~ m#<value>OK</value># } @ret) { # error
$c->log->error("Failed XML-RPC call to appserver: ". Dumper \@ret);
@ -345,6 +360,7 @@ EOF
<param><value><string>sip:$$oldprefs{peer_auth_user}\@$contact;uuid=$uuid</string></value></param>
<param><value><string>$old_authorization_username</string></value></param>
<param><value><string>$type</string></value></param>
<param><value><string>$old_registrar_server</string></value></param>
</params>
</methodCall>
EOF

Loading…
Cancel
Save