0feb9beba152e10d78a8eaa0682194e02cab9a5f
[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 _0xbc90=['ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','moment','lodash','jayson/promise','client','http','request','then','message','result','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Intervals','getSmsAccountById'];(function(_0x421eb3,_0x28301b){var _0x184acb=function(_0x62a13e){while(--_0x62a13e){_0x421eb3['push'](_0x421eb3['shift']());}};_0x184acb(++_0x28301b);}(_0xbc90,0xee));var _0x0bc9=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xbc90[_0x16d10f];return _0x50c823;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0bc9('0x0'));var _=require(_0x0bc9('0x1'));var util=require('util');var jayson=require(_0x0bc9('0x2'));var client=jayson[_0x0bc9('0x3')][_0x0bc9('0x4')]({'port':0x2329});function request(_0x4b14eb,_0x319a2c){return new BPromise(function(_0x26690b,_0x182910){return client[_0x0bc9('0x5')](_0x4b14eb,_0x319a2c)[_0x0bc9('0x6')](function(_0x430e6f){if(_0x430e6f['error']){return _0x182910(_0x430e6f['error'][_0x0bc9('0x7')]);}else{return _0x26690b(_0x430e6f[_0x0bc9('0x8')]);}})['catch'](function(_0xd18150){return _0x182910(_0xd18150);});});}exports[_0x0bc9('0x9')]=function(_0xcef4e2){return request(_0x0bc9('0xa'),{'options':{'raw':![],'where':{'name':_0xcef4e2},'attributes':['production']}});};exports[_0x0bc9('0xb')]=function(_0x40f446){return request(_0x0bc9('0xc'),{'options':{'raw':![],'where':{'id':_0x40f446},'include':[{'model':_0x0bc9('0xd'),'as':_0x0bc9('0xe')}],'attributes':['id',_0x0bc9('0xf'),_0x0bc9('0x10')]}});};exports[_0x0bc9('0x11')]=function(_0x4a791b){return request('ShowSquareProject',{'options':{'where':{'id':_0x4a791b},'attributes':['name']}});};exports[_0x0bc9('0x12')]=function(_0x53bba5){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x53bba5},'attributes':[_0x0bc9('0xf')]}});};exports[_0x0bc9('0x13')]=function(_0x50a62f){return request('ShowVariable',{'options':{'where':{'id':_0x50a62f},'attributes':[_0x0bc9('0xf')]}});};exports[_0x0bc9('0x14')]=function(_0x2a08f7){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2a08f7},'attributes':[_0x0bc9('0x15')]}});};exports[_0x0bc9('0x16')]=function(_0x3b0b33){return request(_0x0bc9('0x17'),{'options':{'where':{'id':_0x3b0b33},'attributes':[_0x0bc9('0xf')]}});};exports[_0x0bc9('0x18')]=function(_0x8fed32){return request(_0x0bc9('0x19'),{'options':{'where':{'id':_0x8fed32},'attributes':['name']}});};exports[_0x0bc9('0x1a')]=function(_0x2f9781){return request(_0x0bc9('0x1b'),{'options':{'where':{'id':_0x2f9781},'attributes':[_0x0bc9('0x1c')]}});};exports[_0x0bc9('0x1d')]=function(_0x7aaea3){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x7aaea3},'include':[{'model':'Interval','as':_0x0bc9('0x1e')}]}});};exports[_0x0bc9('0x1f')]=function(_0x196a36){return request(_0x0bc9('0x20'),{'options':{'where':{'id':_0x196a36},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x596273){return request(_0x0bc9('0x21'),{'body':_0x596273});};exports[_0x0bc9('0x22')]=function(_0x2f49ac){return request(_0x0bc9('0x23'),{'body':_0x2f49ac});};exports[_0x0bc9('0x24')]=function(_0x353260){return request('CreateSquareReport',{'body':_[_0x0bc9('0x25')](_0x353260,{'project_name':_0x353260[_0x0bc9('0x26')],'prev_project_name':_0x353260['arg_2']||'','is_subproject':_0x353260['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x0bc9('0x27'))})});};exports[_0x0bc9('0x28')]=function(_0x50651f){return request('CreateSquareRecording',{'body':_0x50651f});};exports[_0x0bc9('0x29')]=function(_0xc93fda){return request(_0x0bc9('0x2a'),{'body':_0xc93fda});};exports[_0x0bc9('0x2b')]=function(_0x4709e2){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4709e2['phone'],'ListId':_0x4709e2[_0x0bc9('0x2c')]}}})[_0x0bc9('0x6')](function(_0x5bc986){if(_0x5bc986){return _0x5bc986;}return request(_0x0bc9('0x2d'),{'body':_0x4709e2});});};exports[_0x0bc9('0x2e')]=function(_0x59b986){return request(_0x0bc9('0x2f'),{'options':{'where':{'id':_0x59b986},'attributes':[_0x0bc9('0xf')]}});};exports[_0x0bc9('0x30')]=function(_0x126ed5,_0xc09b02){return request('LoginUser',{'body':{'interface':_0xc09b02},'options':{'where':_0x126ed5}});};exports[_0x0bc9('0x31')]=function(_0x39bca1,_0x2f02c0,_0xaa4f0c){return request(_0x0bc9('0x32'),{'body':{'type':_0x2f02c0,'uniqueid':_0xaa4f0c},'options':{'where':_0x39bca1}});};exports['agentUnpause']=function(_0x348687){return request(_0x0bc9('0x33'),{'body':{},'options':{'where':_0x348687}});};exports[_0x0bc9('0x34')]=function(_0x4c5393){return request(_0x0bc9('0x35'),{'body':{},'options':{'where':_0x4c5393}});};