Skip to content

Commit

Permalink
mc: move dnd to mc and fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
cspiel1 committed Sep 12, 2024
1 parent acbe263 commit aca9d80
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions modules/multicast/multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,19 +724,23 @@ static const struct cmd cmdv[] = {
};


static void ua_event_handler(struct ua *ua, enum ua_event ev,
struct call *call, const char *prm, void *arg)
static void event_handler(enum ua_event ev, struct bevent *event, void *arg)
{
(void)ua;
(void)prm;
(void)arg;
const struct sip_msg *msg = bevent_get_msg(event);

switch (ev) {

case UA_EVENT_CALL_ARRIVED:
if (mc.dnd)
call_set_rejected(call, 480,
"Temporarily Unavailable");
case UA_EVENT_SIPSESS_CONN:
if (mc.dnd) {
(void)sip_treply(NULL, uag_sip(), msg, 480,
"Temporarily Unavailable");
info("menu: incoming call from %r <%r> rejected: "
"480 Temporarily Unavailable\n",
&msg->from.dname, &msg->from.auri);
bevent_stop(event);
break;
}

break;

Expand All @@ -752,7 +756,7 @@ static int module_init(void)

err = module_read_config();
err |= cmd_register(baresip_commands(), cmdv, RE_ARRAY_SIZE(cmdv));
err |= uag_event_register(ua_event_handler, NULL);
err |= bevent_register(event_handler, NULL);
if (err)
return err;

Expand All @@ -771,7 +775,7 @@ static int module_close(void)
mcsender_stopall();
mcreceiver_unregall();

uag_event_unregister(ua_event_handler);
bevent_unregister(event_handler);
cmd_unregister(baresip_commands(), cmdv);

mcsource_terminate();
Expand Down

0 comments on commit aca9d80

Please sign in to comment.