Built motion from commit 4ffc18b1.|2.6.31
[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 _0x6c45=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x51d602,_0x3f1e0e){var _0x50d1d8=function(_0xb38c05){while(--_0xb38c05){_0x51d602['push'](_0x51d602['shift']());}};_0x50d1d8(++_0x3f1e0e);}(_0x6c45,0xb1));var _0x56c4=function(_0xc75f5b,_0x30a88a){_0xc75f5b=_0xc75f5b-0x0;var _0x29cb88=_0x6c45[_0xc75f5b];return _0x29cb88;};'use strict';var _=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var moment=require('moment');var BPromise=require(_0x56c4('0x2'));var rs=require(_0x56c4('0x3'));var fs=require('fs');var Redis=require(_0x56c4('0x4'));var db=require(_0x56c4('0x5'))['db'];var utils=require(_0x56c4('0x6'));var logger=require(_0x56c4('0x7'))(_0x56c4('0x8'));var config=require(_0x56c4('0x9'));var jayson=require(_0x56c4('0xa'));var client=jayson[_0x56c4('0xb')][_0x56c4('0xc')]({'port':0x232a});config[_0x56c4('0xd')]=_[_0x56c4('0xe')](config[_0x56c4('0xd')],{'host':_0x56c4('0xf'),'port':0x18eb});var socket=require(_0x56c4('0x10'))(new Redis(config[_0x56c4('0xd')]));require(_0x56c4('0x11'))[_0x56c4('0x12')](socket);function respondWithRpcPromise(_0x1d5094,_0x503254,_0x2533d7){return new BPromise(function(_0x10feed,_0x311519){return client[_0x56c4('0x13')](_0x1d5094,_0x2533d7)['then'](function(_0x34603e){logger[_0x56c4('0x14')](_0x56c4('0x15'),_0x503254,_0x56c4('0x16'));logger['debug'](_0x56c4('0x17'),_0x503254,'request\x20sent',JSON['stringify'](_0x34603e));if(_0x34603e[_0x56c4('0x18')]){if(_0x34603e[_0x56c4('0x18')][_0x56c4('0x19')]===0x1f4){logger[_0x56c4('0x18')](_0x56c4('0x15'),_0x503254,_0x34603e['error'][_0x56c4('0x1a')]);return _0x311519(_0x34603e[_0x56c4('0x18')]['message']);}logger[_0x56c4('0x18')](_0x56c4('0x15'),_0x503254,_0x34603e[_0x56c4('0x18')][_0x56c4('0x1a')]);return _0x10feed(_0x34603e['error'][_0x56c4('0x1a')]);}else{logger[_0x56c4('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x503254,_0x56c4('0x16'));_0x10feed(_0x34603e[_0x56c4('0x1b')][_0x56c4('0x1a')]);}})[_0x56c4('0x1c')](function(_0x4d6871){logger[_0x56c4('0x18')](_0x56c4('0x15'),_0x503254,_0x4d6871);_0x311519(_0x4d6871);});});}