Built motion from commit 7a4eb044.|2.5.36
[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 _0x905b=['stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0x905b,0x80));var _0xb905=function(_0x6eb857,_0x573b1a){_0x6eb857=_0x6eb857-0x0;var _0x5c7aea=_0x905b[_0x6eb857];return _0x5c7aea;};'use strict';var _=require(_0xb905('0x0'));var util=require(_0xb905('0x1'));var moment=require('moment');var BPromise=require(_0xb905('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb905('0x3'));var db=require(_0xb905('0x4'))['db'];var utils=require(_0xb905('0x5'));var logger=require(_0xb905('0x6'))(_0xb905('0x7'));var config=require('../../config/environment');var jayson=require(_0xb905('0x8'));var client=jayson[_0xb905('0x9')][_0xb905('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a1318,_0x49bd9f,_0x35bc6e){return new BPromise(function(_0x27ef30,_0x51c771){return client['request'](_0x2a1318,_0x35bc6e)[_0xb905('0xb')](function(_0x7ff940){logger[_0xb905('0xc')](_0xb905('0xd'),_0x49bd9f,_0xb905('0xe'));logger['debug'](_0xb905('0xf'),_0x49bd9f,'request\x20sent',JSON[_0xb905('0x10')](_0x7ff940));if(_0x7ff940['error']){if(_0x7ff940[_0xb905('0x11')][_0xb905('0x12')]===0x1f4){logger[_0xb905('0x11')]('SquareRecording,\x20%s,\x20%s',_0x49bd9f,_0x7ff940[_0xb905('0x11')][_0xb905('0x13')]);return _0x51c771(_0x7ff940[_0xb905('0x11')]['message']);}logger[_0xb905('0x11')](_0xb905('0xd'),_0x49bd9f,_0x7ff940['error'][_0xb905('0x13')]);return _0x27ef30(_0x7ff940[_0xb905('0x11')][_0xb905('0x13')]);}else{logger[_0xb905('0xc')](_0xb905('0xd'),_0x49bd9f,_0xb905('0xe'));_0x27ef30(_0x7ff940[_0xb905('0x14')][_0xb905('0x13')]);}})[_0xb905('0x15')](function(_0x324602){logger[_0xb905('0x11')](_0xb905('0xd'),_0x49bd9f,_0x324602);_0x51c771(_0x324602);});});}exports[_0xb905('0x16')]=function(_0x236d46){var _0x417df8=this;return new Promise(function(_0x457865,_0x3d761a){return db[_0xb905('0x17')]['create'](_0x236d46['body'],{'raw':_0x236d46['options']?_0x236d46['options']['raw']===undefined?!![]:![]:!![]})[_0xb905('0xb')](function(_0x198404){logger[_0xb905('0xc')](_0xb905('0x16'),_0x236d46);logger['debug']('CreateSquareRecording',_0x236d46,JSON['stringify'](_0x198404));_0x457865(_0x198404);})[_0xb905('0x15')](function(_0x471511){logger['error']('CreateSquareRecording',_0x471511[_0xb905('0x13')],_0x236d46);_0x3d761a(_0x417df8['error'](0x1f4,_0x471511[_0xb905('0x13')]));});});};