Built motion from commit (unavailable).|2.5.3
[motion2.git] / server / api / cannedAnswer / cannedAnswer.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 _0x8fe0=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','CannedAnswer,\x20%s,\x20%s','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','lodash','moment'];(function(_0xf28268,_0x54d95a){var _0x2b59ca=function(_0x454f70){while(--_0x454f70){_0xf28268['push'](_0xf28268['shift']());}};_0x2b59ca(++_0x54d95a);}(_0x8fe0,0xb2));var _0x08fe=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8fe0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x08fe('0x0'));var util=require('util');var moment=require(_0x08fe('0x1'));var BPromise=require(_0x08fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08fe('0x3'));var db=require(_0x08fe('0x4'))['db'];var utils=require(_0x08fe('0x5'));var logger=require('../../config/logger')(_0x08fe('0x6'));var config=require(_0x08fe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x08fe('0x8')][_0x08fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49f4aa,_0x23ab12,_0x2256af){return new BPromise(function(_0x561c4b,_0x2ca487){return client['request'](_0x49f4aa,_0x2256af)[_0x08fe('0xa')](function(_0x446706){logger[_0x08fe('0xb')](_0x08fe('0xc'),_0x23ab12,'request\x20sent');logger['debug'](_0x08fe('0xd'),_0x23ab12,_0x08fe('0xe'),JSON['stringify'](_0x446706));if(_0x446706['error']){if(_0x446706['error'][_0x08fe('0xf')]===0x1f4){logger[_0x08fe('0x10')](_0x08fe('0xc'),_0x23ab12,_0x446706[_0x08fe('0x10')][_0x08fe('0x11')]);return _0x2ca487(_0x446706['error'][_0x08fe('0x11')]);}logger[_0x08fe('0x10')](_0x08fe('0xc'),_0x23ab12,_0x446706[_0x08fe('0x10')]['message']);return _0x561c4b(_0x446706[_0x08fe('0x10')][_0x08fe('0x11')]);}else{logger[_0x08fe('0xb')](_0x08fe('0xc'),_0x23ab12,_0x08fe('0xe'));_0x561c4b(_0x446706['result']['message']);}})['catch'](function(_0x216192){logger['error'](_0x08fe('0xc'),_0x23ab12,_0x216192);_0x2ca487(_0x216192);});});}