Built motion from commit (unavailable).|2.5.4
[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 _0x1ed7=['agentLogout','LogoutUser','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getTrunkById','ShowSound','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','UnpauseUser'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0x1ed7,0x6e));var _0x71ed=function(_0x123797,_0x5b187b){_0x123797=_0x123797-0x0;var _0x3a8f49=_0x1ed7[_0x123797];return _0x3a8f49;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require('lodash');var util=require(_0x71ed('0x0'));var jayson=require(_0x71ed('0x1'));var client=jayson[_0x71ed('0x2')][_0x71ed('0x3')]({'port':0x2329});function request(_0x74dd84,_0x59c737){return new BPromise(function(_0x1a2bc6,_0xb88a02){return client[_0x71ed('0x4')](_0x74dd84,_0x59c737)[_0x71ed('0x5')](function(_0x51bc16){if(_0x51bc16['error']){return _0xb88a02(_0x51bc16[_0x71ed('0x6')][_0x71ed('0x7')]);}else{return _0x1a2bc6(_0x51bc16[_0x71ed('0x8')]);}})[_0x71ed('0x9')](function(_0x3cf7ff){return _0xb88a02(_0x3cf7ff);});});}exports[_0x71ed('0xa')]=function(_0x585943){return request(_0x71ed('0xb'),{'options':{'raw':![],'where':{'name':_0x585943},'attributes':['production']}});};exports[_0x71ed('0xc')]=function(_0xc4e59d){return request(_0x71ed('0xd'),{'options':{'raw':![],'where':{'id':_0xc4e59d},'include':[{'model':_0x71ed('0xe'),'as':_0x71ed('0xf')}],'attributes':['id',_0x71ed('0x10'),_0x71ed('0x11')]}});};exports[_0x71ed('0x12')]=function(_0x43d6dc){return request('ShowSquareProject',{'options':{'where':{'id':_0x43d6dc},'attributes':[_0x71ed('0x10')]}});};exports[_0x71ed('0x13')]=function(_0x327bb5){return request(_0x71ed('0x14'),{'options':{'where':{'id':_0x327bb5},'attributes':['name']}});};exports[_0x71ed('0x15')]=function(_0x16bc2c){return request('ShowVariable',{'options':{'where':{'id':_0x16bc2c},'attributes':['name']}});};exports[_0x71ed('0x16')]=function(_0xe01160){return request(_0x71ed('0x17'),{'options':{'where':{'id':_0xe01160},'attributes':[_0x71ed('0x18')]}});};exports['getUserById']=function(_0x2473a3){return request(_0x71ed('0x19'),{'options':{'where':{'id':_0x2473a3},'attributes':['name']}});};exports[_0x71ed('0x1a')]=function(_0x1c0585){return request('ShowTrunk',{'options':{'where':{'id':_0x1c0585},'attributes':['name']}});};exports['getSoundById']=function(_0x1ce561){return request(_0x71ed('0x1b'),{'options':{'where':{'id':_0x1ce561},'attributes':['save_name']}});};exports[_0x71ed('0x1c')]=function(_0x255776){return request(_0x71ed('0x1d'),{'options':{'raw':![],'where':{'id':_0x255776},'include':[{'model':_0x71ed('0x1e'),'as':'Intervals'}]}});};exports[_0x71ed('0x1f')]=function(_0x500c40){return request(_0x71ed('0x20'),{'options':{'where':{'id':_0x500c40},'attributes':['id',_0x71ed('0x10')]}});};exports['createSmsMessage']=function(_0x5aa33e){return request(_0x71ed('0x21'),{'body':_0x5aa33e});};exports[_0x71ed('0x22')]=function(_0x134e37){return request('CreateSquareDetailsReport',{'body':_0x134e37});};exports[_0x71ed('0x23')]=function(_0x49423b){return request(_0x71ed('0x24'),{'body':_[_0x71ed('0x25')](_0x49423b,{'project_name':_0x49423b[_0x71ed('0x26')],'prev_project_name':_0x49423b[_0x71ed('0x27')]||'','is_subproject':_0x49423b[_0x71ed('0x27')]?!![]:![],'leaveAt':moment()[_0x71ed('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0xb01ddd){return request(_0x71ed('0x29'),{'body':_0xb01ddd});};exports[_0x71ed('0x2a')]=function(_0x39ef72){return request('CreateSquareMessage',{'body':_0x39ef72});};exports[_0x71ed('0x2b')]=function(_0x57b5b3){return request(_0x71ed('0x2c'),{'options':{'raw':![],'where':{'phone':_0x57b5b3['phone'],'ListId':_0x57b5b3[_0x71ed('0x2d')]}}})[_0x71ed('0x5')](function(_0x55476c){if(_0x55476c){return _0x55476c;}return request('CreateCmContact',{'body':_0x57b5b3});});};exports[_0x71ed('0x2e')]=function(_0xff59b8){return request(_0x71ed('0x2f'),{'options':{'where':{'id':_0xff59b8},'attributes':[_0x71ed('0x10')]}});};exports['agentLogin']=function(_0x503e00,_0x36ccba){return request('LoginUser',{'body':{'interface':_0x36ccba},'options':{'where':_0x503e00}});};exports[_0x71ed('0x30')]=function(_0x5de4e1,_0x36b7c3,_0xec9ca7){return request(_0x71ed('0x31'),{'body':{'type':_0x36b7c3,'uniqueid':_0xec9ca7},'options':{'where':_0x5de4e1}});};exports[_0x71ed('0x32')]=function(_0x520906){return request(_0x71ed('0x33'),{'body':{},'options':{'where':_0x520906}});};exports[_0x71ed('0x34')]=function(_0x522e49){return request(_0x71ed('0x35'),{'body':{},'options':{'where':_0x522e49}});};