Adding handling of bad GSM audio frames
[lcr.git] / interface.c
index 60e058f..ca569be 100644 (file)
@@ -1072,16 +1072,25 @@ static int inter_remote(struct interface *interface, char *filename, int line, c
        ifport->remote = 1;
        SCPY(ifport->remote_app, value);
 
-
        return(0);
 }
-
 static int inter_shutdown(struct interface *interface, char *filename, int line, char *parameter, char *value)
 {
        interface->shutdown = 1;
 
        return(0);
 }
+static int inter_bridge(struct interface *interface, char *filename, int line, char *parameter, char *value)
+{
+       if (!value || !value[0]) {
+               SPRINT(interface_error, "Error in %s (line %d): Missing destination interface name.\n", filename, line);
+               return(-1);
+       }
+       interface->app = EAPP_TYPE_BRIDGE;
+       SCPY(interface->bridge_if, value);
+
+       return(0);
+}
 
 
 /*
@@ -1230,6 +1239,10 @@ struct interface_param interface_param[] = {
        "Prevents sending notify messages to this interface. A call placed on hold will\n"
        "Not affect the remote end (phone or telcom switch).\n"
        "This parameter must follow a 'port' parameter."},
+       {"bridge", &inter_bridge, "<destination interface>",
+       "Define bridge application for this interface. All calls received on this\n"
+       "interface will be directly bridged to the given destination interface.\n"
+       "There will be no PBX application, nor routing."},
 
 #ifdef WITH_SS5
        {"ccitt5", &inter_ss5, "[<feature> [feature ...]]",
@@ -1686,11 +1699,7 @@ void do_screen(int out, char *id, int idsize, int *type, int *present, const cha
        char suffix[64];
        struct interface *interface = interface_first;
 
-       while (interface) {
-               if (!strcmp(interface->name, interface_name))
-                       break;
-               interface = interface->next;
-       }
+       interface = getinterfacebyname(interface_name);
        if (!interface)
                return;
 
@@ -1817,3 +1826,16 @@ void do_screen(int out, char *id, int idsize, int *type, int *present, const cha
        }
 }
 
+struct interface *getinterfacebyname(const char *name)
+{
+       struct interface *interface = interface_first;
+
+       while (interface) {
+               if (!strcmp(interface->name, name))
+                       return interface;
+               interface = interface->next;
+       }
+
+       return NULL;
+}
+