Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / cmCompany / cmCompany.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 _0xed76=['request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info'];(function(_0x36acb2,_0x12faaa){var _0x581204=function(_0x4ae944){while(--_0x4ae944){_0x36acb2['push'](_0x36acb2['shift']());}};_0x581204(++_0x12faaa);}(_0xed76,0x194));var _0x6ed7=function(_0x3c401a,_0x18e1ce){_0x3c401a=_0x3c401a-0x0;var _0x4f3f90=_0xed76[_0x3c401a];return _0x4f3f90;};'use strict';var _=require(_0x6ed7('0x0'));var util=require(_0x6ed7('0x1'));var moment=require(_0x6ed7('0x2'));var BPromise=require(_0x6ed7('0x3'));var rs=require(_0x6ed7('0x4'));var fs=require('fs');var Redis=require(_0x6ed7('0x5'));var db=require(_0x6ed7('0x6'))['db'];var utils=require(_0x6ed7('0x7'));var logger=require(_0x6ed7('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ed7('0x9'));var client=jayson[_0x6ed7('0xa')][_0x6ed7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x62df6c,_0x1f1190,_0x218fb3){return new BPromise(function(_0x34c132,_0x36e9dc){return client['request'](_0x62df6c,_0x218fb3)[_0x6ed7('0xc')](function(_0x136521){logger[_0x6ed7('0xd')]('CmCompany,\x20%s,\x20%s',_0x1f1190,_0x6ed7('0xe'));logger[_0x6ed7('0xf')](_0x6ed7('0x10'),_0x1f1190,_0x6ed7('0xe'),JSON['stringify'](_0x136521));if(_0x136521['error']){if(_0x136521[_0x6ed7('0x11')]['code']===0x1f4){logger[_0x6ed7('0x11')](_0x6ed7('0x12'),_0x1f1190,_0x136521[_0x6ed7('0x11')][_0x6ed7('0x13')]);return _0x36e9dc(_0x136521[_0x6ed7('0x11')][_0x6ed7('0x13')]);}logger['error'](_0x6ed7('0x12'),_0x1f1190,_0x136521[_0x6ed7('0x11')]['message']);return _0x34c132(_0x136521['error'][_0x6ed7('0x13')]);}else{logger['info'](_0x6ed7('0x12'),_0x1f1190,'request\x20sent');_0x34c132(_0x136521[_0x6ed7('0x14')]['message']);}})[_0x6ed7('0x15')](function(_0x5b69f7){logger[_0x6ed7('0x11')](_0x6ed7('0x12'),_0x1f1190,_0x5b69f7);_0x36e9dc(_0x5b69f7);});});}