1e05f3bfe8cb371677aa088315c17337c348b7ca
[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 _0x701a=['../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','options','raw','lodash','ioredis','../../config/utils','../../config/logger'];(function(_0x280c03,_0x5ba994){var _0x5e271e=function(_0x2fbc31){while(--_0x2fbc31){_0x280c03['push'](_0x280c03['shift']());}};_0x5e271e(++_0x5ba994);}(_0x701a,0x8c));var _0xa701=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0x701a[_0x567bcb];return _0x4eebc2;};'use strict';var _=require(_0xa701('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa701('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xa701('0x2'));var logger=require(_0xa701('0x3'))('rpc');var config=require(_0xa701('0x4'));var jayson=require(_0xa701('0x5'));var client=jayson[_0xa701('0x6')][_0xa701('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11ca2a,_0x190bbb,_0x37e3d7){return new BPromise(function(_0x3bb223,_0x532f27){return client[_0xa701('0x8')](_0x11ca2a,_0x37e3d7)[_0xa701('0x9')](function(_0x3492dc){logger[_0xa701('0xa')](_0xa701('0xb'),_0x190bbb,_0xa701('0xc'));logger[_0xa701('0xd')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x190bbb,_0xa701('0xc'),JSON[_0xa701('0xe')](_0x3492dc));if(_0x3492dc[_0xa701('0xf')]){if(_0x3492dc[_0xa701('0xf')][_0xa701('0x10')]===0x1f4){logger[_0xa701('0xf')](_0xa701('0xb'),_0x190bbb,_0x3492dc['error'][_0xa701('0x11')]);return _0x532f27(_0x3492dc[_0xa701('0xf')][_0xa701('0x11')]);}logger[_0xa701('0xf')]('SquareRecording,\x20%s,\x20%s',_0x190bbb,_0x3492dc[_0xa701('0xf')][_0xa701('0x11')]);return _0x3bb223(_0x3492dc[_0xa701('0xf')]['message']);}else{logger[_0xa701('0xa')](_0xa701('0xb'),_0x190bbb,'request\x20sent');_0x3bb223(_0x3492dc[_0xa701('0x12')][_0xa701('0x11')]);}})[_0xa701('0x13')](function(_0x3f6ad5){logger[_0xa701('0xf')](_0xa701('0xb'),_0x190bbb,_0x3f6ad5);_0x532f27(_0x3f6ad5);});});}exports[_0xa701('0x14')]=function(_0x38ab62){var _0x48a8be=this;return new Promise(function(_0x3fa22f,_0x866efd){return db[_0xa701('0x15')]['create'](_0x38ab62['body'],{'raw':_0x38ab62[_0xa701('0x16')]?_0x38ab62[_0xa701('0x16')][_0xa701('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x569c3c){logger[_0xa701('0xa')]('CreateSquareRecording',_0x38ab62);logger['debug']('CreateSquareRecording',_0x38ab62,JSON['stringify'](_0x569c3c));_0x3fa22f(_0x569c3c);})[_0xa701('0x13')](function(_0x29e9f5){logger[_0xa701('0xf')](_0xa701('0x14'),_0x29e9f5[_0xa701('0x11')],_0x38ab62);_0x866efd(_0x48a8be[_0xa701('0xf')](0x1f4,_0x29e9f5[_0xa701('0x11')]));});});};