summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README6
-rw-r--r--apppbx.cpp18
-rw-r--r--default/interface.conf8
-rw-r--r--interface.c23
-rw-r--r--interface.h1
5 files changed, 50 insertions, 6 deletions
diff --git a/README b/README
index 4331faf..5496175 100644
--- a/README
+++ b/README
@@ -513,8 +513,12 @@ Changes after Version 1.5
New release Version 1.6
-Changes after Version 1.5
+Changes after Version 1.6
- Fixed bad call/conference bug in joinpbx.c
+- External interfaces must now be specified using 'extern' keyword.
+ -> This prevents from selecting other interfaces when dialing out.
+ -> Just add 'extern' right below your external interface, or define
+ external interface name in routing.conf: ": extern interfaces=XXXXX"
diff --git a/apppbx.cpp b/apppbx.cpp
index 2a91364..25521dd 100644
--- a/apppbx.cpp
+++ b/apppbx.cpp
@@ -550,28 +550,36 @@ struct mISDNport *EndpointAppPBX::hunt_port(char *ifname, int *channel)
struct select_channel *selchannel;
struct mISDNport *mISDNport;
int index, i;
+ int there_is_an_external = 0;
interface = interface_first;
/* first find the given interface or, if not given, one with no extension */
checknext:
- if (!interface)
+ if (!interface) {
+ if (!there_is_an_external && !(ifname && ifname[0])) {
+ trace_header("CHANNEL SELECTION (no external interface specified)", DIRECTION_NONE);
+ add_trace("info", NULL, "Add 'external' parameter to interface.conf.");
+ end_trace();
+ }
return(NULL);
+ }
/* check for given interface */
- if (ifname) {
+ if (ifname && ifname[0]) {
if (!strcasecmp(interface->name, ifname)) {
/* found explicit interface */
- trace_header("CHANNEL SELECTION (found interface)", DIRECTION_NONE);
+ trace_header("CHANNEL SELECTION (found given interface)", DIRECTION_NONE);
add_trace("interface", NULL, "%s", ifname);
end_trace();
goto foundif;
}
} else {
- if (!interface->extension) {
+ if (interface->external) {
+ there_is_an_external = 1;
/* found non extension */
- trace_header("CHANNEL SELECTION (found non extension interface)", DIRECTION_NONE);
+ trace_header("CHANNEL SELECTION (found external interface)", DIRECTION_NONE);
add_trace("interface", NULL, "%s", interface->name);
end_trace();
goto foundif;
diff --git a/default/interface.conf b/default/interface.conf
index 66859dd..85e53f1 100644
--- a/default/interface.conf
+++ b/default/interface.conf
@@ -5,12 +5,14 @@
# Example of an ISDN interface on port 0
#[Ext]
+#external
#portnum 0
# Example of a multilink ISDN interface (Anlagenanschluss) on port 2
# and 3
#[Ext]
+#external
#portnum 2
#portnum 3
@@ -19,6 +21,7 @@
# Layer-2-Hold is required to keep link alive.
#[Ext]
+#external
#portnum 0
#ptp
#layer2hold yes
@@ -73,6 +76,7 @@
# required.
#[Ext]
+#external
#screen-out unknown 300 national 21250993300
#screen-out unknown 2* national 212509932*
#tones yes
@@ -88,6 +92,7 @@
# (Siemens EWSD will select bot-way-channels when indicated that way.)
#[Ext]
+#external
#portnum 0
#layer2hold
#channel-in 1,2,3,4,5,6,7,8,9,10,22,23,24,25,26,27,28,29,30,31
@@ -117,6 +122,7 @@
# Now all information elements can be transmitted in both directions.
#[Ext]
+#external
#portnum 0
#te-special
@@ -133,6 +139,7 @@
# digits will be dialed after setup via overlap dialing.
#[Ext]
+#external
#portnum 0
#dialmax 20
@@ -174,6 +181,7 @@
[Ext]
+external
portnum 0
diff --git a/interface.c b/interface.c
index 24bc731..df39b78 100644
--- a/interface.c
+++ b/interface.c
@@ -114,6 +114,10 @@ static int inter_block(struct interface *interface, char *filename, int line, ch
}
static int inter_extension(struct interface *interface, char *filename, int line, char *parameter, char *value)
{
+ if (interface->external) {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s' not allowed, because interface is external interface.\n", filename, line, parameter);
+ return(-1);
+ }
if (value[0]) {
SPRINT(interface_error, "Error in %s (line %d): parameter '%s' expects no value.\n", filename, line, parameter);
return(-1);
@@ -121,6 +125,19 @@ static int inter_extension(struct interface *interface, char *filename, int line
interface->extension = 1;
return(0);
}
+static int inter_extern(struct interface *interface, char *filename, int line, char *parameter, char *value)
+{
+ if (interface->extension) {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s' not allowed, because interface is an extension.\n", filename, line, parameter);
+ return(-1);
+ }
+ if (value[0]) {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s' expects no value.\n", filename, line, parameter);
+ return(-1);
+ }
+ interface->external = 1;
+ return(0);
+}
static int inter_ptp(struct interface *interface, char *filename, int line, char *parameter, char *value)
{
struct interface_port *ifport;
@@ -907,6 +924,12 @@ static int inter_gsm(struct interface *interface, char *filename, int line, char
struct interface_param interface_param[] = {
{ "extension", &inter_extension, "",
"If keyword is given, calls to interface are handled as internal extensions."},
+
+ { "extern", &inter_extern, "",
+ "If keyword is given, this interface will be used for external calls.\n"
+ "Calls require an external interface, if the routing action 'extern' is used\nwithout specific interface given.\n"
+ "Calls forwarded by extension's 'settings' also require an external interface."},
+
{"tones", &inter_tones, "yes | no",
"Interface generates tones during call setup and release, or not.\nBy default only NT-mode ports generate tones."},
diff --git a/interface.h b/interface.h
index 817dc7d..2c2ee23 100644
--- a/interface.h
+++ b/interface.h
@@ -86,6 +86,7 @@ struct interface_screen {
struct interface {
struct interface *next;
char name[64]; /* name of interface */
+ int external; /* interface used for extranl calls */
int extension; /* calls are handled as extension */
int is_tones; /* generate tones */
int is_earlyb; /* bridge tones during call setup */