Built motion from commit (unavailable).|2.5.22
[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 _0xba99=['info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then'];(function(_0x16125c,_0x569146){var _0x39267f=function(_0x41c4d8){while(--_0x41c4d8){_0x16125c['push'](_0x16125c['shift']());}};_0x39267f(++_0x569146);}(_0xba99,0x7d));var _0x9ba9=function(_0x381c2f,_0x2dde11){_0x381c2f=_0x381c2f-0x0;var _0x43bda5=_0xba99[_0x381c2f];return _0x43bda5;};'use strict';var _=require(_0x9ba9('0x0'));var util=require(_0x9ba9('0x1'));var moment=require(_0x9ba9('0x2'));var BPromise=require(_0x9ba9('0x3'));var rs=require(_0x9ba9('0x4'));var fs=require('fs');var Redis=require(_0x9ba9('0x5'));var db=require(_0x9ba9('0x6'))['db'];var utils=require(_0x9ba9('0x7'));var logger=require(_0x9ba9('0x8'))('rpc');var config=require(_0x9ba9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9ba9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a8a94,_0x413a41,_0x591a50){return new BPromise(function(_0x3b0408,_0x2bcc18){return client[_0x9ba9('0xb')](_0x3a8a94,_0x591a50)[_0x9ba9('0xc')](function(_0x52f254){logger[_0x9ba9('0xd')](_0x9ba9('0xe'),_0x413a41,'request\x20sent');logger[_0x9ba9('0xf')](_0x9ba9('0x10'),_0x413a41,_0x9ba9('0x11'),JSON[_0x9ba9('0x12')](_0x52f254));if(_0x52f254[_0x9ba9('0x13')]){if(_0x52f254[_0x9ba9('0x13')][_0x9ba9('0x14')]===0x1f4){logger[_0x9ba9('0x13')]('CannedAnswer,\x20%s,\x20%s',_0x413a41,_0x52f254[_0x9ba9('0x13')][_0x9ba9('0x15')]);return _0x2bcc18(_0x52f254['error'][_0x9ba9('0x15')]);}logger['error'](_0x9ba9('0xe'),_0x413a41,_0x52f254[_0x9ba9('0x13')][_0x9ba9('0x15')]);return _0x3b0408(_0x52f254[_0x9ba9('0x13')]['message']);}else{logger[_0x9ba9('0xd')](_0x9ba9('0xe'),_0x413a41,_0x9ba9('0x11'));_0x3b0408(_0x52f254[_0x9ba9('0x16')]['message']);}})['catch'](function(_0x334e00){logger[_0x9ba9('0x13')](_0x9ba9('0xe'),_0x413a41,_0x334e00);_0x2bcc18(_0x334e00);});});}