b95a79734c7de3c7c8ccb802b04799e8a37f6b97
[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 _0x31ec=['jayson/promise','client','error','result','getSquareProject','ShowSquareProject','production','ShowMailAccount','Smtp','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','name','getVariableById','ShowVariable','ShowSquareOdbc','dsn','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','LogoutUser','bluebird','moment','util'];(function(_0x30f87a,_0x2cce5a){var _0x3a8efc=function(_0x225d6b){while(--_0x225d6b){_0x30f87a['push'](_0x30f87a['shift']());}};_0x3a8efc(++_0x2cce5a);}(_0x31ec,0x110));var _0xc31e=function(_0x24c6df,_0x4f12b0){_0x24c6df=_0x24c6df-0x0;var _0x229765=_0x31ec[_0x24c6df];return _0x229765;};'use strict';var BPromise=require(_0xc31e('0x0'));var moment=require(_0xc31e('0x1'));var _=require('lodash');var util=require(_0xc31e('0x2'));var jayson=require(_0xc31e('0x3'));var client=jayson[_0xc31e('0x4')]['http']({'port':0x2329});function request(_0x2142b6,_0x231fd4){return new BPromise(function(_0x3ca301,_0x3b9b02){return client['request'](_0x2142b6,_0x231fd4)['then'](function(_0x392369){if(_0x392369['error']){return _0x3b9b02(_0x392369[_0xc31e('0x5')]['message']);}else{return _0x3ca301(_0x392369[_0xc31e('0x6')]);}})['catch'](function(_0x98f8f1){return _0x3b9b02(_0x98f8f1);});});}exports[_0xc31e('0x7')]=function(_0x459f47){return request(_0xc31e('0x8'),{'options':{'raw':![],'where':{'name':_0x459f47},'attributes':[_0xc31e('0x9')]}});};exports['getMailAccountById']=function(_0x294cd0){return request(_0xc31e('0xa'),{'options':{'raw':![],'where':{'id':_0x294cd0},'include':[{'model':'MailServerOut','as':_0xc31e('0xb')}],'attributes':['id','name',_0xc31e('0xc')]}});};exports[_0xc31e('0xd')]=function(_0x1e17dc){return request(_0xc31e('0x8'),{'options':{'where':{'id':_0x1e17dc},'attributes':['name']}});};exports[_0xc31e('0xe')]=function(_0x4c82c5){return request(_0xc31e('0xf'),{'options':{'where':{'id':_0x4c82c5},'attributes':[_0xc31e('0x10')]}});};exports[_0xc31e('0x11')]=function(_0x5e6233){return request(_0xc31e('0x12'),{'options':{'where':{'id':_0x5e6233},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x5344cd){return request(_0xc31e('0x13'),{'options':{'where':{'id':_0x5344cd},'attributes':[_0xc31e('0x14')]}});};exports['getUserById']=function(_0x50cfef){return request(_0xc31e('0x15'),{'options':{'where':{'id':_0x50cfef},'attributes':[_0xc31e('0x10')]}});};exports[_0xc31e('0x16')]=function(_0x5d4e93){return request(_0xc31e('0x17'),{'options':{'where':{'id':_0x5d4e93},'attributes':[_0xc31e('0x10')]}});};exports[_0xc31e('0x18')]=function(_0x5438a6){return request(_0xc31e('0x19'),{'options':{'where':{'id':_0x5438a6},'attributes':[_0xc31e('0x1a')]}});};exports[_0xc31e('0x1b')]=function(_0x3d48af){return request(_0xc31e('0x1c'),{'options':{'raw':![],'where':{'id':_0x3d48af},'include':[{'model':'Interval','as':_0xc31e('0x1d')}]}});};exports[_0xc31e('0x1e')]=function(_0x307e03){return request(_0xc31e('0x1f'),{'options':{'where':{'id':_0x307e03},'attributes':['id',_0xc31e('0x10')]}});};exports[_0xc31e('0x20')]=function(_0x5dd868){return request(_0xc31e('0x21'),{'body':_0x5dd868});};exports[_0xc31e('0x22')]=function(_0x45a1ac){return request(_0xc31e('0x23'),{'body':_0x45a1ac});};exports[_0xc31e('0x24')]=function(_0xc2999){return request('CreateSquareReport',{'body':_[_0xc31e('0x25')](_0xc2999,{'project_name':_0xc2999[_0xc31e('0x26')],'prev_project_name':_0xc2999[_0xc31e('0x27')]||'','is_subproject':_0xc2999['arg_2']?!![]:![],'leaveAt':moment()[_0xc31e('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xc31e('0x29')]=function(_0xc7ffb9){return request('CreateSquareRecording',{'body':_0xc7ffb9});};exports[_0xc31e('0x2a')]=function(_0x1e2dc4){return request(_0xc31e('0x2b'),{'body':_0x1e2dc4});};exports['createCmContact']=function(_0x36cfa9){return request(_0xc31e('0x2c'),{'options':{'raw':![],'where':{'phone':_0x36cfa9[_0xc31e('0x2d')],'ListId':_0x36cfa9[_0xc31e('0x2e')]}}})[_0xc31e('0x2f')](function(_0x3c2970){if(_0x3c2970){return _0x3c2970;}return request(_0xc31e('0x30'),{'body':_0x36cfa9});});};exports[_0xc31e('0x31')]=function(_0x3cc8f9){return request(_0xc31e('0x32'),{'options':{'where':{'id':_0x3cc8f9},'attributes':[_0xc31e('0x10')]}});};exports['agentLogin']=function(_0x3e7e10,_0x54ed9f){return request('LoginUser',{'body':{'interface':_0x54ed9f},'options':{'where':_0x3e7e10}});};exports[_0xc31e('0x33')]=function(_0x5226aa,_0x2f9a5d,_0x31804e){return request(_0xc31e('0x34'),{'body':{'type':_0x2f9a5d,'uniqueid':_0x31804e},'options':{'where':_0x5226aa}});};exports[_0xc31e('0x35')]=function(_0x554c3b){return request('UnpauseUser',{'body':{},'options':{'where':_0x554c3b}});};exports['agentLogout']=function(_0x19d727){return request(_0xc31e('0x36'),{'body':{},'options':{'where':_0x19d727}});};