mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 12:40:17 +00:00
Merge pull request #772 in FS/freeswitch from ~PIOTRGREGOR/freeswitch:feature/FS-8983-avmd-enable-avmd-on-outgoing-channel to master
* commit '6658f61ccdd61fa0638d452bab0356c58a9ce74a': FS-8983 [avmd] Enable avmd on outbound channel
This commit is contained in:
commit
a4c79a22a6
@ -26,8 +26,8 @@
|
|||||||
* This module detects voicemail beeps using a generalized approach.
|
* This module detects voicemail beeps using a generalized approach.
|
||||||
*
|
*
|
||||||
* Modifications:
|
* Modifications:
|
||||||
* Piotr Gregor <piotrek.gregor@gmail.com>:
|
* Piotr Gregor <piotrek.gregor gmail.com>:
|
||||||
* FS-8808, FS-8809, FS-8810, FS-8852, FS-8853, FS-8854, FS-8855
|
* FS-8808, FS-8809, FS-8810, FS-8852, FS-8853, FS-8854, FS-8855, FS-8860, FS-8861
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
@ -225,7 +225,9 @@ static switch_bool_t avmd_callback(switch_media_bug_t * bug, void *user_data, sw
|
|||||||
return SWITCH_TRUE;
|
return SWITCH_TRUE;
|
||||||
|
|
||||||
case SWITCH_ABC_TYPE_WRITE_REPLACE:
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -356,6 +358,7 @@ SWITCH_STANDARD_APP(avmd_start_function)
|
|||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
avmd_session_t *avmd_session;
|
avmd_session_t *avmd_session;
|
||||||
|
switch_media_bug_flag_t flags = 0;
|
||||||
|
|
||||||
if (session == NULL)
|
if (session == NULL)
|
||||||
return;
|
return;
|
||||||
@ -387,6 +390,14 @@ SWITCH_STANDARD_APP(avmd_start_function)
|
|||||||
|
|
||||||
init_avmd_session_data(avmd_session, session);
|
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(
|
status = switch_core_media_bug_add(
|
||||||
session,
|
session,
|
||||||
"avmd",
|
"avmd",
|
||||||
@ -394,7 +405,7 @@ SWITCH_STANDARD_APP(avmd_start_function)
|
|||||||
avmd_callback,
|
avmd_callback,
|
||||||
avmd_session,
|
avmd_session,
|
||||||
0,
|
0,
|
||||||
SMBF_READ_REPLACE,
|
flags,
|
||||||
&bug
|
&bug
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -476,6 +487,7 @@ SWITCH_STANDARD_API(avmd_api_main)
|
|||||||
char *ccmd = NULL;
|
char *ccmd = NULL;
|
||||||
char *uuid;
|
char *uuid;
|
||||||
char *command;
|
char *command;
|
||||||
|
switch_core_media_flag_t flags = 0;
|
||||||
|
|
||||||
/* No command? Display usage */
|
/* No command? Display usage */
|
||||||
if (zstr(cmd)) {
|
if (zstr(cmd)) {
|
||||||
@ -546,6 +558,14 @@ SWITCH_STANDARD_API(avmd_api_main)
|
|||||||
|
|
||||||
init_avmd_session_data(avmd_session, fs_session);
|
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
|
/* Add a media bug that allows me to intercept the
|
||||||
* reading leg of the audio stream */
|
* reading leg of the audio stream */
|
||||||
status = switch_core_media_bug_add(
|
status = switch_core_media_bug_add(
|
||||||
@ -555,7 +575,7 @@ SWITCH_STANDARD_API(avmd_api_main)
|
|||||||
avmd_callback,
|
avmd_callback,
|
||||||
avmd_session,
|
avmd_session,
|
||||||
0,
|
0,
|
||||||
SMBF_READ_REPLACE,
|
flags,
|
||||||
&bug
|
&bug
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -704,7 +724,6 @@ static void avmd_process(avmd_session_t *session, switch_frame_t *frame)
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//amp = 0.0;
|
//amp = 0.0;
|
||||||
//success = 0.0;
|
//success = 0.0;
|
||||||
//error = 0.0;
|
//error = 0.0;
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __OPTIONS_H__
|
#ifndef __AVMD_OPTIONS_H__
|
||||||
#define __OPTIONS_H__
|
#define __AVMD_OPTIONS_H__
|
||||||
|
|
||||||
|
|
||||||
/* #define AVMD_DEBUG 1 */
|
/* #define AVMD_DEBUG 1 */
|
||||||
@ -19,14 +19,20 @@
|
|||||||
/* define/undefine this to enable/disable faster computation
|
/* define/undefine this to enable/disable faster computation
|
||||||
* of arcus cosine - table will be created mapping floats
|
* of arcus cosine - table will be created mapping floats
|
||||||
* to integers and returning arc cos values given these integer
|
* to integers and returning arc cos values given these integer
|
||||||
* indexes into table */
|
* indices into table */
|
||||||
/* #define AVMD_FAST_MATH */
|
/* #define AVMD_FAST_MATH */
|
||||||
|
|
||||||
/* define/undefine this to classify avmd beep detection as valid
|
/* define/undefine this to classify avmd beep detection as valid
|
||||||
* only when there is required number of consecutive elements
|
* only when there is required number of consecutive elements
|
||||||
* in the SMA buffer without reset */
|
* 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
|
||||||
|
|
||||||
|
/* define/undefine to enable/disable avmd on outgoing audio */
|
||||||
|
/*#define AVMD_OUTBOUND_CHANNEL*/
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif /* __AVMD_OPTIONS_H__ */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user