Make tones-dir option available for all interface (interface.conf)

This commit is contained in:
Andreas Eversberg 2017-11-04 15:32:48 +01:00
parent 07c94b7319
commit b2261c3f5c
7 changed files with 40 additions and 19 deletions

View File

@ -144,14 +144,14 @@
#dialmax 20
# Example of an ISDN interface on port 1, with alternate tones_dir to use.
# Example of an ISDN interface on port 1, with alternate tones-dir to use.
# In this case, the tones are "german" tones generated by mISDN_dsp.ko.
# It is possible to give different sample sets, like "tones_german".
#[Int]
#extension
#msn 201,202,203
#tones_dir german
#tones-dir german
#portnum 1
#nt

View File

@ -880,18 +880,12 @@ static int inter_dialmax(struct interface *interface, char *filename, int line,
}
static int inter_tones_dir(struct interface *interface, char *filename, int line, char *parameter, char *value)
{
struct interface_port *ifport;
/* port in chain ? */
if (!interface->ifport) {
SPRINT(interface_error, "Error in %s (line %d): parameter '%s' expects previous 'port' definition.\n", filename, line, parameter);
if (!value || !value[0]) {
SPRINT(interface_error, "Error in %s (line %d): Missing tones directory.\n", filename, line);
return(-1);
}
/* goto end of chain */
ifport = interface->ifport;
while(ifport->next)
ifport = ifport->next;
SCPY(ifport->tones_dir, value);
SCPY(interface->tones_dir, value);
return(0);
}
static int inter_gsm(struct interface *interface, char *filename, int line, char *parameter, char *value)
@ -1354,6 +1348,9 @@ struct interface_param interface_param[] = {
{"tones_dir", &inter_tones_dir, "<path>",
"Overrides the given tone_dir in options.conf.\n"
"To used kernel tones in mISDN_dsp.ko, say 'american', 'german', or 'oldgerman'."},
{"tones-dir", &inter_tones_dir, "<path>",
"Overrides the given tone_dir in options.conf.\n"
"To used kernel tones in mISDN_dsp.ko, say 'american', 'german', or 'oldgerman'."},
{"gsm", &inter_gsm, "",
""},

View File

@ -66,7 +66,6 @@ struct interface_port {
// int tout_hold;
// int tout_park;
int dialmax; /* maximum number of digits to dial */
char tones_dir[128];
int nonotify; /* blocks outgoing notify messages */
int pots_flash; /* allow flash button / keypulse to hold active call */
int pots_ring; /* after hangup let calls on hold ring the phone */
@ -105,6 +104,7 @@ struct interface {
struct interface_screen *ifscreen_in; /* link to screening list */
struct interface_screen *ifscreen_out; /* link to screening list */
int tx_gain, rx_gain; /* filter gain */
char tones_dir[128];
char pipeline[256]; /* filter pipeline */
unsigned char bf_key[56]; /* filter blowfish */
int bf_len; /* filter length of blowfish */

View File

@ -1226,9 +1226,9 @@ void PmISDN::set_tone(const char *dir, const char *tone)
/* if no directory is given (by extension), we use interface.conf or options.conf */
if (!dir || !dir[0]) {
if (p_m_mISDNport->ifport->tones_dir[0])
dir = p_m_mISDNport->ifport->tones_dir;
else if (options.tones_dir[0])
if (p_tones_interface[0])
dir = p_tones_interface;
else
dir = options.tones_dir;
}

View File

@ -159,8 +159,10 @@ Port::Port(int type, const char *portname, struct port_settings *settings, struc
memset(&p_settings, 0, sizeof(p_settings));
}
SCPY(p_name, portname);
if (interface)
if (interface) {
SCPY(p_interface_name, interface->name);
SCPY(p_tones_interface, interface->tones_dir);
}
p_tone_dir[0] = '\0';
p_type = type;
p_serial = port_serial++;
@ -323,8 +325,12 @@ void Port::set_tone(const char *dir, const char *name)
if (name == NULL)
name = "";
if (!dir || !dir[0])
dir = options.tones_dir; /* just in case we have no PmISDN instance */
if (!dir || !dir[0]) {
if (p_tones_interface[0])
dir = p_tones_interface;
else
dir = options.tones_dir; /* just in case we have no PmISDN instance */
}
/* no counter, no eof, normal speed */
p_tone_counter = 0;

1
port.h
View File

@ -207,6 +207,7 @@ class Port
char p_interface_name[64];
/* tone */
char p_tones_interface[256]; /* directory of tones of interface */
char p_tone_dir[256]; /* name of current directory */
char p_tone_name[256]; /* name of current tone */
char p_tone_fh; /* file descriptor of current tone or -1 if not open */

View File

@ -21,4 +21,21 @@ doku:
- aufzeichnung der ansage mit 0 ohne beep beenden
- gain, pipeline, crypt
- polling
- sip
sip:
- blockiert der prozess beim lookup? (also invite oder register bei dns-unerreichbarkeit)
- feste ip statt stun
- ankommende registrierung
- earlyb testen (siehe interface.conf)
- callerid als display-info
routing:
- ersetzten-operator
- bei einem sending-complete muss ein timeout als abgelaufen behandelt werden
lcradmin:
- mncc status (socket-connection) anzeigen
- sip status (register) anzeigen