ecc26d648930e29bbaf96e6a1580c14c4a5120c2
[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 _0x6989=['CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','createCmContact','CreateCmContact','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport'];(function(_0x3cf23e,_0x1489b9){var _0x551053=function(_0x23ac48){while(--_0x23ac48){_0x3cf23e['push'](_0x3cf23e['shift']());}};_0x551053(++_0x1489b9);}(_0x6989,0xe9));var _0x9698=function(_0x1828ca,_0x2f8e40){_0x1828ca=_0x1828ca-0x0;var _0x316e18=_0x6989[_0x1828ca];return _0x316e18;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require('lodash');var util=require(_0x9698('0x0'));var jayson=require(_0x9698('0x1'));var client=jayson[_0x9698('0x2')][_0x9698('0x3')]({'port':0x2329});function request(_0x2d456d,_0x75ae82){return new BPromise(function(_0x4464e9,_0x394c23){return client[_0x9698('0x4')](_0x2d456d,_0x75ae82)[_0x9698('0x5')](function(_0x15aaba){if(_0x15aaba[_0x9698('0x6')]){return _0x394c23(_0x15aaba[_0x9698('0x6')][_0x9698('0x7')]);}else{return _0x4464e9(_0x15aaba[_0x9698('0x8')]);}})[_0x9698('0x9')](function(_0xe1415b){return _0x394c23(_0xe1415b);});});}exports[_0x9698('0xa')]=function(_0x1005a7){return request(_0x9698('0xb'),{'options':{'raw':![],'where':{'name':_0x1005a7},'attributes':[_0x9698('0xc')]}});};exports[_0x9698('0xd')]=function(_0x13f263){return request(_0x9698('0xe'),{'options':{'raw':![],'where':{'id':_0x13f263},'include':[{'model':'MailServerOut','as':'Smtp'}],'attributes':['id',_0x9698('0xf'),_0x9698('0x10')]}});};exports['getSquareProjectById']=function(_0x544607){return request(_0x9698('0xb'),{'options':{'where':{'id':_0x544607},'attributes':[_0x9698('0xf')]}});};exports[_0x9698('0x11')]=function(_0x5e7a87){return request(_0x9698('0x12'),{'options':{'where':{'id':_0x5e7a87},'attributes':[_0x9698('0xf')]}});};exports[_0x9698('0x13')]=function(_0x5f12ed){return request(_0x9698('0x14'),{'options':{'where':{'id':_0x5f12ed},'attributes':[_0x9698('0xf')]}});};exports[_0x9698('0x15')]=function(_0x22375b){return request(_0x9698('0x16'),{'options':{'where':{'id':_0x22375b},'attributes':['dsn']}});};exports[_0x9698('0x17')]=function(_0x283f64){return request('ShowUser',{'options':{'where':{'id':_0x283f64},'attributes':[_0x9698('0xf')]}});};exports[_0x9698('0x18')]=function(_0x7fea2f){return request('ShowTrunk',{'options':{'where':{'id':_0x7fea2f},'attributes':[_0x9698('0xf')]}});};exports[_0x9698('0x19')]=function(_0x2f50dc){return request(_0x9698('0x1a'),{'options':{'where':{'id':_0x2f50dc},'attributes':[_0x9698('0x1b')]}});};exports[_0x9698('0x1c')]=function(_0x4ce0f1){return request(_0x9698('0x1d'),{'options':{'raw':![],'where':{'id':_0x4ce0f1},'include':[{'model':_0x9698('0x1e'),'as':_0x9698('0x1f')}]}});};exports['getSmsAccountById']=function(_0xcfe326){return request(_0x9698('0x20'),{'options':{'where':{'id':_0xcfe326},'attributes':['id',_0x9698('0xf')]}});};exports[_0x9698('0x21')]=function(_0x14e43b){return request(_0x9698('0x22'),{'body':_0x14e43b});};exports['createSquareDetailsReport']=function(_0xb3842a){return request(_0x9698('0x23'),{'body':_0xb3842a});};exports[_0x9698('0x24')]=function(_0x1a3de1){return request(_0x9698('0x25'),{'body':_[_0x9698('0x26')](_0x1a3de1,{'project_name':_0x1a3de1[_0x9698('0x27')],'prev_project_name':_0x1a3de1[_0x9698('0x28')]||'','is_subproject':_0x1a3de1[_0x9698('0x28')]?!![]:![],'leaveAt':moment()[_0x9698('0x29')](_0x9698('0x2a'))})});};exports[_0x9698('0x2b')]=function(_0x45f587){return request('CreateSquareRecording',{'body':_0x45f587});};exports[_0x9698('0x2c')]=function(_0x4cb15f){return request('CreateSquareMessage',{'body':_0x4cb15f});};exports[_0x9698('0x2d')]=function(_0xd0bf8a){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0xd0bf8a['phone'],'ListId':_0xd0bf8a['ListId']}}})[_0x9698('0x5')](function(_0x795ae6){if(_0x795ae6){return _0x795ae6;}return request(_0x9698('0x2e'),{'body':_0xd0bf8a});});};exports['getPauseById']=function(_0x3c9ab8){return request('ShowPause',{'options':{'where':{'id':_0x3c9ab8},'attributes':[_0x9698('0xf')]}});};exports[_0x9698('0x2f')]=function(_0x304eb1,_0x138d91){return request(_0x9698('0x30'),{'body':{'interface':_0x138d91},'options':{'where':_0x304eb1}});};exports[_0x9698('0x31')]=function(_0x486a00,_0x147f4e,_0x4d2e4d){return request(_0x9698('0x32'),{'body':{'type':_0x147f4e,'uniqueid':_0x4d2e4d},'options':{'where':_0x486a00}});};exports[_0x9698('0x33')]=function(_0x4e032f){return request(_0x9698('0x34'),{'body':{},'options':{'where':_0x4e032f}});};exports[_0x9698('0x35')]=function(_0x194b42){return request('LogoutUser',{'body':{},'options':{'where':_0x194b42}});};