32f76fe88db7451f35a985d83157e70ca4ae512c
[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 _0x43fd=['merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','getPauseById','LoginUser','agentPause','UnpauseUser','agentLogout','moment','http','request','then','error','message','result','catch','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','getSquareOdbcById','ShowSquareOdbc','dsn','getContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSquareDetailsReport','createSquareReport','CreateSquareReport'];(function(_0x57bb79,_0x42ca61){var _0x99c51b=function(_0x52af71){while(--_0x52af71){_0x57bb79['push'](_0x57bb79['shift']());}};_0x99c51b(++_0x42ca61);}(_0x43fd,0x1ec));var _0xd43f=function(_0x164a5a,_0x1e6e4e){_0x164a5a=_0x164a5a-0x0;var _0x4ff1e3=_0x43fd[_0x164a5a];return _0x4ff1e3;};'use strict';var _=require('lodash');var moment=require(_0xd43f('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd43f('0x1')]({'port':0x2329});function request(_0x1ead65,_0x484615){return new Promise(function(_0x3df2bd,_0x48f953){return client[_0xd43f('0x2')](_0x1ead65,_0x484615)[_0xd43f('0x3')](function(_0x1d36b7){if(_0x1d36b7[_0xd43f('0x4')]){return _0x48f953(_0x1d36b7['error'][_0xd43f('0x5')]);}else{return _0x3df2bd(_0x1d36b7[_0xd43f('0x6')]);}})[_0xd43f('0x7')](function(_0x331163){return _0x48f953(_0x331163);});});}exports['getSquareProjects']=function(){return request(_0xd43f('0x8'),{'options':{'raw':![],'attributes':['id',_0xd43f('0x9'),'production']}});};exports[_0xd43f('0xa')]=function(_0x2d5011){return request(_0xd43f('0xb'),{'options':{'raw':![],'where':{'name':_0x2d5011},'attributes':[_0xd43f('0xc')]}});};exports[_0xd43f('0xd')]=function(_0x5eb0bb){return request(_0xd43f('0xe'),{'options':{'raw':![],'where':{'id':_0x5eb0bb},'include':[{'model':_0xd43f('0xf'),'as':_0xd43f('0x10'),'include':[{'model':_0xd43f('0x11'),'as':_0xd43f('0x11')}]}],'attributes':['id',_0xd43f('0x9'),_0xd43f('0x12')],'smtp':!![]}});};exports[_0xd43f('0x13')]=function(_0x2b4549){return request(_0xd43f('0xb'),{'options':{'where':{'id':_0x2b4549},'attributes':[_0xd43f('0x9')]}});};exports['getVoiceQueueById']=function(_0x3d979d){return request(_0xd43f('0x14'),{'options':{'where':{'id':_0x3d979d},'attributes':[_0xd43f('0x9')]}});};exports['getVariableById']=function(_0x4c576e){return request('ShowVariable',{'options':{'where':{'id':_0x4c576e},'attributes':[_0xd43f('0x9')]}});};exports[_0xd43f('0x15')]=function(_0x4f8862){return request(_0xd43f('0x16'),{'options':{'where':{'id':_0x4f8862},'attributes':[_0xd43f('0x17')]}});};exports['getUserById']=function(_0x5ced70){return request('ShowUser',{'options':{'where':{'id':_0x5ced70},'attributes':['name']}});};exports[_0xd43f('0x18')]=function(_0x19784f){return request('GetContactByPhone',{'options':{'where':{'phone':_0x19784f[_0xd43f('0x19')]},'attributes':['id']}});};exports[_0xd43f('0x1a')]=function(_0x18b862){return request(_0xd43f('0x1b'),{'options':{'where':{'id':_0x18b862},'attributes':['name']}});};exports[_0xd43f('0x1c')]=function(_0xd3933){return request(_0xd43f('0x1d'),{'options':{'where':{'id':_0xd3933},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x5683dc){return request(_0xd43f('0x1e'),{'options':{'raw':![],'where':{'id':_0x5683dc},'include':[{'model':_0xd43f('0x1f'),'as':_0xd43f('0x20')}]}});};exports[_0xd43f('0x21')]=function(_0x3b1094){return request(_0xd43f('0x22'),{'options':{'where':{'id':_0x3b1094},'attributes':['id',_0xd43f('0x9')]}});};exports['createSmsMessage']=function(_0x262023){return request('CreateSmsMessage',{'body':_0x262023});};exports[_0xd43f('0x23')]=function(_0x47f960){return request('CreateSquareDetailsReport',{'body':_0x47f960});};exports[_0xd43f('0x24')]=function(_0x2dca76){return request(_0xd43f('0x25'),{'body':_[_0xd43f('0x26')](_0x2dca76,{'project_name':_0x2dca76[_0xd43f('0x27')],'prev_project_name':_0x2dca76[_0xd43f('0x28')]||'','is_subproject':_0x2dca76[_0xd43f('0x28')]?!![]:![],'leaveAt':moment()[_0xd43f('0x29')](_0xd43f('0x2a'))})});};exports['createSquareRecording']=function(_0x26a6c9){return request(_0xd43f('0x2b'),{'body':_0x26a6c9});};exports[_0xd43f('0x2c')]=function(_0x2d54a7){return request(_0xd43f('0x2d'),{'body':_0x2d54a7});};exports['createCmContact']=function(_0x161540){return request(_0xd43f('0x2e'),{'options':{'raw':![],'where':{'phone':_0x161540[_0xd43f('0x19')],'ListId':_0x161540[_0xd43f('0x2f')]}}})[_0xd43f('0x3')](function(_0x5a7580){if(_0x5a7580){return _0x5a7580;}return request('CreateCmContact',{'body':_0x161540});});};exports[_0xd43f('0x30')]=function(_0x1f476d){return request('ShowPause',{'options':{'where':{'id':_0x1f476d},'attributes':[_0xd43f('0x9')]}});};exports['agentLogin']=function(_0x53aae7,_0x45e84a){return request(_0xd43f('0x31'),{'body':{'interface':_0x45e84a},'options':{'where':_0x53aae7}});};exports[_0xd43f('0x32')]=function(_0x4d032e,_0x410921,_0x23c4f7){return request('PauseUser',{'body':{'type':_0x410921,'uniqueid':_0x23c4f7},'options':{'where':_0x4d032e}});};exports['agentUnpause']=function(_0x11d2b5){return request(_0xd43f('0x33'),{'body':{},'options':{'where':_0x11d2b5}});};exports[_0xd43f('0x34')]=function(_0x202a05){return request('LogoutUser',{'body':{},'options':{'where':_0x202a05}});};