From c9949a5f9ff4e142bb1176efce4a7d8ce1f75e4a Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Thu, 25 Feb 2021 10:26:10 +0100 Subject: [PATCH] sip: origin: get address on incoming call --- plugins/sip/calls-sip-origin.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/sip/calls-sip-origin.c b/plugins/sip/calls-sip-origin.c index 04ef97e..761eb1e 100644 --- a/plugins/sip/calls-sip-origin.c +++ b/plugins/sip/calls-sip-origin.c @@ -287,11 +287,22 @@ sip_callback (nua_event_t event, { CallsSipOrigin *origin = CALLS_SIP_ORIGIN (magic); CallsSipHandles *op = origin->oper; - const char * from = NULL; + g_autofree gchar * from = NULL; switch (event) { case nua_i_invite: - tl_gets (tags, SIPTAG_FROM_STR_REF (from), TAG_END ()); + if (sip->sip_from && sip->sip_from->a_url && + sip->sip_from->a_url->url_scheme && + sip->sip_from->a_url->url_user && + sip->sip_from->a_url->url_host) + from = g_strconcat (sip->sip_from->a_url->url_scheme, ":", + sip->sip_from->a_url->url_user, "@", + sip->sip_from->a_url->url_host, NULL); + else { + nua_respond (nh, 400, NULL, TAG_END ()); + g_warning ("invalid incoming INVITE request"); + break; + } g_debug ("incoming call INVITE: %03d %s from %s", status, phrase, from);