Built motion from commit (unavailable).|2.5.5
[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 _0xc4de=['jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','SquareRecording','body','options','raw','then','CreateSquareRecording','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x400959,_0xeaac15){var _0x10ff05=function(_0x5471ab){while(--_0x5471ab){_0x400959['push'](_0x400959['shift']());}};_0x10ff05(++_0xeaac15);}(_0xc4de,0x1a7));var _0xec4d=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xc4de[_0x381589];return _0x2a075d;};'use strict';var _=require(_0xec4d('0x0'));var util=require(_0xec4d('0x1'));var moment=require(_0xec4d('0x2'));var BPromise=require(_0xec4d('0x3'));var rs=require(_0xec4d('0x4'));var fs=require('fs');var Redis=require(_0xec4d('0x5'));var db=require(_0xec4d('0x6'))['db'];var utils=require(_0xec4d('0x7'));var logger=require(_0xec4d('0x8'))(_0xec4d('0x9'));var config=require(_0xec4d('0xa'));var jayson=require(_0xec4d('0xb'));var client=jayson[_0xec4d('0xc')][_0xec4d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x396035,_0x187b47,_0x3c010c){return new BPromise(function(_0x2a7a2f,_0x15c04b){return client[_0xec4d('0xe')](_0x396035,_0x3c010c)['then'](function(_0x39bd17){logger[_0xec4d('0xf')](_0xec4d('0x10'),_0x187b47,'request\x20sent');logger[_0xec4d('0x11')](_0xec4d('0x12'),_0x187b47,'request\x20sent',JSON['stringify'](_0x39bd17));if(_0x39bd17[_0xec4d('0x13')]){if(_0x39bd17[_0xec4d('0x13')]['code']===0x1f4){logger[_0xec4d('0x13')](_0xec4d('0x10'),_0x187b47,_0x39bd17[_0xec4d('0x13')][_0xec4d('0x14')]);return _0x15c04b(_0x39bd17['error'][_0xec4d('0x14')]);}logger[_0xec4d('0x13')](_0xec4d('0x10'),_0x187b47,_0x39bd17[_0xec4d('0x13')][_0xec4d('0x14')]);return _0x2a7a2f(_0x39bd17[_0xec4d('0x13')][_0xec4d('0x14')]);}else{logger[_0xec4d('0xf')](_0xec4d('0x10'),_0x187b47,_0xec4d('0x15'));_0x2a7a2f(_0x39bd17[_0xec4d('0x16')][_0xec4d('0x14')]);}})[_0xec4d('0x17')](function(_0x364073){logger[_0xec4d('0x13')](_0xec4d('0x10'),_0x187b47,_0x364073);_0x15c04b(_0x364073);});});}exports['CreateSquareRecording']=function(_0x2c1c0d){var _0x49e6d9=this;return new Promise(function(_0x5ab074,_0x1ae7ae){return db[_0xec4d('0x18')]['create'](_0x2c1c0d[_0xec4d('0x19')],{'raw':_0x2c1c0d[_0xec4d('0x1a')]?_0x2c1c0d[_0xec4d('0x1a')][_0xec4d('0x1b')]===undefined?!![]:![]:!![]})[_0xec4d('0x1c')](function(_0x562377){logger[_0xec4d('0xf')](_0xec4d('0x1d'),_0x2c1c0d);logger['debug']('CreateSquareRecording',_0x2c1c0d,JSON[_0xec4d('0x1e')](_0x562377));_0x5ab074(_0x562377);})[_0xec4d('0x17')](function(_0x53f29b){logger[_0xec4d('0x13')]('CreateSquareRecording',_0x53f29b['message'],_0x2c1c0d);_0x1ae7ae(_0x49e6d9[_0xec4d('0x13')](0x1f4,_0x53f29b[_0xec4d('0x14')]));});});};