Commit 2724e7bc authored by DanmeiChen's avatar DanmeiChen Committed by DanmeiChen

add keep alive interval for real time text

parent 604e47e4
......@@ -7348,6 +7348,14 @@ void linphone_core_enable_realtime_text(LinphoneCore *lc, bool_t value) {
lc->text_conf.enabled = value;
}
unsigned int linphone_core_realtime_text_get_keepalive_interval(const LinphoneCore *lc) {
return lc->text_conf.keepalive_interval;
}
void linphone_core_realtime_text_set_keepalive_interval(LinphoneCore *lc, unsigned int interval) {
lc->text_conf.keepalive_interval = interval;
}
void linphone_core_set_http_proxy_host(LinphoneCore *lc, const char *host) {
lp_config_set_string(lc->config,"sip","http_proxy_host",host);
if (lc->sal) {
......
......@@ -342,6 +342,7 @@ struct video_config{
struct text_config{
bool_t enabled;
unsigned int keepalive_interval;
};
struct ui_config
......
......@@ -435,6 +435,22 @@ LINPHONE_PUBLIC LinphoneStatus linphone_call_params_enable_realtime_text(Linphon
**/
LINPHONE_PUBLIC bool_t linphone_call_params_realtime_text_enabled(const LinphoneCallParams *params);
/**
* Use to set keep alive interval for real time text following rfc4103.
* @param params #LinphoneCallParams
* @param interval The keep alive interval for real time text, 25000 by default.
* @ingroup media_parameters
**/
LINPHONE_PUBLIC void linphone_call_params_set_realtime_text_keepalive_interval(LinphoneCallParams *params, unsigned int interval);
/**
* Use to get keep alive interval of real time text following rfc4103.
* @param params #LinphoneCallParams
* @returns returns keep alive interval of real time text.
* @ingroup media_parameters
**/
LINPHONE_PUBLIC unsigned int linphone_call_params_get_realtime_text_keepalive_interval(const LinphoneCallParams *params);
/**
* Add a custom attribute related to all the streams in the SDP exchanged within SIP messages during a call.
* @param[in] params The #LinphoneCallParams to add a custom SDP attribute to.
......
......@@ -5146,6 +5146,22 @@ LINPHONE_PUBLIC bool_t linphone_core_realtime_text_enabled(LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_core_enable_realtime_text(LinphoneCore *lc, bool_t value);
/**
* Gets keep alive interval of real time text.
* @param[in] lc #LinphoneCore object
* @return keep alive interval of real time text.
* @ingroup media_parameters
*/
LINPHONE_PUBLIC unsigned int linphone_core_realtime_text_get_keepalive_interval(const LinphoneCore *lc);
/**
* Set keep alive interval for real time text.
* @param[in] lc #LinphoneCore object
* @param[in] interval The keep alive interval of real time text, 25000 by default.
* @ingroup network_parameters
*/
LINPHONE_PUBLIC void linphone_core_realtime_text_set_keepalive_interval(LinphoneCore *lc, unsigned int interval);
/**
* Set http proxy address to be used for signaling during next channel connection. Use #linphone_core_set_network_reachable FASLE/TRUE to force channel restart.
* @param[in] lc #LinphoneCore object
......
......@@ -140,6 +140,10 @@ LinphoneStatus linphone_call_params_enable_realtime_text (LinphoneCallParams *pa
return 0;
}
void linphone_call_params_set_realtime_text_keepalive_interval(LinphoneCallParams *params, unsigned int interval){
L_GET_CPP_PTR_FROM_C_OBJECT(params)->setRealtimeTextKeepaliveInterval(interval);
}
void linphone_call_params_enable_video (LinphoneCallParams *params, bool_t enabled) {
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableVideo(!!enabled);
}
......@@ -294,6 +298,10 @@ bool_t linphone_call_params_realtime_text_enabled (const LinphoneCallParams *par
return L_GET_CPP_PTR_FROM_C_OBJECT(params)->realtimeTextEnabled();
}
unsigned int linphone_call_params_get_realtime_text_keepalive_interval (const LinphoneCallParams *params) {
return L_GET_CPP_PTR_FROM_C_OBJECT(params)->realtimeTextKeepaliveInterval();
}
bool_t linphone_call_params_video_enabled (const LinphoneCallParams *params) {
return L_GET_CPP_PTR_FROM_C_OBJECT(params)->videoEnabled();
}
......
......@@ -88,6 +88,7 @@ public:
LinphoneVideoDefinition *sentVideoDefinition = nullptr;
bool realtimeTextEnabled = false;
unsigned int realtimeTextKeepaliveInterval = 25000;
PayloadType *usedRealtimeTextCodec = nullptr;
bool avpfEnabled = false;
......
......@@ -50,6 +50,7 @@ void MediaSessionParamsPrivate::clone (const MediaSessionParamsPrivate *src) {
sentFps = src->sentFps;
sentVideoDefinition = src->sentVideoDefinition ? linphone_video_definition_ref(src->sentVideoDefinition) : nullptr;
realtimeTextEnabled = src->realtimeTextEnabled;
realtimeTextKeepaliveInterval = src->realtimeTextKeepaliveInterval;
usedRealtimeTextCodec = src->usedRealtimeTextCodec;
avpfEnabled = src->avpfEnabled;
avpfRrInterval = src->avpfRrInterval;
......@@ -235,6 +236,7 @@ void MediaSessionParams::initDefault (const std::shared_ptr<Core> &core) {
"This is a possible mis-use of the API. In this case, video is disabled in default LinphoneCallParams";
}
d->realtimeTextEnabled = !!linphone_core_realtime_text_enabled(cCore);
d->realtimeTextKeepaliveInterval = linphone_core_realtime_text_get_keepalive_interval(cCore);
d->encryption = linphone_core_get_media_encryption(cCore);
d->avpfEnabled = (linphone_core_get_avpf_mode(cCore) == LinphoneAVPFEnabled);
d->_implicitRtcpFbEnabled = !!lp_config_get_int(linphone_core_get_config(cCore), "rtp", "rtcp_fb_implicit_rtcp_fb", true);
......@@ -373,6 +375,11 @@ void MediaSessionParams::enableRealtimeText (bool value) {
d->realtimeTextEnabled = value;
}
void MediaSessionParams::setRealtimeTextKeepaliveInterval (unsigned int interval) {
L_D();
d->realtimeTextKeepaliveInterval = interval;
}
const OrtpPayloadType * MediaSessionParams::getUsedRealtimeTextCodec () const {
L_D();
return d->usedRealtimeTextCodec;
......@@ -388,6 +395,11 @@ bool MediaSessionParams::realtimeTextEnabled () const {
return d->realtimeTextEnabled;
}
unsigned int MediaSessionParams::realtimeTextKeepaliveInterval() const {
L_D();
return d->realtimeTextKeepaliveInterval;
}
// -----------------------------------------------------------------------------
bool MediaSessionParams::avpfEnabled () const {
......
......@@ -74,9 +74,11 @@ public:
bool videoMulticastEnabled () const;
void enableRealtimeText (bool value);
void setRealtimeTextKeepaliveInterval (unsigned int interval);
const OrtpPayloadType * getUsedRealtimeTextCodec () const;
LinphonePayloadType * getUsedRealtimeTextPayloadType () const;
bool realtimeTextEnabled () const;
unsigned int realtimeTextKeepaliveInterval () const;
bool avpfEnabled () const;
void enableAvpf (bool value);
......
......@@ -3352,6 +3352,8 @@ void MediaSessionPrivate::startTextStream () {
else {
getCurrentParams()->getPrivate()->setUsedRealtimeTextCodec(rtp_profile_get_payload(textProfile, usedPt));
getCurrentParams()->enableRealtimeText(true);
unsigned int interval = getParams()->realtimeTextKeepaliveInterval();
getCurrentParams()->setRealtimeTextKeepaliveInterval(interval);
if (sal_stream_description_has_srtp(tstream)) {
int cryptoIdx = Sal::findCryptoIndexFromTag(localStreamDesc->crypto, static_cast<unsigned char>(tstream->crypto_local_tag));
if (cryptoIdx >= 0) {
......@@ -3367,6 +3369,7 @@ void MediaSessionPrivate::startTextStream () {
rtp_session_set_multicast_ttl(textStream->ms.sessions.rtp_session, tstream->ttl);
text_stream_start(textStream, textProfile, rtpAddr, tstream->rtp_port, rtcpAddr,
(linphone_core_rtcp_enabled(q->getCore()->getCCore()) && !isMulticast) ? (tstream->rtcp_port ? tstream->rtcp_port : tstream->rtp_port + 1) : 0, usedPt);
ms_filter_call_method(textStream->rttsource, MS_RTT_4103_SOURCE_SET_KEEP_ALIVE_INTERVAL, &interval);
ms_filter_add_notify_callback(textStream->rttsink, realTimeTextCharacterReceived, this, false);
ms_media_stream_sessions_set_encryption_mandatory(&textStream->ms.sessions, isEncryptionMandatory());
}
......
......@@ -1886,6 +1886,8 @@ static void real_time_text(
linphone_core_set_media_encryption_mandatory(pauline->lc, TRUE);
}
linphone_core_realtime_text_set_keepalive_interval(pauline->lc, 500);
marie_params = linphone_core_create_call_params(marie->lc, NULL);
linphone_call_params_enable_realtime_text(marie_params,TRUE);
if (!audio_stream_enabled) {
......@@ -1899,6 +1901,8 @@ static void real_time_text(
marie_call = linphone_core_get_current_call(marie->lc);
if (pauline_call) {
BC_ASSERT_TRUE(linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(pauline_call)));
BC_ASSERT_EQUAL(linphone_call_params_get_realtime_text_keepalive_interval(linphone_call_get_current_params(pauline_call)), 500, unsigned int, "%u");
if (audio_stream_enabled) {
BC_ASSERT_TRUE(linphone_call_params_audio_enabled(linphone_call_get_current_params(pauline_call)));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment