Built motion from commit (unavailable).|2.5.21
[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 _0xe2a0=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x1dc2c7,_0x9cc18d){var _0x17d9e0=function(_0x5eddcc){while(--_0x5eddcc){_0x1dc2c7['push'](_0x1dc2c7['shift']());}};_0x17d9e0(++_0x9cc18d);}(_0xe2a0,0xe2));var _0x0e2a=function(_0x2ff5b0,_0x45d3b1){_0x2ff5b0=_0x2ff5b0-0x0;var _0x89b2a1=_0xe2a0[_0x2ff5b0];return _0x89b2a1;};'use strict';var _=require(_0x0e2a('0x0'));var util=require('util');var moment=require(_0x0e2a('0x1'));var BPromise=require(_0x0e2a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e2a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e2a('0x4'));var logger=require('../../config/logger')(_0x0e2a('0x5'));var config=require(_0x0e2a('0x6'));var jayson=require(_0x0e2a('0x7'));var client=jayson[_0x0e2a('0x8')][_0x0e2a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c89f7,_0x504c49,_0x31f01a){return new BPromise(function(_0x4ca27b,_0x4a84db){return client[_0x0e2a('0xa')](_0x2c89f7,_0x31f01a)[_0x0e2a('0xb')](function(_0x424ef3){logger[_0x0e2a('0xc')](_0x0e2a('0xd'),_0x504c49,_0x0e2a('0xe'));logger[_0x0e2a('0xf')](_0x0e2a('0x10'),_0x504c49,_0x0e2a('0xe'),JSON[_0x0e2a('0x11')](_0x424ef3));if(_0x424ef3['error']){if(_0x424ef3[_0x0e2a('0x12')][_0x0e2a('0x13')]===0x1f4){logger['error'](_0x0e2a('0xd'),_0x504c49,_0x424ef3['error'][_0x0e2a('0x14')]);return _0x4a84db(_0x424ef3[_0x0e2a('0x12')][_0x0e2a('0x14')]);}logger[_0x0e2a('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x504c49,_0x424ef3[_0x0e2a('0x12')][_0x0e2a('0x14')]);return _0x4ca27b(_0x424ef3['error'][_0x0e2a('0x14')]);}else{logger['info']('CannedAnswer,\x20%s,\x20%s',_0x504c49,'request\x20sent');_0x4ca27b(_0x424ef3[_0x0e2a('0x15')][_0x0e2a('0x14')]);}})[_0x0e2a('0x16')](function(_0x3fc205){logger[_0x0e2a('0x12')](_0x0e2a('0xd'),_0x504c49,_0x3fc205);_0x4a84db(_0x3fc205);});});}