Commit 3d923a87 authored by Benjamin REIS's avatar Benjamin REIS

play call_error tone on play_sndcard instead of rinf_sndcard

parent dde2e300
......@@ -3483,7 +3483,7 @@ static void linphone_transfer_routes_to_op(bctbx_list_t *routes, SalOp *op){
void linphone_configure_op_with_proxy(LinphoneCore *lc, SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact, LinphoneProxyConfig *proxy){
bctbx_list_t *routes=NULL;
const char *identity;
if (proxy){
identity=linphone_proxy_config_get_identity(proxy);
if (linphone_proxy_config_get_privacy(proxy)!=LinphonePrivacyDefault) {
......@@ -3504,7 +3504,7 @@ void linphone_configure_op_with_proxy(LinphoneCore *lc, SalOp *op, const Linphon
} else {
sal_op_set_to_address(op,dest);
}
sal_op_set_from(op,identity);
sal_op_set_sent_custom_header(op,headers);
sal_op_set_realm(op,linphone_proxy_config_get_realm(proxy));
......@@ -5623,7 +5623,7 @@ typedef enum{
LinphoneLocalPlayer
}LinphoneAudioResourceType;
static MSFilter *get_audio_resource(LinphoneCore *lc, LinphoneAudioResourceType rtype){
static MSFilter *get_audio_resource(LinphoneCore *lc, LinphoneAudioResourceType rtype, MSSndCard *card){
LinphoneCall *call=linphone_core_get_current_call(lc);
AudioStream *stream=NULL;
RingStream *ringstream;
......@@ -5637,9 +5637,17 @@ static MSFilter *get_audio_resource(LinphoneCore *lc, LinphoneAudioResourceType
if (rtype==LinphoneLocalPlayer) return stream->local_player;
return NULL;
}
if (lc->ringstream==NULL){
if (card || lc->ringstream == NULL) {
if (lc->ringstream)
ring_stop(lc->ringstream);
float amp=lp_config_get_float(lc->config,"sound","dtmf_player_amp",0.1f);
MSSndCard *ringcard=lc->sound_conf.lsd_card ?lc->sound_conf.lsd_card : lc->sound_conf.ring_sndcard;
MSSndCard *ringcard=lc->sound_conf.lsd_card
? lc->sound_conf.lsd_card
: card
? card
: lc->sound_conf.ring_sndcard;
if (ringcard == NULL)
return NULL;
......@@ -5656,12 +5664,15 @@ static MSFilter *get_audio_resource(LinphoneCore *lc, LinphoneAudioResourceType
return NULL;
}
static MSFilter *get_dtmf_gen(LinphoneCore *lc){
return get_audio_resource(lc,LinphoneToneGenerator);
static MSFilter *get_dtmf_gen(LinphoneCore *lc, MSSndCard *card){
return get_audio_resource(lc, LinphoneToneGenerator, card);
}
void linphone_core_play_dtmf(LinphoneCore *lc, char dtmf, int duration_ms){
MSFilter *f=get_dtmf_gen(lc);
MSSndCard *card = linphone_core_in_call(lc)
? lc->sound_conf.play_sndcard
: lc->sound_conf.ring_sndcard;
MSFilter *f=get_dtmf_gen(lc, card);
if (f==NULL){
ms_error("No dtmf generator at this time !");
return;
......@@ -5672,8 +5683,8 @@ void linphone_core_play_dtmf(LinphoneCore *lc, char dtmf, int duration_ms){
else ms_filter_call_method(f, MS_DTMF_GEN_START, &dtmf);
}
LinphoneStatus linphone_core_play_local(LinphoneCore *lc, const char *audiofile){
MSFilter *f=get_audio_resource(lc,LinphoneLocalPlayer);
LinphoneStatus _linphone_core_play_local(LinphoneCore *lc, const char *audiofile, MSSndCard *card){
MSFilter *f=get_audio_resource(lc,LinphoneLocalPlayer, card);
int loopms=-1;
if (!f) return -1;
ms_filter_call_method(f,MS_PLAYER_SET_LOOP,&loopms);
......@@ -5684,11 +5695,15 @@ LinphoneStatus linphone_core_play_local(LinphoneCore *lc, const char *audiofile)
return 0;
}
LinphoneStatus linphone_core_play_local(LinphoneCore *lc, const char *audiofile){
return _linphone_core_play_local(lc, audiofile, NULL);
}
void linphone_core_play_named_tone(LinphoneCore *lc, LinphoneToneID toneid){
if (linphone_core_tone_indications_enabled(lc)){
const char *audiofile=linphone_core_get_tone_file(lc,toneid);
if (!audiofile){
MSFilter *f=get_dtmf_gen(lc);
MSFilter *f=get_dtmf_gen(lc, lc->sound_conf.play_sndcard);
MSDtmfGenCustomTone def;
if (f==NULL){
ms_error("No dtmf generator at this time !");
......@@ -5724,7 +5739,7 @@ void linphone_core_play_named_tone(LinphoneCore *lc, LinphoneToneID toneid){
if (def.duration>0)
ms_filter_call_method(f, MS_DTMF_GEN_PLAY_CUSTOM,&def);
}else{
linphone_core_play_local(lc,audiofile);
_linphone_core_play_local(lc,audiofile, lc->sound_conf.play_sndcard);
}
}
}
......@@ -5734,16 +5749,16 @@ void linphone_core_play_call_error_tone(LinphoneCore *lc, LinphoneReason reason)
LinphoneToneDescription *tone=linphone_core_get_call_error_tone(lc,reason);
if (tone){
if (tone->audiofile){
linphone_core_play_local(lc,tone->audiofile);
_linphone_core_play_local(lc, tone->audiofile, lc->sound_conf.play_sndcard);
}else if (tone->toneid != LinphoneToneUndefined){
linphone_core_play_named_tone(lc,tone->toneid);
linphone_core_play_named_tone(lc, tone->toneid);
}
}
}
}
void linphone_core_stop_dtmf(LinphoneCore *lc){
MSFilter *f=get_dtmf_gen(lc);
MSFilter *f=get_dtmf_gen(lc, NULL);
if (f!=NULL)
ms_filter_call_method_noarg (f, MS_DTMF_GEN_STOP);
}
......@@ -6490,7 +6505,7 @@ bool_t linphone_core_keep_alive_enabled(LinphoneCore* lc) {
}
void linphone_core_start_dtmf_stream(LinphoneCore* lc) {
get_dtmf_gen(lc); /*make sure ring stream is started*/
get_dtmf_gen(lc, lc->sound_conf.ring_sndcard); /*make sure ring stream is started*/
lc->ringstream_autorelease=FALSE; /*disable autorelease mode*/
}
......
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