Built motion from commit 013e4bb4.|2.6.18
[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 _0x00bb=['email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowSquareOdbc','dsn','getUserById','phone','ShowTrunk','save_name','getIntervalById','ShowInterval','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','lodash','moment','jayson/promise','http','request','then','message','result','catch','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','CloudProvider','name'];(function(_0x1e8eb4,_0x53a726){var _0x3e3e6e=function(_0x29dbf3){while(--_0x29dbf3){_0x1e8eb4['push'](_0x1e8eb4['shift']());}};_0x3e3e6e(++_0x53a726);}(_0x00bb,0x1d8));var _0xb00b=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x00bb[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xb00b('0x0'));var moment=require(_0xb00b('0x1'));var jayson=require(_0xb00b('0x2'));var client=jayson['client'][_0xb00b('0x3')]({'port':0x2329});function request(_0x47a3bf,_0x278c5e){return new Promise(function(_0x464fe7,_0x582ef9){return client[_0xb00b('0x4')](_0x47a3bf,_0x278c5e)[_0xb00b('0x5')](function(_0x5b3b34){if(_0x5b3b34['error']){return _0x582ef9(_0x5b3b34['error'][_0xb00b('0x6')]);}else{return _0x464fe7(_0x5b3b34[_0xb00b('0x7')]);}})[_0xb00b('0x8')](function(_0x37f07d){return _0x582ef9(_0x37f07d);});});}exports[_0xb00b('0x9')]=function(){return request(_0xb00b('0xa'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0xb00b('0xb')]=function(_0x1e9b7b){return request(_0xb00b('0xc'),{'options':{'raw':![],'where':{'name':_0x1e9b7b},'attributes':[_0xb00b('0xd')]}});};exports[_0xb00b('0xe')]=function(_0x48e125){return request(_0xb00b('0xf'),{'options':{'raw':![],'where':{'id':_0x48e125},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':'CloudProvider','as':_0xb00b('0x10')}]}],'attributes':['id',_0xb00b('0x11'),_0xb00b('0x12')],'smtp':!![]}});};exports[_0xb00b('0x13')]=function(_0xef5d52){return request(_0xb00b('0xc'),{'options':{'where':{'id':_0xef5d52},'attributes':['name']}});};exports[_0xb00b('0x14')]=function(_0xb0d42e){return request('ShowVoiceQueue',{'options':{'where':{'id':_0xb0d42e},'attributes':[_0xb00b('0x11')]}});};exports[_0xb00b('0x15')]=function(_0x540b79){return request('ShowVariable',{'options':{'where':{'id':_0x540b79},'attributes':[_0xb00b('0x11')]}});};exports['getSquareOdbcById']=function(_0x51d136){return request(_0xb00b('0x16'),{'options':{'where':{'id':_0x51d136},'attributes':[_0xb00b('0x17')]}});};exports[_0xb00b('0x18')]=function(_0xbb72fc){return request('ShowUser',{'options':{'where':{'id':_0xbb72fc},'attributes':[_0xb00b('0x11')]}});};exports['getContactByPhone']=function(_0x415f91){return request('GetContactByPhone',{'options':{'where':{'phone':_0x415f91[_0xb00b('0x19')]},'attributes':['id']}});};exports['getTrunkById']=function(_0xb26ebb){return request(_0xb00b('0x1a'),{'options':{'where':{'id':_0xb26ebb},'attributes':['name']}});};exports['getSoundById']=function(_0x2b0da1){return request('ShowSound',{'options':{'where':{'id':_0x2b0da1},'attributes':[_0xb00b('0x1b')]}});};exports[_0xb00b('0x1c')]=function(_0x2fe48d){return request(_0xb00b('0x1d'),{'options':{'raw':![],'where':{'id':_0x2fe48d},'include':[{'model':'Interval','as':_0xb00b('0x1e')}]}});};exports['getSmsAccountById']=function(_0x25a973){return request(_0xb00b('0x1f'),{'options':{'where':{'id':_0x25a973},'attributes':['id','name']}});};exports[_0xb00b('0x20')]=function(_0x2896d1){return request('CreateSmsMessage',{'body':_0x2896d1});};exports[_0xb00b('0x21')]=function(_0x1f04d3){return request('CreateSquareDetailsReport',{'body':_0x1f04d3});};exports[_0xb00b('0x22')]=function(_0x243fdb){return request(_0xb00b('0x23'),{'body':_[_0xb00b('0x24')](_0x243fdb,{'project_name':_0x243fdb['arg_1'],'prev_project_name':_0x243fdb['arg_2']||'','is_subproject':_0x243fdb[_0xb00b('0x25')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x16ac55){return request(_0xb00b('0x26'),{'body':_0x16ac55});};exports[_0xb00b('0x27')]=function(_0x3825af){return request(_0xb00b('0x28'),{'body':_0x3825af});};exports[_0xb00b('0x29')]=function(_0x15d3b9){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x15d3b9[_0xb00b('0x19')],'ListId':_0x15d3b9['ListId']}}})[_0xb00b('0x5')](function(_0x348165){if(_0x348165){return _0x348165;}return request(_0xb00b('0x2a'),{'body':_0x15d3b9});});};exports['getPauseById']=function(_0x2fc11a){return request(_0xb00b('0x2b'),{'options':{'where':{'id':_0x2fc11a},'attributes':[_0xb00b('0x11')]}});};exports[_0xb00b('0x2c')]=function(_0x303625,_0x2b9824){return request(_0xb00b('0x2d'),{'body':{'interface':_0x2b9824},'options':{'where':_0x303625}});};exports[_0xb00b('0x2e')]=function(_0x149c1a,_0x54e247,_0x2b5f41){return request(_0xb00b('0x2f'),{'body':{'type':_0x54e247,'uniqueid':_0x2b5f41},'options':{'where':_0x149c1a}});};exports['agentUnpause']=function(_0x593659){return request(_0xb00b('0x30'),{'body':{},'options':{'where':_0x593659}});};exports['agentLogout']=function(_0x456241){return request('LogoutUser',{'body':{},'options':{'where':_0x456241}});};