Built motion from commit (unavailable).|2.5.22
[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 _0x31a3=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','CreateSquareRecording','SquareRecording','create','body','options','raw'];(function(_0x13860a,_0x421420){var _0x2c980b=function(_0x47d467){while(--_0x47d467){_0x13860a['push'](_0x13860a['shift']());}};_0x2c980b(++_0x421420);}(_0x31a3,0x189));var _0x331a=function(_0x3546eb,_0x440f3f){_0x3546eb=_0x3546eb-0x0;var _0xe660bf=_0x31a3[_0x3546eb];return _0xe660bf;};'use strict';var _=require(_0x331a('0x0'));var util=require(_0x331a('0x1'));var moment=require('moment');var BPromise=require(_0x331a('0x2'));var rs=require(_0x331a('0x3'));var fs=require('fs');var Redis=require(_0x331a('0x4'));var db=require(_0x331a('0x5'))['db'];var utils=require(_0x331a('0x6'));var logger=require(_0x331a('0x7'))(_0x331a('0x8'));var config=require(_0x331a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x331a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3106c6,_0x4df5d6,_0x3f9908){return new BPromise(function(_0xaa4d52,_0x56f7b3){return client[_0x331a('0xb')](_0x3106c6,_0x3f9908)['then'](function(_0x31fd53){logger[_0x331a('0xc')](_0x331a('0xd'),_0x4df5d6,'request\x20sent');logger[_0x331a('0xe')](_0x331a('0xf'),_0x4df5d6,'request\x20sent',JSON[_0x331a('0x10')](_0x31fd53));if(_0x31fd53[_0x331a('0x11')]){if(_0x31fd53[_0x331a('0x11')]['code']===0x1f4){logger[_0x331a('0x11')](_0x331a('0xd'),_0x4df5d6,_0x31fd53[_0x331a('0x11')][_0x331a('0x12')]);return _0x56f7b3(_0x31fd53[_0x331a('0x11')][_0x331a('0x12')]);}logger['error'](_0x331a('0xd'),_0x4df5d6,_0x31fd53[_0x331a('0x11')][_0x331a('0x12')]);return _0xaa4d52(_0x31fd53[_0x331a('0x11')][_0x331a('0x12')]);}else{logger[_0x331a('0xc')](_0x331a('0xd'),_0x4df5d6,_0x331a('0x13'));_0xaa4d52(_0x31fd53[_0x331a('0x14')][_0x331a('0x12')]);}})['catch'](function(_0x375cb6){logger[_0x331a('0x11')](_0x331a('0xd'),_0x4df5d6,_0x375cb6);_0x56f7b3(_0x375cb6);});});}exports[_0x331a('0x15')]=function(_0x3b0d37){var _0x9e9bad=this;return new Promise(function(_0x3aebec,_0x4fa179){return db[_0x331a('0x16')][_0x331a('0x17')](_0x3b0d37[_0x331a('0x18')],{'raw':_0x3b0d37['options']?_0x3b0d37[_0x331a('0x19')][_0x331a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x242886){logger[_0x331a('0xc')](_0x331a('0x15'),_0x3b0d37);logger[_0x331a('0xe')](_0x331a('0x15'),_0x3b0d37,JSON['stringify'](_0x242886));_0x3aebec(_0x242886);})[_0x331a('0x1b')](function(_0xe62971){logger[_0x331a('0x11')](_0x331a('0x15'),_0xe62971[_0x331a('0x12')],_0x3b0d37);_0x4fa179(_0x9e9bad[_0x331a('0x11')](0x1f4,_0xe62971[_0x331a('0x12')]));});});};