Built motion from commit 14588770.|2.5.38
[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 _0xb921=['socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x5ab238,_0x4ddda9){var _0x236db6=function(_0x5f1f3f){while(--_0x5f1f3f){_0x5ab238['push'](_0x5ab238['shift']());}};_0x236db6(++_0x4ddda9);}(_0xb921,0x16a));var _0x1b92=function(_0x2fcd62,_0x57bf42){_0x2fcd62=_0x2fcd62-0x0;var _0x2580f5=_0xb921[_0x2fcd62];return _0x2580f5;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var moment=require(_0x1b92('0x2'));var BPromise=require(_0x1b92('0x3'));var rs=require(_0x1b92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b92('0x5'));var logger=require(_0x1b92('0x6'))(_0x1b92('0x7'));var config=require(_0x1b92('0x8'));var jayson=require(_0x1b92('0x9'));var client=jayson[_0x1b92('0xa')][_0x1b92('0xb')]({'port':0x232a});config[_0x1b92('0xc')]=_[_0x1b92('0xd')](config[_0x1b92('0xc')],{'host':_0x1b92('0xe'),'port':0x18eb});var socket=require(_0x1b92('0xf'))(new Redis(config[_0x1b92('0xc')]));require(_0x1b92('0x10'))[_0x1b92('0x11')](socket);function respondWithRpcPromise(_0x4c8e30,_0x31e314,_0x1e5802){return new BPromise(function(_0x154b6d,_0x146d68){return client[_0x1b92('0x12')](_0x4c8e30,_0x1e5802)[_0x1b92('0x13')](function(_0x3deaf4){logger['info'](_0x1b92('0x14'),_0x31e314,_0x1b92('0x15'));logger['debug'](_0x1b92('0x16'),_0x31e314,_0x1b92('0x15'),JSON[_0x1b92('0x17')](_0x3deaf4));if(_0x3deaf4[_0x1b92('0x18')]){if(_0x3deaf4[_0x1b92('0x18')][_0x1b92('0x19')]===0x1f4){logger[_0x1b92('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x31e314,_0x3deaf4[_0x1b92('0x18')]['message']);return _0x146d68(_0x3deaf4[_0x1b92('0x18')]['message']);}logger[_0x1b92('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x31e314,_0x3deaf4[_0x1b92('0x18')][_0x1b92('0x1a')]);return _0x154b6d(_0x3deaf4[_0x1b92('0x18')]['message']);}else{logger[_0x1b92('0x1b')](_0x1b92('0x14'),_0x31e314,_0x1b92('0x15'));_0x154b6d(_0x3deaf4[_0x1b92('0x1c')][_0x1b92('0x1a')]);}})['catch'](function(_0x4024bf){logger[_0x1b92('0x18')](_0x1b92('0x14'),_0x31e314,_0x4024bf);_0x146d68(_0x4024bf);});});}