a228b12aab76c03a0507022670486567a4fa7950
[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 _0x0d5e=['request\x20sent','stringify','code','error','result','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','VoiceMusicOnHold,\x20%s,\x20%s','debug'];(function(_0x41c81a,_0x4d88a5){var _0x5e42dd=function(_0x5b7e8f){while(--_0x5b7e8f){_0x41c81a['push'](_0x41c81a['shift']());}};_0x5e42dd(++_0x4d88a5);}(_0x0d5e,0xb2));var _0xe0d5=function(_0x5ecd67,_0x49447a){_0x5ecd67=_0x5ecd67-0x0;var _0x275ae7=_0x0d5e[_0x5ecd67];return _0x275ae7;};'use strict';var _=require(_0xe0d5('0x0'));var util=require(_0xe0d5('0x1'));var moment=require(_0xe0d5('0x2'));var BPromise=require(_0xe0d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0d5('0x4'))['db'];var utils=require(_0xe0d5('0x5'));var logger=require('../../config/logger')(_0xe0d5('0x6'));var config=require('../../config/environment');var jayson=require(_0xe0d5('0x7'));var client=jayson[_0xe0d5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbddcab,_0x4ef55b,_0x22a868){return new BPromise(function(_0x22add2,_0x7a2d19){return client[_0xe0d5('0x9')](_0xbddcab,_0x22a868)['then'](function(_0x575126){logger['info'](_0xe0d5('0xa'),_0x4ef55b,'request\x20sent');logger[_0xe0d5('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x4ef55b,_0xe0d5('0xc'),JSON[_0xe0d5('0xd')](_0x575126));if(_0x575126['error']){if(_0x575126['error'][_0xe0d5('0xe')]===0x1f4){logger[_0xe0d5('0xf')](_0xe0d5('0xa'),_0x4ef55b,_0x575126[_0xe0d5('0xf')]['message']);return _0x7a2d19(_0x575126[_0xe0d5('0xf')]['message']);}logger[_0xe0d5('0xf')](_0xe0d5('0xa'),_0x4ef55b,_0x575126['error']['message']);return _0x22add2(_0x575126['error']['message']);}else{logger['info'](_0xe0d5('0xa'),_0x4ef55b,_0xe0d5('0xc'));_0x22add2(_0x575126[_0xe0d5('0x10')][_0xe0d5('0x11')]);}})[_0xe0d5('0x12')](function(_0xe0f06){logger['error'](_0xe0d5('0xa'),_0x4ef55b,_0xe0f06);_0x7a2d19(_0xe0f06);});});}