Built motion from commit (unavailable).|2.4.17
[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 _0xb531=['CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3b5d64,_0x538ec4){var _0x147682=function(_0x39611b){while(--_0x39611b){_0x3b5d64['push'](_0x3b5d64['shift']());}};_0x147682(++_0x538ec4);}(_0xb531,0x1c0));var _0x1b53=function(_0x5bbb96,_0x10071d){_0x5bbb96=_0x5bbb96-0x0;var _0x18d362=_0xb531[_0x5bbb96];return _0x18d362;};'use strict';var _=require('lodash');var util=require(_0x1b53('0x0'));var moment=require('moment');var BPromise=require(_0x1b53('0x1'));var rs=require(_0x1b53('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b53('0x3'))['db'];var utils=require(_0x1b53('0x4'));var logger=require(_0x1b53('0x5'))(_0x1b53('0x6'));var config=require('../../config/environment');var jayson=require(_0x1b53('0x7'));var client=jayson['client'][_0x1b53('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28cf1e,_0x1f323a,_0x3e4087){return new BPromise(function(_0x47a671,_0x4b1579){return client[_0x1b53('0x9')](_0x28cf1e,_0x3e4087)['then'](function(_0x27d785){logger[_0x1b53('0xa')](_0x1b53('0xb'),_0x1f323a,_0x1b53('0xc'));logger[_0x1b53('0xd')](_0x1b53('0xe'),_0x1f323a,_0x1b53('0xc'),JSON[_0x1b53('0xf')](_0x27d785));if(_0x27d785[_0x1b53('0x10')]){if(_0x27d785[_0x1b53('0x10')][_0x1b53('0x11')]===0x1f4){logger[_0x1b53('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x1f323a,_0x27d785[_0x1b53('0x10')]['message']);return _0x4b1579(_0x27d785[_0x1b53('0x10')][_0x1b53('0x12')]);}logger['error'](_0x1b53('0xb'),_0x1f323a,_0x27d785[_0x1b53('0x10')]['message']);return _0x47a671(_0x27d785[_0x1b53('0x10')]['message']);}else{logger[_0x1b53('0xa')]('CannedAnswer,\x20%s,\x20%s',_0x1f323a,'request\x20sent');_0x47a671(_0x27d785[_0x1b53('0x13')][_0x1b53('0x12')]);}})[_0x1b53('0x14')](function(_0x1ce377){logger[_0x1b53('0x10')](_0x1b53('0xb'),_0x1f323a,_0x1ce377);_0x4b1579(_0x1ce377);});});}