Built motion from commit (unavailable).|2.4.4
[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 _0x822a=['info','CannedAnswer,\x20%s,\x20%s','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x349164,_0x58a515){var _0x1d64e2=function(_0x4cd544){while(--_0x4cd544){_0x349164['push'](_0x349164['shift']());}};_0x1d64e2(++_0x58a515);}(_0x822a,0x87));var _0xa822=function(_0x471540,_0x428580){_0x471540=_0x471540-0x0;var _0x10217a=_0x822a[_0x471540];return _0x10217a;};'use strict';var _=require(_0xa822('0x0'));var util=require(_0xa822('0x1'));var moment=require(_0xa822('0x2'));var BPromise=require(_0xa822('0x3'));var rs=require(_0xa822('0x4'));var fs=require('fs');var Redis=require(_0xa822('0x5'));var db=require(_0xa822('0x6'))['db'];var utils=require(_0xa822('0x7'));var logger=require(_0xa822('0x8'))(_0xa822('0x9'));var config=require('../../config/environment');var jayson=require(_0xa822('0xa'));var client=jayson[_0xa822('0xb')][_0xa822('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34c2e8,_0x1eaedc,_0x23c3b1){return new BPromise(function(_0x21ce6a,_0x4035d1){return client[_0xa822('0xd')](_0x34c2e8,_0x23c3b1)[_0xa822('0xe')](function(_0x38a62e){logger[_0xa822('0xf')](_0xa822('0x10'),_0x1eaedc,_0xa822('0x11'));logger['debug'](_0xa822('0x12'),_0x1eaedc,_0xa822('0x11'),JSON[_0xa822('0x13')](_0x38a62e));if(_0x38a62e[_0xa822('0x14')]){if(_0x38a62e[_0xa822('0x14')][_0xa822('0x15')]===0x1f4){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x1eaedc,_0x38a62e['error']['message']);return _0x4035d1(_0x38a62e[_0xa822('0x14')]['message']);}logger[_0xa822('0x14')](_0xa822('0x10'),_0x1eaedc,_0x38a62e[_0xa822('0x14')][_0xa822('0x16')]);return _0x21ce6a(_0x38a62e['error'][_0xa822('0x16')]);}else{logger[_0xa822('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x1eaedc,_0xa822('0x11'));_0x21ce6a(_0x38a62e[_0xa822('0x17')][_0xa822('0x16')]);}})[_0xa822('0x18')](function(_0x18ad55){logger[_0xa822('0x14')](_0xa822('0x10'),_0x1eaedc,_0x18ad55);_0x4035d1(_0x18ad55);});});}