X-Git-Url: http://repos.xcallymotion.com/?a=blobdiff_plain;f=server%2Fservices%2Fami%2Ftrigger%2Findex.js;h=ffdb8644d7d378efaaa18d76c5404ed25809c531;hb=3b6ec49862a5197d06e7453a43d40dcd68709ea0;hp=60c353488dfe395089986ea0f45e8780094403be;hpb=54b4ff96e83f911255a158fd7e32a0e84ec4b7d0;p=motion2.git diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 60c3534..ffdb864 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 _0xd136=['render','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','data5','windowHeight','data6','600','winApplication','winArguments','format','user:%s','name','jscripty','trigger:%s','exec','queue','routeId','parse','query','search','replace','every','AllConditions','checkConditions','channel','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','upperFirst','AccountId','interaction','message','value','event','agent','membername','lastevent','util','lodash','url','mustache','ioredis','./integration','./cmContact','./script','../../../config/environment','trigger','../ami','redis','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','accounts','salesforceAccounts','vtigerAccounts','freshsalesAccounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','checkTriggers','interface','status','checkTrigger','merge','variables','length','Actions','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2'];(function(_0x3f0aa4,_0x51bbab){var _0xd56fc4=function(_0x7206e2){while(--_0x7206e2){_0x3f0aa4['push'](_0x3f0aa4['shift']());}};_0xd56fc4(++_0x51bbab);}(_0xd136,0xa7));var _0x6d13=function(_0x2127f5,_0x16e431){_0x2127f5=_0x2127f5-0x0;var _0x465c7b=_0xd136[_0x2127f5];return _0x465c7b;};'use strict';var util=require(_0x6d13('0x0'));var _=require(_0x6d13('0x1'));var url=require(_0x6d13('0x2'));var Mustache=require(_0x6d13('0x3'));var Redis=require(_0x6d13('0x4'));var urlforward=require('./urlforward');var integration=require(_0x6d13('0x5'));var cmContact=require(_0x6d13('0x6'));var script=require(_0x6d13('0x7'));var config=require(_0x6d13('0x8'));var logger=require('../../../config/logger')(_0x6d13('0x9'));var ami=require(_0x6d13('0xa'));config[_0x6d13('0xb')]=_['defaults'](config[_0x6d13('0xb')],{'host':_0x6d13('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6d13('0xb')]));var operators={'equals':function(_0x4a0c4d,_0x140e88){return _0x4a0c4d==_0x140e88;},'not_equals':function(_0x475ea2,_0x22d22d){return _0x475ea2!=_0x22d22d;}};var barAndWebActions=[_0x6d13('0xd'),_0x6d13('0x2'),_0x6d13('0xe')];function Trigger(_0x581b9c){this['triggers']=_0x581b9c[_0x6d13('0xf')];this[_0x6d13('0x10')]=_0x581b9c[_0x6d13('0x10')];this[_0x6d13('0x11')]=_0x581b9c[_0x6d13('0x11')];this[_0x6d13('0x12')]=_0x581b9c['templates'];this[_0x6d13('0x13')]=_0x581b9c[_0x6d13('0x13')];this[_0x6d13('0x14')]=_0x581b9c[_0x6d13('0x14')];this[_0x6d13('0x15')]=_0x581b9c[_0x6d13('0x15')];this['salesforceAccounts']=_0x581b9c['salesforceAccounts'];this[_0x6d13('0x16')]=_0x581b9c[_0x6d13('0x16')];this[_0x6d13('0x17')]=_0x581b9c[_0x6d13('0x17')];this[_0x6d13('0x18')]=_0x581b9c[_0x6d13('0x18')];this['vtigerAccounts']=_0x581b9c['vtigerAccounts'];this['servicenowAccounts']=_0x581b9c[_0x6d13('0x19')];this[_0x6d13('0x1a')]=_0x581b9c[_0x6d13('0x1a')];this['freshsalesAccounts']=_0x581b9c['freshsalesAccounts'];this[_0x6d13('0x1b')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x6d13('0x1c')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x6d13('0x16')],'zoho':this['zohoAccounts'],'desk':this[_0x6d13('0x18')],'vtiger':this[_0x6d13('0x1d')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x6d13('0x1e')],'servicenow':this[_0x6d13('0x19')]};ami['on'](_0x6d13('0x1f'),this['syncCustomEvent'][_0x6d13('0x20')](this));ami['on'](_0x6d13('0x21'),this[_0x6d13('0x22')]['bind'](this));ami['on'](_0x6d13('0x23'),this['syncCustomEvent'][_0x6d13('0x20')](this));ami['on'](_0x6d13('0x24'),this[_0x6d13('0x22')]['bind'](this));ami['on']('custom:agentnosuchnumber',this[_0x6d13('0x22')][_0x6d13('0x20')](this));ami['on'](_0x6d13('0x25'),this[_0x6d13('0x22')][_0x6d13('0x20')](this));ami['on'](_0x6d13('0x26'),this[_0x6d13('0x22')][_0x6d13('0x20')](this));ami['on'](_0x6d13('0x27'),this[_0x6d13('0x22')]['bind'](this));ami['on'](_0x6d13('0x28'),this[_0x6d13('0x22')][_0x6d13('0x20')](this));ami['on']('custom:amd',this[_0x6d13('0x22')][_0x6d13('0x20')](this));ami['on'](_0x6d13('0x29'),this[_0x6d13('0x22')]['bind'](this));ami['on'](_0x6d13('0x2a'),this['syncCustomEvent']['bind'](this));ami['on'](_0x6d13('0x2b'),this[_0x6d13('0x2c')][_0x6d13('0x20')](this));ami['on'](_0x6d13('0x2d'),this[_0x6d13('0x2c')][_0x6d13('0x20')](this));ami['on'](_0x6d13('0x2e'),this[_0x6d13('0x2c')][_0x6d13('0x20')](this));ami['on']('custom:newinteraction',this[_0x6d13('0x22')][_0x6d13('0x20')](this));ami['on'](_0x6d13('0x2f'),this[_0x6d13('0x22')]['bind'](this));ami['on'](_0x6d13('0x30'),this['syncCustomEvent'][_0x6d13('0x20')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0x6d13('0x31'),this[_0x6d13('0x22')][_0x6d13('0x20')](this));ami['on'](_0x6d13('0x32'),this[_0x6d13('0x22')][_0x6d13('0x20')](this));}Trigger[_0x6d13('0x33')][_0x6d13('0x34')]=function(_0x306478,_0x5bd657,_0x459514){logger[_0x6d13('0x35')](_0x306478,_0x5bd657,JSON[_0x6d13('0x36')](_0x459514));io['to'](_0x306478)[_0x6d13('0x34')](_0x5bd657,_0x459514);};Trigger[_0x6d13('0x33')][_0x6d13('0x22')]=function(_0x4b2f97){var _0x3dcd56=_['clone'](_0x4b2f97);this[_0x6d13('0x37')](_0x3dcd56);};Trigger[_0x6d13('0x33')][_0x6d13('0x2c')]=function(_0x405ba3){if(this['agents'][_0x405ba3[_0x6d13('0x38')]]){this[_0x6d13('0x22')](_0x405ba3);}};Trigger[_0x6d13('0x33')]['checkTriggers']=function(_0x1f297b){var _0x1e86da;for(var _0x494a77 in this[_0x6d13('0xf')]){if(this[_0x6d13('0xf')]['hasOwnProperty'](_0x494a77)){if(this[_0x6d13('0xf')][_0x494a77][_0x6d13('0x39')]){_0x1e86da=this[_0x6d13('0x3a')](this[_0x6d13('0xf')][_0x494a77],_0x1f297b);if(_0x1e86da){_[_0x6d13('0x3b')](_0x1f297b,_0x1f297b[_0x6d13('0x3c')]);for(var _0x2e1fea=0x0,_0x49df9b,_0x40ad3e,_0x11cad7;_0x2e1fea