--- ./po/fr.po 2017-07-21 07:36:30.000000000 +0000 +++ ../linphone-3.12.0-distinctive/./po/fr.po 2020-11-14 14:20:12.842623011 +0000 @@ -1319,6 +1319,14 @@ msgstr "Gérer mes comptes SIP" msgid "Ring sound:" msgstr "Sonnerie:" +#: parameters.ui:940 +msgid "Distinctive ring sound:" +msgstr "Sonnerie distinctive:" + +#: parameters.ui:1113 +msgid "Disable call waiting beep" +msgstr "Désactiver la tonalité d'appel en attente" + #: ../gtk/parameters.ui.h:32 msgid "ALSA special device (optional):" msgstr "Appareil ALSA spécifique (optionnel) :" --- ./include/linphone/core.h 2017-07-21 07:36:30.000000000 +0000 +++ ../linphone-3.12.0-distinctive/./include/linphone/core.h 2020-11-13 09:13:51.813178286 +0000 @@ -2877,6 +2877,38 @@ LINPHONE_PUBLIC void linphone_core_set_r LINPHONE_PUBLIC const char *linphone_core_get_ring(const LinphoneCore *lc); /** + * Sets the path to a wav file used for distinctive ringing. The file must be a wav 16bit linear. Local ring is disabled if null. + * @param[in] lc LinphoneCore object + * @param[in] path The path to a wav file to be used for ringing + * @ingroup media_parameters +**/ +LINPHONE_PUBLIC void linphone_core_set_distinctive_ring(LinphoneCore *lc, const char *path); + +/** + * Returns the path to the wav file used for distinctive ringing. + * @param[in] lc LinphoneCore object + * @return The path to the wav file used for ringing + * @ingroup media_parameters +**/ +LINPHONE_PUBLIC const char *linphone_core_get_distinctive_ring(const LinphoneCore *lc); + +/** + * Sets the no call waiting flag + * @param[in] lc LinphoneCore object + * @param[in] yesno nonzero to set + * @ingroup media_parameters +**/ +LINPHONE_PUBLIC void linphone_core_set_no_call_waiting(LinphoneCore *lc, int no_call_waiting); + +/** + * Returns the no call waiting flag + * @param[in] lc LinphoneCore object + * @return The path to the wav file used for ringing + * @ingroup media_parameters +**/ +LINPHONE_PUBLIC bool_t linphone_core_get_no_call_waiting(const LinphoneCore *lc); + +/** * Specify whether the tls server certificate must be verified when connecting to a SIP/TLS server. * @param[in] lc LinphoneCore object * @param[in] yesno A boolean value telling whether the tls server certificate must be verified --- ./coreapi/linphonecore.c 2017-07-21 07:36:30.000000000 +0000 +++ ../linphone-3.12.0-distinctive/./coreapi/linphonecore.c 2020-11-13 11:14:08.074796480 +0000 @@ -1192,6 +1192,17 @@ static void sound_config_read(LinphoneCo bctbx_free(default_local_ring); } + tmpbuf = lp_config_get_string(lc->config, "sound", "distinctive_ring", NULL); + if (tmpbuf) { + if (bctbx_file_exist(tmpbuf) == 0) { + linphone_core_set_distinctive_ring(lc, tmpbuf); + } else { + ms_warning("'%s' ring file does not exist", tmpbuf); + } + } + + linphone_core_set_no_call_waiting (lc, lp_config_get_int(lc->config, "sound", "no_call_waiting", 0)); + default_remote_ring = bctbx_strdup_printf("%s/%s", linphone_factory_get_sound_resources_dir(factory), REMOTE_RING_WAV); tmpbuf = default_remote_ring; tmpbuf = lp_config_get_string(lc->config, "sound", "remote_ring", tmpbuf); @@ -3659,18 +3670,30 @@ void linphone_core_notify_incoming_call( linphone_core_notify_show_interface(lc); linphone_core_notify_display_status(lc,barmesg); + /* play the ring if this is the only call*/ if (bctbx_list_size(lc->calls)==1){ MSSndCard *ringcard=lc->sound_conf.lsd_card ?lc->sound_conf.lsd_card : lc->sound_conf.ring_sndcard; + char const *ringtone = lc->sound_conf.local_ring; lc->current_call=call; + if (lc->sound_conf.distinctive_ring) { + char const *alert = sal_custom_header_find ( + ((SalOpBase *)call->op)->recv_custom_headers, "alert-info"); + + // should check value of alert for ringer + if (alert) { + ringtone = lc->sound_conf.distinctive_ring; + } + } if (lc->ringstream && lc->dmfs_playing_start_time!=0){ linphone_core_stop_dtmf_stream(lc); } - linphone_ringtoneplayer_start(lc->factory, lc->ringtoneplayer, ringcard, lc->sound_conf.local_ring, 2000); + linphone_ringtoneplayer_start(lc->factory, lc->ringtoneplayer, ringcard, ringtone, 2000); }else{ /* else play a tone within the context of the current call */ call->ringing_beep=TRUE; - linphone_core_play_named_tone(lc,LinphoneToneCallWaiting); + if (!lc->sound_conf.no_call_waiting) + linphone_core_play_named_tone(lc,LinphoneToneCallWaiting); } linphone_call_set_state(call,LinphoneCallIncomingReceived,"Incoming call"); @@ -4329,6 +4352,31 @@ const char *linphone_core_get_ring(const return lc->sound_conf.local_ring; } +void linphone_core_set_distinctive_ring(LinphoneCore *lc,const char *path){ + if (lc->sound_conf.distinctive_ring!=0){ + ms_free(lc->sound_conf.distinctive_ring); + lc->sound_conf.distinctive_ring=NULL; + } + if (path) + lc->sound_conf.distinctive_ring=ms_strdup(path); + if ( linphone_core_ready(lc) && lc->sound_conf.distinctive_ring) + lp_config_set_string(lc->config,"sound","distinctive_ring",lc->sound_conf.distinctive_ring); +} + +const char *linphone_core_get_distinctive_ring(const LinphoneCore *lc){ + return lc->sound_conf.distinctive_ring; +} + +void linphone_core_set_no_call_waiting(LinphoneCore *lc,int no_call_waiting) { + lc->sound_conf.no_call_waiting = !!no_call_waiting; + if ( linphone_core_ready(lc)) + lp_config_set_int(lc->config,"sound","no_call_waiting",no_call_waiting); +} + +bool_t linphone_core_get_no_call_waiting(const LinphoneCore *lc){ + return !!lc->sound_conf.no_call_waiting; +} + void linphone_core_set_root_ca(LinphoneCore *lc, const char *path) { sal_set_root_ca(lc->sal, path); if (lc->http_crypto_config) { --- ./coreapi/private.h 2017-07-21 07:36:30.000000000 +0000 +++ ../linphone-3.12.0-distinctive/./coreapi/private.h 2020-11-13 09:14:42.029435423 +0000 @@ -919,8 +919,10 @@ typedef struct sound_config char ring_lev; char source; char *local_ring; + char *distinctive_ring; char *remote_ring; char *ringback_tone; + bool_t no_call_waiting; bool_t ec; bool_t ea; bool_t agc; --- ./gtk/linphone.h 2017-07-21 07:36:30.000000000 +0000 +++ ../linphone-3.12.0-distinctive/./gtk/linphone.h 2020-11-13 12:10:27.410643251 +0000 @@ -325,6 +325,7 @@ LINPHONE_PUBLIC void linphone_gtk_captur LINPHONE_PUBLIC void linphone_gtk_ring_device_changed(GtkWidget *w); LINPHONE_PUBLIC void linphone_gtk_playback_device_changed(GtkWidget *w); LINPHONE_PUBLIC void linphone_gtk_echo_cancelation_toggled(GtkWidget *w); +LINPHONE_PUBLIC void linphone_gtk_no_call_waiting_toggled(GtkWidget *w); LINPHONE_PUBLIC void linphone_gtk_cam_changed(GtkWidget *w); LINPHONE_PUBLIC void linphone_gtk_video_size_changed(GtkWidget *w); LINPHONE_PUBLIC void linphone_gtk_video_renderer_changed(GtkWidget *w); --- ./gtk/propertybox.c 2017-07-21 07:36:30.000000000 +0000 +++ ../linphone-3.12.0-distinctive/./gtk/propertybox.c 2020-11-13 12:31:04.870233381 +0000 @@ -522,6 +522,12 @@ void linphone_gtk_ring_file_set(GtkWidge g_free(file); } +void linphone_gtk_distinctive_file_set(GtkWidget *w){ + gchar *file=gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(w)); + linphone_core_set_distinctive_ring(linphone_gtk_get_core(),file); + g_free(file); +} + static void linphone_gtk_end_of_ring(LinphoneCore *lc, void *user_data){ gtk_widget_set_sensitive((GtkWidget*)user_data,TRUE); } @@ -535,11 +541,25 @@ void linphone_gtk_play_ring_file(GtkWidg } } +void linphone_gtk_play_distinctive_file(GtkWidget *w){ + if (linphone_core_preview_ring(linphone_gtk_get_core(), + linphone_core_get_distinctive_ring(linphone_gtk_get_core()), + linphone_gtk_end_of_ring, + w)==0){ + gtk_widget_set_sensitive(w,FALSE); + } +} + void linphone_gtk_echo_cancelation_toggled(GtkWidget *w){ linphone_core_enable_echo_cancellation(linphone_gtk_get_core(), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); } +void linphone_gtk_no_call_waiting_toggled(GtkWidget *w){ + linphone_core_set_no_call_waiting(linphone_gtk_get_core(), + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); +} + enum { CODEC_NAME, CODEC_RATE, @@ -1701,9 +1721,12 @@ void linphone_gtk_show_parameters(void){ #endif gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"echo_cancelation")), linphone_core_echo_cancellation_enabled(lc)); - + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"no_call_waiting")), + linphone_core_get_no_call_waiting(lc)); gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(linphone_gtk_get_widget(pb,"ring_chooser")), linphone_core_get_ring(lc)); + gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(linphone_gtk_get_widget(pb,"distinctive_chooser")), + linphone_core_get_distinctive_ring(lc)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"adaptive_rate_control")), linphone_core_adaptive_rate_control_enabled(lc)); /* SIP CONFIG */ --- ./gtk/parameters.ui 2017-07-21 07:36:30.000000000 +0000 +++ ../linphone-3.12.0-distinctive/./gtk/parameters.ui 2020-11-14 13:54:34.218057264 +0000 @@ -827,7 +827,7 @@ True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 6 + 8 2 @@ -890,6 +890,63 @@ + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + True + True + 0 + + + + + gtk-media-play + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + + + + True + True + 1 + + + + + 1 + 2 + 5 + 6 + GTK_FILL + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Distinctive ring sound: + right + + + 5 + 6 + GTK_FILL + + + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -1047,8 +1104,24 @@ 1 2 - 5 - 6 + 6 + 7 + + + + + Disable call waiting beep + True + True + False + True + + + + 1 + 2 + 7 + 8