Built motion from commit (unavailable).|2.4.18
[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 _0x9e84=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x47d493,_0x3bedfb){var _0x50242a=function(_0x473bd6){while(--_0x473bd6){_0x47d493['push'](_0x47d493['shift']());}};_0x50242a(++_0x3bedfb);}(_0x9e84,0x1ce));var _0x49e8=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0x9e84[_0x26fc81];return _0x9feece;};'use strict';var _=require(_0x49e8('0x0'));var util=require(_0x49e8('0x1'));var moment=require(_0x49e8('0x2'));var BPromise=require(_0x49e8('0x3'));var rs=require(_0x49e8('0x4'));var fs=require('fs');var Redis=require(_0x49e8('0x5'));var db=require(_0x49e8('0x6'))['db'];var utils=require(_0x49e8('0x7'));var logger=require(_0x49e8('0x8'))(_0x49e8('0x9'));var config=require(_0x49e8('0xa'));var jayson=require(_0x49e8('0xb'));var client=jayson['client'][_0x49e8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2de9ea,_0x5d5321,_0x43dc42){return new BPromise(function(_0x75124b,_0x133c21){return client['request'](_0x2de9ea,_0x43dc42)[_0x49e8('0xd')](function(_0x1a38bf){logger[_0x49e8('0xe')](_0x49e8('0xf'),_0x5d5321,_0x49e8('0x10'));logger[_0x49e8('0x11')]('Cdr,\x20%s,\x20%s,\x20%s',_0x5d5321,_0x49e8('0x10'),JSON[_0x49e8('0x12')](_0x1a38bf));if(_0x1a38bf[_0x49e8('0x13')]){if(_0x1a38bf[_0x49e8('0x13')]['code']===0x1f4){logger[_0x49e8('0x13')](_0x49e8('0xf'),_0x5d5321,_0x1a38bf[_0x49e8('0x13')]['message']);return _0x133c21(_0x1a38bf[_0x49e8('0x13')]['message']);}logger[_0x49e8('0x13')](_0x49e8('0xf'),_0x5d5321,_0x1a38bf[_0x49e8('0x13')][_0x49e8('0x14')]);return _0x75124b(_0x1a38bf[_0x49e8('0x13')]['message']);}else{logger[_0x49e8('0xe')](_0x49e8('0xf'),_0x5d5321,'request\x20sent');_0x75124b(_0x1a38bf[_0x49e8('0x15')]['message']);}})[_0x49e8('0x16')](function(_0x5ca275){logger[_0x49e8('0x13')](_0x49e8('0xf'),_0x5d5321,_0x5ca275);_0x133c21(_0x5ca275);});});}