Getting all registered users from the ProSBC
2 posters
Page 1 of 1
Getting all registered users from the ProSBC
Problem:
Currently, the Status screen in the registrar shows a maximum of 100 registered users. If you have more than 100 registered users you cannot see all of them.Solution:
Using the attached python script can get all registered users and can save it to a CSV file.Using Instructions::
In the script you need to define following information:
hostname: ProSBC Management IP address
port: if it is different than the default SSH port please modify it
username: ProSBC SSH connection Username
password: ProSBC SSH password
local_filepath: Define the local file path where to save the output.
- Attachments
Re: Getting all registered users from the ProSBC
Alternative Solution:
Using a Client Side Bookmarklet we can call the information through the browser to work with any ProSBC currently in the field.Minified Code:
- Code:
javascript:(function(){/*! Version: 0.0.1*/var e=document.createElement("div");e.textContent="Gathering registered users...",e.style.position="fixed",e.style.top="50%",e.style.left="50%",e.style.transform="translate(-50%, -50%)",e.style.backgroundColor="#fff",e.style.padding="10px",e.style.border="1px solid #ccc",e.style.zIndex="9999",document.body.appendChild(e);var t=window.location.origin+"/status?path=%2Fsip_registration%2Fdomain%2Fuser%2Fcontact",o=new XMLHttpRequest;o.open("GET",t),o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Authorization",window.btoa(document.cookie)),o.responseType="blob",o.onload=function(){var t=new FileReader;t.onloadend=function(){var o,n,s=JSON.parse(t.result),d=(o=s,n={},Object.keys(o).sort().forEach((function(e){n[e]=o[e]})),n),r=JSON.stringify(d,null,2),i=new Blob([r],{type:"application/json"}),a=document.createElement("a");a.href=window.URL.createObjectURL(i),a.download="ProSBC_Registered_Users.json",a.style.display="none",document.body.appendChild(a),a.click(),document.body.removeChild(a),document.body.removeChild(e)},t.readAsText(o.response)},o.send()})();
Installation Instructions
Introduction:Bookmarklets are when a user saves JavaScript code as the URL Path in a book mark on their browser. It can allow local control of a web resource, along with adding increased functionality without the need of any changes on the server side.
- Create a new bookmark on your browser, give it a cosmetic name and then copy the entire minified code above into the URL Field.
- Log in to your ProSBC
- Click the bookmark created in Step 1.
- Wait for your download to begin.
In larger configs this can take up to several minutes. You can monitor the debugging console in your browser to troubleshoot if nothing arrives after 2 minutes. - Name and save the file.
UnMinified Code:
- Code:
javascript:(function() {
/*! Version: 0.0.1
Script MUST begin with 'javascript:' to function as a bookmarklet.
Create loading message for User.*/
var loadingElement = document.createElement('div');
loadingElement.textContent = 'Gathering registered users...';
loadingElement.style.position = 'fixed';
loadingElement.style.top = '50%';
loadingElement.style.left = '50%';
loadingElement.style.transform = 'translate(-50%, -50%)';
loadingElement.style.backgroundColor = '#fff';
loadingElement.style.padding = '10px';
loadingElement.style.border = '1px solid #ccc';
loadingElement.style.zIndex = '9999';
document.body.appendChild(loadingElement);
/*!Using current authentication and url, gather registered user's contact information*/
var url = window.location.origin + '/status?path=%2Fsip_registration%2Fdomain%2Fuser%2Fcontact';
var xhr = new XMLHttpRequest();
xhr.open('GET', url);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('Authorization', window.btoa(document.cookie));
xhr.responseType = 'blob';
xhr.onload = function() {
var reader = new FileReader();
reader.onloadend = function() {
var json = JSON.parse(reader.result);
/*!Sort the results*/
var sortedJson = sortJsonObjectKeys(json);
/*!Set formatting and indentation for proper .json file to download.*/
var indentedJson = JSON.stringify(sortedJson, null, 2);
var blob = new Blob([indentedJson], { type: 'application/json' });
var a = document.createElement('a');
a.href = window.URL.createObjectURL(blob);
/*!Modify default configuration name here.*/
a.download = 'ProSBC_Registered_Users.json';
a.style.display = 'none';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
document.body.removeChild(loadingElement);
};
reader.readAsText(xhr.response);
};
xhr.send();
/*!Function called above to sort the response alphabetically so that each export looks similar.*/
function sortJsonObjectKeys(jsonObj) {
var sortedObj = {};
var keys = Object.keys(jsonObj).sort();
keys.forEach(function(key) {
sortedObj[key] = jsonObj[key];
});
return sortedObj;
}
})();
jpuckett- Number of Messages : 14
Point : 22
Registration Date : 2022-03-15
Similar topics
» Where can I see registered users?
» SNOM Phones registered via ProSBC to 3CX Cannot Receive Calls
» How to manage users?
» Manipulate registered route
» NAT Keep-Alive for registered remote workers
» SNOM Phones registered via ProSBC to 3CX Cannot Receive Calls
» How to manage users?
» Manipulate registered route
» NAT Keep-Alive for registered remote workers
Page 1 of 1
Permissions in this forum:
You can reply to topics in this forum