messaging stuff

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1902 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-07-17 14:12:07 +00:00
parent 7abfa425bd
commit 7712c6637c
4 changed files with 132 additions and 117 deletions

View File

@ -30,6 +30,9 @@
*
*/
#include <libteletone.h>
#define SMAX 32767
#define SMIN -32768
#define normalize_to_16bit(n) if (n > SMAX) n = SMAX; else if (n < SMIN) n = SMIN;
@ -163,6 +166,7 @@ int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *m
for (i = 0; i < freqlen; i++) {
sample += ((teletone_process_t) 2 * (ts->volume > 0 ? ts->volume : 1) * cos(tones[i] * ts->samples * period));
}
normalize_to_16bit(sample);
ts->buffer[ts->samples] = (teletone_audio_t)sample;
for (c = 1; c < ts->channels; c++) {

View File

@ -704,10 +704,14 @@ static void conference_loop(conference_member_t *member)
switch_size_t file_sample_len = samples;
char *digit;
char msg[512];
switch_event_t *event;
if (switch_core_session_dequeue_event(member->session, &event) == SWITCH_STATUS_SUCCESS) {
switch_event_destroy(&event);
}
if (switch_channel_has_dtmf(channel)) {
switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
}
for (digit = dtmf; *digit; digit++) {
switch(*digit) {
@ -829,6 +833,7 @@ static void conference_loop(conference_member_t *member)
break;
}
}
}
if (member->fnode) {
if (member->fnode->done) {

View File

@ -1509,9 +1509,12 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", from);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "subject", subject);
switch_event_add_body(event, msg);
if (switch_core_session_queue_event(tech_pvt->session, &event) != SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true");
switch_event_fire(&event);
}
}
break;

View File

@ -1130,7 +1130,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_receive_event(switch_core_se
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(switch_core_session_t *session, switch_event_t **event)
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_status_t status = SWITCH_STATUS_FALSE;
assert(session != NULL);
@ -1138,8 +1138,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(switch_core_sess
switch_queue_create(&session->event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
}
if ((status = (switch_status_t) switch_queue_push(session->event_queue, *event) == SWITCH_STATUS_SUCCESS)) {
if (session->event_queue) {
if (switch_queue_trypush(session->event_queue, *event) == SWITCH_STATUS_SUCCESS) {
*event = NULL;
status = SWITCH_STATUS_SUCCESS;
}
}
return status;