Built motion from commit (unavailable).|2.5.4
[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 _0x757d=['moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','then','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util'];(function(_0x1f3e64,_0x254556){var _0x107d9c=function(_0x406eb9){while(--_0x406eb9){_0x1f3e64['push'](_0x1f3e64['shift']());}};_0x107d9c(++_0x254556);}(_0x757d,0xb2));var _0xd757=function(_0x32729c,_0xf5afd8){_0x32729c=_0x32729c-0x0;var _0x482cfd=_0x757d[_0x32729c];return _0x482cfd;};'use strict';var _=require(_0xd757('0x0'));var util=require(_0xd757('0x1'));var moment=require(_0xd757('0x2'));var BPromise=require('bluebird');var rs=require(_0xd757('0x3'));var fs=require('fs');var Redis=require(_0xd757('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd757('0x5'));var logger=require('../../config/logger')(_0xd757('0x6'));var config=require(_0xd757('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43d793,_0xd75d09,_0x174433){return new BPromise(function(_0x3a6aaa,_0x3b3b9){return client['request'](_0x43d793,_0x174433)[_0xd757('0x9')](function(_0x22f569){logger[_0xd757('0xa')](_0xd757('0xb'),_0xd75d09,_0xd757('0xc'));logger['debug'](_0xd757('0xd'),_0xd75d09,_0xd757('0xc'),JSON['stringify'](_0x22f569));if(_0x22f569[_0xd757('0xe')]){if(_0x22f569['error'][_0xd757('0xf')]===0x1f4){logger[_0xd757('0xe')](_0xd757('0xb'),_0xd75d09,_0x22f569[_0xd757('0xe')][_0xd757('0x10')]);return _0x3b3b9(_0x22f569[_0xd757('0xe')]['message']);}logger[_0xd757('0xe')]('CannedAnswer,\x20%s,\x20%s',_0xd75d09,_0x22f569[_0xd757('0xe')][_0xd757('0x10')]);return _0x3a6aaa(_0x22f569[_0xd757('0xe')][_0xd757('0x10')]);}else{logger[_0xd757('0xa')](_0xd757('0xb'),_0xd75d09,_0xd757('0xc'));_0x3a6aaa(_0x22f569['result'][_0xd757('0x10')]);}})[_0xd757('0x11')](function(_0x30880c){logger[_0xd757('0xe')](_0xd757('0xb'),_0xd75d09,_0x30880c);_0x3b3b9(_0x30880c);});});}