Hi All,
First time post here, long time freepbx user
I am trying to automate the creation & maintenance of some of the tasks on our PBXs using Chef.
As a first step, i have created a short PHP script, to create new trunks, using a function i found in /var/www/html/admin/modules/core/functions.inc.php .
Script looks like this:
<?php
$bootstrap_settings = array();
$bootstrap_settings['freepbx_auth'] = false;
include '/etc/freepbx.conf';
$tech = "pjsip";
$channelid = "";
$dialoutprefix = "";
$maxchans = "";
$outcid = "447878787777";
$peerdetails = "test";
$usercontext = "";
$userconfig = "test";
$register = "yesplease";
$keepcid = "";
$failtrunk = "";
$disabletrunk = FALSE;
$provider = "someprovider";
$continue = TRUE;
$dialopts = "";
core_trunks_add($tech, $channelid, $dialoutprefix, $maxchans, $outcid, $peerdetails, $usercontext, $userconfig, $register, $keepcid, $failtrunk, $disabletrunk, $name, $provider, $continue, $dialopts)
//test to map params
//core_trunks_add("pjsip", "1", "2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21")
// 1 = tech
// 2 = outbound dial prefix
// 3 = max channels
// 4 = outbound caller idate
// 12= Trunk Name
// 15 = dial openssl_get_cert_locations
// 10 = monitor trunk failures 1
?>
And it kinda works - it can add a new trunk, appears fine, putting in the name, and a lot of the options above work, i can figure out the rest later - however i cant figure out how to add in the specific PJSIP settings, i.e. Username, Passowrd, Server etc. Would also be nice to figure out how to edit the advanced settings as well.
Anyone with any ideas of where to look - would be much appreciated!