69c7fb9c7c9fe050bfe935993f6c512c2ca2b125
[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 _0xcd2f=['localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','error','VoicePrefix,\x20%s,\x20%s','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x565cf8,_0x82628d){var _0x1f0c41=function(_0x320e47){while(--_0x320e47){_0x565cf8['push'](_0x565cf8['shift']());}};_0x1f0c41(++_0x82628d);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xcd2f[_0x4b2863];return _0x567d67;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfcd2('0x0'));var rs=require(_0xfcd2('0x1'));var fs=require('fs');var Redis=require(_0xfcd2('0x2'));var db=require(_0xfcd2('0x3'))['db'];var utils=require(_0xfcd2('0x4'));var logger=require(_0xfcd2('0x5'))(_0xfcd2('0x6'));var config=require(_0xfcd2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfcd2('0x8')][_0xfcd2('0x9')]({'port':0x232a});config[_0xfcd2('0xa')]=_[_0xfcd2('0xb')](config[_0xfcd2('0xa')],{'host':_0xfcd2('0xc'),'port':0x18eb});var socket=require(_0xfcd2('0xd'))(new Redis(config[_0xfcd2('0xa')]));require(_0xfcd2('0xe'))[_0xfcd2('0xf')](socket);function respondWithRpcPromise(_0x3c4880,_0x53999a,_0x5994cf){return new BPromise(function(_0x18fa4d,_0x24cd5d){return client[_0xfcd2('0x10')](_0x3c4880,_0x5994cf)[_0xfcd2('0x11')](function(_0x53777e){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x53999a,'request\x20sent');logger['debug'](_0xfcd2('0x12'),_0x53999a,_0xfcd2('0x13'),JSON['stringify'](_0x53777e));if(_0x53777e[_0xfcd2('0x14')]){if(_0x53777e[_0xfcd2('0x14')]['code']===0x1f4){logger['error'](_0xfcd2('0x15'),_0x53999a,_0x53777e[_0xfcd2('0x14')][_0xfcd2('0x16')]);return _0x24cd5d(_0x53777e[_0xfcd2('0x14')][_0xfcd2('0x16')]);}logger['error'](_0xfcd2('0x15'),_0x53999a,_0x53777e[_0xfcd2('0x14')][_0xfcd2('0x16')]);return _0x18fa4d(_0x53777e[_0xfcd2('0x14')][_0xfcd2('0x16')]);}else{logger[_0xfcd2('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x53999a,_0xfcd2('0x13'));_0x18fa4d(_0x53777e[_0xfcd2('0x18')][_0xfcd2('0x16')]);}})[_0xfcd2('0x19')](function(_0x580184){logger[_0xfcd2('0x14')](_0xfcd2('0x15'),_0x53999a,_0x580184);_0x24cd5d(_0x580184);});});}