Built motion from commit f8768ebe.|2.6.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 _0x8277=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','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','stringify','error','code','message','result','catch','util'];(function(_0x475dc6,_0x4fe920){var _0x1bf2a0=function(_0x466b1a){while(--_0x466b1a){_0x475dc6['push'](_0x475dc6['shift']());}};_0x1bf2a0(++_0x4fe920);}(_0x8277,0xcf));var _0x7827=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x8277[_0x1e172a];return _0x96338b;};'use strict';var _=require('lodash');var util=require(_0x7827('0x0'));var moment=require(_0x7827('0x1'));var BPromise=require('bluebird');var rs=require(_0x7827('0x2'));var fs=require('fs');var Redis=require(_0x7827('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7827('0x4'));var logger=require(_0x7827('0x5'))('rpc');var config=require(_0x7827('0x6'));var jayson=require(_0x7827('0x7'));var client=jayson[_0x7827('0x8')]['http']({'port':0x232a});config[_0x7827('0x9')]=_[_0x7827('0xa')](config[_0x7827('0x9')],{'host':_0x7827('0xb'),'port':0x18eb});var socket=require(_0x7827('0xc'))(new Redis(config[_0x7827('0x9')]));require(_0x7827('0xd'))[_0x7827('0xe')](socket);function respondWithRpcPromise(_0xfd2a88,_0x2392d8,_0x2abc26){return new BPromise(function(_0x4472b2,_0x21f5d5){return client[_0x7827('0xf')](_0xfd2a88,_0x2abc26)['then'](function(_0x457717){logger[_0x7827('0x10')](_0x7827('0x11'),_0x2392d8,_0x7827('0x12'));logger['debug'](_0x7827('0x13'),_0x2392d8,_0x7827('0x12'),JSON[_0x7827('0x14')](_0x457717));if(_0x457717[_0x7827('0x15')]){if(_0x457717[_0x7827('0x15')][_0x7827('0x16')]===0x1f4){logger[_0x7827('0x15')](_0x7827('0x11'),_0x2392d8,_0x457717[_0x7827('0x15')][_0x7827('0x17')]);return _0x21f5d5(_0x457717[_0x7827('0x15')][_0x7827('0x17')]);}logger[_0x7827('0x15')](_0x7827('0x11'),_0x2392d8,_0x457717[_0x7827('0x15')]['message']);return _0x4472b2(_0x457717[_0x7827('0x15')][_0x7827('0x17')]);}else{logger[_0x7827('0x10')](_0x7827('0x11'),_0x2392d8,_0x7827('0x12'));_0x4472b2(_0x457717[_0x7827('0x18')][_0x7827('0x17')]);}})[_0x7827('0x19')](function(_0x4f6500){logger[_0x7827('0x15')](_0x7827('0x11'),_0x2392d8,_0x4f6500);_0x21f5d5(_0x4f6500);});});}