Built motion from commit (unavailable).|2.5.4
[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 _0xc14e=['request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','SquareRecording','create','body','options','raw','then','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s'];(function(_0x3abcd8,_0x40a42e){var _0x394ec9=function(_0x577d7e){while(--_0x577d7e){_0x3abcd8['push'](_0x3abcd8['shift']());}};_0x394ec9(++_0x40a42e);}(_0xc14e,0xa5));var _0xec14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc14e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xec14('0x0'));var util=require(_0xec14('0x1'));var moment=require('moment');var BPromise=require(_0xec14('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec14('0x3'));var db=require(_0xec14('0x4'))['db'];var utils=require(_0xec14('0x5'));var logger=require(_0xec14('0x6'))(_0xec14('0x7'));var config=require(_0xec14('0x8'));var jayson=require(_0xec14('0x9'));var client=jayson[_0xec14('0xa')][_0xec14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x446472,_0x494c7e,_0x2c86ad){return new BPromise(function(_0x46113a,_0x4c34e7){return client[_0xec14('0xc')](_0x446472,_0x2c86ad)['then'](function(_0x21d042){logger[_0xec14('0xd')](_0xec14('0xe'),_0x494c7e,_0xec14('0xf'));logger['debug'](_0xec14('0x10'),_0x494c7e,_0xec14('0xf'),JSON[_0xec14('0x11')](_0x21d042));if(_0x21d042[_0xec14('0x12')]){if(_0x21d042[_0xec14('0x12')][_0xec14('0x13')]===0x1f4){logger[_0xec14('0x12')](_0xec14('0xe'),_0x494c7e,_0x21d042['error'][_0xec14('0x14')]);return _0x4c34e7(_0x21d042[_0xec14('0x12')][_0xec14('0x14')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x494c7e,_0x21d042[_0xec14('0x12')][_0xec14('0x14')]);return _0x46113a(_0x21d042[_0xec14('0x12')][_0xec14('0x14')]);}else{logger[_0xec14('0xd')]('SquareRecording,\x20%s,\x20%s',_0x494c7e,'request\x20sent');_0x46113a(_0x21d042[_0xec14('0x15')][_0xec14('0x14')]);}})['catch'](function(_0x408b32){logger[_0xec14('0x12')]('SquareRecording,\x20%s,\x20%s',_0x494c7e,_0x408b32);_0x4c34e7(_0x408b32);});});}exports[_0xec14('0x16')]=function(_0x2f1e13){var _0x483774=this;return new Promise(function(_0x56d36b,_0x42b373){return db[_0xec14('0x17')][_0xec14('0x18')](_0x2f1e13[_0xec14('0x19')],{'raw':_0x2f1e13[_0xec14('0x1a')]?_0x2f1e13[_0xec14('0x1a')][_0xec14('0x1b')]===undefined?!![]:![]:!![]})[_0xec14('0x1c')](function(_0x1321be){logger[_0xec14('0xd')](_0xec14('0x16'),_0x2f1e13);logger[_0xec14('0x1d')](_0xec14('0x16'),_0x2f1e13,JSON[_0xec14('0x11')](_0x1321be));_0x56d36b(_0x1321be);})['catch'](function(_0xc8fa56){logger[_0xec14('0x12')](_0xec14('0x16'),_0xc8fa56[_0xec14('0x14')],_0x2f1e13);_0x42b373(_0x483774[_0xec14('0x12')](0x1f4,_0xc8fa56[_0xec14('0x14')]));});});};