e6ed502cb9de041c5aeaee53203b3c4a20aaa4e3
[motion2.git] / server / api / voiceMail / voiceMail.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 _0x320f=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x1d37b9,_0x40a041){var _0x4f4ae6=function(_0x1f5b46){while(--_0x1f5b46){_0x1d37b9['push'](_0x1d37b9['shift']());}};_0x4f4ae6(++_0x40a041);}(_0x320f,0x1b2));var _0xf320=function(_0x4e0e14,_0x196bc1){_0x4e0e14=_0x4e0e14-0x0;var _0x15f35d=_0x320f[_0x4e0e14];return _0x15f35d;};'use strict';var _=require('lodash');var util=require(_0xf320('0x0'));var moment=require(_0xf320('0x1'));var BPromise=require(_0xf320('0x2'));var rs=require(_0xf320('0x3'));var fs=require('fs');var Redis=require(_0xf320('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf320('0x5'));var logger=require(_0xf320('0x6'))(_0xf320('0x7'));var config=require(_0xf320('0x8'));var jayson=require(_0xf320('0x9'));var client=jayson[_0xf320('0xa')][_0xf320('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x461d0e,_0x223fd1,_0x3c36ed){return new BPromise(function(_0x29d9c2,_0x7693b5){return client['request'](_0x461d0e,_0x3c36ed)[_0xf320('0xc')](function(_0x2c167d){logger[_0xf320('0xd')](_0xf320('0xe'),_0x223fd1,_0xf320('0xf'));logger[_0xf320('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x223fd1,_0xf320('0xf'),JSON[_0xf320('0x11')](_0x2c167d));if(_0x2c167d[_0xf320('0x12')]){if(_0x2c167d['error'][_0xf320('0x13')]===0x1f4){logger[_0xf320('0x12')](_0xf320('0xe'),_0x223fd1,_0x2c167d[_0xf320('0x12')]['message']);return _0x7693b5(_0x2c167d[_0xf320('0x12')][_0xf320('0x14')]);}logger[_0xf320('0x12')]('VoiceMail,\x20%s,\x20%s',_0x223fd1,_0x2c167d['error']['message']);return _0x29d9c2(_0x2c167d[_0xf320('0x12')][_0xf320('0x14')]);}else{logger['info'](_0xf320('0xe'),_0x223fd1,_0xf320('0xf'));_0x29d9c2(_0x2c167d[_0xf320('0x15')]['message']);}})[_0xf320('0x16')](function(_0x3e89d0){logger['error']('VoiceMail,\x20%s,\x20%s',_0x223fd1,_0x3e89d0);_0x7693b5(_0x3e89d0);});});}