Built motion from commit e6806ed6.|2.6.0
[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 _0x8f1b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','debug','request\x20sent','stringify','error','SquareRecording,\x20%s,\x20%s','message','info','result','catch','CreateSquareRecording','SquareRecording','create','body','options','lodash','util','bluebird','randomstring','ioredis'];(function(_0x27c2bc,_0x5a98de){var _0x52577f=function(_0x5bcc80){while(--_0x5bcc80){_0x27c2bc['push'](_0x27c2bc['shift']());}};_0x52577f(++_0x5a98de);}(_0x8f1b,0x67));var _0xb8f1=function(_0x7aeb8,_0x307978){_0x7aeb8=_0x7aeb8-0x0;var _0x5e09f3=_0x8f1b[_0x7aeb8];return _0x5e09f3;};'use strict';var _=require(_0xb8f1('0x0'));var util=require(_0xb8f1('0x1'));var moment=require('moment');var BPromise=require(_0xb8f1('0x2'));var rs=require(_0xb8f1('0x3'));var fs=require('fs');var Redis=require(_0xb8f1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb8f1('0x5'));var logger=require(_0xb8f1('0x6'))(_0xb8f1('0x7'));var config=require(_0xb8f1('0x8'));var jayson=require(_0xb8f1('0x9'));var client=jayson[_0xb8f1('0xa')][_0xb8f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x423da7,_0x5028f7,_0x53bae4){return new BPromise(function(_0xe35e7e,_0x498323){return client['request'](_0x423da7,_0x53bae4)[_0xb8f1('0xc')](function(_0x4ce3b1){logger['info']('SquareRecording,\x20%s,\x20%s',_0x5028f7,'request\x20sent');logger[_0xb8f1('0xd')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5028f7,_0xb8f1('0xe'),JSON[_0xb8f1('0xf')](_0x4ce3b1));if(_0x4ce3b1[_0xb8f1('0x10')]){if(_0x4ce3b1['error']['code']===0x1f4){logger[_0xb8f1('0x10')](_0xb8f1('0x11'),_0x5028f7,_0x4ce3b1['error'][_0xb8f1('0x12')]);return _0x498323(_0x4ce3b1[_0xb8f1('0x10')][_0xb8f1('0x12')]);}logger[_0xb8f1('0x10')](_0xb8f1('0x11'),_0x5028f7,_0x4ce3b1[_0xb8f1('0x10')][_0xb8f1('0x12')]);return _0xe35e7e(_0x4ce3b1[_0xb8f1('0x10')][_0xb8f1('0x12')]);}else{logger[_0xb8f1('0x13')](_0xb8f1('0x11'),_0x5028f7,_0xb8f1('0xe'));_0xe35e7e(_0x4ce3b1[_0xb8f1('0x14')][_0xb8f1('0x12')]);}})[_0xb8f1('0x15')](function(_0x3b4a60){logger[_0xb8f1('0x10')](_0xb8f1('0x11'),_0x5028f7,_0x3b4a60);_0x498323(_0x3b4a60);});});}exports[_0xb8f1('0x16')]=function(_0x42e1fe){var _0x5c3686=this;return new Promise(function(_0x200fe4,_0x3d609a){return db[_0xb8f1('0x17')][_0xb8f1('0x18')](_0x42e1fe[_0xb8f1('0x19')],{'raw':_0x42e1fe[_0xb8f1('0x1a')]?_0x42e1fe[_0xb8f1('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xb8f1('0xc')](function(_0x2be579){logger[_0xb8f1('0x13')](_0xb8f1('0x16'),_0x42e1fe);logger[_0xb8f1('0xd')](_0xb8f1('0x16'),_0x42e1fe,JSON[_0xb8f1('0xf')](_0x2be579));_0x200fe4(_0x2be579);})[_0xb8f1('0x15')](function(_0x40ee5e){logger[_0xb8f1('0x10')]('CreateSquareRecording',_0x40ee5e[_0xb8f1('0x12')],_0x42e1fe);_0x3d609a(_0x5c3686[_0xb8f1('0x10')](0x1f4,_0x40ee5e[_0xb8f1('0x12')]));});});};