PHP code example of apntalk / freeswitch-xml-projection
1. Go to this page and download the library: Download apntalk/freeswitch-xml-projection library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
apntalk / freeswitch-xml-projection example snippets
declare(strict_types=1);
use APNTalk\FreeSwitchXmlProjection\Directory\A1HashCredential;
use APNTalk\FreeSwitchXmlProjection\Directory\DirectoryDocument;
use APNTalk\FreeSwitchXmlProjection\Directory\DirectoryDomain;
use APNTalk\FreeSwitchXmlProjection\Directory\DirectoryParam;
use APNTalk\FreeSwitchXmlProjection\Directory\DirectoryUser;
use APNTalk\FreeSwitchXmlProjection\Directory\DirectoryXmlRenderer;
use APNTalk\FreeSwitchXmlProjection\Http\XmlCurlRequestParser;
$request = (new XmlCurlRequestParser())->parse($_POST);
if (! $request->isDirectory() || $request->action()?->value !== 'sip_auth') {
return;
}
$document = new DirectoryDocument([
new DirectoryDomain(
'tenant.example.test',
[DirectoryParam::dialStringDefault()],
[],
[
new DirectoryUser(
'1001',
A1HashCredential::fromPlainPassword('1001', 'tenant.example.test', 'secret'),
),
],
),
]);
echo (new DirectoryXmlRenderer())->render($document);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.