From: Jon Langseth Date: Mon, 12 Aug 2013 11:22:04 +0000 (+0200) Subject: completed sipalias remove function X-Git-Url: https://git.defcon.no/?p=hermes;a=commitdiff_plain;h=8fbb8e2797e3d162513d980dc43bd38480fc512f completed sipalias remove function --- diff --git a/guc-clients/sipalias b/guc-clients/sipalias index 9212228..7a9716a 100755 --- a/guc-clients/sipalias +++ b/guc-clients/sipalias @@ -187,7 +187,8 @@ elsif ( $alias ) printf("Alias after expanding options: %s\n", $use_alias); # URL-encode any plus-signs in the address... -$use_alias =~ s/\+/\%2B/g; +#$use_alias =~ s/\+/\%2B/g; +# Seems to not be needed, am I doing this somewhere else? undef $data; # run alias/list with alias=$use_alias, expect an empty list @@ -241,6 +242,16 @@ else $aliases[0]->{'destination'}, $username . "@" . $domain ); } + undef $data; + $data = exec_apinode("alias/remove", { 'alias' => $use_alias }); + # fail unless OK is returned. + if ( not $data->{'response'} eq 'ok' ) + { + printf("Unable to remove alias, Hermes response is: %s\n", $data->{'cause'}); + logout(); + exit; + } + printf("Removed alias %s.\n", $data->{'alias'} ); } logout();