diff --git a/bin/ngcp-create_subscriber b/bin/ngcp-create_subscriber old mode 100644 new mode 100755 index 7fd20f1..14c0996 --- a/bin/ngcp-create_subscriber +++ b/bin/ngcp-create_subscriber @@ -3,11 +3,26 @@ use strict; use Getopt::Std; use Sipwise::Provisioning::Billing; +use YAML::Tiny; + +my $yaml = YAML::Tiny->new; +my $inputfile = '/etc/ngcp-config/constants.yml'; +my $password; +my $user = 'cmd'; + +$yaml = YAML::Tiny->read($inputfile) or die "File $inputfile could not be read"; + +unless (my ($user) = grep { $_->{user} eq $user && defined $_->{pass} } @{$yaml->[0]->{ossbss}->{provisioning}->{acl}}) { + die "Error: No password set for user cmd in $inputfile\n"; +} else { + $password = $user->{pass}; +} my %CONFIG = ( - admin => 'administrator', - password => 'administrator', + admin => 'cmd', + password => $password, ); + my %BILLING = ( billing_profile => 'default', # not needed, but may be set if desired @@ -72,7 +87,7 @@ sub call_prov { $result = $bprov->handle_request( $function, { authentication => { - type => 'admin', + type => 'system', username => $CONFIG{admin}, password => $CONFIG{password}, }, diff --git a/bin/ngcp-terminate_subscriber b/bin/ngcp-terminate_subscriber index 37beca1..14eedbd 100755 --- a/bin/ngcp-terminate_subscriber +++ b/bin/ngcp-terminate_subscriber @@ -3,10 +3,24 @@ use strict; use Getopt::Std; use Sipwise::Provisioning::Billing; +use YAML::Tiny; + +my $yaml = YAML::Tiny->new; +my $inputfile = '/etc/ngcp-config/constants.yml'; +my $password; +my $user = 'cmd'; + +$yaml = YAML::Tiny->read($inputfile) or die "File $inputfile could not be read"; + +unless (my ($user) = grep { $_->{user} eq $user && defined $_->{pass} } @{$yaml->[0]->{ossbss}->{provisioning}->{acl}}) { + die "Error: No password set for user cmd in $inputfile\n"; +} else { + $password = $user->{pass}; +} my %CONFIG = ( - admin => 'administrator', - password => 'administrator', + admin => 'cmd', + password => $password, ); sub main; @@ -54,7 +68,7 @@ sub call_prov { $result = $bprov->handle_request( $function, { authentication => { - type => 'admin', + type => 'system', username => $CONFIG{admin}, password => $CONFIG{password}, },