Freeswitch-trunk
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
June 2007
- 7 participants
- 182 discussions
[commit] r5384 - in freeswitch/trunk/src: . include mod/applications/mod_dptools
by Freeswitch SVN 17 Jun '07
by Freeswitch SVN 17 Jun '07
17 Jun '07
Author: anthm
Date: Sat Jun 16 21:16:39 2007
New Revision: 5384
Modified:
freeswitch/trunk/src/include/switch_ivr.h
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/switch_ivr_originate.c
freeswitch/trunk/src/switch_ivr_play_say.c
Log:
add gentones app
Modified: freeswitch/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_ivr.h (original)
+++ freeswitch/trunk/src/include/switch_ivr.h Sat Jun 16 21:16:39 2007
@@ -267,6 +267,7 @@
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, char *file, switch_input_args_t *args);
+SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *session, char *script, int32_t loops, switch_input_args_t *args);
/*!
\brief record a file from the session to a file
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Sat Jun 16 21:16:39 2007
@@ -820,6 +820,35 @@
}
+static void gentones_function(switch_core_session_t *session, char *data)
+{
+ switch_channel_t *channel;
+ char *tone_script = NULL;
+ switch_input_args_t args = { 0 };
+ char *l;
+ int32_t loops = 0;
+
+ tone_script = switch_core_session_strdup(session, data);
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ switch_channel_pre_answer(channel);
+
+ if ((l = strchr(tone_script, '|'))) {
+ *l++ = '\0';
+ loops = atoi(l);
+
+ if (loops < 0) {
+ loops = -1;
+ }
+ }
+
+ args.input_callback = on_dtmf;
+ switch_ivr_gentones(session, tone_script, loops, &args);
+
+}
+
static void displace_session_function(switch_core_session_t *session, char *data)
{
switch_channel_t *channel;
@@ -1124,6 +1153,17 @@
/* flags */ SAF_NONE,
/*.next */ &stop_record_session_application_interface
};
+
+static switch_application_interface_t gentones_application_interface = {
+ /*.interface_name */ "gentones",
+ /*.application_function */ gentones_function,
+ /* long_desc */ "Generate tones to the channel",
+ /* short_desc */ "Generate Tones",
+ /* syntax */ "<tgml_script>[|<loops>]",
+ /* flags */ SAF_NONE,
+ /*.next */ &playback_application_interface
+};
+
static switch_application_interface_t park_application_interface = {
/*.interface_name */ "park",
/*.application_function */ park_function,
@@ -1131,7 +1171,7 @@
/* short_desc */ NULL,
/* syntax */ NULL,
/* flags */ SAF_NONE,
- /*.next */ &playback_application_interface
+ /*.next */ &gentones_application_interface
};
static switch_application_interface_t echo_application_interface = {
Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c (original)
+++ freeswitch/trunk/src/switch_ivr_originate.c Sat Jun 16 21:16:39 2007
@@ -663,6 +663,7 @@
} else {
teletone_init_session(&ringback.ts, 0, teletone_handler, &ringback);
+ ringback.ts.rate = read_codec->implementation->samples_per_second;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Play Ringback Tone [%s]\n", ringback_data);
//ringback.ts.debug = 1;
//ringback.ts.debug_stream = switch_core_get_console();
Modified: freeswitch/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_play_say.c (original)
+++ freeswitch/trunk/src/switch_ivr_play_say.c Sat Jun 16 21:16:39 2007
@@ -477,6 +477,94 @@
return status;
}
+static int teletone_handler(teletone_generation_session_t * ts, teletone_tone_map_t * map)
+{
+ switch_buffer_t *audio_buffer = ts->user_data;
+ int wrote;
+
+ if (!audio_buffer) {
+ return -1;
+ }
+
+ wrote = teletone_mux_tones(ts, map);
+ switch_buffer_write(audio_buffer, ts->buffer, wrote * 2);
+
+ return 0;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *session, char *script, int32_t loops, switch_input_args_t *args)
+{
+ teletone_generation_session_t ts;
+ switch_buffer_t *audio_buffer;
+ switch_frame_t *read_frame = NULL;
+ switch_codec_t *read_codec = NULL, write_codec;
+ switch_frame_t write_frame;
+ switch_byte_t data[1024];
+ switch_channel_t *channel;
+
+ assert(session != NULL);
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ switch_channel_pre_answer(channel);
+ read_codec = switch_core_session_get_read_codec(session);
+
+ if (switch_core_codec_init(&write_codec,
+ "L16",
+ NULL,
+ read_codec->implementation->samples_per_second,
+ read_codec->implementation->microseconds_per_frame / 1000,
+ 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+ NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+
+ return SWITCH_STATUS_FALSE;
+ }
+
+ write_frame.codec = &write_codec;
+ write_frame.data = data;
+
+ switch_buffer_create_dynamic(&audio_buffer, 512, 1024, 0);
+ teletone_init_session(&ts, 0, teletone_handler, audio_buffer);
+ ts.rate = read_codec->implementation->samples_per_second;
+
+ teletone_run(&ts, script);
+
+ if (loops) {
+ switch_buffer_set_loops(audio_buffer, loops);
+ }
+
+ while(switch_channel_ready(channel)) {
+ switch_status_t status = switch_core_session_read_frame(session, &read_frame, 1000, 0);
+
+ if (!SWITCH_READ_ACCEPTABLE(status)) {
+ break;
+ }
+
+ if (read_frame->datalen < 2 || switch_test_flag(read_frame, SFF_CNG)) {
+ continue;
+ }
+
+ if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(audio_buffer, write_frame.data,
+ read_frame->codec->implementation->bytes_per_frame)) <= 0) {
+ break;
+ }
+
+ write_frame.samples = write_frame.datalen / 2;
+
+ if (switch_core_session_write_frame(session, &write_frame, 1000, 0) != SWITCH_STATUS_SUCCESS) {
+ break;
+ }
+ }
+
+ switch_core_codec_destroy(&write_codec);
+ switch_buffer_destroy(&audio_buffer);
+ teletone_destroy_session(&ts);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
#define FILE_STARTSAMPLES 1024 * 32
#define FILE_BLOCKSIZE 1024 * 8
#define FILE_BUFSIZE 1024 * 64
1
0
16 Jun '07
Author: anthm
Date: Sat Jun 16 19:23:34 2007
New Revision: 5383
Modified:
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
Log:
fix typos
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Sat Jun 16 19:23:34 2007
@@ -1064,7 +1064,7 @@
};
static switch_application_interface_t displace_application_interface = {
- /*.interface_name */ "displace",
+ /*.interface_name */ "displace_session",
/*.application_function */ displace_session_function,
/* long_desc */ "Displace audio from a file to the channels input",
/* short_desc */ "Displace File",
@@ -1074,7 +1074,7 @@
};
static switch_application_interface_t stop_displace_application_interface = {
- /*.interface_name */ "displace",
+ /*.interface_name */ "stop_displace_session",
/*.application_function */ stop_displace_session_function,
/* long_desc */ "Stop Displacing to a file",
/* short_desc */ "Stop Displace File",
1
0
[commit] r5381 - in freeswitch/trunk: libs/libteletone libs/libteletone/src src src/include
by Freeswitch SVN 16 Jun '07
by Freeswitch SVN 16 Jun '07
16 Jun '07
Author: mikej
Date: Fri Jun 15 23:56:44 2007
New Revision: 5381
Modified:
freeswitch/trunk/libs/libteletone/src/libteletone_detect.c
freeswitch/trunk/libs/libteletone/teletone.def
freeswitch/trunk/src/include/switch_cpp.h
freeswitch/trunk/src/switch_cpp.cpp
Log:
fix windows build.
Modified: freeswitch/trunk/libs/libteletone/src/libteletone_detect.c
==============================================================================
--- freeswitch/trunk/libs/libteletone/src/libteletone_detect.c (original)
+++ freeswitch/trunk/libs/libteletone/src/libteletone_detect.c Fri Jun 15 23:56:44 2007
@@ -126,7 +126,7 @@
for (i = 0; i < samples; i++) {
v1 = goertzel_state->v2;
goertzel_state->v2 = goertzel_state->v3;
- goertzel_state->v3 = goertzel_state->fac*goertzel_state->v2 - v1 + sample_buffer[i];
+ goertzel_state->v3 = (float)(goertzel_state->fac*goertzel_state->v2 - v1 + sample_buffer[i]);
}
}
@@ -140,17 +140,17 @@
dtmf_detect_state->hit1 = dtmf_detect_state->hit2 = 0;
for (i = 0; i < GRID_FACTOR; i++) {
- theta = M_TWO_PI*(dtmf_row[i]/(float)sample_rate);
- dtmf_detect_row[i].fac = 2.0*cos(theta);
+ theta = (float)(M_TWO_PI*(dtmf_row[i]/(float)sample_rate));
+ dtmf_detect_row[i].fac = (float)(2.0f*cos(theta));
- theta = M_TWO_PI*(dtmf_col[i]/(float)sample_rate);
- dtmf_detect_col[i].fac = 2.0*cos(theta);
+ theta = (float)(M_TWO_PI*(dtmf_col[i]/(float)sample_rate));
+ dtmf_detect_col[i].fac = (float)(2.0f*cos(theta));
- theta = M_TWO_PI*(dtmf_row[i]*2.0/(float)sample_rate);
- dtmf_detect_row_2nd[i].fac = 2.0*cos(theta);
+ theta = (float)(M_TWO_PI*(dtmf_row[i]*2.0/(float)sample_rate));
+ dtmf_detect_row_2nd[i].fac = (float)(2.0f*cos(theta));
- theta = M_TWO_PI*(dtmf_col[i]*2.0/(float)sample_rate);
- dtmf_detect_col_2nd[i].fac = 2.0*cos(theta);
+ theta = (float)(M_TWO_PI*(dtmf_col[i]*2.0/(float)sample_rate));
+ dtmf_detect_col_2nd[i].fac = (float)(2.0f*cos(theta));
goertzel_init (&dtmf_detect_state->row_out[i], &dtmf_detect_row[i]);
goertzel_init (&dtmf_detect_state->col_out[i], &dtmf_detect_col[i]);
@@ -196,8 +196,8 @@
break;
}
mt->tone_count++;
- theta = M_TWO_PI*(map->freqs[x]/(float)mt->sample_rate);
- mt->tdd[x].fac = 2.0 * cos(theta);
+ theta = (float)(M_TWO_PI*(map->freqs[x]/(float)mt->sample_rate));
+ mt->tdd[x].fac = (float)(2.0f * cos(theta));
goertzel_init (&mt->gs[x], &mt->tdd[x]);
goertzel_init (&mt->gs2[x], &mt->tdd[x]);
}
@@ -230,11 +230,11 @@
for(x = 0; x < mt->tone_count; x++) {
v1 = mt->gs[x].v2;
mt->gs[x].v2 = mt->gs[x].v3;
- mt->gs[x].v3 = mt->gs[x].fac * mt->gs[x].v2 - v1 + famp;
+ mt->gs[x].v3 = (float)(mt->gs[x].fac * mt->gs[x].v2 - v1 + famp);
v1 = mt->gs2[x].v2;
mt->gs2[x].v2 = mt->gs2[x].v3;
- mt->gs2[x].v3 = mt->gs2[x].fac*mt->gs2[x].v2 - v1 + famp;
+ mt->gs2[x].v3 = (float)(mt->gs2[x].fac*mt->gs2[x].v2 - v1 + famp);
}
}
@@ -245,7 +245,7 @@
eng_sum = 0;
for(x = 0; x < mt->tone_count; x++) {
- eng_all[x] = teletone_goertzel_result (&mt->gs[x]);
+ eng_all[x] = (float)(teletone_goertzel_result (&mt->gs[x]));
eng_sum += eng_all[x];
}
@@ -325,19 +325,19 @@
for(x = 0; x < GRID_FACTOR; x++) {
v1 = dtmf_detect_state->row_out[x].v2;
dtmf_detect_state->row_out[x].v2 = dtmf_detect_state->row_out[x].v3;
- dtmf_detect_state->row_out[x].v3 = dtmf_detect_state->row_out[x].fac*dtmf_detect_state->row_out[x].v2 - v1 + famp;
+ dtmf_detect_state->row_out[x].v3 = (float)(dtmf_detect_state->row_out[x].fac*dtmf_detect_state->row_out[x].v2 - v1 + famp);
v1 = dtmf_detect_state->col_out[x].v2;
dtmf_detect_state->col_out[x].v2 = dtmf_detect_state->col_out[x].v3;
- dtmf_detect_state->col_out[x].v3 = dtmf_detect_state->col_out[x].fac*dtmf_detect_state->col_out[x].v2 - v1 + famp;
+ dtmf_detect_state->col_out[x].v3 = (float)(dtmf_detect_state->col_out[x].fac*dtmf_detect_state->col_out[x].v2 - v1 + famp);
v1 = dtmf_detect_state->col_out2nd[x].v2;
dtmf_detect_state->col_out2nd[x].v2 = dtmf_detect_state->col_out2nd[x].v3;
- dtmf_detect_state->col_out2nd[x].v3 = dtmf_detect_state->col_out2nd[x].fac*dtmf_detect_state->col_out2nd[x].v2 - v1 + famp;
+ dtmf_detect_state->col_out2nd[x].v3 = (float)(dtmf_detect_state->col_out2nd[x].fac*dtmf_detect_state->col_out2nd[x].v2 - v1 + famp);
v1 = dtmf_detect_state->row_out2nd[x].v2;
dtmf_detect_state->row_out2nd[x].v2 = dtmf_detect_state->row_out2nd[x].v3;
- dtmf_detect_state->row_out2nd[x].v3 = dtmf_detect_state->row_out2nd[x].fac*dtmf_detect_state->row_out2nd[x].v2 - v1 + famp;
+ dtmf_detect_state->row_out2nd[x].v3 = (float)(dtmf_detect_state->row_out2nd[x].fac*dtmf_detect_state->row_out2nd[x].v2 - v1 + famp);
}
}
@@ -348,15 +348,15 @@
}
/* We are at the end of a DTMF detection block */
/* Find the peak row and the peak column */
- row_energy[0] = teletone_goertzel_result (&dtmf_detect_state->row_out[0]);
- col_energy[0] = teletone_goertzel_result (&dtmf_detect_state->col_out[0]);
+ row_energy[0] = (float)(teletone_goertzel_result (&dtmf_detect_state->row_out[0]));
+ col_energy[0] = (float)(teletone_goertzel_result (&dtmf_detect_state->col_out[0]));
for (best_row = best_col = 0, i = 1; i < GRID_FACTOR; i++) {
- row_energy[i] = teletone_goertzel_result (&dtmf_detect_state->row_out[i]);
+ row_energy[i] = (float)(teletone_goertzel_result (&dtmf_detect_state->row_out[i]));
if (row_energy[i] > row_energy[best_row]) {
best_row = i;
}
- col_energy[i] = teletone_goertzel_result (&dtmf_detect_state->col_out[i]);
+ col_energy[i] = (float)(teletone_goertzel_result (&dtmf_detect_state->col_out[i]));
if (col_energy[i] > col_energy[best_col]) {
best_col = i;
}
Modified: freeswitch/trunk/libs/libteletone/teletone.def
==============================================================================
--- freeswitch/trunk/libs/libteletone/teletone.def (original)
+++ freeswitch/trunk/libs/libteletone/teletone.def Fri Jun 15 23:56:44 2007
@@ -5,7 +5,6 @@
teletone_init_session
teletone_set_map
teletone_set_tone
-teletone_goertzel_result
teletone_goertzel_update
teletone_dtmf_get
teletone_dtmf_detect
Modified: freeswitch/trunk/src/include/switch_cpp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_cpp.h (original)
+++ freeswitch/trunk/src/include/switch_cpp.h Fri Jun 15 23:56:44 2007
@@ -28,7 +28,7 @@
// eg, PyThreadState *threadState
void *extra; // currently used to store a switch_file_handle_t
char *funcargs; // extra string that will be passed to callback function
-};
+} input_callback_state;
class CoreSession {
Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp (original)
+++ freeswitch/trunk/src/switch_cpp.cpp Fri Jun 15 23:56:44 2007
@@ -212,8 +212,6 @@
switch_status_t status;
switch_file_handle_t fh = { 0 };
- unsigned int samps;
- unsigned int pos = 0;
char *prebuf;
sanity_check(-1);
1
0
[commit] r5380 - in freeswitch/trunk/src: . mod/applications/mod_commands mod/applications/mod_dptools
by Freeswitch SVN 16 Jun '07
by Freeswitch SVN 16 Jun '07
16 Jun '07
Author: anthm
Date: Fri Jun 15 23:43:13 2007
New Revision: 5380
Modified:
freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/switch_core_io.c
freeswitch/trunk/src/switch_ivr_async.c
Log:
finish up merge
Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Fri Jun 15 23:43:13 2007
@@ -284,7 +284,9 @@
time_t to = 0;
switch_core_session_t *rsession;
- mydata = switch_core_session_strdup(session, cmd);
+ mydata = strdup(cmd);
+ assert(mydata != NULL);
+
if ((argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]))) < 3) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID ARGS!\n");
}
@@ -296,15 +298,15 @@
if (argv[4]) {
uint32_t mto;
- if (*argv[2] == '+') {
- if ((mto = atoi(argv[3]+1)) > 0) {
+ if (*argv[4] == '+') {
+ if ((mto = atoi(argv[4]+1)) > 0) {
to = time(NULL) + mto;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
goto done;
}
} else {
- if ((to = atoi(argv[3])) < time(NULL)) {
+ if ((to = atoi(argv[4])) < time(NULL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
to = 0;
goto done;
@@ -317,6 +319,7 @@
done:
+ free(mydata);
switch_core_session_rwunlock(rsession);
return SWITCH_STATUS_SUCCESS;
@@ -1431,7 +1434,7 @@
};
static switch_api_interface_t tone_detect_session_interface = {
- /*.interface_name */ "tone_Detect",
+ /*.interface_name */ "tone_detect",
/*.desc */ "Start Tone Detection on a channel",
/*.function */ tone_detect_session_function,
/*.syntax */
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Fri Jun 15 23:43:13 2007
@@ -680,14 +680,14 @@
}
if (argv[3]) {
uint32_t mto;
- if (*argv[2] == '+') {
- if ((mto = atoi(argv[2]+1)) > 0) {
+ if (*argv[3] == '+') {
+ if ((mto = atol(argv[3]+1)) > 0) {
to = time(NULL) + mto;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
}
} else {
- if ((to = atoi(argv[2])) < time(NULL)) {
+ if ((to = atol(argv[3])) < time(NULL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
to = 0;
}
Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c (original)
+++ freeswitch/trunk/src/switch_core_io.c Fri Jun 15 23:43:13 2007
@@ -232,7 +232,7 @@
switch_mutex_lock(bp->read_mutex);
switch_buffer_write(bp->raw_read_buffer, read_frame->data, read_frame->datalen);
if (bp->callback) {
- if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ) == SWITCH_FALSE || (bp->stop_time && bp->stop_time >= time(NULL))) {
+ if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ) == SWITCH_FALSE || (bp->stop_time && bp->stop_time <= time(NULL))) {
ok = SWITCH_FALSE;
}
}
@@ -516,7 +516,7 @@
}
}
- if (bp->stop_time && bp->stop_time >= time(NULL)) {
+ if (bp->stop_time && bp->stop_time <= time(NULL)) {
ok = SWITCH_FALSE;
}
Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c (original)
+++ freeswitch/trunk/src/switch_ivr_async.c Fri Jun 15 23:43:13 2007
@@ -519,7 +519,8 @@
if (cont->list[i].up && teletone_multi_tone_detect(&cont->list[i].mt, frame->data, frame->samples)) {
switch_event_t *event;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "TONE %s DETECTED\n", cont->list[i].key);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "TONE %s DETECTED\n", cont->list[i].key);
+ cont->list[i].up = 0;
if (cont->list[i].app) {
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
@@ -531,8 +532,6 @@
}
}
- cont->list[cont->index].up = 0;
-
if (switch_event_create(&event, SWITCH_EVENT_DETECTED_TONE) == SWITCH_STATUS_SUCCESS) {
switch_event_t *dup;
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Detected-Tone", "%s", cont->list[i].key);
@@ -641,6 +640,7 @@
p = next + 1;
}
} while (next);
+ cont->list[cont->index].map.freqs[i++] = 0;
if (!ok) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid tone spec!\n");
@@ -675,6 +675,7 @@
}
}
+
if ((status = switch_core_media_bug_add(session, tone_detect_callback, cont, timeout, bflags, &cont->bug)) != SWITCH_STATUS_SUCCESS) {
return status;
}
1
0
[commit] r5379 - in freeswitch/trunk/src: . include mod/applications/mod_commands mod/applications/mod_dptools
by Freeswitch SVN 16 Jun '07
by Freeswitch SVN 16 Jun '07
16 Jun '07
Author: anthm
Date: Fri Jun 15 22:25:40 2007
New Revision: 5379
Modified:
freeswitch/trunk/src/include/switch_ivr.h
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/switch_event.c
freeswitch/trunk/src/switch_ivr_async.c
Log:
upgrade fax_detect to tone_detect
Modified: freeswitch/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_ivr.h (original)
+++ freeswitch/trunk/src/include/switch_ivr.h Fri Jun 15 22:25:40 2007
@@ -233,18 +233,27 @@
SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session);
/*!
- \brief Stop looking for FAX CNG
+ \brief Stop looking for TONES
\param session the session to stop looking
\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_stop_fax_detect_session(switch_core_session_t *session);
+SWITCH_DECLARE(switch_status_t) switch_ivr_stop_tone_detect_session(switch_core_session_t *session);
/*!
- \brief Start looking for FAX CNG
+ \brief Start looking for TONES
\param session the session to start looking
+ \param key the name of the tone.
+ \param tone_spec comma sep list of tone freqs
+ \param flags one or both of 'r' and 'w'
+ \param timeout timeout
+ \param app optional application to execute when tone is found
+ \param data optional data for appliaction
\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_fax_detect_session(switch_core_session_t *session);
+SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
+ const char *key, const char *tone_spec,
+ const char *flags, time_t timeout,
+ const char *app, const char *data);
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Fri Jun 15 22:25:40 2007
@@ -852,7 +852,7 @@
SWITCH_EVENT_CODEC - Codec Change
SWITCH_EVENT_BACKGROUND_JOB - Background Job
SWITCH_EVENT_DETECTED_SPEECH - Detected Speech
- SWITCH_EVENT_DETECTED_FAX - Detected Fax CNG Tone
+ SWITCH_EVENT_DETECTED_TONE - Detected Tone
SWITCH_EVENT_PRIVATE_COMMAND - A private command event
SWITCH_EVENT_HEARTBEAT - Machine is alive
SWITCH_EVENT_TRAP - Error Trap
@@ -902,7 +902,7 @@
SWITCH_EVENT_CODEC,
SWITCH_EVENT_BACKGROUND_JOB,
SWITCH_EVENT_DETECTED_SPEECH,
- SWITCH_EVENT_DETECTED_FAX,
+ SWITCH_EVENT_DETECTED_TONE,
SWITCH_EVENT_PRIVATE_COMMAND,
SWITCH_EVENT_HEARTBEAT,
SWITCH_EVENT_TRAP,
Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Fri Jun 15 22:25:40 2007
@@ -276,6 +276,51 @@
return SWITCH_STATUS_SUCCESS;
}
+SWITCH_STANDARD_API(tone_detect_session_function)
+{
+ char *argv[6] = { 0 };
+ int argc;
+ char *mydata = NULL;
+ time_t to = 0;
+ switch_core_session_t *rsession;
+
+ mydata = switch_core_session_strdup(session, cmd);
+ if ((argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]))) < 3) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID ARGS!\n");
+ }
+
+ if (!(rsession = switch_core_session_locate(argv[0]))) {
+ stream->write_function(stream, "-Error Cannot locate session!\n");
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ if (argv[4]) {
+ uint32_t mto;
+ if (*argv[2] == '+') {
+ if ((mto = atoi(argv[3]+1)) > 0) {
+ to = time(NULL) + mto;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
+ goto done;
+ }
+ } else {
+ if ((to = atoi(argv[3])) < time(NULL)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
+ to = 0;
+ goto done;
+ }
+ }
+ }
+
+ switch_ivr_tone_detect_session(rsession, argv[1], argv[2], argv[3], to, argv[5], argv[6]);
+ stream->write_function(stream, "Enabling tone detection '%s' '%s' '%s'\n", argv[1], argv[2], argv[3]);
+
+ done:
+
+ switch_core_session_rwunlock(rsession);
+
+ return SWITCH_STATUS_SUCCESS;
+}
SWITCH_STANDARD_API(sched_transfer_function)
{
@@ -1385,13 +1430,22 @@
/*.next */ &reload_api_interface
};
+static switch_api_interface_t tone_detect_session_interface = {
+ /*.interface_name */ "tone_Detect",
+ /*.desc */ "Start Tone Detection on a channel",
+ /*.function */ tone_detect_session_function,
+ /*.syntax */
+ "<uuid> <key> <tone_spec> [<flags> <timeout> <app> <args>]",
+ /*.next */ &kill_api_interface
+};
+
static switch_api_interface_t originate_api_interface = {
/*.interface_name */ "originate",
/*.desc */ "Originate a Call",
/*.function */ originate_function,
/*.syntax */
"<call url> <exten>|&<application_name>(<app_args>) [<dialplan>] [<context>] [<cid_name>] [<cid_num>] [<timeout_sec>]",
- /*.next */ &kill_api_interface
+ /*.next */ &tone_detect_session_interface
};
static switch_loadable_module_interface_t commands_module_interface = {
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Fri Jun 15 22:25:40 2007
@@ -664,20 +664,45 @@
static void fax_detect_session_function(switch_core_session_t *session, char *data)
{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Enabling fax detection\n");
- switch_ivr_fax_detect_session(session);
+ switch_ivr_tone_detect_session(session, "fax", "1100.0", "r", 0, NULL, NULL);
}
-static void system_session_function(switch_core_session_t *session, char *data)
+static void tone_detect_session_function(switch_core_session_t *session, char *data)
{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Executing command: %s\n",data);
- system(data);
+ char *argv[6] = { 0 };
+ int argc;
+ char *mydata = NULL;
+ time_t to = 0;
+
+ mydata = switch_core_session_strdup(session, data);
+ if ((argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]))) < 2) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID ARGS!\n");
+ }
+ if (argv[3]) {
+ uint32_t mto;
+ if (*argv[2] == '+') {
+ if ((mto = atoi(argv[2]+1)) > 0) {
+ to = time(NULL) + mto;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
+ }
+ } else {
+ if ((to = atoi(argv[2])) < time(NULL)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
+ to = 0;
+ }
+ }
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Enabling tone detection '%s' '%s'\n", argv[0], argv[1]);
+
+ switch_ivr_tone_detect_session(session, argv[0], argv[1], argv[2], to, argv[4], argv[5]);
}
static void stop_fax_detect_session_function(switch_core_session_t *session, char *data)
{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Disabling fax detection\n");
- switch_ivr_stop_fax_detect_session(session);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Disabling tone detection\n");
+ switch_ivr_stop_tone_detect_session(session);
}
static void echo_function(switch_core_session_t *session, char *data)
@@ -1018,15 +1043,6 @@
/*.next */ &dptools_api_interface
};
-static switch_application_interface_t system_application_interface = {
- /*.interface_name */ "system",
- /*.application_function */ system_session_function,
- /* long_desc */ "Execute a system command",
- /* short_desc */ "Execute a system command",
- /* syntax */ "<command>",
- /* flags */ SAF_NONE,
- /*.next */ NULL
-};
static switch_application_interface_t bridge_application_interface = {
/*.interface_name */ "bridge",
@@ -1034,8 +1050,7 @@
/* long_desc */ "Bridge the audio between two sessions",
/* short_desc */ "Bridge Audio",
/* syntax */ "<channel_url>",
- /* flags */ SAF_SUPPORT_NOMEDIA,
- /* next */ &system_application_interface
+ /* flags */ SAF_SUPPORT_NOMEDIA
};
static switch_application_interface_t speak_application_interface = {
@@ -1129,6 +1144,17 @@
/*.next */ &park_application_interface
};
+
+static switch_application_interface_t tone_detect_application_interface = {
+ /*.interface_name */ "tone_detect",
+ /*.application_function */ tone_detect_session_function,
+ /* long_desc */ "Detect tones",
+ /* short_desc */ "Detect tones",
+ /* syntax */ "",
+ /* flags */ SAF_NONE,
+ /*.next */ &echo_application_interface
+};
+
static switch_application_interface_t fax_detect_application_interface = {
/*.interface_name */ "fax_detect",
/*.application_function */ fax_detect_session_function,
@@ -1136,14 +1162,14 @@
/* short_desc */ "Detect faxes",
/* syntax */ "",
/* flags */ SAF_NONE,
- /*.next */ &echo_application_interface
+ /*.next */ &tone_detect_application_interface
};
-static switch_application_interface_t stop_fax_detect_application_interface = {
- /*.interface_name */ "stop_fax_detect",
+static switch_application_interface_t stop_tone_detect_application_interface = {
+ /*.interface_name */ "stop_tone_detect",
/*.application_function */ stop_fax_detect_session_function,
- /* long_desc */ "Stop detecting fax send tones",
- /* short_desc */ "stop detecting faxes",
+ /* long_desc */ "Stop detecting tones",
+ /* short_desc */ "stop detecting tones",
/* syntax */ "",
/* flags */ SAF_NONE,
/* next */ &fax_detect_application_interface
@@ -1156,7 +1182,7 @@
/* short_desc */ "Detect dtmf",
/* syntax */ "",
/* flags */ SAF_NONE,
- /* next */ &stop_fax_detect_application_interface
+ /* next */ &stop_tone_detect_application_interface
};
static switch_application_interface_t stop_dtmf_application_interface = {
Modified: freeswitch/trunk/src/switch_event.c
==============================================================================
--- freeswitch/trunk/src/switch_event.c (original)
+++ freeswitch/trunk/src/switch_event.c Fri Jun 15 22:25:40 2007
@@ -133,7 +133,7 @@
"CODEC",
"BACKGROUND_JOB",
"DETECTED_SPEECH",
- "DETECTED_FAX",
+ "DETECTED_TONE",
"PRIVATE_COMMAND",
"HEARTBEAT",
"TRAP",
Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c (original)
+++ freeswitch/trunk/src/switch_ivr_async.c Fri Jun 15 22:25:40 2007
@@ -138,18 +138,18 @@
if (dh->mux) {
int16_t buf[1024];
int16_t *fp = frame->data;
- int x;
+ uint32_t x;
switch_core_file_read(&dh->fh, buf, &len);
- for(x = 0; x < len; x++) {
+ for(x = 0; x < (uint32_t) len; x++) {
int32_t mixed = fp[x] + buf[x];
switch_normalize_to_16bit(mixed);
fp[x] = (int16_t) mixed;
}
} else {
switch_core_file_read(&dh->fh, frame->data, &len);
- frame->samples = len;
+ frame->samples = (uint32_t) len;
frame->datalen = frame->samples * 2;
}
switch_core_media_bug_set_write_replace_frame(bug, frame);
@@ -477,117 +477,211 @@
}
+#define MAX_TONES 16
typedef struct {
- switch_core_session_t *session;
- teletone_multi_tone_t mt;
-} switch_fax_detect_t;
-
-static switch_bool_t fax_detect_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
-{
- switch_fax_detect_t *pvt = (switch_fax_detect_t *) user_data;
- uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
- switch_frame_t frame = { 0 };
- // switch_channel_t *channel = switch_core_session_get_channel(pvt->session);
-
- // assert(channel != NULL);
- frame.data = data;
- frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
-
- switch (type) {
- case SWITCH_ABC_TYPE_INIT:
- break;
- case SWITCH_ABC_TYPE_CLOSE:
- break;
- case SWITCH_ABC_TYPE_READ:
- if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) {
- if(teletone_multi_tone_detect(&pvt->mt, frame.data, frame.samples)) {
- switch_event_t *event;
+ teletone_multi_tone_t mt;
+ char *app;
+ char *data;
+ char *key;
+ teletone_tone_map_t map;
+ int up;
+} switch_tone_detect_t;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FAX CNG DETECTED\n");
- if (switch_event_create(&event, SWITCH_EVENT_DETECTED_FAX) == SWITCH_STATUS_SUCCESS) {
- switch_event_t *dup;
+typedef struct {
+ switch_tone_detect_t list[MAX_TONES+1];
+ int index;
+ switch_media_bug_t *bug;
+ switch_core_session_t *session;
+} switch_tone_container_t;
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "fax", "detected");
-
- if (switch_event_dup(&dup, event) == SWITCH_STATUS_SUCCESS) {
- switch_event_fire(&dup);
- }
-
+static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
+{
+ switch_tone_container_t *cont = (switch_tone_container_t *) user_data;
+ switch_frame_t *frame = NULL;
+ int i = 0;
- if (switch_core_session_queue_event(pvt->session, &event) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Event queue failed!\n");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true");
- switch_event_fire(&event);
- }
+ switch (type) {
+ case SWITCH_ABC_TYPE_INIT:
+ break;
+ case SWITCH_ABC_TYPE_CLOSE:
+ break;
+ case SWITCH_ABC_TYPE_READ_REPLACE:
+ frame = switch_core_media_bug_get_read_replace_frame(bug);
+ case SWITCH_ABC_TYPE_WRITE_REPLACE:
+ {
+
+ if (!frame) {
+ frame = switch_core_media_bug_get_write_replace_frame(bug);
+ }
+
+ for (i = 0 ; i < cont->index; cont++) {
+ if (cont->list[i].up && teletone_multi_tone_detect(&cont->list[i].mt, frame->data, frame->samples)) {
+ switch_event_t *event;
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "TONE %s DETECTED\n", cont->list[i].key);
+
+ if (cont->list[i].app) {
+ if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-command", "execute");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-name", "%s", cont->list[i].app);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "execute-app-arg", "%s", cont->list[i].data);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5);
+ switch_core_session_queue_private_event(cont->session, &event);
+ }
+ }
+
+ cont->list[cont->index].up = 0;
+
+ if (switch_event_create(&event, SWITCH_EVENT_DETECTED_TONE) == SWITCH_STATUS_SUCCESS) {
+ switch_event_t *dup;
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Detected-Tone", "%s", cont->list[i].key);
+
+ if (switch_event_dup(&dup, event) == SWITCH_STATUS_SUCCESS) {
+ switch_event_fire(&dup);
+ }
+
+ if (switch_core_session_queue_event(cont->session, &event) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Event queue failed!\n");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true");
+ switch_event_fire(&event);
+ }
+ }
+ }
+ }
+ }
+ break;
+ case SWITCH_ABC_TYPE_WRITE:
+ default:
+ break;
}
- }
- }
- break;
- case SWITCH_ABC_TYPE_WRITE:
- default:
- break;
- }
- return SWITCH_TRUE;
+ return SWITCH_TRUE;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_stop_fax_detect_session(switch_core_session_t *session)
+SWITCH_DECLARE(switch_status_t) switch_ivr_stop_tone_detect_session(switch_core_session_t *session)
{
- switch_media_bug_t *bug;
- switch_channel_t *channel = switch_core_session_get_channel(session);
-
- assert(channel != NULL);
- if ((bug = switch_channel_get_private(channel, "fax"))) {
- switch_channel_set_private(channel, "fax", NULL);
- switch_core_media_bug_remove(session, &bug);
- return SWITCH_STATUS_SUCCESS;
- }
-
- return SWITCH_STATUS_FALSE;
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ switch_tone_container_t *cont;
+
+ assert(channel != NULL);
+ if ((cont = switch_channel_get_private(channel, "_tone_detect_"))) {
+ switch_channel_set_private(channel, "_tone_detect_", NULL);
+ switch_core_media_bug_remove(session, &cont->bug);
+ return SWITCH_STATUS_SUCCESS;
+ }
+ return SWITCH_STATUS_FALSE;
+
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_fax_detect_session(switch_core_session_t *session)
+SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
+ const char *key, const char *tone_spec,
+ const char *flags, time_t timeout,
+ const char *app, const char *data)
{
switch_channel_t *channel;
switch_codec_t *read_codec;
- switch_media_bug_t *bug;
switch_status_t status;
- switch_fax_detect_t *pvt;
- teletone_tone_map_t *map;
- int i;
+ switch_tone_container_t *cont = NULL;
+ char *p, *next;
+ int i = 0, ok = 0;
+
+ switch_media_bug_flag_t bflags = 0;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
-
read_codec = switch_core_session_get_read_codec(session);
assert(read_codec != NULL);
+
+ if (switch_strlen_zero(key)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Key Specified!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if ((cont = switch_channel_get_private(channel, "_tone_detect_"))) {
+ if (cont->index >= MAX_TONES) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Max Tones Reached!\n");
+ return SWITCH_STATUS_FALSE;
+ }
- if (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) {
- return SWITCH_STATUS_MEMERR;
+ for(i = 0; i < cont->index; i++) {
+ if (!strcasecmp(key, cont->list[cont->index].key )) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Renabling %s\n", key);
+ cont->list[cont->index].up = 1;
+ teletone_multi_tone_init(&cont->list[i].mt, &cont->list[i].map);
+ return SWITCH_STATUS_SUCCESS;
+ }
+ }
}
- if (!(map = switch_core_session_alloc(session, sizeof(*map)))) {
- return SWITCH_STATUS_MEMERR;
+ if (switch_strlen_zero(tone_spec)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Spec Specified!\n");
+ return SWITCH_STATUS_FALSE;
}
- for(i=0;i<TELETONE_MAX_TONES;i++) {
- map->freqs[i] = 1100.0;
+ if (!cont && !(cont = switch_core_session_alloc(session, sizeof(*cont)))) {
+ return SWITCH_STATUS_MEMERR;
}
- pvt->mt.sample_rate = read_codec->implementation->samples_per_second;
- pvt->session = session;
- teletone_multi_tone_init(&pvt->mt, map);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Adding tone spec %s index %d\n", tone_spec, cont->index);
- switch_channel_answer(channel);
+ i = 0;
+ p = (char *) tone_spec;
+
+ do {
+ teletone_process_t this;
+ next = strchr(p, ',');
+ while(*p == ' ') p++;
+ if ((this = (teletone_process_t) atof(p))) {
+ ok++;
+ cont->list[cont->index].map.freqs[i++] = this;
+ }
+ if (next) {
+ p = next + 1;
+ }
+ } while (next);
+
+ if (!ok) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid tone spec!\n");
+ return SWITCH_STATUS_FALSE;
+
+ }
- if ((status = switch_core_media_bug_add(session, fax_detect_callback, pvt, 0, SMBF_READ_STREAM, &bug)) != SWITCH_STATUS_SUCCESS) {
- return status;
+ cont->list[cont->index].key = switch_core_session_strdup(session, key);
+
+ if (app) {
+ cont->list[cont->index].app = switch_core_session_strdup(session, app);
+ }
+
+ if (data) {
+ cont->list[cont->index].data = switch_core_session_strdup(session, data);
}
- switch_channel_set_private(channel, "fax", bug);
+ cont->list[cont->index].up = 1;
+ cont->list[cont->index].mt.sample_rate = read_codec->implementation->samples_per_second;
+ teletone_multi_tone_init(&cont->list[cont->index].mt, &cont->list[cont->index].map);
+ cont->session = session;
+
+ switch_channel_answer(channel);
+
+ if (switch_strlen_zero(flags)) {
+ bflags = SMBF_READ_REPLACE;
+ } else {
+ if (strchr(flags, 'r')) {
+ bflags |= SMBF_READ_REPLACE;
+ } else if (strchr(flags, 'w')) {
+ bflags |= SMBF_WRITE_REPLACE;
+ }
+ }
+
+ if ((status = switch_core_media_bug_add(session, tone_detect_callback, cont, timeout, bflags, &cont->bug)) != SWITCH_STATUS_SUCCESS) {
+ return status;
+ }
+ switch_channel_set_private(channel, "_tone_detect_", cont);
+ cont->index++;
+
return SWITCH_STATUS_SUCCESS;
}
1
0
16 Jun '07
Author: anthm
Date: Fri Jun 15 20:21:01 2007
New Revision: 5378
Modified:
freeswitch/trunk/libs/libteletone/src/libteletone_detect.c
freeswitch/trunk/libs/libteletone/src/libteletone_detect.h
freeswitch/trunk/src/switch_ivr_async.c
Log:
fix tones stuff on 64bit
Modified: freeswitch/trunk/libs/libteletone/src/libteletone_detect.c
==============================================================================
--- freeswitch/trunk/libs/libteletone/src/libteletone_detect.c (original)
+++ freeswitch/trunk/libs/libteletone/src/libteletone_detect.c Fri Jun 15 20:21:01 2007
@@ -106,9 +106,8 @@
static teletone_detection_descriptor_t dtmf_detect_row_2nd[GRID_FACTOR];
static teletone_detection_descriptor_t dtmf_detect_col_2nd[GRID_FACTOR];
-static teletone_process_t dtmf_row[] = {697.0, 770.0, 852.0, 941.0};
-static teletone_process_t dtmf_col[] = {1209.0, 1336.0, 1477.0, 1633.0};
-
+static float dtmf_row[] = {697.0f, 770.0f, 852.0f, 941.0f};
+static float dtmf_col[] = {1209.0f, 1336.0f, 1477.0f, 1633.0f};
static char dtmf_positions[] = "123A" "456B" "789C" "*0#D";
@@ -122,7 +121,7 @@
int samples)
{
int i;
- teletone_process_t v1;
+ float v1;
for (i = 0; i < samples; i++) {
v1 = goertzel_state->v2;
@@ -131,29 +130,26 @@
}
}
-teletone_process_t teletone_goertzel_result (teletone_goertzel_state_t *goertzel_state)
-{
- return goertzel_state->v3 * goertzel_state->v3 + goertzel_state->v2 * goertzel_state->v2 - goertzel_state->v2 * goertzel_state->v3 * goertzel_state->fac;
-}
+#define teletone_goertzel_result(gs) ((gs)->v3 * (gs)->v3 + (gs)->v2 * (gs)->v2 - (gs)->v2 * (gs)->v3 * (gs)->fac)
void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate)
{
int i;
- teletone_process_t theta;
+ float theta;
dtmf_detect_state->hit1 = dtmf_detect_state->hit2 = 0;
for (i = 0; i < GRID_FACTOR; i++) {
- theta = M_TWO_PI*(dtmf_row[i]/(teletone_process_t)sample_rate);
+ theta = M_TWO_PI*(dtmf_row[i]/(float)sample_rate);
dtmf_detect_row[i].fac = 2.0*cos(theta);
- theta = M_TWO_PI*(dtmf_col[i]/(teletone_process_t)sample_rate);
+ theta = M_TWO_PI*(dtmf_col[i]/(float)sample_rate);
dtmf_detect_col[i].fac = 2.0*cos(theta);
- theta = M_TWO_PI*(dtmf_row[i]*2.0/(teletone_process_t)sample_rate);
+ theta = M_TWO_PI*(dtmf_row[i]*2.0/(float)sample_rate);
dtmf_detect_row_2nd[i].fac = 2.0*cos(theta);
- theta = M_TWO_PI*(dtmf_col[i]*2.0/(teletone_process_t)sample_rate);
+ theta = M_TWO_PI*(dtmf_col[i]*2.0/(float)sample_rate);
dtmf_detect_col_2nd[i].fac = 2.0*cos(theta);
goertzel_init (&dtmf_detect_state->row_out[i], &dtmf_detect_row[i]);
@@ -172,7 +168,7 @@
void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map)
{
- teletone_process_t theta = 0;
+ float theta = 0;
int x = 0;
if(!mt->min_samples) {
@@ -200,7 +196,7 @@
break;
}
mt->tone_count++;
- theta = M_TWO_PI*(map->freqs[x]/(teletone_process_t)mt->sample_rate);
+ theta = M_TWO_PI*(map->freqs[x]/(float)mt->sample_rate);
mt->tdd[x].fac = 2.0 * cos(theta);
goertzel_init (&mt->gs[x], &mt->tdd[x]);
goertzel_init (&mt->gs2[x], &mt->tdd[x]);
@@ -213,8 +209,8 @@
int samples)
{
int sample, limit, j, x = 0;
- teletone_process_t v1, famp;
- teletone_process_t eng_sum = 0, eng_all[TELETONE_MAX_TONES];
+ float v1, famp;
+ float eng_sum = 0, eng_all[TELETONE_MAX_TONES];
int gtest = 0, see_hit = 0;
for (sample = 0; sample < samples; sample = limit) {
@@ -299,10 +295,10 @@
int16_t sample_buffer[],
int samples)
{
- teletone_process_t row_energy[GRID_FACTOR];
- teletone_process_t col_energy[GRID_FACTOR];
- teletone_process_t famp;
- teletone_process_t v1;
+ float row_energy[GRID_FACTOR];
+ float col_energy[GRID_FACTOR];
+ float famp;
+ float v1;
int i;
int j;
int sample;
Modified: freeswitch/trunk/libs/libteletone/src/libteletone_detect.h
==============================================================================
--- freeswitch/trunk/libs/libteletone/src/libteletone_detect.h (original)
+++ freeswitch/trunk/libs/libteletone/src/libteletone_detect.h Fri Jun 15 20:21:01 2007
@@ -136,9 +136,9 @@
/*! \brief A continer for the elements of a Goertzel Algorithm (The names are from his formula) */
typedef struct {
- teletone_process_t v2;
- teletone_process_t v3;
- teletone_process_t fac;
+ float v2;
+ float v3;
+ double fac;
} teletone_goertzel_state_t;
/*! \brief A container for a DTMF detection state.*/
@@ -153,7 +153,7 @@
teletone_goertzel_state_t col_out[GRID_FACTOR];
teletone_goertzel_state_t row_out2nd[GRID_FACTOR];
teletone_goertzel_state_t col_out2nd[GRID_FACTOR];
- teletone_process_t energy;
+ float energy;
int current_sample;
char digits[TELETONE_MAX_DTMF_DIGITS + 1];
@@ -165,7 +165,7 @@
/*! \brief An abstraction to store the coefficient of a tone frequency */
typedef struct {
- teletone_process_t fac;
+ float fac;
} teletone_detection_descriptor_t;
/*! \brief A container for a single multi-tone detection
@@ -180,7 +180,7 @@
teletone_goertzel_state_t gs2[TELETONE_MAX_TONES];
int tone_count;
- teletone_process_t energy;
+ float energy;
int current_sample;
int min_samples;
@@ -253,13 +253,6 @@
int16_t sample_buffer[],
int samples);
- /*!
- \brief Compute the result of the last applied step of the Goertzel Algorithm
- \param goertzel_state the goertzel state to retrieve from
- \return the computed value for consideration in furthur audio tests
- */
- teletone_process_t teletone_goertzel_result (teletone_goertzel_state_t *goertzel_state);
-
#ifdef __cplusplus
Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c (original)
+++ freeswitch/trunk/src/switch_ivr_async.c Fri Jun 15 20:21:01 2007
@@ -503,7 +503,7 @@
if(teletone_multi_tone_detect(&pvt->mt, frame.data, frame.samples)) {
switch_event_t *event;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX CNG DETECTED\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FAX CNG DETECTED\n");
if (switch_event_create(&event, SWITCH_EVENT_DETECTED_FAX) == SWITCH_STATUS_SUCCESS) {
switch_event_t *dup;
1
0
15 Jun '07
Author: greenlizard
Date: Fri Jun 15 16:37:28 2007
New Revision: 5377
Modified:
freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
Log:
had to reswig w/ swig 1.3.31 in order to compile with trunk makefile
Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py Fri Jun 15 16:37:28 2007
@@ -1,10 +1,16 @@
-# This file was created automatically by SWIG 1.3.29.
+# This file was automatically generated by SWIG (http://www.swig.org)
+# Version 1.3.31
+#
# Don't modify this file, modify the SWIG interface instead.
# This file is compatible with both classic and new-style classes.
import _freeswitch
import new
new_instancemethod = new.instancemethod
+try:
+ _swig_property = property
+except NameError:
+ pass # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
if (name == "thisown"): return self.this.own(value)
if (name == "this"):
@@ -55,16 +61,16 @@
__repr__ = _swig_repr
__swig_setmethods__["function"] = _freeswitch.input_callback_state_function_set
__swig_getmethods__["function"] = _freeswitch.input_callback_state_function_get
- if _newclass:function = property(_freeswitch.input_callback_state_function_get, _freeswitch.input_callback_state_function_set)
+ if _newclass:function = _swig_property(_freeswitch.input_callback_state_function_get, _freeswitch.input_callback_state_function_set)
__swig_setmethods__["threadState"] = _freeswitch.input_callback_state_threadState_set
__swig_getmethods__["threadState"] = _freeswitch.input_callback_state_threadState_get
- if _newclass:threadState = property(_freeswitch.input_callback_state_threadState_get, _freeswitch.input_callback_state_threadState_set)
+ if _newclass:threadState = _swig_property(_freeswitch.input_callback_state_threadState_get, _freeswitch.input_callback_state_threadState_set)
__swig_setmethods__["extra"] = _freeswitch.input_callback_state_extra_set
__swig_getmethods__["extra"] = _freeswitch.input_callback_state_extra_get
- if _newclass:extra = property(_freeswitch.input_callback_state_extra_get, _freeswitch.input_callback_state_extra_set)
+ if _newclass:extra = _swig_property(_freeswitch.input_callback_state_extra_get, _freeswitch.input_callback_state_extra_set)
__swig_setmethods__["funcargs"] = _freeswitch.input_callback_state_funcargs_set
__swig_getmethods__["funcargs"] = _freeswitch.input_callback_state_funcargs_get
- if _newclass:funcargs = property(_freeswitch.input_callback_state_funcargs_get, _freeswitch.input_callback_state_funcargs_set)
+ if _newclass:funcargs = _swig_property(_freeswitch.input_callback_state_funcargs_get, _freeswitch.input_callback_state_funcargs_set)
def __init__(self, *args):
this = _freeswitch.new_input_callback_state(*args)
try: self.this.append(this)
@@ -88,13 +94,13 @@
__del__ = lambda self : None;
__swig_setmethods__["session"] = _freeswitch.CoreSession_session_set
__swig_getmethods__["session"] = _freeswitch.CoreSession_session_get
- if _newclass:session = property(_freeswitch.CoreSession_session_get, _freeswitch.CoreSession_session_set)
+ if _newclass:session = _swig_property(_freeswitch.CoreSession_session_get, _freeswitch.CoreSession_session_set)
__swig_setmethods__["channel"] = _freeswitch.CoreSession_channel_set
__swig_getmethods__["channel"] = _freeswitch.CoreSession_channel_get
- if _newclass:channel = property(_freeswitch.CoreSession_channel_get, _freeswitch.CoreSession_channel_set)
+ if _newclass:channel = _swig_property(_freeswitch.CoreSession_channel_get, _freeswitch.CoreSession_channel_set)
__swig_setmethods__["cb_state"] = _freeswitch.CoreSession_cb_state_set
__swig_getmethods__["cb_state"] = _freeswitch.CoreSession_cb_state_get
- if _newclass:cb_state = property(_freeswitch.CoreSession_cb_state_get, _freeswitch.CoreSession_cb_state_set)
+ if _newclass:cb_state = _swig_property(_freeswitch.CoreSession_cb_state_get, _freeswitch.CoreSession_cb_state_set)
def answer(*args): return _freeswitch.CoreSession_answer(*args)
def preAnswer(*args): return _freeswitch.CoreSession_preAnswer(*args)
def hangup(*args): return _freeswitch.CoreSession_hangup(*args)
@@ -118,10 +124,10 @@
PythonDTMFCallback = _freeswitch.PythonDTMFCallback
class PySession(CoreSession):
__swig_setmethods__ = {}
- for _s in [CoreSession]: __swig_setmethods__.update(_s.__swig_setmethods__)
+ for _s in [CoreSession]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
__setattr__ = lambda self, name, value: _swig_setattr(self, PySession, name, value)
__swig_getmethods__ = {}
- for _s in [CoreSession]: __swig_getmethods__.update(_s.__swig_getmethods__)
+ for _s in [CoreSession]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
__getattr__ = lambda self, name: _swig_getattr(self, PySession, name)
__repr__ = _swig_repr
def __init__(self, *args):
Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp Fri Jun 15 16:37:28 2007
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org)
- * Version 1.3.29
+ * Version 1.3.31
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@@ -120,7 +120,7 @@
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif
@@ -137,7 +137,7 @@
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "2"
+#define SWIG_RUNTIME_VERSION "3"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
@@ -714,8 +714,6 @@
-/* Python.h has to appear first */
-#include <Python.h>
/* Add PyOS_snprintf for old Pythons */
#if PY_VERSION_HEX < 0x02020000
@@ -796,6 +794,14 @@
}
#endif
+/* Py_ssize_t for old Pythons */
+/* This code is as recommended by: */
+/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
+#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
+typedef int Py_ssize_t;
+# define PY_SSIZE_T_MAX INT_MAX
+# define PY_SSIZE_T_MIN INT_MIN
+#endif
/* -----------------------------------------------------------------------------
* error manipulation
@@ -1189,7 +1195,7 @@
SWIGRUNTIMEINLINE PyObject *
_SWIG_Py_None(void)
{
- PyObject *none = Py_BuildValue("");
+ PyObject *none = Py_BuildValue((char*)"");
Py_DECREF(none);
return none;
}
@@ -2048,7 +2054,7 @@
void *vptr = 0;
/* here we get the method pointer for callbacks */
- char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
+ const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
if (desc) {
desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
@@ -2169,7 +2175,7 @@
return;
}
#endif
- dict = PyObject_GetAttrString(inst, "__dict__");
+ dict = PyObject_GetAttrString(inst, (char*)"__dict__");
PyDict_SetItem(dict, SWIG_This(), swig_this);
Py_DECREF(dict);
}
@@ -2310,7 +2316,7 @@
/* The python cached type query */
SWIGRUNTIME PyObject *
-SWIG_Python_TypeCache() {
+SWIG_Python_TypeCache(void) {
static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
return cache;
}
@@ -2480,7 +2486,7 @@
#if (PY_VERSION_HEX <= 0x02000000)
# if !defined(SWIG_PYTHON_CLASSIC)
-# error "This python version requires to use swig with the '-classic' option"
+# error "This python version requires swig to be run with the '-classic' option"
# endif
#endif
@@ -2491,7 +2497,8 @@
#define SWIG_name "_freeswitch"
-#define SWIGVERSION 0x010329
+#define SWIGVERSION 0x010331
+#define SWIG_VERSION SWIGVERSION
#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
@@ -2566,7 +2573,7 @@
SWIGINTERN swig_type_info*
-SWIG_pchar_descriptor()
+SWIG_pchar_descriptor(void)
{
static int init = 0;
static swig_type_info* info = 0;
@@ -2582,7 +2589,7 @@
SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
{
if (PyString_Check(obj)) {
- char *cstr; int len;
+ char *cstr; Py_ssize_t len;
PyString_AsStringAndSize(obj, &cstr, &len);
if (cptr) {
if (alloc) {
@@ -3104,12 +3111,12 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log" "', argument " "1"" of type '" "char *""'");
}
- arg1 = buf1;
+ arg1 = reinterpret_cast< char * >(buf1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
console_log(arg1,arg2);
resultobj = SWIG_Py_Void();
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
@@ -3135,7 +3142,7 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_clean_log" "', argument " "1"" of type '" "char *""'");
}
- arg1 = buf1;
+ arg1 = reinterpret_cast< char * >(buf1);
console_clean_log(arg1);
resultobj = SWIG_Py_Void();
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
@@ -3165,14 +3172,14 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "api_execute" "', argument " "1"" of type '" "char *""'");
}
- arg1 = buf1;
+ arg1 = reinterpret_cast< char * >(buf1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "api_execute" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (char *)api_execute(arg1,arg2);
- resultobj = SWIG_FromCharPtr(result);
+ resultobj = SWIG_FromCharPtr((const char *)result);
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return resultobj;
@@ -3196,7 +3203,7 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "api_reply_delete" "', argument " "1"" of type '" "char *""'");
}
- arg1 = buf1;
+ arg1 = reinterpret_cast< char * >(buf1);
api_reply_delete(arg1);
resultobj = SWIG_Py_Void();
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
@@ -3229,7 +3236,7 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "process_callback_result" "', argument " "1"" of type '" "char *""'");
}
- arg1 = buf1;
+ arg1 = reinterpret_cast< char * >(buf1);
res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "process_callback_result" "', argument " "2"" of type '" "input_callback_state *""'");
@@ -3425,11 +3432,11 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_funcargs_set" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
if (arg1->funcargs) delete[] arg1->funcargs;
if (arg2) {
- size_t size = strlen(arg2) + 1;
- arg1->funcargs = reinterpret_cast< char* >(memcpy((new char[size]), arg2, sizeof(char)*(size)));
+ size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+ arg1->funcargs = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
} else {
arg1->funcargs = 0;
}
@@ -3457,7 +3464,7 @@
}
arg1 = reinterpret_cast< input_callback_state * >(argp1);
result = (char *) ((arg1)->funcargs);
- resultobj = SWIG_FromCharPtr(result);
+ resultobj = SWIG_FromCharPtr((const char *)result);
return resultobj;
fail:
return NULL;
@@ -3520,7 +3527,7 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_CoreSession" "', argument " "1"" of type '" "char *""'");
}
- arg1 = buf1;
+ arg1 = reinterpret_cast< char * >(buf1);
result = (CoreSession *)new CoreSession(arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CoreSession, SWIG_POINTER_NEW | 0 );
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
@@ -3582,7 +3589,7 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"No matching function for overloaded 'new_CoreSession'");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_CoreSession'.\n Possible C/C++ prototypes are:\n CoreSession(char *)\n CoreSession(switch_core_session_t *)\n");
return NULL;
}
@@ -3834,7 +3841,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
(arg1)->hangup(arg2);
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
@@ -3872,12 +3879,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3"" of type '" "char *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
(arg1)->setVariable(arg2,arg3);
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
@@ -3913,9 +3920,9 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (char *)(arg1)->getVariable(arg2);
- resultobj = SWIG_FromCharPtr(result);
+ resultobj = SWIG_FromCharPtr((const char *)result);
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return resultobj;
fail:
@@ -3952,12 +3959,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_playFile" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_playFile" "', argument " "3"" of type '" "char *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
result = (int)(arg1)->playFile(arg2,arg3);
resultobj = SWIG_From_int(static_cast< int >(result));
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
@@ -4055,7 +4062,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
result = (int)(arg1)->speak(arg2);
resultobj = SWIG_From_int(static_cast< int >(result));
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
@@ -4093,12 +4100,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3"" of type '" "char *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
(arg1)->set_tts_parms(arg2,arg3);
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
@@ -4170,7 +4177,7 @@
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "char *""'");
}
- arg4 = buf4;
+ arg4 = reinterpret_cast< char * >(buf4);
res5 = SWIG_AsCharPtrAndSize(obj4, &t5, &n5, &alloc5);
if (!SWIG_IsOK(res5)) {
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_getDigits" "', argument " "5"" of type '" "char *terminator""'");
@@ -4232,17 +4239,17 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3"" of type '" "char *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4"" of type '" "char *""'");
}
- arg4 = buf4;
+ arg4 = reinterpret_cast< char * >(buf4);
result = (int)(arg1)->transfer(arg2,arg3,arg4);
resultobj = SWIG_From_int(static_cast< int >(result));
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
@@ -4338,17 +4345,17 @@
if (!SWIG_IsOK(res6)) {
SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6"" of type '" "char *""'");
}
- arg6 = buf6;
+ arg6 = reinterpret_cast< char * >(buf6);
res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
if (!SWIG_IsOK(res7)) {
SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7"" of type '" "char *""'");
}
- arg7 = buf7;
+ arg7 = reinterpret_cast< char * >(buf7);
res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
if (!SWIG_IsOK(res8)) {
SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8"" of type '" "char *""'");
}
- arg8 = buf8;
+ arg8 = reinterpret_cast< char * >(buf8);
res9 = SWIG_AsCharPtrAndSize(obj8, &t9, &n9, &alloc9);
if (!SWIG_IsOK(res9)) {
SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9"" of type '" "char *dtmf_buf""'");
@@ -4362,7 +4369,7 @@
if (!SWIG_IsOK(res10)) {
SWIG_exception_fail(SWIG_ArgError(res10), "in method '" "CoreSession_playAndGetDigits" "', argument " "10"" of type '" "char *""'");
}
- arg10 = buf10;
+ arg10 = reinterpret_cast< char * >(buf10);
result = (int)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10);
resultobj = SWIG_From_int(static_cast< int >(result));
arg9[128] = 0;
@@ -4408,7 +4415,7 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamfile" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
ecode3 = SWIG_AsVal_int(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamfile" "', argument " "3"" of type '" "int""'");
@@ -4473,12 +4480,12 @@
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
}
- arg2 = buf2;
+ arg2 = reinterpret_cast< char * >(buf2);
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3"" of type '" "char *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
(arg1)->execute(arg2,arg3);
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
@@ -4616,7 +4623,7 @@
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySession" "', argument " "1"" of type '" "char *""'");
}
- arg1 = buf1;
+ arg1 = reinterpret_cast< char * >(buf1);
result = (PySession *)new PySession(arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW | 0 );
if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
@@ -4678,7 +4685,7 @@
}
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"No matching function for overloaded 'new_PySession'");
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_PySession'.\n Possible C/C++ prototypes are:\n PySession(char *)\n PySession(switch_core_session_t *)\n");
return NULL;
}
@@ -4730,7 +4737,7 @@
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySession_setDTMFCallback" "', argument " "3"" of type '" "char *""'");
}
- arg3 = buf3;
+ arg3 = reinterpret_cast< char * >(buf3);
(arg1)->setDTMFCallback(arg2,arg3);
resultobj = SWIG_Py_Void();
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
@@ -4928,7 +4935,7 @@
* structures together.
*
* The generated swig_type_info structures are assigned staticly to an initial
- * array. We just loop though that array, and handle each type individually.
+ * array. We just loop through that array, and handle each type individually.
* First we lookup if this type has been already loaded, and if so, use the
* loaded structure instead of the generated one. Then we have to fill in the
* cast linked list. The cast data is initially stored in something like a
@@ -4966,30 +4973,47 @@
#define SWIGRUNTIME_DEBUG
#endif
+
SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
- swig_module_info *module_head;
- static int init_run = 0;
+ swig_module_info *module_head, *iter;
+ int found;
clientdata = clientdata;
- if (init_run) return;
- init_run = 1;
-
- /* Initialize the swig_module */
- swig_module.type_initial = swig_type_initial;
- swig_module.cast_initial = swig_cast_initial;
+ /* check to see if the circular list has been setup, if not, set it up */
+ if (swig_module.next==0) {
+ /* Initialize the swig_module */
+ swig_module.type_initial = swig_type_initial;
+ swig_module.cast_initial = swig_cast_initial;
+ swig_module.next = &swig_module;
+ }
/* Try and load any already created modules */
module_head = SWIG_GetModule(clientdata);
- if (module_head) {
+ if (!module_head) {
+ /* This is the first module loaded for this interpreter */
+ /* so set the swig module into the interpreter */
+ SWIG_SetModule(clientdata, &swig_module);
+ module_head = &swig_module;
+ } else {
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+ found=0;
+ iter=module_head;
+ do {
+ if (iter==&swig_module) {
+ found=1;
+ break;
+ }
+ iter=iter->next;
+ } while (iter!= module_head);
+
+ /* if the is found in the list, then all is done and we may leave */
+ if (found) return;
+ /* otherwise we must add out module into the list */
swig_module.next = module_head->next;
module_head->next = &swig_module;
- } else {
- /* This is the first module loaded */
- swig_module.next = &swig_module;
- SWIG_SetModule(clientdata, &swig_module);
}
/* Now work on filling in swig_module.types */
@@ -5302,7 +5326,7 @@
}
SWIGINTERN PyObject *
- SWIG_globals() {
+ SWIG_globals(void) {
static PyObject *_SWIG_globals = 0;
if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();
return _SWIG_globals;
@@ -5347,11 +5371,11 @@
swig_type_info **types_initial) {
size_t i;
for (i = 0; methods[i].ml_name; ++i) {
- char *c = methods[i].ml_doc;
+ const char *c = methods[i].ml_doc;
if (c && (c = strstr(c, "swig_ptr: "))) {
int j;
swig_const_info *ci = 0;
- char *name = c + 10;
+ const char *name = c + 10;
for (j = 0; const_table[j].type; ++j) {
if (strncmp(const_table[j].name, name,
strlen(const_table[j].name)) == 0) {
1
0
Author: mikej
Date: Fri Jun 15 13:40:44 2007
New Revision: 5376
Modified:
freeswitch/trunk/build/modules.conf.in
Log:
add mod_python to modules.conf.in
Modified: freeswitch/trunk/build/modules.conf.in
==============================================================================
--- freeswitch/trunk/build/modules.conf.in (original)
+++ freeswitch/trunk/build/modules.conf.in Fri Jun 15 13:40:44 2007
@@ -38,6 +38,7 @@
formats/mod_sndfile
#formats/mod_shout
#languages/mod_perl
+#languages/mod_python
#languages/mod_spidermonkey
#languages/mod_spidermonkey_teletone
#languages/mod_spidermonkey_core_db
1
0
15 Jun '07
Author: mikej
Date: Fri Jun 15 13:39:18 2007
New Revision: 5375
Modified:
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
Log:
add system application (MODAPP-14)
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Fri Jun 15 13:39:18 2007
@@ -668,6 +668,12 @@
switch_ivr_fax_detect_session(session);
}
+static void system_session_function(switch_core_session_t *session, char *data)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Executing command: %s\n",data);
+ system(data);
+}
+
static void stop_fax_detect_session_function(switch_core_session_t *session, char *data)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Disabling fax detection\n");
@@ -1012,6 +1018,15 @@
/*.next */ &dptools_api_interface
};
+static switch_application_interface_t system_application_interface = {
+ /*.interface_name */ "system",
+ /*.application_function */ system_session_function,
+ /* long_desc */ "Execute a system command",
+ /* short_desc */ "Execute a system command",
+ /* syntax */ "<command>",
+ /* flags */ SAF_NONE,
+ /*.next */ NULL
+};
static switch_application_interface_t bridge_application_interface = {
/*.interface_name */ "bridge",
@@ -1019,7 +1034,8 @@
/* long_desc */ "Bridge the audio between two sessions",
/* short_desc */ "Bridge Audio",
/* syntax */ "<channel_url>",
- /* flags */ SAF_SUPPORT_NOMEDIA
+ /* flags */ SAF_SUPPORT_NOMEDIA,
+ /* next */ &system_application_interface
};
static switch_application_interface_t speak_application_interface = {
1
0
[commit] r5374 - in freeswitch/trunk: scripts src src/include src/mod/languages/mod_python
by Freeswitch SVN 15 Jun '07
by Freeswitch SVN 15 Jun '07
15 Jun '07
Author: mikej
Date: Fri Jun 15 13:25:41 2007
New Revision: 5374
Modified:
freeswitch/trunk/scripts/mytest.py
freeswitch/trunk/src/include/switch_cpp.h
freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp
freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h
freeswitch/trunk/src/mod/languages/mod_python/mod_python.c
freeswitch/trunk/src/mod/languages/mod_python/mod_python.i
freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
freeswitch/trunk/src/switch_cpp.cpp
Log:
merge fix for MODLANG-33 and MODLANG-34.
Modified: freeswitch/trunk/scripts/mytest.py
==============================================================================
--- freeswitch/trunk/scripts/mytest.py (original)
+++ freeswitch/trunk/scripts/mytest.py Fri Jun 15 13:25:41 2007
@@ -1,26 +1,39 @@
+# Please see latest version of this script at
+# http://wiki.freeswitch.org/wiki/Mod_python
+# before reporting errors
+
import sys, time
-def onDTMF(input, itype, buf, buflen):
- print "input=",input
- print "itype=",itype
- print "buf=",buf
- print "buflen",buflen
- if input == "#":
- return 1
- else:
- return 0
-console_log("1","test from my python program\n")
-session.answer()
-session.setDTMFCallback(onDTMF)
-session.set_tts_parms("cepstral", "david")
-session.playFile("/root/test.gsm", "")
-session.speakText("Please enter telephone number with area code and press pound sign. ")
-input = session.getDigits("", 11, "*#", 10000)
-console_log("1","result from get digits is "+ input +"\n")
-phone_number = session.playAndGetDigits(5, 11, 3, 10000, "*#",
- "/sounds/test.gsm",
- "/sounds/invalid.gsm",
- "",
- "^17771112222$");
-console_log("1","result from play_and_get_digits is "+ phone_number +"\n")
-session.transfer("1000", "XML", "default")
-session.hangup("1")
+from freeswitch import *
+
+def onDTMF(input, itype, funcargs):
+ console_log("1","\n\nonDTMF input: %s\n" % input)
+ if input == "5":
+ return "pause"
+ if input == "3":
+ return "seek:+60000"
+ if input == "1":
+ return "seek:-60000"
+ if input == "0":
+ return "stop"
+ return None # will make the streamfile audio stop
+
+def handler(uuid):
+
+ console_log("1","... test from my python program\n")
+ session = PySession(uuid)
+ session.answer()
+ session.setDTMFCallback(onDTMF, "")
+ session.set_tts_parms("cepstral", "david")
+ session.playFile("/path/to/your.mp3", "")
+ session.speak("Please enter telephone number with area code and press pound sign. ")
+ input = session.getDigits("", 11, "*#", "#", 10000)
+ console_log("1","result from get digits is %s\n" % input)
+ phone_number = session.playAndGetDigits(5, 11, 3, 10000, "*#",
+ "/sounds/test.gsm",
+ "/sounds/invalid.gsm",
+ "",
+ "^17771112222$");
+ console_log("1","result from play_and_get_digits is %s\n" % phone_number)
+ session.transfer("1000", "XML", "default")
+ session.hangup("1")
+
Modified: freeswitch/trunk/src/include/switch_cpp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_cpp.h (original)
+++ freeswitch/trunk/src/include/switch_cpp.h Fri Jun 15 13:25:41 2007
@@ -20,39 +20,112 @@
struct input_callback_state *cb_state,
switch_core_session_t *session);
+
+typedef struct input_callback_state {
+ void *function; // pointer to the language specific callback function
+ // eg, PyObject *pyfunc
+ void *threadState; // pointer to the language specific thread state
+ // eg, PyThreadState *threadState
+ void *extra; // currently used to store a switch_file_handle_t
+ char *funcargs; // extra string that will be passed to callback function
+};
+
+
class CoreSession {
- private:
+ protected:
switch_input_args_t args;
switch_input_args_t *ap;
+ char *uuid;
+ char *tts_name;
+ char *voice_name;
+ void store_file_handle(switch_file_handle_t *fh);
public:
CoreSession(char *uuid);
CoreSession(switch_core_session_t *new_session);
- ~CoreSession();
+ virtual ~CoreSession();
switch_core_session_t *session;
switch_channel_t *channel;
+ input_callback_state cb_state;
int answer();
int preAnswer();
void hangup(char *cause);
void setVariable(char *var, char *val);
char *getVariable(char *var);
+
+ /** \brief Play a file that resides on disk into the channel
+ *
+ * \param file - the path to the .wav/.mp3 to be played
+ * \param timer_name - ?? does not seem to be used, what is this?
+ * \return an int status code indicating success or failure
+ *
+ * NOTE: if a dtmf callback is installed before calling this
+ * function, that callback will be called upon receiving any
+ * dtmfs
+ */
int playFile(char *file, char *timer_name);
- void setDTMFCallback(switch_input_callback_function_t cb, void *buf, uint32_t buflen);
- int speakText(char *text);
+
+
+ /** \brief set a DTMF callback function
+ *
+ * The DTMF callback function will be set and persist
+ * for the life of the session, and be called when a dtmf
+ * is pressed by user during playFile(), streamfile(), and
+ * certain other methods are executing.
+ *
+ * Note that language specific sessions might need to create
+ * their own version of this with a slightly different signature
+ * (as done in freeswitch_python.h)
+ */
+ void setDTMFCallback(switch_input_callback_function_t cb,
+ void *buf,
+ uint32_t buflen);
+
+ int speak(char *text);
void set_tts_parms(char *tts_name, char *voice_name);
- int getDigits(char *dtmf_buf, int len, char *terminators, char *terminator, int timeout);
+
+ int getDigits(char *dtmf_buf,
+ int len,
+ char *terminators,
+ char *terminator,
+ int timeout);
+
int transfer(char *extensions, char *dialplan, char *context);
- int playAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, char *terminators,
- char *audio_files, char *bad_input_audio_files, char *dtmf_buf,
+
+ /** \brief Play a file into channel and collect dtmfs
+ *
+ * See API docs in switch_ivr.h: switch_play_and_get_digits(..)
+ *
+ * NOTE: this does not call any dtmf callbacks set by
+ * setDTMFCallback(..) as it uses its own internal callback
+ * handler.
+ */
+ int playAndGetDigits(int min_digits,
+ int max_digits,
+ int max_tries,
+ int timeout,
+ char *terminators,
+ char *audio_files,
+ char *bad_input_audio_files,
+ char *dtmf_buf,
char *digits_regex);
- int streamfile(char *file, void *cb_func, char *funcargs, int starting_sample_count);
+
+ /** \brief Play a file that resides on disk into the channel
+ *
+ * \param file - the path to the .wav/.mp3 to be played
+ * \param starting_sample_count - the index of the sample to
+ * start playing from
+ * \return an int status code indicating success or failure
+ *
+ */
+ int streamfile(char *file, int starting_sample_count);
+
+ bool ready();
+
void execute(char *app, char *data);
- void begin_allow_threads();
- void end_allow_threads();
+ virtual void begin_allow_threads();
+ virtual void end_allow_threads();
+
- protected:
- char *uuid;
- char *tts_name;
- char *voice_name;
};
Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch.py Fri Jun 15 13:25:41 2007
@@ -47,6 +47,33 @@
api_execute = _freeswitch.api_execute
api_reply_delete = _freeswitch.api_reply_delete
process_callback_result = _freeswitch.process_callback_result
+class input_callback_state(_object):
+ __swig_setmethods__ = {}
+ __setattr__ = lambda self, name, value: _swig_setattr(self, input_callback_state, name, value)
+ __swig_getmethods__ = {}
+ __getattr__ = lambda self, name: _swig_getattr(self, input_callback_state, name)
+ __repr__ = _swig_repr
+ __swig_setmethods__["function"] = _freeswitch.input_callback_state_function_set
+ __swig_getmethods__["function"] = _freeswitch.input_callback_state_function_get
+ if _newclass:function = property(_freeswitch.input_callback_state_function_get, _freeswitch.input_callback_state_function_set)
+ __swig_setmethods__["threadState"] = _freeswitch.input_callback_state_threadState_set
+ __swig_getmethods__["threadState"] = _freeswitch.input_callback_state_threadState_get
+ if _newclass:threadState = property(_freeswitch.input_callback_state_threadState_get, _freeswitch.input_callback_state_threadState_set)
+ __swig_setmethods__["extra"] = _freeswitch.input_callback_state_extra_set
+ __swig_getmethods__["extra"] = _freeswitch.input_callback_state_extra_get
+ if _newclass:extra = property(_freeswitch.input_callback_state_extra_get, _freeswitch.input_callback_state_extra_set)
+ __swig_setmethods__["funcargs"] = _freeswitch.input_callback_state_funcargs_set
+ __swig_getmethods__["funcargs"] = _freeswitch.input_callback_state_funcargs_get
+ if _newclass:funcargs = property(_freeswitch.input_callback_state_funcargs_get, _freeswitch.input_callback_state_funcargs_set)
+ def __init__(self, *args):
+ this = _freeswitch.new_input_callback_state(*args)
+ try: self.this.append(this)
+ except: self.this = this
+ __swig_destroy__ = _freeswitch.delete_input_callback_state
+ __del__ = lambda self : None;
+input_callback_state_swigregister = _freeswitch.input_callback_state_swigregister
+input_callback_state_swigregister(input_callback_state)
+
class CoreSession(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, CoreSession, name, value)
@@ -65,6 +92,9 @@
__swig_setmethods__["channel"] = _freeswitch.CoreSession_channel_set
__swig_getmethods__["channel"] = _freeswitch.CoreSession_channel_get
if _newclass:channel = property(_freeswitch.CoreSession_channel_get, _freeswitch.CoreSession_channel_set)
+ __swig_setmethods__["cb_state"] = _freeswitch.CoreSession_cb_state_set
+ __swig_getmethods__["cb_state"] = _freeswitch.CoreSession_cb_state_get
+ if _newclass:cb_state = property(_freeswitch.CoreSession_cb_state_get, _freeswitch.CoreSession_cb_state_set)
def answer(*args): return _freeswitch.CoreSession_answer(*args)
def preAnswer(*args): return _freeswitch.CoreSession_preAnswer(*args)
def hangup(*args): return _freeswitch.CoreSession_hangup(*args)
@@ -72,12 +102,13 @@
def getVariable(*args): return _freeswitch.CoreSession_getVariable(*args)
def playFile(*args): return _freeswitch.CoreSession_playFile(*args)
def setDTMFCallback(*args): return _freeswitch.CoreSession_setDTMFCallback(*args)
- def speakText(*args): return _freeswitch.CoreSession_speakText(*args)
+ def speak(*args): return _freeswitch.CoreSession_speak(*args)
def set_tts_parms(*args): return _freeswitch.CoreSession_set_tts_parms(*args)
def getDigits(*args): return _freeswitch.CoreSession_getDigits(*args)
def transfer(*args): return _freeswitch.CoreSession_transfer(*args)
def playAndGetDigits(*args): return _freeswitch.CoreSession_playAndGetDigits(*args)
def streamfile(*args): return _freeswitch.CoreSession_streamfile(*args)
+ def ready(*args): return _freeswitch.CoreSession_ready(*args)
def execute(*args): return _freeswitch.CoreSession_execute(*args)
def begin_allow_threads(*args): return _freeswitch.CoreSession_begin_allow_threads(*args)
def end_allow_threads(*args): return _freeswitch.CoreSession_end_allow_threads(*args)
@@ -85,33 +116,6 @@
CoreSession_swigregister(CoreSession)
PythonDTMFCallback = _freeswitch.PythonDTMFCallback
-class input_callback_state(_object):
- __swig_setmethods__ = {}
- __setattr__ = lambda self, name, value: _swig_setattr(self, input_callback_state, name, value)
- __swig_getmethods__ = {}
- __getattr__ = lambda self, name: _swig_getattr(self, input_callback_state, name)
- __repr__ = _swig_repr
- __swig_setmethods__["function"] = _freeswitch.input_callback_state_function_set
- __swig_getmethods__["function"] = _freeswitch.input_callback_state_function_get
- if _newclass:function = property(_freeswitch.input_callback_state_function_get, _freeswitch.input_callback_state_function_set)
- __swig_setmethods__["threadState"] = _freeswitch.input_callback_state_threadState_set
- __swig_getmethods__["threadState"] = _freeswitch.input_callback_state_threadState_get
- if _newclass:threadState = property(_freeswitch.input_callback_state_threadState_get, _freeswitch.input_callback_state_threadState_set)
- __swig_setmethods__["extra"] = _freeswitch.input_callback_state_extra_set
- __swig_getmethods__["extra"] = _freeswitch.input_callback_state_extra_get
- if _newclass:extra = property(_freeswitch.input_callback_state_extra_get, _freeswitch.input_callback_state_extra_set)
- __swig_setmethods__["funcargs"] = _freeswitch.input_callback_state_funcargs_set
- __swig_getmethods__["funcargs"] = _freeswitch.input_callback_state_funcargs_get
- if _newclass:funcargs = property(_freeswitch.input_callback_state_funcargs_get, _freeswitch.input_callback_state_funcargs_set)
- def __init__(self, *args):
- this = _freeswitch.new_input_callback_state(*args)
- try: self.this.append(this)
- except: self.this = this
- __swig_destroy__ = _freeswitch.delete_input_callback_state
- __del__ = lambda self : None;
-input_callback_state_swigregister = _freeswitch.input_callback_state_swigregister
-input_callback_state_swigregister(input_callback_state)
-
class PySession(CoreSession):
__swig_setmethods__ = {}
for _s in [CoreSession]: __swig_setmethods__.update(_s.__swig_setmethods__)
@@ -126,7 +130,7 @@
except: self.this = this
__swig_destroy__ = _freeswitch.delete_PySession
__del__ = lambda self : None;
- def streamfile(*args): return _freeswitch.PySession_streamfile(*args)
+ def setDTMFCallback(*args): return _freeswitch.PySession_setDTMFCallback(*args)
def begin_allow_threads(*args): return _freeswitch.PySession_begin_allow_threads(*args)
def end_allow_threads(*args): return _freeswitch.PySession_end_allow_threads(*args)
PySession_swigregister = _freeswitch.PySession_swigregister
Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.cpp Fri Jun 15 13:25:41 2007
@@ -3,62 +3,53 @@
#define sanity_check(x) do { if (!session) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
-int PySession::streamfile(char *file, PyObject *pyfunc, char *funcargs, int starting_sample_count)
+void PySession::setDTMFCallback(PyObject *pyfunc, char *funcargs)
{
- switch_status_t status;
- switch_input_args_t args = { 0 }, *ap = NULL;
- struct input_callback_state cb_state = { 0 };
- switch_file_handle_t fh = { 0 };
- char *prebuf;
-
- sanity_check(-1);
- cb_state.funcargs = funcargs;
- fh.samples = starting_sample_count;
+ sanity_check();
if (!PyCallable_Check(pyfunc)) {
- dtmfCallbackFunction = NULL;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "DTMF function is not a python function.");
- }
- else {
- dtmfCallbackFunction = pyfunc;
}
+ else {
+ cb_state.funcargs = funcargs;
+ cb_state.function = (void *) pyfunc;
- if (dtmfCallbackFunction) {
- cb_state.function = dtmfCallbackFunction;
- cb_state.extra = &fh;
args.buf = &cb_state;
args.buflen = sizeof(cb_state); // not sure what this is used for, copy mod_spidermonkey
- args.input_callback = PythonDTMFCallback; // defined in mod_python.i, will use ptrs in cb_state
+
+ // we cannot set the actual callback to a python function, because
+ // the callback is a function pointer with a specific signature.
+ // so, set it to the following c function which will act as a proxy,
+ // finding the python callback in the args callback args structure
+ args.input_callback = PythonDTMFCallback; // defined in mod_python.i
ap = &args;
- }
- if ((prebuf = switch_channel_get_variable(this->channel, "stream_prebuffer"))) {
- int maybe = atoi(prebuf);
- if (maybe > 0) {
- fh.prebuf = maybe;
- }
}
-
- this->begin_allow_threads();
- cb_state.threadState = threadState; // pass threadState so the dtmfhandler can pick it up
- status = switch_ivr_play_file(session, &fh, file, ap);
- this->end_allow_threads();
-
- return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmf callback was set, pyfunc: %p. cb_state: %p\n", pyfunc, &cb_state);
}
void PySession::begin_allow_threads(void) {
- threadState = PyEval_SaveThread();
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::begin_allow_threads() called\n");
+
+ threadState = (void *) PyEval_SaveThread();
+ cb_state.threadState = threadState;
+ // cb_state.extra = &fh;
+ args.buf = &cb_state;
+ ap = &args;
}
void PySession::end_allow_threads(void) {
- PyEval_RestoreThread(threadState);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::end_allow_threads() called\n");
+ PyEval_RestoreThread(((PyThreadState *)threadState));
}
PySession::~PySession() {
// Should we do any cleanup here?
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::~PySession desctructor\n");
}
+
+
Modified: freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/freeswitch_python.h Fri Jun 15 13:25:41 2007
@@ -26,26 +26,17 @@
char *api_execute(char *cmd, char *arg);
void api_reply_delete(char *reply);
-struct input_callback_state {
- PyObject *function;
- PyThreadState *threadState;
- void *extra;
- char *funcargs;
-};
-
class PySession : public CoreSession {
private:
- PyObject *dtmfCallbackFunction;
- PyThreadState *threadState;
+ void *threadState;
public:
- PySession(char *uuid) : CoreSession(uuid) {};
- PySession(switch_core_session_t *session) : CoreSession(session) {};
- ~PySession();
- int streamfile(char *file, PyObject *pyfunc, char *funcargs, int starting_sample_count);
- void begin_allow_threads();
- void end_allow_threads();
+ PySession(char *uuid) : CoreSession(uuid) {}
+ PySession(switch_core_session_t *session) : CoreSession(session) {}
+ ~PySession();
+ void setDTMFCallback(PyObject *pyfunc, char *funcargs);
+ void begin_allow_threads();
+ void end_allow_threads();
- protected:
};
#ifdef __cplusplus
Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python.c Fri Jun 15 13:25:41 2007
@@ -56,87 +56,115 @@
static void eval_some_python(char *uuid, char *args)
{
PyThreadState *tstate = NULL;
- FILE *pythonfile = NULL;
char *dupargs = NULL;
char *argv[128] = {0};
int argc;
int lead = 0;
- char *script = NULL, *script_path = NULL, *path = NULL;
+ char *script = NULL;
+ PyObject *module = NULL;
+ PyObject *function = NULL;
+ PyObject *arg = NULL;
+ PyObject *result = NULL;
if (args) {
- dupargs = strdup(args);
+ dupargs = strdup(args);
} else {
- return;
+ return;
}
assert(dupargs != NULL);
if (!(argc = switch_separate_string(dupargs, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No script name specified!\n");
- goto done;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No module name specified!\n");
+ goto done;
}
script = argv[0];
lead = 1;
- if (switch_is_file_path(script)) {
- script_path = script;
- if ((script = strrchr(script_path, *SWITCH_PATH_SEPARATOR))) {
- script++;
- } else {
- script = script_path;
- }
- } else if ((path = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.script_dir, SWITCH_PATH_SEPARATOR, script))) {
- script_path = path;
- }
- if (script_path) {
- if (!switch_file_exists(script_path, NULL) == SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Open File: %s\n", script_path);
- goto done;
- }
- }
-
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "running %s\n", script_path);
-
-
- if ((pythonfile = fopen(script_path, "r"))) {
-
- PyEval_AcquireLock();
- tstate = PyThreadState_New(mainThreadState->interp);
- if (!tstate) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error acquiring tstate\n");
- goto done;
- }
- PyThreadState_Swap(tstate);
- init_freeswitch();
- PyRun_SimpleString("from freeswitch import *");
- if (uuid) {
- char code[128];
- snprintf(code, sizeof(code), "session = PySession(\"%s\");", uuid);
- PyRun_SimpleString(code);
- }
- PySys_SetArgv(argc - lead, &argv[lead]);
- PyRun_SimpleFile(pythonfile, script);
- PyThreadState_Swap(NULL);
- PyThreadState_Clear(tstate);
- PyThreadState_Delete(tstate);
- PyEval_ReleaseLock();
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Invoking py module: %s\n", script);
-
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error running %s\n", script_path);
+ tstate = PyThreadState_New(mainThreadState->interp);
+ if (!tstate) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error acquiring tstate\n");
+ goto done;
+ }
+
+ // swap in thread state
+ PyEval_AcquireThread(tstate);
+ init_freeswitch();
+
+ // import the module
+ module = PyImport_ImportModule( (char *) script);
+ if (!module) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error importing module\n");
+ PyErr_Print();
+ PyErr_Clear();
+ goto done_swap_out;
+ }
+
+ // reload the module
+ module = PyImport_ReloadModule(module);
+ if (!module) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error reloading module\n");
+ PyErr_Print();
+ PyErr_Clear();
+ goto done_swap_out;
+ }
+
+ // get the handler function to be called
+ function = PyObject_GetAttrString(module, "handler");
+ if (!function) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Module does not define handler(uuid)\n");
+ PyErr_Print();
+ PyErr_Clear();
+ goto done_swap_out;
+ }
+
+ if (uuid) {
+ // build a tuple to pass the args, the uuid of session
+ arg = Py_BuildValue("(s)", uuid);
+ if (!arg) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error building args\n");
+ PyErr_Print();
+ PyErr_Clear();
+ goto done_swap_out;
+ }
+ }
+ else {
+ arg = PyTuple_New(1);
+ PyObject *nada = Py_BuildValue("");
+ PyTuple_SetItem(arg, 0, nada);
+ }
+
+ // invoke the handler
+ result = PyEval_CallObjectWithKeywords(function, arg, (PyObject *)NULL);
+
+ // check the result and print out any errors
+ if (!result) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error calling python script\n");
+ PyErr_Print();
+ PyErr_Clear();
}
+ goto done_swap_out;
done:
+ switch_safe_free(dupargs);
- if (pythonfile) {
- fclose(pythonfile);
- }
+ done_swap_out:
+ // decrement ref counts
+ Py_XDECREF(module);
+ Py_XDECREF(function);
+ Py_XDECREF(arg);
+ Py_XDECREF(result);
+
+ // swap out thread state
+ PyEval_ReleaseThread(tstate);
switch_safe_free(dupargs);
- switch_safe_free(path);
+
+
}
static void python_function(switch_core_session_t *session, char *data)
@@ -229,14 +257,25 @@
*module_interface = &python_module_interface;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Python Framework Loading...\n");
- Py_Initialize();
- PyEval_InitThreads();
+ if (!Py_IsInitialized()) {
- mainThreadState = PyThreadState_Get();
+ // initialize python system
+ Py_Initialize();
- PyThreadState_Swap(NULL);
+ // create GIL and a threadstate
+ PyEval_InitThreads();
- PyEval_ReleaseLock();
+ // save threadstate since it's interp field will be needed
+ // to create new threadstates, and will be needed for shutdown
+ mainThreadState = PyThreadState_Get();
+
+ // swap out threadstate since the call threads will create
+ // their own and swap in their threadstate
+ PyThreadState_Swap(NULL);
+
+ // release GIL
+ PyEval_ReleaseLock();
+ }
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python.i
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python.i (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python.i Fri Jun 15 13:25:41 2007
@@ -30,6 +30,8 @@
switch_file_handle_t *fh = NULL;
PyThreadState *threadState = NULL;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "PythonDTMFCallback\n");
+
if (!buf) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buf pointer is null");
return SWITCH_STATUS_FALSE;
@@ -39,11 +41,14 @@
func = (PyObject *) cb_state->function;
if (!func) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cb_state->function is null");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cb_state->function is null\n");
return SWITCH_STATUS_FALSE;
}
+ else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "cb_state->function is NOT null\n");
+ }
if (!PyCallable_Check(func)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
return SWITCH_STATUS_FALSE;
}
@@ -57,14 +62,22 @@
threadState = (PyThreadState *) cb_state->threadState;
if (!threadState) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error, invalid threadstate");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error, invalid threadstate\n");
return SWITCH_STATUS_FALSE;
}
+ else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "restoring threadstate: %p\n", threadState);
+ }
PyEval_RestoreThread(threadState); // nasty stuff happens when py interp has no thread state
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "restored threadstate, calling python function: %p\n", func);
+
result = PyEval_CallObject(func, arglist);
+
threadState = PyEval_SaveThread();
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "called python function\n");
Py_DECREF(arglist); // Trash arglist
if (result && result != Py_None) {
@@ -88,6 +101,9 @@
switch_file_handle_t *fh = NULL;
fh = (switch_file_handle_t *) cb_state->extra;
+ if (!fh) {
+ return SWITCH_STATUS_FALSE;
+ }
if (!ret) {
return SWITCH_STATUS_FALSE;
Modified: freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp (original)
+++ freeswitch/trunk/src/mod/languages/mod_python/mod_python_wrap.cpp Fri Jun 15 13:25:41 2007
@@ -2461,19 +2461,18 @@
#define SWIGTYPE_p_CoreSession swig_types[0]
#define SWIGTYPE_p_PySession swig_types[1]
-#define SWIGTYPE_p_PyThreadState swig_types[2]
-#define SWIGTYPE_p_char swig_types[3]
-#define SWIGTYPE_p_input_callback_state swig_types[4]
-#define SWIGTYPE_p_switch_channel_t swig_types[5]
-#define SWIGTYPE_p_switch_core_session swig_types[6]
-#define SWIGTYPE_p_switch_core_session_t swig_types[7]
-#define SWIGTYPE_p_switch_input_callback_function_t swig_types[8]
-#define SWIGTYPE_p_switch_input_type_t swig_types[9]
-#define SWIGTYPE_p_switch_status_t swig_types[10]
-#define SWIGTYPE_p_uint32_t swig_types[11]
-#define SWIGTYPE_p_void swig_types[12]
-static swig_type_info *swig_types[14];
-static swig_module_info swig_module = {swig_types, 13, 0, 0, 0, 0};
+#define SWIGTYPE_p_char swig_types[2]
+#define SWIGTYPE_p_input_callback_state swig_types[3]
+#define SWIGTYPE_p_switch_channel_t swig_types[4]
+#define SWIGTYPE_p_switch_core_session swig_types[5]
+#define SWIGTYPE_p_switch_core_session_t swig_types[6]
+#define SWIGTYPE_p_switch_input_callback_function_t swig_types[7]
+#define SWIGTYPE_p_switch_input_type_t swig_types[8]
+#define SWIGTYPE_p_switch_status_t swig_types[9]
+#define SWIGTYPE_p_uint32_t swig_types[10]
+#define SWIGTYPE_p_void swig_types[11]
+static swig_type_info *swig_types[13];
+static swig_module_info swig_module = {swig_types, 12, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -2815,6 +2814,13 @@
}
+SWIGINTERNINLINE PyObject*
+ SWIG_From_bool (bool value)
+{
+ return PyBool_FromLong(value ? 1 : 0);
+}
+
+
SWIGINTERN int
SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val)
{
@@ -2892,6 +2898,8 @@
switch_file_handle_t *fh = NULL;
PyThreadState *threadState = NULL;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "PythonDTMFCallback\n");
+
if (!buf) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buf pointer is null");
return SWITCH_STATUS_FALSE;
@@ -2901,11 +2909,14 @@
func = (PyObject *) cb_state->function;
if (!func) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cb_state->function is null");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cb_state->function is null\n");
return SWITCH_STATUS_FALSE;
}
+ else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "cb_state->function is NOT null\n");
+ }
if (!PyCallable_Check(func)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
return SWITCH_STATUS_FALSE;
}
@@ -2919,14 +2930,22 @@
threadState = (PyThreadState *) cb_state->threadState;
if (!threadState) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error, invalid threadstate");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error, invalid threadstate\n");
return SWITCH_STATUS_FALSE;
}
+ else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "restoring threadstate: %p\n", threadState);
+ }
PyEval_RestoreThread(threadState); // nasty stuff happens when py interp has no thread state
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "restored threadstate, calling python function: %p\n", func);
+
result = PyEval_CallObject(func, arglist);
+
threadState = PyEval_SaveThread();
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "called python function\n");
Py_DECREF(arglist); // Trash arglist
if (result && result != Py_None) {
@@ -2950,6 +2969,9 @@
switch_file_handle_t *fh = NULL;
fh = (switch_file_handle_t *) cb_state->extra;
+ if (!fh) {
+ return SWITCH_STATUS_FALSE;
+ }
if (!ret) {
return SWITCH_STATUS_FALSE;
@@ -2984,8 +3006,6 @@
return SWITCH_STATUS_SUCCESS;
} else if (!strcasecmp(ret, "stop")) {
return SWITCH_STATUS_FALSE;
- } else if (!strcasecmp(ret, "hangup")) {
- return SWITCH_STATUS_BREAK;
} else if (!strcasecmp(ret, "restart")) {
unsigned int pos = 0;
fh->speed = 0;
@@ -3230,132 +3250,129 @@
}
-SWIGINTERN PyObject *_wrap_new_CoreSession__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_function_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- char *arg1 = (char *) 0 ;
- CoreSession *result = 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
+ input_callback_state *arg1 = (input_callback_state *) 0 ;
+ void *arg2 = (void *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:new_CoreSession",&obj0)) SWIG_fail;
- res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+ if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_function_set",&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_CoreSession" "', argument " "1"" of type '" "char *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_function_set" "', argument " "1"" of type '" "input_callback_state *""'");
}
- arg1 = buf1;
- result = (CoreSession *)new CoreSession(arg1);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CoreSession, SWIG_POINTER_NEW | 0 );
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+ arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_function_set" "', argument " "2"" of type '" "void *""'");
+ }
+ if (arg1) (arg1)->function = arg2;
+
+ resultobj = SWIG_Py_Void();
return resultobj;
fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return NULL;
}
-SWIGINTERN PyObject *_wrap_new_CoreSession__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_function_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- CoreSession *result = 0 ;
+ input_callback_state *arg1 = (input_callback_state *) 0 ;
+ void *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:new_CoreSession",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_function_get",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_CoreSession" "', argument " "1"" of type '" "switch_core_session_t *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_function_get" "', argument " "1"" of type '" "input_callback_state *""'");
}
- arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
- result = (CoreSession *)new CoreSession(arg1);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CoreSession, SWIG_POINTER_NEW | 0 );
+ arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ result = (void *) ((arg1)->function);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
return resultobj;
fail:
return NULL;
}
-SWIGINTERN PyObject *_wrap_new_CoreSession(PyObject *self, PyObject *args) {
- int argc;
- PyObject *argv[2];
- int ii;
+SWIGINTERN PyObject *_wrap_input_callback_state_threadState_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ input_callback_state *arg1 = (input_callback_state *) 0 ;
+ void *arg2 = (void *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
- if (!PyTuple_Check(args)) SWIG_fail;
- argc = PyObject_Length(args);
- for (ii = 0; (ii < argc) && (ii < 1); ii++) {
- argv[ii] = PyTuple_GET_ITEM(args,ii);
- }
- if (argc == 1) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_core_session_t, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_new_CoreSession__SWIG_1(self, args);
- }
+ if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_threadState_set",&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_threadState_set" "', argument " "1"" of type '" "input_callback_state *""'");
}
- if (argc == 1) {
- int _v;
- int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_new_CoreSession__SWIG_0(self, args);
- }
+ arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_threadState_set" "', argument " "2"" of type '" "void *""'");
}
+ if (arg1) (arg1)->threadState = arg2;
+ resultobj = SWIG_Py_Void();
+ return resultobj;
fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"No matching function for overloaded 'new_CoreSession'");
return NULL;
}
-SWIGINTERN PyObject *_wrap_delete_CoreSession(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_threadState_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
+ input_callback_state *arg1 = (input_callback_state *) 0 ;
+ void *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:delete_CoreSession",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_threadState_get",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_threadState_get" "', argument " "1"" of type '" "input_callback_state *""'");
}
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- delete arg1;
-
- resultobj = SWIG_Py_Void();
+ arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ result = (void *) ((arg1)->threadState);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
return resultobj;
fail:
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_session_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_extra_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+ input_callback_state *arg1 = (input_callback_state *) 0 ;
+ void *arg2 = (void *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
+ int res2 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_session_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_extra_set",&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_extra_set" "', argument " "1"" of type '" "input_callback_state *""'");
}
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN | 0 );
+ arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_session_set" "', argument " "2"" of type '" "switch_core_session_t *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_extra_set" "', argument " "2"" of type '" "void *""'");
}
- arg2 = reinterpret_cast< switch_core_session_t * >(argp2);
- if (arg1) (arg1)->session = arg2;
+ if (arg1) (arg1)->extra = arg2;
resultobj = SWIG_Py_Void();
return resultobj;
@@ -3364,380 +3381,471 @@
}
-SWIGINTERN PyObject *_wrap_CoreSession_session_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_extra_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_core_session_t *result = 0 ;
+ input_callback_state *arg1 = (input_callback_state *) 0 ;
+ void *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_session_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_extra_get",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_extra_get" "', argument " "1"" of type '" "input_callback_state *""'");
}
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (switch_core_session_t *) ((arg1)->session);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 | 0 );
+ arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ result = (void *) ((arg1)->extra);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
return resultobj;
fail:
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_channel_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_funcargs_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_channel_t *arg2 = (switch_channel_t *) 0 ;
+ input_callback_state *arg1 = (input_callback_state *) 0 ;
+ char *arg2 = (char *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_channel_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_funcargs_set",&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_funcargs_set" "', argument " "1"" of type '" "input_callback_state *""'");
}
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN | 0 );
+ arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2"" of type '" "switch_channel_t *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_funcargs_set" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = buf2;
+ if (arg1->funcargs) delete[] arg1->funcargs;
+ if (arg2) {
+ size_t size = strlen(arg2) + 1;
+ arg1->funcargs = reinterpret_cast< char* >(memcpy((new char[size]), arg2, sizeof(char)*(size)));
+ } else {
+ arg1->funcargs = 0;
}
- arg2 = reinterpret_cast< switch_channel_t * >(argp2);
- if (arg1) (arg1)->channel = arg2;
-
resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return resultobj;
fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_channel_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_input_callback_state_funcargs_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_channel_t *result = 0 ;
+ input_callback_state *arg1 = (input_callback_state *) 0 ;
+ char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_channel_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_funcargs_get",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_funcargs_get" "', argument " "1"" of type '" "input_callback_state *""'");
}
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (switch_channel_t *) ((arg1)->channel);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 | 0 );
+ arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ result = (char *) ((arg1)->funcargs);
+ resultobj = SWIG_FromCharPtr(result);
return resultobj;
fail:
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_answer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_input_callback_state(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
+ input_callback_state *result = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_answer",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (int)(arg1)->answer();
- resultobj = SWIG_From_int(static_cast< int >(result));
+ if (!PyArg_ParseTuple(args,(char *)":new_input_callback_state")) SWIG_fail;
+ result = (input_callback_state *)new input_callback_state();
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_POINTER_NEW | 0 );
return resultobj;
fail:
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_preAnswer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_delete_input_callback_state(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
+ input_callback_state *arg1 = (input_callback_state *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_preAnswer",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"O:delete_input_callback_state",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_input_callback_state" "', argument " "1"" of type '" "input_callback_state *""'");
}
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (int)(arg1)->preAnswer();
- resultobj = SWIG_From_int(static_cast< int >(result));
+ arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ delete arg1;
+
+ resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_hangup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *input_callback_state_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *obj;
+ if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+ SWIG_TypeNewClientData(SWIGTYPE_p_input_callback_state, SWIG_NewClientData(obj));
+ return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject *_wrap_new_CoreSession__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
+ char *arg1 = (char *) 0 ;
+ CoreSession *result = 0 ;
+ int res1 ;
+ char *buf1 = 0 ;
+ int alloc1 = 0 ;
PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_hangup",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"O:new_CoreSession",&obj0)) SWIG_fail;
+ res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2"" of type '" "char *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_CoreSession" "', argument " "1"" of type '" "char *""'");
}
- arg2 = buf2;
- (arg1)->hangup(arg2);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ arg1 = buf1;
+ result = (CoreSession *)new CoreSession(arg1);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CoreSession, SWIG_POINTER_NEW | 0 );
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return resultobj;
fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_setVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_CoreSession__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ CoreSession *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setVariable",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"O:new_CoreSession",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_CoreSession" "', argument " "1"" of type '" "switch_core_session_t *""'");
}
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2"" of type '" "char *""'");
+ arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
+ result = (CoreSession *)new CoreSession(arg1);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CoreSession, SWIG_POINTER_NEW | 0 );
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_CoreSession(PyObject *self, PyObject *args) {
+ int argc;
+ PyObject *argv[2];
+ int ii;
+
+ if (!PyTuple_Check(args)) SWIG_fail;
+ argc = PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args,ii);
}
- arg2 = buf2;
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3"" of type '" "char *""'");
+ if (argc == 1) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_core_session_t, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_new_CoreSession__SWIG_1(self, args);
+ }
}
- arg3 = buf3;
- (arg1)->setVariable(arg2,arg3);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
+ if (argc == 1) {
+ int _v;
+ int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_new_CoreSession__SWIG_0(self, args);
+ }
+ }
+
fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"No matching function for overloaded 'new_CoreSession'");
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_getVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_delete_CoreSession(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_getVariable",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"O:delete_CoreSession",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = buf2;
- result = (char *)(arg1)->getVariable(arg2);
- resultobj = SWIG_FromCharPtr(result);
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ delete arg1;
+
+ resultobj = SWIG_Py_Void();
return resultobj;
fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_playFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_session_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- int result;
+ switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_playFile",&obj0,&obj1,&obj2)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_session_set",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playFile" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_playFile" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = buf2;
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_playFile" "', argument " "3"" of type '" "char *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_session_set" "', argument " "2"" of type '" "switch_core_session_t *""'");
}
- arg3 = buf3;
- result = (int)(arg1)->playFile(arg2,arg3);
- resultobj = SWIG_From_int(static_cast< int >(result));
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ arg2 = reinterpret_cast< switch_core_session_t * >(argp2);
+ if (arg1) (arg1)->session = arg2;
+
+ resultobj = SWIG_Py_Void();
return resultobj;
fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_setDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_session_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
- switch_input_callback_function_t arg2 ;
- void *arg3 = (void *) 0 ;
- uint32_t arg4 ;
+ switch_core_session_t *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- void *argp2 ;
- int res2 = 0 ;
- int res3 ;
- void *argp4 ;
- int res4 = 0 ;
PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_setDTMFCallback",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_session_get",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
- {
- res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_input_callback_function_t, 0 | 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2"" of type '" "switch_input_callback_function_t""'");
- }
- if (!argp2) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_setDTMFCallback" "', argument " "2"" of type '" "switch_input_callback_function_t""'");
- } else {
- switch_input_callback_function_t * temp = reinterpret_cast< switch_input_callback_function_t * >(argp2);
- arg2 = *temp;
- if (SWIG_IsNewObj(res2)) delete temp;
- }
- }
- res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3"" of type '" "void *""'");
- }
- {
- res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_uint32_t, 0 | 0);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_setDTMFCallback" "', argument " "4"" of type '" "uint32_t""'");
- }
- if (!argp4) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_setDTMFCallback" "', argument " "4"" of type '" "uint32_t""'");
- } else {
- uint32_t * temp = reinterpret_cast< uint32_t * >(argp4);
- arg4 = *temp;
- if (SWIG_IsNewObj(res4)) delete temp;
- }
- }
- (arg1)->setDTMFCallback(arg2,arg3,arg4);
- resultobj = SWIG_Py_Void();
+ result = (switch_core_session_t *) ((arg1)->session);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 | 0 );
return resultobj;
fail:
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_speakText(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_channel_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int result;
+ switch_channel_t *arg2 = (switch_channel_t *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_speakText",&obj0,&obj1)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_channel_set",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speakText" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speakText" "', argument " "2"" of type '" "char *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2"" of type '" "switch_channel_t *""'");
}
- arg2 = buf2;
- result = (int)(arg1)->speakText(arg2);
- resultobj = SWIG_From_int(static_cast< int >(result));
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ arg2 = reinterpret_cast< switch_channel_t * >(argp2);
+ if (arg1) (arg1)->channel = arg2;
+
+ resultobj = SWIG_Py_Void();
return resultobj;
fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_set_tts_parms(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_channel_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ switch_channel_t *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject * obj0 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_channel_get",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ result = (switch_channel_t *) ((arg1)->channel);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 | 0 );
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_cb_state_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ input_callback_state *arg2 = (input_callback_state *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_cb_state_set",&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_set" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_input_callback_state, 0 | 0 );
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_cb_state_set" "', argument " "2"" of type '" "input_callback_state *""'");
+ }
+ arg2 = reinterpret_cast< input_callback_state * >(argp2);
+ if (arg1) (arg1)->cb_state = *arg2;
+
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_cb_state_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ input_callback_state *result = 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject * obj0 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_cb_state_get",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_get" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ result = (input_callback_state *)& ((arg1)->cb_state);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, 0 | 0 );
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_answer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ int result;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject * obj0 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_answer",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ result = (int)(arg1)->answer();
+ resultobj = SWIG_From_int(static_cast< int >(result));
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_preAnswer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ int result;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject * obj0 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_preAnswer",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ result = (int)(arg1)->preAnswer();
+ resultobj = SWIG_From_int(static_cast< int >(result));
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_hangup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_hangup",&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = buf2;
+ (arg1)->hangup(arg2);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ return resultobj;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_setVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
char *arg2 = (char *) 0 ;
@@ -3754,23 +3862,23 @@
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_set_tts_parms",&obj0,&obj1,&obj2)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setVariable",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2"" of type '" "char *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2"" of type '" "char *""'");
}
arg2 = buf2;
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3"" of type '" "char *""'");
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3"" of type '" "char *""'");
}
arg3 = buf3;
- (arg1)->set_tts_parms(arg2,arg3);
+ (arg1)->setVariable(arg2,arg3);
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
@@ -3782,100 +3890,45 @@
}
-SWIGINTERN PyObject *_wrap_CoreSession_getDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_getVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
char *arg2 = (char *) 0 ;
- int arg3 ;
- char *arg4 = (char *) 0 ;
- char *arg5 = (char *) 0 ;
- int arg6 ;
- int result;
+ char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
- char temp2[128+1] ;
- char *t2 = 0 ;
- size_t n2 = 0 ;
+ char *buf2 = 0 ;
int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- int res5 ;
- char temp5[8+1] ;
- char *t5 = 0 ;
- size_t n5 = 0 ;
- int alloc5 = 0 ;
- int val6 ;
- int ecode6 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
- PyObject * obj4 = 0 ;
- PyObject * obj5 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OOOOOO:CoreSession_getDigits",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_getVariable",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &t2, &n2, &alloc2);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "char *dtmf_buf""'");
- }
- if ( n2 > (size_t) 128 ) n2 = (size_t) 128;
- memcpy(temp2, t2, sizeof(char)*n2);
- if (alloc2 == SWIG_NEWOBJ) delete[] t2;
- temp2[n2 - 1] = 0;
- arg2 = (char *) temp2;
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "int""'");
- }
- arg3 = static_cast< int >(val3);
- res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "char *""'");
- }
- arg4 = buf4;
- res5 = SWIG_AsCharPtrAndSize(obj4, &t5, &n5, &alloc5);
- if (!SWIG_IsOK(res5)) {
- SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_getDigits" "', argument " "5"" of type '" "char *terminator""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2"" of type '" "char *""'");
}
- if ( n5 > (size_t) 8 ) n5 = (size_t) 8;
- memcpy(temp5, t5, sizeof(char)*n5);
- if (alloc5 == SWIG_NEWOBJ) delete[] t5;
- temp5[n5 - 1] = 0;
- arg5 = (char *) temp5;
- ecode6 = SWIG_AsVal_int(obj5, &val6);
- if (!SWIG_IsOK(ecode6)) {
- SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "CoreSession_getDigits" "', argument " "6"" of type '" "int""'");
- }
- arg6 = static_cast< int >(val6);
- result = (int)(arg1)->getDigits(arg2,arg3,arg4,arg5,arg6);
- resultobj = SWIG_From_int(static_cast< int >(result));
- arg2[128] = 0;
- resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg2));
- arg5[8] = 0;
- resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg5));
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ arg2 = buf2;
+ result = (char *)(arg1)->getVariable(arg2);
+ resultobj = SWIG_FromCharPtr(result);
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return resultobj;
fail:
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_transfer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_playFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
@@ -3885,236 +3938,135 @@
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_transfer",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_playFile",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playFile" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2"" of type '" "char *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_playFile" "', argument " "2"" of type '" "char *""'");
}
arg2 = buf2;
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3"" of type '" "char *""'");
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_playFile" "', argument " "3"" of type '" "char *""'");
}
arg3 = buf3;
- res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4"" of type '" "char *""'");
- }
- arg4 = buf4;
- result = (int)(arg1)->transfer(arg2,arg3,arg4);
+ result = (int)(arg1)->playFile(arg2,arg3);
resultobj = SWIG_From_int(static_cast< int >(result));
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_playAndGetDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_setDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- int arg3 ;
- int arg4 ;
- int arg5 ;
- char *arg6 = (char *) 0 ;
- char *arg7 = (char *) 0 ;
- char *arg8 = (char *) 0 ;
- char *arg9 = (char *) 0 ;
- char *arg10 = (char *) 0 ;
- int result;
+ switch_input_callback_function_t arg2 ;
+ void *arg3 = (void *) 0 ;
+ uint32_t arg4 ;
void *argp1 = 0 ;
int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- int val5 ;
- int ecode5 = 0 ;
- int res6 ;
- char *buf6 = 0 ;
- int alloc6 = 0 ;
- int res7 ;
- char *buf7 = 0 ;
- int alloc7 = 0 ;
- int res8 ;
- char *buf8 = 0 ;
- int alloc8 = 0 ;
- int res9 ;
- char temp9[128+1] ;
- char *t9 = 0 ;
- size_t n9 = 0 ;
- int alloc9 = 0 ;
- int res10 ;
- char *buf10 = 0 ;
- int alloc10 = 0 ;
+ void *argp2 ;
+ int res2 = 0 ;
+ int res3 ;
+ void *argp4 ;
+ int res4 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
- PyObject * obj4 = 0 ;
- PyObject * obj5 = 0 ;
- PyObject * obj6 = 0 ;
- PyObject * obj7 = 0 ;
- PyObject * obj8 = 0 ;
- PyObject * obj9 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:CoreSession_playAndGetDigits",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_setDTMFCallback",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_int(obj1, &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3"" of type '" "int""'");
- }
- arg3 = static_cast< int >(val3);
- ecode4 = SWIG_AsVal_int(obj3, &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4"" of type '" "int""'");
- }
- arg4 = static_cast< int >(val4);
- ecode5 = SWIG_AsVal_int(obj4, &val5);
- if (!SWIG_IsOK(ecode5)) {
- SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5"" of type '" "int""'");
- }
- arg5 = static_cast< int >(val5);
- res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
- if (!SWIG_IsOK(res6)) {
- SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6"" of type '" "char *""'");
- }
- arg6 = buf6;
- res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
- if (!SWIG_IsOK(res7)) {
- SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7"" of type '" "char *""'");
- }
- arg7 = buf7;
- res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
- if (!SWIG_IsOK(res8)) {
- SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8"" of type '" "char *""'");
+ {
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_input_callback_function_t, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2"" of type '" "switch_input_callback_function_t""'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_setDTMFCallback" "', argument " "2"" of type '" "switch_input_callback_function_t""'");
+ } else {
+ switch_input_callback_function_t * temp = reinterpret_cast< switch_input_callback_function_t * >(argp2);
+ arg2 = *temp;
+ if (SWIG_IsNewObj(res2)) delete temp;
+ }
}
- arg8 = buf8;
- res9 = SWIG_AsCharPtrAndSize(obj8, &t9, &n9, &alloc9);
- if (!SWIG_IsOK(res9)) {
- SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9"" of type '" "char *dtmf_buf""'");
+ res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3"" of type '" "void *""'");
}
- if ( n9 > (size_t) 128 ) n9 = (size_t) 128;
- memcpy(temp9, t9, sizeof(char)*n9);
- if (alloc9 == SWIG_NEWOBJ) delete[] t9;
- temp9[n9 - 1] = 0;
- arg9 = (char *) temp9;
- res10 = SWIG_AsCharPtrAndSize(obj9, &buf10, NULL, &alloc10);
- if (!SWIG_IsOK(res10)) {
- SWIG_exception_fail(SWIG_ArgError(res10), "in method '" "CoreSession_playAndGetDigits" "', argument " "10"" of type '" "char *""'");
+ {
+ res4 = SWIG_ConvertPtr(obj3, &argp4, SWIGTYPE_p_uint32_t, 0 | 0);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_setDTMFCallback" "', argument " "4"" of type '" "uint32_t""'");
+ }
+ if (!argp4) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_setDTMFCallback" "', argument " "4"" of type '" "uint32_t""'");
+ } else {
+ uint32_t * temp = reinterpret_cast< uint32_t * >(argp4);
+ arg4 = *temp;
+ if (SWIG_IsNewObj(res4)) delete temp;
+ }
}
- arg10 = buf10;
- result = (int)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10);
- resultobj = SWIG_From_int(static_cast< int >(result));
- arg9[128] = 0;
- resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg9));
- if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
- if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
- if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
- if (alloc10 == SWIG_NEWOBJ) delete[] buf10;
+ (arg1)->setDTMFCallback(arg2,arg3,arg4);
+ resultobj = SWIG_Py_Void();
return resultobj;
fail:
- if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
- if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
- if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
- if (alloc10 == SWIG_NEWOBJ) delete[] buf10;
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_streamfile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_speak(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
char *arg2 = (char *) 0 ;
- void *arg3 = (void *) 0 ;
- char *arg4 = (char *) 0 ;
- int arg5 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
- int res3 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- int val5 ;
- int ecode5 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
- PyObject * obj4 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OOOOO:CoreSession_streamfile",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_speak",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamfile" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speak" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamfile" "', argument " "2"" of type '" "char *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2"" of type '" "char *""'");
}
arg2 = buf2;
- res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_streamfile" "', argument " "3"" of type '" "void *""'");
- }
- res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_streamfile" "', argument " "4"" of type '" "char *""'");
- }
- arg4 = buf4;
- ecode5 = SWIG_AsVal_int(obj4, &val5);
- if (!SWIG_IsOK(ecode5)) {
- SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_streamfile" "', argument " "5"" of type '" "int""'");
- }
- arg5 = static_cast< int >(val5);
- result = (int)(arg1)->streamfile(arg2,arg3,arg4,arg5);
+ result = (int)(arg1)->speak(arg2);
resultobj = SWIG_From_int(static_cast< int >(result));
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_set_tts_parms(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
char *arg2 = (char *) 0 ;
@@ -4131,23 +4083,23 @@
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_execute",&obj0,&obj1,&obj2)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_set_tts_parms",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2"" of type '" "char *""'");
}
arg2 = buf2;
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3"" of type '" "char *""'");
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3"" of type '" "char *""'");
}
arg3 = buf3;
- (arg1)->execute(arg2,arg3);
+ (arg1)->set_tts_parms(arg2,arg3);
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
@@ -4159,371 +4111,497 @@
}
-SWIGINTERN PyObject *_wrap_CoreSession_begin_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_getDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ int arg3 ;
+ char *arg4 = (char *) 0 ;
+ char *arg5 = (char *) 0 ;
+ int arg6 ;
+ int result;
void *argp1 = 0 ;
int res1 = 0 ;
+ int res2 ;
+ char temp2[128+1] ;
+ char *t2 = 0 ;
+ size_t n2 = 0 ;
+ int alloc2 = 0 ;
+ int val3 ;
+ int ecode3 = 0 ;
+ int res4 ;
+ char *buf4 = 0 ;
+ int alloc4 = 0 ;
+ int res5 ;
+ char temp5[8+1] ;
+ char *t5 = 0 ;
+ size_t n5 = 0 ;
+ int alloc5 = 0 ;
+ int val6 ;
+ int ecode6 = 0 ;
PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+ PyObject * obj3 = 0 ;
+ PyObject * obj4 = 0 ;
+ PyObject * obj5 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_begin_allow_threads",&obj0)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"OOOOOO:CoreSession_getDigits",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_begin_allow_threads" "', argument " "1"" of type '" "CoreSession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
- (arg1)->begin_allow_threads();
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_CoreSession_end_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_end_allow_threads",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_end_allow_threads" "', argument " "1"" of type '" "CoreSession *""'");
+ res2 = SWIG_AsCharPtrAndSize(obj1, &t2, &n2, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "char *dtmf_buf""'");
}
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- (arg1)->end_allow_threads();
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *CoreSession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
- SWIG_TypeNewClientData(SWIGTYPE_p_CoreSession, SWIG_NewClientData(obj));
- return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *_wrap_PythonDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- switch_core_session *arg1 = (switch_core_session *) 0 ;
- void *arg2 = (void *) 0 ;
- switch_input_type_t arg3 ;
- void *arg4 = (void *) 0 ;
- unsigned int arg5 ;
- switch_status_t result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- void *argp3 ;
- int res3 = 0 ;
- int res4 ;
- unsigned int val5 ;
- int ecode5 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
- PyObject * obj4 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOOOO:PythonDTMFCallback",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PythonDTMFCallback" "', argument " "1"" of type '" "switch_core_session *""'");
- }
- arg1 = reinterpret_cast< switch_core_session * >(argp1);
- res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PythonDTMFCallback" "', argument " "2"" of type '" "void *""'");
- }
- {
- res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PythonDTMFCallback" "', argument " "3"" of type '" "switch_input_type_t""'");
- }
- if (!argp3) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PythonDTMFCallback" "', argument " "3"" of type '" "switch_input_type_t""'");
- } else {
- switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3);
- arg3 = *temp;
- if (SWIG_IsNewObj(res3)) delete temp;
- }
- }
- res4 = SWIG_ConvertPtr(obj3,SWIG_as_voidptrptr(&arg4), 0, 0);
+ if ( n2 > (size_t) 128 ) n2 = (size_t) 128;
+ memcpy(temp2, t2, sizeof(char)*n2);
+ if (alloc2 == SWIG_NEWOBJ) delete[] t2;
+ temp2[n2 - 1] = 0;
+ arg2 = (char *) temp2;
+ ecode3 = SWIG_AsVal_int(obj2, &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "int""'");
+ }
+ arg3 = static_cast< int >(val3);
+ res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "PythonDTMFCallback" "', argument " "4"" of type '" "void *""'");
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "char *""'");
}
- ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
- if (!SWIG_IsOK(ecode5)) {
- SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "PythonDTMFCallback" "', argument " "5"" of type '" "unsigned int""'");
+ arg4 = buf4;
+ res5 = SWIG_AsCharPtrAndSize(obj4, &t5, &n5, &alloc5);
+ if (!SWIG_IsOK(res5)) {
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_getDigits" "', argument " "5"" of type '" "char *terminator""'");
+ }
+ if ( n5 > (size_t) 8 ) n5 = (size_t) 8;
+ memcpy(temp5, t5, sizeof(char)*n5);
+ if (alloc5 == SWIG_NEWOBJ) delete[] t5;
+ temp5[n5 - 1] = 0;
+ arg5 = (char *) temp5;
+ ecode6 = SWIG_AsVal_int(obj5, &val6);
+ if (!SWIG_IsOK(ecode6)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "CoreSession_getDigits" "', argument " "6"" of type '" "int""'");
}
- arg5 = static_cast< unsigned int >(val5);
- result = PythonDTMFCallback(arg1,arg2,arg3,arg4,arg5);
- resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0 );
+ arg6 = static_cast< int >(val6);
+ result = (int)(arg1)->getDigits(arg2,arg3,arg4,arg5,arg6);
+ resultobj = SWIG_From_int(static_cast< int >(result));
+ arg2[128] = 0;
+ resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg2));
+ arg5[8] = 0;
+ resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg5));
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
return resultobj;
fail:
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
return NULL;
}
-SWIGINTERN PyObject *_wrap_input_callback_state_function_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_transfer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
- PyObject *arg2 = (PyObject *) 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ int result;
void *argp1 = 0 ;
int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int res4 ;
+ char *buf4 = 0 ;
+ int alloc4 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+ PyObject * obj3 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_function_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_transfer",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_function_set" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1"" of type '" "CoreSession *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
- arg2 = obj1;
- if (arg1) (arg1)->function = arg2;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_input_callback_state_function_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
- PyObject *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_function_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_function_get" "', argument " "1"" of type '" "input_callback_state *""'");
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2"" of type '" "char *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
- result = (PyObject *) ((arg1)->function);
- resultobj = result;
+ arg2 = buf2;
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3"" of type '" "char *""'");
+ }
+ arg3 = buf3;
+ res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4"" of type '" "char *""'");
+ }
+ arg4 = buf4;
+ result = (int)(arg1)->transfer(arg2,arg3,arg4);
+ resultobj = SWIG_From_int(static_cast< int >(result));
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
return resultobj;
fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
return NULL;
}
-SWIGINTERN PyObject *_wrap_input_callback_state_threadState_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_playAndGetDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
- PyThreadState *arg2 = (PyThreadState *) 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ int arg2 ;
+ int arg3 ;
+ int arg4 ;
+ int arg5 ;
+ char *arg6 = (char *) 0 ;
+ char *arg7 = (char *) 0 ;
+ char *arg8 = (char *) 0 ;
+ char *arg9 = (char *) 0 ;
+ char *arg10 = (char *) 0 ;
+ int result;
void *argp1 = 0 ;
int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
+ int val2 ;
+ int ecode2 = 0 ;
+ int val3 ;
+ int ecode3 = 0 ;
+ int val4 ;
+ int ecode4 = 0 ;
+ int val5 ;
+ int ecode5 = 0 ;
+ int res6 ;
+ char *buf6 = 0 ;
+ int alloc6 = 0 ;
+ int res7 ;
+ char *buf7 = 0 ;
+ int alloc7 = 0 ;
+ int res8 ;
+ char *buf8 = 0 ;
+ int alloc8 = 0 ;
+ int res9 ;
+ char temp9[128+1] ;
+ char *t9 = 0 ;
+ size_t n9 = 0 ;
+ int alloc9 = 0 ;
+ int res10 ;
+ char *buf10 = 0 ;
+ int alloc10 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+ PyObject * obj3 = 0 ;
+ PyObject * obj4 = 0 ;
+ PyObject * obj5 = 0 ;
+ PyObject * obj6 = 0 ;
+ PyObject * obj7 = 0 ;
+ PyObject * obj8 = 0 ;
+ PyObject * obj9 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_threadState_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOO:CoreSession_playAndGetDigits",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_threadState_set" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1"" of type '" "CoreSession *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_PyThreadState, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_threadState_set" "', argument " "2"" of type '" "PyThreadState *""'");
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_int(obj1, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2"" of type '" "int""'");
+ }
+ arg2 = static_cast< int >(val2);
+ ecode3 = SWIG_AsVal_int(obj2, &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3"" of type '" "int""'");
+ }
+ arg3 = static_cast< int >(val3);
+ ecode4 = SWIG_AsVal_int(obj3, &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4"" of type '" "int""'");
+ }
+ arg4 = static_cast< int >(val4);
+ ecode5 = SWIG_AsVal_int(obj4, &val5);
+ if (!SWIG_IsOK(ecode5)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5"" of type '" "int""'");
+ }
+ arg5 = static_cast< int >(val5);
+ res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
+ if (!SWIG_IsOK(res6)) {
+ SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6"" of type '" "char *""'");
}
- arg2 = reinterpret_cast< PyThreadState * >(argp2);
- if (arg1) (arg1)->threadState = arg2;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_input_callback_state_threadState_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
- PyThreadState *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_threadState_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_threadState_get" "', argument " "1"" of type '" "input_callback_state *""'");
+ arg6 = buf6;
+ res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
+ if (!SWIG_IsOK(res7)) {
+ SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7"" of type '" "char *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
- result = (PyThreadState *) ((arg1)->threadState);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PyThreadState, 0 | 0 );
+ arg7 = buf7;
+ res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
+ if (!SWIG_IsOK(res8)) {
+ SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8"" of type '" "char *""'");
+ }
+ arg8 = buf8;
+ res9 = SWIG_AsCharPtrAndSize(obj8, &t9, &n9, &alloc9);
+ if (!SWIG_IsOK(res9)) {
+ SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9"" of type '" "char *dtmf_buf""'");
+ }
+ if ( n9 > (size_t) 128 ) n9 = (size_t) 128;
+ memcpy(temp9, t9, sizeof(char)*n9);
+ if (alloc9 == SWIG_NEWOBJ) delete[] t9;
+ temp9[n9 - 1] = 0;
+ arg9 = (char *) temp9;
+ res10 = SWIG_AsCharPtrAndSize(obj9, &buf10, NULL, &alloc10);
+ if (!SWIG_IsOK(res10)) {
+ SWIG_exception_fail(SWIG_ArgError(res10), "in method '" "CoreSession_playAndGetDigits" "', argument " "10"" of type '" "char *""'");
+ }
+ arg10 = buf10;
+ result = (int)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10);
+ resultobj = SWIG_From_int(static_cast< int >(result));
+ arg9[128] = 0;
+ resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_FromCharPtr(arg9));
+ if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+ if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+ if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+ if (alloc10 == SWIG_NEWOBJ) delete[] buf10;
return resultobj;
fail:
+ if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+ if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+ if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
+ if (alloc10 == SWIG_NEWOBJ) delete[] buf10;
return NULL;
}
-SWIGINTERN PyObject *_wrap_input_callback_state_extra_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_streamfile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
- void *arg2 = (void *) 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ int arg3 ;
+ int result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int val3 ;
+ int ecode3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_extra_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_streamfile",&obj0,&obj1,&obj2)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_extra_set" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamfile" "', argument " "1"" of type '" "CoreSession *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
- res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_extra_set" "', argument " "2"" of type '" "void *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamfile" "', argument " "2"" of type '" "char *""'");
}
- if (arg1) (arg1)->extra = arg2;
-
- resultobj = SWIG_Py_Void();
+ arg2 = buf2;
+ ecode3 = SWIG_AsVal_int(obj2, &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamfile" "', argument " "3"" of type '" "int""'");
+ }
+ arg3 = static_cast< int >(val3);
+ result = (int)(arg1)->streamfile(arg2,arg3);
+ resultobj = SWIG_From_int(static_cast< int >(result));
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return resultobj;
fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
return NULL;
}
-SWIGINTERN PyObject *_wrap_input_callback_state_extra_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_ready(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
- void *result = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ bool result;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_extra_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_ready",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_extra_get" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_ready" "', argument " "1"" of type '" "CoreSession *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
- result = (void *) ((arg1)->extra);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ result = (bool)(arg1)->ready();
+ resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
-SWIGINTERN PyObject *_wrap_input_callback_state_funcargs_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_funcargs_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_execute",&obj0,&obj1,&obj2)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_funcargs_set" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_funcargs_set" "', argument " "2"" of type '" "char *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
}
arg2 = buf2;
- if (arg1->funcargs) delete[] arg1->funcargs;
- if (arg2) {
- size_t size = strlen(arg2) + 1;
- arg1->funcargs = reinterpret_cast< char* >(memcpy((new char[size]), arg2, sizeof(char)*(size)));
- } else {
- arg1->funcargs = 0;
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3"" of type '" "char *""'");
}
+ arg3 = buf3;
+ (arg1)->execute(arg2,arg3);
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return resultobj;
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return NULL;
}
-SWIGINTERN PyObject *_wrap_input_callback_state_funcargs_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_begin_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
- char *result = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_funcargs_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_begin_allow_threads",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_funcargs_get" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_begin_allow_threads" "', argument " "1"" of type '" "CoreSession *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
- result = (char *) ((arg1)->funcargs);
- resultobj = SWIG_FromCharPtr(result);
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ (arg1)->begin_allow_threads();
+ resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
-SWIGINTERN PyObject *_wrap_new_input_callback_state(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_end_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *result = 0 ;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ PyObject * obj0 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)":new_input_callback_state")) SWIG_fail;
- result = (input_callback_state *)new input_callback_state();
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_POINTER_NEW | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_end_allow_threads",&obj0)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_end_allow_threads" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ (arg1)->end_allow_threads();
+ resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
-SWIGINTERN PyObject *_wrap_delete_input_callback_state(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *CoreSession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *obj;
+ if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
+ SWIG_TypeNewClientData(SWIGTYPE_p_CoreSession, SWIG_NewClientData(obj));
+ return SWIG_Py_Void();
+}
+
+SWIGINTERN PyObject *_wrap_PythonDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
+ switch_core_session *arg1 = (switch_core_session *) 0 ;
+ void *arg2 = (void *) 0 ;
+ switch_input_type_t arg3 ;
+ void *arg4 = (void *) 0 ;
+ unsigned int arg5 ;
+ switch_status_t result;
void *argp1 = 0 ;
int res1 = 0 ;
+ int res2 ;
+ void *argp3 ;
+ int res3 = 0 ;
+ int res4 ;
+ unsigned int val5 ;
+ int ecode5 = 0 ;
PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+ PyObject * obj3 = 0 ;
+ PyObject * obj4 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"O:delete_input_callback_state",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN | 0 );
+ if (!PyArg_ParseTuple(args,(char *)"OOOOO:PythonDTMFCallback",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_input_callback_state" "', argument " "1"" of type '" "input_callback_state *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PythonDTMFCallback" "', argument " "1"" of type '" "switch_core_session *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
- delete arg1;
-
- resultobj = SWIG_Py_Void();
+ arg1 = reinterpret_cast< switch_core_session * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PythonDTMFCallback" "', argument " "2"" of type '" "void *""'");
+ }
+ {
+ res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PythonDTMFCallback" "', argument " "3"" of type '" "switch_input_type_t""'");
+ }
+ if (!argp3) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PythonDTMFCallback" "', argument " "3"" of type '" "switch_input_type_t""'");
+ } else {
+ switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3);
+ arg3 = *temp;
+ if (SWIG_IsNewObj(res3)) delete temp;
+ }
+ }
+ res4 = SWIG_ConvertPtr(obj3,SWIG_as_voidptrptr(&arg4), 0, 0);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "PythonDTMFCallback" "', argument " "4"" of type '" "void *""'");
+ }
+ ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
+ if (!SWIG_IsOK(ecode5)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "PythonDTMFCallback" "', argument " "5"" of type '" "unsigned int""'");
+ }
+ arg5 = static_cast< unsigned int >(val5);
+ result = PythonDTMFCallback(arg1,arg2,arg3,arg4,arg5);
+ resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
}
-SWIGINTERN PyObject *input_callback_state_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
- SWIG_TypeNewClientData(SWIGTYPE_p_input_callback_state, SWIG_NewClientData(obj));
- return SWIG_Py_Void();
-}
-
SWIGINTERN PyObject *_wrap_new_PySession__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
char *arg1 = (char *) 0 ;
@@ -4627,60 +4705,38 @@
}
-SWIGINTERN PyObject *_wrap_PySession_streamfile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_PySession_setDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
PySession *arg1 = (PySession *) 0 ;
- char *arg2 = (char *) 0 ;
- PyObject *arg3 = (PyObject *) 0 ;
- char *arg4 = (char *) 0 ;
- int arg5 ;
- int result;
+ PyObject *arg2 = (PyObject *) 0 ;
+ char *arg3 = (char *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- int val5 ;
- int ecode5 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
- PyObject * obj4 = 0 ;
- if (!PyArg_ParseTuple(args,(char *)"OOOOO:PySession_streamfile",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+ if (!PyArg_ParseTuple(args,(char *)"OOO:PySession_setDTMFCallback",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_streamfile" "', argument " "1"" of type '" "PySession *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_setDTMFCallback" "', argument " "1"" of type '" "PySession *""'");
}
arg1 = reinterpret_cast< PySession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySession_streamfile" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = buf2;
- arg3 = obj2;
- res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "PySession_streamfile" "', argument " "4"" of type '" "char *""'");
+ arg2 = obj1;
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySession_setDTMFCallback" "', argument " "3"" of type '" "char *""'");
}
- arg4 = buf4;
- ecode5 = SWIG_AsVal_int(obj4, &val5);
- if (!SWIG_IsOK(ecode5)) {
- SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "PySession_streamfile" "', argument " "5"" of type '" "int""'");
- }
- arg5 = static_cast< int >(val5);
- result = (int)(arg1)->streamfile(arg2,arg3,arg4,arg5);
- resultobj = SWIG_From_int(static_cast< int >(result));
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ arg3 = buf3;
+ (arg1)->setDTMFCallback(arg2,arg3);
+ resultobj = SWIG_Py_Void();
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return resultobj;
fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return NULL;
}
@@ -4740,12 +4796,25 @@
{ (char *)"api_execute", _wrap_api_execute, METH_VARARGS, NULL},
{ (char *)"api_reply_delete", _wrap_api_reply_delete, METH_VARARGS, NULL},
{ (char *)"process_callback_result", _wrap_process_callback_result, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_function_set", _wrap_input_callback_state_function_set, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_function_get", _wrap_input_callback_state_function_get, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_threadState_set", _wrap_input_callback_state_threadState_set, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_threadState_get", _wrap_input_callback_state_threadState_get, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_extra_set", _wrap_input_callback_state_extra_set, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_extra_get", _wrap_input_callback_state_extra_get, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_funcargs_set", _wrap_input_callback_state_funcargs_set, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_funcargs_get", _wrap_input_callback_state_funcargs_get, METH_VARARGS, NULL},
+ { (char *)"new_input_callback_state", _wrap_new_input_callback_state, METH_VARARGS, NULL},
+ { (char *)"delete_input_callback_state", _wrap_delete_input_callback_state, METH_VARARGS, NULL},
+ { (char *)"input_callback_state_swigregister", input_callback_state_swigregister, METH_VARARGS, NULL},
{ (char *)"new_CoreSession", _wrap_new_CoreSession, METH_VARARGS, NULL},
{ (char *)"delete_CoreSession", _wrap_delete_CoreSession, METH_VARARGS, NULL},
{ (char *)"CoreSession_session_set", _wrap_CoreSession_session_set, METH_VARARGS, NULL},
{ (char *)"CoreSession_session_get", _wrap_CoreSession_session_get, METH_VARARGS, NULL},
{ (char *)"CoreSession_channel_set", _wrap_CoreSession_channel_set, METH_VARARGS, NULL},
{ (char *)"CoreSession_channel_get", _wrap_CoreSession_channel_get, METH_VARARGS, NULL},
+ { (char *)"CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set, METH_VARARGS, NULL},
+ { (char *)"CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get, METH_VARARGS, NULL},
{ (char *)"CoreSession_answer", _wrap_CoreSession_answer, METH_VARARGS, NULL},
{ (char *)"CoreSession_preAnswer", _wrap_CoreSession_preAnswer, METH_VARARGS, NULL},
{ (char *)"CoreSession_hangup", _wrap_CoreSession_hangup, METH_VARARGS, NULL},
@@ -4753,31 +4822,21 @@
{ (char *)"CoreSession_getVariable", _wrap_CoreSession_getVariable, METH_VARARGS, NULL},
{ (char *)"CoreSession_playFile", _wrap_CoreSession_playFile, METH_VARARGS, NULL},
{ (char *)"CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback, METH_VARARGS, NULL},
- { (char *)"CoreSession_speakText", _wrap_CoreSession_speakText, METH_VARARGS, NULL},
+ { (char *)"CoreSession_speak", _wrap_CoreSession_speak, METH_VARARGS, NULL},
{ (char *)"CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms, METH_VARARGS, NULL},
{ (char *)"CoreSession_getDigits", _wrap_CoreSession_getDigits, METH_VARARGS, NULL},
{ (char *)"CoreSession_transfer", _wrap_CoreSession_transfer, METH_VARARGS, NULL},
{ (char *)"CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits, METH_VARARGS, NULL},
{ (char *)"CoreSession_streamfile", _wrap_CoreSession_streamfile, METH_VARARGS, NULL},
+ { (char *)"CoreSession_ready", _wrap_CoreSession_ready, METH_VARARGS, NULL},
{ (char *)"CoreSession_execute", _wrap_CoreSession_execute, METH_VARARGS, NULL},
{ (char *)"CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads, METH_VARARGS, NULL},
{ (char *)"CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads, METH_VARARGS, NULL},
{ (char *)"CoreSession_swigregister", CoreSession_swigregister, METH_VARARGS, NULL},
{ (char *)"PythonDTMFCallback", _wrap_PythonDTMFCallback, METH_VARARGS, NULL},
- { (char *)"input_callback_state_function_set", _wrap_input_callback_state_function_set, METH_VARARGS, NULL},
- { (char *)"input_callback_state_function_get", _wrap_input_callback_state_function_get, METH_VARARGS, NULL},
- { (char *)"input_callback_state_threadState_set", _wrap_input_callback_state_threadState_set, METH_VARARGS, NULL},
- { (char *)"input_callback_state_threadState_get", _wrap_input_callback_state_threadState_get, METH_VARARGS, NULL},
- { (char *)"input_callback_state_extra_set", _wrap_input_callback_state_extra_set, METH_VARARGS, NULL},
- { (char *)"input_callback_state_extra_get", _wrap_input_callback_state_extra_get, METH_VARARGS, NULL},
- { (char *)"input_callback_state_funcargs_set", _wrap_input_callback_state_funcargs_set, METH_VARARGS, NULL},
- { (char *)"input_callback_state_funcargs_get", _wrap_input_callback_state_funcargs_get, METH_VARARGS, NULL},
- { (char *)"new_input_callback_state", _wrap_new_input_callback_state, METH_VARARGS, NULL},
- { (char *)"delete_input_callback_state", _wrap_delete_input_callback_state, METH_VARARGS, NULL},
- { (char *)"input_callback_state_swigregister", input_callback_state_swigregister, METH_VARARGS, NULL},
{ (char *)"new_PySession", _wrap_new_PySession, METH_VARARGS, NULL},
{ (char *)"delete_PySession", _wrap_delete_PySession, METH_VARARGS, NULL},
- { (char *)"PySession_streamfile", _wrap_PySession_streamfile, METH_VARARGS, NULL},
+ { (char *)"PySession_setDTMFCallback", _wrap_PySession_setDTMFCallback, METH_VARARGS, NULL},
{ (char *)"PySession_begin_allow_threads", _wrap_PySession_begin_allow_threads, METH_VARARGS, NULL},
{ (char *)"PySession_end_allow_threads", _wrap_PySession_end_allow_threads, METH_VARARGS, NULL},
{ (char *)"PySession_swigregister", PySession_swigregister, METH_VARARGS, NULL},
@@ -4792,7 +4851,6 @@
}
static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_PySession = {"_p_PySession", "PySession *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_PyThreadState = {"_p_PyThreadState", "PyThreadState *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0};
@@ -4807,7 +4865,6 @@
static swig_type_info *swig_type_initial[] = {
&_swigt__p_CoreSession,
&_swigt__p_PySession,
- &_swigt__p_PyThreadState,
&_swigt__p_char,
&_swigt__p_input_callback_state,
&_swigt__p_switch_channel_t,
@@ -4822,7 +4879,6 @@
static swig_cast_info _swigc__p_CoreSession[] = { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_PySession, _p_PySessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_PySession[] = { {&_swigt__p_PySession, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_PyThreadState[] = { {&_swigt__p_PyThreadState, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}};
@@ -4837,7 +4893,6 @@
static swig_cast_info *swig_cast_initial[] = {
_swigc__p_CoreSession,
_swigc__p_PySession,
- _swigc__p_PyThreadState,
_swigc__p_char,
_swigc__p_input_callback_state,
_swigc__p_switch_channel_t,
Modified: freeswitch/trunk/src/switch_cpp.cpp
==============================================================================
--- freeswitch/trunk/src/switch_cpp.cpp (original)
+++ freeswitch/trunk/src/switch_cpp.cpp Fri Jun 15 13:25:41 2007
@@ -28,6 +28,7 @@
CoreSession::~CoreSession()
{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::~CoreSession desctructor");
if (session) {
switch_core_session_rwunlock(session);
@@ -57,6 +58,7 @@
void CoreSession::hangup(char *cause)
{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::hangup\n");
sanity_check_noreturn;
switch_channel_hangup(channel, switch_channel_str2cause(cause));
}
@@ -88,20 +90,25 @@
int CoreSession::playFile(char *file, char *timer_name)
{
switch_status_t status;
+ switch_file_handle_t fh = { 0 };
sanity_check(-1);
if (switch_strlen_zero(timer_name)) {
timer_name = NULL;
}
+ store_file_handle(&fh);
begin_allow_threads();
- status = switch_ivr_play_file(session, NULL, file, ap);
+ status = switch_ivr_play_file(session, &fh, file, ap);
end_allow_threads();
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
}
-void CoreSession::setDTMFCallback(switch_input_callback_function_t cb, void *buf, uint32_t buflen)
+void CoreSession::setDTMFCallback(switch_input_callback_function_t cb,
+ void *buf,
+ uint32_t buflen)
{
sanity_check_noreturn;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::setDTMFCallback.");
if (cb) {
args.buf = buf;
args.buflen = buflen;
@@ -113,12 +120,23 @@
}
}
-int CoreSession::speakText(char *text)
+
+int CoreSession::speak(char *text)
{
switch_status_t status;
switch_codec_t *codec;
sanity_check(-1);
+ if (!tts_name) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No TTS engine specified");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (!voice_name) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No TTS voice specified");
+ return SWITCH_STATUS_FALSE;
+ }
+
codec = switch_core_session_get_read_codec(session);
begin_allow_threads();
status = switch_ivr_speak_text(session, tts_name, voice_name, codec->implementation->samples_per_second, text, ap);
@@ -135,12 +153,22 @@
voice_name = strdup(voice_name_p);
}
-int CoreSession::getDigits(char *dtmf_buf, int len, char *terminators, char *terminator, int timeout)
+int CoreSession::getDigits(char *dtmf_buf,
+ int len,
+ char *terminators,
+ char *terminator,
+ int timeout)
{
switch_status_t status;
sanity_check(-1);
begin_allow_threads();
- status = switch_ivr_collect_digits_count(session, dtmf_buf,(uint32_t) len,(uint32_t) len, terminators, terminator, (uint32_t) timeout);
+ status = switch_ivr_collect_digits_count(session,
+ dtmf_buf,
+ (uint32_t) len,
+ (uint32_t) len,
+ terminators,
+ terminator,
+ (uint32_t) timeout);
end_allow_threads();
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
}
@@ -153,8 +181,15 @@
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
}
-int CoreSession::playAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, char *terminators,
- char *audio_files, char *bad_input_audio_files, char *dtmf_buf, char *digits_regex)
+int CoreSession::playAndGetDigits(int min_digits,
+ int max_digits,
+ int max_tries,
+ int timeout,
+ char *terminators,
+ char *audio_files,
+ char *bad_input_audio_files,
+ char *dtmf_buf,
+ char *digits_regex)
{
switch_status_t status;
sanity_check(-1);
@@ -173,16 +208,72 @@
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
}
-int CoreSession::streamfile(char *file, void *cb_func, char *funcargs, int starting_sample_count) {
- return 0;
+int CoreSession::streamfile(char *file, int starting_sample_count) {
+
+ switch_status_t status;
+ switch_file_handle_t fh = { 0 };
+ unsigned int samps;
+ unsigned int pos = 0;
+ char *prebuf;
+
+ sanity_check(-1);
+ fh.samples = starting_sample_count;
+ store_file_handle(&fh);
+
+ begin_allow_threads();
+ status = switch_ivr_play_file(session, &fh, file, ap);
+ end_allow_threads();
+
+ if ((prebuf = switch_channel_get_variable(this->channel, "stream_prebuffer"))) {
+ int maybe = atoi(prebuf);
+ if (maybe > 0) {
+ fh.prebuf = maybe;
+ }
+ }
+
+ return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
+
+}
+
+bool CoreSession::ready() {
+
+ switch_channel_t *channel;
+
+ if (!session) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "You must call the session.originate method before calling this method!\n");
+ return false;
+ }
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ return switch_channel_ready(channel) != 0;
+
+
}
void CoreSession::begin_allow_threads() {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::begin_allow_threads() called and does nothing\n");
}
void CoreSession::end_allow_threads() {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::end_allow_threads() called and does nothing\n");
}
+/** \brief Store a file handle in the callback args
+ *
+ * In a few of the methods like playFile and streamfile,
+ * an empty switch_file_handle_t is created and passed
+ * to core, and stored in callback args so that the callback
+ * handler can retrieve it for pausing, ff, rewinding file ptr.
+ *
+ * \param fh - a switch_file_handle_t
+ */
+void CoreSession::store_file_handle(switch_file_handle_t *fh) {
+ cb_state.extra = fh; // set a file handle so callback handler can pause
+ args.buf = &cb_state;
+ ap = &args;
+}
/* For Emacs:
1
0