Built motion from commit (unavailable).|2.4.18
[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 _0x62f2=['SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','SquareRecording','create','body','options','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x5d17d3,_0x5b664e){var _0x3456df=function(_0x337eaf){while(--_0x337eaf){_0x5d17d3['push'](_0x5d17d3['shift']());}};_0x3456df(++_0x5b664e);}(_0x62f2,0xcc));var _0x262f=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x62f2[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x262f('0x0'));var util=require(_0x262f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x262f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x262f('0x3'))['db'];var utils=require(_0x262f('0x4'));var logger=require(_0x262f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x262f('0x6'));var client=jayson[_0x262f('0x7')][_0x262f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x76d0a5,_0x5805a8,_0x1260f2){return new BPromise(function(_0x14ee0c,_0x57375c){return client[_0x262f('0x9')](_0x76d0a5,_0x1260f2)[_0x262f('0xa')](function(_0x3b416c){logger[_0x262f('0xb')](_0x262f('0xc'),_0x5805a8,_0x262f('0xd'));logger[_0x262f('0xe')](_0x262f('0xf'),_0x5805a8,'request\x20sent',JSON[_0x262f('0x10')](_0x3b416c));if(_0x3b416c[_0x262f('0x11')]){if(_0x3b416c[_0x262f('0x11')][_0x262f('0x12')]===0x1f4){logger[_0x262f('0x11')]('SquareRecording,\x20%s,\x20%s',_0x5805a8,_0x3b416c[_0x262f('0x11')][_0x262f('0x13')]);return _0x57375c(_0x3b416c['error'][_0x262f('0x13')]);}logger['error'](_0x262f('0xc'),_0x5805a8,_0x3b416c[_0x262f('0x11')][_0x262f('0x13')]);return _0x14ee0c(_0x3b416c['error'][_0x262f('0x13')]);}else{logger['info'](_0x262f('0xc'),_0x5805a8,_0x262f('0xd'));_0x14ee0c(_0x3b416c[_0x262f('0x14')][_0x262f('0x13')]);}})['catch'](function(_0x91ac39){logger[_0x262f('0x11')](_0x262f('0xc'),_0x5805a8,_0x91ac39);_0x57375c(_0x91ac39);});});}exports[_0x262f('0x15')]=function(_0x6cc2bf){var _0x494713=this;return new Promise(function(_0xa645f1,_0x4476e9){return db[_0x262f('0x16')][_0x262f('0x17')](_0x6cc2bf[_0x262f('0x18')],{'raw':_0x6cc2bf[_0x262f('0x19')]?_0x6cc2bf['options']['raw']===undefined?!![]:![]:!![]})[_0x262f('0xa')](function(_0x214131){logger[_0x262f('0xb')](_0x262f('0x15'),_0x6cc2bf);logger['debug'](_0x262f('0x15'),_0x6cc2bf,JSON[_0x262f('0x10')](_0x214131));_0xa645f1(_0x214131);})[_0x262f('0x1a')](function(_0x1e11ac){logger[_0x262f('0x11')](_0x262f('0x15'),_0x1e11ac[_0x262f('0x13')],_0x6cc2bf);_0x4476e9(_0x494713[_0x262f('0x11')](0x1f4,_0x1e11ac[_0x262f('0x13')]));});});};