]> git.defcon.no Git - hermes/commitdiff
completed sipalias remove function
authorJon Langseth <jon.langseth@hig.no>
Mon, 12 Aug 2013 11:22:04 +0000 (13:22 +0200)
committerJon Langseth <jon.langseth@hig.no>
Mon, 12 Aug 2013 11:22:04 +0000 (13:22 +0200)
guc-clients/sipalias

index 9212228a5c72096d18a90c2b38c30d994fddd7ff..7a9716a46edf38454a036f700f65602fcf748197 100755 (executable)
@@ -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();