Built motion from commit (unavailable).|2.5.24
[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 _0x2683=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','debug','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2683,0x1e9));var _0x3268=function(_0xbf09ab,_0x251a19){_0xbf09ab=_0xbf09ab-0x0;var _0x2a9aef=_0x2683[_0xbf09ab];return _0x2a9aef;};'use strict';var _=require(_0x3268('0x0'));var util=require(_0x3268('0x1'));var moment=require(_0x3268('0x2'));var BPromise=require('bluebird');var rs=require(_0x3268('0x3'));var fs=require('fs');var Redis=require(_0x3268('0x4'));var db=require(_0x3268('0x5'))['db'];var utils=require(_0x3268('0x6'));var logger=require(_0x3268('0x7'))(_0x3268('0x8'));var config=require(_0x3268('0x9'));var jayson=require(_0x3268('0xa'));var client=jayson[_0x3268('0xb')][_0x3268('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f7855,_0x273f06,_0x29cb2c){return new BPromise(function(_0x317e04,_0x422e07){return client[_0x3268('0xd')](_0x3f7855,_0x29cb2c)[_0x3268('0xe')](function(_0x128706){logger[_0x3268('0xf')](_0x3268('0x10'),_0x273f06,_0x3268('0x11'));logger['debug'](_0x3268('0x12'),_0x273f06,'request\x20sent',JSON['stringify'](_0x128706));if(_0x128706[_0x3268('0x13')]){if(_0x128706[_0x3268('0x13')][_0x3268('0x14')]===0x1f4){logger['error'](_0x3268('0x10'),_0x273f06,_0x128706['error'][_0x3268('0x15')]);return _0x422e07(_0x128706[_0x3268('0x13')][_0x3268('0x15')]);}logger['error'](_0x3268('0x10'),_0x273f06,_0x128706['error'][_0x3268('0x15')]);return _0x317e04(_0x128706[_0x3268('0x13')]['message']);}else{logger[_0x3268('0xf')](_0x3268('0x10'),_0x273f06,_0x3268('0x11'));_0x317e04(_0x128706[_0x3268('0x16')][_0x3268('0x15')]);}})[_0x3268('0x17')](function(_0x23f4ac){logger[_0x3268('0x13')]('SquareRecording,\x20%s,\x20%s',_0x273f06,_0x23f4ac);_0x422e07(_0x23f4ac);});});}exports[_0x3268('0x18')]=function(_0x43b804){var _0x50a73b=this;return new Promise(function(_0x2e44af,_0x29b5ff){return db[_0x3268('0x19')][_0x3268('0x1a')](_0x43b804['body'],{'raw':_0x43b804[_0x3268('0x1b')]?_0x43b804['options'][_0x3268('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x599864){logger['info'](_0x3268('0x18'),_0x43b804);logger[_0x3268('0x1d')](_0x3268('0x18'),_0x43b804,JSON[_0x3268('0x1e')](_0x599864));_0x2e44af(_0x599864);})[_0x3268('0x17')](function(_0x1f5b34){logger[_0x3268('0x13')](_0x3268('0x18'),_0x1f5b34[_0x3268('0x15')],_0x43b804);_0x29b5ff(_0x50a73b[_0x3268('0x13')](0x1f4,_0x1f5b34[_0x3268('0x15')]));});});};