Built motion from commit (unavailable).|2.4.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 _0x21e3=['stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s'];(function(_0x2683d4,_0x1148c2){var _0x493266=function(_0x566c4a){while(--_0x566c4a){_0x2683d4['push'](_0x2683d4['shift']());}};_0x493266(++_0x1148c2);}(_0x21e3,0x131));var _0x321e=function(_0x26f75d,_0x1e940d){_0x26f75d=_0x26f75d-0x0;var _0x174123=_0x21e3[_0x26f75d];return _0x174123;};'use strict';var _=require(_0x321e('0x0'));var util=require('util');var moment=require(_0x321e('0x1'));var BPromise=require(_0x321e('0x2'));var rs=require(_0x321e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x321e('0x4'));var logger=require(_0x321e('0x5'))(_0x321e('0x6'));var config=require(_0x321e('0x7'));var jayson=require(_0x321e('0x8'));var client=jayson[_0x321e('0x9')][_0x321e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x224b8c,_0x2e5b1f,_0x1228a4){return new BPromise(function(_0x3c75e5,_0x178516){return client[_0x321e('0xb')](_0x224b8c,_0x1228a4)[_0x321e('0xc')](function(_0x4d7428){logger['info'](_0x321e('0xd'),_0x2e5b1f,_0x321e('0xe'));logger[_0x321e('0xf')](_0x321e('0x10'),_0x2e5b1f,_0x321e('0xe'),JSON[_0x321e('0x11')](_0x4d7428));if(_0x4d7428['error']){if(_0x4d7428[_0x321e('0x12')][_0x321e('0x13')]===0x1f4){logger[_0x321e('0x12')](_0x321e('0xd'),_0x2e5b1f,_0x4d7428[_0x321e('0x12')][_0x321e('0x14')]);return _0x178516(_0x4d7428['error'][_0x321e('0x14')]);}logger['error'](_0x321e('0xd'),_0x2e5b1f,_0x4d7428[_0x321e('0x12')][_0x321e('0x14')]);return _0x3c75e5(_0x4d7428[_0x321e('0x12')]['message']);}else{logger[_0x321e('0x15')](_0x321e('0xd'),_0x2e5b1f,_0x321e('0xe'));_0x3c75e5(_0x4d7428['result']['message']);}})[_0x321e('0x16')](function(_0x50d012){logger['error'](_0x321e('0xd'),_0x2e5b1f,_0x50d012);_0x178516(_0x50d012);});});}