Built motion from commit (unavailable).|2.5.17
[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 _0x2524=['../../config/environment','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x29055f,_0x1694ca){var _0x218a7e=function(_0x173677){while(--_0x173677){_0x29055f['push'](_0x29055f['shift']());}};_0x218a7e(++_0x1694ca);}(_0x2524,0x13e));var _0x4252=function(_0x5c37d7,_0x2b6d84){_0x5c37d7=_0x5c37d7-0x0;var _0xeb1936=_0x2524[_0x5c37d7];return _0xeb1936;};'use strict';var _=require(_0x4252('0x0'));var util=require(_0x4252('0x1'));var moment=require(_0x4252('0x2'));var BPromise=require('bluebird');var rs=require(_0x4252('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4252('0x4'));var logger=require(_0x4252('0x5'))(_0x4252('0x6'));var config=require(_0x4252('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4252('0x8')]({'port':0x232a});config[_0x4252('0x9')]=_[_0x4252('0xa')](config[_0x4252('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4252('0xb'))(new Redis(config[_0x4252('0x9')]));require(_0x4252('0xc'))[_0x4252('0xd')](socket);function respondWithRpcPromise(_0x915a20,_0x25a0b0,_0x47421f){return new BPromise(function(_0x492390,_0x1ec675){return client['request'](_0x915a20,_0x47421f)[_0x4252('0xe')](function(_0x210ce1){logger[_0x4252('0xf')](_0x4252('0x10'),_0x25a0b0,'request\x20sent');logger[_0x4252('0x11')](_0x4252('0x12'),_0x25a0b0,_0x4252('0x13'),JSON[_0x4252('0x14')](_0x210ce1));if(_0x210ce1['error']){if(_0x210ce1[_0x4252('0x15')]['code']===0x1f4){logger[_0x4252('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x25a0b0,_0x210ce1[_0x4252('0x15')][_0x4252('0x16')]);return _0x1ec675(_0x210ce1[_0x4252('0x15')][_0x4252('0x16')]);}logger[_0x4252('0x15')](_0x4252('0x10'),_0x25a0b0,_0x210ce1[_0x4252('0x15')][_0x4252('0x16')]);return _0x492390(_0x210ce1[_0x4252('0x15')][_0x4252('0x16')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x25a0b0,_0x4252('0x13'));_0x492390(_0x210ce1[_0x4252('0x17')][_0x4252('0x16')]);}})[_0x4252('0x18')](function(_0x1d87ae){logger[_0x4252('0x15')](_0x4252('0x10'),_0x25a0b0,_0x1d87ae);_0x1ec675(_0x1d87ae);});});}