Hi there,
I’m using the latest version of the FreePBX Distro with FreePBX 13.0 with Asterisk 13.12 on Ubuntu.
I was building a program to add devices automatically using bootstrap but when testing the core_devices_add() function with all parameters filled in I keep getting this exception :
[root@localhost ~]# php DevicesScript.php
locale: Cannot set LC_CTYPE to default locale: No such file or directory
Exception: Account must be set! in file /var/www/html/admin/modules/core/Core.class.php on line 1315
Stack trace:
1. Exception->() /var/www/html/admin/modules/core/Core.class.php:1315
2. FreePBX\modules\Core->convertRequest2Array() /var/www/html/admin/modules/core/functions.inc.php:4099
3. core_devices_add() /root/DevicesScript.php:51
EDIT :
I found this example in the freepbx documentation so I tried to use it but it still gives the same exception
<?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');
}
/*
USER VARS:
Array
(
[extension] => 0224
[password] =>
[name] => Display Name
[voicemail] => default
[ringtimer] => 0
[noanswer] =>
[recording] =>
[outboundcid] =>
[sipname] =>
[noanswer_cid] =>
[busy_cid] =>
[chanunavail_cid] =>
[noanswer_dest] =>
[busy_dest] =>
[chanunavail_dest] =>
[mohclass] => default
[callwaiting] => enabled
[cid_masquerade] => 0224
[call_screen] => 0
[pinless] => disabled
[cfringtimer] => 0
[concurrency_limit] => 0
[dialopts] =>
[recording_in_external] => dontcare
[recording_out_external] => dontcare
[recording_in_internal] => dontcare
[recording_out_internal] => dontcare
[recording_ondemand] => disabled
[recording_priority] => 10
)
*/
$vars = array(
"extension" => 255,
"name" => "Bobby",
"password" => base64_encode(openssl_random_pseudo_bytes(30))
);
core_users_add($vars);
//core_devices_add($id,$tech,$dial,$devicetype,$user,$description,$emergency_cid=null,$editmode=false)
core_devices_add(255,'sip','','fixed',255,'Bobby');
?>
Even though I didn’t code the file where the exception is thrown. I was hoping some of you might know how to solve this exception.
Kind regards,
Lowie Daniels