c965f42fa1a2073afa8dd68ee6b061d63bb3148e
[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 _0xc64e=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareRecording','SquareRecording','create','options','raw','catch','lodash','moment'];(function(_0x1d0a1e,_0x267df2){var _0x23e5f1=function(_0xeb6eae){while(--_0xeb6eae){_0x1d0a1e['push'](_0x1d0a1e['shift']());}};_0x23e5f1(++_0x267df2);}(_0xc64e,0xf1));var _0xec64=function(_0x357c3d,_0x4eb6ad){_0x357c3d=_0x357c3d-0x0;var _0x258c36=_0xc64e[_0x357c3d];return _0x258c36;};'use strict';var _=require(_0xec64('0x0'));var util=require('util');var moment=require(_0xec64('0x1'));var BPromise=require(_0xec64('0x2'));var rs=require(_0xec64('0x3'));var fs=require('fs');var Redis=require(_0xec64('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec64('0x5'));var logger=require(_0xec64('0x6'))(_0xec64('0x7'));var config=require('../../config/environment');var jayson=require(_0xec64('0x8'));var client=jayson['client'][_0xec64('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x186417,_0x396e29,_0x3cc372){return new BPromise(function(_0x338860,_0x4a3b94){return client[_0xec64('0xa')](_0x186417,_0x3cc372)[_0xec64('0xb')](function(_0x5704a5){logger[_0xec64('0xc')](_0xec64('0xd'),_0x396e29,_0xec64('0xe'));logger[_0xec64('0xf')](_0xec64('0x10'),_0x396e29,_0xec64('0xe'),JSON['stringify'](_0x5704a5));if(_0x5704a5[_0xec64('0x11')]){if(_0x5704a5['error'][_0xec64('0x12')]===0x1f4){logger[_0xec64('0x11')]('SquareRecording,\x20%s,\x20%s',_0x396e29,_0x5704a5[_0xec64('0x11')][_0xec64('0x13')]);return _0x4a3b94(_0x5704a5[_0xec64('0x11')]['message']);}logger[_0xec64('0x11')](_0xec64('0xd'),_0x396e29,_0x5704a5['error'][_0xec64('0x13')]);return _0x338860(_0x5704a5[_0xec64('0x11')][_0xec64('0x13')]);}else{logger[_0xec64('0xc')](_0xec64('0xd'),_0x396e29,_0xec64('0xe'));_0x338860(_0x5704a5[_0xec64('0x14')][_0xec64('0x13')]);}})['catch'](function(_0x492233){logger['error']('SquareRecording,\x20%s,\x20%s',_0x396e29,_0x492233);_0x4a3b94(_0x492233);});});}exports[_0xec64('0x15')]=function(_0x5b1f30){var _0x4d070c=this;return new Promise(function(_0x310b30,_0x39668d){return db[_0xec64('0x16')][_0xec64('0x17')](_0x5b1f30['body'],{'raw':_0x5b1f30[_0xec64('0x18')]?_0x5b1f30['options'][_0xec64('0x19')]===undefined?!![]:![]:!![]})[_0xec64('0xb')](function(_0xf99ec3){logger['info'](_0xec64('0x15'),_0x5b1f30);logger[_0xec64('0xf')](_0xec64('0x15'),_0x5b1f30,JSON['stringify'](_0xf99ec3));_0x310b30(_0xf99ec3);})[_0xec64('0x1a')](function(_0x12465f){logger[_0xec64('0x11')]('CreateSquareRecording',_0x12465f[_0xec64('0x13')],_0x5b1f30);_0x39668d(_0x4d070c['error'](0x1f4,_0x12465f[_0xec64('0x13')]));});});};