Built motion from commit (unavailable).|2.5.15
[motion2.git] / server / api / voicePrefix / voicePrefix.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 _0x427e=['stringify','error','code','message','info','result','catch','lodash','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0x414e75,_0x2d0b54){var _0x39589d=function(_0x4065aa){while(--_0x4065aa){_0x414e75['push'](_0x414e75['shift']());}};_0x39589d(++_0x2d0b54);}(_0x427e,0x11a));var _0xe427=function(_0x1bc1d1,_0x643cac){_0x1bc1d1=_0x1bc1d1-0x0;var _0x326ded=_0x427e[_0x1bc1d1];return _0x326ded;};'use strict';var _=require(_0xe427('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe427('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe427('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe427('0x3'))(_0xe427('0x4'));var config=require('../../config/environment');var jayson=require(_0xe427('0x5'));var client=jayson[_0xe427('0x6')][_0xe427('0x7')]({'port':0x232a});config[_0xe427('0x8')]=_[_0xe427('0x9')](config[_0xe427('0x8')],{'host':_0xe427('0xa'),'port':0x18eb});var socket=require(_0xe427('0xb'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xe427('0xc')](socket);function respondWithRpcPromise(_0x1416b6,_0x381c7f,_0x25a1bc){return new BPromise(function(_0x3b3f9d,_0x2aecd7){return client[_0xe427('0xd')](_0x1416b6,_0x25a1bc)[_0xe427('0xe')](function(_0x5f2fad){logger['info'](_0xe427('0xf'),_0x381c7f,_0xe427('0x10'));logger['debug'](_0xe427('0x11'),_0x381c7f,_0xe427('0x10'),JSON[_0xe427('0x12')](_0x5f2fad));if(_0x5f2fad[_0xe427('0x13')]){if(_0x5f2fad[_0xe427('0x13')][_0xe427('0x14')]===0x1f4){logger[_0xe427('0x13')](_0xe427('0xf'),_0x381c7f,_0x5f2fad[_0xe427('0x13')]['message']);return _0x2aecd7(_0x5f2fad['error'][_0xe427('0x15')]);}logger[_0xe427('0x13')](_0xe427('0xf'),_0x381c7f,_0x5f2fad['error'][_0xe427('0x15')]);return _0x3b3f9d(_0x5f2fad[_0xe427('0x13')][_0xe427('0x15')]);}else{logger[_0xe427('0x16')](_0xe427('0xf'),_0x381c7f,'request\x20sent');_0x3b3f9d(_0x5f2fad[_0xe427('0x17')][_0xe427('0x15')]);}})[_0xe427('0x18')](function(_0x58637e){logger[_0xe427('0x13')](_0xe427('0xf'),_0x381c7f,_0x58637e);_0x2aecd7(_0x58637e);});});}