Built motion from commit (unavailable).|2.5.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 _0x7a45=['../../config/environment','client','http','request','then','info','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','CannedAnswer,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','rpc'];(function(_0x366caa,_0x275844){var _0x5536d5=function(_0x5b2519){while(--_0x5b2519){_0x366caa['push'](_0x366caa['shift']());}};_0x5536d5(++_0x275844);}(_0x7a45,0xe5));var _0x57a4=function(_0x2312fe,_0x5a4c44){_0x2312fe=_0x2312fe-0x0;var _0x3599ff=_0x7a45[_0x2312fe];return _0x3599ff;};'use strict';var _=require(_0x57a4('0x0'));var util=require(_0x57a4('0x1'));var moment=require('moment');var BPromise=require(_0x57a4('0x2'));var rs=require(_0x57a4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x57a4('0x4'));var config=require(_0x57a4('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x57a4('0x6')][_0x57a4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5b98fb,_0x5d0ecc,_0x3fb96b){return new BPromise(function(_0x1fcc29,_0x2a2fb5){return client[_0x57a4('0x8')](_0x5b98fb,_0x3fb96b)[_0x57a4('0x9')](function(_0x37756e){logger[_0x57a4('0xa')]('CannedAnswer,\x20%s,\x20%s',_0x5d0ecc,'request\x20sent');logger[_0x57a4('0xb')](_0x57a4('0xc'),_0x5d0ecc,'request\x20sent',JSON[_0x57a4('0xd')](_0x37756e));if(_0x37756e[_0x57a4('0xe')]){if(_0x37756e[_0x57a4('0xe')][_0x57a4('0xf')]===0x1f4){logger[_0x57a4('0xe')](_0x57a4('0x10'),_0x5d0ecc,_0x37756e[_0x57a4('0xe')]['message']);return _0x2a2fb5(_0x37756e[_0x57a4('0xe')]['message']);}logger[_0x57a4('0xe')](_0x57a4('0x10'),_0x5d0ecc,_0x37756e[_0x57a4('0xe')][_0x57a4('0x11')]);return _0x1fcc29(_0x37756e[_0x57a4('0xe')]['message']);}else{logger[_0x57a4('0xa')](_0x57a4('0x10'),_0x5d0ecc,'request\x20sent');_0x1fcc29(_0x37756e['result'][_0x57a4('0x11')]);}})['catch'](function(_0x2b0d92){logger[_0x57a4('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x5d0ecc,_0x2b0d92);_0x2a2fb5(_0x2b0d92);});});}