From 19b4cee5800269931f756371dfd42501ff8ce46e Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sun, 28 Mar 2021 13:10:26 +0200 Subject: Updated libs --- src/libosmocc/endpoint.c | 17 +++++++++++++++-- src/libosmocc/screen.c | 2 +- src/libosmocc/sdp.c | 11 ++++++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/libosmocc/endpoint.c b/src/libosmocc/endpoint.c index 317efdb..e1d6027 100644 --- a/src/libosmocc/endpoint.c +++ b/src/libosmocc/endpoint.c @@ -1085,6 +1085,7 @@ static int osmo_cc_set_address(osmo_cc_endpoint_t *ep, const char *text) { const char **address_p, **host_p; uint16_t *port_p; + int local = 0; int rc; if (!strncasecmp(text, "local", 5)) { @@ -1098,6 +1099,7 @@ static int osmo_cc_set_address(osmo_cc_endpoint_t *ep, const char *text) address_p = &ep->local_address; host_p = &ep->local_host; port_p = &ep->local_port; + local = 1; } else if (!strncasecmp(text, "remote", 6)) { text += 6; /* remove spaces after keyword */ @@ -1137,6 +1139,17 @@ static int osmo_cc_set_address(osmo_cc_endpoint_t *ep, const char *text) *address_p = strdup(text); *host_p = strdup(*host_p); + if (local) { + enum osmo_cc_session_addrtype addrtype; + addrtype = osmo_cc_address_type(*host_p); + if (addrtype == osmo_cc_session_addrtype_unknown) { + PDEBUG(DCC, DEBUG_ERROR, "Given local address '%s' is invalid.\n", *host_p); + return -EINVAL; + } + osmo_cc_set_local_peer(osmo_cc_session_nettype_inet, addrtype, *host_p); + return 0; + } + return 0; } @@ -1149,8 +1162,8 @@ static void osmo_cc_help_rtp(void) printf("rtp-ports \n\n"); printf("These options can be used to alter the local IP and port range for RTP traffic.\n"); - printf("By default the local IPv4 loopback address is used. To connect interfaces\n"); - printf("between machines, local machine's IP must be given.\n\n"); + printf("By default the local peer is used, which is loopback by default. To connect\n"); + printf("interfaces, between machines, local machine's IP must be given.\n\n"); } static int osmo_cc_set_rtp(const char *text) diff --git a/src/libosmocc/screen.c b/src/libosmocc/screen.c index c8e17dc..5040ce6 100644 --- a/src/libosmocc/screen.c +++ b/src/libosmocc/screen.c @@ -578,7 +578,7 @@ osmo_cc_msg_t *osmo_cc_screen_msg(osmo_cc_endpoint_t *ep, osmo_cc_msg_t *old_msg } rc = osmo_cc_get_ie_redir(old_msg, 0, &redir_type, &redir_plan, &redir_present, &redir_screen, &redir_reason, id, sizeof(id)); if (rc >= 0) { - rc = osmo_cc_screen("incoming redirecting number", ep->screen_calling_in, &redir_type, &redir_present, redir, sizeof(redir), id, routing_p); + rc = osmo_cc_screen("incoming redirecting number", ep->screen_calling_in, &redir_type, &redir_present, redir, sizeof(redir), id, NULL); if (rc >= 0) redir_status = 1; } diff --git a/src/libosmocc/sdp.c b/src/libosmocc/sdp.c index 5afd3d6..0f8bca9 100644 --- a/src/libosmocc/sdp.c +++ b/src/libosmocc/sdp.c @@ -486,14 +486,14 @@ struct osmo_cc_session *osmo_cc_session_parsesdp(void *priv, const char *_sdp) } PDEBUG(DCC, DEBUG_DEBUG, " -> (rtpmap) payload type = %d\n", codec->payload_type_remote); if (!(word = wordsep(&next_word))) - break; + goto rtpmap_done; if ((p = strchr(word, '/'))) *p++ = '\0'; free((char *)codec->payload_name); // in case it is already set above codec->payload_name = strdup(word); PDEBUG(DCC, DEBUG_DEBUG, " -> (rtpmap) payload name = %s\n", codec->payload_name); if (!(word = p)) - break; + goto rtpmap_done; if ((p = strchr(word, '/'))) *p++ = '\0'; codec->payload_rate = atoi(word); @@ -502,10 +502,15 @@ struct osmo_cc_session *osmo_cc_session_parsesdp(void *priv, const char *_sdp) /* if no channel is given and no default was specified, we must set 1 channel */ if (!codec->payload_channels) codec->payload_channels = 1; - break; + goto rtpmap_done; } codec->payload_channels = atoi(word); PDEBUG(DCC, DEBUG_DEBUG, " -> (rtpmap) payload channels = %d\n", codec->payload_channels); + rtpmap_done: + if (!codec->payload_name || !codec->payload_rate || !codec->payload_channels) { + PDEBUG(DCC, DEBUG_NOTICE, "Broken 'rtpmap' definition in SDP line %d = '%s' Skipping codec!\n", line_no, line); + osmo_cc_free_codec(codec); + } } break; } -- cgit v1.2.3