Built motion from commit 3c2ce842.|2.6.31
[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 _0x7a35=['CreateSquareRecording','SquareRecording','body','options','raw','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a35,0x18e));var _0x57a3=function(_0x3600a9,_0x4a3cbb){_0x3600a9=_0x3600a9-0x0;var _0x4532fd=_0x7a35[_0x3600a9];return _0x4532fd;};'use strict';var _=require(_0x57a3('0x0'));var util=require('util');var moment=require(_0x57a3('0x1'));var BPromise=require(_0x57a3('0x2'));var rs=require(_0x57a3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x57a3('0x4'))['db'];var utils=require(_0x57a3('0x5'));var logger=require(_0x57a3('0x6'))('rpc');var config=require(_0x57a3('0x7'));var jayson=require(_0x57a3('0x8'));var client=jayson[_0x57a3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x172647,_0x5dcf8c,_0x3342eb){return new BPromise(function(_0x25f780,_0x7151eb){return client[_0x57a3('0xa')](_0x172647,_0x3342eb)[_0x57a3('0xb')](function(_0x2d9a9d){logger[_0x57a3('0xc')](_0x57a3('0xd'),_0x5dcf8c,_0x57a3('0xe'));logger[_0x57a3('0xf')](_0x57a3('0x10'),_0x5dcf8c,_0x57a3('0xe'),JSON['stringify'](_0x2d9a9d));if(_0x2d9a9d['error']){if(_0x2d9a9d[_0x57a3('0x11')][_0x57a3('0x12')]===0x1f4){logger[_0x57a3('0x11')]('SquareRecording,\x20%s,\x20%s',_0x5dcf8c,_0x2d9a9d[_0x57a3('0x11')][_0x57a3('0x13')]);return _0x7151eb(_0x2d9a9d['error'][_0x57a3('0x13')]);}logger['error'](_0x57a3('0xd'),_0x5dcf8c,_0x2d9a9d[_0x57a3('0x11')][_0x57a3('0x13')]);return _0x25f780(_0x2d9a9d[_0x57a3('0x11')][_0x57a3('0x13')]);}else{logger[_0x57a3('0xc')](_0x57a3('0xd'),_0x5dcf8c,_0x57a3('0xe'));_0x25f780(_0x2d9a9d[_0x57a3('0x14')]['message']);}})[_0x57a3('0x15')](function(_0x452594){logger[_0x57a3('0x11')](_0x57a3('0xd'),_0x5dcf8c,_0x452594);_0x7151eb(_0x452594);});});}exports[_0x57a3('0x16')]=function(_0x411c6d){var _0x540353=this;return new Promise(function(_0x385541,_0x271ed6){return db[_0x57a3('0x17')]['create'](_0x411c6d[_0x57a3('0x18')],{'raw':_0x411c6d[_0x57a3('0x19')]?_0x411c6d['options'][_0x57a3('0x1a')]===undefined?!![]:![]:!![]})[_0x57a3('0xb')](function(_0x4c4cdb){logger[_0x57a3('0xc')]('CreateSquareRecording',_0x411c6d);logger[_0x57a3('0xf')](_0x57a3('0x16'),_0x411c6d,JSON[_0x57a3('0x1b')](_0x4c4cdb));_0x385541(_0x4c4cdb);})['catch'](function(_0x24c1b7){logger['error'](_0x57a3('0x16'),_0x24c1b7['message'],_0x411c6d);_0x271ed6(_0x540353['error'](0x1f4,_0x24c1b7[_0x57a3('0x13')]));});});};