diff --git a/src/ua.c b/src/ua.c index a61fbd6ed3..cb1dd15996 100644 --- a/src/ua.c +++ b/src/ua.c @@ -714,10 +714,6 @@ void sipsess_conn_handler(const struct sip_msg *msg, void *arg) return; } - err = bevent_sip_msg_emit(UA_EVENT_SIPSESS_CONN, msg, ""); - if (err == ENOENT) - return; - /* handle multiple calls */ if (config->call.max_calls && uag_call_count() + 1 > config->call.max_calls) { @@ -758,6 +754,10 @@ void sipsess_conn_handler(const struct sip_msg *msg, void *arg) return; } + err = bevent_sip_msg_emit(UA_EVENT_SIPSESS_CONN, msg, ""); + if (err == ENOENT) + return; + (void)pl_strcpy(&msg->to.auri, to_uri, sizeof(to_uri)); err = ua_call_alloc(&call, ua, VIDMODE_ON, msg, NULL, to_uri, true);