Built motion from commit 85328c08.|2.5.50
[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 _0xd30a=['catch','CreateSquareRecording','SquareRecording','body','options','raw','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0xd30a,0x19d));var _0xad30=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xd30a[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xad30('0x0'));var util=require('util');var moment=require(_0xad30('0x1'));var BPromise=require(_0xad30('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad30('0x3'));var db=require(_0xad30('0x4'))['db'];var utils=require(_0xad30('0x5'));var logger=require(_0xad30('0x6'))(_0xad30('0x7'));var config=require(_0xad30('0x8'));var jayson=require(_0xad30('0x9'));var client=jayson[_0xad30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc0,_0x2e99d4,_0x1493da){return new BPromise(function(_0x20ac8b,_0x53e6fe){return client[_0xad30('0xb')](_0x3dc0,_0x1493da)[_0xad30('0xc')](function(_0x384583){logger['info'](_0xad30('0xd'),_0x2e99d4,_0xad30('0xe'));logger['debug'](_0xad30('0xf'),_0x2e99d4,_0xad30('0xe'),JSON[_0xad30('0x10')](_0x384583));if(_0x384583[_0xad30('0x11')]){if(_0x384583[_0xad30('0x11')][_0xad30('0x12')]===0x1f4){logger[_0xad30('0x11')](_0xad30('0xd'),_0x2e99d4,_0x384583[_0xad30('0x11')][_0xad30('0x13')]);return _0x53e6fe(_0x384583['error'][_0xad30('0x13')]);}logger[_0xad30('0x11')]('SquareRecording,\x20%s,\x20%s',_0x2e99d4,_0x384583[_0xad30('0x11')][_0xad30('0x13')]);return _0x20ac8b(_0x384583[_0xad30('0x11')]['message']);}else{logger[_0xad30('0x14')](_0xad30('0xd'),_0x2e99d4,_0xad30('0xe'));_0x20ac8b(_0x384583[_0xad30('0x15')][_0xad30('0x13')]);}})[_0xad30('0x16')](function(_0x2a6d9c){logger[_0xad30('0x11')](_0xad30('0xd'),_0x2e99d4,_0x2a6d9c);_0x53e6fe(_0x2a6d9c);});});}exports[_0xad30('0x17')]=function(_0x19a0cc){var _0x16cb53=this;return new Promise(function(_0x842841,_0x5068eb){return db[_0xad30('0x18')]['create'](_0x19a0cc[_0xad30('0x19')],{'raw':_0x19a0cc[_0xad30('0x1a')]?_0x19a0cc['options'][_0xad30('0x1b')]===undefined?!![]:![]:!![]})[_0xad30('0xc')](function(_0x312704){logger[_0xad30('0x14')]('CreateSquareRecording',_0x19a0cc);logger[_0xad30('0x1c')](_0xad30('0x17'),_0x19a0cc,JSON[_0xad30('0x10')](_0x312704));_0x842841(_0x312704);})[_0xad30('0x16')](function(_0x12ec56){logger['error'](_0xad30('0x17'),_0x12ec56[_0xad30('0x13')],_0x19a0cc);_0x5068eb(_0x16cb53[_0xad30('0x11')](0x1f4,_0x12ec56[_0xad30('0x13')]));});});};