Built motion from commit (unavailable).|2.5.30
[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 _0x4c02=['error','VoicePrefix,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','debug'];(function(_0x3146d3,_0x4401ad){var _0x55107e=function(_0x580fbe){while(--_0x580fbe){_0x3146d3['push'](_0x3146d3['shift']());}};_0x55107e(++_0x4401ad);}(_0x4c02,0x1d9));var _0x24c0=function(_0x460666,_0x24bfa0){_0x460666=_0x460666-0x0;var _0x555cbf=_0x4c02[_0x460666];return _0x555cbf;};'use strict';var _=require(_0x24c0('0x0'));var util=require(_0x24c0('0x1'));var moment=require(_0x24c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x24c0('0x3'));var fs=require('fs');var Redis=require(_0x24c0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x24c0('0x5'));var logger=require(_0x24c0('0x6'))(_0x24c0('0x7'));var config=require(_0x24c0('0x8'));var jayson=require(_0x24c0('0x9'));var client=jayson[_0x24c0('0xa')][_0x24c0('0xb')]({'port':0x232a});config['redis']=_[_0x24c0('0xc')](config['redis'],{'host':_0x24c0('0xd'),'port':0x18eb});var socket=require(_0x24c0('0xe'))(new Redis(config['redis']));require(_0x24c0('0xf'))[_0x24c0('0x10')](socket);function respondWithRpcPromise(_0x1e6a4e,_0x51ff6c,_0x38a274){return new BPromise(function(_0x5e1360,_0x22cc1b){return client[_0x24c0('0x11')](_0x1e6a4e,_0x38a274)[_0x24c0('0x12')](function(_0x5201c7){logger[_0x24c0('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x51ff6c,'request\x20sent');logger[_0x24c0('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x51ff6c,'request\x20sent',JSON['stringify'](_0x5201c7));if(_0x5201c7[_0x24c0('0x15')]){if(_0x5201c7['error']['code']===0x1f4){logger[_0x24c0('0x15')](_0x24c0('0x16'),_0x51ff6c,_0x5201c7['error'][_0x24c0('0x17')]);return _0x22cc1b(_0x5201c7['error'][_0x24c0('0x17')]);}logger[_0x24c0('0x15')](_0x24c0('0x16'),_0x51ff6c,_0x5201c7[_0x24c0('0x15')]['message']);return _0x5e1360(_0x5201c7[_0x24c0('0x15')]['message']);}else{logger[_0x24c0('0x13')](_0x24c0('0x16'),_0x51ff6c,_0x24c0('0x18'));_0x5e1360(_0x5201c7['result']['message']);}})[_0x24c0('0x19')](function(_0x3b9d4f){logger[_0x24c0('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x51ff6c,_0x3b9d4f);_0x22cc1b(_0x3b9d4f);});});}