Built motion from commit 5b761a7b.|2.5.36
[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 _0xc2c7=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','localhost','socket.io-emitter','redis','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x403697,_0x1da82c){var _0x1a97b2=function(_0x265352){while(--_0x265352){_0x403697['push'](_0x403697['shift']());}};_0x1a97b2(++_0x1da82c);}(_0xc2c7,0x134));var _0x7c2c=function(_0x12156e,_0x2d50dd){_0x12156e=_0x12156e-0x0;var _0x18aaa2=_0xc2c7[_0x12156e];return _0x18aaa2;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x7c2c('0xb'),'port':0x18eb});var socket=require(_0x7c2c('0xc'))(new Redis(config[_0x7c2c('0xd')]));require(_0x7c2c('0xe'))[_0x7c2c('0xf')](socket);function respondWithRpcPromise(_0x57b107,_0x3093d2,_0x307bec){return new BPromise(function(_0x285ff6,_0x1bfeaf){return client[_0x7c2c('0x10')](_0x57b107,_0x307bec)[_0x7c2c('0x11')](function(_0x2cb057){logger[_0x7c2c('0x12')](_0x7c2c('0x13'),_0x3093d2,_0x7c2c('0x14'));logger[_0x7c2c('0x15')](_0x7c2c('0x16'),_0x3093d2,_0x7c2c('0x14'),JSON[_0x7c2c('0x17')](_0x2cb057));if(_0x2cb057[_0x7c2c('0x18')]){if(_0x2cb057[_0x7c2c('0x18')]['code']===0x1f4){logger['error'](_0x7c2c('0x13'),_0x3093d2,_0x2cb057[_0x7c2c('0x18')][_0x7c2c('0x19')]);return _0x1bfeaf(_0x2cb057['error'][_0x7c2c('0x19')]);}logger[_0x7c2c('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x3093d2,_0x2cb057[_0x7c2c('0x18')]['message']);return _0x285ff6(_0x2cb057[_0x7c2c('0x18')]['message']);}else{logger[_0x7c2c('0x12')](_0x7c2c('0x13'),_0x3093d2,_0x7c2c('0x14'));_0x285ff6(_0x2cb057[_0x7c2c('0x1a')][_0x7c2c('0x19')]);}})[_0x7c2c('0x1b')](function(_0x2c1378){logger[_0x7c2c('0x18')](_0x7c2c('0x13'),_0x3093d2,_0x2c1378);_0x1bfeaf(_0x2c1378);});});}