Built motion from commit (unavailable).|2.5.10
[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 _0x0495=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x400322,_0x4353a8){var _0xfdd597=function(_0xd914b6){while(--_0xd914b6){_0x400322['push'](_0x400322['shift']());}};_0xfdd597(++_0x4353a8);}(_0x0495,0x11b));var _0x5049=function(_0x1c9e30,_0x3e9745){_0x1c9e30=_0x1c9e30-0x0;var _0x3eb1c5=_0x0495[_0x1c9e30];return _0x3eb1c5;};'use strict';var _=require(_0x5049('0x0'));var util=require(_0x5049('0x1'));var moment=require(_0x5049('0x2'));var BPromise=require(_0x5049('0x3'));var rs=require(_0x5049('0x4'));var fs=require('fs');var Redis=require(_0x5049('0x5'));var db=require(_0x5049('0x6'))['db'];var utils=require(_0x5049('0x7'));var logger=require('../../config/logger')(_0x5049('0x8'));var config=require('../../config/environment');var jayson=require(_0x5049('0x9'));var client=jayson[_0x5049('0xa')][_0x5049('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44c211,_0xcb8f1f,_0x515ace){return new BPromise(function(_0x10388f,_0x44c56c){return client[_0x5049('0xc')](_0x44c211,_0x515ace)[_0x5049('0xd')](function(_0x57ecf0){logger[_0x5049('0xe')](_0x5049('0xf'),_0xcb8f1f,_0x5049('0x10'));logger[_0x5049('0x11')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0xcb8f1f,_0x5049('0x10'),JSON[_0x5049('0x12')](_0x57ecf0));if(_0x57ecf0[_0x5049('0x13')]){if(_0x57ecf0[_0x5049('0x13')][_0x5049('0x14')]===0x1f4){logger[_0x5049('0x13')](_0x5049('0xf'),_0xcb8f1f,_0x57ecf0[_0x5049('0x13')][_0x5049('0x15')]);return _0x44c56c(_0x57ecf0['error'][_0x5049('0x15')]);}logger[_0x5049('0x13')](_0x5049('0xf'),_0xcb8f1f,_0x57ecf0['error']['message']);return _0x10388f(_0x57ecf0[_0x5049('0x13')][_0x5049('0x15')]);}else{logger['info'](_0x5049('0xf'),_0xcb8f1f,_0x5049('0x10'));_0x10388f(_0x57ecf0[_0x5049('0x16')][_0x5049('0x15')]);}})[_0x5049('0x17')](function(_0x7020f1){logger[_0x5049('0x13')](_0x5049('0xf'),_0xcb8f1f,_0x7020f1);_0x44c56c(_0x7020f1);});});}