Commit e53d4cf7 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Improve API so that it is more object-oriented.

parent 7276f565
......@@ -50,7 +50,7 @@ static int media_parameters_changed(LinphoneCall *call, SalMediaDescription *old
return result;
}
void linphone_core_update_streams_destinations(LinphoneCore *lc, LinphoneCall *call, SalMediaDescription *old_md, SalMediaDescription *new_md) {
void linphone_core_update_streams_destinations(LinphoneCall *call, SalMediaDescription *old_md, SalMediaDescription *new_md) {
SalStreamDescription *new_audiodesc = NULL;
SalStreamDescription *new_videodesc = NULL;
char *rtp_addr, *rtcp_addr;
......@@ -124,55 +124,55 @@ void linphone_call_update_frozen_payloads(LinphoneCall *call, SalMediaDescriptio
}
}
void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMediaDescription *new_md, LinphoneCallState target_state){
SalMediaDescription *oldmd=call->resultdesc;
int md_changed=0;
void linphone_call_update_streams(LinphoneCall *call, SalMediaDescription *new_md, LinphoneCallState target_state) {
LinphoneCore *lc = linphone_call_get_core(call);
SalMediaDescription *oldmd = call->resultdesc;
int md_changed = 0;
if (!((call->state == LinphoneCallIncomingEarlyMedia) && (linphone_core_get_ring_during_incoming_early_media(lc)))) {
linphone_core_stop_ringing(lc);
}
if (!new_md) {
ms_error("linphone_core_update_streams() called with null media description");
ms_error("linphone_call_update_streams() called with null media description");
return;
}
linphone_call_update_biggest_desc(call, call->localdesc);
sal_media_description_ref(new_md);
call->resultdesc=new_md;
if ((call->audiostream && call->audiostream->ms.state==MSStreamStarted) || (call->videostream && call->videostream->ms.state==MSStreamStarted)){
call->resultdesc = new_md;
if ((call->audiostream && (call->audiostream->ms.state == MSStreamStarted)) || (call->videostream && (call->videostream->ms.state == MSStreamStarted))) {
clear_early_media_destinations(call);
/* we already started media: check if we really need to restart it*/
if (oldmd){
/* We already started media: check if we really need to restart it */
if (oldmd) {
md_changed = media_parameters_changed(call, oldmd, new_md);
if ((md_changed & ( SAL_MEDIA_DESCRIPTION_CODEC_CHANGED
|SAL_MEDIA_DESCRIPTION_STREAMS_CHANGED
|SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED
|SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED
|SAL_MEDIA_DESCRIPTION_FORCE_STREAM_RECONSTRUCTION ))){
|SAL_MEDIA_DESCRIPTION_FORCE_STREAM_RECONSTRUCTION ))) {
ms_message("Media descriptions are different, need to restart the streams.");
} else if ( call->playing_ringbacktone) {
} else if (call->playing_ringbacktone) {
ms_message("Playing ringback tone, will restart the streams.");
} else {
if (md_changed == SAL_MEDIA_DESCRIPTION_UNCHANGED) {
if (call->all_muted){
if (call->all_muted) {
ms_message("Early media finished, unmuting inputs...");
/*we were in early media, now we want to enable real media */
/* We were in early media, now we want to enable real media */
call->all_muted = FALSE;
if (call->audiostream)
linphone_core_enable_mic(lc, linphone_core_mic_enabled(lc));
if (call->audiostream) linphone_core_enable_mic(lc, linphone_core_mic_enabled(lc));
#ifdef VIDEO_ENABLED
if (call->videostream && call->camera_enabled)
if (call->videostream && call->camera_enabled) {
linphone_call_enable_camera(call, linphone_call_camera_enabled(call));
}
#endif
}
/*FIXME ZRTP, might be restarted in any cases ? */
ms_message("No need to restart streams, SDP is unchanged.");
goto end;
}else {
} else {
if (md_changed & SAL_MEDIA_DESCRIPTION_NETWORK_CHANGED) {
ms_message("Network parameters have changed, update them.");
linphone_core_update_streams_destinations(lc, call, oldmd, new_md);
linphone_core_update_streams_destinations(call, oldmd, new_md);
}
if (md_changed & SAL_MEDIA_DESCRIPTION_CRYPTO_KEYS_CHANGED) {
ms_message("Crypto parameters have changed, update them.");
......@@ -182,34 +182,35 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
}
}
}
linphone_call_stop_media_streams (call);
if (md_changed & SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED){
ms_message("Media ip type has changed, destroying sessions context on call [%p]",call);
linphone_call_stop_media_streams(call);
if (md_changed & SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED) {
ms_message("Media ip type has changed, destroying sessions context on call [%p]", call);
ms_media_stream_sessions_uninit(&call->sessions[call->main_audio_stream_index]);
ms_media_stream_sessions_uninit(&call->sessions[call->main_video_stream_index]);
ms_media_stream_sessions_uninit(&call->sessions[call->main_text_stream_index]);
}
linphone_call_init_media_streams (call);
linphone_call_init_media_streams(call);
}
if (call->audiostream==NULL){
/*this happens after pausing the call locally. The streams are destroyed and then we wait the 200Ok to recreate them*/
linphone_call_init_media_streams (call);
if (call->audiostream == NULL) {
/* This happens after pausing the call locally. The streams are destroyed and then we wait the 200Ok to recreate them */
linphone_call_init_media_streams(call);
}
if (call->params->real_early_media && call->state==LinphoneCallOutgoingEarlyMedia){
if (call->params->real_early_media && (call->state == LinphoneCallOutgoingEarlyMedia)) {
prepare_early_media_forking(call);
}
linphone_call_start_media_streams(call, target_state);
if (call->state==LinphoneCallPausing && call->paused_by_app && bctbx_list_size(lc->calls)==1){
linphone_core_play_named_tone(lc,LinphoneToneCallOnHold);
if ((call->state == LinphoneCallPausing) && call->paused_by_app && (bctbx_list_size(lc->calls) == 1)) {
linphone_core_play_named_tone(lc, LinphoneToneCallOnHold);
}
linphone_call_update_frozen_payloads(call, new_md);
end:
if (oldmd)
sal_media_description_unref(oldmd);
end:
if (oldmd) sal_media_description_unref(oldmd);
}
#if 0
static bool_t is_duplicate_call(LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to){
bctbx_list_t *elem;
......@@ -476,7 +477,7 @@ static void call_ringing(SalOp *h){
linphone_call_set_state(call,LinphoneCallOutgoingEarlyMedia,"Early media");
linphone_core_stop_ringing(lc);
ms_message("Doing early media...");
linphone_core_update_streams(lc,call,md, call->state);
linphone_call_update_streams(call, md, call->state);
if ((linphone_call_params_get_audio_direction(linphone_call_get_current_params(call)) == LinphoneMediaDirectionInactive) && call->audiostream) {
if (lc->ringstream != NULL) return; /* Already ringing! */
start_remote_ring(lc, call);
......@@ -523,7 +524,7 @@ static void process_call_accepted(LinphoneCore *lc, LinphoneCall *call, SalOp *o
#ifdef BUILD_UPNP
if (call->upnp_session != NULL && rmd) {
linphone_core_update_upnp_from_remote_media_description(call, rmd);
linphone_call_update_upnp_from_remote_media_description(call, rmd);
}
#endif //BUILD_UPNP
......@@ -582,8 +583,8 @@ static void process_call_accepted(LinphoneCore *lc, LinphoneCall *call, SalOp *o
if (next_state != LinphoneCallIdle){
linphone_call_update_remote_session_id_and_ver(call);
linphone_core_update_ice_state_in_call_stats(call);
linphone_core_update_streams(lc, call, md, next_state);
linphone_call_update_ice_state_in_call_stats(call);
linphone_call_update_streams(call, md, next_state);
linphone_call_fix_call_parameters(call, rmd);
linphone_call_set_state(call, next_state, next_state_str);
}else{
......@@ -599,7 +600,7 @@ static void process_call_accepted(LinphoneCore *lc, LinphoneCall *call, SalOp *o
case LinphoneCallIncomingReceived:
case LinphoneCallIncomingEarlyMedia:
ms_error("Incompatible SDP answer received, need to abort the call");
linphone_core_abort_call(lc,call,_("Incompatible, check codecs or security settings..."));
linphone_call_abort(call, _("Incompatible, check codecs or security settings..."));
break;
/*otherwise we are able to resume previous state*/
default:
......@@ -641,7 +642,7 @@ static void call_accepted(SalOp *op){
static void call_resumed(LinphoneCore *lc, LinphoneCall *call){
linphone_core_notify_display_status(lc,_("We have been resumed."));
_linphone_core_accept_call_update(lc,call,NULL,LinphoneCallStreamsRunning,"Connected (streams running)");
_linphone_call_accept_update(call,NULL,LinphoneCallStreamsRunning,"Connected (streams running)");
}
static void call_paused_by_remote(LinphoneCore *lc, LinphoneCall *call){
......@@ -653,7 +654,7 @@ static void call_paused_by_remote(LinphoneCore *lc, LinphoneCall *call){
if (lp_config_get_int(lc->config, "sip", "inactive_video_on_pause", 0)) {
linphone_call_params_set_video_direction(params, LinphoneMediaDirectionInactive);
}
_linphone_core_accept_call_update(lc,call,params,LinphoneCallPausedByRemote,"Call paused by remote");
_linphone_call_accept_update(call,params,LinphoneCallPausedByRemote,"Call paused by remote");
linphone_call_params_unref(params);
}
......@@ -695,7 +696,7 @@ static void call_updated(LinphoneCore *lc, LinphoneCall *call, SalOp *op, bool_t
case LinphoneCallIncomingEarlyMedia:
if (is_update) {
linphone_call_set_state(call, LinphoneCallEarlyUpdatedByRemote, "EarlyUpdatedByRemote");
_linphone_core_accept_call_update(lc,call,NULL,call->prevstate,linphone_call_state_to_string(call->prevstate));
_linphone_call_accept_update(call,NULL,call->prevstate,linphone_call_state_to_string(call->prevstate));
}
break;
case LinphoneCallStreamsRunning:
......@@ -709,7 +710,7 @@ static void call_updated(LinphoneCore *lc, LinphoneCall *call, SalOp *op, bool_t
break;
case LinphoneCallPaused:
/*we'll remain in pause state but accept the offer anyway according to default parameters*/
_linphone_core_accept_call_update(lc,call,NULL,call->state,linphone_call_state_to_string(call->state));
_linphone_call_accept_update(call,NULL,call->state,linphone_call_state_to_string(call->state));
break;
case LinphoneCallUpdating:
case LinphoneCallPausing:
......@@ -908,7 +909,7 @@ static void call_failure(SalOp *op){
linphone_address_unref(call->log->to);
}
call->log->to = linphone_address_ref(redirection_to);
linphone_core_restart_invite(lc, call);
linphone_call_restart_invite(call);
return;
}
}
......@@ -941,19 +942,19 @@ static void call_failure(SalOp *op){
if (call->params->avpf_enabled == TRUE) {
if (i == 0) ms_message("Retrying call [%p] with SAVP", call);
call->params->avpf_enabled = FALSE;
linphone_core_restart_invite(lc, call);
linphone_call_restart_invite(call);
return;
} else if (!linphone_core_is_media_encryption_mandatory(lc)) {
if (i == 0) ms_message("Retrying call [%p] with AVP", call);
call->params->media_encryption = LinphoneMediaEncryptionNone;
memset(call->localdesc->streams[i].crypto, 0, sizeof(call->localdesc->streams[i].crypto));
linphone_core_restart_invite(lc, call);
linphone_call_restart_invite(call);
return;
}
} else if (call->params->avpf_enabled == TRUE) {
if (i == 0) ms_message("Retrying call [%p] with AVP", call);
call->params->avpf_enabled = FALSE;
linphone_core_restart_invite(lc, call);
linphone_call_restart_invite(call);
return;
}
}
......@@ -1216,7 +1217,7 @@ static void ping_reply(SalOp *op){
if (call){
if (call->state==LinphoneCallOutgoingInit){
call->ping_replied=TRUE;
linphone_core_proceed_with_invite_if_ready(call->core,call,NULL);
linphone_call_proceed_with_invite_if_ready(call, NULL);
}
}
else
......
......@@ -445,7 +445,7 @@ int LocalConference::removeFromConference(LinphoneCall *call, bool_t active){
linphone_call_params_unref(params);
} else{
ms_message("Pausing call to actually remove from conference");
err=_linphone_core_pause_call(m_core,call);
err=_linphone_call_pause(call);
}
return err;
}
......@@ -529,7 +529,7 @@ int LocalConference::enter() {
return -1;
}
if (m_core->current_call != NULL) {
_linphone_core_pause_call(m_core, m_core->current_call);
_linphone_call_pause(m_core->current_call);
}
if (m_localParticipantStream==NULL) addLocalEndpoint();
return 0;
......
This diff is collapsed.
This diff is collapsed.
......@@ -69,8 +69,12 @@ bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const LinphonePayloa
return FALSE;
}
bool_t linphone_core_payload_type_is_vbr(LinphoneCore *lc, const LinphonePayloadType *pt){
if (pt->type==PAYLOAD_VIDEO) return TRUE;
bool_t linphone_core_payload_type_is_vbr(LinphoneCore *lc, const LinphonePayloadType *pt) {
return linphone_payload_type_is_vbr(pt);
}
bool_t linphone_payload_type_is_vbr(const LinphonePayloadType *pt) {
if (pt->type == PAYLOAD_VIDEO) return TRUE;
return !!(pt->flags & PAYLOAD_TYPE_IS_VBR);
}
......@@ -85,12 +89,20 @@ int linphone_core_enable_payload_type(LinphoneCore *lc, LinphonePayloadType *pt,
return -1;
}
int linphone_core_get_payload_type_number(LinphoneCore *lc, const PayloadType *pt){
int linphone_core_get_payload_type_number(LinphoneCore *lc, const PayloadType *pt) {
return linphone_payload_type_get_number(pt);
}
int linphone_payload_type_get_number(const PayloadType *pt) {
return payload_type_get_number(pt);
}
void linphone_core_set_payload_type_number(LinphoneCore *lc, PayloadType *pt, int number){
payload_type_set_number(pt,number);
void linphone_core_set_payload_type_number(LinphoneCore *lc, PayloadType *pt, int number) {
linphone_payload_type_set_number(pt, number);
}
void linphone_payload_type_set_number(PayloadType *pt, int number) {
payload_type_set_number(pt, number);
}
const char *linphone_core_get_payload_type_description(LinphoneCore *lc, PayloadType *pt){
......@@ -772,8 +784,7 @@ const char *linphone_ice_state_to_string(LinphoneIceState state){
return "invalid";
}
void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call)
{
void linphone_call_update_ice_state_in_call_stats(LinphoneCall *call) {
IceCheckList *audio_check_list;
IceCheckList *video_check_list;
IceCheckList *text_check_list;
......@@ -891,7 +902,7 @@ void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call, SalMediaDes
}
}
linphone_core_update_ice_state_in_call_stats(call);
linphone_call_update_ice_state_in_call_stats(call);
}
void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session, bool_t use_nortpproxy) {
......
......@@ -414,7 +414,7 @@ const LinphoneAuthInfo *_linphone_core_find_tls_auth_info(LinphoneCore *lc);
const LinphoneAuthInfo *_linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username, const char *domain, bool_t ignore_realm);
void linphone_core_update_proxy_register(LinphoneCore *lc);
int linphone_core_abort_call(LinphoneCore *lc, LinphoneCall *call, const char *error);
int linphone_call_abort(LinphoneCall *call, const char *error);
const char *linphone_core_get_nat_address_resolved(LinphoneCore *lc);
int linphone_proxy_config_send_publish(LinphoneProxyConfig *cfg, LinphonePresenceModel *presence);
......@@ -532,7 +532,7 @@ void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, Linphone
int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call);
LINPHONE_PUBLIC void linphone_core_enable_forced_ice_relay(LinphoneCore *lc, bool_t enable);
LINPHONE_PUBLIC void linphone_core_enable_short_turn_refresh(LinphoneCore *lc, bool_t enable);
void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call);
void linphone_call_update_ice_state_in_call_stats(LinphoneCall *call);
LINPHONE_PUBLIC void linphone_call_stats_fill(LinphoneCallStats *stats, MediaStream *ms, OrtpEvent *ev);
void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call, SalMediaDescription *result);
void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session, bool_t use_nortpproxy);
......@@ -579,14 +579,14 @@ void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose);
void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float progresses);
void linphone_core_stop_waiting(LinphoneCore *lc);
int linphone_core_proceed_with_invite_if_ready(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy);
int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, const LinphoneAddress* destination/* = NULL if to be taken from the call log */);
int linphone_core_restart_invite(LinphoneCore *lc, LinphoneCall *call);
int linphone_call_proceed_with_invite_if_ready(LinphoneCall *call, LinphoneProxyConfig *dest_proxy);
int linphone_call_start_invite(LinphoneCall *call, const LinphoneAddress *destination/* = NULL if to be taken from the call log */);
int linphone_call_restart_invite(LinphoneCall *call);
/*
* param automatic_offering aims is to take into account previous answer for video in case of automatic re-invite.
* Purpose is to avoid to re-ask video previously declined */
int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call);
int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState next_state, const char *state_info);
int linphone_call_start_update(LinphoneCall *call);
int linphone_call_start_accept_update(LinphoneCall *call, LinphoneCallState next_state, const char *state_info);
void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call);
bool_t linphone_core_incompatible_security(LinphoneCore *lc, SalMediaDescription *md);
extern SalCallbacks linphone_sal_callbacks;
......@@ -946,7 +946,7 @@ LinphoneToneDescription *linphone_core_get_call_error_tone(const LinphoneCore *l
void linphone_core_play_call_error_tone(LinphoneCore *lc, LinphoneReason reason);
void _linphone_core_set_tone(LinphoneCore *lc, LinphoneReason reason, LinphoneToneID id, const char *audiofile);
LINPHONE_PUBLIC const char *linphone_core_get_tone_file(const LinphoneCore *lc, LinphoneToneID id);
int _linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params, LinphoneCallState next_state, const char *state_info);
int _linphone_call_accept_update(LinphoneCall *call, const LinphoneCallParams *params, LinphoneCallState next_state, const char *state_info);
typedef struct _LinphoneTaskList{
MSList *hooks;
......@@ -1148,7 +1148,7 @@ void linphone_call_make_local_media_description(LinphoneCall *call);
void linphone_call_make_local_media_description_with_params(LinphoneCore *lc, LinphoneCall *call, LinphoneCallParams *params);
void linphone_call_increment_local_media_description(LinphoneCall *call);
void linphone_call_fill_media_multicast_addr(LinphoneCall *call);
void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMediaDescription *new_md, LinphoneCallState target_state);
void linphone_call_update_streams(LinphoneCall *call, SalMediaDescription *new_md, LinphoneCallState target_state);
bool_t linphone_core_is_payload_type_usable_for_bandwidth(LinphoneCore *lc, const PayloadType *pt, int bandwidth_limit);
......@@ -1199,7 +1199,7 @@ void linphone_call_set_broken(LinphoneCall *call);
void linphone_call_repair_if_broken(LinphoneCall *call);
void linphone_core_repair_calls(LinphoneCore *lc);
int linphone_core_preempt_sound_resources(LinphoneCore *lc);
int _linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call);
int _linphone_call_pause(LinphoneCall *call);
/*conferencing subsystem*/
void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t muted);
......
......@@ -679,7 +679,7 @@ int linphone_upnp_context_send_remove_port_binding(UpnpContext *lupnp, UpnpPortB
* uPnP Core interfaces
*/
int linphone_core_update_upnp_audio_video(LinphoneCall *call, bool_t audio, bool_t video) {
int linphone_call_update_upnp_audio_video(LinphoneCall *call, bool_t audio, bool_t video) {
LinphoneCore *lc = call->core;
UpnpContext *lupnp = lc->upnp;
int ret = -1;
......@@ -725,7 +725,7 @@ int linphone_core_update_upnp_audio_video(LinphoneCall *call, bool_t audio, bool
int linphone_core_update_upnp_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md) {
int linphone_call_update_upnp_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md) {
bool_t audio = FALSE;
bool_t video = FALSE;
int i;
......@@ -741,14 +741,14 @@ int linphone_core_update_upnp_from_remote_media_description(LinphoneCall *call,
}
}
return linphone_core_update_upnp_audio_video(call, audio, video);
return linphone_call_update_upnp_audio_video(call, audio, video);
}
int linphone_core_update_upnp(LinphoneCore *lc, LinphoneCall *call) {
return linphone_core_update_upnp_audio_video(call, call->audiostream!=NULL, call->videostream!=NULL);
int linphone_call_update_upnp(LinphoneCall *call) {
return linphone_call_update_upnp_audio_video(call, call->audiostream!=NULL, call->videostream!=NULL);
}
void linphone_core_update_upnp_state_in_call_stats(LinphoneCall *call) {
void linphone_call_update_upnp_state_in_call_stats(LinphoneCall *call) {
call->stats[LINPHONE_CALL_STATS_AUDIO].upnp_state = call->upnp_session->audio->state;
call->stats[LINPHONE_CALL_STATS_VIDEO].upnp_state = call->upnp_session->video->state;
}
......@@ -799,7 +799,7 @@ int linphone_upnp_call_process(LinphoneCall *call) {
/*
* Update stat
*/
linphone_core_update_upnp_state_in_call_stats(call);
linphone_call_update_upnp_state_in_call_stats(call);
/*
* Update session state
......@@ -832,13 +832,13 @@ int linphone_upnp_call_process(LinphoneCall *call) {
switch (call->state) {
case LinphoneCallUpdating:
linphone_core_start_update_call(lc, call);
linphone_call_start_update(call);
break;
case LinphoneCallUpdatedByRemote:
linphone_core_start_accept_call_update(lc, call,call->prevstate,linphone_call_state_to_string(call->prevstate));
linphone_call_start_accept_update(call, call->prevstate, linphone_call_state_to_string(call->prevstate));
break;
case LinphoneCallOutgoingInit:
linphone_core_proceed_with_invite_if_ready(lc, call, NULL);
linphone_call_proceed_with_invite_if_ready(call, NULL);
break;
case LinphoneCallIdle:
linphone_call_update_local_media_description_from_ice_or_upnp(call);
......@@ -1056,7 +1056,7 @@ bool_t linphone_core_upnp_hook(void *data) {
return TRUE;
}
int linphone_core_update_local_media_description_from_upnp(SalMediaDescription *desc, UpnpSession *session) {
int linphone_call_update_local_media_description_from_upnp(SalMediaDescription *desc, UpnpSession *session) {
int i;
SalStreamDescription *stream;
UpnpStream *upnpStream;
......
......@@ -27,9 +27,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
typedef struct _UpnpSession UpnpSession;
typedef struct _UpnpContext UpnpContext;
int linphone_core_update_local_media_description_from_upnp(SalMediaDescription *desc, UpnpSession *session);
int linphone_core_update_upnp_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md);
int linphone_core_update_upnp(LinphoneCore *lc, LinphoneCall *call);
int linphone_call_update_local_media_description_from_upnp(SalMediaDescription *desc, UpnpSession *session);
int linphone_call_update_upnp_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md);
int linphone_call_update_upnp(LinphoneCall *call);
int linphone_upnp_call_process(LinphoneCall *call);
UpnpSession* linphone_upnp_session_new(LinphoneCall *call);
......@@ -43,6 +43,6 @@ LinphoneUpnpState linphone_upnp_context_get_state(UpnpContext *ctx);
const char *linphone_upnp_context_get_external_ipaddress(UpnpContext *ctx);
int linphone_upnp_context_get_external_port(UpnpContext *ctx);
bool_t linphone_upnp_context_is_ready_for_register(UpnpContext *ctx);
void linphone_core_update_upnp_state_in_call_stats(LinphoneCall *call);
void linphone_call_update_upnp_state_in_call_stats(LinphoneCall *call);
#endif //LINPHONE_UPNP_H
......@@ -352,6 +352,176 @@ LINPHONE_PUBLIC RtpTransport * linphone_call_get_meta_rtp_transport(LinphoneCall
**/
LINPHONE_PUBLIC RtpTransport * linphone_call_get_meta_rtcp_transport(LinphoneCall *call, int stream_index);
/**
* Pauses the call. If a music file has been setup using linphone_core_set_play_file(),
* this file will be played to the remote user.
* The only way to resume a paused call is to call linphone_call_resume().
* @param[in] call LinphoneCall object
* @return 0 on success, -1 on failure
* @see linphone_call_resume()
**/
LINPHONE_PUBLIC int linphone_call_pause(LinphoneCall *call);
/**
* Resumes a call.
* The call needs to have been paused previously with linphone_call_pause().
* @param[in] call LinphoneCall object
* @return 0 on success, -1 on failure
* @see linphone_call_pause()
**/
LINPHONE_PUBLIC int linphone_call_resume(LinphoneCall *call);
/**
* Terminates a call.
* @param[in] call LinphoneCall object
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC int linphone_call_terminate(LinphoneCall *call);
/**
* Redirect the specified call to the given redirect URI.
* @param[in] call A LinphoneCall object
* @param[in] redirect_uri The URI to redirect the call to
* @return 0 if successful, -1 on error.
*/
LINPHONE_PUBLIC int linphone_call_redirect(LinphoneCall *call, const char *redirect_uri);
/**
* Decline a pending incoming call, with a reason.
* @param[in] call A LinphoneCall object that must be in the IncomingReceived state
* @param[in] reason The reason for rejecting the call: LinphoneReasonDeclined or LinphoneReasonBusy
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC int linphone_call_decline(LinphoneCall * call, LinphoneReason reason);
/**
* Accept an incoming call.
*
* Basically the application is notified of incoming calls within the
* call_state_changed callback of the #LinphoneCoreVTable structure, where it will receive
* a LinphoneCallIncoming event with the associated LinphoneCall object.
* The application can later accept the call using this method.
* @param[in] call A LinphoneCall object
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC int linphone_call_accept(LinphoneCall *call);
/**
* Accept an incoming call, with parameters.
*
* Basically the application is notified of incoming calls within the
* call_state_changed callback of the #LinphoneCoreVTable structure, where it will receive
* a LinphoneCallIncoming event with the associated LinphoneCall object.
* The application can later accept the call using this method.
* @param[in] call A LinphoneCall object
* @param[in] params The specific parameters for this call, for example whether video is accepted or not. Use NULL to use default parameters
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC int linphone_call_accept_with_params(LinphoneCall *call, const LinphoneCallParams *params);
/**
* Accept an early media session for an incoming call.
* This is identical as calling linphone_call_accept_early_media_with_params() with NULL parameters.
* @param[in] call A LinphoneCall object
* @return 0 if successful, -1 otherwise
* @see linphone_call_accept_early_media_with_params()
**/
LINPHONE_PUBLIC int linphone_call_accept_early_media(LinphoneCall *call);
/**
* When receiving an incoming, accept to start a media session as early-media.
* This means the call is not accepted but audio & video streams can be established if the remote party supports early media.
* However, unlike after call acceptance, mic and camera input are not sent during early-media, though received audio & video are played normally.
* The call can then later be fully accepted using linphone_call_accept() or linphone_call_accept_with_params().
* @param[in] call A LinphoneCall object
* @param[in] params The call parameters to use (can be NULL)
* @return 0 if successful, -1 otherwise
**/
LINPHONE_PUBLIC int linphone_call_accept_early_media_with_params(LinphoneCall *call, const LinphoneCallParams *params);
/**
* Updates a running call according to supplied call parameters or parameters changed in the LinphoneCore.
* In this version this is limited to the following use cases:
* - setting up/down the video stream according to the video parameter of the LinphoneCallParams (see linphone_call_params_enable_video() ).
* - changing the size of the transmitted video after calling linphone_core_set_preferred_video_size()
* In case no changes are requested through the LinphoneCallParams argument, then this argument can be omitted and set to NULL.
* WARNING: Updating a call in the LinphoneCallPaused state will still result in a paused call even if the media directions set in the
* params are sendrecv. To resume a paused call, you need to call linphone_call_resume().
* @param[in] call A LinphoneCall update
* @param[in] params The new call parameters to use (may be NULL)
* @return 0 if successful, -1 otherwise.
**/
LINPHONE_PUBLIC int linphone_call_update(LinphoneCall *call, const LinphoneCallParams *params);
/**
* When receiving a #LinphoneCallUpdatedByRemote state notification, prevent LinphoneCore from performing an automatic answer.
*
* When receiving a #LinphoneCallUpdatedByRemote state notification (ie an incoming reINVITE), the default behaviour of
* LinphoneCore is defined by the "defer_update_default" option of the "sip" section of the config. If this option is 0 (the default)
* then the LinphoneCore automatically answers the reINIVTE with call parameters unchanged.
* However when for example when the remote party updated the call to propose a video stream, it can be useful
* to prompt the user before answering. This can be achieved by calling linphone_core_defer_call_update() during
* the call state notification, to deactivate the automatic answer that would just confirm the audio but reject the video.
* Then, when the user responds to dialog prompt, it becomes possible to call linphone_call_accept_update() to answer
* the reINVITE, with eventually video enabled in the LinphoneCallParams argument.
*
* The #LinphoneCallUpdatedByRemote notification can also arrive when receiving an INVITE without SDP. In such case, an unchanged offer is made
* in the 200Ok, and when the ACK containing the SDP answer is received, #LinphoneCallUpdatedByRemote is triggered to notify the application of possible
* changes in the media session. However in such case defering the update has no meaning since we just generating an offer.
*
* @param[in] call A LinphoneCall object
* @return 0 if successful, -1 if the linphone_call_defer_update() was done outside a valid #LinphoneCallUpdatedByRemote notification
**/
LINPHONE_PUBLIC int linphone_call_defer_update(LinphoneCall *call);
/**
* Accept call modifications initiated by other end.
*
* This call may be performed in response to a #LinphoneCallUpdatedByRemote state notification.
* When such notification arrives, the application can decide to call linphone_call_defer_update() so that it can
* have the time to prompt the user. linphone_call_get_remote_params() can be used to get information about the call parameters
* requested by the other party, such as whether a video stream is requested.
*