diff --git a/bin/ngcp-api-admins b/bin/ngcp-api-admins index b7cb23b..ce41867 100755 --- a/bin/ngcp-api-admins +++ b/bin/ngcp-api-admins @@ -15,22 +15,46 @@ my $opts = { verbose => 0, }; +# XXX: Remove after mr10.5. +sub old_option { + my ($name, $value) = @_; + my $newname = $name =~ tr/_/-/r; + $opts->{$name} = $value; + warn "$0: option --$name is deprecated; use --$newname instead\n"; +} + +sub parse_option { + my ($name, $value) = @_; + $name =~ tr/-/_/; + $opts->{$name} = $value; +} + GetOptions($opts, 'help|h' => sub { usage() }, 'op=s', 'login=s', 'password=s', 'email=s', - 'reseller_id=i', - 'is_system=i', - 'is_master=i', - 'is_superuser=i', - 'is_ccare=i', - 'read_only=i', - 'show_paswords=i', - 'call_data=i', - 'billing_data=i', - 'lawful_intercept=i', + 'reseller_id=i' => \&old_option, + 'reseller-id=i' => \&parse_option, + 'is_system=i' => \&old_option, + 'is-system=i' => \&parse_option, + 'is_master=i' => \&old_option, + 'is-master=i' => \&parse_option, + 'is_superuser=i' => \&old_option, + 'is-superuser=i' => \&parse_option, + 'is_ccare=i' => \&old_option, + 'is-ccare=i' => \&parse_option, + 'read_only=i' => \&old_option, + 'read-only=i' => \&parse_option, + 'show_paswords=i' => \&old_option, + 'show-paswords=i' => \&parse_option, + 'call_data=i' => \&old_option, + 'call-data=i' => \&parse_option, + 'billing_data=i' => \&old_option, + 'billing-data=i' => \&parse_option, + 'lawful_intercept=i' => \&old_option, + 'lawful-intercept=i' => \&parse_option, 'verbose', ) or usage(); @@ -149,7 +173,7 @@ Operation: "list", "add", "update", "delete" =over 8 -=item B<--login>, B<login> +=item B<--login> B<login> Administrator login name @@ -157,45 +181,45 @@ Administrator login name Password field -=item B<--password> I<password> +=item B<--email> I<email> Email field -=item B<--reseller_id> +=item B<--reseller-id> Reseller id the administartor belongs to (used in "add" and "update"). -=item B<--is_system> I<0|1> +=item B<--is-system> I<0|1> A flag that defines wether the user is the system root and can manage everything. *Only administrators with this flag are able to manage "lawful intercept" administrators. -=item B<--is_superuser> I<0|1> +=item B<--is-superuser> I<0|1> A flag that defines wether the administrator can manage all resellers on the platform. -=item B<--is_master> I<0|1> +=item B<--is-master> I<0|1> A flag that defines wether the administrator can manage other administrators within the same reseller. -=item B<--is_ccare> I<0|1> +=item B<--is-ccare> I<0|1> A flag that defines wether the administrator is limited only to manage Customers and Subscribers. (coped with <is_superuser> defines wether the scope is limited to only Reseller the administrator belongs to or across all Resellers) -=item B<--read_only> I<0|1> +=item B<--read-only> I<0|1> Engages "Read Only" functionality for the administrator. -=item B<--show_passwords> I<0|1> +=item B<--show-passwords> I<0|1> Show clear text passwords to the administrator. -=item B<--call_data> I<0|1> +=item B<--call-data> I<0|1> The administrator is able to access call traces ("voisniff" must be also enabled). -=item B<--billing_data> I<0|1> +=item B<--billing-data> I<0|1> Enables the administrator to apply "Balance top up" and "Vouchers". diff --git a/bin/ngcp-create-customer b/bin/ngcp-create-customer index 4d9631d..e3a2000 100755 --- a/bin/ngcp-create-customer +++ b/bin/ngcp-create-customer @@ -17,10 +17,26 @@ my $opts = { verbose => 0, }; +# XXX: Remove after mr10.5. +sub old_option { + my ($name, $value) = @_; + my $newname = $name =~ tr/_/-/r; + $opts->{$name} = $value; + warn "$0: option --$name is deprecated; use --$newname instead\n"; +} + +sub parse_option { + my ($name, $value) = @_; + $name =~ tr/-/_/; + $opts->{$name} = $value; +} + GetOptions($opts, 'help|h' => sub { usage() }, - 'billing_profile_id=i', - 'contact_id=i', + 'billing_profile_id=i' => \&old_option, + 'billing-profile-id=i' => \&parse_option, + 'contact_id=i' => \&old_option, + 'contact-id=i' => \&parse_option, 'type=s', 'verbose', ) or usage(); @@ -84,11 +100,11 @@ B<This program> creates a customer on the NGCP platform. =over 8 -=item B<--billing_profile_id> +=item B<--billing-profile-id> I<id> Billing profile id. -=item B<--contact_id> +=item B<--contact-id> I<id> Contact id. @@ -98,7 +114,7 @@ Contact id. =over 8 -=item B<--type> +=item B<--type> I<customer-type> Customer can be one of the "sipaccount" or "pbxaccount" type. Defaults to "sipaccount". diff --git a/bin/ngcp-create-domain b/bin/ngcp-create-domain index 7d5dcee..e055647 100755 --- a/bin/ngcp-create-domain +++ b/bin/ngcp-create-domain @@ -18,12 +18,29 @@ my $opts = { verbose => 0, }; +# XXX: Remove after mr10.5. +sub old_option { + my ($name, $value) = @_; + my $newname = $name =~ tr/_/-/r; + $opts->{$name} = $value; + warn "$0: option --$name is deprecated; use --$newname instead\n"; +} + +sub parse_option { + my ($name, $value) = @_; + $name =~ tr/-/_/; + $opts->{$name} = $value; +} + GetOptions($opts, 'help|h' => sub { usage() }, 'domain=s', - 'reseller_id=i', - 'skip_xmpp', - 'skip_sip', + 'reseller_id=i' => \&old_option, + 'reseller-id=i' => \&parse_option, + 'skip_xmpp' => \&old_option, + 'skip-xmpp' => \&parse_option, + 'skip_sip' => \&old_option, + 'skip-sip' => \&parse_option, 'verbose', ) or usage(); @@ -103,16 +120,16 @@ The domain to create. =over 8 -=item B<--reseller_id> I<rid> +=item B<--reseller-id> I<rid> Reseller id. Default 1. -=item B<--skip_sip> +=item B<--skip-sip> Skip reloading SIP services. If true, changes will not be effective immedeately until the respective service is restarted or properly notified. Default false. -=item B<--skip_xmpp> +=item B<--skip-xmpp> Skip reloading XMPP services. If true, changes will not be effective immedeately until the respective service is restarted or properly notified. Default false. diff --git a/bin/ngcp-create-subscriber b/bin/ngcp-create-subscriber index 8f85da1..7306278 100755 --- a/bin/ngcp-create-subscriber +++ b/bin/ngcp-create-subscriber @@ -17,9 +17,24 @@ my $opts = { pbx_pilot => 0, }; +# XXX: Remove after mr10.5. +sub old_option { + my ($name, $value) = @_; + my $newname = $name =~ tr/_/-/r; + $opts->{$name} = $value; + warn "$0: option --$name is deprecated; use --$newname instead\n"; +} + +sub parse_option { + my ($name, $value) = @_; + $name =~ tr/-/_/; + $opts->{$name} = $value; +} + GetOptions($opts, 'help|h' => sub { usage() }, - 'customer_id=i', + 'customer_id=i' => \&old_option, + 'customer-id=i' => \&parse_option, 'username|u=s', 'password|p=s', 'domain|d=s', @@ -28,10 +43,13 @@ GetOptions($opts, 'ac|a=s', 'sn|n=s', 'aliases=s@', - 'display_name=s', + 'display_name=s' => \&old_option, + 'display-name=s' => \&parse_option, 'webpassword|w=s', - 'pbx_pilot', - 'pbx_extension=s', + 'pbx_pilot' => \&old_option, + 'pbx-pilot' => \&parse_option, + 'pbx_extension=s' => \&old_option, + 'pbx-extension=s' => \&parse_option, 'verbose', ) or usage(); @@ -127,7 +145,7 @@ B<This program> creates a subscriber on the NGCP platform. =over 8 -=item B<--customer_id> I<cid> +=item B<--customer-id> I<cid> An existing customer id to assign this subscriber to. @@ -176,7 +194,7 @@ A local number part of the subscriber's number. Set the administrative flag for the new subscriber. Defaults to 0 (no). -=item B<--display> I<display-name> +=item B<--display-name> I<display-name> A display name part of the subscriber's number. @@ -190,12 +208,12 @@ A list of alias numbers devid_alias=Alice -=item B<--pbx_pilot> +=item B<--pbx-pilot> Set the "pbx pilot" flag for the new subscriber. Defaults to 0 (no). -=item B<--pbx_extension> +=item B<--pbx-extension> PBX extension number (only usable for PBX subscribers) diff --git a/bin/ngcp-delete-domain b/bin/ngcp-delete-domain index 9f2cc91..8ce47d0 100755 --- a/bin/ngcp-delete-domain +++ b/bin/ngcp-delete-domain @@ -18,11 +18,27 @@ my $opts = { verbose => 0, }; +# XXX: Remove after mr10.5. +sub old_option { + my ($name, $value) = @_; + my $newname = $name =~ tr/_/-/r; + $opts->{$name} = $value; + warn "$0: option --$name is deprecated; use --$newname instead\n"; +} + +sub parse_option { + my ($name, $value) = @_; + $name =~ tr/-/_/; + $opts->{$name} = $value; +} + GetOptions($opts, 'help|h' => sub { usage() }, 'domain=s', - 'skip_xmpp', - 'skip_sip', + 'skip_xmpp' => \&old_option, + 'skip-xmpp' => \&parse_option, + 'skip_sip' => \&old_option, + 'skip-sip' => \&parse_option, 'verbose', ) or usage(); @@ -110,12 +126,12 @@ The domain name to delete. =over 8 -=item B<--skip_sip> +=item B<--skip-sip> Skip reloading SIP services. If true, changes will not be effective immedeately until the respective service is restarted or properly notified. Default false. -=item B<--skip_xmpp> +=item B<--skip-xmpp> Skip reloading XMPP services. If true, changes will not be effective immedeately until the respective service is restarted or properly notified. Default false. diff --git a/bin/ngcp-get-customer b/bin/ngcp-get-customer index b49a334..47e02e4 100755 --- a/bin/ngcp-get-customer +++ b/bin/ngcp-get-customer @@ -15,9 +15,24 @@ my $opts = { verbose => 0, }; +# XXX: Remove after mr10.5. +sub old_option { + my ($name, $value) = @_; + my $newname = $name =~ tr/_/-/r; + $opts->{$name} = $value; + warn "$0: option --$name is deprecated; use --$newname instead\n"; +} + +sub parse_option { + my ($name, $value) = @_; + $name =~ tr/-/_/; + $opts->{$name} = $value; +} + GetOptions($opts, 'help|h' => sub { usage() }, - 'customer_id=i', + 'customer_id=i' => \&old_option, + 'customer-id=i' => \&parse_option, 'verbose', ) or usage(); @@ -79,7 +94,7 @@ B<This program> retreives a customer from the NGCP platform. =over 8 -=item B<--customer_id> I<cid> +=item B<--customer-id> I<cid> Customer id. diff --git a/bin/ngcp-terminate-customer b/bin/ngcp-terminate-customer index 9de5521..40ef1f9 100755 --- a/bin/ngcp-terminate-customer +++ b/bin/ngcp-terminate-customer @@ -15,9 +15,24 @@ my $opts = { verbose => 0, }; +# XXX: Remove after mr10.5. +sub old_option { + my ($name, $value) = @_; + my $newname = $name =~ tr/_/-/r; + $opts->{$name} = $value; + warn "$0: option --$name is deprecated; use --$newname instead\n"; +} + +sub parse_option { + my ($name, $value) = @_; + $name =~ tr/-/_/; + $opts->{$name} = $value; +} + GetOptions($opts, 'help|h' => sub { usage() }, - 'customer_id=i', + 'customer_id=i' => \&old_option, + 'customer-id=i' => \&parse_option, 'verbose', ) or usage(); @@ -84,7 +99,7 @@ B<This program> terminates a customer on the NGCP platform. =over 8 -=item B<--customer_id> I<cid> +=item B<--customer-id> I<cid> Customer ID.