X-Git-Url: http://repos.xcallymotion.com/?a=blobdiff_plain;f=server%2Fservices%2Fami%2Ftrigger%2Findex.js;h=c5dffd4870b70be05b6819f2591faa94cc95bf69;hb=ef4e758b3a8a542ed14842116a07db29f3cf2e7c;hp=fd8c8db59f03a9db32559d20438b000a2805e8f7;hpb=6b8dca8de1a6b807be7e36077511bb032e7382e5;p=motion2.git diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index fd8c8db..c5dffd4 100644 --- a/server/services/ami/trigger/index.js +++ b/server/services/ami/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfb6=['freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:incomingmessage','custom:rejectmessage','prototype','info','interface','checkTriggers','status','checkTrigger','merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','uriLocation','800','windowHeight','data6','600','winApplication','emit','format','user:%s','name','action','data1','jscripty','trigger:%s','exec','integration','routeId','urlforward','script','query','search','replace','AllConditions','checkConditions','channel','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','queue','agent','membername','lastevent','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','templates','voiceExtensions','zendeskAccounts'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xcfb6,0xd1));var _0x6cfb=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0xcfb6[_0x1e3c02];return _0x4d26d7;};'use strict';var util=require(_0x6cfb('0x0'));var _=require(_0x6cfb('0x1'));var url=require(_0x6cfb('0x2'));var Mustache=require(_0x6cfb('0x3'));var Redis=require(_0x6cfb('0x4'));var urlforward=require(_0x6cfb('0x5'));var integration=require(_0x6cfb('0x6'));var cmContact=require(_0x6cfb('0x7'));var script=require(_0x6cfb('0x8'));var config=require(_0x6cfb('0x9'));var logger=require(_0x6cfb('0xa'))(_0x6cfb('0xb'));var ami=require('../ami');config[_0x6cfb('0xc')]=_[_0x6cfb('0xd')](config[_0x6cfb('0xc')],{'host':_0x6cfb('0xe'),'port':0x18eb});var io=require(_0x6cfb('0xf'))(new Redis(config[_0x6cfb('0xc')]));var operators={'equals':function(_0x4b3b94,_0x2bc19b){return _0x4b3b94==_0x2bc19b;},'not_equals':function(_0xf068db,_0x1495ba){return _0xf068db!=_0x1495ba;}};var barAndWebActions=[_0x6cfb('0x10'),_0x6cfb('0x2'),_0x6cfb('0x11')];function Trigger(_0xbde6f8){this[_0x6cfb('0x12')]=_0xbde6f8[_0x6cfb('0x12')];this[_0x6cfb('0x13')]=_0xbde6f8[_0x6cfb('0x13')];this['voiceQueues']=_0xbde6f8['voiceQueues'];this[_0x6cfb('0x14')]=_0xbde6f8['templates'];this[_0x6cfb('0x15')]=_0xbde6f8[_0x6cfb('0x15')];this[_0x6cfb('0x16')]=_0xbde6f8[_0x6cfb('0x16')];this[_0x6cfb('0x17')]=_0xbde6f8[_0x6cfb('0x17')];this[_0x6cfb('0x18')]=_0xbde6f8[_0x6cfb('0x18')];this[_0x6cfb('0x19')]=_0xbde6f8[_0x6cfb('0x19')];this[_0x6cfb('0x1a')]=_0xbde6f8['zohoAccounts'];this[_0x6cfb('0x1b')]=_0xbde6f8['deskAccounts'];this[_0x6cfb('0x1c')]=_0xbde6f8[_0x6cfb('0x1c')];this[_0x6cfb('0x1d')]=_0xbde6f8[_0x6cfb('0x1d')];this[_0x6cfb('0x1e')]=_0xbde6f8[_0x6cfb('0x1e')];this[_0x6cfb('0x1f')]=_0xbde6f8['freshsalesAccounts'];this[_0x6cfb('0x20')]={'zendesk':this[_0x6cfb('0x16')],'salesforce':this[_0x6cfb('0x18')],'freshdesk':this[_0x6cfb('0x17')],'sugarcrm':this[_0x6cfb('0x19')],'zoho':this[_0x6cfb('0x1a')],'desk':this[_0x6cfb('0x1b')],'vtiger':this[_0x6cfb('0x1c')],'dynamics365':this[_0x6cfb('0x1e')],'freshsales':this[_0x6cfb('0x1f')],'servicenow':this[_0x6cfb('0x1d')]};ami['on'](_0x6cfb('0x21'),this[_0x6cfb('0x22')][_0x6cfb('0x23')](this));ami['on'](_0x6cfb('0x24'),this['syncCustomEvent'][_0x6cfb('0x23')](this));ami['on'](_0x6cfb('0x25'),this[_0x6cfb('0x22')]['bind'](this));ami['on'](_0x6cfb('0x26'),this['syncCustomEvent'][_0x6cfb('0x23')](this));ami['on']('custom:agentnosuchnumber',this[_0x6cfb('0x22')][_0x6cfb('0x23')](this));ami['on'](_0x6cfb('0x27'),this[_0x6cfb('0x22')][_0x6cfb('0x23')](this));ami['on'](_0x6cfb('0x28'),this['syncCustomEvent'][_0x6cfb('0x23')](this));ami['on']('custom:agentcongestion',this[_0x6cfb('0x22')][_0x6cfb('0x23')](this));ami['on'](_0x6cfb('0x29'),this[_0x6cfb('0x22')][_0x6cfb('0x23')](this));ami['on'](_0x6cfb('0x2a'),this[_0x6cfb('0x22')][_0x6cfb('0x23')](this));ami['on'](_0x6cfb('0x2b'),this[_0x6cfb('0x22')][_0x6cfb('0x23')](this));ami['on'](_0x6cfb('0x2c'),this[_0x6cfb('0x2d')]['bind'](this));ami['on']('custom:dialconnect',this[_0x6cfb('0x2d')][_0x6cfb('0x23')](this));ami['on'](_0x6cfb('0x2e'),this['syncAgentDial'][_0x6cfb('0x23')](this));ami['on']('custom:newinteraction',this['syncCustomEvent'][_0x6cfb('0x23')](this));ami['on']('custom:closedinteraction',this[_0x6cfb('0x22')][_0x6cfb('0x23')](this));ami['on'](_0x6cfb('0x2f'),this[_0x6cfb('0x22')][_0x6cfb('0x23')](this));ami['on']('custom:outgoingmessage',this[_0x6cfb('0x22')]['bind'](this));ami['on']('custom:acceptmessage',this[_0x6cfb('0x22')][_0x6cfb('0x23')](this));ami['on'](_0x6cfb('0x30'),this['syncCustomEvent']['bind'](this));}Trigger[_0x6cfb('0x31')]['emit']=function(_0x47cc47,_0x720c48,_0x308521){logger[_0x6cfb('0x32')](_0x47cc47,_0x720c48,JSON['stringify'](_0x308521));io['to'](_0x47cc47)['emit'](_0x720c48,_0x308521);};Trigger['prototype'][_0x6cfb('0x22')]=function(_0xa7411b){var _0x44cade=_['clone'](_0xa7411b);this['checkTriggers'](_0x44cade);};Trigger['prototype'][_0x6cfb('0x2d')]=function(_0xc28f8a){if(this['agents'][_0xc28f8a[_0x6cfb('0x33')]]){this[_0x6cfb('0x22')](_0xc28f8a);}};Trigger[_0x6cfb('0x31')][_0x6cfb('0x34')]=function(_0x598c7b){var _0x5f1646;for(var _0x1e591d in this[_0x6cfb('0x12')]){if(this['triggers']['hasOwnProperty'](_0x1e591d)){if(this['triggers'][_0x1e591d][_0x6cfb('0x35')]){_0x5f1646=this[_0x6cfb('0x36')](this[_0x6cfb('0x12')][_0x1e591d],_0x598c7b);if(_0x5f1646){_[_0x6cfb('0x37')](_0x598c7b,_0x598c7b[_0x6cfb('0x38')]);for(var _0x37e0bc=0x0,_0x5612d3,_0x2bab9c,_0x4d603c;_0x37e0bc