c953773a487d62a6ad5d6247956a3af304c927c2
[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 _0x43ae=['then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x43ae,0x10e));var _0xe43a=function(_0x19d252,_0x556c0f){_0x19d252=_0x19d252-0x0;var _0x293ecf=_0x43ae[_0x19d252];return _0x293ecf;};'use strict';var _=require(_0xe43a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe43a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe43a('0x2'));var db=require(_0xe43a('0x3'))['db'];var utils=require(_0xe43a('0x4'));var logger=require(_0xe43a('0x5'))('rpc');var config=require(_0xe43a('0x6'));var jayson=require(_0xe43a('0x7'));var client=jayson['client'][_0xe43a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e82e7,_0x852a11,_0x2b3969){return new BPromise(function(_0x44ecb7,_0x1168f0){return client[_0xe43a('0x9')](_0x5e82e7,_0x2b3969)[_0xe43a('0xa')](function(_0x58e605){logger[_0xe43a('0xb')](_0xe43a('0xc'),_0x852a11,_0xe43a('0xd'));logger[_0xe43a('0xe')](_0xe43a('0xf'),_0x852a11,_0xe43a('0xd'),JSON[_0xe43a('0x10')](_0x58e605));if(_0x58e605[_0xe43a('0x11')]){if(_0x58e605[_0xe43a('0x11')][_0xe43a('0x12')]===0x1f4){logger['error'](_0xe43a('0xc'),_0x852a11,_0x58e605[_0xe43a('0x11')][_0xe43a('0x13')]);return _0x1168f0(_0x58e605[_0xe43a('0x11')][_0xe43a('0x13')]);}logger[_0xe43a('0x11')](_0xe43a('0xc'),_0x852a11,_0x58e605['error']['message']);return _0x44ecb7(_0x58e605['error'][_0xe43a('0x13')]);}else{logger[_0xe43a('0xb')]('SquareRecording,\x20%s,\x20%s',_0x852a11,_0xe43a('0xd'));_0x44ecb7(_0x58e605[_0xe43a('0x14')][_0xe43a('0x13')]);}})[_0xe43a('0x15')](function(_0xfa2af4){logger[_0xe43a('0x11')](_0xe43a('0xc'),_0x852a11,_0xfa2af4);_0x1168f0(_0xfa2af4);});});}exports[_0xe43a('0x16')]=function(_0x274bb1){var _0x839327=this;return new Promise(function(_0x289362,_0xce1c0d){return db[_0xe43a('0x17')][_0xe43a('0x18')](_0x274bb1[_0xe43a('0x19')],{'raw':_0x274bb1[_0xe43a('0x1a')]?_0x274bb1[_0xe43a('0x1a')][_0xe43a('0x1b')]===undefined?!![]:![]:!![]})[_0xe43a('0xa')](function(_0x465df4){logger['info'](_0xe43a('0x16'),_0x274bb1);logger[_0xe43a('0xe')](_0xe43a('0x16'),_0x274bb1,JSON[_0xe43a('0x10')](_0x465df4));_0x289362(_0x465df4);})[_0xe43a('0x15')](function(_0x34f197){logger[_0xe43a('0x11')]('CreateSquareRecording',_0x34f197[_0xe43a('0x13')],_0x274bb1);_0xce1c0d(_0x839327[_0xe43a('0x11')](0x1f4,_0x34f197[_0xe43a('0x13')]));});});};