Built motion from commit d5e4af8c.|2.6.23
[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 _0x082a=['message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x28c0cb,_0x4b54f3){var _0x9d54f7=function(_0x293e00){while(--_0x293e00){_0x28c0cb['push'](_0x28c0cb['shift']());}};_0x9d54f7(++_0x4b54f3);}(_0x082a,0x154));var _0xa082=function(_0x5351fb,_0x39aa75){_0x5351fb=_0x5351fb-0x0;var _0x1275f8=_0x082a[_0x5351fb];return _0x1275f8;};'use strict';var _=require('lodash');var util=require(_0xa082('0x0'));var moment=require(_0xa082('0x1'));var BPromise=require(_0xa082('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa082('0x3'));var db=require(_0xa082('0x4'))['db'];var utils=require(_0xa082('0x5'));var logger=require(_0xa082('0x6'))(_0xa082('0x7'));var config=require('../../config/environment');var jayson=require(_0xa082('0x8'));var client=jayson['client'][_0xa082('0x9')]({'port':0x232a});config[_0xa082('0xa')]=_['defaults'](config[_0xa082('0xa')],{'host':_0xa082('0xb'),'port':0x18eb});var socket=require(_0xa082('0xc'))(new Redis(config['redis']));require(_0xa082('0xd'))[_0xa082('0xe')](socket);function respondWithRpcPromise(_0xd359ef,_0x46b66d,_0x7c826c){return new BPromise(function(_0x494ef6,_0x1fcf69){return client[_0xa082('0xf')](_0xd359ef,_0x7c826c)[_0xa082('0x10')](function(_0x5798dc){logger['info'](_0xa082('0x11'),_0x46b66d,_0xa082('0x12'));logger[_0xa082('0x13')](_0xa082('0x14'),_0x46b66d,'request\x20sent',JSON[_0xa082('0x15')](_0x5798dc));if(_0x5798dc[_0xa082('0x16')]){if(_0x5798dc[_0xa082('0x16')][_0xa082('0x17')]===0x1f4){logger[_0xa082('0x16')](_0xa082('0x11'),_0x46b66d,_0x5798dc['error'][_0xa082('0x18')]);return _0x1fcf69(_0x5798dc[_0xa082('0x16')]['message']);}logger[_0xa082('0x16')](_0xa082('0x11'),_0x46b66d,_0x5798dc[_0xa082('0x16')][_0xa082('0x18')]);return _0x494ef6(_0x5798dc['error']['message']);}else{logger[_0xa082('0x19')](_0xa082('0x11'),_0x46b66d,'request\x20sent');_0x494ef6(_0x5798dc[_0xa082('0x1a')]['message']);}})[_0xa082('0x1b')](function(_0x284376){logger[_0xa082('0x16')](_0xa082('0x11'),_0x46b66d,_0x284376);_0x1fcf69(_0x284376);});});}