Skip to content

Commit

Permalink
menu: a config flag for SIP MESSAGE tone
Browse files Browse the repository at this point in the history
  • Loading branch information
cspiel1 committed Nov 14, 2024
1 parent 4b8fdee commit ca99268
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/examples/config
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ video_selfview window # {window,pip}
#menu_max_earlyaudio 32
#menu_max_earlyvideo_rx 32
#menu_max_earlyvideo_tx 32
#menu_message_tone yes

# GTK
#gtk_clean_number no
Expand Down
8 changes: 6 additions & 2 deletions modules/menu/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -976,8 +976,10 @@ static void message_handler(struct ua *ua, const struct pl *peer,
ui_output(baresip_uis(), "\r%r: \"%b\"\n",
peer, mbuf_buf(body), mbuf_get_left(body));

(void)play_file(NULL, baresip_player(), "message.wav", 0,
cfg->audio.alert_mod, cfg->audio.alert_dev);
if (menu.message_tone) {
(void)play_file(NULL, baresip_player(), "message.wav", 0,
cfg->audio.alert_mod, cfg->audio.alert_dev);
}
}


Expand Down Expand Up @@ -1170,6 +1172,7 @@ static int module_init(void)
menu.clean_number = false;
menu.play = NULL;
menu.adelay = -1;
menu.message_tone = true;
err = odict_alloc(&menu.ovaufile, 8);
if (err)
return err;
Expand All @@ -1180,6 +1183,7 @@ static int module_init(void)
conf_get_bool(conf_cur(), "ringback_disabled",
&menu.ringback_disabled);
conf_get_bool(conf_cur(), "menu_clean_number", &menu.clean_number);
conf_get_bool(conf_cur(), "menu_message_tone", &menu.message_tone);

if (0 == conf_get(conf_cur(), "redial_attempts", &val) &&
0 == pl_strcasecmp(&val, "inf")) {
Expand Down
1 change: 1 addition & 0 deletions modules/menu/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct menu{
struct tmr tmr_play; /**< Tones play timer */
size_t outcnt; /**< Outgoing call counter */
bool dnd; /**< Do not disturb flag */
bool message_tone; /**< Play tone for SIP MESSAGE */
};

/*Get menu object*/
Expand Down
1 change: 1 addition & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,7 @@ int config_write_template(const char *file, const struct config *cfg)
"#menu_max_earlyaudio\t32\n"
"#menu_max_earlyvideo_rx\t32\n"
"#menu_max_earlyvideo_tx\t32\n"
"#menu_message_tone\tyes\n"
);

(void)re_fprintf(f,
Expand Down

0 comments on commit ca99268

Please sign in to comment.