Built motion from commit (unavailable).|2.2.1
[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 _0xf52f=['client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateSquareRecording','SquareRecording','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0xf52f,0x1dc));var _0xff52=function(_0x54d197,_0x5c5884){_0x54d197=_0x54d197-0x0;var _0x5aa343=_0xf52f[_0x54d197];return _0x5aa343;};'use strict';var _=require(_0xff52('0x0'));var util=require(_0xff52('0x1'));var moment=require('moment');var BPromise=require(_0xff52('0x2'));var rs=require(_0xff52('0x3'));var fs=require('fs');var Redis=require(_0xff52('0x4'));var db=require(_0xff52('0x5'))['db'];var utils=require(_0xff52('0x6'));var logger=require(_0xff52('0x7'))(_0xff52('0x8'));var config=require(_0xff52('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff52('0xa')][_0xff52('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36bbd8,_0x53978d,_0x1d7bea){return new BPromise(function(_0x5a0735,_0x2f704b){return client['request'](_0x36bbd8,_0x1d7bea)[_0xff52('0xc')](function(_0x3ee744){logger[_0xff52('0xd')](_0xff52('0xe'),_0x53978d,_0xff52('0xf'));logger['debug'](_0xff52('0x10'),_0x53978d,_0xff52('0xf'),JSON[_0xff52('0x11')](_0x3ee744));if(_0x3ee744['error']){if(_0x3ee744['error'][_0xff52('0x12')]===0x1f4){logger[_0xff52('0x13')](_0xff52('0xe'),_0x53978d,_0x3ee744[_0xff52('0x13')][_0xff52('0x14')]);return _0x2f704b(_0x3ee744[_0xff52('0x13')]['message']);}logger['error'](_0xff52('0xe'),_0x53978d,_0x3ee744[_0xff52('0x13')][_0xff52('0x14')]);return _0x5a0735(_0x3ee744[_0xff52('0x13')]['message']);}else{logger['info'](_0xff52('0xe'),_0x53978d,_0xff52('0xf'));_0x5a0735(_0x3ee744[_0xff52('0x15')][_0xff52('0x14')]);}})[_0xff52('0x16')](function(_0x57e72f){logger[_0xff52('0x13')](_0xff52('0xe'),_0x53978d,_0x57e72f);_0x2f704b(_0x57e72f);});});}exports[_0xff52('0x17')]=function(_0x246453){var _0x43a83a=this;return new Promise(function(_0x48ce15,_0x3d9868){return db[_0xff52('0x18')]['create'](_0x246453['body'],{'raw':_0x246453[_0xff52('0x19')]?_0x246453[_0xff52('0x19')][_0xff52('0x1a')]===undefined?!![]:![]:!![]})[_0xff52('0xc')](function(_0x49d089){logger[_0xff52('0xd')]('CreateSquareRecording',_0x246453);logger['debug'](_0xff52('0x17'),_0x246453,JSON[_0xff52('0x11')](_0x49d089));_0x48ce15(_0x49d089);})[_0xff52('0x16')](function(_0xce641a){logger['error'](_0xff52('0x17'),_0xce641a[_0xff52('0x14')],_0x246453);_0x3d9868(_0x43a83a[_0xff52('0x13')](0x1f4,_0xce641a[_0xff52('0x14')]));});});};