/*+***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*************************************************************************************/
var Vtiger_PBXManager_Js = {
/**
* Function registers PBX for popups
*/
registerPBXCall : function() {
Vtiger_PBXManager_Js.requestPBXgetCalls();
},
/**
* Function registers PBX for Outbound Call
*/
registerPBXOutboundCall : function(number,record) {
Vtiger_PBXManager_Js.makeOutboundCall(number,record);
},
/**
* Function request for PBX popups
*/
requestPBXgetCalls : function() {
var url = 'index.php?module=PBXManager&action=IncomingCallPoll&mode=searchIncomingCalls';
app.request.get({url: url}).then(function(e, result){
if(result) {
for(i=0; i< result.length; i++) {
var record = result[i];
if(jQuery('#pbxcall_'+record.pbxmanagerid+'').size()== 0 )
Vtiger_PBXManager_Js.showPBXIncomingCallPopup(record);
else
Vtiger_PBXManager_Js.updatePBXIncomingCallPopup(record);
}
}
});
Vtiger_PBXManager_Js.removeCompletedCallPopup();
},
/**
* Function display the PBX popup
*/
showPBXIncomingCallPopup : function(record) {
var params = {
title: app.vtranslate('JS_PBX_INCOMING_CALL'),
message: '