c682d821096889e9418d09eef93c19fa7dc3a7db
[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 _0x192f=['arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','jayson/promise','http','request','then','error','message','result','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge'];(function(_0x372b76,_0x510d62){var _0x2da7e5=function(_0x1eaa2f){while(--_0x1eaa2f){_0x372b76['push'](_0x372b76['shift']());}};_0x2da7e5(++_0x510d62);}(_0x192f,0xd6));var _0xf192=function(_0xbb3269,_0xee00b0){_0xbb3269=_0xbb3269-0x0;var _0x1950bf=_0x192f[_0xbb3269];return _0x1950bf;};'use strict';var _=require(_0xf192('0x0'));var moment=require('moment');var jayson=require(_0xf192('0x1'));var client=jayson['client'][_0xf192('0x2')]({'port':0x2329});function request(_0x5aec4b,_0x527d53){return new Promise(function(_0x3ed9c1,_0x3b704f){return client[_0xf192('0x3')](_0x5aec4b,_0x527d53)[_0xf192('0x4')](function(_0x1df2e1){if(_0x1df2e1[_0xf192('0x5')]){return _0x3b704f(_0x1df2e1['error'][_0xf192('0x6')]);}else{return _0x3ed9c1(_0x1df2e1[_0xf192('0x7')]);}})['catch'](function(_0x2c4102){return _0x3b704f(_0x2c4102);});});}exports[_0xf192('0x8')]=function(){return request(_0xf192('0x9'),{'options':{'raw':![],'attributes':['id',_0xf192('0xa'),_0xf192('0xb')]}});};exports['getSquareProject']=function(_0x4c9d03){return request(_0xf192('0xc'),{'options':{'raw':![],'where':{'name':_0x4c9d03},'attributes':[_0xf192('0xb')]}});};exports[_0xf192('0xd')]=function(_0x2cb4b2){return request(_0xf192('0xe'),{'options':{'raw':![],'where':{'id':_0x2cb4b2},'include':[{'model':_0xf192('0xf'),'as':_0xf192('0x10'),'include':[{'model':_0xf192('0x11'),'as':'CloudProvider'}]}],'attributes':['id',_0xf192('0xa'),_0xf192('0x12')],'smtp':!![]}});};exports[_0xf192('0x13')]=function(_0x16b525){return request(_0xf192('0xc'),{'options':{'where':{'id':_0x16b525},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x14')]=function(_0xb51acc){return request(_0xf192('0x15'),{'options':{'where':{'id':_0xb51acc},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x16')]=function(_0x287088){return request('ShowVariable',{'options':{'where':{'id':_0x287088},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x17')]=function(_0x578423){return request(_0xf192('0x18'),{'options':{'where':{'id':_0x578423},'attributes':[_0xf192('0x19')]}});};exports[_0xf192('0x1a')]=function(_0x2185ea){return request(_0xf192('0x1b'),{'options':{'where':{'id':_0x2185ea},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x1c')]=function(_0x3aa61c){return request(_0xf192('0x1d'),{'options':{'where':{'phone':_0x3aa61c[_0xf192('0x1e')]},'attributes':['id']}});};exports[_0xf192('0x1f')]=function(_0x3ee921){return request('ShowTrunk',{'options':{'where':{'id':_0x3ee921},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x20')]=function(_0x418bc2){return request(_0xf192('0x21'),{'options':{'where':{'id':_0x418bc2},'attributes':[_0xf192('0x22')]}});};exports[_0xf192('0x23')]=function(_0x1dcf33){return request(_0xf192('0x24'),{'options':{'raw':![],'where':{'id':_0x1dcf33},'include':[{'model':'Interval','as':_0xf192('0x25')}]}});};exports[_0xf192('0x26')]=function(_0x32fc43){return request(_0xf192('0x27'),{'options':{'where':{'id':_0x32fc43},'attributes':['id','name']}});};exports[_0xf192('0x28')]=function(_0x5d3d2c){return request(_0xf192('0x29'),{'body':_0x5d3d2c});};exports['createSquareDetailsReport']=function(_0x466aa0){return request(_0xf192('0x2a'),{'body':_0x466aa0});};exports[_0xf192('0x2b')]=function(_0x425dea){return request(_0xf192('0x2c'),{'body':_[_0xf192('0x2d')](_0x425dea,{'project_name':_0x425dea[_0xf192('0x2e')],'prev_project_name':_0x425dea[_0xf192('0x2f')]||'','is_subproject':_0x425dea['arg_2']?!![]:![],'leaveAt':moment()[_0xf192('0x30')](_0xf192('0x31'))})});};exports[_0xf192('0x32')]=function(_0x5f0a2f){return request('CreateSquareRecording',{'body':_0x5f0a2f});};exports[_0xf192('0x33')]=function(_0x256fb6){return request(_0xf192('0x34'),{'body':_0x256fb6});};exports[_0xf192('0x35')]=function(_0x596c6a){return request(_0xf192('0x36'),{'options':{'raw':![],'where':{'phone':_0x596c6a['phone'],'ListId':_0x596c6a[_0xf192('0x37')]}}})['then'](function(_0x555f01){if(_0x555f01){return _0x555f01;}return request(_0xf192('0x38'),{'body':_0x596c6a});});};exports[_0xf192('0x39')]=function(_0x5460cc){return request('ShowPause',{'options':{'where':{'id':_0x5460cc},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x3a')]=function(_0x3d2db4,_0x574908){return request(_0xf192('0x3b'),{'body':{'interface':_0x574908},'options':{'where':_0x3d2db4}});};exports[_0xf192('0x3c')]=function(_0x367c9b,_0x16956a,_0x57e5ee){return request(_0xf192('0x3d'),{'body':{'type':_0x16956a,'uniqueid':_0x57e5ee},'options':{'where':_0x367c9b}});};exports[_0xf192('0x3e')]=function(_0x241e28){return request('UnpauseUser',{'body':{},'options':{'where':_0x241e28}});};exports[_0xf192('0x3f')]=function(_0x290e79){return request(_0xf192('0x40'),{'body':{},'options':{'where':_0x290e79}});};