c31465d729b57d0067f5b74fdd5a493092129d31
[motion2.git] / server / api / voiceMusicOnHold / voiceMusicOnHold.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 _0xdbb1=['request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','../../config/utils','../../config/environment','client','http','request','then','VoiceMusicOnHold,\x20%s,\x20%s'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0xdbb1,0x67));var _0x1dbb=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xdbb1[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0x1dbb('0x0'));var util=require(_0x1dbb('0x1'));var moment=require(_0x1dbb('0x2'));var BPromise=require(_0x1dbb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1dbb('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1dbb('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1dbb('0x6')][_0x1dbb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2800fa,_0x37b046,_0x391eb1){return new BPromise(function(_0x51a9cc,_0x523baf){return client[_0x1dbb('0x8')](_0x2800fa,_0x391eb1)[_0x1dbb('0x9')](function(_0x1a34c6){logger['info'](_0x1dbb('0xa'),_0x37b046,_0x1dbb('0xb'));logger[_0x1dbb('0xc')](_0x1dbb('0xd'),_0x37b046,_0x1dbb('0xb'),JSON[_0x1dbb('0xe')](_0x1a34c6));if(_0x1a34c6[_0x1dbb('0xf')]){if(_0x1a34c6[_0x1dbb('0xf')]['code']===0x1f4){logger['error'](_0x1dbb('0xa'),_0x37b046,_0x1a34c6[_0x1dbb('0xf')][_0x1dbb('0x10')]);return _0x523baf(_0x1a34c6['error'][_0x1dbb('0x10')]);}logger[_0x1dbb('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x37b046,_0x1a34c6[_0x1dbb('0xf')][_0x1dbb('0x10')]);return _0x51a9cc(_0x1a34c6[_0x1dbb('0xf')][_0x1dbb('0x10')]);}else{logger[_0x1dbb('0x11')](_0x1dbb('0xa'),_0x37b046,_0x1dbb('0xb'));_0x51a9cc(_0x1a34c6['result'][_0x1dbb('0x10')]);}})[_0x1dbb('0x12')](function(_0x140ad4){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x37b046,_0x140ad4);_0x523baf(_0x140ad4);});});}