Built motion from commit 25580385.|2.6.2
[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 _0xbd36=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4f5f12,_0x416857){var _0x183cf7=function(_0x3e4b60){while(--_0x3e4b60){_0x4f5f12['push'](_0x4f5f12['shift']());}};_0x183cf7(++_0x416857);}(_0xbd36,0x65));var _0x6bd3=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xbd36[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x6bd3('0x0'));var util=require(_0x6bd3('0x1'));var moment=require(_0x6bd3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bd3('0x3'));var db=require(_0x6bd3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bd3('0x5'))(_0x6bd3('0x6'));var config=require(_0x6bd3('0x7'));var jayson=require(_0x6bd3('0x8'));var client=jayson['client'][_0x6bd3('0x9')]({'port':0x232a});config[_0x6bd3('0xa')]=_[_0x6bd3('0xb')](config[_0x6bd3('0xa')],{'host':_0x6bd3('0xc'),'port':0x18eb});var socket=require(_0x6bd3('0xd'))(new Redis(config[_0x6bd3('0xa')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x310f54,_0x50f7f4,_0x2ce148){return new BPromise(function(_0x18004a,_0x25056a){return client[_0x6bd3('0xe')](_0x310f54,_0x2ce148)[_0x6bd3('0xf')](function(_0x56e88f){logger[_0x6bd3('0x10')](_0x6bd3('0x11'),_0x50f7f4,'request\x20sent');logger[_0x6bd3('0x12')](_0x6bd3('0x13'),_0x50f7f4,_0x6bd3('0x14'),JSON[_0x6bd3('0x15')](_0x56e88f));if(_0x56e88f[_0x6bd3('0x16')]){if(_0x56e88f[_0x6bd3('0x16')][_0x6bd3('0x17')]===0x1f4){logger[_0x6bd3('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x50f7f4,_0x56e88f[_0x6bd3('0x16')][_0x6bd3('0x18')]);return _0x25056a(_0x56e88f['error']['message']);}logger['error'](_0x6bd3('0x11'),_0x50f7f4,_0x56e88f['error'][_0x6bd3('0x18')]);return _0x18004a(_0x56e88f[_0x6bd3('0x16')][_0x6bd3('0x18')]);}else{logger[_0x6bd3('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x50f7f4,'request\x20sent');_0x18004a(_0x56e88f[_0x6bd3('0x19')][_0x6bd3('0x18')]);}})[_0x6bd3('0x1a')](function(_0x45ae0e){logger[_0x6bd3('0x16')](_0x6bd3('0x11'),_0x50f7f4,_0x45ae0e);_0x25056a(_0x45ae0e);});});}