ecee93ab1f6c4894a2f18ff063bb0184bf75b1b7
[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 _0xce50=['agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','client','http','error','message','catch','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','getVoiceQueueById','name','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','then','CreateCmContact','getPauseById','ShowPause'];(function(_0x496e9e,_0x5396df){var _0x49b0d9=function(_0x82905d){while(--_0x82905d){_0x496e9e['push'](_0x496e9e['shift']());}};_0x49b0d9(++_0x5396df);}(_0xce50,0x1d8));var _0x0ce5=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xce50[_0x2aec52];return _0x3b8835;};'use strict';var _=require('lodash');var moment=require(_0x0ce5('0x0'));var jayson=require(_0x0ce5('0x1'));var client=jayson[_0x0ce5('0x2')][_0x0ce5('0x3')]({'port':0x2329});function request(_0x1eddd3,_0x563b79){return new Promise(function(_0x5969ab,_0x11f9e0){return client['request'](_0x1eddd3,_0x563b79)['then'](function(_0x15c8ba){if(_0x15c8ba[_0x0ce5('0x4')]){return _0x11f9e0(_0x15c8ba[_0x0ce5('0x4')][_0x0ce5('0x5')]);}else{return _0x5969ab(_0x15c8ba['result']);}})[_0x0ce5('0x6')](function(_0x8d611f){return _0x11f9e0(_0x8d611f);});});}exports['getSquareProjects']=function(){return request(_0x0ce5('0x7'),{'options':{'raw':![],'attributes':['id','name',_0x0ce5('0x8')]}});};exports[_0x0ce5('0x9')]=function(_0x3ed31c){return request(_0x0ce5('0xa'),{'options':{'raw':![],'where':{'name':_0x3ed31c},'attributes':['production']}});};exports[_0x0ce5('0xb')]=function(_0x2b5559){return request(_0x0ce5('0xc'),{'options':{'raw':![],'where':{'id':_0x2b5559},'include':[{'model':_0x0ce5('0xd'),'as':_0x0ce5('0xe'),'include':[{'model':'CloudProvider','as':'CloudProvider'}]}],'attributes':['id','name',_0x0ce5('0xf')],'smtp':!![]}});};exports[_0x0ce5('0x10')]=function(_0x352865){return request(_0x0ce5('0xa'),{'options':{'where':{'id':_0x352865},'attributes':['name']}});};exports[_0x0ce5('0x11')]=function(_0x117fa9){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x117fa9},'attributes':[_0x0ce5('0x12')]}});};exports['getVariableById']=function(_0x1ece6f){return request(_0x0ce5('0x13'),{'options':{'where':{'id':_0x1ece6f},'attributes':[_0x0ce5('0x12')]}});};exports[_0x0ce5('0x14')]=function(_0x470087){return request(_0x0ce5('0x15'),{'options':{'where':{'id':_0x470087},'attributes':[_0x0ce5('0x16')]}});};exports[_0x0ce5('0x17')]=function(_0x5eab29){return request(_0x0ce5('0x18'),{'options':{'where':{'id':_0x5eab29},'attributes':[_0x0ce5('0x12')]}});};exports['getContactByPhone']=function(_0x4f5e0b){return request(_0x0ce5('0x19'),{'options':{'where':{'phone':_0x4f5e0b['phone']},'attributes':['id']}});};exports[_0x0ce5('0x1a')]=function(_0x477451){return request(_0x0ce5('0x1b'),{'options':{'where':{'id':_0x477451},'attributes':[_0x0ce5('0x12')]}});};exports[_0x0ce5('0x1c')]=function(_0x22bf81){return request('ShowSound',{'options':{'where':{'id':_0x22bf81},'attributes':[_0x0ce5('0x1d')]}});};exports[_0x0ce5('0x1e')]=function(_0x1a1b8a){return request(_0x0ce5('0x1f'),{'options':{'raw':![],'where':{'id':_0x1a1b8a},'include':[{'model':'Interval','as':_0x0ce5('0x20')}]}});};exports['getSmsAccountById']=function(_0x16ff16){return request(_0x0ce5('0x21'),{'options':{'where':{'id':_0x16ff16},'attributes':['id',_0x0ce5('0x12')]}});};exports[_0x0ce5('0x22')]=function(_0x334e7d){return request(_0x0ce5('0x23'),{'body':_0x334e7d});};exports[_0x0ce5('0x24')]=function(_0x39042a){return request(_0x0ce5('0x25'),{'body':_0x39042a});};exports[_0x0ce5('0x26')]=function(_0x5adffe){return request('CreateSquareReport',{'body':_[_0x0ce5('0x27')](_0x5adffe,{'project_name':_0x5adffe['arg_1'],'prev_project_name':_0x5adffe['arg_2']||'','is_subproject':_0x5adffe[_0x0ce5('0x28')]?!![]:![],'leaveAt':moment()['format'](_0x0ce5('0x29'))})});};exports[_0x0ce5('0x2a')]=function(_0x5bdf41){return request('CreateSquareRecording',{'body':_0x5bdf41});};exports[_0x0ce5('0x2b')]=function(_0x30bf71){return request('CreateSquareMessage',{'body':_0x30bf71});};exports[_0x0ce5('0x2c')]=function(_0x470fb6){return request(_0x0ce5('0x2d'),{'options':{'raw':![],'where':{'phone':_0x470fb6['phone'],'ListId':_0x470fb6['ListId']}}})[_0x0ce5('0x2e')](function(_0x28080b){if(_0x28080b){return _0x28080b;}return request(_0x0ce5('0x2f'),{'body':_0x470fb6});});};exports[_0x0ce5('0x30')]=function(_0x460ccf){return request(_0x0ce5('0x31'),{'options':{'where':{'id':_0x460ccf},'attributes':[_0x0ce5('0x12')]}});};exports[_0x0ce5('0x32')]=function(_0x34612a,_0x211c1a){return request(_0x0ce5('0x33'),{'body':{'interface':_0x211c1a},'options':{'where':_0x34612a}});};exports[_0x0ce5('0x34')]=function(_0x3c7d4d,_0xfef4a3,_0x733d8a){return request(_0x0ce5('0x35'),{'body':{'type':_0xfef4a3,'uniqueid':_0x733d8a},'options':{'where':_0x3c7d4d}});};exports[_0x0ce5('0x36')]=function(_0x417466){return request(_0x0ce5('0x37'),{'body':{},'options':{'where':_0x417466}});};exports[_0x0ce5('0x38')]=function(_0x1d7351){return request(_0x0ce5('0x39'),{'body':{},'options':{'where':_0x1d7351}});};