Built motion from commit bab6f49e.|2.6.17
[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 _0xad36=['message','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','merge','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','moment','jayson/promise','client','http','request','error'];(function(_0x2f4f01,_0x15f77c){var _0x562f64=function(_0x491011){while(--_0x491011){_0x2f4f01['push'](_0x2f4f01['shift']());}};_0x562f64(++_0x15f77c);}(_0xad36,0x11c));var _0x6ad3=function(_0x38daa8,_0x102d10){_0x38daa8=_0x38daa8-0x0;var _0x27c5f0=_0xad36[_0x38daa8];return _0x27c5f0;};'use strict';var _=require('lodash');var moment=require(_0x6ad3('0x0'));var jayson=require(_0x6ad3('0x1'));var client=jayson[_0x6ad3('0x2')][_0x6ad3('0x3')]({'port':0x2329});function request(_0x32fb2f,_0x35a0ee){return new Promise(function(_0xef54ab,_0x17a9b2){return client[_0x6ad3('0x4')](_0x32fb2f,_0x35a0ee)['then'](function(_0x2053e8){if(_0x2053e8[_0x6ad3('0x5')]){return _0x17a9b2(_0x2053e8[_0x6ad3('0x5')][_0x6ad3('0x6')]);}else{return _0xef54ab(_0x2053e8['result']);}})['catch'](function(_0x50913c){return _0x17a9b2(_0x50913c);});});}exports['getSquareProjects']=function(){return request(_0x6ad3('0x7'),{'options':{'raw':![],'attributes':['id',_0x6ad3('0x8'),_0x6ad3('0x9')]}});};exports[_0x6ad3('0xa')]=function(_0x236745){return request(_0x6ad3('0xb'),{'options':{'raw':![],'where':{'name':_0x236745},'attributes':[_0x6ad3('0x9')]}});};exports[_0x6ad3('0xc')]=function(_0xffe161){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0xffe161},'include':[{'model':_0x6ad3('0xd'),'as':_0x6ad3('0xe'),'include':[{'model':_0x6ad3('0xf'),'as':_0x6ad3('0xf')}]}],'attributes':['id',_0x6ad3('0x8'),_0x6ad3('0x10')],'smtp':!![]}});};exports[_0x6ad3('0x11')]=function(_0x96fe49){return request('ShowSquareProject',{'options':{'where':{'id':_0x96fe49},'attributes':[_0x6ad3('0x8')]}});};exports['getVoiceQueueById']=function(_0x14418f){return request(_0x6ad3('0x12'),{'options':{'where':{'id':_0x14418f},'attributes':[_0x6ad3('0x8')]}});};exports[_0x6ad3('0x13')]=function(_0x2e1ba0){return request('ShowVariable',{'options':{'where':{'id':_0x2e1ba0},'attributes':[_0x6ad3('0x8')]}});};exports[_0x6ad3('0x14')]=function(_0xf81b3){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xf81b3},'attributes':['dsn']}});};exports['getUserById']=function(_0x4ea840){return request(_0x6ad3('0x15'),{'options':{'where':{'id':_0x4ea840},'attributes':['name']}});};exports[_0x6ad3('0x16')]=function(_0x52d10c){return request(_0x6ad3('0x17'),{'options':{'where':{'phone':_0x52d10c[_0x6ad3('0x18')]},'attributes':['id']}});};exports[_0x6ad3('0x19')]=function(_0x3f8ce2){return request('ShowTrunk',{'options':{'where':{'id':_0x3f8ce2},'attributes':['name']}});};exports[_0x6ad3('0x1a')]=function(_0x35324a){return request(_0x6ad3('0x1b'),{'options':{'where':{'id':_0x35324a},'attributes':[_0x6ad3('0x1c')]}});};exports[_0x6ad3('0x1d')]=function(_0xc75a57){return request(_0x6ad3('0x1e'),{'options':{'raw':![],'where':{'id':_0xc75a57},'include':[{'model':_0x6ad3('0x1f'),'as':_0x6ad3('0x20')}]}});};exports['getSmsAccountById']=function(_0x33e11b){return request(_0x6ad3('0x21'),{'options':{'where':{'id':_0x33e11b},'attributes':['id',_0x6ad3('0x8')]}});};exports[_0x6ad3('0x22')]=function(_0x220887){return request(_0x6ad3('0x23'),{'body':_0x220887});};exports['createSquareDetailsReport']=function(_0x1942d4){return request(_0x6ad3('0x24'),{'body':_0x1942d4});};exports[_0x6ad3('0x25')]=function(_0x4dfec1){return request('CreateSquareReport',{'body':_[_0x6ad3('0x26')](_0x4dfec1,{'project_name':_0x4dfec1[_0x6ad3('0x27')],'prev_project_name':_0x4dfec1['arg_2']||'','is_subproject':_0x4dfec1['arg_2']?!![]:![],'leaveAt':moment()[_0x6ad3('0x28')](_0x6ad3('0x29'))})});};exports[_0x6ad3('0x2a')]=function(_0xf857f4){return request(_0x6ad3('0x2b'),{'body':_0xf857f4});};exports[_0x6ad3('0x2c')]=function(_0x4f692d){return request('CreateSquareMessage',{'body':_0x4f692d});};exports[_0x6ad3('0x2d')]=function(_0x3e8d2a){return request(_0x6ad3('0x2e'),{'options':{'raw':![],'where':{'phone':_0x3e8d2a[_0x6ad3('0x18')],'ListId':_0x3e8d2a['ListId']}}})[_0x6ad3('0x2f')](function(_0x2f1d01){if(_0x2f1d01){return _0x2f1d01;}return request(_0x6ad3('0x30'),{'body':_0x3e8d2a});});};exports[_0x6ad3('0x31')]=function(_0x18d3e6){return request(_0x6ad3('0x32'),{'options':{'where':{'id':_0x18d3e6},'attributes':[_0x6ad3('0x8')]}});};exports[_0x6ad3('0x33')]=function(_0x3929b5,_0x4ed23b){return request(_0x6ad3('0x34'),{'body':{'interface':_0x4ed23b},'options':{'where':_0x3929b5}});};exports[_0x6ad3('0x35')]=function(_0x4fe3e9,_0x298476,_0x1ca730){return request(_0x6ad3('0x36'),{'body':{'type':_0x298476,'uniqueid':_0x1ca730},'options':{'where':_0x4fe3e9}});};exports[_0x6ad3('0x37')]=function(_0x4be46c){return request(_0x6ad3('0x38'),{'body':{},'options':{'where':_0x4be46c}});};exports['agentLogout']=function(_0x4f07b4){return request(_0x6ad3('0x39'),{'body':{},'options':{'where':_0x4f07b4}});};