Built motion from commit d5e4af8c.|2.6.23
[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 _0x0dce=['request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xc75912,_0x2bbbe){var _0x17fbe2=function(_0x37607d){while(--_0x37607d){_0xc75912['push'](_0xc75912['shift']());}};_0x17fbe2(++_0x2bbbe);}(_0x0dce,0x154));var _0xe0dc=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x0dce[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xe0dc('0x0'));var util=require(_0xe0dc('0x1'));var moment=require(_0xe0dc('0x2'));var BPromise=require(_0xe0dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0dc('0x4'))['db'];var utils=require(_0xe0dc('0x5'));var logger=require(_0xe0dc('0x6'))(_0xe0dc('0x7'));var config=require(_0xe0dc('0x8'));var jayson=require(_0xe0dc('0x9'));var client=jayson[_0xe0dc('0xa')][_0xe0dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43857a,_0x50884e,_0x147b56){return new BPromise(function(_0xb7d8fb,_0x887aeb){return client['request'](_0x43857a,_0x147b56)['then'](function(_0x5ba68a){logger['info']('Cdr,\x20%s,\x20%s',_0x50884e,_0xe0dc('0xc'));logger['debug'](_0xe0dc('0xd'),_0x50884e,_0xe0dc('0xc'),JSON[_0xe0dc('0xe')](_0x5ba68a));if(_0x5ba68a[_0xe0dc('0xf')]){if(_0x5ba68a[_0xe0dc('0xf')][_0xe0dc('0x10')]===0x1f4){logger[_0xe0dc('0xf')](_0xe0dc('0x11'),_0x50884e,_0x5ba68a['error']['message']);return _0x887aeb(_0x5ba68a[_0xe0dc('0xf')][_0xe0dc('0x12')]);}logger[_0xe0dc('0xf')]('Cdr,\x20%s,\x20%s',_0x50884e,_0x5ba68a[_0xe0dc('0xf')]['message']);return _0xb7d8fb(_0x5ba68a['error']['message']);}else{logger[_0xe0dc('0x13')]('Cdr,\x20%s,\x20%s',_0x50884e,_0xe0dc('0xc'));_0xb7d8fb(_0x5ba68a[_0xe0dc('0x14')][_0xe0dc('0x12')]);}})[_0xe0dc('0x15')](function(_0x6da21a){logger[_0xe0dc('0xf')](_0xe0dc('0x11'),_0x50884e,_0x6da21a);_0x887aeb(_0x6da21a);});});}