mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-28 21:23:44 +00:00
tweaks
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9033 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
07728b3b60
commit
b47382df69
@ -13,7 +13,31 @@ extern "C" {
|
|||||||
#define this_check_void() do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n");}} while(0)
|
#define this_check_void() do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n");}} while(0)
|
||||||
#define sanity_check(x) do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
|
#define sanity_check(x) do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
|
||||||
#define sanity_check_noreturn do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return;}} while(0)
|
#define sanity_check_noreturn do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return;}} while(0)
|
||||||
#define init_vars() do { allocated = 0; session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; xml_cdr_text = NULL; memset(&caller_profile, 0, sizeof(caller_profile)); memset(&args, 0, sizeof(args)); ap = NULL; caller_profile.source = "mod_unknown"; caller_profile.dialplan = ""; caller_profile.context = ""; caller_profile.caller_id_name = ""; caller_profile.caller_id_number = ""; caller_profile.network_addr = ""; caller_profile.ani = ""; caller_profile.aniii = ""; caller_profile.rdnis = ""; caller_profile.username = ""; on_hangup = NULL; memset(&cb_state, 0, sizeof(cb_state)); hook_state = CS_NEW; } while(0)
|
#define init_vars() allocated = 0; \
|
||||||
|
session = NULL; \
|
||||||
|
channel = NULL; \
|
||||||
|
uuid = NULL; \
|
||||||
|
tts_name = NULL; \
|
||||||
|
voice_name = NULL; \
|
||||||
|
xml_cdr_text = NULL; \
|
||||||
|
memset(&caller_profile, 0, sizeof(caller_profile)); \
|
||||||
|
memset(&args, 0, sizeof(args)); \
|
||||||
|
ap = NULL; \
|
||||||
|
caller_profile.source = "mod_unknown"; \
|
||||||
|
caller_profile.dialplan = ""; \
|
||||||
|
caller_profile.context = ""; \
|
||||||
|
caller_profile.caller_id_name = ""; \
|
||||||
|
caller_profile.caller_id_number = ""; \
|
||||||
|
caller_profile.network_addr = ""; \
|
||||||
|
caller_profile.ani = ""; \
|
||||||
|
caller_profile.aniii = ""; \
|
||||||
|
caller_profile.rdnis = ""; \
|
||||||
|
caller_profile.username = ""; \
|
||||||
|
on_hangup = NULL; \
|
||||||
|
memset(&cb_state, 0, sizeof(cb_state)); \
|
||||||
|
hook_state = CS_NEW; \
|
||||||
|
fhp = NULL
|
||||||
|
|
||||||
//// C++ Interface: switch_to_cpp_mempool//// Description: This class allows for overloading the new operator to allocate from a switch_memory_pool_t//// Author: Yossi Neiman <freeswitch@cartissolutions.com>, (C) 2007//// Copyright: See COPYING file that comes with this distribution//
|
//// C++ Interface: switch_to_cpp_mempool//// Description: This class allows for overloading the new operator to allocate from a switch_memory_pool_t//// Author: Yossi Neiman <freeswitch@cartissolutions.com>, (C) 2007//// Copyright: See COPYING file that comes with this distribution//
|
||||||
#if 0
|
#if 0
|
||||||
#ifndef SWITCHTOMEMPOOL
|
#ifndef SWITCHTOMEMPOOL
|
||||||
|
@ -1124,8 +1124,6 @@ SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *sess
|
|||||||
SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *result)
|
SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *result)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch_file_handle_t *fh = NULL;
|
|
||||||
|
|
||||||
this_check(SWITCH_STATUS_FALSE);
|
this_check(SWITCH_STATUS_FALSE);
|
||||||
sanity_check(SWITCH_STATUS_FALSE);
|
sanity_check(SWITCH_STATUS_FALSE);
|
||||||
|
|
||||||
@ -1134,20 +1132,6 @@ SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *resul
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fhp) {
|
if (fhp) {
|
||||||
fh = fhp;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fh) {
|
|
||||||
if (!fh) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Process callback result aborted because fh is null\n");
|
|
||||||
return SWITCH_STATUS_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fh->file_interface) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Process callback result aborted because fh->file_interface is null\n");
|
|
||||||
return SWITCH_STATUS_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strncasecmp(result, "speed", 4)) {
|
if (!strncasecmp(result, "speed", 4)) {
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
@ -1158,10 +1142,10 @@ SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *resul
|
|||||||
if (!(step = atoi(p))) {
|
if (!(step = atoi(p))) {
|
||||||
step = 1;
|
step = 1;
|
||||||
}
|
}
|
||||||
fh->speed += step;
|
fhp->speed += step;
|
||||||
} else {
|
} else {
|
||||||
int speed = atoi(p);
|
int speed = atoi(p);
|
||||||
fh->speed = speed;
|
fhp->speed = speed;
|
||||||
}
|
}
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1169,18 +1153,18 @@ SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *resul
|
|||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
|
|
||||||
} else if (!strcasecmp(result, "pause")) {
|
} else if (!strcasecmp(result, "pause")) {
|
||||||
if (switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
|
if (switch_test_flag(fhp, SWITCH_FILE_PAUSE)) {
|
||||||
switch_clear_flag(fh, SWITCH_FILE_PAUSE);
|
switch_clear_flag(fhp, SWITCH_FILE_PAUSE);
|
||||||
} else {
|
} else {
|
||||||
switch_set_flag(fh, SWITCH_FILE_PAUSE);
|
switch_set_flag(fhp, SWITCH_FILE_PAUSE);
|
||||||
}
|
}
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
} else if (!strcasecmp(result, "stop")) {
|
} else if (!strcasecmp(result, "stop")) {
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
} else if (!strcasecmp(result, "restart")) {
|
} else if (!strcasecmp(result, "restart")) {
|
||||||
unsigned int pos = 0;
|
unsigned int pos = 0;
|
||||||
fh->speed = 0;
|
fhp->speed = 0;
|
||||||
switch_core_file_seek(fh, &pos, 0, SEEK_SET);
|
switch_core_file_seek(fhp, &pos, 0, SEEK_SET);
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
} else if (!strncasecmp(result, "seek", 4)) {
|
} else if (!strncasecmp(result, "seek", 4)) {
|
||||||
switch_codec_t *codec;
|
switch_codec_t *codec;
|
||||||
@ -1199,18 +1183,18 @@ SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *resul
|
|||||||
if (step > 0) {
|
if (step > 0) {
|
||||||
samps = step * (codec->implementation->samples_per_second / 1000);
|
samps = step * (codec->implementation->samples_per_second / 1000);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
|
||||||
switch_core_file_seek(fh, &pos, samps, SEEK_CUR);
|
switch_core_file_seek(fhp, &pos, samps, SEEK_CUR);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
|
||||||
} else {
|
} else {
|
||||||
samps = step * (codec->implementation->samples_per_second / 1000);
|
samps = step * (codec->implementation->samples_per_second / 1000);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
|
||||||
switch_core_file_seek(fh, &pos, fh->pos - samps, SEEK_SET);
|
switch_core_file_seek(fhp, &pos, fhp->pos - samps, SEEK_SET);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
samps = atoi(p) * (codec->implementation->samples_per_second / 1000);
|
samps = atoi(p) * (codec->implementation->samples_per_second / 1000);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "going to seek\n");
|
||||||
switch_core_file_seek(fh, &pos, samps, SEEK_SET);
|
switch_core_file_seek(fhp, &pos, samps, SEEK_SET);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done seek\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1218,6 +1202,7 @@ SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *resul
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(result, "true") || !strcmp(result, "undefined")) {
|
if (!strcmp(result, "true") || !strcmp(result, "undefined")) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "return success\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "return success\n");
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user