Specifications
PA-001011-03-04 Aastra July 2014
307
$output .= "<Parameter>password</Parameter>\n";
$output .= "<Default></Default>\n";
$output .= "</AastraIPPhoneInputScreen>\n";
header("Content-Length: ".strlen($output));
echo $output;
exit;
}
# IF authentication failed
if (!$userinfo = verify_user($extension, $password))
{
# Display error
$output = "<AastraIPPhoneTextScreen LockIn=\"yes\"
destroyOnExit=\"yes\">\n";
$output .= "<Title>Authentication failed</Title>\n";
$output .= "<Text>Wrong user and password.</Text>\n";
$output .= "</AastraIPPhoneTextScreen>\n";
header("Content-Type: text/xml");
header("Content-Length: ".strlen($output));
echo $output;
exit;
}
# IF already configured
if(lookup_config_file($extension)==1)
{
# Display error
$output = "<AastraIPPhoneTextScreen LockIn=\"yes\"
destroyOnExit=\"yes\">\n";
$output .= "<Title>Error</Title>\n";
$output .= "<Text>Extension already in use.</Text>\n";
$output .= "</AastraIPPhoneTextScreen>\n";
header("Content-Type: text/xml");
header("Content-Length: ".strlen($output));
echo $output;
exit;
}
# Get all the user data
$sip_array = parse_ini_file($ASTERISK_LOCATION."sip_additional.conf", true);
# If user not found
if ($sip_array[$extension]==NULL)
{
# Display error
$output = "<AastraIPPhoneTextScreen LockIn=\"yes\"
destroyOnExit=\"yes\">\n";
$output .= "<Title>Internal error</Title>\n";
$output .= "<Text>Extension is not provisioned.</Text>\n";
$output .= "</AastraIPPhoneTextScreen>\n";
header("Content-Type: text/xml");
header("Content-Length: ".strlen($output));
echo $output;
exit;
}
else
{
# Collect data
$username=get_username($extension);
$secret=get_secret($extension);
$callerid=get_callerid($extension);
}
# Get MAC address and type of phone
$value=Aastra_decode_HTTP_header();
# Create mac.cfg
create_mac($value[1],$extension,$username,$secret,$callerid,$value[0]);
# Update config file
update_config_file($extension,$value[1],$value[3],$value[0]);