bool_t send_ringbacktone=FALSE;
if (call->audiostream==NULL){
- /*this happens after pausing the call locally. The streams is destroyed and then we wait the 200Ok to recreate it*/
+ /*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->state==LinphoneCallIncomingEarlyMedia && linphone_core_get_remote_ringback_tone (lc)!=NULL){
}
linphone_call_start_media_streams(call,all_muted,send_ringbacktone);
}
+ if (call->state==LinphoneCallPausing && call->paused_by_app && ms_list_size(lc->calls)==1){
+ linphone_core_play_named_tone(lc,LinphoneToneCallOnHold);
+ }
}
#if 0
static bool_t is_duplicate_call(LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to){
} else if (sr == SalReasonBusy) {
call->reason=LinphoneReasonBusy;
linphone_call_set_state(call,LinphoneCallError,"User is busy.");
+ linphone_core_play_named_tone(lc,LinphoneToneBusy);
} else {
linphone_call_set_state(call,LinphoneCallError,msg);
}
}
if (call->state!=LinphoneCallPaused){
ms_message("Automatically pausing current call to accept transfer.");
- linphone_core_pause_call(lc,call);
+ _linphone_core_pause_call(lc,call);
call->was_automatically_paused=TRUE;
/*then we will start the refered when the pause is accepted, in order to serialize transactions within the dialog.
* Indeed we need to avoid to send a NOTIFY to inform about of state of the refered call while the pause isn't completed.
err=linphone_core_update_call(lc,call,&call->params);
} else{
ms_message("Pausing call to actually remove from conference");
- err=linphone_core_pause_call(lc,call);
+ err=_linphone_core_pause_call(lc,call);
}
return err;
return -1;
}
if (lc->current_call != NULL) {
- linphone_core_pause_call(lc, lc->current_call);
+ _linphone_core_pause_call(lc, lc->current_call);
}
LinphoneConference *conf=&lc->conf_ctx;
if (conf->local_participant==NULL) add_local_endpoint(conf,lc);
static void ecc_play_tones(EcCalibrator *ecc){
MSDtmfGenCustomTone tone;
MSToneDetectorDef expected_tone;
+
+ memset(&tone,0,sizeof(tone));
+ memset(&expected_tone,0,sizeof(expected_tone));
ms_filter_set_notify_callback(ecc->det,on_tone_received,ecc);
/*play an initial tone to startup the audio playback/capture*/
- tone.frequency=140;
+ tone.frequencies[0]=140;
tone.duration=1000;
tone.amplitude=0.5;
/* play the three tones*/
- tone.frequency=2000;
+ tone.frequencies[0]=2000;
tone.duration=100;
ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone);
ms_usleep(300000);
- tone.frequency=2300;
+ tone.frequencies[0]=2300;
tone.duration=100;
ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone);
ms_usleep(300000);
- tone.frequency=2500;
+ tone.frequencies[0]=2500;
tone.duration=100;
ms_filter_call_method(ecc->gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone);
ms_sleep(1);
if (from)
{
snprintf(temp,sizeof(temp),"Remote end %s seems to have disconnected, the call is going to be closed.",from);
- free(from);
+ ms_free(from);
}
else
{
if (lc->vtable.display_warning!=NULL)
lc->vtable.display_warning(lc,temp);
linphone_core_terminate_call(lc,call);
+ linphone_core_play_named_tone(lc,LinphoneToneCallFailed);
}
static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
ms_message("incoming call ringing for %i seconds",elapsed);
if (elapsed>lc->sip_conf.inc_timeout){
ms_message("incoming call timeout (%i)",lc->sip_conf.inc_timeout);
+ LinphoneReason decline_reason=lc->current_call ? LinphoneReasonBusy : LinphoneReasonDeclined;
call->log->status=LinphoneCallMissed;
call->reason=LinphoneReasonNotAnswered;
- linphone_core_terminate_call(lc,call);
+ linphone_core_decline_call(lc,call,decline_reason);
}
}
if (lc->sip_conf.in_call_timeout > 0 && elapsed>lc->sip_conf.in_call_timeout) {
}else{
/* else play a tone within the context of the current call */
call->ringing_beep=TRUE;
- linphone_core_play_tone(lc);
+ linphone_core_play_named_tone(lc,LinphoneToneCallWaiting);
}
linphone_call_set_state(call,LinphoneCallIncomingReceived,"Incoming call");
*
* @ingroup call_control
**/
-LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc)
-{
+LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc){
return lc->current_call;
}
*
* @ingroup call_control
**/
-int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call)
+int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call){
+ int err=_linphone_core_pause_call(lc,call);
+ if (err==0) call->paused_by_app=TRUE;
+ return err;
+}
+
+/* Internal version that does not play tone indication*/
+int _linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call)
{
const char *subject=NULL;
lc->vtable.display_status(lc,_("Pausing the current call..."));
if (call->audiostream || call->videostream)
linphone_call_stop_media_streams (call);
+ call->paused_by_app=FALSE;
return 0;
}
LinphoneCall *call=(LinphoneCall *)elem->data;
LinphoneCallState cs=linphone_call_get_state(call);
if (cs==LinphoneCallStreamsRunning || cs==LinphoneCallPausedByRemote){
- linphone_core_pause_call(lc,call);
+ _linphone_core_pause_call(lc,call);
}
}
return 0;
current_call=linphone_core_get_current_call(lc);
if(current_call != NULL){
ms_message("Pausing automatically the current call.");
- linphone_core_pause_call(lc,current_call);
+ _linphone_core_pause_call(lc,current_call);
+ }
+ if (lc->ringstream){
+ ring_stop(lc->ringstream);
+ lc->ringstream=NULL;
}
}
ms_error("No dtmf generator at this time !");
return;
}
+ memset(&def,0,sizeof(def));
def.duration=300;
- def.frequency=500;
+ def.frequencies[0]=500;
def.amplitude=1;
def.interval=2000;
ms_filter_call_method(f, MS_DTMF_GEN_PLAY_CUSTOM,&def);
}
+void linphone_core_play_named_tone(LinphoneCore *lc, LinphoneToneID toneid){
+ if (linphone_core_tone_indications_enabled(lc)){
+ MSFilter *f=get_dtmf_gen(lc);
+ MSDtmfGenCustomTone def;
+ if (f==NULL){
+ ms_error("No dtmf generator at this time !");
+ return;
+ }
+ memset(&def,0,sizeof(def));
+ def.amplitude=1;
+ /*these are french tones, excepted the failed one, which is USA congestion tone (does not exist in France)*/
+ switch(toneid){
+ case LinphoneToneCallOnHold:
+ case LinphoneToneCallWaiting:
+ def.duration=300;
+ def.frequencies[0]=440;
+ def.interval=2000;
+ break;
+ case LinphoneToneBusy:
+ def.duration=500;
+ def.frequencies[0]=440;
+ def.interval=500;
+ def.repeat_count=3;
+ break;
+ case LinphoneToneCallFailed:
+ def.duration=250;
+ def.frequencies[0]=480;
+ def.frequencies[0]=620;
+ def.interval=250;
+ def.repeat_count=3;
+
+ break;
+ default:
+ ms_warning("Unhandled tone id.");
+ }
+ if (def.duration>0)
+ ms_filter_call_method(f, MS_DTMF_GEN_PLAY_CUSTOM,&def);
+ }
+}
+
/**
* @ingroup media_parameters
*
if (pos2-pos1>=0){
/* found a pair key,value */
+
if (cur!=NULL){
LpItem *item=lp_section_find_item(cur,key);
if (item==NULL){
ms_free(item->value);
item->value=strdup(pos1);
}
- /*printf("Found %s %s={%s}\n",cur->name,key,pos1);*/
+ /*ms_message("Found %s=%s",key,pos1);*/
}else{
ms_warning("found key,item but no sections");
}
LpConfig * lp_config_new(const char *filename){
LpConfig *lpconfig=lp_new0(LpConfig,1);
if (filename!=NULL){
+ ms_message("Using (r/w) config information from %s", filename);
lpconfig->filename=ortp_strdup(filename);
lpconfig->file=fopen(filename,"rw");
if (lpconfig->file!=NULL){
int lp_config_read_file(LpConfig *lpconfig, const char *filename){
FILE* f=fopen(filename,"r");
if (f!=NULL){
+ ms_message("Reading config information from %s", filename);
lp_config_parse(lpconfig,f);
fclose(f);
return 0;
return ret;
}
+bool_t linphone_core_tone_indications_enabled(LinphoneCore*lc){
+ return lp_config_get_int(lc->config,"sound","tone_indications",1);
+}
#ifdef HAVE_GETIFADDRS
bool_t was_automatically_paused;
bool_t ping_replied;
bool_t record_active;
+ bool_t paused_by_app;
};
void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapsed);
void linphone_core_preempt_sound_resources(LinphoneCore *lc);
+int _linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call);
+
/*conferencing subsystem*/
void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t muted);
/* When a conference participant pause the conference he may send a music.
void linphone_core_message_storage_init(LinphoneCore *lc);
void linphone_core_message_storage_close(LinphoneCore *lc);
+typedef enum _LinphoneToneID{
+ LinphoneToneBusy,
+ LinphoneToneCallWaiting,
+ LinphoneToneCallOnHold,
+ LinphoneToneCallFailed
+}LinphoneToneID;
+void linphone_core_play_named_tone(LinphoneCore *lc, LinphoneToneID id);
+bool_t linphone_core_tone_indications_enabled(LinphoneCore*lc);
+
#ifdef __cplusplus
}
#endif
-Subproject commit 28c3383b5e98196ab394f6616f11c195e6759d28
+Subproject commit d1d3e1af51ab26ecb9808d6f83629e661c67af5f