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

Add parameter and API to allow ringing while in the incoming early media call state.

parent 083b3400
......@@ -120,7 +120,9 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
bool_t all_muted=FALSE;
bool_t send_ringbacktone=FALSE;
linphone_core_stop_ringing(lc);
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");
return;
......
......@@ -3258,7 +3258,6 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){
char *tmp;
LinphoneAddress *from_parsed;
bool_t propose_early_media=lp_config_get_int(lc->config,"sip","incoming_calls_early_media",FALSE);
const char *ringback_tone=linphone_core_get_remote_ringback_tone (lc);
from_parsed=linphone_address_new(sal_op_get_from(call->op));
linphone_address_clean(from_parsed);
......@@ -3298,7 +3297,7 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){
/*try to be best-effort in giving real local or routable contact address for 100Rel case*/
linphone_call_set_contact_op(call);
if (propose_early_media || ringback_tone!=NULL){
if (propose_early_media){
linphone_core_accept_early_media(lc,call);
}else sal_call_notify_ringing(call->op,FALSE);
......@@ -6500,9 +6499,6 @@ int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call)
return 0;
}
/**
* Specifies a ring back tone to be played to far end during incoming calls.
**/
void linphone_core_set_remote_ringback_tone(LinphoneCore *lc, const char *file){
if (lc->sound_conf.ringback_tone){
ms_free(lc->sound_conf.ringback_tone);
......@@ -6512,13 +6508,18 @@ void linphone_core_set_remote_ringback_tone(LinphoneCore *lc, const char *file){
lc->sound_conf.ringback_tone=ms_strdup(file);
}
/**
* Returns the ring back tone played to far end during incoming calls.
**/
const char *linphone_core_get_remote_ringback_tone(const LinphoneCore *lc){
return lc->sound_conf.ringback_tone;
}
void linphone_core_set_ring_during_incoming_early_media(LinphoneCore *lc, bool_t enable) {
lp_config_set_int(lc->config, "sound", "ring_during_incoming_early_media", (int)enable);
}
bool_t linphone_core_get_ring_during_incoming_early_media(const LinphoneCore *lc) {
return (bool_t)lp_config_get_int(lc->config, "sound", "ring_during_incoming_early_media", 0);
}
LinphonePayloadType* linphone_core_find_payload_type(LinphoneCore* lc, const char* type, int rate, int channels) {
LinphonePayloadType* result = find_payload_type_from_list(type, rate, channels, linphone_core_get_audio_codecs(lc));
if (result) {
......
......@@ -2672,9 +2672,36 @@ LINPHONE_PUBLIC const char *linphone_core_get_root_ca(LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_core_set_ringback(LinphoneCore *lc, const char *path);
LINPHONE_PUBLIC const char * linphone_core_get_ringback(const LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_core_set_remote_ringback_tone(LinphoneCore *lc,const char *);
/**
* Specify a ring back tone to be played to far end during incoming calls.
* @param[in] lc #LinphoneCore object
* @param[in] ring The path to the ring back tone to be played.
* @ingroup media_parameters
**/
LINPHONE_PUBLIC void linphone_core_set_remote_ringback_tone(LinphoneCore *lc, const char *ring);
/**
* Get the ring back tone played to far end during incoming calls.
* @param[in] lc #LinphoneCore object
* @ingroup media_parameters
**/
LINPHONE_PUBLIC const char *linphone_core_get_remote_ringback_tone(const LinphoneCore *lc);
/**
* Enable or disable the ring play during an incoming early media call.
* @param[in] lc #LinphoneCore object
* @param[in] enable A boolean value telling whether to enable ringing during an incoming early media call.
* @ingroup media_parameters
*/
LINPHONE_PUBLIC void linphone_core_set_ring_during_incoming_early_media(LinphoneCore *lc, bool_t enable);
/**
* Tells whether the ring play is enabled during an incoming early media call.
* @param[in] lc #LinphoneCore object
* @ingroup media_paramaters
*/
LINPHONE_PUBLIC bool_t linphone_core_get_ring_during_incoming_early_media(const LinphoneCore *lc);
LINPHONE_PUBLIC int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata);
LINPHONE_PUBLIC int linphone_core_play_local(LinphoneCore *lc, const char *audiofile);
LINPHONE_PUBLIC void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val);
......
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