/* Autogenerated with Kurento Idl */
/*
* (C) Copyright 2013-2015 Kurento (https://kurento.openvidu.io/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var inherits = require('inherits');
var kurentoClient = require('kurento-client');
var disguise = kurentoClient.disguise;
var checkType = kurentoClient.checkType;
var ChecktypeError = checkType.ChecktypeError;
var Transaction = kurentoClient.TransactionsManager.Transaction;
var SessionEndpoint = require('./SessionEndpoint');
function noop(error, result) {
if (error) console.trace(error);
return result
};
/**
* @classdesc
* Interface implemented by Endpoints that require an SDP Offer/Answer
* negotiation in order to configure a media session.
* <p>Functionality provided by this API:</p>
* <ul>
* <li>Generate SDP offers.</li>
* <li>Process SDP offers.</li>
* <li>Configure SDP related params.</li>
* </ul>
*
* @abstract
* @extends module:core/abstracts.SessionEndpoint
*
* @constructor module:core/abstracts.SdpEndpoint
*/
function SdpEndpoint(){
SdpEndpoint.super_.call(this);
};
inherits(SdpEndpoint, SessionEndpoint);
//
// Public properties
//
/**
* Maximum inbound bitrate requested by this endpoint. Signaled to compatible
* WebRTC and RTP senders as part of Kurento's REMB bandwidth estimations, and
* also
* as an SDP bitrate attribute (<code>b=AS:{value}</code>, see
* <a href='https://datatracker.ietf.org/doc/html/rfc8866#section-5.8'
* >RFC 8866 Section 5.8. Bandwidth Information</a
* >) in <i>sendrecv</i> and <i>recvonly</i> SDP Offers.
* <ul>
* <li>Unit: kbps (kilobits per second).</li>
* <li>Default: 0 (unlimited).</li>
* </ul>
*
* @alias module:core/abstracts.SdpEndpoint#getMaxAudioRecvBandwidth
*
* @param {module:core/abstracts.SdpEndpoint~getMaxAudioRecvBandwidthCallback} [callback]
*
* @return {external:Promise}
*/
SdpEndpoint.prototype.getMaxAudioRecvBandwidth = function(callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
var usePromise = false;
if (callback == undefined) {
usePromise = true;
}
if(!arguments.length) callback = undefined;
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'getMaxAudioRecvBandwidth', callback), this)
};
/**
* @callback module:core/abstracts.SdpEndpoint~getMaxAudioRecvBandwidthCallback
* @param {external:Error} error
* @param {external:Integer} result
*/
/**
* Maximum inbound bitrate requested by this endpoint. Signaled to compatible
* WebRTC and RTP senders as part of Kurento's REMB bandwidth estimations, and
* also
* as an SDP bitrate attribute (<code>b=AS:{value}</code>, see
* <a href='https://datatracker.ietf.org/doc/html/rfc8866#section-5.8'
* >RFC 8866 Section 5.8. Bandwidth Information</a
* >) in <i>sendrecv</i> and <i>recvonly</i> SDP Offers.
* <ul>
* <li>Unit: kbps (kilobits per second).</li>
* <li>Default: 0 (unlimited).</li>
* </ul>
*
* @alias module:core/abstracts.SdpEndpoint#setMaxAudioRecvBandwidth
*
* @param {external:Integer} maxAudioRecvBandwidth
* @param {module:core/abstracts.SdpEndpoint~setMaxAudioRecvBandwidthCallback} [callback]
*
* @return {external:Promise}
*/
SdpEndpoint.prototype.setMaxAudioRecvBandwidth = function(maxAudioRecvBandwidth, callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
//
// checkType('int', 'maxAudioRecvBandwidth', maxAudioRecvBandwidth, {required: true});
//
var params = {
maxAudioRecvBandwidth: maxAudioRecvBandwidth
};
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'setMaxAudioRecvBandwidth', params, callback), this)
};
/**
* @callback module:core/abstracts.SdpEndpoint~setMaxAudioRecvBandwidthCallback
* @param {external:Error} error
*/
/**
* Maximum inbound bitrate requested by this endpoint. Signaled to compatible
* WebRTC and RTP senders as part of Kurento's REMB bandwidth estimations, and
* also
* as an SDP bitrate attribute (<code>b=AS:{value}</code>, see
* <a href='https://datatracker.ietf.org/doc/html/rfc8866#section-5.8'
* >RFC 8866 Section 5.8. Bandwidth Information</a
* >) in <i>sendrecv</i> and <i>recvonly</i> SDP Offers.
* <ul>
* <li>Unit: kbps (kilobits per second).</li>
* <li>Default: 0 (unlimited).</li>
* </ul>
*
* @alias module:core/abstracts.SdpEndpoint#getMaxVideoRecvBandwidth
*
* @param {module:core/abstracts.SdpEndpoint~getMaxVideoRecvBandwidthCallback} [callback]
*
* @return {external:Promise}
*/
SdpEndpoint.prototype.getMaxVideoRecvBandwidth = function(callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
var usePromise = false;
if (callback == undefined) {
usePromise = true;
}
if(!arguments.length) callback = undefined;
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'getMaxVideoRecvBandwidth', callback), this)
};
/**
* @callback module:core/abstracts.SdpEndpoint~getMaxVideoRecvBandwidthCallback
* @param {external:Error} error
* @param {external:Integer} result
*/
/**
* Maximum inbound bitrate requested by this endpoint. Signaled to compatible
* WebRTC and RTP senders as part of Kurento's REMB bandwidth estimations, and
* also
* as an SDP bitrate attribute (<code>b=AS:{value}</code>, see
* <a href='https://datatracker.ietf.org/doc/html/rfc8866#section-5.8'
* >RFC 8866 Section 5.8. Bandwidth Information</a
* >) in <i>sendrecv</i> and <i>recvonly</i> SDP Offers.
* <ul>
* <li>Unit: kbps (kilobits per second).</li>
* <li>Default: 0 (unlimited).</li>
* </ul>
*
* @alias module:core/abstracts.SdpEndpoint#setMaxVideoRecvBandwidth
*
* @param {external:Integer} maxVideoRecvBandwidth
* @param {module:core/abstracts.SdpEndpoint~setMaxVideoRecvBandwidthCallback} [callback]
*
* @return {external:Promise}
*/
SdpEndpoint.prototype.setMaxVideoRecvBandwidth = function(maxVideoRecvBandwidth, callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
//
// checkType('int', 'maxVideoRecvBandwidth', maxVideoRecvBandwidth, {required: true});
//
var params = {
maxVideoRecvBandwidth: maxVideoRecvBandwidth
};
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'setMaxVideoRecvBandwidth', params, callback), this)
};
/**
* @callback module:core/abstracts.SdpEndpoint~setMaxVideoRecvBandwidthCallback
* @param {external:Error} error
*/
//
// Public methods
//
/**
* Generates an SDP offer with media capabilities of the Endpoint.
* Throws:
* <ul>
* <li>
* SDP_END_POINT_ALREADY_NEGOTIATED If the endpoint is already negotiated.
* </li>
* <li>
* SDP_END_POINT_GENERATE_OFFER_ERROR if the generated offer is empty. This
* is
* most likely due to an internal error.
* </li>
* </ul>
*
* @alias module:core/abstracts.SdpEndpoint.generateOffer
*
* @param {module:core/complexTypes.OfferOptions} [options]
* An <code>OfferOptions</code> providing options requested for the offer.
*
* @param {module:core/abstracts.SdpEndpoint~generateOfferCallback} [callback]
*
* @return {external:Promise}
*/
SdpEndpoint.prototype.generateOffer = function(options, callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
callback = arguments[arguments.length-1] instanceof Function
? Array.prototype.pop.call(arguments)
: undefined;
switch(arguments.length){
case 0: options = undefined;
break;
case 1:
break;
default:
var error = new RangeError('Number of params ('+arguments.length+') not in range [0-1]');
error.length = arguments.length;
error.min = 0;
error.max = 1;
throw error;
}
//
// checkType('OfferOptions', 'options', options);
//
var params = {
options: options
};
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'generateOffer', params, callback), this)
};
/**
* @callback module:core/abstracts.SdpEndpoint~generateOfferCallback
* @param {external:Error} error
* @param {external:String} result
* The SDP offer.
*/
/**
* Returns the local SDP.
* <ul>
* <li>
* No offer has been generated: returns null.
* </li>
* <li>
* Offer has been generated: returns the SDP offer.
* </li>
* <li>
* Offer has been generated and answer processed: returns the agreed SDP.
* </li>
* </ul>
*
* @alias module:core/abstracts.SdpEndpoint.getLocalSessionDescriptor
*
* @param {module:core/abstracts.SdpEndpoint~getLocalSessionDescriptorCallback} [callback]
*
* @return {external:Promise}
*/
SdpEndpoint.prototype.getLocalSessionDescriptor = function(callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
var usePromise = false;
if (callback == undefined) {
usePromise = true;
}
if(!arguments.length) callback = undefined;
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'getLocalSessionDescriptor', callback), this)
};
/**
* @callback module:core/abstracts.SdpEndpoint~getLocalSessionDescriptorCallback
* @param {external:Error} error
* @param {external:String} result
* The last agreed SessionSpec.
*/
/**
* This method returns the remote SDP.
* If the negotiation process is not complete, it will return NULL.
*
* @alias module:core/abstracts.SdpEndpoint.getRemoteSessionDescriptor
*
* @param {module:core/abstracts.SdpEndpoint~getRemoteSessionDescriptorCallback} [callback]
*
* @return {external:Promise}
*/
SdpEndpoint.prototype.getRemoteSessionDescriptor = function(callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
var usePromise = false;
if (callback == undefined) {
usePromise = true;
}
if(!arguments.length) callback = undefined;
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'getRemoteSessionDescriptor', callback), this)
};
/**
* @callback module:core/abstracts.SdpEndpoint~getRemoteSessionDescriptorCallback
* @param {external:Error} error
* @param {external:String} result
* The last agreed User Agent session description.
*/
/**
* Generates an SDP offer with media capabilities of the Endpoint.
* Throws:
* <ul>
* <li>
* SDP_PARSE_ERROR If the offer is empty or has errors.
* </li>
* <li>
* SDP_END_POINT_ALREADY_NEGOTIATED If the endpoint is already negotiated.
* </li>
* <li>
* SDP_END_POINT_PROCESS_ANSWER_ERROR if the result of processing the answer
* an empty string. This is most likely due to an internal error.
* </li>
* <li>
* SDP_END_POINT_NOT_OFFER_GENERATED If the method is invoked before the
* generateOffer method.
* </li>
* </ul>
*
* @alias module:core/abstracts.SdpEndpoint.processAnswer
*
* @param {external:String} answer
* SessionSpec answer from the remote User Agent
*
* @param {module:core/abstracts.SdpEndpoint~processAnswerCallback} [callback]
*
* @return {external:Promise}
*/
SdpEndpoint.prototype.processAnswer = function(answer, callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
//
// checkType('String', 'answer', answer, {required: true});
//
var params = {
answer: answer
};
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'processAnswer', params, callback), this)
};
/**
* @callback module:core/abstracts.SdpEndpoint~processAnswerCallback
* @param {external:Error} error
* @param {external:String} result
* Updated SDP offer, based on the answer received.
*/
/**
* Processes SDP offer of the remote peer, and generates an SDP answer based on
* the endpoint's capabilities.
* <p>
* If no matching capabilities are found, the SDP will contain no codecs.
* </p>
* Throws:
* <ul>
* <li>
* SDP_PARSE_ERROR If the offer is empty or has errors.
* </li>
* <li>
* SDP_END_POINT_ALREADY_NEGOTIATED If the endpoint is already negotiated.
* </li>
* <li>
* SDP_END_POINT_PROCESS_OFFER_ERROR if the generated offer is empty. This
* is
* most likely due to an internal error.
* </li>
* </ul>
*
* @alias module:core/abstracts.SdpEndpoint.processOffer
*
* @param {external:String} offer
* SessionSpec offer from the remote User Agent
*
* @param {module:core/abstracts.SdpEndpoint~processOfferCallback} [callback]
*
* @return {external:Promise}
*/
SdpEndpoint.prototype.processOffer = function(offer, callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
//
// checkType('String', 'offer', offer, {required: true});
//
var params = {
offer: offer
};
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'processOffer', params, callback), this)
};
/**
* @callback module:core/abstracts.SdpEndpoint~processOfferCallback
* @param {external:Error} error
* @param {external:String} result
* The chosen configuration from the ones stated in the SDP offer.
*/
/**
* @alias module:core/abstracts.SdpEndpoint.constructorParams
*/
SdpEndpoint.constructorParams = {
};
/**
* @alias module:core/abstracts.SdpEndpoint.events
*
* @extends module:core/abstracts.SessionEndpoint.events
*/
SdpEndpoint.events = SessionEndpoint.events;
/**
* Checker for {@link module:core/abstracts.SdpEndpoint}
*
* @memberof module:core/abstracts
*
* @param {external:String} key
* @param {module:core/abstracts.SdpEndpoint} value
*/
function checkSdpEndpoint(key, value)
{
if(!(value instanceof SdpEndpoint))
throw ChecktypeError(key, SdpEndpoint, value);
};
module.exports = SdpEndpoint;
SdpEndpoint.check = checkSdpEndpoint;