mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 12:42:02 +00:00
Adding bugs to the core
This is the primary commit to add bugs to the core (media bugs that is)
Media bugs are kind of like what ChanSpy is in Asterisk only cooler (I wrote ChanSpy too so I can say that)
Here is an example of using them to record a call by the higher level switch_ivr functionality passed
up to the dialplan via mod_playback.
The call will be recorded while the some.wav plays then stop for the rest of the call (when some_other.wav plays)
The bugs may have bugs since this is 1 day's work so happy hunting ......
<extension name="42">
<condition field="destination_number" expression="^42$">
<action application="set" data="RECORD_TITLE=recording test"/>
<action application="set" data="RECORD_ARTIST=FreeSWITCH"/>
<action application="record_session" data="/tmp/rtest.wav"/>
<action application="playback" data="/tmp/some.wav"/>
<action application="stop_record_session" data="/tmp/rtest.wav"/>
<action application="playback" data="/tmp/some_other.wav"/>
</condition>
</extension>
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2588 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -228,10 +228,6 @@ static uint32_t next_member_id(void)
|
||||
}
|
||||
|
||||
|
||||
#define SMAX 32767
|
||||
#define SMIN -32768
|
||||
#define normalize_to_16bit(n) if (n > SMAX) n = SMAX; else if (n < SMIN) n = SMIN;
|
||||
|
||||
static void switch_change_sln_volume(int16_t *data, uint32_t samples, int32_t vol)
|
||||
{
|
||||
int16_t *p = data;
|
||||
@@ -249,7 +245,7 @@ static void switch_change_sln_volume(int16_t *data, uint32_t samples, int32_t vo
|
||||
|
||||
for (x = 0; x < samples; x++) {
|
||||
b = (int32_t)((double)p[x] * mult);
|
||||
normalize_to_16bit(b);
|
||||
switch_normalize_to_16bit(b);
|
||||
p[x] = (int16_t) b;
|
||||
}
|
||||
}
|
||||
@@ -600,7 +596,7 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v
|
||||
|
||||
for (x = 0; x < imember->read / 2; x++) {
|
||||
int32_t z = muxed[x] + bptr[x];
|
||||
normalize_to_16bit(z);
|
||||
switch_normalize_to_16bit(z);
|
||||
muxed[x] = (int16_t)z;
|
||||
}
|
||||
|
||||
|
||||
@@ -133,6 +133,26 @@ static void record_function(switch_core_session_t *session, char *data)
|
||||
}
|
||||
|
||||
|
||||
static void record_session_function(switch_core_session_t *session, char *data)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
switch_ivr_record_session(session, data, NULL);
|
||||
}
|
||||
|
||||
|
||||
static void stop_record_session_function(switch_core_session_t *session, char *data)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
switch_ivr_stop_record_session(session, data);
|
||||
}
|
||||
|
||||
|
||||
static const switch_application_interface_t speak_application_interface = {
|
||||
/*.interface_name */ "speak",
|
||||
/*.application_function */ speak_function
|
||||
@@ -145,11 +165,27 @@ static const switch_application_interface_t record_application_interface = {
|
||||
&speak_application_interface
|
||||
};
|
||||
|
||||
|
||||
static const switch_application_interface_t record_session_application_interface = {
|
||||
/*.interface_name */ "record_session",
|
||||
/*.application_function */ record_session_function,
|
||||
NULL,NULL,NULL,
|
||||
&record_application_interface
|
||||
};
|
||||
|
||||
|
||||
static const switch_application_interface_t stop_record_session_application_interface = {
|
||||
/*.interface_name */ "stop_record_session",
|
||||
/*.application_function */ stop_record_session_function,
|
||||
NULL,NULL,NULL,
|
||||
&record_session_application_interface
|
||||
};
|
||||
|
||||
static const switch_application_interface_t playback_application_interface = {
|
||||
/*.interface_name */ "playback",
|
||||
/*.application_function */ playback_function,
|
||||
NULL,NULL,NULL,
|
||||
/*.next*/ &record_application_interface
|
||||
/*.next*/ &stop_record_session_application_interface
|
||||
};
|
||||
|
||||
static const switch_loadable_module_interface_t mod_playback_module_interface = {
|
||||
|
||||
Reference in New Issue
Block a user