Built motion from commit (unavailable).|2.5.11
[motion2.git] / server / api / automation / automation.rpc.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 _0x8f73=['info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then'];(function(_0x8d695e,_0x394999){var _0x3d156e=function(_0x38cf6f){while(--_0x38cf6f){_0x8d695e['push'](_0x8d695e['shift']());}};_0x3d156e(++_0x394999);}(_0x8f73,0x12b));var _0x38f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8f73[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x38f7('0x0'));var util=require(_0x38f7('0x1'));var moment=require(_0x38f7('0x2'));var BPromise=require(_0x38f7('0x3'));var rs=require(_0x38f7('0x4'));var fs=require('fs');var Redis=require(_0x38f7('0x5'));var db=require(_0x38f7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x38f7('0x7'));var config=require(_0x38f7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x38f7('0x9')][_0x38f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ef086,_0x5a8dc8,_0x53e886){return new BPromise(function(_0x12959e,_0x268acf){return client[_0x38f7('0xb')](_0x4ef086,_0x53e886)[_0x38f7('0xc')](function(_0x3a0c27){logger[_0x38f7('0xd')](_0x38f7('0xe'),_0x5a8dc8,'request\x20sent');logger[_0x38f7('0xf')](_0x38f7('0x10'),_0x5a8dc8,_0x38f7('0x11'),JSON[_0x38f7('0x12')](_0x3a0c27));if(_0x3a0c27[_0x38f7('0x13')]){if(_0x3a0c27[_0x38f7('0x13')][_0x38f7('0x14')]===0x1f4){logger['error'](_0x38f7('0xe'),_0x5a8dc8,_0x3a0c27['error']['message']);return _0x268acf(_0x3a0c27[_0x38f7('0x13')][_0x38f7('0x15')]);}logger['error'](_0x38f7('0xe'),_0x5a8dc8,_0x3a0c27[_0x38f7('0x13')][_0x38f7('0x15')]);return _0x12959e(_0x3a0c27[_0x38f7('0x13')][_0x38f7('0x15')]);}else{logger['info'](_0x38f7('0xe'),_0x5a8dc8,_0x38f7('0x11'));_0x12959e(_0x3a0c27[_0x38f7('0x16')]['message']);}})[_0x38f7('0x17')](function(_0x87e53e){logger[_0x38f7('0x13')](_0x38f7('0xe'),_0x5a8dc8,_0x87e53e);_0x268acf(_0x87e53e);});});}