Built motion from commit (unavailable).|2.5.14
[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 _0xd615=['CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd615,0x1ec));var _0x5d61=function(_0x1cac9f,_0x4d9691){_0x1cac9f=_0x1cac9f-0x0;var _0x14ea8f=_0xd615[_0x1cac9f];return _0x14ea8f;};'use strict';var _=require(_0x5d61('0x0'));var util=require(_0x5d61('0x1'));var moment=require(_0x5d61('0x2'));var BPromise=require(_0x5d61('0x3'));var rs=require(_0x5d61('0x4'));var fs=require('fs');var Redis=require(_0x5d61('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d61('0x6'));var logger=require(_0x5d61('0x7'))(_0x5d61('0x8'));var config=require('../../config/environment');var jayson=require(_0x5d61('0x9'));var client=jayson['client'][_0x5d61('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e3118,_0x4946dd,_0xc12fd5){return new BPromise(function(_0x21b74b,_0x577e69){return client[_0x5d61('0xb')](_0x4e3118,_0xc12fd5)[_0x5d61('0xc')](function(_0xde9b73){logger[_0x5d61('0xd')](_0x5d61('0xe'),_0x4946dd,_0x5d61('0xf'));logger[_0x5d61('0x10')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x4946dd,_0x5d61('0xf'),JSON['stringify'](_0xde9b73));if(_0xde9b73[_0x5d61('0x11')]){if(_0xde9b73['error'][_0x5d61('0x12')]===0x1f4){logger[_0x5d61('0x11')]('CannedAnswer,\x20%s,\x20%s',_0x4946dd,_0xde9b73[_0x5d61('0x11')]['message']);return _0x577e69(_0xde9b73[_0x5d61('0x11')][_0x5d61('0x13')]);}logger[_0x5d61('0x11')](_0x5d61('0xe'),_0x4946dd,_0xde9b73[_0x5d61('0x11')]['message']);return _0x21b74b(_0xde9b73[_0x5d61('0x11')][_0x5d61('0x13')]);}else{logger[_0x5d61('0xd')](_0x5d61('0xe'),_0x4946dd,_0x5d61('0xf'));_0x21b74b(_0xde9b73[_0x5d61('0x14')]['message']);}})[_0x5d61('0x15')](function(_0x1e7d29){logger[_0x5d61('0x11')](_0x5d61('0xe'),_0x4946dd,_0x1e7d29);_0x577e69(_0x1e7d29);});});}