Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / api / whatsappApplication / whatsappApplication.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 _0xfd2e=['error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0xfd2e,0x6e));var _0xefd2=function(_0xf9a655,_0x223e92){_0xf9a655=_0xf9a655-0x0;var _0x239857=_0xfd2e[_0xf9a655];return _0x239857;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var moment=require(_0xefd2('0x1'));var BPromise=require('bluebird');var rs=require(_0xefd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefd2('0x3'))['db'];var utils=require(_0xefd2('0x4'));var logger=require(_0xefd2('0x5'))(_0xefd2('0x6'));var config=require(_0xefd2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefd2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x516aab,_0x51fab0,_0x43d90b){return new BPromise(function(_0x50dd63,_0x440d11){return client[_0xefd2('0x9')](_0x516aab,_0x43d90b)[_0xefd2('0xa')](function(_0xded765){logger[_0xefd2('0xb')](_0xefd2('0xc'),_0x51fab0,_0xefd2('0xd'));logger['debug'](_0xefd2('0xe'),_0x51fab0,_0xefd2('0xd'),JSON[_0xefd2('0xf')](_0xded765));if(_0xded765[_0xefd2('0x10')]){if(_0xded765[_0xefd2('0x10')][_0xefd2('0x11')]===0x1f4){logger[_0xefd2('0x10')](_0xefd2('0xc'),_0x51fab0,_0xded765['error']['message']);return _0x440d11(_0xded765[_0xefd2('0x10')]['message']);}logger['error'](_0xefd2('0xc'),_0x51fab0,_0xded765[_0xefd2('0x10')][_0xefd2('0x12')]);return _0x50dd63(_0xded765[_0xefd2('0x10')][_0xefd2('0x12')]);}else{logger['info'](_0xefd2('0xc'),_0x51fab0,_0xefd2('0xd'));_0x50dd63(_0xded765[_0xefd2('0x13')][_0xefd2('0x12')]);}})[_0xefd2('0x14')](function(_0x471e3b){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x51fab0,_0x471e3b);_0x440d11(_0x471e3b);});});}