Hi
I’m trying to write my own little API so that I can create extensions and users from my external web application.
I have tried this
$settings = [
'extension' => $extension,
'devinfo_secret' => $password,
'name' => $name,
'tech' => 'pjsip',
'devinfo_sipdriver' => 'chan_pjsip',
'userman_directory' => 1,
'userman_assign' => 'add',
'userman_password' => $password,
'userman_group' => [1]
];
$FreePBX = FreePBX::Create();
$Userman = FreePBX::Userman();
$FreePBX->Core->addUser($settings['extension'], $settings);
$FreePBX->Core->addDevice($settings['extension'], $settings['tech'], $sip);
$Userman->addUserByDirectory(1, $extension, $password, $extension, 'Description', array("displayname"=>$name), true);
$FreePBX->Core->addDevice('99' . $settings['extension'], $settings['tech'], $webrtc);
The variables $sip and $webrtc are arrays filled with keys/values, that looks just like those FreePBX uses when creating through the webgui.
But it’s only the “webrtc” extension that can register and make calls.
When I try to register the non-webrtc extension, I see this on Asterisk:
res_pjsip_registrar.c:1082 registrar_on_rx_request: Endpoint 'anonymous' has no configured AORs
which somewhat makes sense, as there’s no entry regarding this extension in etc/asterisk/pjsip.aor.conf - only the webrtc extension.
I have looked deep in the FreePBX code, but I think it’s pretty messy with both procedural and OO mixed together and some functions returns/echos
<script>javascript:alert([...]
I really hope that someone can give some input here.
Thanks