Built motion from commit (unavailable).|2.5.27
[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 _0x15aa=['code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x30c18f,_0xdc5cfb){var _0x342b1f=function(_0x2c7569){while(--_0x2c7569){_0x30c18f['push'](_0x30c18f['shift']());}};_0x342b1f(++_0xdc5cfb);}(_0x15aa,0xcb));var _0xa15a=function(_0xfd6f5,_0x25c8f8){_0xfd6f5=_0xfd6f5-0x0;var _0x36d448=_0x15aa[_0xfd6f5];return _0x36d448;};'use strict';var _=require(_0xa15a('0x0'));var util=require('util');var moment=require(_0xa15a('0x1'));var BPromise=require(_0xa15a('0x2'));var rs=require(_0xa15a('0x3'));var fs=require('fs');var Redis=require(_0xa15a('0x4'));var db=require(_0xa15a('0x5'))['db'];var utils=require(_0xa15a('0x6'));var logger=require(_0xa15a('0x7'))(_0xa15a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa15a('0x9')][_0xa15a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d6465,_0x240a33,_0x464da4){return new BPromise(function(_0x36c9ca,_0x32648c){return client['request'](_0x2d6465,_0x464da4)[_0xa15a('0xb')](function(_0x5202b0){logger['info'](_0xa15a('0xc'),_0x240a33,_0xa15a('0xd'));logger[_0xa15a('0xe')](_0xa15a('0xf'),_0x240a33,'request\x20sent',JSON[_0xa15a('0x10')](_0x5202b0));if(_0x5202b0['error']){if(_0x5202b0['error'][_0xa15a('0x11')]===0x1f4){logger['error'](_0xa15a('0xc'),_0x240a33,_0x5202b0[_0xa15a('0x12')][_0xa15a('0x13')]);return _0x32648c(_0x5202b0[_0xa15a('0x12')][_0xa15a('0x13')]);}logger[_0xa15a('0x12')](_0xa15a('0xc'),_0x240a33,_0x5202b0['error'][_0xa15a('0x13')]);return _0x36c9ca(_0x5202b0[_0xa15a('0x12')][_0xa15a('0x13')]);}else{logger['info'](_0xa15a('0xc'),_0x240a33,_0xa15a('0xd'));_0x36c9ca(_0x5202b0[_0xa15a('0x14')][_0xa15a('0x13')]);}})[_0xa15a('0x15')](function(_0xb886e6){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x240a33,_0xb886e6);_0x32648c(_0xb886e6);});});}