Built motion from commit bab6f49e.|2.6.17
[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 _0x1ac3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x1ac3,0x1db));var _0x31ac=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x1ac3[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x31ac('0x0'));var util=require(_0x31ac('0x1'));var moment=require(_0x31ac('0x2'));var BPromise=require(_0x31ac('0x3'));var rs=require(_0x31ac('0x4'));var fs=require('fs');var Redis=require(_0x31ac('0x5'));var db=require(_0x31ac('0x6'))['db'];var utils=require(_0x31ac('0x7'));var logger=require(_0x31ac('0x8'))(_0x31ac('0x9'));var config=require(_0x31ac('0xa'));var jayson=require(_0x31ac('0xb'));var client=jayson[_0x31ac('0xc')][_0x31ac('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x15024d,_0x4201d6,_0x43fa1c){return new BPromise(function(_0x4eff5e,_0x29458b){return client[_0x31ac('0xe')](_0x15024d,_0x43fa1c)[_0x31ac('0xf')](function(_0x170c31){logger['info'](_0x31ac('0x10'),_0x4201d6,_0x31ac('0x11'));logger['debug'](_0x31ac('0x12'),_0x4201d6,_0x31ac('0x11'),JSON[_0x31ac('0x13')](_0x170c31));if(_0x170c31[_0x31ac('0x14')]){if(_0x170c31[_0x31ac('0x14')][_0x31ac('0x15')]===0x1f4){logger['error'](_0x31ac('0x10'),_0x4201d6,_0x170c31[_0x31ac('0x14')]['message']);return _0x29458b(_0x170c31[_0x31ac('0x14')][_0x31ac('0x16')]);}logger[_0x31ac('0x14')]('SquareRecording,\x20%s,\x20%s',_0x4201d6,_0x170c31[_0x31ac('0x14')][_0x31ac('0x16')]);return _0x4eff5e(_0x170c31[_0x31ac('0x14')]['message']);}else{logger[_0x31ac('0x17')](_0x31ac('0x10'),_0x4201d6,_0x31ac('0x11'));_0x4eff5e(_0x170c31[_0x31ac('0x18')][_0x31ac('0x16')]);}})[_0x31ac('0x19')](function(_0x49782d){logger[_0x31ac('0x14')](_0x31ac('0x10'),_0x4201d6,_0x49782d);_0x29458b(_0x49782d);});});}exports[_0x31ac('0x1a')]=function(_0x1b7093){var _0x160b1b=this;return new Promise(function(_0xeab2e8,_0x5bab06){return db[_0x31ac('0x1b')][_0x31ac('0x1c')](_0x1b7093[_0x31ac('0x1d')],{'raw':_0x1b7093[_0x31ac('0x1e')]?_0x1b7093['options'][_0x31ac('0x1f')]===undefined?!![]:![]:!![]})[_0x31ac('0xf')](function(_0x19b91f){logger['info'](_0x31ac('0x1a'),_0x1b7093);logger['debug'](_0x31ac('0x1a'),_0x1b7093,JSON['stringify'](_0x19b91f));_0xeab2e8(_0x19b91f);})['catch'](function(_0xd6184e){logger[_0x31ac('0x14')](_0x31ac('0x1a'),_0xd6184e[_0x31ac('0x16')],_0x1b7093);_0x5bab06(_0x160b1b[_0x31ac('0x14')](0x1f4,_0xd6184e[_0x31ac('0x16')]));});});};