summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuper User2008-01-06 15:49:29 +0100
committerSuper User2008-01-06 15:49:29 +0100
commitd2ffecef264949e36341e87f8e1ff41a8effb1f2 (patch)
treef1466d38dae68a0dbf03f3c82cd3e0010fac98d5
parentfixes (diff)
downloadlcr-d2ffecef264949e36341e87f8e1ff41a8effb1f2.tar.gz
lcr-d2ffecef264949e36341e87f8e1ff41a8effb1f2.tar.xz
lcr-d2ffecef264949e36341e87f8e1ff41a8effb1f2.zip
added filter options (gain, pipeline, blowfish) to interface configuration.
modified: apppbx.cpp modified: interface.c modified: interface.h modified: mISDN.cpp modified: mISDN.h modified: route.c modified: todo.txt
-rw-r--r--apppbx.cpp8
-rw-r--r--interface.c124
-rw-r--r--interface.h11
-rw-r--r--mISDN.cpp15
-rw-r--r--mISDN.h1
-rw-r--r--route.c2
-rw-r--r--todo.txt5
7 files changed, 135 insertions, 31 deletions
diff --git a/apppbx.cpp b/apppbx.cpp
index c7803ac..3a39524 100644
--- a/apppbx.cpp
+++ b/apppbx.cpp
@@ -47,7 +47,7 @@ EndpointAppPBX::EndpointAppPBX(class Endpoint *epoint, int origin) : EndpointApp
e_ext.tout_disconnect = 120;
// e_ext.tout_hold = 900;
// e_ext.tout_park = 900;
- e_ext.rxvol = e_ext.txvol = 256;
+ e_ext.rxvol = e_ext.txvol = 0;
e_state = EPOINT_STATE_IDLE;
e_ext.number[0] = '\0';
e_extension_interface[0] = '\0';
@@ -1583,7 +1583,7 @@ void EndpointAppPBX::port_setup(struct port_list *portlist, int message_type, un
/* set volume of rx and tx */
if (param->setup.callerinfo.itype == INFO_ITYPE_ISDN_EXTENSION)
- if (e_ext.txvol!=256 || e_ext.rxvol!=256)
+ if (e_ext.txvol!=0 || e_ext.rxvol!=0)
{
message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_mISDNSIGNAL);
message->param.mISDNsignal.message = mISDNSIGNAL_VOLUME;
@@ -2073,7 +2073,7 @@ void EndpointAppPBX::port_connect(struct port_list *portlist, int message_type,
new_state(EPOINT_STATE_CONNECT);
/* set volume of rx and tx */
- if (e_ext.txvol!=256 || e_ext.rxvol!=256)
+ if (e_ext.txvol!=0 || e_ext.rxvol!=0)
{
message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_mISDNSIGNAL);
message->param.mISDNsignal.message = mISDNSIGNAL_VOLUME;
@@ -2453,7 +2453,7 @@ void EndpointAppPBX::port_notify(struct port_list *portlist, int message_type, u
case INFO_NOTIFY_USER_RESUMED:
/* set volume of rx and tx */
if (param->setup.callerinfo.itype == INFO_ITYPE_ISDN_EXTENSION)
- if (e_ext.txvol!=256 || e_ext.rxvol!=256)
+ if (e_ext.txvol!=0 || e_ext.rxvol!=0)
if (portlist)
{
message = message_create(ea_endpoint->ep_serial, portlist->port_id, EPOINT_TO_PORT, MESSAGE_mISDNSIGNAL);
diff --git a/interface.c b/interface.c
index e95d613..b2995ff 100644
--- a/interface.c
+++ b/interface.c
@@ -651,13 +651,116 @@ static int inter_nodtmf(struct interface *interface, char *filename, int line, c
ifport->nodtmf = 1;
return(0);
}
-#warning filter to be done
-#if 0
static int inter_filter(struct interface *interface, char *filename, int line, char *parameter, char *value)
{
+ char *p, *q;
+
+ /* seperate parameter from filter */
+ p = value;
+ while(*p > 32)
+ p++;
+ if (*p)
+ {
+ *p++ = 0;
+ while(*p > 0 && *p <= 32)
+ p++;
+ }
+
+ if (!strcasecmp(value, "gain"))
+ {
+ q = p;
+ while(*q > 32)
+ q++;
+ if (*q)
+ {
+ *q++ = 0;
+ while(*q > 0 && *q <= 32)
+ q++;
+ }
+ if (*p == 0 || *q == 0)
+ {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s %s' expects two gain values.\n", filename, line, parameter, value);
+ return(-1);
+ }
+ if (atoi(p)<-8 || atoi(p)>8 || atoi(q)<-8 || atoi(q)>8)
+ {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s %s' gain values not in range. (-8...8)\n", filename, line, parameter, value);
+ return(-1);
+ }
+ interface->gain_tx = atoi(p);
+ interface->gain_rx = atoi(q);
+ } else
+ if (!strcasecmp(value, "pipeline"))
+ {
+ if (*p == 0)
+ {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s %s' expects pipeline string.\n", filename, line, parameter, value);
+ return(-1);
+ }
+ SCPY(interface->pipeline, p);
+ } else
+ if (!strcasecmp(value, "blowfish"))
+ {
+ unsigned char key[56];
+ int l;
+
+ if (!!strncmp(p, "0x", 2))
+ {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s %s' expects blowfish key starting with '0x'.\n", filename, line, parameter, value);
+ return(-1);
+ }
+ p += 2;
+ l = 0;
+ while(*p)
+ {
+ if (l == 56)
+ {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s %s' key too long.\n", filename, line, parameter, value);
+ return(-1);
+ }
+ if (*p >= '0' && *p <= '9')
+ key[l] = (*p-'0')<<4;
+ else if (*p >= 'a' && *p <= 'f')
+ key[l] = (*p-'a'+10)<<4;
+ else if (*p >= 'A' && *p <= 'F')
+ key[l] = (*p-'A'+10)<<4;
+ else
+ {
+ digout:
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s %s' key has digits out of range. (0...9, a...f)\n", filename, line, parameter, value);
+ return(-1);
+ }
+ p++;
+ if (*p == 0)
+ {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s %s' key must end on an 8 bit boundary (two character boundary).\n", filename, line, parameter, value);
+ return(-1);
+ }
+ if (*p >= '0' && *p <= '9')
+ key[l] = (*p-'0')<<4;
+ else if (*p >= 'a' && *p <= 'f')
+ key[l] = (*p-'a'+10)<<4;
+ else if (*p >= 'A' && *p <= 'F')
+ key[l] = (*p-'A'+10)<<4;
+ else
+ goto digout;
+ p++;
+ l++;
+ }
+ if (l < 4)
+ {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s %s' key must be at least 4 bytes (8 characters).\n", filename, line, parameter, value);
+ return(-1);
+ }
+ memcpy(interface->bf_key, key, l);
+ interface->bf_len = l;
+ } else
+ {
+ SPRINT(interface_error, "Error in %s (line %d): parameter '%s' has unknown filter '%s'.\n", filename, line, parameter, value);
+ return(-1);
+ }
return(0);
}
-#endif
/*
@@ -748,13 +851,11 @@ struct interface_param interface_param[] = {
"This parameter must follow a 'port' parameter."},
#endif
-#if 0
-#warning todo: filter, also in the PmISDN object
- {"filter", &inter_filter, "<filter> [parameters]",
+ {"filter", &inter_filter, "<filter> <parameters>",
"Adds/appends a filter. Filters are ordered in transmit direction.\n"
"gain <tx-volume> <rx-volume> - Changes volume (-8 .. 8)\n"
+ "pipeline <string> - Sets echo cancelation pipeline.\n"
"blowfish <key> - Adds encryption. Key must be 4-56 bytes (8-112 hex characters."},
-#endif
{NULL, NULL, NULL, NULL}
};
@@ -934,7 +1035,6 @@ void free_interfaces(struct interface *interface)
struct select_channel *selchannel;
struct interface_msn *ifmsn;
struct interface_screen *ifscreen;
- struct interface_filter *iffilter;
while(interface)
{
@@ -986,14 +1086,6 @@ void free_interfaces(struct interface *interface)
FREE(temp, sizeof(struct interface_screen));
memuse--;
}
- iffilter = interface->iffilter;
- while(iffilter)
- {
- temp = iffilter;
- iffilter = iffilter->next;
- FREE(temp, sizeof(struct interface_filter));
- memuse--;
- }
temp = interface;
interface = interface->next;
FREE(temp, sizeof(struct interface));
diff --git a/interface.h b/interface.h
index 4085ebe..f97c28b 100644
--- a/interface.h
+++ b/interface.h
@@ -73,12 +73,6 @@ struct interface_screen {
int result_present; /* presentation type */
};
-struct interface_filter {
- struct interface_filter *next;
- int filter; /* filter to use */
- char parameter[256]; /* filter parameter */
-};
-
struct interface {
struct interface *next;
char name[64]; /* name of interface */
@@ -91,7 +85,10 @@ struct interface {
struct interface_msn *ifmsn; /* link to interface msn list */
struct interface_screen *ifscreen_in; /* link to screening list */
struct interface_screen *ifscreen_out; /* link to screening list */
- struct interface_filter *iffilter; /* link to filter list */
+ int gain_tx, gain_rx; /* filter gain */
+ char pipeline[256]; /* filter pipeline */
+ unsigned char bf_key[56]; /* filter blowfish */
+ int bf_len; /* filter length of blowfish */
};
struct interface_param {
diff --git a/mISDN.cpp b/mISDN.cpp
index 3c4c23d..ca232f5 100644
--- a/mISDN.cpp
+++ b/mISDN.cpp
@@ -168,7 +168,8 @@ PmISDN::PmISDN(int type, mISDNport *mISDNport, char *portname, struct port_setti
p_m_b_reserve = 0;
p_m_delete = 0;
p_m_hold = 0;
- p_m_txvol = p_m_rxvol = 0;
+ p_m_txvol = mISDNport->ifport->interface->gain_tx;
+ p_m_rxvol = mISDNport->ifport->interface->gain_rx;
p_m_conf = 0;
p_m_txdata = 0;
p_m_delay = 0;
@@ -181,7 +182,8 @@ PmISDN::PmISDN(int type, mISDNport *mISDNport, char *portname, struct port_setti
p_m_timer = 0;
p_m_remote_ref = 0; /* channel shall be exported to given remote */
p_m_remote_id = 0; /* channel shall be exported to given remote */
-
+ SCPY(p_m_pipeline, mISDNport->ifport->interface->pipeline);
+
/* audio */
p_m_load = 0;
p_m_last_tv_sec = 0;
@@ -194,13 +196,18 @@ PmISDN::PmISDN(int type, mISDNport *mISDNport, char *portname, struct port_setti
p_m_crypt_msg_len = 0;
p_m_crypt_msg[0] = '\0';
p_m_crypt_msg_current = 0;
- p_m_crypt_key[0] = '\0';
p_m_crypt_key_len = 0;
p_m_crypt_listen = 0;
p_m_crypt_listen_state = 0;
p_m_crypt_listen_len = 0;
p_m_crypt_listen_msg[0] = '\0';
p_m_crypt_listen_crc = 0;
+ if (mISDNport->ifport->interface->bf_len >= 4 && mISDNport->ifport->interface->bf_len <= 56)
+ {
+ memcpy(p_m_crypt_key, mISDNport->ifport->interface->bf_key, p_m_crypt_key_len);
+ p_m_crypt_key_len = mISDNport->ifport->interface->bf_len;
+ p_m_crypt = 1;
+ }
/* if any channel requested by constructor */
if (channel == CHANNEL_ANY)
@@ -634,6 +641,8 @@ static void _bchannel_configure(struct mISDNport *mISDNport, int i)
ph_control(mISDNport, port, handle, VOL_CHANGE_TX, port->p_m_txvol, "DSP-TXVOL", port->p_m_txvol);
if (port->p_m_rxvol)
ph_control(mISDNport, port, handle, VOL_CHANGE_RX, port->p_m_rxvol, "DSP-RXVOL", port->p_m_rxvol);
+ if (port->p_m_pipeline[0])
+ ph_control_block(mISDNport, port, handle, PIPELINE_CFG, port->p_m_pipeline, strlen(port->p_m_pipeline)+1, "DSP-PIPELINE", 0);
if (port->p_m_conf)
ph_control(mISDNport, port, handle, CMX_CONF_JOIN, port->p_m_conf, "DSP-CONF", port->p_m_conf);
if (port->p_m_echo)
diff --git a/mISDN.h b/mISDN.h
index 47626f1..f9485b2 100644
--- a/mISDN.h
+++ b/mISDN.h
@@ -112,6 +112,7 @@ class PmISDN : public Port
struct mISDNport *p_m_mISDNport; /* pointer to port */
int p_m_delay; /* use delay instead of dejitter */
int p_m_txvol, p_m_rxvol; /* volume shift (0 = no change) */
+ char p_m_pipeline[256]; /* filter pipeline */
int p_m_echo, p_m_conf; /* remote echo, conference number */
int p_m_tone; /* current kernel space tone */
int p_m_rxoff; /* rx from driver is disabled */
diff --git a/route.c b/route.c
index 2546b18..724c4a4 100644
--- a/route.c
+++ b/route.c
@@ -234,7 +234,7 @@ struct param_defs param_defs[] = {
"strip", "Remove digits that were required to match this rule."},
{ PARAM_APPLICATION,
"application",PARAM_TYPE_STRING,
- "application", "Name of remote application to make call to."},
+ "application=<name>", "Name of remote application to make call to."},
{ 0, NULL, 0, NULL, NULL}
};
diff --git a/todo.txt b/todo.txt
index e6c7ddd..12e6620 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,3 +1,7 @@
+
+fuer asterisk: dejitter tx_buffer in dsp.o
+
+
layer-2-hold interface feature
neue params zum aufbau eines externen/internen calls
@@ -6,6 +10,7 @@ neue params zun aufbau eines externen/internen calls dokumentieren
neuen partyline-param dokumentieren
dokumentieren: aufzeichnung der ansage mit 0 ohne beep beenden
+doku: gain, pipeline, crypt
make asterisk call implementation