Built motion from commit f7863d46.|2.5.41
[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 _0x9ab0=['then','info','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareRecording','options','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xd8768,_0x3fedcb){var _0x46228f=function(_0x65a836){while(--_0x65a836){_0xd8768['push'](_0xd8768['shift']());}};_0x46228f(++_0x3fedcb);}(_0x9ab0,0xb5));var _0x09ab=function(_0x393f5f,_0x429a24){_0x393f5f=_0x393f5f-0x0;var _0x112f37=_0x9ab0[_0x393f5f];return _0x112f37;};'use strict';var _=require(_0x09ab('0x0'));var util=require('util');var moment=require(_0x09ab('0x1'));var BPromise=require(_0x09ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x09ab('0x3'));var db=require(_0x09ab('0x4'))['db'];var utils=require(_0x09ab('0x5'));var logger=require(_0x09ab('0x6'))(_0x09ab('0x7'));var config=require(_0x09ab('0x8'));var jayson=require(_0x09ab('0x9'));var client=jayson[_0x09ab('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e255,_0x1557fc,_0x5e911){return new BPromise(function(_0x1b9a3e,_0x5aac88){return client['request'](_0x56e255,_0x5e911)[_0x09ab('0xb')](function(_0x9215c){logger[_0x09ab('0xc')](_0x09ab('0xd'),_0x1557fc,'request\x20sent');logger['debug'](_0x09ab('0xe'),_0x1557fc,_0x09ab('0xf'),JSON['stringify'](_0x9215c));if(_0x9215c[_0x09ab('0x10')]){if(_0x9215c[_0x09ab('0x10')][_0x09ab('0x11')]===0x1f4){logger[_0x09ab('0x10')](_0x09ab('0xd'),_0x1557fc,_0x9215c[_0x09ab('0x10')][_0x09ab('0x12')]);return _0x5aac88(_0x9215c['error'][_0x09ab('0x12')]);}logger['error'](_0x09ab('0xd'),_0x1557fc,_0x9215c['error'][_0x09ab('0x12')]);return _0x1b9a3e(_0x9215c[_0x09ab('0x10')]['message']);}else{logger[_0x09ab('0xc')](_0x09ab('0xd'),_0x1557fc,_0x09ab('0xf'));_0x1b9a3e(_0x9215c[_0x09ab('0x13')][_0x09ab('0x12')]);}})[_0x09ab('0x14')](function(_0x4e3293){logger[_0x09ab('0x10')](_0x09ab('0xd'),_0x1557fc,_0x4e3293);_0x5aac88(_0x4e3293);});});}exports[_0x09ab('0x15')]=function(_0x52719e){var _0x22f25b=this;return new Promise(function(_0x3e9710,_0x4248bb){return db['SquareRecording']['create'](_0x52719e['body'],{'raw':_0x52719e[_0x09ab('0x16')]?_0x52719e[_0x09ab('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x11265f){logger[_0x09ab('0xc')](_0x09ab('0x15'),_0x52719e);logger[_0x09ab('0x17')]('CreateSquareRecording',_0x52719e,JSON['stringify'](_0x11265f));_0x3e9710(_0x11265f);})[_0x09ab('0x14')](function(_0x447a02){logger[_0x09ab('0x10')](_0x09ab('0x15'),_0x447a02[_0x09ab('0x12')],_0x52719e);_0x4248bb(_0x22f25b[_0x09ab('0x10')](0x1f4,_0x447a02[_0x09ab('0x12')]));});});};