diff --git a/modules/multicast/multicast.c b/modules/multicast/multicast.c index af58c6d..4974b9d 100644 --- a/modules/multicast/multicast.c +++ b/modules/multicast/multicast.c @@ -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; @@ -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; @@ -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();