Picture of V1p
Registered 1 year 145 days
V1p Friday, 30 June 2023, 11:06 AM
PBX API DON'T WORK, I FOUND ANOTHER WAY JavaScript
Did't find anything working in the Sdk and the Forum, soo i found another way to accessing pbx api from javascript, all needed is go to pbx objects enable devices api and go to Devices Object and enable the app they code:

var devicesApi = start.consumeApi("com.innovaphone.devices"); //Consume Devices API
devicesApi.send({ mt: "GetGateways" }); // send Request
window.addEventListener("message", getMex); //Make Event Listener with Function you prefer
//##Than make the function to take the data required to craft the access link##
function getMex(obj) { //JSON PARSE THE DATA
var objj = JSON.parse(obj.data); //GET EVENT AND FILTER BY TYPE
if (objj.mt == "ApiResult" && objj.msg.mt == "GetGatewaysResult") {
for (gtw in objj.msg.gateways) {
if (objj.msg.gateways[gtw].id == 1) {//FROM THE PBX WITH ID 1 GET HWID AND THE URI
PBXHWID = objj.msg.gateways[gtw].hwId;
PBXURI = objj.msg.gateways[gtw].uri; //SPLIT AND GET PBXID
passthls = PBXURI.split('/');
PBXURI = passthls.at(-2);
PBXCOMP = passthls.at(-6);
LINKSCR = passthls.at(-9);
PBXLINK = "../../" + PBXCOMP + "/devices/passthrough/" + PBXHWID + "/" + PBXURI;
console.log(passthls);
console.log(PBXURI);
}
}
}
}
//##Then we craft a passtrough link for access to PBX Object for example: ##
var url = PBXLINK + "/PBX0/ADMIN/mod_cmd_login.xml?cmd=show&user=*&search=&search-loc=&search-grp=&hide=&xsl=pbx_objs_right.xsl";
//##Then we need to import JQuery in the htm file to make the request to the url##
$.get(url, function (data) {
console.log(data);
var x = data.querySelectorAll("user");
console.log(x);
}
//#In the Attachment the results (sorry for the censorship)#:
Screenshot_2023-06-30_at_10.51.43.jpg

Picture of V1p
Registered 1 year 145 days
V1p Thursday, 6 July 2023, 12:13 PM
Re: PBX API DON'T WORK, I FOUND ANOTHER WAY JavaScript
sorry wrong discussion.
← You can define your color theme preference here