Built motion from commit 87cd5f02.|2.5.48
[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 _0x8fcd=['rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','request','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x4dbba7,_0x34d6d1){var _0x43ef83=function(_0x27acf1){while(--_0x27acf1){_0x4dbba7['push'](_0x4dbba7['shift']());}};_0x43ef83(++_0x34d6d1);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x12a3b1,_0x571e97){_0x12a3b1=_0x12a3b1-0x0;var _0x4c6d15=_0x8fcd[_0x12a3b1];return _0x4c6d15;};'use strict';var _=require(_0xd8fc('0x0'));var util=require(_0xd8fc('0x1'));var moment=require(_0xd8fc('0x2'));var BPromise=require(_0xd8fc('0x3'));var rs=require(_0xd8fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd8fc('0x5'));var logger=require(_0xd8fc('0x6'))(_0xd8fc('0x7'));var config=require(_0xd8fc('0x8'));var jayson=require(_0xd8fc('0x9'));var client=jayson[_0xd8fc('0xa')]['http']({'port':0x232a});config['redis']=_[_0xd8fc('0xb')](config['redis'],{'host':_0xd8fc('0xc'),'port':0x18eb});var socket=require(_0xd8fc('0xd'))(new Redis(config[_0xd8fc('0xe')]));require(_0xd8fc('0xf'))['register'](socket);function respondWithRpcPromise(_0x5ce1ee,_0x16ef0c,_0x575049){return new BPromise(function(_0x49ac65,_0x1a1927){return client[_0xd8fc('0x10')](_0x5ce1ee,_0x575049)['then'](function(_0x4f3823){logger[_0xd8fc('0x11')](_0xd8fc('0x12'),_0x16ef0c,'request\x20sent');logger[_0xd8fc('0x13')](_0xd8fc('0x14'),_0x16ef0c,_0xd8fc('0x15'),JSON[_0xd8fc('0x16')](_0x4f3823));if(_0x4f3823[_0xd8fc('0x17')]){if(_0x4f3823['error'][_0xd8fc('0x18')]===0x1f4){logger['error'](_0xd8fc('0x12'),_0x16ef0c,_0x4f3823[_0xd8fc('0x17')][_0xd8fc('0x19')]);return _0x1a1927(_0x4f3823['error'][_0xd8fc('0x19')]);}logger[_0xd8fc('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x16ef0c,_0x4f3823['error'][_0xd8fc('0x19')]);return _0x49ac65(_0x4f3823[_0xd8fc('0x17')][_0xd8fc('0x19')]);}else{logger['info'](_0xd8fc('0x12'),_0x16ef0c,_0xd8fc('0x15'));_0x49ac65(_0x4f3823[_0xd8fc('0x1a')][_0xd8fc('0x19')]);}})[_0xd8fc('0x1b')](function(_0x373654){logger[_0xd8fc('0x17')](_0xd8fc('0x12'),_0x16ef0c,_0x373654);_0x1a1927(_0x373654);});});}