77501cc3159bdffa4b29ca6cead1c13e4b4a6e03
[motion2.git] / server / services / agi / rpc / index.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
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.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x1a17=['save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getTrunkById','ShowTrunk','ShowSound'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0x1a17,0xa2));var _0x71a1=function(_0xfef7a9,_0x11c6e8){_0xfef7a9=_0xfef7a9-0x0;var _0x4f5995=_0x1a17[_0xfef7a9];return _0x4f5995;};'use strict';var BPromise=require(_0x71a1('0x0'));var moment=require(_0x71a1('0x1'));var _=require(_0x71a1('0x2'));var util=require(_0x71a1('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x71a1('0x4')][_0x71a1('0x5')]({'port':0x2329});function request(_0x4ef97,_0x5dd5ff){return new BPromise(function(_0x348ce9,_0x275d43){return client[_0x71a1('0x6')](_0x4ef97,_0x5dd5ff)[_0x71a1('0x7')](function(_0x50a12d){if(_0x50a12d[_0x71a1('0x8')]){return _0x275d43(_0x50a12d[_0x71a1('0x8')][_0x71a1('0x9')]);}else{return _0x348ce9(_0x50a12d[_0x71a1('0xa')]);}})[_0x71a1('0xb')](function(_0x278e88){return _0x275d43(_0x278e88);});});}exports[_0x71a1('0xc')]=function(_0x5eae42){return request(_0x71a1('0xd'),{'options':{'raw':![],'where':{'name':_0x5eae42},'attributes':[_0x71a1('0xe')]}});};exports[_0x71a1('0xf')]=function(_0x1d0074){return request(_0x71a1('0x10'),{'options':{'raw':![],'where':{'id':_0x1d0074},'include':[{'model':_0x71a1('0x11'),'as':_0x71a1('0x12')}],'attributes':['id',_0x71a1('0x13'),_0x71a1('0x14')]}});};exports[_0x71a1('0x15')]=function(_0x381b48){return request(_0x71a1('0xd'),{'options':{'where':{'id':_0x381b48},'attributes':['name']}});};exports[_0x71a1('0x16')]=function(_0x13aee7){return request(_0x71a1('0x17'),{'options':{'where':{'id':_0x13aee7},'attributes':['name']}});};exports[_0x71a1('0x18')]=function(_0x3ed5e6){return request(_0x71a1('0x19'),{'options':{'where':{'id':_0x3ed5e6},'attributes':[_0x71a1('0x13')]}});};exports[_0x71a1('0x1a')]=function(_0x575fd7){return request(_0x71a1('0x1b'),{'options':{'where':{'id':_0x575fd7},'attributes':['dsn']}});};exports[_0x71a1('0x1c')]=function(_0x10abca){return request(_0x71a1('0x1d'),{'options':{'where':{'id':_0x10abca},'attributes':[_0x71a1('0x13')]}});};exports[_0x71a1('0x1e')]=function(_0x1f66fd){return request(_0x71a1('0x1f'),{'options':{'where':{'id':_0x1f66fd},'attributes':[_0x71a1('0x13')]}});};exports['getSoundById']=function(_0x4685cb){return request(_0x71a1('0x20'),{'options':{'where':{'id':_0x4685cb},'attributes':[_0x71a1('0x21')]}});};exports[_0x71a1('0x22')]=function(_0x4c0467){return request(_0x71a1('0x23'),{'options':{'raw':![],'where':{'id':_0x4c0467},'include':[{'model':_0x71a1('0x24'),'as':_0x71a1('0x25')}]}});};exports[_0x71a1('0x26')]=function(_0x52ac4f){return request('ShowSmsAccount',{'options':{'where':{'id':_0x52ac4f},'attributes':['id',_0x71a1('0x13')]}});};exports[_0x71a1('0x27')]=function(_0x3875cf){return request(_0x71a1('0x28'),{'body':_0x3875cf});};exports[_0x71a1('0x29')]=function(_0x491b5c){return request(_0x71a1('0x2a'),{'body':_0x491b5c});};exports[_0x71a1('0x2b')]=function(_0x29a8cd){return request('CreateSquareReport',{'body':_[_0x71a1('0x2c')](_0x29a8cd,{'project_name':_0x29a8cd[_0x71a1('0x2d')],'prev_project_name':_0x29a8cd['arg_2']||'','is_subproject':_0x29a8cd[_0x71a1('0x2e')]?!![]:![],'leaveAt':moment()[_0x71a1('0x2f')](_0x71a1('0x30'))})});};exports['createSquareRecording']=function(_0x3406eb){return request(_0x71a1('0x31'),{'body':_0x3406eb});};exports[_0x71a1('0x32')]=function(_0x4f9e01){return request(_0x71a1('0x33'),{'body':_0x4f9e01});};exports[_0x71a1('0x34')]=function(_0x3bb8b7){return request(_0x71a1('0x35'),{'options':{'raw':![],'where':{'phone':_0x3bb8b7[_0x71a1('0x36')],'ListId':_0x3bb8b7[_0x71a1('0x37')]}}})[_0x71a1('0x7')](function(_0x571816){if(_0x571816){return _0x571816;}return request(_0x71a1('0x38'),{'body':_0x3bb8b7});});};exports[_0x71a1('0x39')]=function(_0x4d65f7){return request(_0x71a1('0x3a'),{'options':{'where':{'id':_0x4d65f7},'attributes':[_0x71a1('0x13')]}});};exports[_0x71a1('0x3b')]=function(_0x160499,_0x459df2){return request('LoginUser',{'body':{'interface':_0x459df2},'options':{'where':_0x160499}});};exports[_0x71a1('0x3c')]=function(_0x2c6416,_0x5ef628,_0x33c2e9){return request(_0x71a1('0x3d'),{'body':{'type':_0x5ef628,'uniqueid':_0x33c2e9},'options':{'where':_0x2c6416}});};exports['agentUnpause']=function(_0x395bfb){return request(_0x71a1('0x3e'),{'body':{},'options':{'where':_0x395bfb}});};exports[_0x71a1('0x3f')]=function(_0x53360f){return request(_0x71a1('0x40'),{'body':{},'options':{'where':_0x53360f}});};