summaryrefslogtreecommitdiff
path: root/modules/menu
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2016-09-04 10:49:41 +0200
committerAlfred E. Heggestad <aeh@db.org>2016-09-04 10:49:41 +0200
commit8abcfeb1486a093a07360c63ea65958e3daaa57d (patch)
treee1bdfe78788ce83ff94f08d8ebc537d69bd8c561 /modules/menu
parent1939f2d3ec202c27b43cf6c2350d0b1cd2f6933c (diff)
play: make it re-entrant, add struct player
Diffstat (limited to 'modules/menu')
-rw-r--r--modules/menu/menu.c17
1 files changed, 11 insertions, 6 deletions
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);
}