diff --git a/conf/provisioning.conf b/conf/provisioning.conf index 0dabf28..f7a5520 100644 --- a/conf/provisioning.conf +++ b/conf/provisioning.conf @@ -1,10 +1,32 @@ \ No newline at end of file diff --git a/httpd/flexisip-account-manager.conf b/httpd/flexisip-account-manager.conf index acf348a..3204453 100644 --- a/httpd/flexisip-account-manager.conf +++ b/httpd/flexisip-account-manager.conf @@ -10,4 +10,11 @@ Alias /flexisip-account-manager /opt/belledonne-communications/share/flexisip-ac Require not env blockAccess + + + + Require all granted + Require not env blockAccess + + diff --git a/src/xmlrpc/provisioning.php b/src/xmlrpc/provisioning.php new file mode 100644 index 0000000..c5ae502 --- /dev/null +++ b/src/xmlrpc/provisioning.php @@ -0,0 +1,82 @@ +. +*/ + +header("Access-Control-Allow-Origin: *"); +header("Content-Type: application/xml; charset=UTF-8"); + +include_once __DIR__ . '/../misc/utilities.php'; + +$xml = ''; +$xml = $xml . ''; + +$proxy_config_index = 0; +$auth_info_index = 0; + +if (file_exists(REMOTE_PROVISIONING_DEFAULT_CONFIG)) { + $rc_array = parse_ini_file(REMOTE_PROVISIONING_DEFAULT_CONFIG, true); + foreach ($rc_array as $section => $values) { + $xml = $xml . '
'; + if (startswith($section, "proxy_config_")) { + $proxy_config_index += 1; + } else if (startswith($section, "auth_info_")) { + $auth_info_index += 1; + } + + foreach ($values as $key => $value) { + // We need to replace any < or > by < and > or the xml won't be valid ! + $value = str_replace("<", "<", $value); + $value = str_replace(">", ">", $value); + + $xml = $xml . '' . $value . ''; + } + $xml = $xml . '
'; + } +} + +$username = isset($_GET['username']) ? $_GET['username'] : null; +$domain = isset($_GET['domain']) ? $_GET['domain'] : SIP_DOMAIN; +$transport = isset($_GET['transport']) ? $_GET['transport'] : REMOTE_PROVISIONING_DEFAULT_TRANSPORT; + +if (!empty($username)) { + $xml = $xml . '
'; + $xml = $xml . '<sip:' . $username . '@' . $domain . '>'; + $xml = $xml . '<sip:' . $domain . ';transport=' . $transport . '>'; + $xml = $xml . '<sip:' . $domain . ';transport=' . $transport . '>'; + $xml = $xml . '
'; + + $ha1 = isset($_GET['ha1']) ? $_GET['ha1'] : null; + $algo = isset($_GET['algorithm']) ? $_GET['algorithm'] : "MD5"; + + if (!empty($ha1)) { + $xml = $xml . '
'; + $xml = $xml . '' . $username . ''; + $xml = $xml . '' . $ha1 . ''; + $xml = $xml . '' . $domain . ''; + $xml = $xml . '' . $algo . ''; + $xml = $xml . '
'; + } +} + +$xml = $xml . '
'; + +http_response_code(200); +echo $xml; + +?> \ No newline at end of file