Built motion from commit c738b9ac.|2.6.25
[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 _0xb5fd=['request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','SquareRecording','create','options','raw','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x542eb2,_0x403921){var _0xd84d92=function(_0x588740){while(--_0x588740){_0x542eb2['push'](_0x542eb2['shift']());}};_0xd84d92(++_0x403921);}(_0xb5fd,0x82));var _0xdb5f=function(_0x3ef830,_0x20f402){_0x3ef830=_0x3ef830-0x0;var _0x434b82=_0xb5fd[_0x3ef830];return _0x434b82;};'use strict';var _=require(_0xdb5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdb5f('0x1'));var rs=require(_0xdb5f('0x2'));var fs=require('fs');var Redis=require(_0xdb5f('0x3'));var db=require(_0xdb5f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb5f('0x5'))(_0xdb5f('0x6'));var config=require(_0xdb5f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdb5f('0x8')][_0xdb5f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5614,_0x3b61e9,_0x186e5){return new BPromise(function(_0x6567df,_0x440f97){return client[_0xdb5f('0xa')](_0x5614,_0x186e5)[_0xdb5f('0xb')](function(_0xf0921e){logger[_0xdb5f('0xc')](_0xdb5f('0xd'),_0x3b61e9,_0xdb5f('0xe'));logger[_0xdb5f('0xf')](_0xdb5f('0x10'),_0x3b61e9,'request\x20sent',JSON[_0xdb5f('0x11')](_0xf0921e));if(_0xf0921e[_0xdb5f('0x12')]){if(_0xf0921e[_0xdb5f('0x12')][_0xdb5f('0x13')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x3b61e9,_0xf0921e[_0xdb5f('0x12')][_0xdb5f('0x14')]);return _0x440f97(_0xf0921e[_0xdb5f('0x12')]['message']);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x3b61e9,_0xf0921e['error'][_0xdb5f('0x14')]);return _0x6567df(_0xf0921e[_0xdb5f('0x12')][_0xdb5f('0x14')]);}else{logger[_0xdb5f('0xc')](_0xdb5f('0xd'),_0x3b61e9,'request\x20sent');_0x6567df(_0xf0921e[_0xdb5f('0x15')]['message']);}})['catch'](function(_0x3ee988){logger[_0xdb5f('0x12')](_0xdb5f('0xd'),_0x3b61e9,_0x3ee988);_0x440f97(_0x3ee988);});});}exports[_0xdb5f('0x16')]=function(_0x5037f4){var _0x255624=this;return new Promise(function(_0x1fa7ff,_0x5cb428){return db[_0xdb5f('0x17')][_0xdb5f('0x18')](_0x5037f4['body'],{'raw':_0x5037f4[_0xdb5f('0x19')]?_0x5037f4[_0xdb5f('0x19')][_0xdb5f('0x1a')]===undefined?!![]:![]:!![]})[_0xdb5f('0xb')](function(_0x104efd){logger[_0xdb5f('0xc')](_0xdb5f('0x16'),_0x5037f4);logger[_0xdb5f('0xf')]('CreateSquareRecording',_0x5037f4,JSON['stringify'](_0x104efd));_0x1fa7ff(_0x104efd);})[_0xdb5f('0x1b')](function(_0x53a85b){logger[_0xdb5f('0x12')](_0xdb5f('0x16'),_0x53a85b['message'],_0x5037f4);_0x5cb428(_0x255624[_0xdb5f('0x12')](0x1f4,_0x53a85b[_0xdb5f('0x14')]));});});};