mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-11-04 23:51:17 +00:00
sip: sdp: Honour per media connections
Otherwise we might miss the IP of the remote peer leaving us unable to establish a connection for RTP. From https://datatracker.ietf.org/doc/html/rfc4566#section-5.7 A session description MUST contain either at least one "c=" field in each media description or a single "c=" field at the session level. It MAY contain a single session-level "c=" field and additional "c=" field(s) per media description, in which case the per-media values override the session-level settings for the respective media.
This commit is contained in:
parent
cf3face6cc
commit
929d76708a
1 changed files with 14 additions and 8 deletions
|
@ -513,25 +513,31 @@ sip_i_state (int status,
|
||||||
CALLS_EMIT_MESSAGE (origin, "DNS error", GTK_MESSAGE_ERROR);
|
CALLS_EMIT_MESSAGE (origin, "DNS error", GTK_MESSAGE_ERROR);
|
||||||
}
|
}
|
||||||
/* XXX making some assumptions about the received SDP message here...
|
/* XXX making some assumptions about the received SDP message here...
|
||||||
* namely: that there is only the session wide connection c= line
|
* namely: rtcp port = rtp port + 1
|
||||||
* and no individual connections per media stream.
|
|
||||||
* also: rtcp port = rtp port + 1
|
|
||||||
*/
|
*/
|
||||||
if (r_sdp) {
|
if (r_sdp) {
|
||||||
g_autoptr (GList) codecs =
|
g_autoptr (GList) codecs =
|
||||||
calls_sip_media_manager_get_codecs_from_sdp (origin->media_manager,
|
calls_sip_media_manager_get_codecs_from_sdp (origin->media_manager,
|
||||||
r_sdp->sdp_media);
|
r_sdp->sdp_media);
|
||||||
const char *remote_ip = NULL;
|
const char *session_ip = NULL;
|
||||||
if (r_sdp->sdp_connection && r_sdp->sdp_connection->c_address) {
|
const char *media_ip = NULL;
|
||||||
remote_ip = r_sdp->sdp_connection->c_address;
|
|
||||||
} else {
|
if (r_sdp->sdp_connection && r_sdp->sdp_connection->c_address)
|
||||||
|
session_ip = r_sdp->sdp_connection->c_address;
|
||||||
|
|
||||||
|
if (r_sdp->sdp_media && r_sdp->sdp_media->m_connections &&
|
||||||
|
r_sdp->sdp_media->m_connections->c_address)
|
||||||
|
media_ip = r_sdp->sdp_media->m_connections->c_address;
|
||||||
|
|
||||||
|
if (!session_ip && !media_ip) {
|
||||||
g_warning ("Could not determine IP of remote peer. Hanging up");
|
g_warning ("Could not determine IP of remote peer. Hanging up");
|
||||||
calls_call_hang_up (CALLS_CALL (call));
|
calls_call_hang_up (CALLS_CALL (call));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
calls_sip_call_set_codecs (call, codecs);
|
calls_sip_call_set_codecs (call, codecs);
|
||||||
calls_sip_call_setup_remote_media_connection (call,
|
calls_sip_call_setup_remote_media_connection (call,
|
||||||
remote_ip,
|
media_ip ? : session_ip,
|
||||||
r_sdp->sdp_media->m_port,
|
r_sdp->sdp_media->m_port,
|
||||||
r_sdp->sdp_media->m_port + 1);
|
r_sdp->sdp_media->m_port + 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue