1186f500c5061a49864434c9a9c369c35fe0b424
[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 _0xe4d5=['ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','getSoundById','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','arg_1','arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','ShowPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','bluebird','util','jayson/promise','client','http','request','then','error','message','result','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById'];(function(_0x250264,_0x88940b){var _0x4cda8a=function(_0x2258d0){while(--_0x2258d0){_0x250264['push'](_0x250264['shift']());}};_0x4cda8a(++_0x88940b);}(_0xe4d5,0x89));var _0x5e4d=function(_0x18a378,_0x46dc75){_0x18a378=_0x18a378-0x0;var _0x23760a=_0xe4d5[_0x18a378];return _0x23760a;};'use strict';var BPromise=require(_0x5e4d('0x0'));var moment=require('moment');var _=require('lodash');var util=require(_0x5e4d('0x1'));var jayson=require(_0x5e4d('0x2'));var client=jayson[_0x5e4d('0x3')][_0x5e4d('0x4')]({'port':0x2329});function request(_0x412f7d,_0x2166e7){return new BPromise(function(_0x2d2837,_0xb63e4){return client[_0x5e4d('0x5')](_0x412f7d,_0x2166e7)[_0x5e4d('0x6')](function(_0x4659eb){if(_0x4659eb[_0x5e4d('0x7')]){return _0xb63e4(_0x4659eb[_0x5e4d('0x7')][_0x5e4d('0x8')]);}else{return _0x2d2837(_0x4659eb[_0x5e4d('0x9')]);}})['catch'](function(_0x58281a){return _0xb63e4(_0x58281a);});});}exports[_0x5e4d('0xa')]=function(_0x10cec8){return request(_0x5e4d('0xb'),{'options':{'raw':![],'where':{'name':_0x10cec8},'attributes':[_0x5e4d('0xc')]}});};exports[_0x5e4d('0xd')]=function(_0x593542){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x593542},'include':[{'model':_0x5e4d('0xe'),'as':'Smtp'}],'attributes':['id',_0x5e4d('0xf'),'email']}});};exports[_0x5e4d('0x10')]=function(_0x53d17e){return request(_0x5e4d('0xb'),{'options':{'where':{'id':_0x53d17e},'attributes':[_0x5e4d('0xf')]}});};exports[_0x5e4d('0x11')]=function(_0x19bb2c){return request(_0x5e4d('0x12'),{'options':{'where':{'id':_0x19bb2c},'attributes':['name']}});};exports[_0x5e4d('0x13')]=function(_0x4e806d){return request(_0x5e4d('0x14'),{'options':{'where':{'id':_0x4e806d},'attributes':['name']}});};exports[_0x5e4d('0x15')]=function(_0x529480){return request(_0x5e4d('0x16'),{'options':{'where':{'id':_0x529480},'attributes':[_0x5e4d('0x17')]}});};exports[_0x5e4d('0x18')]=function(_0x13b989){return request(_0x5e4d('0x19'),{'options':{'where':{'id':_0x13b989},'attributes':[_0x5e4d('0xf')]}});};exports[_0x5e4d('0x1a')]=function(_0x2b20b7){return request('GetContactByPhone',{'options':{'where':{'phone':_0x2b20b7[_0x5e4d('0x1b')]},'attributes':['id']}});};exports[_0x5e4d('0x1c')]=function(_0x538c75){return request('ShowTrunk',{'options':{'where':{'id':_0x538c75},'attributes':['name']}});};exports[_0x5e4d('0x1d')]=function(_0x166995){return request('ShowSound',{'options':{'where':{'id':_0x166995},'attributes':[_0x5e4d('0x1e')]}});};exports[_0x5e4d('0x1f')]=function(_0x2197ab){return request(_0x5e4d('0x20'),{'options':{'raw':![],'where':{'id':_0x2197ab},'include':[{'model':_0x5e4d('0x21'),'as':'Intervals'}]}});};exports[_0x5e4d('0x22')]=function(_0x23181d){return request(_0x5e4d('0x23'),{'options':{'where':{'id':_0x23181d},'attributes':['id',_0x5e4d('0xf')]}});};exports[_0x5e4d('0x24')]=function(_0x52c4cd){return request(_0x5e4d('0x25'),{'body':_0x52c4cd});};exports[_0x5e4d('0x26')]=function(_0x5d44b1){return request('CreateSquareDetailsReport',{'body':_0x5d44b1});};exports['createSquareReport']=function(_0x39bc9d){return request('CreateSquareReport',{'body':_['merge'](_0x39bc9d,{'project_name':_0x39bc9d[_0x5e4d('0x27')],'prev_project_name':_0x39bc9d[_0x5e4d('0x28')]||'','is_subproject':_0x39bc9d[_0x5e4d('0x28')]?!![]:![],'leaveAt':moment()[_0x5e4d('0x29')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x5e4d('0x2a')]=function(_0x350582){return request('CreateSquareRecording',{'body':_0x350582});};exports[_0x5e4d('0x2b')]=function(_0x2fc464){return request(_0x5e4d('0x2c'),{'body':_0x2fc464});};exports[_0x5e4d('0x2d')]=function(_0x21351c){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x21351c['phone'],'ListId':_0x21351c[_0x5e4d('0x2e')]}}})['then'](function(_0x434074){if(_0x434074){return _0x434074;}return request(_0x5e4d('0x2f'),{'body':_0x21351c});});};exports['getPauseById']=function(_0x500cc2){return request(_0x5e4d('0x30'),{'options':{'where':{'id':_0x500cc2},'attributes':[_0x5e4d('0xf')]}});};exports['agentLogin']=function(_0x51ee21,_0x5715cf){return request('LoginUser',{'body':{'interface':_0x5715cf},'options':{'where':_0x51ee21}});};exports['agentPause']=function(_0xe56433,_0x1048b1,_0x22cfef){return request(_0x5e4d('0x31'),{'body':{'type':_0x1048b1,'uniqueid':_0x22cfef},'options':{'where':_0xe56433}});};exports['agentUnpause']=function(_0x2089ca){return request(_0x5e4d('0x32'),{'body':{},'options':{'where':_0x2089ca}});};exports[_0x5e4d('0x33')]=function(_0x2f596d){return request(_0x5e4d('0x34'),{'body':{},'options':{'where':_0x2f596d}});};