Built motion from commit (unavailable).|2.5.2
[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 _0x1c2b=['SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4d2842,_0x9fefa0){var _0x122e4f=function(_0x3bbf9f){while(--_0x3bbf9f){_0x4d2842['push'](_0x4d2842['shift']());}};_0x122e4f(++_0x9fefa0);}(_0x1c2b,0x191));var _0xb1c2=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x1c2b[_0x817d9b];return _0x2752e1;};'use strict';var _=require(_0xb1c2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb1c2('0x1'));var rs=require(_0xb1c2('0x2'));var fs=require('fs');var Redis=require(_0xb1c2('0x3'));var db=require(_0xb1c2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb1c2('0x5'));var config=require(_0xb1c2('0x6'));var jayson=require(_0xb1c2('0x7'));var client=jayson[_0xb1c2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33ae37,_0x212883,_0x186494){return new BPromise(function(_0x42a496,_0x5b4bf5){return client[_0xb1c2('0x9')](_0x33ae37,_0x186494)[_0xb1c2('0xa')](function(_0x5d6e59){logger[_0xb1c2('0xb')](_0xb1c2('0xc'),_0x212883,_0xb1c2('0xd'));logger[_0xb1c2('0xe')](_0xb1c2('0xf'),_0x212883,_0xb1c2('0xd'),JSON[_0xb1c2('0x10')](_0x5d6e59));if(_0x5d6e59[_0xb1c2('0x11')]){if(_0x5d6e59['error']['code']===0x1f4){logger[_0xb1c2('0x11')](_0xb1c2('0xc'),_0x212883,_0x5d6e59['error'][_0xb1c2('0x12')]);return _0x5b4bf5(_0x5d6e59[_0xb1c2('0x11')]['message']);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x212883,_0x5d6e59[_0xb1c2('0x11')][_0xb1c2('0x12')]);return _0x42a496(_0x5d6e59['error'][_0xb1c2('0x12')]);}else{logger['info'](_0xb1c2('0xc'),_0x212883,_0xb1c2('0xd'));_0x42a496(_0x5d6e59[_0xb1c2('0x13')]['message']);}})['catch'](function(_0x3efeb6){logger[_0xb1c2('0x11')]('SquareRecording,\x20%s,\x20%s',_0x212883,_0x3efeb6);_0x5b4bf5(_0x3efeb6);});});}exports[_0xb1c2('0x14')]=function(_0x4d5026){var _0x171a16=this;return new Promise(function(_0x6d37c4,_0x328f9f){return db[_0xb1c2('0x15')][_0xb1c2('0x16')](_0x4d5026[_0xb1c2('0x17')],{'raw':_0x4d5026['options']?_0x4d5026[_0xb1c2('0x18')][_0xb1c2('0x19')]===undefined?!![]:![]:!![]})[_0xb1c2('0xa')](function(_0x4c6057){logger[_0xb1c2('0xb')]('CreateSquareRecording',_0x4d5026);logger[_0xb1c2('0xe')](_0xb1c2('0x14'),_0x4d5026,JSON[_0xb1c2('0x10')](_0x4c6057));_0x6d37c4(_0x4c6057);})['catch'](function(_0xe91501){logger['error'](_0xb1c2('0x14'),_0xe91501['message'],_0x4d5026);_0x328f9f(_0x171a16['error'](0x1f4,_0xe91501[_0xb1c2('0x12')]));});});};