Built motion from commit 753c950e.|2.5.42
[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 _0x156b=['then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareRecording','SquareRecording','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1f9bdb,_0x4d8aaf){var _0x508972=function(_0x3b21be){while(--_0x3b21be){_0x1f9bdb['push'](_0x1f9bdb['shift']());}};_0x508972(++_0x4d8aaf);}(_0x156b,0x1c2));var _0xb156=function(_0x506aef,_0xb1161c){_0x506aef=_0x506aef-0x0;var _0x579eea=_0x156b[_0x506aef];return _0x579eea;};'use strict';var _=require(_0xb156('0x0'));var util=require(_0xb156('0x1'));var moment=require(_0xb156('0x2'));var BPromise=require(_0xb156('0x3'));var rs=require(_0xb156('0x4'));var fs=require('fs');var Redis=require(_0xb156('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb156('0x6'));var logger=require(_0xb156('0x7'))(_0xb156('0x8'));var config=require(_0xb156('0x9'));var jayson=require(_0xb156('0xa'));var client=jayson[_0xb156('0xb')][_0xb156('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b9b4e,_0xd4903e,_0xfbd368){return new BPromise(function(_0x5325cf,_0x2e6dac){return client[_0xb156('0xd')](_0x1b9b4e,_0xfbd368)[_0xb156('0xe')](function(_0x917f34){logger[_0xb156('0xf')](_0xb156('0x10'),_0xd4903e,_0xb156('0x11'));logger['debug'](_0xb156('0x12'),_0xd4903e,_0xb156('0x11'),JSON[_0xb156('0x13')](_0x917f34));if(_0x917f34[_0xb156('0x14')]){if(_0x917f34[_0xb156('0x14')]['code']===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0xd4903e,_0x917f34['error'][_0xb156('0x15')]);return _0x2e6dac(_0x917f34[_0xb156('0x14')][_0xb156('0x15')]);}logger['error'](_0xb156('0x10'),_0xd4903e,_0x917f34[_0xb156('0x14')]['message']);return _0x5325cf(_0x917f34[_0xb156('0x14')][_0xb156('0x15')]);}else{logger[_0xb156('0xf')](_0xb156('0x10'),_0xd4903e,_0xb156('0x11'));_0x5325cf(_0x917f34[_0xb156('0x16')][_0xb156('0x15')]);}})['catch'](function(_0x58e86a){logger['error'](_0xb156('0x10'),_0xd4903e,_0x58e86a);_0x2e6dac(_0x58e86a);});});}exports[_0xb156('0x17')]=function(_0x36f2e0){var _0x37f29d=this;return new Promise(function(_0x4fc22c,_0x17e41a){return db[_0xb156('0x18')]['create'](_0x36f2e0[_0xb156('0x19')],{'raw':_0x36f2e0[_0xb156('0x1a')]?_0x36f2e0[_0xb156('0x1a')][_0xb156('0x1b')]===undefined?!![]:![]:!![]})[_0xb156('0xe')](function(_0x28dbd4){logger[_0xb156('0xf')](_0xb156('0x17'),_0x36f2e0);logger[_0xb156('0x1c')](_0xb156('0x17'),_0x36f2e0,JSON[_0xb156('0x13')](_0x28dbd4));_0x4fc22c(_0x28dbd4);})['catch'](function(_0x243123){logger[_0xb156('0x14')](_0xb156('0x17'),_0x243123['message'],_0x36f2e0);_0x17e41a(_0x37f29d[_0xb156('0x14')](0x1f4,_0x243123[_0xb156('0x15')]));});});};