interface.conf: Verify that an rtp-bridge interface is also bridged
authorPeter Stuge <peter@stuge.se>
Wed, 2 Oct 2013 16:02:17 +0000 (18:02 +0200)
committerAndreas Eversberg <jolly@eversberg.eu>
Wed, 2 Oct 2013 16:12:02 +0000 (18:12 +0200)
RTP bridging only works when interfaces are bridged so we now check
that the interface has been configured as bridge upon seeing rtp-bridge
during parsing of interface.conf.

Note: This change requires that rtp-bridge appears after bridge for
the interface. If this makes your existing configuration fail because
rtp-bridge appears before the bridge parameter then please move the
rtp-bridge line below the bridge line.

interface.c

index d66bbe8..4cc978c 100644 (file)
@@ -1005,6 +1005,12 @@ static int inter_rtp_bridge(struct interface *interface, char *filename, int lin
                SPRINT(interface_error, "Error in %s (line %d): Interface does not support RTP\n", filename, line);
                return(-1);
        }
+
+       if (interface->app != EAPP_TYPE_BRIDGE) {
+               SPRINT(interface_error, "Error in %s (line %d): '%s' requires previous 'bridge' parameter.\n", filename, line, parameter);
+               return(-1);
+       }
+
        interface->rtp_bridge = 1;
 
        return(0);
@@ -1354,7 +1360,8 @@ struct interface_param interface_param[] = {
        "Give SIP configuration file."},
        {"rtp-bridge", &inter_rtp_bridge, "",
        "Enables RTP bridging directly from this interface.\n"
-       "This only works, if both ends support RTP. (like gsm-bs and sip)"},
+       "This only works if both bridged interfaces use RTP, e.g. between gsm-bs and sip.\n"
+       "This parameter must follow a 'bridge' parameter.\n"},
 #if 0
        not needed, since ms defines what is supports and remote (sip) tells what is selected
        {"rtp-payload", &inter_rtp_payload, "<codec>",