From: jonl Date: Thu, 12 Jan 2012 17:30:34 +0000 (+0100) Subject: Added collision prevention to aliases, added todo for the reverse, promoted numbers... X-Git-Url: https://git.defcon.no/?a=commitdiff_plain;h=b19a2088e6def6ed39e5d04996178459fb475e63;p=hermes Added collision prevention to aliases, added todo for the reverse, promoted numbers/inpool to a prod-node --- diff --git a/alias.php b/alias.php index 0c24b01..9adb434 100644 --- a/alias.php +++ b/alias.php @@ -101,6 +101,11 @@ if ( !$config['sql_link'] ) } // TODO: Verify that alias does not collide with existing SIP-adress + if ( is_kamailio_domain( $alias_domain) && is_kamailio_subscriber($alias_username, $alias_domain) ) + { + print json_encode ( array( 'response' => 'failed', 'cause' => 'exists', 'detail' => 'The desired alias collides with an existing non-alias.' )); + break; + } list ( $dest_username, $dest_domain ) = split_sipaddress( $_GET['destination']); diff --git a/api-nodes.txt b/api-nodes.txt index a82e3c2..1a26ef8 100644 --- a/api-nodes.txt +++ b/api-nodes.txt @@ -107,7 +107,6 @@ numbers/remove?number=%2B4761123456 Returns 'response' as 'ok' with 'number' set to the number that was pulled from the pool. numbers/inpool?number=%2B4761123456 - A debug-node, may disappear at any time ^_^ Tests if the given E164 number is in the pool. Returns 'response' = 'ok' with 'number' = '' If the number is in the pool Returns response = 'failed' with 'cause' = 'nonexistant' if not. @@ -152,7 +151,8 @@ Planned, but not implemented nodes/functions: alias/list alias/user?destination=foo@bar.bz -Add collision prevention for aliases, make sure that no alias can be added when the alias -address would overlap/collide with a valid user-address - authentication-mechanism :) + +Add collision prevention for users, make sure that no user can be added when the user +address would overlap/collide with a valid alias-address +