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++;
p_record_buffer_writep = 0;
p_record_buffer_dir = 0;
+ /* VoOTP */
+#ifdef WITH_VOOTP
+ p_vootp = NULL;
+#endif
+ /* D-O-V */
+ dov_init();
+
/* append port to chain */
next = NULL;
temp = port_first;
PDEBUG(DEBUG_PORT, "removing port (%d) of type 0x%x, name '%s' interface '%s'\n", p_serial, p_type, p_name, p_interface_name);
+#ifdef WITH_VOOTP
+ if (p_vootp) {
+ vootp_destroy(p_vootp);
+ p_vootp = NULL;
+ }
+#endif
+
if (p_bridge) {
PDEBUG(DEBUG_PORT, "Removing us from bridge %u\n", p_bridge->bridge_id);
remove_bridge(p_bridge, this);
if (p_record)
close_record(0, 0);
+ dov_exit();
+
classuse--;
/* disconnect port from endpoint */
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;
}
+void Port::set_display(const char *text)
+{
+}
+
/*
* set the file in the tone directory for vbox playback
* also set the play_eof-flag
PDEBUG(DEBUG_PORT, "PORT(%s) bridging to id %d\n", p_name, param->bridge_id);
bridge(param->bridge_id);
return 1;
+
+#ifdef WITH_VOOTP
+ case MESSAGE_VOOTP: /* enable / disable VoOTP */
+ PDEBUG(DEBUG_PORT, "PORT(%s) VoOTP enabled: %d\n", p_name, param->vootp.enable);
+ set_vootp(¶m->vootp);
+ return 1;
+#endif
+
+ case MESSAGE_DOV_REQUEST: /* Data-Over-Voice message */
+ PDEBUG(DEBUG_PORT, "PORT(%s) sending data over voice message (len=%d)\n", p_name, param->dov.length);
+ dov_sendmsg(param->dov.data, param->dov.length, (enum dov_type)param->dov.type, param->dov.level);
+ return 1;
+
+ case MESSAGE_DOV_LISTEN: /* Data-Over-Voice listen order */
+ PDEBUG(DEBUG_PORT, "PORT(%s) sending data over voice listen order\n", p_name);
+ dov_listen((enum dov_type)param->dov.type);
+ return 1;
}
return 0;
char filename[256];
time_t now;
struct tm *now_tm;
- int ret;
+ int __attribute__((__unused__)) ret;
if (!extension) {
PERROR("Port(%d) not an extension\n", p_serial);
case CODEC_MONO:
case CODEC_STEREO:
case CODEC_8BIT:
+ memset(&dummyheader, 0, sizeof(dummyheader));
ret = fwrite(dummyheader, sizeof(dummyheader), 1, p_record);
break;
char *p;
struct caller_info callerinfo;
const char *valid_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-!$%&/()=+*;~";
- int ret;
+ int __attribute__((__unused__)) ret;
if (!p_record)
return;
signed short *s;
int free, i, ii;
signed int sample;
- int ret;
+ int __attribute__((__unused__)) ret;
/* no recording */
if (!p_record || !length)
signed long *sum;
unsigned char *buf;
+#ifdef WITH_VOOTP
+ if (p_vootp)
+ vootp_encrypt_stream(p_vootp, data, len);
+#endif
+
/* less than two ports, so drop */
if (!p_bridge || !p_bridge->first || !p_bridge->first->next)
return -EIO;
}
-/* receive data from remote Port (dummy, needs to be inherited) */
+/* receive data from remote Port */
int Port::bridge_rx(unsigned char *data, int len)
{
- return 0; /* datenklo */
+
+#ifdef WITH_VOOTP
+ if (p_vootp)
+ vootp_decrypt_stream(p_vootp, data, len);
+#endif
+
+ return 0;
+}
+
+#ifdef WITH_VOOTP
+static void vootp_info(void *priv, const char *text)
+{
+ class Port *port = (class Port *)priv;
+ char display[strlen(text) + 1];
+
+ SCPY(display, text);
+ if (display[0])
+ display[strlen(display) - 1] = '\0';
+
+ port->set_display(display);
}
+void Port::set_vootp(struct param_vootp *vootp)
+{
+ if (p_vootp) {
+ vootp_destroy(p_vootp);
+ p_vootp = NULL;
+ }
+ if (vootp->enable) {
+ p_vootp = vootp_create(this, (options.law=='a'), options.otp_dir, NULL, NULL, vootp->id, vootp_info);
+// vootp_loglevel(VOOTP_LOGL_DEBUG);
+ if (!p_vootp) {
+ struct lcr_msg *message;
+
+ message = message_create(p_serial, p_epointlist->epoint_id, PORT_TO_EPOINT, MESSAGE_VOOTP);
+ message->param.vootp.failed = 1;
+ message_put(message);
+ }
+ }
+}
+#endif