Built motion from commit 932cf0d0.|2.5.42
[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 _0x1018=['../../config/logger','rpc','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','info','CreateSquareRecording','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1eb249,_0x30f50e){var _0x37def9=function(_0x23790f){while(--_0x23790f){_0x1eb249['push'](_0x1eb249['shift']());}};_0x37def9(++_0x30f50e);}(_0x1018,0x148));var _0x8101=function(_0x22c288,_0x2491c4){_0x22c288=_0x22c288-0x0;var _0x5950f0=_0x1018[_0x22c288];return _0x5950f0;};'use strict';var _=require(_0x8101('0x0'));var util=require(_0x8101('0x1'));var moment=require(_0x8101('0x2'));var BPromise=require(_0x8101('0x3'));var rs=require(_0x8101('0x4'));var fs=require('fs');var Redis=require(_0x8101('0x5'));var db=require(_0x8101('0x6'))['db'];var utils=require(_0x8101('0x7'));var logger=require(_0x8101('0x8'))(_0x8101('0x9'));var config=require('../../config/environment');var jayson=require(_0x8101('0xa'));var client=jayson[_0x8101('0xb')][_0x8101('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55bf39,_0x633fec,_0x3ea57d){return new BPromise(function(_0x3d730b,_0xda231e){return client[_0x8101('0xd')](_0x55bf39,_0x3ea57d)[_0x8101('0xe')](function(_0xbff937){logger['info'](_0x8101('0xf'),_0x633fec,_0x8101('0x10'));logger['debug'](_0x8101('0x11'),_0x633fec,_0x8101('0x10'),JSON[_0x8101('0x12')](_0xbff937));if(_0xbff937[_0x8101('0x13')]){if(_0xbff937[_0x8101('0x13')][_0x8101('0x14')]===0x1f4){logger[_0x8101('0x13')](_0x8101('0xf'),_0x633fec,_0xbff937[_0x8101('0x13')][_0x8101('0x15')]);return _0xda231e(_0xbff937[_0x8101('0x13')][_0x8101('0x15')]);}logger['error'](_0x8101('0xf'),_0x633fec,_0xbff937[_0x8101('0x13')]['message']);return _0x3d730b(_0xbff937[_0x8101('0x13')][_0x8101('0x15')]);}else{logger['info'](_0x8101('0xf'),_0x633fec,_0x8101('0x10'));_0x3d730b(_0xbff937[_0x8101('0x16')]['message']);}})['catch'](function(_0x4cf013){logger[_0x8101('0x13')](_0x8101('0xf'),_0x633fec,_0x4cf013);_0xda231e(_0x4cf013);});});}exports['CreateSquareRecording']=function(_0x3c7757){var _0x2ef277=this;return new Promise(function(_0x309b62,_0x408e80){return db['SquareRecording']['create'](_0x3c7757['body'],{'raw':_0x3c7757['options']?_0x3c7757[_0x8101('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x38d516){logger[_0x8101('0x18')](_0x8101('0x19'),_0x3c7757);logger[_0x8101('0x1a')](_0x8101('0x19'),_0x3c7757,JSON[_0x8101('0x12')](_0x38d516));_0x309b62(_0x38d516);})[_0x8101('0x1b')](function(_0x4742e8){logger['error'](_0x8101('0x19'),_0x4742e8[_0x8101('0x15')],_0x3c7757);_0x408e80(_0x2ef277[_0x8101('0x13')](0x1f4,_0x4742e8[_0x8101('0x15')]));});});};