+ print json_encode ( array( 'response' => 'invalid') );
+ break;
+ case "/change_pw":
+ /*
+ Required parameters should be...
+ ( username & domain ) | user
+
+ * Verify that no associations/relations exist in 'provision.phones'
+ * Verify that the user exists ...
+ * Test to see of user exists in 'provision.users'
+ * Test to see of user exists in 'kamailio.subscriber'.
+ * If no such user exists, return 'response' => 'failed' with 'cause' => 'nonexistant'
+ * Update user passwords in 'provision' and 'kamailio' as appropriate
+ * On other failures, return 'response' => 'failed' with 'cause' => 'error' (may set 'detail' => 'message')
+ */
+ if ( ( array_key_exists( 'username', $_GET) && array_key_exists( 'domain', $_GET ) )
+ || array_key_exists('user', $_GET) )
+
+ {
+ $username = "";
+ $domain = "";
+ if ( array_key_exists('username', $_GET) )
+ {
+ $username = $_GET['username'];
+ $domain = $_GET['domain'];
+ }
+ else
+ {
+ $user = split_sipaddress($_GET['user']);
+ if ( !$user )
+ {
+ print json_encode ( array( 'response' => 'failed', 'cause' => 'invalid', 'detail' => 'Invalid SIP address') );
+ break;
+ }
+ list ( $username, $domain ) = $user;
+ }
+ print json_encode ( array( 'response' => 'failed', 'cause' => 'notimplemented', 'detail' => 'Requested feature valid, but not implemented' ) );
+ }
+ else
+ print json_encode( array( 'response' => 'invalid', 'cause' => 'parameters' ) );
+ break;
+
+ case "/update":
+ /*
+ Required parameters should be...
+ ( username & domain ) | user
+
+ * Verify that no associations/relations exist in 'provision.phones'
+ * Verify that the user exists ...
+ * Test to see of user exists in 'provision.users'
+ * Test to see of user exists in 'kamailio.subscriber'.
+ * If no such user exists, return 'response' => 'failed' with 'cause' => 'nonexistant'
+ * Get update parameters, and change as appropriate ;)
+ * On other failures, return 'response' => 'failed' with 'cause' => 'error' (may set 'detail' => 'message')
+ */
+ if ( ( array_key_exists( 'username', $_GET) && array_key_exists( 'domain', $_GET ) )
+ || array_key_exists('user', $_GET) )
+
+ {
+ $username = "";
+ $domain = "";
+ if ( array_key_exists('username', $_GET) )
+ {
+ $username = $_GET['username'];
+ $domain = $_GET['domain'];
+ }
+ else
+ {
+ $user = split_sipaddress($_GET['user']);
+ if ( !$user )
+ {
+ print json_encode ( array( 'response' => 'failed', 'cause' => 'invalid', 'detail' => 'Invalid SIP address') );
+ break;
+ }
+ list ( $username, $domain ) = $user;
+ }
+ print json_encode ( array( 'response' => 'failed', 'cause' => 'notimplemented', 'detail' => 'Requested feature valid, but not implemented' ) );
+ }
+ else
+ print json_encode( array( 'response' => 'invalid', 'cause' => 'parameters' ) );