Built motion from commit 1efd3d96.|2.6.31
[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 _0x9099=['getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','lodash','jayson/promise','client','http','request','then','error','message','result','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk'];(function(_0x2cfa09,_0x1ffa9a){var _0x5eafc4=function(_0x5c46f3){while(--_0x5c46f3){_0x2cfa09['push'](_0x2cfa09['shift']());}};_0x5eafc4(++_0x1ffa9a);}(_0x9099,0x1ac));var _0x9909=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0x9099[_0x2d344f];return _0x2e796b;};'use strict';var _=require(_0x9909('0x0'));var moment=require('moment');var jayson=require(_0x9909('0x1'));var client=jayson[_0x9909('0x2')][_0x9909('0x3')]({'port':0x2329});function request(_0x2524d3,_0x3fd4b4){return new Promise(function(_0x34aabc,_0x2168ff){return client[_0x9909('0x4')](_0x2524d3,_0x3fd4b4)[_0x9909('0x5')](function(_0x25cf23){if(_0x25cf23[_0x9909('0x6')]){return _0x2168ff(_0x25cf23[_0x9909('0x6')][_0x9909('0x7')]);}else{return _0x34aabc(_0x25cf23[_0x9909('0x8')]);}})['catch'](function(_0x6d755a){return _0x2168ff(_0x6d755a);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x9909('0x9')]=function(_0x592725){return request(_0x9909('0xa'),{'options':{'raw':![],'where':{'name':_0x592725},'attributes':[_0x9909('0xb')]}});};exports[_0x9909('0xc')]=function(_0x514573){return request(_0x9909('0xd'),{'options':{'raw':![],'where':{'id':_0x514573},'include':[{'model':'MailServerOut','as':_0x9909('0xe'),'include':[{'model':_0x9909('0xf'),'as':_0x9909('0xf')}]}],'attributes':['id',_0x9909('0x10'),_0x9909('0x11')],'smtp':!![]}});};exports[_0x9909('0x12')]=function(_0x22224a){return request(_0x9909('0xa'),{'options':{'where':{'id':_0x22224a},'attributes':[_0x9909('0x10')]}});};exports[_0x9909('0x13')]=function(_0x1c2668){return request(_0x9909('0x14'),{'options':{'where':{'id':_0x1c2668},'attributes':[_0x9909('0x10')]}});};exports['getVariableById']=function(_0x33a8e3){return request('ShowVariable',{'options':{'where':{'id':_0x33a8e3},'attributes':[_0x9909('0x10')]}});};exports['getSquareOdbcById']=function(_0x1a9c97){return request(_0x9909('0x15'),{'options':{'where':{'id':_0x1a9c97},'attributes':[_0x9909('0x16')]}});};exports['getUserById']=function(_0x9a16a6){return request(_0x9909('0x17'),{'options':{'where':{'id':_0x9a16a6},'attributes':[_0x9909('0x10')]}});};exports[_0x9909('0x18')]=function(_0x1106e5){return request(_0x9909('0x19'),{'options':{'where':{'phone':_0x1106e5[_0x9909('0x1a')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x1b038f){return request(_0x9909('0x1b'),{'options':{'where':{'id':_0x1b038f},'attributes':['name']}});};exports[_0x9909('0x1c')]=function(_0x446ebb){return request(_0x9909('0x1d'),{'options':{'where':{'id':_0x446ebb},'attributes':[_0x9909('0x1e')]}});};exports[_0x9909('0x1f')]=function(_0x222cd9){return request(_0x9909('0x20'),{'options':{'raw':![],'where':{'id':_0x222cd9},'include':[{'model':'Interval','as':_0x9909('0x21')}]}});};exports[_0x9909('0x22')]=function(_0x4a626b){return request('ShowSmsAccount',{'options':{'where':{'id':_0x4a626b},'attributes':['id',_0x9909('0x10')]}});};exports[_0x9909('0x23')]=function(_0xdd5088){return request(_0x9909('0x24'),{'body':_0xdd5088});};exports[_0x9909('0x25')]=function(_0x59c5c9){return request('CreateSquareDetailsReport',{'body':_0x59c5c9});};exports[_0x9909('0x26')]=function(_0x25007c){return request(_0x9909('0x27'),{'body':_[_0x9909('0x28')](_0x25007c,{'project_name':_0x25007c['arg_1'],'prev_project_name':_0x25007c[_0x9909('0x29')]||'','is_subproject':_0x25007c[_0x9909('0x29')]?!![]:![],'leaveAt':moment()[_0x9909('0x2a')](_0x9909('0x2b'))})});};exports['createSquareRecording']=function(_0x405c5e){return request(_0x9909('0x2c'),{'body':_0x405c5e});};exports[_0x9909('0x2d')]=function(_0x14ec4b){return request('CreateSquareMessage',{'body':_0x14ec4b});};exports[_0x9909('0x2e')]=function(_0x175d52){return request(_0x9909('0x2f'),{'options':{'raw':![],'where':{'phone':_0x175d52[_0x9909('0x1a')],'ListId':_0x175d52[_0x9909('0x30')]}}})[_0x9909('0x5')](function(_0x427530){if(_0x427530){return _0x427530;}return request('CreateCmContact',{'body':_0x175d52});});};exports[_0x9909('0x31')]=function(_0x3a3f4f){return request(_0x9909('0x32'),{'options':{'where':{'id':_0x3a3f4f},'attributes':[_0x9909('0x10')]}});};exports[_0x9909('0x33')]=function(_0x519066,_0x4245eb){return request(_0x9909('0x34'),{'body':{'interface':_0x4245eb},'options':{'where':_0x519066}});};exports[_0x9909('0x35')]=function(_0x3e599a,_0xc1bd06,_0x222dd1){return request(_0x9909('0x36'),{'body':{'type':_0xc1bd06,'uniqueid':_0x222dd1},'options':{'where':_0x3e599a}});};exports[_0x9909('0x37')]=function(_0x59886b){return request('UnpauseUser',{'body':{},'options':{'where':_0x59886b}});};exports[_0x9909('0x38')]=function(_0x1afb2f){return request('LogoutUser',{'body':{},'options':{'where':_0x1afb2f}});};