fb19dcf8817411070b3183b1a7535dd0ce99c911
[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 _0x823f=['../../config/environment','jayson/promise','client','request','CannedAnswer,\x20%s,\x20%s','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x38e447,_0x2c399f){var _0x32b8f7=function(_0x59601f){while(--_0x59601f){_0x38e447['push'](_0x38e447['shift']());}};_0x32b8f7(++_0x2c399f);}(_0x823f,0x9f));var _0xf823=function(_0x19ef2b,_0x354f66){_0x19ef2b=_0x19ef2b-0x0;var _0x4df537=_0x823f[_0x19ef2b];return _0x4df537;};'use strict';var _=require(_0xf823('0x0'));var util=require(_0xf823('0x1'));var moment=require(_0xf823('0x2'));var BPromise=require(_0xf823('0x3'));var rs=require(_0xf823('0x4'));var fs=require('fs');var Redis=require(_0xf823('0x5'));var db=require(_0xf823('0x6'))['db'];var utils=require(_0xf823('0x7'));var logger=require(_0xf823('0x8'))('rpc');var config=require(_0xf823('0x9'));var jayson=require(_0xf823('0xa'));var client=jayson[_0xf823('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5507cd,_0x574348,_0x138856){return new BPromise(function(_0x3750a3,_0x5ce626){return client[_0xf823('0xc')](_0x5507cd,_0x138856)['then'](function(_0x33bef0){logger['info'](_0xf823('0xd'),_0x574348,'request\x20sent');logger['debug'](_0xf823('0xe'),_0x574348,_0xf823('0xf'),JSON['stringify'](_0x33bef0));if(_0x33bef0[_0xf823('0x10')]){if(_0x33bef0['error']['code']===0x1f4){logger[_0xf823('0x10')](_0xf823('0xd'),_0x574348,_0x33bef0[_0xf823('0x10')][_0xf823('0x11')]);return _0x5ce626(_0x33bef0[_0xf823('0x10')]['message']);}logger[_0xf823('0x10')](_0xf823('0xd'),_0x574348,_0x33bef0[_0xf823('0x10')][_0xf823('0x11')]);return _0x3750a3(_0x33bef0['error']['message']);}else{logger[_0xf823('0x12')](_0xf823('0xd'),_0x574348,_0xf823('0xf'));_0x3750a3(_0x33bef0[_0xf823('0x13')][_0xf823('0x11')]);}})[_0xf823('0x14')](function(_0x543f39){logger[_0xf823('0x10')](_0xf823('0xd'),_0x574348,_0x543f39);_0x5ce626(_0x543f39);});});}