Built motion from commit (unavailable).|2.5.14
[motion2.git] / server / api / openchannelAccount / openchannelAccount.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 _0x234c=['OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./openchannelAccount.socket','then','info','OpenchannelAccount,\x20%s,\x20%s','debug'];(function(_0x2359a0,_0x51ab9c){var _0x269f47=function(_0x5ed79d){while(--_0x5ed79d){_0x2359a0['push'](_0x2359a0['shift']());}};_0x269f47(++_0x51ab9c);}(_0x234c,0x17f));var _0xc234=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x234c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc234('0x0'));var util=require(_0xc234('0x1'));var moment=require(_0xc234('0x2'));var BPromise=require(_0xc234('0x3'));var rs=require(_0xc234('0x4'));var fs=require('fs');var Redis=require(_0xc234('0x5'));var db=require(_0xc234('0x6'))['db'];var utils=require(_0xc234('0x7'));var logger=require(_0xc234('0x8'))(_0xc234('0x9'));var config=require(_0xc234('0xa'));var jayson=require(_0xc234('0xb'));var client=jayson[_0xc234('0xc')][_0xc234('0xd')]({'port':0x232a});config['redis']=_[_0xc234('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc234('0xf'))(new Redis(config[_0xc234('0x10')]));require(_0xc234('0x11'))['register'](socket);function respondWithRpcPromise(_0x4240eb,_0x44535d,_0x2cef90){return new BPromise(function(_0x49ec69,_0x3d53ed){return client['request'](_0x4240eb,_0x2cef90)[_0xc234('0x12')](function(_0x515379){logger[_0xc234('0x13')](_0xc234('0x14'),_0x44535d,'request\x20sent');logger[_0xc234('0x15')](_0xc234('0x16'),_0x44535d,_0xc234('0x17'),JSON['stringify'](_0x515379));if(_0x515379[_0xc234('0x18')]){if(_0x515379[_0xc234('0x18')][_0xc234('0x19')]===0x1f4){logger['error'](_0xc234('0x14'),_0x44535d,_0x515379[_0xc234('0x18')][_0xc234('0x1a')]);return _0x3d53ed(_0x515379[_0xc234('0x18')][_0xc234('0x1a')]);}logger[_0xc234('0x18')](_0xc234('0x14'),_0x44535d,_0x515379[_0xc234('0x18')][_0xc234('0x1a')]);return _0x49ec69(_0x515379[_0xc234('0x18')][_0xc234('0x1a')]);}else{logger[_0xc234('0x13')](_0xc234('0x14'),_0x44535d,_0xc234('0x17'));_0x49ec69(_0x515379['result'][_0xc234('0x1a')]);}})['catch'](function(_0x4373b6){logger[_0xc234('0x18')](_0xc234('0x14'),_0x44535d,_0x4373b6);_0x3d53ed(_0x4373b6);});});}