Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / api / openchannelMessage / openchannelMessage.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 _0x01d9=['catch','CreateOpenchannelMessage','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x43e9ed,_0xe5a03d){var _0x523323=function(_0x3a6bc1){while(--_0x3a6bc1){_0x43e9ed['push'](_0x43e9ed['shift']());}};_0x523323(++_0xe5a03d);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});config[_0x901d('0xc')]=_[_0x901d('0xd')](config[_0x901d('0xc')],{'host':_0x901d('0xe'),'port':0x18eb});var socket=require(_0x901d('0xf'))(new Redis(config[_0x901d('0xc')]));require(_0x901d('0x10'))[_0x901d('0x11')](socket);function respondWithRpcPromise(_0xacff40,_0x440fb0,_0xd819f0){return new BPromise(function(_0x1d3137,_0x5d74e2){return client[_0x901d('0x12')](_0xacff40,_0xd819f0)['then'](function(_0x220153){logger[_0x901d('0x13')](_0x901d('0x14'),_0x440fb0,_0x901d('0x15'));logger[_0x901d('0x16')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x440fb0,_0x901d('0x15'),JSON[_0x901d('0x17')](_0x220153));if(_0x220153[_0x901d('0x18')]){if(_0x220153[_0x901d('0x18')][_0x901d('0x19')]===0x1f4){logger[_0x901d('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x440fb0,_0x220153[_0x901d('0x18')][_0x901d('0x1a')]);return _0x5d74e2(_0x220153[_0x901d('0x18')][_0x901d('0x1a')]);}logger[_0x901d('0x18')](_0x901d('0x14'),_0x440fb0,_0x220153[_0x901d('0x18')][_0x901d('0x1a')]);return _0x1d3137(_0x220153[_0x901d('0x18')][_0x901d('0x1a')]);}else{logger[_0x901d('0x13')](_0x901d('0x14'),_0x440fb0,_0x901d('0x15'));_0x1d3137(_0x220153[_0x901d('0x1b')][_0x901d('0x1a')]);}})[_0x901d('0x1c')](function(_0xf3c66a){logger[_0x901d('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x440fb0,_0xf3c66a);_0x5d74e2(_0xf3c66a);});});}exports[_0x901d('0x1d')]=function(_0x2f32f8){var _0x4d27db=this;return new Promise(function(_0x5bdff4,_0x496a06){return db['OpenchannelMessage'][_0x901d('0x1e')](_0x2f32f8[_0x901d('0x1f')],{'raw':_0x2f32f8['options']?_0x2f32f8[_0x901d('0x20')][_0x901d('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x20778b){logger[_0x901d('0x13')](_0x901d('0x1d'),_0x2f32f8);logger[_0x901d('0x16')](_0x901d('0x1d'),_0x2f32f8,JSON[_0x901d('0x17')](_0x20778b));_0x5bdff4(_0x20778b);})[_0x901d('0x1c')](function(_0x45b6a8){logger['error'](_0x901d('0x1d'),_0x45b6a8[_0x901d('0x1a')],_0x2f32f8);_0x496a06(_0x4d27db[_0x901d('0x18')](0x1f4,_0x45b6a8[_0x901d('0x1a')]));});});};