1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-09-29 15:25:24 +00:00

sip: origin: get address on incoming call

This commit is contained in:
Evangelos Ribeiro Tzaras 2021-02-25 10:26:10 +01:00
parent 588f70f78a
commit c9949a5f9f

View file

@ -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);