19b5511e610d7bdf8ab5a0cfbd195d2fa817bb06
[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 _0x6364=['save_name','getIntervalById','ShowInterval','Interval','Intervals','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','CreateCmContact','agentPause','PauseUser','agentUnpause','agentLogout','jayson/promise','client','http','request','error','message','result','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','ShowTrunk','getSoundById'];(function(_0x29133f,_0x5a7ed2){var _0x11bbec=function(_0x27326f){while(--_0x27326f){_0x29133f['push'](_0x29133f['shift']());}};_0x11bbec(++_0x5a7ed2);}(_0x6364,0x8f));var _0x4636=function(_0x3b9be2,_0x1502b4){_0x3b9be2=_0x3b9be2-0x0;var _0x3dfaa6=_0x6364[_0x3b9be2];return _0x3dfaa6;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x4636('0x0'));var client=jayson[_0x4636('0x1')][_0x4636('0x2')]({'port':0x2329});function request(_0x17b25f,_0x3a02f9){return new Promise(function(_0xfa8c2a,_0x28d2a2){return client[_0x4636('0x3')](_0x17b25f,_0x3a02f9)['then'](function(_0x30dc87){if(_0x30dc87[_0x4636('0x4')]){return _0x28d2a2(_0x30dc87[_0x4636('0x4')][_0x4636('0x5')]);}else{return _0xfa8c2a(_0x30dc87[_0x4636('0x6')]);}})['catch'](function(_0xd364dc){return _0x28d2a2(_0xd364dc);});});}exports[_0x4636('0x7')]=function(){return request(_0x4636('0x8'),{'options':{'raw':![],'attributes':['id',_0x4636('0x9'),'production']}});};exports[_0x4636('0xa')]=function(_0x4747ac){return request(_0x4636('0xb'),{'options':{'raw':![],'where':{'name':_0x4747ac},'attributes':[_0x4636('0xc')]}});};exports[_0x4636('0xd')]=function(_0x48daa0){return request(_0x4636('0xe'),{'options':{'raw':![],'where':{'id':_0x48daa0},'include':[{'model':_0x4636('0xf'),'as':_0x4636('0x10'),'include':[{'model':_0x4636('0x11'),'as':'CloudProvider'}]}],'attributes':['id',_0x4636('0x9'),_0x4636('0x12')],'smtp':!![]}});};exports[_0x4636('0x13')]=function(_0x16d689){return request(_0x4636('0xb'),{'options':{'where':{'id':_0x16d689},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x1b0436){return request(_0x4636('0x14'),{'options':{'where':{'id':_0x1b0436},'attributes':[_0x4636('0x9')]}});};exports[_0x4636('0x15')]=function(_0x495fb9){return request(_0x4636('0x16'),{'options':{'where':{'id':_0x495fb9},'attributes':[_0x4636('0x9')]}});};exports[_0x4636('0x17')]=function(_0x1b047c){return request(_0x4636('0x18'),{'options':{'where':{'id':_0x1b047c},'attributes':[_0x4636('0x19')]}});};exports['getUserById']=function(_0xc04acf){return request(_0x4636('0x1a'),{'options':{'where':{'id':_0xc04acf},'attributes':[_0x4636('0x9')]}});};exports[_0x4636('0x1b')]=function(_0x5495dc){return request(_0x4636('0x1c'),{'options':{'where':{'phone':_0x5495dc['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x30f410){return request(_0x4636('0x1d'),{'options':{'where':{'id':_0x30f410},'attributes':['name']}});};exports[_0x4636('0x1e')]=function(_0x213642){return request('ShowSound',{'options':{'where':{'id':_0x213642},'attributes':[_0x4636('0x1f')]}});};exports[_0x4636('0x20')]=function(_0x51a2ec){return request(_0x4636('0x21'),{'options':{'raw':![],'where':{'id':_0x51a2ec},'include':[{'model':_0x4636('0x22'),'as':_0x4636('0x23')}]}});};exports['getSmsAccountById']=function(_0x441a89){return request('ShowSmsAccount',{'options':{'where':{'id':_0x441a89},'attributes':['id',_0x4636('0x9')]}});};exports[_0x4636('0x24')]=function(_0x3cd3d7){return request(_0x4636('0x25'),{'body':_0x3cd3d7});};exports[_0x4636('0x26')]=function(_0x45cb52){return request(_0x4636('0x27'),{'body':_0x45cb52});};exports[_0x4636('0x28')]=function(_0x114e5e){return request(_0x4636('0x29'),{'body':_[_0x4636('0x2a')](_0x114e5e,{'project_name':_0x114e5e[_0x4636('0x2b')],'prev_project_name':_0x114e5e[_0x4636('0x2c')]||'','is_subproject':_0x114e5e[_0x4636('0x2c')]?!![]:![],'leaveAt':moment()[_0x4636('0x2d')](_0x4636('0x2e'))})});};exports[_0x4636('0x2f')]=function(_0x3a7f91){return request(_0x4636('0x30'),{'body':_0x3a7f91});};exports[_0x4636('0x31')]=function(_0x4a15f3){return request(_0x4636('0x32'),{'body':_0x4a15f3});};exports['createCmContact']=function(_0x8dd8cf){return request(_0x4636('0x33'),{'options':{'raw':![],'where':{'phone':_0x8dd8cf[_0x4636('0x34')],'ListId':_0x8dd8cf['ListId']}}})['then'](function(_0x5ef382){if(_0x5ef382){return _0x5ef382;}return request(_0x4636('0x35'),{'body':_0x8dd8cf});});};exports['getPauseById']=function(_0x4e0bc0){return request('ShowPause',{'options':{'where':{'id':_0x4e0bc0},'attributes':[_0x4636('0x9')]}});};exports['agentLogin']=function(_0x5a7701,_0x247551){return request('LoginUser',{'body':{'interface':_0x247551},'options':{'where':_0x5a7701}});};exports[_0x4636('0x36')]=function(_0x2c666c,_0x64a49,_0x2cf70d){return request(_0x4636('0x37'),{'body':{'type':_0x64a49,'uniqueid':_0x2cf70d},'options':{'where':_0x2c666c}});};exports[_0x4636('0x38')]=function(_0x31b1f7){return request('UnpauseUser',{'body':{},'options':{'where':_0x31b1f7}});};exports[_0x4636('0x39')]=function(_0x5172a8){return request('LogoutUser',{'body':{},'options':{'where':_0x5172a8}});};