X-Git-Url: http://repos.xcallymotion.com/?a=blobdiff_plain;f=server%2Fservices%2Fami%2Ftrigger%2Findex.js;h=fe03921316830d07afab0e8199f4f812f4a85cab;hb=fb34d7d7b73e912de94d572e15e1910ea03e3516;hp=972e2e8c7e53c61127f6b0988dc8b8a1ac14f840;hpb=3b98a30f4ada10cd5d8b95df3555955dc5830a8a;p=motion2.git diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 972e2e8..fe03921 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 _0x9dfc=['merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','template\x20not\x20found','uri','data3','isNil','data4','location','data5','800','windowHeight','data6','600','winapp','winApplication','render','winArguments','format','user:%s','name','trigger:%s:%s','trigger:%s','action','exec','queue','script','buildUri','parse','query','search','channel','AllConditions','every','checkConditions','some','AnyConditions','account','chat','operator','upperFirst','AccountId','value','interaction','message','event','membername','lastevent','routeId','mailSubstatus','null','substatus','offlineMessage','created','equals','util','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','url','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:substatus','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','emit','info','stringify','prototype','clone','undefined','motionChannel','voice','interface','checkTriggers','hasOwnProperty','checkTrigger'];(function(_0x198e87,_0x27951f){var _0x132b38=function(_0x5912ea){while(--_0x5912ea){_0x198e87['push'](_0x198e87['shift']());}};_0x132b38(++_0x27951f);}(_0x9dfc,0x140));var _0xc9df=function(_0x2bbf4e,_0x21ddbc){_0x2bbf4e=_0x2bbf4e-0x0;var _0x39d499=_0x9dfc[_0x2bbf4e];return _0x39d499;};'use strict';var util=require(_0xc9df('0x0'));var _=require('lodash');var url=require('url');var Mustache=require('mustache');var Redis=require(_0xc9df('0x1'));var urlforward=require(_0xc9df('0x2'));var integration=require(_0xc9df('0x3'));var cmContact=require(_0xc9df('0x4'));var script=require(_0xc9df('0x5'));var config=require(_0xc9df('0x6'));var logger=require(_0xc9df('0x7'))(_0xc9df('0x8'));var ami=require(_0xc9df('0x9'));config[_0xc9df('0xa')]=_['defaults'](config[_0xc9df('0xa')],{'host':_0xc9df('0xb'),'port':0x18eb});var io=require(_0xc9df('0xc'))(new Redis(config[_0xc9df('0xa')]));var operators={'equals':function(_0xded560,_0x59ce91){return _0xded560==_0x59ce91;},'not_equals':function(_0x2eab57,_0x4b3e47){return _0x2eab57!=_0x4b3e47;}};var barAndWebActions=[_0xc9df('0xd'),_0xc9df('0xe'),'winapp'];function Trigger(_0xd25c8a){this[_0xc9df('0xf')]=_0xd25c8a['triggers'];this[_0xc9df('0x10')]=_0xd25c8a[_0xc9df('0x10')];this[_0xc9df('0x11')]=_0xd25c8a[_0xc9df('0x11')];this[_0xc9df('0x12')]=_0xd25c8a[_0xc9df('0x12')];this[_0xc9df('0x13')]=_0xd25c8a[_0xc9df('0x13')];this['zendeskAccounts']=_0xd25c8a[_0xc9df('0x14')];this[_0xc9df('0x15')]=_0xd25c8a[_0xc9df('0x15')];this[_0xc9df('0x16')]=_0xd25c8a['salesforceAccounts'];this[_0xc9df('0x17')]=_0xd25c8a[_0xc9df('0x17')];this[_0xc9df('0x18')]=_0xd25c8a[_0xc9df('0x18')];this[_0xc9df('0x19')]=_0xd25c8a['deskAccounts'];this[_0xc9df('0x1a')]=_0xd25c8a[_0xc9df('0x1a')];this[_0xc9df('0x1b')]=_0xd25c8a[_0xc9df('0x1b')];this[_0xc9df('0x1c')]=_0xd25c8a['dynamics365Accounts'];this[_0xc9df('0x1d')]=_0xd25c8a[_0xc9df('0x1d')];this[_0xc9df('0x1e')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xc9df('0x16')],'freshdesk':this[_0xc9df('0x15')],'sugarcrm':this[_0xc9df('0x17')],'zoho':this[_0xc9df('0x18')],'desk':this[_0xc9df('0x19')],'vtiger':this[_0xc9df('0x1a')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xc9df('0x1d')],'servicenow':this[_0xc9df('0x1b')]};ami['on'](_0xc9df('0x1f'),this[_0xc9df('0x20')][_0xc9df('0x21')](this));ami['on'](_0xc9df('0x22'),this['syncCustomEvent'][_0xc9df('0x21')](this));ami['on'](_0xc9df('0x23'),this[_0xc9df('0x20')]['bind'](this));ami['on'](_0xc9df('0x24'),this[_0xc9df('0x20')]['bind'](this));ami['on'](_0xc9df('0x25'),this[_0xc9df('0x20')][_0xc9df('0x21')](this));ami['on'](_0xc9df('0x26'),this[_0xc9df('0x20')]['bind'](this));ami['on']('custom:agentbusy',this[_0xc9df('0x20')][_0xc9df('0x21')](this));ami['on'](_0xc9df('0x27'),this['syncCustomEvent'][_0xc9df('0x21')](this));ami['on'](_0xc9df('0x28'),this['syncCustomEvent'][_0xc9df('0x21')](this));ami['on'](_0xc9df('0x29'),this['syncCustomEvent']['bind'](this));ami['on'](_0xc9df('0x2a'),this[_0xc9df('0x20')][_0xc9df('0x21')](this));ami['on'](_0xc9df('0x2b'),this[_0xc9df('0x20')][_0xc9df('0x21')](this));ami['on'](_0xc9df('0x2c'),this[_0xc9df('0x2d')][_0xc9df('0x21')](this));ami['on']('custom:dialconnect',this[_0xc9df('0x2d')][_0xc9df('0x21')](this));ami['on'](_0xc9df('0x2e'),this[_0xc9df('0x2d')][_0xc9df('0x21')](this));ami['on'](_0xc9df('0x2f'),this['syncCustomEvent'][_0xc9df('0x21')](this));ami['on']('custom:closedinteraction',this[_0xc9df('0x20')][_0xc9df('0x21')](this));ami['on'](_0xc9df('0x30'),this[_0xc9df('0x20')][_0xc9df('0x21')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0xc9df('0x21')](this));ami['on'](_0xc9df('0x31'),this[_0xc9df('0x20')]['bind'](this));ami['on']('custom:acceptmessage',this[_0xc9df('0x20')][_0xc9df('0x21')](this));ami['on'](_0xc9df('0x32'),this[_0xc9df('0x20')][_0xc9df('0x21')](this));ami['on'](_0xc9df('0x33'),this[_0xc9df('0x20')]['bind'](this));}Trigger['prototype'][_0xc9df('0x34')]=function(_0x52d5f6,_0x48b472,_0x432023){logger[_0xc9df('0x35')](_0x52d5f6,_0x48b472,JSON[_0xc9df('0x36')](_0x432023));io['to'](_0x52d5f6)[_0xc9df('0x34')](_0x48b472,_0x432023);};Trigger[_0xc9df('0x37')][_0xc9df('0x20')]=function(_0x151c8f){var _0x5e384b=_[_0xc9df('0x38')](_0x151c8f);if(typeof _0x5e384b['motionChannel']===_0xc9df('0x39')){_0x5e384b[_0xc9df('0x3a')]=_0xc9df('0x3b');}this['checkTriggers'](_0x5e384b);};Trigger[_0xc9df('0x37')][_0xc9df('0x2d')]=function(_0x3b0ba3){if(this[_0xc9df('0x10')][_0x3b0ba3[_0xc9df('0x3c')]]){this[_0xc9df('0x20')](_0x3b0ba3);}};Trigger[_0xc9df('0x37')][_0xc9df('0x3d')]=function(_0x3ebade){var _0x22ddd4;for(var _0x292739 in this[_0xc9df('0xf')]){if(this['triggers'][_0xc9df('0x3e')](_0x292739)){if(this['triggers'][_0x292739]['status']){_0x22ddd4=this[_0xc9df('0x3f')](this['triggers'][_0x292739],_0x3ebade);if(_0x22ddd4){_[_0xc9df('0x40')](_0x3ebade,_0x3ebade[_0xc9df('0x41')]);for(var _0xc8bfd5=0x0,_0x2e5599,_0x103ff4,_0x1e0c0d;_0xc8bfd5