Built motion from commit fe909640.|2.6.8
[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 _0x8212=['VoicePrefix,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x35c490,_0xcb651){var _0x3d8e8b=function(_0x36f2c3){while(--_0x36f2c3){_0x35c490['push'](_0x35c490['shift']());}};_0x3d8e8b(++_0xcb651);}(_0x8212,0xb3));var _0x2821=function(_0x51904f,_0x439694){_0x51904f=_0x51904f-0x0;var _0x24dc27=_0x8212[_0x51904f];return _0x24dc27;};'use strict';var _=require(_0x2821('0x0'));var util=require(_0x2821('0x1'));var moment=require('moment');var BPromise=require(_0x2821('0x2'));var rs=require(_0x2821('0x3'));var fs=require('fs');var Redis=require(_0x2821('0x4'));var db=require(_0x2821('0x5'))['db'];var utils=require(_0x2821('0x6'));var logger=require(_0x2821('0x7'))(_0x2821('0x8'));var config=require(_0x2821('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2821('0xa')]['http']({'port':0x232a});config[_0x2821('0xb')]=_[_0x2821('0xc')](config['redis'],{'host':_0x2821('0xd'),'port':0x18eb});var socket=require(_0x2821('0xe'))(new Redis(config[_0x2821('0xb')]));require(_0x2821('0xf'))[_0x2821('0x10')](socket);function respondWithRpcPromise(_0x17d352,_0x258b64,_0x1a6eb6){return new BPromise(function(_0x379eee,_0x4aa28d){return client[_0x2821('0x11')](_0x17d352,_0x1a6eb6)[_0x2821('0x12')](function(_0x7c120a){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x258b64,'request\x20sent');logger['debug'](_0x2821('0x13'),_0x258b64,_0x2821('0x14'),JSON[_0x2821('0x15')](_0x7c120a));if(_0x7c120a[_0x2821('0x16')]){if(_0x7c120a[_0x2821('0x16')][_0x2821('0x17')]===0x1f4){logger['error'](_0x2821('0x18'),_0x258b64,_0x7c120a['error']['message']);return _0x4aa28d(_0x7c120a[_0x2821('0x16')][_0x2821('0x19')]);}logger[_0x2821('0x16')](_0x2821('0x18'),_0x258b64,_0x7c120a['error'][_0x2821('0x19')]);return _0x379eee(_0x7c120a['error'][_0x2821('0x19')]);}else{logger[_0x2821('0x1a')](_0x2821('0x18'),_0x258b64,_0x2821('0x14'));_0x379eee(_0x7c120a[_0x2821('0x1b')][_0x2821('0x19')]);}})[_0x2821('0x1c')](function(_0x1a7966){logger['error'](_0x2821('0x18'),_0x258b64,_0x1a7966);_0x4aa28d(_0x1a7966);});});}