Built motion from commit (unavailable).|2.5.4
[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 _0x6125=['defaults','redis','socket.io-emitter','./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0x6125,0x162));var _0x5612=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6125[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5612('0x0'));var util=require(_0x5612('0x1'));var moment=require(_0x5612('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5612('0x3'));var db=require(_0x5612('0x4'))['db'];var utils=require(_0x5612('0x5'));var logger=require('../../config/logger')(_0x5612('0x6'));var config=require(_0x5612('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5612('0x8')][_0x5612('0x9')]({'port':0x232a});config['redis']=_[_0x5612('0xa')](config[_0x5612('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5612('0xc'))(new Redis(config[_0x5612('0xb')]));require(_0x5612('0xd'))['register'](socket);function respondWithRpcPromise(_0xb856e7,_0xf2f7c2,_0x456c2d){return new BPromise(function(_0x2280a5,_0x1ccc3a){return client[_0x5612('0xe')](_0xb856e7,_0x456c2d)[_0x5612('0xf')](function(_0x25685d){logger['info'](_0x5612('0x10'),_0xf2f7c2,'request\x20sent');logger[_0x5612('0x11')](_0x5612('0x12'),_0xf2f7c2,_0x5612('0x13'),JSON[_0x5612('0x14')](_0x25685d));if(_0x25685d[_0x5612('0x15')]){if(_0x25685d[_0x5612('0x15')][_0x5612('0x16')]===0x1f4){logger[_0x5612('0x15')](_0x5612('0x10'),_0xf2f7c2,_0x25685d[_0x5612('0x15')]['message']);return _0x1ccc3a(_0x25685d[_0x5612('0x15')][_0x5612('0x17')]);}logger[_0x5612('0x15')](_0x5612('0x10'),_0xf2f7c2,_0x25685d[_0x5612('0x15')]['message']);return _0x2280a5(_0x25685d[_0x5612('0x15')][_0x5612('0x17')]);}else{logger[_0x5612('0x18')]('VoicePrefix,\x20%s,\x20%s',_0xf2f7c2,_0x5612('0x13'));_0x2280a5(_0x25685d['result'][_0x5612('0x17')]);}})[_0x5612('0x19')](function(_0x5e6928){logger[_0x5612('0x15')](_0x5612('0x10'),_0xf2f7c2,_0x5e6928);_0x1ccc3a(_0x5e6928);});});}