From 8abcfeb1486a093a07360c63ea65958e3daaa57d Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sun, 4 Sep 2016 10:49:41 +0200 Subject: play: make it re-entrant, add struct player --- modules/menu/menu.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'modules/menu') diff --git a/modules/menu/menu.c b/modules/menu/menu.c index 0366471..66d6894 100644 --- a/modules/menu/menu.c +++ b/modules/menu/menu.c @@ -827,6 +827,8 @@ static void redial_handler(void *arg) static void ua_event_handler(struct ua *ua, enum ua_event ev, struct call *call, const char *prm, void *arg) { + struct player *player = baresip_player(); + (void)call; (void)prm; (void)arg; @@ -851,12 +853,13 @@ static void ua_event_handler(struct ua *ua, enum ua_event ev, if (ANSWERMODE_MANUAL == account_answermode(ua_account(ua))) { if (list_count(ua_calls(ua)) > 1) { - (void)play_file(&menu.play, + (void)play_file(&menu.play, player, "callwaiting.wav", 3); } else { /* Alert user */ - (void)play_file(&menu.play, "ring.wav", -1); + (void)play_file(&menu.play, player, + "ring.wav", -1); } if (menu.bell) @@ -868,7 +871,7 @@ static void ua_event_handler(struct ua *ua, enum ua_event ev, /* stop any ringtones */ menu.play = mem_deref(menu.play); - (void)play_file(&menu.play, "ringback.wav", -1); + (void)play_file(&menu.play, player, "ringback.wav", -1); break; case UA_EVENT_CALL_ESTABLISHED: @@ -889,8 +892,10 @@ static void ua_event_handler(struct ua *ua, enum ua_event ev, if (call_scode(call)) { const char *tone; tone = translate_errorcode(call_scode(call)); - if (tone) - (void)play_file(&menu.play, tone, 1); + if (tone) { + (void)play_file(&menu.play, player, + tone, 1); + } } alert_stop(); @@ -950,7 +955,7 @@ static void message_handler(const struct pl *peer, const struct pl *ctype, (void)re_fprintf(stderr, "\r%r: \"%b\"\n", peer, mbuf_buf(body), mbuf_get_left(body)); - (void)play_file(NULL, "message.wav", 0); + (void)play_file(NULL, baresip_player(), "message.wav", 0); } -- cgit v1.2.3