* This module detects voicemail beeps using a generalized approach.
*
* Modifications:
- * Piotr Gregor <piotrek.gregor@gmail.com>:
- * FS-8808, FS-8809, FS-8810, FS-8852, FS-8853, FS-8854, FS-8855
+ * Piotr Gregor <piotrek.gregor gmail.com>:
+ * FS-8808, FS-8809, FS-8810, FS-8852, FS-8853, FS-8854, FS-8855, FS-8860, FS-8861
*/
#include <switch.h>
return SWITCH_TRUE;
case SWITCH_ABC_TYPE_WRITE_REPLACE:
- break;
+ frame = switch_core_media_bug_get_write_replace_frame(bug);
+ avmd_process(avmd_session, frame);
+ return SWITCH_TRUE;
default:
break;
switch_status_t status;
switch_channel_t *channel;
avmd_session_t *avmd_session;
+ switch_media_bug_flag_t flags = 0;
if (session == NULL)
return;
init_avmd_session_data(avmd_session, session);
+#ifdef AVMD_INBOUND_CHANNEL
+ flags |= SMBF_READ_REPLACE;
+#endif
+#ifdef AVMD_OUTBOUND_CHANNEL
+ flags |= SMBF_WRITE_REPLACE;
+#endif
+ switch_assert(flags != 0);
+
status = switch_core_media_bug_add(
session,
"avmd",
avmd_callback,
avmd_session,
0,
- SMBF_READ_REPLACE,
+ flags,
&bug
);
char *ccmd = NULL;
char *uuid;
char *command;
+ switch_core_media_flag_t flags = 0;
/* No command? Display usage */
if (zstr(cmd)) {
init_avmd_session_data(avmd_session, fs_session);
+#ifdef AVMD_INBOUND_CHANNEL
+ flags |= SMBF_READ_REPLACE;
+#endif
+#ifdef AVMD_OUTBOUND_CHANNEL
+ flags |= SMBF_WRITE_REPLACE;
+#endif
+ switch_assert(flags != 0);
+
/* Add a media bug that allows me to intercept the
* reading leg of the audio stream */
status = switch_core_media_bug_add(
avmd_callback,
avmd_session,
0,
- SMBF_READ_REPLACE,
+ flags,
&bug
);
return;
}
-
//amp = 0.0;
//success = 0.0;
//error = 0.0;
*/
-#ifndef __OPTIONS_H__
-#define __OPTIONS_H__
+#ifndef __AVMD_OPTIONS_H__
+#define __AVMD_OPTIONS_H__
/* #define AVMD_DEBUG 1 */
/* define/undefine this to enable/disable faster computation
* of arcus cosine - table will be created mapping floats
* to integers and returning arc cos values given these integer
- * indexes into table */
+ * indices into table */
/* #define AVMD_FAST_MATH */
/* define/undefine this to classify avmd beep detection as valid
* only when there is required number of consecutive elements
* in the SMA buffer without reset */
-#define AVMD_REQUIRE_CONTINUOUS_STREAK 1
+#define AVMD_REQUIRE_CONTINUOUS_STREAK 5
+/* define/undefine to enable/disable avmd on incoming audio */
+#define AVMD_INBOUND_CHANNEL
-#endif
+/* define/undefine to enable/disable avmd on outgoing audio */
+/*#define AVMD_OUTBOUND_CHANNEL*/
+
+
+#endif /* __AVMD_OPTIONS_H__ */