Func core_users_add

Hey,

I’m trying to build a external app to add, edit and delete users, I’ve managed to do all three items but there’s some problems.

When using the function “core_users_add()” to add accounts the password field is empty, I’ve checked the database and the users table has the password but the sip table did not have secret so I’m completely confused.

I’ve checked the functions.inc.php to try and figure out if I’m missing a value and I’ve even inserted a print command to see if the password is being passed to the code and it is, so I’ve got no clue what to do.

The voicemail field in the users table stay novm even though I’m passing a default value to the command, so also not sure why its doing that, I am adding a voicemail box and it shows up when looking at the account in the freepbx interface.

$vars = array( 'name' => "$firstname $lastname", 'extension' => $extension, 'password' => '123psas123', 'recording_in_external' => 'recording=always', 'recording_out_external' => 'recording=always', 'recording_in_internal' => 'recording=always', 'recording_out_internal' => 'recording=always', 'device' => "SIP/$extension", 'callwaiting' => 'enabled', 'pinless' => ($pinless == 1 ? 'enabled' : 'disabled'), 'voicemail' => ($voicemail == 1 ? 'default' : 'novm'), 'ringtimer' => '60', 'cid_masquerade' => "0127414400", ); core_users_add($vars, false);

if ($voicemail == 1) {
$vars = array (
‘extension’ => $extension,
‘vmpwd’ => $vmpwd,
‘name’ => “$firstname $lastname”,
‘email’ => $vmemail,
‘options’ => “attach=”.($vmattch == 1 ? ‘yes’ : ‘no’)."|saycid=".($vmcid == 1 ? ‘yes’ : ‘no’)."|envelope=no|delete=".($vmdel == 1 ? ‘yes’ : ‘no’),
‘vmcontext’ =>‘default’
);

voicemail_mailbox_add($extension, $vars);

}

Any help would be wonderful.

Thank you.

So if you look at the SQL query getting passed at line 5489 (assuming you’re on latest 2.11) of core/functions.inc.php does it have the password? If so, what is MySQL saying about it?