diff --git a/conf/hooks.conf b/conf/hooks.conf index 6b5869f..2f1c9ac 100644 --- a/conf/hooks.conf +++ b/conf/hooks.conf @@ -9,7 +9,7 @@ */ define('CUSTOM_HOOKS', FALSE); -/** ### Hooks implementation */ +/** ### Hooks implementation ### */ function hook_on_account_created($account) { @@ -19,4 +19,19 @@ function hook_on_account_activated($account) { } +/** ### request_params array my contain username, domain, transport, ha1 and algo ### */ + +function provisioning_hook_on_proxy_config($xml, $request_params) { + $xml .= 'sip:conference-factory@' . $request_params["domain"] . ''; +} +function provisioning_hook_on_auth_info($xml, $request_params) { + +} + +function provisioning_hook_on_additional_section($xml, $request_params) { + $xml .= '
'; + $xml .= 'sips:rls@' . $request_params["domain"] . ''; + $xml .= '
'; +} + ?> \ No newline at end of file diff --git a/flexisip-account-manager.spec b/flexisip-account-manager.spec index ad8e76a..42861c9 100644 --- a/flexisip-account-manager.spec +++ b/flexisip-account-manager.spec @@ -8,7 +8,7 @@ #%define _datadir %{_datarootdir} #%define _docdir %{_datadir}/doc -%define build_number 36 +%define build_number 37 %define var_dir /var/opt/belledonne-communications %define opt_dir /opt/belledonne-communications/share/flexisip-account-manager %define env_file "$RPM_BUILD_ROOT/etc/flexisip-account-manager/flexiapi.env" diff --git a/src/xmlrpc/provisioning.php b/src/xmlrpc/provisioning.php index 2a14a19..072eb25 100644 --- a/src/xmlrpc/provisioning.php +++ b/src/xmlrpc/provisioning.php @@ -101,7 +101,7 @@ $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; } elseif (startswith($section, "auth_info_")) { @@ -121,6 +121,14 @@ if (file_exists(REMOTE_PROVISIONING_DEFAULT_CONFIG)) { $domain = isset($_GET['domain']) ? $_GET['domain'] : SIP_DOMAIN; $transport = isset($_GET['transport']) ? $_GET['transport'] : REMOTE_PROVISIONING_DEFAULT_TRANSPORT; + +$request_params = array( + "username" => $username, + "domain" => $domain, + "transport" => $transport, + "ha1" => null, + "algo" => DEFAULT_ALGORITHM, +); if (!empty($username)) { if (REMOTE_PROVISIONING_USE_DIGEST_AUTH) { @@ -166,26 +174,39 @@ if (!empty($username)) { $logger->message("Account id " . $account->id . " is already activated"); } } - } + } - $xml .= '
'; + $request_params["ha1"] = $ha1; + $request_params["algo"] = $algo; + + $xml .= '
'; $xml .= '<sip:' . $username . '@' . $domain . '>'; $xml .= '<sip:' . $domain . ';transport=' . $transport . '>'; $xml .= '<sip:' . $domain . ';transport=' . $transport . '>'; $xml .= '1'; - $xml .= 'push_notification'; + $xml .= 'push_notification'; + if (CUSTOM_HOOKS) { + provisioning_hook_on_proxy_config($xml, $request_params); + } $xml .= '
'; if (!empty($ha1)) { - $xml .= '
'; + $xml .= '
'; $xml .= '' . $username . ''; $xml .= '' . $ha1 . ''; $xml .= '' . $domain . ''; - $xml .= '' . $algo . ''; + $xml .= '' . $algo . ''; + if (CUSTOM_HOOKS) { + provisioning_hook_on_auth_info($xml, $request_params); + } $xml .= '
'; } } +if (CUSTOM_HOOKS) { + provisioning_hook_on_additional_section($xml, $request_params); +} + $xml .= ''; http_response_code(200);