Built motion from commit 56a37f2a.|2.6.21
[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 _0xdd0c=['PauseUser','UnpauseUser','LogoutUser','moment','jayson/promise','client','request','then','error','message','result','catch','GetSquareProjects','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','name','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','getSoundById','ShowSound','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser'];(function(_0x542a3e,_0x1bb56b){var _0x2f3cce=function(_0x1e94f7){while(--_0x1e94f7){_0x542a3e['push'](_0x542a3e['shift']());}};_0x2f3cce(++_0x1bb56b);}(_0xdd0c,0x165));var _0xcdd0=function(_0x32415d,_0x318653){_0x32415d=_0x32415d-0x0;var _0x5bfacf=_0xdd0c[_0x32415d];return _0x5bfacf;};'use strict';var _=require('lodash');var moment=require(_0xcdd0('0x0'));var jayson=require(_0xcdd0('0x1'));var client=jayson[_0xcdd0('0x2')]['http']({'port':0x2329});function request(_0xe8ed9,_0x5b86cb){return new Promise(function(_0x3d8684,_0x159e38){return client[_0xcdd0('0x3')](_0xe8ed9,_0x5b86cb)[_0xcdd0('0x4')](function(_0x17ad7d){if(_0x17ad7d['error']){return _0x159e38(_0x17ad7d[_0xcdd0('0x5')][_0xcdd0('0x6')]);}else{return _0x3d8684(_0x17ad7d[_0xcdd0('0x7')]);}})[_0xcdd0('0x8')](function(_0x337496){return _0x159e38(_0x337496);});});}exports['getSquareProjects']=function(){return request(_0xcdd0('0x9'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0xcdd0('0xa')]=function(_0x31cf23){return request(_0xcdd0('0xb'),{'options':{'raw':![],'where':{'name':_0x31cf23},'attributes':[_0xcdd0('0xc')]}});};exports[_0xcdd0('0xd')]=function(_0x460fce){return request(_0xcdd0('0xe'),{'options':{'raw':![],'where':{'id':_0x460fce},'include':[{'model':_0xcdd0('0xf'),'as':_0xcdd0('0x10'),'include':[{'model':_0xcdd0('0x11'),'as':'CloudProvider'}]}],'attributes':['id','name',_0xcdd0('0x12')],'smtp':!![]}});};exports[_0xcdd0('0x13')]=function(_0x485711){return request(_0xcdd0('0xb'),{'options':{'where':{'id':_0x485711},'attributes':[_0xcdd0('0x14')]}});};exports['getVoiceQueueById']=function(_0x1fc89a){return request(_0xcdd0('0x15'),{'options':{'where':{'id':_0x1fc89a},'attributes':[_0xcdd0('0x14')]}});};exports[_0xcdd0('0x16')]=function(_0xc1c3d5){return request('ShowVariable',{'options':{'where':{'id':_0xc1c3d5},'attributes':['name']}});};exports[_0xcdd0('0x17')]=function(_0x1cd478){return request(_0xcdd0('0x18'),{'options':{'where':{'id':_0x1cd478},'attributes':[_0xcdd0('0x19')]}});};exports[_0xcdd0('0x1a')]=function(_0x3b07a1){return request(_0xcdd0('0x1b'),{'options':{'where':{'id':_0x3b07a1},'attributes':[_0xcdd0('0x14')]}});};exports[_0xcdd0('0x1c')]=function(_0x14d55b){return request('GetContactByPhone',{'options':{'where':{'phone':_0x14d55b[_0xcdd0('0x1d')]},'attributes':['id']}});};exports[_0xcdd0('0x1e')]=function(_0x5060fa){return request('ShowTrunk',{'options':{'where':{'id':_0x5060fa},'attributes':[_0xcdd0('0x14')]}});};exports[_0xcdd0('0x1f')]=function(_0x510b8d){return request(_0xcdd0('0x20'),{'options':{'where':{'id':_0x510b8d},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x4d038f){return request(_0xcdd0('0x21'),{'options':{'raw':![],'where':{'id':_0x4d038f},'include':[{'model':_0xcdd0('0x22'),'as':'Intervals'}]}});};exports[_0xcdd0('0x23')]=function(_0x31a3e6){return request(_0xcdd0('0x24'),{'options':{'where':{'id':_0x31a3e6},'attributes':['id','name']}});};exports[_0xcdd0('0x25')]=function(_0x7be0ac){return request('CreateSmsMessage',{'body':_0x7be0ac});};exports[_0xcdd0('0x26')]=function(_0x3586f6){return request('CreateSquareDetailsReport',{'body':_0x3586f6});};exports[_0xcdd0('0x27')]=function(_0x57704f){return request(_0xcdd0('0x28'),{'body':_[_0xcdd0('0x29')](_0x57704f,{'project_name':_0x57704f[_0xcdd0('0x2a')],'prev_project_name':_0x57704f['arg_2']||'','is_subproject':_0x57704f[_0xcdd0('0x2b')]?!![]:![],'leaveAt':moment()[_0xcdd0('0x2c')](_0xcdd0('0x2d'))})});};exports[_0xcdd0('0x2e')]=function(_0x1fa582){return request(_0xcdd0('0x2f'),{'body':_0x1fa582});};exports[_0xcdd0('0x30')]=function(_0x39ff27){return request(_0xcdd0('0x31'),{'body':_0x39ff27});};exports[_0xcdd0('0x32')]=function(_0x4074e0){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4074e0[_0xcdd0('0x1d')],'ListId':_0x4074e0[_0xcdd0('0x33')]}}})[_0xcdd0('0x4')](function(_0x5b8635){if(_0x5b8635){return _0x5b8635;}return request(_0xcdd0('0x34'),{'body':_0x4074e0});});};exports[_0xcdd0('0x35')]=function(_0x1a51c6){return request(_0xcdd0('0x36'),{'options':{'where':{'id':_0x1a51c6},'attributes':[_0xcdd0('0x14')]}});};exports['agentLogin']=function(_0x3b431f,_0x1b3e8e){return request(_0xcdd0('0x37'),{'body':{'interface':_0x1b3e8e},'options':{'where':_0x3b431f}});};exports['agentPause']=function(_0x5eb0cb,_0xa10863,_0x1697c3){return request(_0xcdd0('0x38'),{'body':{'type':_0xa10863,'uniqueid':_0x1697c3},'options':{'where':_0x5eb0cb}});};exports['agentUnpause']=function(_0x328b38){return request(_0xcdd0('0x39'),{'body':{},'options':{'where':_0x328b38}});};exports['agentLogout']=function(_0x42170f){return request(_0xcdd0('0x3a'),{'body':{},'options':{'where':_0x42170f}});};