d660dbb5c629ccde4e91b019a55118ceed21a273
[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 _0xc224=['arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','agentLogout','bluebird','moment','lodash','util','client','http','request','error','message','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xc224,0xe4));var _0x4c22=function(_0x32ed0,_0x6fac0b){_0x32ed0=_0x32ed0-0x0;var _0xd9484a=_0xc224[_0x32ed0];return _0xd9484a;};'use strict';var BPromise=require(_0x4c22('0x0'));var moment=require(_0x4c22('0x1'));var _=require(_0x4c22('0x2'));var util=require(_0x4c22('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x4c22('0x4')][_0x4c22('0x5')]({'port':0x2329});function request(_0x141143,_0x50e3c8){return new BPromise(function(_0x31a9a2,_0x57b38d){return client[_0x4c22('0x6')](_0x141143,_0x50e3c8)['then'](function(_0x4b2aa2){if(_0x4b2aa2[_0x4c22('0x7')]){return _0x57b38d(_0x4b2aa2[_0x4c22('0x7')][_0x4c22('0x8')]);}else{return _0x31a9a2(_0x4b2aa2['result']);}})[_0x4c22('0x9')](function(_0xa1eefd){return _0x57b38d(_0xa1eefd);});});}exports[_0x4c22('0xa')]=function(_0x1aadaa){return request(_0x4c22('0xb'),{'options':{'raw':![],'where':{'name':_0x1aadaa},'attributes':[_0x4c22('0xc')]}});};exports[_0x4c22('0xd')]=function(_0x563300){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x563300},'include':[{'model':_0x4c22('0xe'),'as':'Smtp'}],'attributes':['id',_0x4c22('0xf'),_0x4c22('0x10')]}});};exports[_0x4c22('0x11')]=function(_0x41aaee){return request(_0x4c22('0xb'),{'options':{'where':{'id':_0x41aaee},'attributes':[_0x4c22('0xf')]}});};exports[_0x4c22('0x12')]=function(_0x260be9){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x260be9},'attributes':[_0x4c22('0xf')]}});};exports[_0x4c22('0x13')]=function(_0x48cb4b){return request(_0x4c22('0x14'),{'options':{'where':{'id':_0x48cb4b},'attributes':['name']}});};exports[_0x4c22('0x15')]=function(_0x43eb7c){return request(_0x4c22('0x16'),{'options':{'where':{'id':_0x43eb7c},'attributes':['dsn']}});};exports[_0x4c22('0x17')]=function(_0x2f0a1c){return request(_0x4c22('0x18'),{'options':{'where':{'id':_0x2f0a1c},'attributes':[_0x4c22('0xf')]}});};exports[_0x4c22('0x19')]=function(_0x2718bf){return request(_0x4c22('0x1a'),{'options':{'where':{'id':_0x2718bf},'attributes':['name']}});};exports[_0x4c22('0x1b')]=function(_0x2ae2f6){return request('ShowSound',{'options':{'where':{'id':_0x2ae2f6},'attributes':[_0x4c22('0x1c')]}});};exports[_0x4c22('0x1d')]=function(_0x16a980){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x16a980},'include':[{'model':_0x4c22('0x1e'),'as':_0x4c22('0x1f')}]}});};exports[_0x4c22('0x20')]=function(_0x5e38cb){return request('ShowSmsAccount',{'options':{'where':{'id':_0x5e38cb},'attributes':['id','name']}});};exports[_0x4c22('0x21')]=function(_0x20cdaa){return request('CreateSmsMessage',{'body':_0x20cdaa});};exports[_0x4c22('0x22')]=function(_0x43f89b){return request('CreateSquareDetailsReport',{'body':_0x43f89b});};exports[_0x4c22('0x23')]=function(_0x278650){return request(_0x4c22('0x24'),{'body':_['merge'](_0x278650,{'project_name':_0x278650[_0x4c22('0x25')],'prev_project_name':_0x278650[_0x4c22('0x26')]||'','is_subproject':_0x278650[_0x4c22('0x26')]?!![]:![],'leaveAt':moment()[_0x4c22('0x27')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x4c22('0x28')]=function(_0xe52132){return request(_0x4c22('0x29'),{'body':_0xe52132});};exports[_0x4c22('0x2a')]=function(_0x41df64){return request(_0x4c22('0x2b'),{'body':_0x41df64});};exports[_0x4c22('0x2c')]=function(_0x9292c6){return request(_0x4c22('0x2d'),{'options':{'raw':![],'where':{'phone':_0x9292c6[_0x4c22('0x2e')],'ListId':_0x9292c6['ListId']}}})['then'](function(_0x550035){if(_0x550035){return _0x550035;}return request('CreateCmContact',{'body':_0x9292c6});});};exports[_0x4c22('0x2f')]=function(_0x328284){return request(_0x4c22('0x30'),{'options':{'where':{'id':_0x328284},'attributes':[_0x4c22('0xf')]}});};exports['agentLogin']=function(_0x55eeb9,_0x51fb87){return request('LoginUser',{'body':{'interface':_0x51fb87},'options':{'where':_0x55eeb9}});};exports[_0x4c22('0x31')]=function(_0x27cb0b,_0x19b830,_0x366e40){return request(_0x4c22('0x32'),{'body':{'type':_0x19b830,'uniqueid':_0x366e40},'options':{'where':_0x27cb0b}});};exports[_0x4c22('0x33')]=function(_0x30486c){return request('UnpauseUser',{'body':{},'options':{'where':_0x30486c}});};exports[_0x4c22('0x34')]=function(_0x9f974e){return request('LogoutUser',{'body':{},'options':{'where':_0x9f974e}});};