mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-01-17 10:08:05 +00:00
Added hooks to provisioning
This commit is contained in:
parent
cfd3e6abfc
commit
dc222ecd9e
3 changed files with 44 additions and 8 deletions
|
|
@ -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 .= '<entry name="conference_factory_uri" overwrite="true">sip:conference-factory@' . $request_params["domain"] . '</entry>';
|
||||
}
|
||||
function provisioning_hook_on_auth_info($xml, $request_params) {
|
||||
|
||||
}
|
||||
|
||||
function provisioning_hook_on_additional_section($xml, $request_params) {
|
||||
$xml .= '<section name="sip">';
|
||||
$xml .= '<entry name="rls_uri" overwrite="true">sips:rls@' . $request_params["domain"] . '</entry>';
|
||||
$xml .= '</section>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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 .= '<section name="' . $section . '"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>';
|
||||
$xml .= '<section name="' . $section . '">';
|
||||
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 .= '<section name="proxy_' . $proxy_config_index . '"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>';
|
||||
$request_params["ha1"] = $ha1;
|
||||
$request_params["algo"] = $algo;
|
||||
|
||||
$xml .= '<section name="proxy_' . $proxy_config_index . '">';
|
||||
$xml .= '<entry name="reg_identity"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '><sip:' . $username . '@' . $domain . '></entry>';
|
||||
$xml .= '<entry name="reg_proxy"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '><sip:' . $domain . ';transport=' . $transport . '></entry>';
|
||||
$xml .= '<entry name="reg_route"><sip:' . $domain . ';transport=' . $transport . '></entry>';
|
||||
$xml .= '<entry name="reg_sendregister"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>1</entry>';
|
||||
$xml .= '<entry name="refkey"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>push_notification</entry>';
|
||||
$xml .= '<entry name="refkey"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>push_notification</entry>';
|
||||
if (CUSTOM_HOOKS) {
|
||||
provisioning_hook_on_proxy_config($xml, $request_params);
|
||||
}
|
||||
$xml .= '</section>';
|
||||
|
||||
if (!empty($ha1)) {
|
||||
$xml .= '<section name="auth_info_' . $auth_info_index . '"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>';
|
||||
$xml .= '<section name="auth_info_' . $auth_info_index . '">';
|
||||
$xml .= '<entry name="username"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>' . $username . '</entry>';
|
||||
$xml .= '<entry name="ha1"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>' . $ha1 . '</entry>';
|
||||
$xml .= '<entry name="realm"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>' . $domain . '</entry>';
|
||||
$xml .= '<entry name="algorithm"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>' . $algo . '</entry>';
|
||||
$xml .= '<entry name="algorithm"' . (REMOTE_PROVISIONING_OVERWRITE_ALL ? ' overwrite="true"' : '') . '>' . $algo . '</entry>';
|
||||
if (CUSTOM_HOOKS) {
|
||||
provisioning_hook_on_auth_info($xml, $request_params);
|
||||
}
|
||||
$xml .= '</section>';
|
||||
}
|
||||
}
|
||||
|
||||
if (CUSTOM_HOOKS) {
|
||||
provisioning_hook_on_additional_section($xml, $request_params);
|
||||
}
|
||||
|
||||
$xml .= '</config>';
|
||||
|
||||
http_response_code(200);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue