I was trying to add extension programatically. There I was facing some issues. My code was
<?php
$bootstrap_settings = array();
$bootstrap_settings['freepbx_auth'] = false;
if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) {
include_once('/etc/asterisk/freepbx.conf');
}
$vars = array(
"extension" => 9876543200,
"name" => "Test",
"devinfo_secret" => "testing",
"devinfo_mediaencryption" => "sdes",
);
core_users_add($vars);
core_devices_add(9876543200,'pjsip','PJSIP/9876543200','fixed',9876543200,'Test');
And output
[root@sg html]# php a.php
[FATAL] Fields are empty
Trace Back:
/var/www/html/admin/modules/core/Core.class.php:1389 die_freepbx()
[0]: Fields are empty
/var/www/html/admin/modules/core/functions.inc.php:4227 FreePBX\modules\Core->convertRequest2Array()
[0]: 9876543200
[1]: pjsip
[2]: 2
/var/www/html/a.php:18 core_devices_add()
[0]: 9876543200
[1]: pjsip
[2]: PJSIP/9876543200
[3]: fixed
[4]: 9876543200
[5]: Test
I tried to add PJSIP extension but in GUI I was getting virtual device added. I need to add media encryption also. Can anyone guide me?