Built motion from commit (unavailable).|2.0.72
[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 _0x6592=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result'];(function(_0x44104e,_0x2d2d96){var _0x51e6a8=function(_0x11d488){while(--_0x11d488){_0x44104e['push'](_0x44104e['shift']());}};_0x51e6a8(++_0x2d2d96);}(_0x6592,0xd3));var _0x2659=function(_0x449158,_0x44e1b0){_0x449158=_0x449158-0x0;var _0x1f3c3a=_0x6592[_0x449158];return _0x1f3c3a;};'use strict';var _=require('lodash');var util=require(_0x2659('0x0'));var moment=require(_0x2659('0x1'));var BPromise=require(_0x2659('0x2'));var rs=require(_0x2659('0x3'));var fs=require('fs');var db=require(_0x2659('0x4'))['db'];var utils=require(_0x2659('0x5'));var logger=require('../../config/logger')(_0x2659('0x6'));var config=require(_0x2659('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2659('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42650f,_0x1d8953,_0x14459e){return new BPromise(function(_0xbae971,_0x338876){return client[_0x2659('0x9')](_0x42650f,_0x14459e)[_0x2659('0xa')](function(_0x40e7f1){logger['info'](_0x2659('0xb'),_0x1d8953,'request\x20sent');logger[_0x2659('0xc')](_0x2659('0xd'),_0x1d8953,'request\x20sent',JSON['stringify'](_0x40e7f1));if(_0x40e7f1[_0x2659('0xe')]){if(_0x40e7f1[_0x2659('0xe')][_0x2659('0xf')]===0x1f4){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x1d8953,_0x40e7f1[_0x2659('0xe')][_0x2659('0x10')]);return _0x338876(_0x40e7f1[_0x2659('0xe')][_0x2659('0x10')]);}logger[_0x2659('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x1d8953,_0x40e7f1[_0x2659('0xe')][_0x2659('0x10')]);return _0xbae971(_0x40e7f1[_0x2659('0xe')][_0x2659('0x10')]);}else{logger[_0x2659('0x11')](_0x2659('0xb'),_0x1d8953,_0x2659('0x12'));_0xbae971(_0x40e7f1[_0x2659('0x13')][_0x2659('0x10')]);}})[_0x2659('0x14')](function(_0x29339a){logger['error'](_0x2659('0xb'),_0x1d8953,_0x29339a);_0x338876(_0x29339a);});});}