Built motion from commit 616d3211.|2.6.4
[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 _0x65f4=['save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','jayson/promise','client','http','request','error','result','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getSoundById','ShowSound'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0x65f4,0x19a));var _0x465f=function(_0x94b386,_0x33e4cf){_0x94b386=_0x94b386-0x0;var _0x335efe=_0x65f4[_0x94b386];return _0x335efe;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x465f('0x0'));var client=jayson[_0x465f('0x1')][_0x465f('0x2')]({'port':0x2329});function request(_0x59c7cb,_0x584451){return new Promise(function(_0x32cc52,_0x3bf967){return client[_0x465f('0x3')](_0x59c7cb,_0x584451)['then'](function(_0x3dc748){if(_0x3dc748[_0x465f('0x4')]){return _0x3bf967(_0x3dc748[_0x465f('0x4')]['message']);}else{return _0x32cc52(_0x3dc748[_0x465f('0x5')]);}})['catch'](function(_0x523ca1){return _0x3bf967(_0x523ca1);});});}exports[_0x465f('0x6')]=function(){return request(_0x465f('0x7'),{'options':{'raw':![],'attributes':['id',_0x465f('0x8'),_0x465f('0x9')]}});};exports[_0x465f('0xa')]=function(_0x33eefb){return request(_0x465f('0xb'),{'options':{'raw':![],'where':{'name':_0x33eefb},'attributes':[_0x465f('0x9')]}});};exports['getMailAccountById']=function(_0x44d0b3){return request(_0x465f('0xc'),{'options':{'raw':![],'where':{'id':_0x44d0b3},'include':[{'model':_0x465f('0xd'),'as':_0x465f('0xe'),'include':[{'model':_0x465f('0xf'),'as':_0x465f('0xf')}]}],'attributes':['id',_0x465f('0x8'),_0x465f('0x10')],'smtp':!![]}});};exports[_0x465f('0x11')]=function(_0x5937e6){return request('ShowSquareProject',{'options':{'where':{'id':_0x5937e6},'attributes':[_0x465f('0x8')]}});};exports[_0x465f('0x12')]=function(_0x2cb09c){return request(_0x465f('0x13'),{'options':{'where':{'id':_0x2cb09c},'attributes':['name']}});};exports[_0x465f('0x14')]=function(_0xaffeac){return request('ShowVariable',{'options':{'where':{'id':_0xaffeac},'attributes':['name']}});};exports[_0x465f('0x15')]=function(_0x211ee2){return request(_0x465f('0x16'),{'options':{'where':{'id':_0x211ee2},'attributes':[_0x465f('0x17')]}});};exports[_0x465f('0x18')]=function(_0x5e9726){return request(_0x465f('0x19'),{'options':{'where':{'id':_0x5e9726},'attributes':[_0x465f('0x8')]}});};exports[_0x465f('0x1a')]=function(_0x5d469c){return request(_0x465f('0x1b'),{'options':{'where':{'phone':_0x5d469c[_0x465f('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x3d9ec1){return request('ShowTrunk',{'options':{'where':{'id':_0x3d9ec1},'attributes':[_0x465f('0x8')]}});};exports[_0x465f('0x1d')]=function(_0x2dabac){return request(_0x465f('0x1e'),{'options':{'where':{'id':_0x2dabac},'attributes':[_0x465f('0x1f')]}});};exports[_0x465f('0x20')]=function(_0x2cd76d){return request(_0x465f('0x21'),{'options':{'raw':![],'where':{'id':_0x2cd76d},'include':[{'model':_0x465f('0x22'),'as':_0x465f('0x23')}]}});};exports[_0x465f('0x24')]=function(_0x4aa4a8){return request(_0x465f('0x25'),{'options':{'where':{'id':_0x4aa4a8},'attributes':['id',_0x465f('0x8')]}});};exports[_0x465f('0x26')]=function(_0x317aed){return request(_0x465f('0x27'),{'body':_0x317aed});};exports[_0x465f('0x28')]=function(_0x944e42){return request(_0x465f('0x29'),{'body':_0x944e42});};exports[_0x465f('0x2a')]=function(_0xbea909){return request('CreateSquareReport',{'body':_[_0x465f('0x2b')](_0xbea909,{'project_name':_0xbea909[_0x465f('0x2c')],'prev_project_name':_0xbea909['arg_2']||'','is_subproject':_0xbea909['arg_2']?!![]:![],'leaveAt':moment()[_0x465f('0x2d')](_0x465f('0x2e'))})});};exports[_0x465f('0x2f')]=function(_0x38a197){return request(_0x465f('0x30'),{'body':_0x38a197});};exports[_0x465f('0x31')]=function(_0x1e1ad6){return request(_0x465f('0x32'),{'body':_0x1e1ad6});};exports[_0x465f('0x33')]=function(_0x190506){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x190506[_0x465f('0x1c')],'ListId':_0x190506[_0x465f('0x34')]}}})['then'](function(_0x13a058){if(_0x13a058){return _0x13a058;}return request('CreateCmContact',{'body':_0x190506});});};exports[_0x465f('0x35')]=function(_0x489288){return request(_0x465f('0x36'),{'options':{'where':{'id':_0x489288},'attributes':[_0x465f('0x8')]}});};exports[_0x465f('0x37')]=function(_0x25d2d7,_0x4c63db){return request(_0x465f('0x38'),{'body':{'interface':_0x4c63db},'options':{'where':_0x25d2d7}});};exports[_0x465f('0x39')]=function(_0x139a56,_0x597afd,_0x156eb2){return request(_0x465f('0x3a'),{'body':{'type':_0x597afd,'uniqueid':_0x156eb2},'options':{'where':_0x139a56}});};exports[_0x465f('0x3b')]=function(_0x497033){return request(_0x465f('0x3c'),{'body':{},'options':{'where':_0x497033}});};exports[_0x465f('0x3d')]=function(_0xfdb59c){return request(_0x465f('0x3e'),{'body':{},'options':{'where':_0xfdb59c}});};