Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / api / cdr / cdr.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 _0x7e60=['info','request\x20sent','debug','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x55e953,_0x51a078){var _0x497428=function(_0x5b02a6){while(--_0x5b02a6){_0x55e953['push'](_0x55e953['shift']());}};_0x497428(++_0x51a078);}(_0x7e60,0xa4));var _0x07e6=function(_0x31e961,_0x4b5ec9){_0x31e961=_0x31e961-0x0;var _0x24801e=_0x7e60[_0x31e961];return _0x24801e;};'use strict';var _=require(_0x07e6('0x0'));var util=require('util');var moment=require(_0x07e6('0x1'));var BPromise=require(_0x07e6('0x2'));var rs=require(_0x07e6('0x3'));var fs=require('fs');var Redis=require(_0x07e6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x07e6('0x5'))(_0x07e6('0x6'));var config=require(_0x07e6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x07e6('0x8')][_0x07e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc7e71b,_0x17aa26,_0x13b4bc){return new BPromise(function(_0x38ecef,_0x524634){return client[_0x07e6('0xa')](_0xc7e71b,_0x13b4bc)[_0x07e6('0xb')](function(_0x5ec0b6){logger[_0x07e6('0xc')]('Cdr,\x20%s,\x20%s',_0x17aa26,_0x07e6('0xd'));logger[_0x07e6('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x17aa26,_0x07e6('0xd'),JSON[_0x07e6('0xf')](_0x5ec0b6));if(_0x5ec0b6[_0x07e6('0x10')]){if(_0x5ec0b6[_0x07e6('0x10')][_0x07e6('0x11')]===0x1f4){logger[_0x07e6('0x10')](_0x07e6('0x12'),_0x17aa26,_0x5ec0b6[_0x07e6('0x10')][_0x07e6('0x13')]);return _0x524634(_0x5ec0b6[_0x07e6('0x10')][_0x07e6('0x13')]);}logger['error']('Cdr,\x20%s,\x20%s',_0x17aa26,_0x5ec0b6[_0x07e6('0x10')][_0x07e6('0x13')]);return _0x38ecef(_0x5ec0b6[_0x07e6('0x10')][_0x07e6('0x13')]);}else{logger['info'](_0x07e6('0x12'),_0x17aa26,'request\x20sent');_0x38ecef(_0x5ec0b6[_0x07e6('0x14')][_0x07e6('0x13')]);}})[_0x07e6('0x15')](function(_0x26d367){logger[_0x07e6('0x10')](_0x07e6('0x12'),_0x17aa26,_0x26d367);_0x524634(_0x26d367);});});}