e41f22c869cf9942c591711123fbfcb685f5fc00
[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 _0xc1ce=['CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','CannedAnswer,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x4917a2,_0x235623){var _0x9c5420=function(_0x20a548){while(--_0x20a548){_0x4917a2['push'](_0x4917a2['shift']());}};_0x9c5420(++_0x235623);}(_0xc1ce,0x128));var _0xec1c=function(_0x1498a2,_0x534bb3){_0x1498a2=_0x1498a2-0x0;var _0x4898ad=_0xc1ce[_0x1498a2];return _0x4898ad;};'use strict';var _=require(_0xec1c('0x0'));var util=require(_0xec1c('0x1'));var moment=require(_0xec1c('0x2'));var BPromise=require(_0xec1c('0x3'));var rs=require(_0xec1c('0x4'));var fs=require('fs');var Redis=require(_0xec1c('0x5'));var db=require(_0xec1c('0x6'))['db'];var utils=require(_0xec1c('0x7'));var logger=require('../../config/logger')(_0xec1c('0x8'));var config=require('../../config/environment');var jayson=require(_0xec1c('0x9'));var client=jayson[_0xec1c('0xa')][_0xec1c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e9db4,_0x82b579,_0x38ae60){return new BPromise(function(_0x3aec2a,_0xf1ece9){return client[_0xec1c('0xc')](_0x5e9db4,_0x38ae60)['then'](function(_0x54e394){logger[_0xec1c('0xd')]('CannedAnswer,\x20%s,\x20%s',_0x82b579,_0xec1c('0xe'));logger[_0xec1c('0xf')](_0xec1c('0x10'),_0x82b579,'request\x20sent',JSON[_0xec1c('0x11')](_0x54e394));if(_0x54e394[_0xec1c('0x12')]){if(_0x54e394['error'][_0xec1c('0x13')]===0x1f4){logger[_0xec1c('0x12')](_0xec1c('0x14'),_0x82b579,_0x54e394[_0xec1c('0x12')]['message']);return _0xf1ece9(_0x54e394[_0xec1c('0x12')]['message']);}logger[_0xec1c('0x12')](_0xec1c('0x14'),_0x82b579,_0x54e394[_0xec1c('0x12')]['message']);return _0x3aec2a(_0x54e394[_0xec1c('0x12')][_0xec1c('0x15')]);}else{logger[_0xec1c('0xd')](_0xec1c('0x14'),_0x82b579,_0xec1c('0xe'));_0x3aec2a(_0x54e394[_0xec1c('0x16')][_0xec1c('0x15')]);}})[_0xec1c('0x17')](function(_0x448238){logger[_0xec1c('0x12')](_0xec1c('0x14'),_0x82b579,_0x448238);_0xf1ece9(_0x448238);});});}