Built motion from commit 3d6333b4.|2.6.31
[motion2.git] / server / api / squareRecording / squareRecording.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 _0x517a=['result','catch','CreateSquareRecording','SquareRecording','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x517a,0x83));var _0xa517=function(_0x20f149,_0x5b2af9){_0x20f149=_0x20f149-0x0;var _0x2510a6=_0x517a[_0x20f149];return _0x2510a6;};'use strict';var _=require(_0xa517('0x0'));var util=require(_0xa517('0x1'));var moment=require(_0xa517('0x2'));var BPromise=require(_0xa517('0x3'));var rs=require(_0xa517('0x4'));var fs=require('fs');var Redis=require(_0xa517('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa517('0x6'));var config=require('../../config/environment');var jayson=require(_0xa517('0x7'));var client=jayson[_0xa517('0x8')][_0xa517('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30111d,_0x2faa09,_0x86f65e){return new BPromise(function(_0x3fd285,_0x59250a){return client['request'](_0x30111d,_0x86f65e)[_0xa517('0xa')](function(_0x189676){logger[_0xa517('0xb')](_0xa517('0xc'),_0x2faa09,_0xa517('0xd'));logger['debug'](_0xa517('0xe'),_0x2faa09,_0xa517('0xd'),JSON[_0xa517('0xf')](_0x189676));if(_0x189676[_0xa517('0x10')]){if(_0x189676[_0xa517('0x10')][_0xa517('0x11')]===0x1f4){logger[_0xa517('0x10')]('SquareRecording,\x20%s,\x20%s',_0x2faa09,_0x189676[_0xa517('0x10')][_0xa517('0x12')]);return _0x59250a(_0x189676[_0xa517('0x10')][_0xa517('0x12')]);}logger['error'](_0xa517('0xc'),_0x2faa09,_0x189676[_0xa517('0x10')][_0xa517('0x12')]);return _0x3fd285(_0x189676[_0xa517('0x10')][_0xa517('0x12')]);}else{logger[_0xa517('0xb')]('SquareRecording,\x20%s,\x20%s',_0x2faa09,_0xa517('0xd'));_0x3fd285(_0x189676[_0xa517('0x13')][_0xa517('0x12')]);}})[_0xa517('0x14')](function(_0x37c0f0){logger[_0xa517('0x10')]('SquareRecording,\x20%s,\x20%s',_0x2faa09,_0x37c0f0);_0x59250a(_0x37c0f0);});});}exports[_0xa517('0x15')]=function(_0x238bd3){var _0x1f9885=this;return new Promise(function(_0x59be4d,_0x435bd7){return db[_0xa517('0x16')]['create'](_0x238bd3['body'],{'raw':_0x238bd3[_0xa517('0x17')]?_0x238bd3[_0xa517('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xa517('0xa')](function(_0x597b07){logger[_0xa517('0xb')](_0xa517('0x15'),_0x238bd3);logger[_0xa517('0x18')](_0xa517('0x15'),_0x238bd3,JSON[_0xa517('0xf')](_0x597b07));_0x59be4d(_0x597b07);})['catch'](function(_0x333231){logger['error'](_0xa517('0x15'),_0x333231[_0xa517('0x12')],_0x238bd3);_0x435bd7(_0x1f9885['error'](0x1f4,_0x333231['message']));});});};