Built motion from commit (unavailable).|2.5.29
[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 _0xc8c7=['../../config/environment','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2e9aab,_0x5bee41){var _0x81d7dd=function(_0x1e2cd4){while(--_0x1e2cd4){_0x2e9aab['push'](_0x2e9aab['shift']());}};_0x81d7dd(++_0x5bee41);}(_0xc8c7,0x117));var _0x7c8c=function(_0x4025f1,_0x7f6778){_0x4025f1=_0x4025f1-0x0;var _0x4eb867=_0xc8c7[_0x4025f1];return _0x4eb867;};'use strict';var _=require(_0x7c8c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7c8c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c8c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c8c('0x3'));var logger=require(_0x7c8c('0x4'))(_0x7c8c('0x5'));var config=require(_0x7c8c('0x6'));var jayson=require(_0x7c8c('0x7'));var client=jayson['client'][_0x7c8c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54608f,_0x14f584,_0x2ffc37){return new BPromise(function(_0x3fbc26,_0x4307d6){return client[_0x7c8c('0x9')](_0x54608f,_0x2ffc37)[_0x7c8c('0xa')](function(_0x419e96){logger[_0x7c8c('0xb')](_0x7c8c('0xc'),_0x14f584,'request\x20sent');logger[_0x7c8c('0xd')](_0x7c8c('0xe'),_0x14f584,_0x7c8c('0xf'),JSON['stringify'](_0x419e96));if(_0x419e96[_0x7c8c('0x10')]){if(_0x419e96[_0x7c8c('0x10')]['code']===0x1f4){logger[_0x7c8c('0x10')](_0x7c8c('0xc'),_0x14f584,_0x419e96[_0x7c8c('0x10')]['message']);return _0x4307d6(_0x419e96['error']['message']);}logger[_0x7c8c('0x10')]('Automation,\x20%s,\x20%s',_0x14f584,_0x419e96[_0x7c8c('0x10')][_0x7c8c('0x11')]);return _0x3fbc26(_0x419e96[_0x7c8c('0x10')][_0x7c8c('0x11')]);}else{logger[_0x7c8c('0xb')](_0x7c8c('0xc'),_0x14f584,_0x7c8c('0xf'));_0x3fbc26(_0x419e96['result'][_0x7c8c('0x11')]);}})[_0x7c8c('0x12')](function(_0x5bb2ee){logger[_0x7c8c('0x10')](_0x7c8c('0xc'),_0x14f584,_0x5bb2ee);_0x4307d6(_0x5bb2ee);});});}