my $help;
my $username;
my $configfile;
+my $dryrun = 0;
my ($g_ua, $session, $api_key, $auth_key, $data, $domain);
my ($user, $sipuser, $mac);
"macaddress=s" => \$mac,
"username=s" => \$username,
"configfile=s" => \$configfile,
+ "dryrun" => \$dryrun,
);
if (
--configfile=s|--config|-c
--username=s|--user|-u
--macaddress=s|--mac|-m
+ --dryrun|--dry|-d
Verify the contents of the configuration file.
Verify that the key-file exists.
exit;
}
+if ( $dryrun ) {
+ print("Dryrun specified. All OK so far, stopping before add.\n");
+ logout();
+ exit;
+}
+
$data = exec_apinode("phone/add", { 'user' => $sipuser, 'mac' => $mac });
printf("Failed to add phone+user, cause given: '%s'\n", $data->{'cause'})
my $help;
my $username;
my $configfile;
+my $dryrun = 0;
my ($g_ua, $session, $api_key, $auth_key, $data, $domain);
my ($user, $displayname, $phone, $mail, $sipuser, $linetext);
"help" => \$help,
"username=s" => \$username,
"configfile=s" => \$configfile,
+ "dryrun" => \$dryrun,
);
if (
Verify that the following options are set:
--configfile=s
--username=s
+ --dryrun
Verify the contents of the configuration file.
Verify that the key-file exists.
login_apikey();
+
$data = exec_apinode("user/available", { "user" => $sipuser });
if ( not $data->{'response'} eq 'ok' )
{
}
undef $data;
+if ( $dryrun ) {
+ print("Dryrun specified. All OK so far, stopping before add.\n");
+ logout();
+ exit;
+}
+
$data = exec_apinode("user/add_local", {
"user" => $sipuser,
"displayname" => $displayname,