Built motion from commit (unavailable).|2.5.4
[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 _0x31f3=['error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x6f116f,_0x48c8bd){var _0x120342=function(_0xa8e20a){while(--_0xa8e20a){_0x6f116f['push'](_0x6f116f['shift']());}};_0x120342(++_0x48c8bd);}(_0x31f3,0x190));var _0x331f=function(_0x2a71d2,_0x35bcda){_0x2a71d2=_0x2a71d2-0x0;var _0x200112=_0x31f3[_0x2a71d2];return _0x200112;};'use strict';var _=require(_0x331f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x331f('0x1'));var db=require(_0x331f('0x2'))['db'];var utils=require(_0x331f('0x3'));var logger=require(_0x331f('0x4'))(_0x331f('0x5'));var config=require(_0x331f('0x6'));var jayson=require(_0x331f('0x7'));var client=jayson['client'][_0x331f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfe1213,_0x56de52,_0x397094){return new BPromise(function(_0x28a775,_0x2bd495){return client['request'](_0xfe1213,_0x397094)[_0x331f('0x9')](function(_0x36073c){logger[_0x331f('0xa')](_0x331f('0xb'),_0x56de52,_0x331f('0xc'));logger[_0x331f('0xd')](_0x331f('0xe'),_0x56de52,'request\x20sent',JSON[_0x331f('0xf')](_0x36073c));if(_0x36073c[_0x331f('0x10')]){if(_0x36073c[_0x331f('0x10')][_0x331f('0x11')]===0x1f4){logger[_0x331f('0x10')]('SquareRecording,\x20%s,\x20%s',_0x56de52,_0x36073c[_0x331f('0x10')]['message']);return _0x2bd495(_0x36073c[_0x331f('0x10')][_0x331f('0x12')]);}logger[_0x331f('0x10')]('SquareRecording,\x20%s,\x20%s',_0x56de52,_0x36073c[_0x331f('0x10')][_0x331f('0x12')]);return _0x28a775(_0x36073c[_0x331f('0x10')][_0x331f('0x12')]);}else{logger['info'](_0x331f('0xb'),_0x56de52,_0x331f('0xc'));_0x28a775(_0x36073c[_0x331f('0x13')][_0x331f('0x12')]);}})[_0x331f('0x14')](function(_0x2e363d){logger[_0x331f('0x10')](_0x331f('0xb'),_0x56de52,_0x2e363d);_0x2bd495(_0x2e363d);});});}exports[_0x331f('0x15')]=function(_0x268a7b){var _0x1a9af3=this;return new Promise(function(_0x2108c0,_0x54e267){return db[_0x331f('0x16')][_0x331f('0x17')](_0x268a7b['body'],{'raw':_0x268a7b[_0x331f('0x18')]?_0x268a7b[_0x331f('0x18')][_0x331f('0x19')]===undefined?!![]:![]:!![]})[_0x331f('0x9')](function(_0x3489aa){logger[_0x331f('0xa')]('CreateSquareRecording',_0x268a7b);logger['debug'](_0x331f('0x15'),_0x268a7b,JSON[_0x331f('0xf')](_0x3489aa));_0x2108c0(_0x3489aa);})[_0x331f('0x14')](function(_0x41beb1){logger[_0x331f('0x10')](_0x331f('0x15'),_0x41beb1[_0x331f('0x12')],_0x268a7b);_0x54e267(_0x1a9af3['error'](0x1f4,_0x41beb1['message']));});});};