TT#76671 ngcp-create-subscriber pbx extension, display name, aliases

* add support for pbx extension, display name, aliases

Change-Id: I084ed189a139d63c9bb912fa2da516c11a2aaaef
changes/55/38355/2
Kirill Solomko 5 years ago
parent d7449d0b0f
commit 3c25b4b1a8

@ -27,8 +27,11 @@ GetOptions($opts,
'cc|c=s',
'ac|a=s',
'sn|n=s',
'aliases=s@',
'display_name=s',
'webpassword|w=s',
'pbx_pilot',
'pbx_extension=s',
'verbose',
) or usage();
@ -70,18 +73,34 @@ sub main {
}
my $uri = '/api/subscribers/';
my %data = map {
$_ => $opts->{$_}
} qw(customer_id username password webpassword);
$data{primary_number} = { map { $_ => $opts->{$_} } qw(cc ac sn) };
$data{administrative} = $opts->{admin};
$data{is_pbx_pilot} = $opts->{pbx_pilot};
$data{display_name} = $opts->{display_name} // undef;
$data{pbx_extension} = $opts->{pbx_extension} // undef;
my $tmp = $dom->as_hash->{_embedded}->{'ngcp:domains'};
if (ref $tmp eq 'ARRAY') {
$data{domain_id} = @{$tmp}[0]->{id};
} else {
$data{domain_id} = $tmp->{id};
}
if ($opts->{aliases}) {
$data{alias_numbers} = [
map {
{
map {
split /\=/, $_
} split /\s+/, $_
}
} @{$opts->{aliases}}
];
}
my $res = $client->request('POST', $uri, \%data);
print $res->result . "\n";
@ -157,11 +176,29 @@ 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>
A display name part of the subscriber's number.
=item B<--aliases>
A list of alias numbers
Format: --aliases "cc=43 ac=1 sn=123" --aliases "cc=43 ac=1 sn=456"
Optional:
is_devid=1
devid_alias=Alice
=item B<--pbx_pilot>
Set the "pbx pilot" flag for the new subscriber.
Defaults to 0 (no).
=item B<--pbx_extension>
PBX extension number (only usable for PBX subscribers)
=item B<--verbose>
Show additional debug information. Default false.

Loading…
Cancel
Save