1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
17 // *************************************************************************
18 var _0xcf97=['isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','message','join','info','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x11178d,_0x195521){var _0x4d30d1=function(_0x55e1e8){while(--_0x55e1e8){_0x11178d['push'](_0x11178d['shift']());}};_0x4d30d1(++_0x195521);}(_0xcf97,0x7b));var _0x7cf9=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0xcf97[_0x10c16d];return _0x5896f4;};'use strict';var schema=require(_0x7cf9('0x0'));var sh=require(_0x7cf9('0x1'));var _=require('lodash');var utils=require(_0x7cf9('0x2'));var logger=require(_0x7cf9('0x3'))('routing');var system=schema({'command':{'type':_0x7cf9('0x4'),'required':!![],'message':_0x7cf9('0x5')}});exports['consequence']=function(_0x50c3a2,_0x44b6c4){return function(_0x2e3ff5){try{var _0x19a164={'command':_0x44b6c4[0x0]};var _0x152830=system[_0x7cf9('0x0')](_0x19a164,{'typecast':!![]});if(_0x152830[_0x7cf9('0x6')]){logger[_0x7cf9('0x7')]('[%s][SYSTEM]\x20%s',_0x50c3a2,_['map'](_0x152830,_0x7cf9('0x8'))[_0x7cf9('0x9')](',\x20'));logger[_0x7cf9('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x50c3a2);_0x2e3ff5[_0x7cf9('0xb')]();}else{var _0x4dcd83=this;var _0x1e38db=utils[_0x7cf9('0xc')](_0x44b6c4[0x0],this);logger[_0x7cf9('0xa')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x50c3a2,_0x1e38db);sh[_0x7cf9('0xd')](_[_0x7cf9('0xe')](_0x1e38db),function(_0x3dc75a,_0x115fe2){logger['info'](_0x7cf9('0xf'),_0x50c3a2,_0x3dc75a);if(_0x3dc75a==0x0){var _0x31750f=_0x115fe2[_0x7cf9('0x10')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x44b6c4[0x1])||_[_0x7cf9('0x11')](_0x44b6c4[0x1])){logger[_0x7cf9('0xa')](_0x7cf9('0x12'),_0x50c3a2);_0x4dcd83[_0x7cf9('0x13')][_0x44b6c4[0x1]]=_0x31750f;}else{logger[_0x7cf9('0xa')](_0x7cf9('0x14'),_0x50c3a2,_0x44b6c4[0x1],_0x31750f);_0x4dcd83[_0x7cf9('0x13')][_0x44b6c4[0x1]]=_0x31750f;}}_0x2e3ff5[_0x7cf9('0xb')]();});}}catch(_0x408880){logger[_0x7cf9('0x7')]('[%s][SYSTEM]\x20%s',_0x50c3a2,_[_0x7cf9('0x15')](_0x408880)?JSON[_0x7cf9('0x16')](_0x408880):_0x408880);logger['info'](_0x7cf9('0x17'),_0x50c3a2);_0x2e3ff5[_0x7cf9('0xb')]();}};};