b66115c99fed9cc3957489833950be80998a2ba1
[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 _0x3f9d=['getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','bluebird','lodash','util','jayson/promise','client','http','request','then','error','message','result','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById'];(function(_0x3e8e79,_0x1c865c){var _0x4e2039=function(_0x47b214){while(--_0x47b214){_0x3e8e79['push'](_0x3e8e79['shift']());}};_0x4e2039(++_0x1c865c);}(_0x3f9d,0x12e));var _0xd3f9=function(_0x152ef7,_0x221f4c){_0x152ef7=_0x152ef7-0x0;var _0x33b535=_0x3f9d[_0x152ef7];return _0x33b535;};'use strict';var BPromise=require(_0xd3f9('0x0'));var moment=require('moment');var _=require(_0xd3f9('0x1'));var util=require(_0xd3f9('0x2'));var jayson=require(_0xd3f9('0x3'));var client=jayson[_0xd3f9('0x4')][_0xd3f9('0x5')]({'port':0x2329});function request(_0x10ffea,_0x4de754){return new BPromise(function(_0x507b8e,_0x2265c9){return client[_0xd3f9('0x6')](_0x10ffea,_0x4de754)[_0xd3f9('0x7')](function(_0x4d91b3){if(_0x4d91b3[_0xd3f9('0x8')]){return _0x2265c9(_0x4d91b3[_0xd3f9('0x8')][_0xd3f9('0x9')]);}else{return _0x507b8e(_0x4d91b3[_0xd3f9('0xa')]);}})['catch'](function(_0x56157e){return _0x2265c9(_0x56157e);});});}exports['getSquareProject']=function(_0x4ece98){return request(_0xd3f9('0xb'),{'options':{'raw':![],'where':{'name':_0x4ece98},'attributes':[_0xd3f9('0xc')]}});};exports[_0xd3f9('0xd')]=function(_0xfde804){return request(_0xd3f9('0xe'),{'options':{'raw':![],'where':{'id':_0xfde804},'include':[{'model':_0xd3f9('0xf'),'as':_0xd3f9('0x10')}],'attributes':['id',_0xd3f9('0x11'),_0xd3f9('0x12')]}});};exports[_0xd3f9('0x13')]=function(_0x526dd3){return request(_0xd3f9('0xb'),{'options':{'where':{'id':_0x526dd3},'attributes':[_0xd3f9('0x11')]}});};exports['getVoiceQueueById']=function(_0x5a8970){return request(_0xd3f9('0x14'),{'options':{'where':{'id':_0x5a8970},'attributes':[_0xd3f9('0x11')]}});};exports[_0xd3f9('0x15')]=function(_0x581d58){return request('ShowVariable',{'options':{'where':{'id':_0x581d58},'attributes':[_0xd3f9('0x11')]}});};exports[_0xd3f9('0x16')]=function(_0x59856c){return request(_0xd3f9('0x17'),{'options':{'where':{'id':_0x59856c},'attributes':['dsn']}});};exports[_0xd3f9('0x18')]=function(_0x231dc4){return request(_0xd3f9('0x19'),{'options':{'where':{'id':_0x231dc4},'attributes':[_0xd3f9('0x11')]}});};exports['getTrunkById']=function(_0x57ed1b){return request('ShowTrunk',{'options':{'where':{'id':_0x57ed1b},'attributes':[_0xd3f9('0x11')]}});};exports['getSoundById']=function(_0x2c0081){return request(_0xd3f9('0x1a'),{'options':{'where':{'id':_0x2c0081},'attributes':['save_name']}});};exports[_0xd3f9('0x1b')]=function(_0x1b0092){return request(_0xd3f9('0x1c'),{'options':{'raw':![],'where':{'id':_0x1b0092},'include':[{'model':'Interval','as':_0xd3f9('0x1d')}]}});};exports[_0xd3f9('0x1e')]=function(_0x1f58bc){return request('ShowSmsAccount',{'options':{'where':{'id':_0x1f58bc},'attributes':['id',_0xd3f9('0x11')]}});};exports[_0xd3f9('0x1f')]=function(_0xe78640){return request(_0xd3f9('0x20'),{'body':_0xe78640});};exports['createSquareDetailsReport']=function(_0xb6cdd5){return request('CreateSquareDetailsReport',{'body':_0xb6cdd5});};exports[_0xd3f9('0x21')]=function(_0x15e0a4){return request(_0xd3f9('0x22'),{'body':_[_0xd3f9('0x23')](_0x15e0a4,{'project_name':_0x15e0a4[_0xd3f9('0x24')],'prev_project_name':_0x15e0a4[_0xd3f9('0x25')]||'','is_subproject':_0x15e0a4[_0xd3f9('0x25')]?!![]:![],'leaveAt':moment()['format'](_0xd3f9('0x26'))})});};exports['createSquareRecording']=function(_0x589734){return request(_0xd3f9('0x27'),{'body':_0x589734});};exports[_0xd3f9('0x28')]=function(_0x2e2c8f){return request(_0xd3f9('0x29'),{'body':_0x2e2c8f});};exports[_0xd3f9('0x2a')]=function(_0x547f2c){return request(_0xd3f9('0x2b'),{'options':{'raw':![],'where':{'phone':_0x547f2c[_0xd3f9('0x2c')],'ListId':_0x547f2c[_0xd3f9('0x2d')]}}})['then'](function(_0x1f0d3c){if(_0x1f0d3c){return _0x1f0d3c;}return request(_0xd3f9('0x2e'),{'body':_0x547f2c});});};exports['getPauseById']=function(_0x5dd71c){return request(_0xd3f9('0x2f'),{'options':{'where':{'id':_0x5dd71c},'attributes':['name']}});};exports[_0xd3f9('0x30')]=function(_0x45a5c1,_0x3b7bd4){return request(_0xd3f9('0x31'),{'body':{'interface':_0x3b7bd4},'options':{'where':_0x45a5c1}});};exports[_0xd3f9('0x32')]=function(_0x3f3277,_0x1d0e23,_0x1ccf08){return request(_0xd3f9('0x33'),{'body':{'type':_0x1d0e23,'uniqueid':_0x1ccf08},'options':{'where':_0x3f3277}});};exports[_0xd3f9('0x34')]=function(_0x39d2b9){return request('UnpauseUser',{'body':{},'options':{'where':_0x39d2b9}});};exports[_0xd3f9('0x35')]=function(_0x1d4489){return request('LogoutUser',{'body':{},'options':{'where':_0x1d4489}});};