4b49456c7313548c64e0539e1d87f9dc3f7b52e8
[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 _0x0c02=['format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','http','request','then','error','getSquareProjects','GetSquareProjects','name','production','getSquareProject','MailServerOut','Smtp','CloudProvider','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2'];(function(_0x3146f6,_0x437cde){var _0x4a509a=function(_0x4a8756){while(--_0x4a8756){_0x3146f6['push'](_0x3146f6['shift']());}};_0x4a509a(++_0x437cde);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0x20c0('0x0'));var jayson=require(_0x20c0('0x1'));var client=jayson['client'][_0x20c0('0x2')]({'port':0x2329});function request(_0x5c8750,_0x454922){return new Promise(function(_0x6d03d0,_0x38022e){return client[_0x20c0('0x3')](_0x5c8750,_0x454922)[_0x20c0('0x4')](function(_0x1474f7){if(_0x1474f7[_0x20c0('0x5')]){return _0x38022e(_0x1474f7[_0x20c0('0x5')]['message']);}else{return _0x6d03d0(_0x1474f7['result']);}})['catch'](function(_0x4db532){return _0x38022e(_0x4db532);});});}exports[_0x20c0('0x6')]=function(){return request(_0x20c0('0x7'),{'options':{'raw':![],'attributes':['id',_0x20c0('0x8'),_0x20c0('0x9')]}});};exports[_0x20c0('0xa')]=function(_0xedd21d){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xedd21d},'attributes':['production']}});};exports['getMailAccountById']=function(_0x578592){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x578592},'include':[{'model':_0x20c0('0xb'),'as':_0x20c0('0xc'),'include':[{'model':_0x20c0('0xd'),'as':_0x20c0('0xd')}]}],'attributes':['id','name',_0x20c0('0xe')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x5c9ee6){return request(_0x20c0('0xf'),{'options':{'where':{'id':_0x5c9ee6},'attributes':[_0x20c0('0x8')]}});};exports[_0x20c0('0x10')]=function(_0x3b2bba){return request(_0x20c0('0x11'),{'options':{'where':{'id':_0x3b2bba},'attributes':[_0x20c0('0x8')]}});};exports[_0x20c0('0x12')]=function(_0x105839){return request(_0x20c0('0x13'),{'options':{'where':{'id':_0x105839},'attributes':['name']}});};exports[_0x20c0('0x14')]=function(_0xc78626){return request(_0x20c0('0x15'),{'options':{'where':{'id':_0xc78626},'attributes':[_0x20c0('0x16')]}});};exports[_0x20c0('0x17')]=function(_0xeff5b9){return request('ShowUser',{'options':{'where':{'id':_0xeff5b9},'attributes':['name']}});};exports['getContactByPhone']=function(_0x10a921){return request(_0x20c0('0x18'),{'options':{'where':{'phone':_0x10a921[_0x20c0('0x19')]},'attributes':['id']}});};exports[_0x20c0('0x1a')]=function(_0x5b3725){return request(_0x20c0('0x1b'),{'options':{'where':{'id':_0x5b3725},'attributes':[_0x20c0('0x8')]}});};exports[_0x20c0('0x1c')]=function(_0x5851eb){return request('ShowSound',{'options':{'where':{'id':_0x5851eb},'attributes':[_0x20c0('0x1d')]}});};exports[_0x20c0('0x1e')]=function(_0x1407d3){return request(_0x20c0('0x1f'),{'options':{'raw':![],'where':{'id':_0x1407d3},'include':[{'model':_0x20c0('0x20'),'as':'Intervals'}]}});};exports[_0x20c0('0x21')]=function(_0x28959a){return request(_0x20c0('0x22'),{'options':{'where':{'id':_0x28959a},'attributes':['id',_0x20c0('0x8')]}});};exports['createSmsMessage']=function(_0xfea1eb){return request(_0x20c0('0x23'),{'body':_0xfea1eb});};exports[_0x20c0('0x24')]=function(_0x114ff9){return request(_0x20c0('0x25'),{'body':_0x114ff9});};exports[_0x20c0('0x26')]=function(_0x14c676){return request('CreateSquareReport',{'body':_[_0x20c0('0x27')](_0x14c676,{'project_name':_0x14c676[_0x20c0('0x28')],'prev_project_name':_0x14c676[_0x20c0('0x29')]||'','is_subproject':_0x14c676[_0x20c0('0x29')]?!![]:![],'leaveAt':moment()[_0x20c0('0x2a')](_0x20c0('0x2b'))})});};exports['createSquareRecording']=function(_0x4e0cbb){return request(_0x20c0('0x2c'),{'body':_0x4e0cbb});};exports[_0x20c0('0x2d')]=function(_0x1e3790){return request('CreateSquareMessage',{'body':_0x1e3790});};exports[_0x20c0('0x2e')]=function(_0x25592b){return request(_0x20c0('0x2f'),{'options':{'raw':![],'where':{'phone':_0x25592b[_0x20c0('0x19')],'ListId':_0x25592b['ListId']}}})['then'](function(_0x29d8ee){if(_0x29d8ee){return _0x29d8ee;}return request(_0x20c0('0x30'),{'body':_0x25592b});});};exports[_0x20c0('0x31')]=function(_0xe961ad){return request(_0x20c0('0x32'),{'options':{'where':{'id':_0xe961ad},'attributes':[_0x20c0('0x8')]}});};exports[_0x20c0('0x33')]=function(_0x40c0a7,_0x3ac0a4){return request(_0x20c0('0x34'),{'body':{'interface':_0x3ac0a4},'options':{'where':_0x40c0a7}});};exports[_0x20c0('0x35')]=function(_0x32448b,_0x1fef93,_0x45fa64){return request('PauseUser',{'body':{'type':_0x1fef93,'uniqueid':_0x45fa64},'options':{'where':_0x32448b}});};exports[_0x20c0('0x36')]=function(_0x1ad64f){return request(_0x20c0('0x37'),{'body':{},'options':{'where':_0x1ad64f}});};exports[_0x20c0('0x38')]=function(_0x59406e){return request(_0x20c0('0x39'),{'body':{},'options':{'where':_0x59406e}});};