Built motion from commit (unavailable).|2.5.15
[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 _0x0ace=['error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x334206,_0x5d9ecb){var _0x479fa2=function(_0x550a49){while(--_0x550a49){_0x334206['push'](_0x334206['shift']());}};_0x479fa2(++_0x5d9ecb);}(_0x0ace,0x15e));var _0xe0ac=function(_0x308c00,_0x3cbd67){_0x308c00=_0x308c00-0x0;var _0x2b21b2=_0x0ace[_0x308c00];return _0x2b21b2;};'use strict';var _=require(_0xe0ac('0x0'));var util=require(_0xe0ac('0x1'));var moment=require(_0xe0ac('0x2'));var BPromise=require(_0xe0ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0ac('0x4'))['db'];var utils=require(_0xe0ac('0x5'));var logger=require(_0xe0ac('0x6'))(_0xe0ac('0x7'));var config=require(_0xe0ac('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe0ac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cd9c0,_0x346188,_0x75439f){return new BPromise(function(_0x31f622,_0x3b86e8){return client[_0xe0ac('0xa')](_0x1cd9c0,_0x75439f)[_0xe0ac('0xb')](function(_0x4c7b84){logger[_0xe0ac('0xc')](_0xe0ac('0xd'),_0x346188,'request\x20sent');logger[_0xe0ac('0xe')](_0xe0ac('0xf'),_0x346188,_0xe0ac('0x10'),JSON[_0xe0ac('0x11')](_0x4c7b84));if(_0x4c7b84[_0xe0ac('0x12')]){if(_0x4c7b84[_0xe0ac('0x12')][_0xe0ac('0x13')]===0x1f4){logger['error'](_0xe0ac('0xd'),_0x346188,_0x4c7b84['error']['message']);return _0x3b86e8(_0x4c7b84[_0xe0ac('0x12')][_0xe0ac('0x14')]);}logger[_0xe0ac('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x346188,_0x4c7b84[_0xe0ac('0x12')]['message']);return _0x31f622(_0x4c7b84[_0xe0ac('0x12')][_0xe0ac('0x14')]);}else{logger['info'](_0xe0ac('0xd'),_0x346188,_0xe0ac('0x10'));_0x31f622(_0x4c7b84[_0xe0ac('0x15')][_0xe0ac('0x14')]);}})[_0xe0ac('0x16')](function(_0x4c568a){logger[_0xe0ac('0x12')](_0xe0ac('0xd'),_0x346188,_0x4c568a);_0x3b86e8(_0x4c568a);});});}