Freeswitch-svn
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
- 10 participants
- 249 discussions
Author: anthm
Date: Wed Jun 6 19:28:00 2007
New Revision: 5276
Modified:
freeswitch/trunk/libs/libteletone/src/libteletone_detect.c
freeswitch/trunk/libs/libteletone/src/libteletone_detect.h
freeswitch/trunk/libs/libteletone/src/libteletone_generate.c
freeswitch/trunk/libs/libteletone/src/libteletone_generate.h
Log:
update teletone see wiki for syntax changes in TTML
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 Wed Jun 6 19:28:00 2007
@@ -90,7 +90,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <math.h>
+#include <libteletone_detect.h>
+
#ifndef _MSC_VER
#include <stdint.h>
#endif
@@ -98,7 +99,7 @@
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
-#include <libteletone_detect.h>
+
static teletone_detection_descriptor_t dtmf_detect_row[GRID_FACTOR];
static teletone_detection_descriptor_t dtmf_detect_col[GRID_FACTOR];
@@ -208,8 +209,8 @@
}
int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
- int16_t sample_buffer[],
- int samples)
+ int16_t sample_buffer[],
+ int samples)
{
int sample, limit, j, x = 0;
teletone_process_t v1, famp;
@@ -295,8 +296,8 @@
int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
- int16_t sample_buffer[],
- int samples)
+ int16_t sample_buffer[],
+ int samples)
{
teletone_process_t row_energy[GRID_FACTOR];
teletone_process_t col_energy[GRID_FACTOR];
@@ -426,8 +427,8 @@
int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
- char *buf,
- int max)
+ char *buf,
+ int max)
{
if (max > dtmf_detect_state->current_digits) {
max = dtmf_detect_state->current_digits;
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 Wed Jun 6 19:28:00 2007
@@ -98,11 +98,11 @@
#endif
#include <libteletone.h>
-/*! \file libteletone_detect.h
- \brief Tone Detection Routines
+ /*! \file libteletone_detect.h
+ \brief Tone Detection Routines
- This module is responsible for tone detection specifics
-*/
+ This module is responsible for tone detection specifics
+ */
#ifndef FALSE
#define FALSE 0
@@ -111,17 +111,17 @@
#endif
#endif
-/* Basic DTMF specs:
- *
- * Minimum tone on = 40ms
- * Minimum tone off = 50ms
- * Maximum digit rate = 10 per second
- * Normal twist <= 8dB accepted
- * Reverse twist <= 4dB accepted
- * S/N >= 15dB will detect OK
- * Attenuation <= 26dB will detect OK
- * Frequency tolerance +- 1.5% will detect, +-3.5% will reject
- */
+ /* Basic DTMF specs:
+ *
+ * Minimum tone on = 40ms
+ * Minimum tone off = 50ms
+ * Maximum digit rate = 10 per second
+ * Normal twist <= 8dB accepted
+ * Reverse twist <= 4dB accepted
+ * S/N >= 15dB will detect OK
+ * Attenuation <= 26dB will detect OK
+ * Frequency tolerance +- 1.5% will detect, +-3.5% will reject
+ */
#define DTMF_THRESHOLD 8.0e7
#define DTMF_NORMAL_TWIST 6.3 /* 8dB */
@@ -134,131 +134,131 @@
#define BLOCK_LEN 102
#define M_TWO_PI 2.0*M_PI
-/*! \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;
-} teletone_goertzel_state_t;
+ /*! \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;
+ } teletone_goertzel_state_t;
-/*! \brief A container for a DTMF detection state.*/
-typedef struct {
- int hit1;
- int hit2;
- int hit3;
- int hit4;
- int mhit;
-
- teletone_goertzel_state_t row_out[GRID_FACTOR];
- 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;
+ /*! \brief A container for a DTMF detection state.*/
+ typedef struct {
+ int hit1;
+ int hit2;
+ int hit3;
+ int hit4;
+ int mhit;
+
+ teletone_goertzel_state_t row_out[GRID_FACTOR];
+ 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;
- int current_sample;
- char digits[TELETONE_MAX_DTMF_DIGITS + 1];
- int current_digits;
- int detected_digits;
- int lost_digits;
- int digit_hits[16];
-} teletone_dtmf_detect_state_t;
-
-/*! \brief An abstraction to store the coefficient of a tone frequency */
-typedef struct {
- teletone_process_t fac;
-} teletone_detection_descriptor_t;
-
-/*! \brief A container for a single multi-tone detection
-TELETONE_MAX_TONES dictates the maximum simultaneous tones that can be present
-in a multi-tone representation.
-*/
-typedef struct {
- int sample_rate;
-
- teletone_detection_descriptor_t tdd[TELETONE_MAX_TONES];
- teletone_goertzel_state_t gs[TELETONE_MAX_TONES];
- teletone_goertzel_state_t gs2[TELETONE_MAX_TONES];
- int tone_count;
+ int current_sample;
+ char digits[TELETONE_MAX_DTMF_DIGITS + 1];
+ int current_digits;
+ int detected_digits;
+ int lost_digits;
+ int digit_hits[16];
+ } teletone_dtmf_detect_state_t;
+
+ /*! \brief An abstraction to store the coefficient of a tone frequency */
+ typedef struct {
+ teletone_process_t fac;
+ } teletone_detection_descriptor_t;
+
+ /*! \brief A container for a single multi-tone detection
+ TELETONE_MAX_TONES dictates the maximum simultaneous tones that can be present
+ in a multi-tone representation.
+ */
+ typedef struct {
+ int sample_rate;
+
+ teletone_detection_descriptor_t tdd[TELETONE_MAX_TONES];
+ teletone_goertzel_state_t gs[TELETONE_MAX_TONES];
+ teletone_goertzel_state_t gs2[TELETONE_MAX_TONES];
+ int tone_count;
- teletone_process_t energy;
- int current_sample;
+ teletone_process_t energy;
+ int current_sample;
- int min_samples;
- int total_samples;
+ int min_samples;
+ int total_samples;
- int positives;
- int negatives;
- int hits;
-
- int positive_factor;
- int negative_factor;
- int hit_factor;
-
-} teletone_multi_tone_t;
-
-
-/*!
- \brief Initilize a multi-frequency tone detector
- \param mt the multi-frequency tone descriptor
- \param map a representation of the multi-frequency tone
-*/
-void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map);
-
-/*!
- \brief Check a sample buffer for the presence of the mulit-frequency tone described by mt
- \param mt the multi-frequency tone descriptor
- \param sample_buffer an array aof 16 bit signed linear samples
- \param samples the number of samples present in sample_buffer
- \return true when the tone was detected or false when it is not
-*/
-int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
- int16_t sample_buffer[],
- int samples);
-
-/*!
- \brief Initilize a DTMF detection state object
- \param dtmf_detect_state the DTMF detection state to initilize
- \param sample_rate the desired sample rate
-*/
-void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate);
-
-/*!
- \brief Check a sample buffer for the presence of DTMF digits
- \param dtmf_detect_state the detection state object to check
- \param sample_buffer an array aof 16 bit signed linear samples
- \param samples the number of samples present in sample_buffer
- \return true when DTMF was detected or false when it is not
-*/
-int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
- int16_t sample_buffer[],
- int samples);
-/*!
- \brief retrieve any collected digits into a string buffer
- \param dtmf_detect_state the detection state object to check
- \param buf the string buffer to write to
- \param max the maximum length of buf
- \return the number of characters written to buf
-*/
-int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
- char *buf,
- int max);
-
-/*!
- \brief Step through the Goertzel Algorithm for each sample in a buffer
- \param goertzel_state the goertzel state to step the samples through
- \param sample_buffer an array aof 16 bit signed linear samples
- \param samples the number of samples present in sample_buffer
-*/
-void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
+ int positives;
+ int negatives;
+ int hits;
+
+ int positive_factor;
+ int negative_factor;
+ int hit_factor;
+
+ } teletone_multi_tone_t;
+
+
+ /*!
+ \brief Initilize a multi-frequency tone detector
+ \param mt the multi-frequency tone descriptor
+ \param map a representation of the multi-frequency tone
+ */
+ void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map);
+
+ /*!
+ \brief Check a sample buffer for the presence of the mulit-frequency tone described by mt
+ \param mt the multi-frequency tone descriptor
+ \param sample_buffer an array aof 16 bit signed linear samples
+ \param samples the number of samples present in sample_buffer
+ \return true when the tone was detected or false when it is not
+ */
+ int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
+ int16_t sample_buffer[],
+ int samples);
+
+ /*!
+ \brief Initilize a DTMF detection state object
+ \param dtmf_detect_state the DTMF detection state to initilize
+ \param sample_rate the desired sample rate
+ */
+ void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate);
+
+ /*!
+ \brief Check a sample buffer for the presence of DTMF digits
+ \param dtmf_detect_state the detection state object to check
+ \param sample_buffer an array aof 16 bit signed linear samples
+ \param samples the number of samples present in sample_buffer
+ \return true when DTMF was detected or false when it is not
+ */
+ int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
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);
+ /*!
+ \brief retrieve any collected digits into a string buffer
+ \param dtmf_detect_state the detection state object to check
+ \param buf the string buffer to write to
+ \param max the maximum length of buf
+ \return the number of characters written to buf
+ */
+ int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
+ char *buf,
+ int max);
+
+ /*!
+ \brief Step through the Goertzel Algorithm for each sample in a buffer
+ \param goertzel_state the goertzel state to step the samples through
+ \param sample_buffer an array aof 16 bit signed linear samples
+ \param samples the number of samples present in sample_buffer
+ */
+ void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
+ 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);
Modified: freeswitch/trunk/libs/libteletone/src/libteletone_generate.c
==============================================================================
--- freeswitch/trunk/libs/libteletone/src/libteletone_generate.c (original)
+++ freeswitch/trunk/libs/libteletone/src/libteletone_generate.c Wed Jun 6 19:28:00 2007
@@ -70,6 +70,7 @@
*/
#include <libteletone.h>
+
#define SMAX 32767
#define SMIN -32768
#define normalize_to_16bit(n) if (n > SMAX) n = SMAX; else if (n < SMIN) n = SMIN;
@@ -78,6 +79,25 @@
#pragma warning(disable:4706)
#endif
+int16_t TELETONE_SINES[SINE_TABLE_MAX] = {
+ 0x00c9, 0x025b, 0x03ed, 0x057f, 0x0711, 0x08a2, 0x0a33, 0x0bc4,
+ 0x0d54, 0x0ee4, 0x1073, 0x1201, 0x138f, 0x151c, 0x16a8, 0x1833,
+ 0x19be, 0x1b47, 0x1cd0, 0x1e57, 0x1fdd, 0x2162, 0x22e5, 0x2467,
+ 0x25e8, 0x2768, 0x28e5, 0x2a62, 0x2bdc, 0x2d55, 0x2ecc, 0x3042,
+ 0x31b5, 0x3327, 0x3497, 0x3604, 0x3770, 0x38d9, 0x3a40, 0x3ba5,
+ 0x3d08, 0x3e68, 0x3fc6, 0x4121, 0x427a, 0x43d1, 0x4524, 0x4675,
+ 0x47c4, 0x490f, 0x4a58, 0x4b9e, 0x4ce1, 0x4e21, 0x4f5e, 0x5098,
+ 0x51cf, 0x5303, 0x5433, 0x5560, 0x568a, 0x57b1, 0x58d4, 0x59f4,
+ 0x5b10, 0x5c29, 0x5d3e, 0x5e50, 0x5f5e, 0x6068, 0x616f, 0x6272,
+ 0x6371, 0x646c, 0x6564, 0x6657, 0x6747, 0x6832, 0x691a, 0x69fd,
+ 0x6add, 0x6bb8, 0x6c8f, 0x6d62, 0x6e31, 0x6efb, 0x6fc2, 0x7083,
+ 0x7141, 0x71fa, 0x72af, 0x735f, 0x740b, 0x74b3, 0x7556, 0x75f4,
+ 0x768e, 0x7723, 0x77b4, 0x7840, 0x78c8, 0x794a, 0x79c9, 0x7a42,
+ 0x7ab7, 0x7b27, 0x7b92, 0x7bf9, 0x7c5a, 0x7cb7, 0x7d0f, 0x7d63,
+ 0x7db1, 0x7dfb, 0x7e3f, 0x7e7f, 0x7eba, 0x7ef0, 0x7f22, 0x7f4e,
+ 0x7f75, 0x7f98, 0x7fb5, 0x7fce, 0x7fe2, 0x7ff1, 0x7ffa, 0x7fff
+};
+
int teletone_set_tone(teletone_generation_session_t *ts, int index, ...)
{
@@ -122,8 +142,9 @@
ts->tmp_wait = -1;
ts->handler = handler;
ts->user_data = user_data;
- ts->volume = 1500;
+ ts->volume = -7;
ts->decay_step = 0;
+ ts->decay_factor = 1;
if (buflen) {
if ((ts->buffer = calloc(buflen, sizeof(teletone_audio_t))) == 0) {
return -1;
@@ -181,34 +202,24 @@
int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map)
{
- teletone_process_t period = (1.0 / ts->rate) / ts->channels;
+ /*teletone_process_t period = (1.0 / ts->rate) / ts->channels;*/
int i, c;
int freqlen = 0;
- teletone_process_t tones[TELETONE_MAX_TONES];
- int decay = 0;
+ teletone_dds_state_t tones[TELETONE_MAX_TONES];
+ //int decay = 0;
int duration;
int wait = 0;
- teletone_process_t sample;
-
+ int32_t sample;
+ int32_t dc = 0;
+ float vol = ts->volume;
ts->samples = 0;
-
+ memset(tones, 0, sizeof(tones[0]) * TELETONE_MAX_TONES);
duration = (ts->tmp_duration > -1) ? ts->tmp_duration : ts->duration;
wait = (ts->tmp_wait > -1) ? ts->tmp_wait : ts->wait;
if (map->freqs[0] > 0) {
- if (ts->decay_step) {
- if (ts->decay_factor) {
- decay = (duration - (duration / ts->decay_factor));
- } else {
- decay = 0;
- }
- }
- if (ts->volume < 0) {
- ts->volume = 0;
- }
-
for (freqlen = 0; map->freqs[freqlen] && freqlen < TELETONE_MAX_TONES; freqlen++) {
- tones[freqlen] = (teletone_process_t) map->freqs[freqlen] * (2 * M_PI);
+ teletone_dds_state_set_tone(&tones[freqlen], map->freqs[freqlen], ts->rate, vol);
}
if (ts->channels > 1) {
@@ -220,17 +231,28 @@
return -1;
}
}
+
for (ts->samples = 0; ts->samples < ts->datalen && ts->samples < duration; ts->samples++) {
- if (ts->decay_step && !(ts->samples % ts->decay_step) && ts->volume > 0 && ts->samples > decay) {
- ts->volume += ts->decay_direction;
+ if (ts->decay_direction && ++dc >= ts->decay_step) {
+ float nvol = vol + ts->decay_direction * ts->decay_factor;
+ int j;
+
+ if (nvol <= TELETONE_VOL_DB_MAX && nvol >= TELETONE_VOL_DB_MIN) {
+ vol = nvol;
+ for (j = 0; map->freqs[j] && j < TELETONE_MAX_TONES; j++) {
+ teletone_dds_state_set_tx_level(&tones[j], vol);
+ }
+ dc = 0;
+ }
}
- sample = (teletone_process_t) 128;
+ sample = 128;
for (i = 0; i < freqlen; i++) {
- sample += ((teletone_process_t) 2 * (ts->volume > 0 ? ts->volume : 1) * cos(tones[i] * ts->samples * period));
+ int32_t s = teletone_dds_modulate_sample(&tones[i]);
+ sample += s;
}
- normalize_to_16bit(sample);
+ sample /= freqlen;
ts->buffer[ts->samples] = (teletone_audio_t)sample;
for (c = 1; c < ts->channels; c++) {
@@ -261,7 +283,8 @@
fprintf(ts->debug_stream, "%s%0.2f", i == 0 ? "" : "+",map->freqs[i]);
}
- fprintf(ts->debug_stream, ") [volume %d; samples %d(%dms) x %d channel%s; wait %d(%dms); decay_factor %d; decay_step %d; wrote %d bytes]\n",
+ fprintf(ts->debug_stream,
+ ") [volume %0.2fDb; samples %d(%dms) x %d channel%s; wait %d(%dms); decay_factor %0.2f; decay_step %d(%dms); wrote %d bytes]\n",
ts->volume,
duration,
duration / (ts->rate / 1000),
@@ -271,6 +294,7 @@
wait / (ts->rate / 1000),
ts->decay_factor,
ts->decay_step,
+ ts->decay_step / (ts->rate / 1000),
ts->samples * 2);
}
}
@@ -330,18 +354,23 @@
ts->duration = atoi(cur + 2) * (ts->rate / 1000);
break;
case 'v':
- ts->volume = atoi(cur + 2);
+ {
+ float vol = atof(cur + 2);
+ if (vol <= TELETONE_VOL_DB_MAX && vol >= TELETONE_VOL_DB_MIN) {
+ ts->volume = vol;
+ }
+ }
break;
case '>':
- ts->decay_factor = atoi(cur + 2);
+ ts->decay_step = atoi(cur + 2) * (ts->rate / 1000);
ts->decay_direction = -1;
break;
case '<':
- ts->decay_factor = atoi(cur + 2);
+ ts->decay_step = atoi(cur + 2) * (ts->rate / 1000);
ts->decay_direction = 1;
break;
case '+':
- ts->decay_step = atoi(cur + 2);
+ ts->decay_factor = atof(cur + 2);
break;
case 'w':
ts->wait = atoi(cur + 2) * (ts->rate / 1000);
Modified: freeswitch/trunk/libs/libteletone/src/libteletone_generate.h
==============================================================================
--- freeswitch/trunk/libs/libteletone/src/libteletone_generate.h (original)
+++ freeswitch/trunk/libs/libteletone/src/libteletone_generate.h Wed Jun 6 19:28:00 2007
@@ -72,13 +72,30 @@
#define LIBTELETONE_GENERATE_H
#ifdef __cplusplus
extern "C" {
+#ifdef _doh
+}
+#endif
#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <math.h>
+#if !defined(powf)
+extern float powf (float, float);
+#endif
+#include <string.h>
+#include <errno.h>
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <math.h>
#ifndef _MSC_VER
#include <unistd.h>
+#include <stdint.h>
#endif
#include <fcntl.h>
#include <sys/types.h>
@@ -87,12 +104,71 @@
#include <stdarg.h>
#include <libteletone.h>
+#define TELETONE_VOL_DB_MAX 0
+#define TELETONE_VOL_DB_MIN -63
+
+struct teletone_dds_state {
+ uint32_t phase_rate;
+ uint32_t scale_factor;
+ uint32_t phase_accumulator;
+ int16_t sample;
+ float tx_level;
+};
+typedef struct teletone_dds_state teletone_dds_state_t;
+
+#define SINE_TABLE_MAX 128
+#define SINE_TABLE_LEN (SINE_TABLE_MAX - 1)
+#define MAX_PHASE_ACCUMULATOR 0x10000 * 0x10000
+/* 3.14 == the max power on ulaw (alaw is 3.17) */
+/* 3.02 represents twice the power */
+#define DBM0_MAX_POWER (3.14f + 3.02f)
+
+extern int16_t TELETONE_SINES[SINE_TABLE_MAX];
+
+static __inline__ int16_t teletone_dds_modulate_sample(teletone_dds_state_t *dds)
+{
+ int32_t bitmask = dds->phase_accumulator, sine_index = (bitmask >>= 23) & SINE_TABLE_LEN;
+ int16_t sample;
+
+ if (bitmask & SINE_TABLE_MAX) {
+ sine_index = SINE_TABLE_LEN - sine_index;
+ }
+
+ sample = TELETONE_SINES[sine_index];
+
+ if (bitmask & (SINE_TABLE_MAX * 2)) {
+ sample *= -1;
+ }
+
+ dds->phase_accumulator += dds->phase_rate;
+
+ return (int16_t) (sample * dds->scale_factor >> 15);
+}
+
+static __inline__ void teletone_dds_state_set_tone(teletone_dds_state_t *dds, float tone, uint32_t rate, float tx_level)
+{
+ dds->phase_accumulator = 0;
+ dds->phase_rate = (int32_t) ((tone * MAX_PHASE_ACCUMULATOR) / rate);
+
+
+ if (dds->tx_level != tx_level || !dds->scale_factor) {
+ dds->scale_factor = (int) (powf(10.0f, (tx_level - DBM0_MAX_POWER) / 20.0f) * (32767.0f * 1.414214f));
+ }
+
+ dds->tx_level = tx_level;
+}
+
+static __inline__ void teletone_dds_state_set_tx_level(teletone_dds_state_t *dds, float tx_level)
+{
+ dds->scale_factor = (int) (powf(10.0f, (tx_level - DBM0_MAX_POWER) / 20.0f) * (32767.0f * 1.414214f));
+}
+
/*! \file libteletone_generate.h
- \brief Tone Generation Routines
+ \brief Tone Generation Routines
- This module is responsible for tone generation specifics
+ This module is responsible for tone generation specifics
*/
typedef int16_t teletone_audio_t;
@@ -120,13 +196,13 @@
/*! Number of loops to repeat the entire set of instructions*/
int LOOPS;
/*! Number to mutiply total samples by to determine when to begin ascent or decent e.g. 0=beginning 4=(last 25%) */
- int decay_factor;
+ float decay_factor;
/*! Direction to perform volume increase/decrease 1/-1*/
int decay_direction;
/*! Number of samples between increase/decrease of volume */
int decay_step;
/*! Volume factor of the tone */
- int volume;
+ float volume;
/*! Debug on/off */
int debug;
/*! FILE stream to write debug data to */
1
0
Author: anthm
Date: Wed Jun 6 10:35:32 2007
New Revision: 5275
Modified:
freeswitch/trunk/scripts/socket/socket2me/socket2me.c
Log:
update
Modified: freeswitch/trunk/scripts/socket/socket2me/socket2me.c
==============================================================================
--- freeswitch/trunk/scripts/socket/socket2me/socket2me.c (original)
+++ freeswitch/trunk/scripts/socket/socket2me/socket2me.c Wed Jun 6 10:35:32 2007
@@ -371,7 +371,7 @@
cliAddrLen = sizeof(sendaddr);
- if (sendto(usock, usebuf, tx_bytes, 0, (struct sockaddr *) &sendaddr, sizeof(sendaddr)) != sample_count) {
+ if (sendto(usock, usebuf, tx_bytes, 0, (struct sockaddr *) &sendaddr, sizeof(sendaddr)) != tx_bytes) {
die("sendto() sent a different number of bytes than expected");
}
}
1
0
Author: anthm
Date: Wed Jun 6 10:14:17 2007
New Revision: 5274
Modified:
freeswitch/trunk/scripts/socket/socket2me/socket2me.c
Log:
update
Modified: freeswitch/trunk/scripts/socket/socket2me/socket2me.c
==============================================================================
--- freeswitch/trunk/scripts/socket/socket2me/socket2me.c (original)
+++ freeswitch/trunk/scripts/socket/socket2me/socket2me.c Wed Jun 6 10:14:17 2007
@@ -284,7 +284,7 @@
for (;;) {
struct sockaddr_in local_addr = {0};
- int cliAddrLen = sizeof(local_addr);
+ size_t cliAddrLen = sizeof(local_addr);
unsigned char audiobuf[1024], rawbuf[1024], outbuf[1024];
short *usebuf = NULL;
int tx, tx_bytes, bigger, sample_count;
@@ -316,7 +316,7 @@
continue;
}
- if ((read_bytes = recvfrom(usock, audiobuf, sizeof(audiobuf), 0, (struct sockaddr *) &local_addr, cliAddrLen)) < 0) {
+ if ((read_bytes = recvfrom(usock, audiobuf, sizeof(audiobuf), 0, (struct sockaddr *) &local_addr, &cliAddrLen)) < 0) {
die("recvfrom() failed");
}
1
0
[commit] r5273 - freeswitch/branches/greenlizard/src/mod/formats/mod_shout
by Freeswitch SVN 05 Jun '07
by Freeswitch SVN 05 Jun '07
05 Jun '07
Author: greenlizard
Date: Tue Jun 5 15:44:54 2007
New Revision: 5273
Modified:
freeswitch/branches/greenlizard/src/mod/formats/mod_shout/mod_shout.c
Log:
patch from http://jira.freeswitch.org/browse/MODFORM-1#action_10284
Modified: freeswitch/branches/greenlizard/src/mod/formats/mod_shout/mod_shout.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/formats/mod_shout/mod_shout.c (original)
+++ freeswitch/branches/greenlizard/src/mod/formats/mod_shout/mod_shout.c Tue Jun 5 15:44:54 2007
@@ -271,8 +271,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decoder Error!\n");
}
dlen = 0;
- //continue;
- goto error;
+ continue;
}
context->mp3err = 0;
1
0
[commit] r5272 - in freeswitch/branches/greenlizard: scripts src/mod/languages/mod_python
by Freeswitch SVN 05 Jun '07
by Freeswitch SVN 05 Jun '07
05 Jun '07
Author: greenlizard
Date: Tue Jun 5 15:29:34 2007
New Revision: 5272
Modified:
freeswitch/branches/greenlizard/scripts/mytest.py
freeswitch/branches/greenlizard/src/mod/languages/mod_python/Makefile
Log:
update the mytest.py to match recent changes, checkin trunk version of Makefile
Modified: freeswitch/branches/greenlizard/scripts/mytest.py
==============================================================================
--- freeswitch/branches/greenlizard/scripts/mytest.py (original)
+++ freeswitch/branches/greenlizard/scripts/mytest.py Tue Jun 5 15:29:34 2007
@@ -1,32 +1,44 @@
-
-# WARNING: May be out of date, please see
+# 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
+
+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 == "4":
+ return "seek:-120000"
+ if input == "6":
+ return "seek:+120000"
+ if input == "7":
+ return "seek:-360000"
+ if input == "9":
+ return "seek:+360000"
+ if input == "0":
+ return "stop"
+ return None # will make the streamfile audio stop
+
console_log("1","test from my python program\n")
session.answer()
-session.setDTMFCallback(onDTMF)
+session.setDTMFCallback(onDTMF, "")
session.set_tts_parms("cepstral", "david")
-session.playFile("/root/test.gsm", "")
+session.playFile("/pub/music/Bob Marley - exodus.mp3", "")
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")
+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 "+ phone_number +"\n")
+
+console_log("1","result from play_and_get_digits is %s\n" % phone_number)
session.transfer("1000", "XML", "default")
session.hangup("1")
Modified: freeswitch/branches/greenlizard/src/mod/languages/mod_python/Makefile
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/languages/mod_python/Makefile (original)
+++ freeswitch/branches/greenlizard/src/mod/languages/mod_python/Makefile Tue Jun 5 15:29:34 2007
@@ -3,8 +3,8 @@
# and define these variables to impact your build
-LOCAL_CFLAGS=-I$(PREFIX)/include/python2.5/
-LOCAL_LDFLAGS=-lpython2.5 -L$(PREFIX)/lib/python2.5/config/ -lutil -lstdc++
+LOCAL_CFLAGS=-I/usr/include/python2.4/
+LOCAL_LDFLAGS=-lpython2.4 -L/usr/lib/python2.4/config/ -lutil -lstdc++
LOCAL_OBJS=freeswitch_python.o mod_python_wrap.o
include ../../../../build/modmake.rules
@@ -13,17 +13,20 @@
SWIGCFILE=../../../switch_swig.c
SWIGIFILE=../../../switch_swig.i
-local_depend:
-MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install Python-2.5.1.tgz --prefix=$(PREFIX) --enable-threads CFLAGSFORSHARED="-fPIC"
+#local_depend:
+# MAKE=$(MAKE) PY_CFLAGS=-fPIC $(BASE)/build/buildlib.sh $(BASE) install Python-2.4.3.tgz --prefix=$(PREFIX) --enable-threads
reswig:
-swig -python -shadow -c++ -o mod_python_wrap.cpp mod_python.i
+ swig -python -shadow -c++ -I../../../../src/include -o mod_python_wrap.cpp mod_python.i
switch_swig_wrap.o: switch_swig_wrap.c Makefile
-$(CC) -w $(CFLAGS) -c $< -o $@
+ $(CC) -w $(CFLAGS) -c $< -o $@
switch_swig.o: $(SWIGCFILE) Makefile
-$(CC) -w $(CFLAGS) -c $< -o $@
+ $(CC) -w $(CFLAGS) -c $< -o $@
local_install:
-cp -f freeswitch.py $(PREFIX)/lib/python2.5/site-packages/
+ cp -f freeswitch.py /usr/lib/python2.4/site-packages/
+
+
+
1
0
05 Jun '07
Author: mikej
Date: Tue Jun 5 14:22:16 2007
New Revision: 5271
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
Log:
fix to not unintentionally use to in 200 contact
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Tue Jun 5 14:22:16 2007
@@ -1844,11 +1844,10 @@
if (profile->ndlb & PFLAG_NDLB_TO_IN_200_CONTACT) {
tech_pvt->reply_contact = tech_pvt->to_uri;
} else {
- tech_pvt->to_uri = switch_core_session_strdup(session, profile->url);
+ tech_pvt->reply_contact = switch_core_session_strdup(session, profile->url);
}
} else {
- tech_pvt->to_uri = switch_core_session_strdup(session, profile->url);
- tech_pvt->reply_contact = tech_pvt->to_uri;
+ tech_pvt->reply_contact = switch_core_session_strdup(session, profile->url);
}
}
1
0
[commit] r5270 - in freeswitch/branches/greenlizard/src: . include mod/languages/mod_python
by Freeswitch SVN 05 Jun '07
by Freeswitch SVN 05 Jun '07
05 Jun '07
Author: greenlizard
Date: Tue Jun 5 14:11:00 2007
New Revision: 5270
Modified:
freeswitch/branches/greenlizard/src/include/switch_cpp.h
freeswitch/branches/greenlizard/src/mod/languages/mod_python/freeswitch.py
freeswitch/branches/greenlizard/src/mod/languages/mod_python/freeswitch_python.cpp
freeswitch/branches/greenlizard/src/mod/languages/mod_python/freeswitch_python.h
freeswitch/branches/greenlizard/src/mod/languages/mod_python/mod_python.i
freeswitch/branches/greenlizard/src/mod/languages/mod_python/mod_python_wrap.cpp
freeswitch/branches/greenlizard/src/switch_cpp.cpp
Log:
changes described in http://pastebin.freeswitch.org/3021
Modified: freeswitch/branches/greenlizard/src/include/switch_cpp.h
==============================================================================
--- freeswitch/branches/greenlizard/src/include/switch_cpp.h (original)
+++ freeswitch/branches/greenlizard/src/include/switch_cpp.h Tue Jun 5 14:11:00 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 *session);
~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/branches/greenlizard/src/mod/languages/mod_python/freeswitch.py
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/languages/mod_python/freeswitch.py (original)
+++ freeswitch/branches/greenlizard/src/mod/languages/mod_python/freeswitch.py Tue Jun 5 14:11:00 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/branches/greenlizard/src/mod/languages/mod_python/freeswitch_python.cpp
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/languages/mod_python/freeswitch_python.cpp (original)
+++ freeswitch/branches/greenlizard/src/mod/languages/mod_python/freeswitch_python.cpp Tue Jun 5 14:11:00 2007
@@ -3,54 +3,52 @@
#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 };
-
- 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;
- }
-
- 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_INFO, "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_INFO, "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_INFO, "PySession::end_allow_threads() called\n");
+ PyEval_RestoreThread(((PyThreadState *)threadState));
}
PySession::~PySession() {
// Should we do any cleanup here?
}
+
+
Modified: freeswitch/branches/greenlizard/src/mod/languages/mod_python/freeswitch_python.h
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/languages/mod_python/freeswitch_python.h (original)
+++ freeswitch/branches/greenlizard/src/mod/languages/mod_python/freeswitch_python.h Tue Jun 5 14:11:00 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/branches/greenlizard/src/mod/languages/mod_python/mod_python.i
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/languages/mod_python/mod_python.i (original)
+++ freeswitch/branches/greenlizard/src/mod/languages/mod_python/mod_python.i Tue Jun 5 14:11:00 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,21 @@
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 +100,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/branches/greenlizard/src/mod/languages/mod_python/mod_python_wrap.cpp
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/languages/mod_python/mod_python_wrap.cpp (original)
+++ freeswitch/branches/greenlizard/src/mod/languages/mod_python/mod_python_wrap.cpp Tue Jun 5 14:11:00 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,21 @@
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 +2968,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 +3005,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 +3249,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 +3380,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 +3861,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 +3889,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 +3937,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 +4082,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 +4110,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();
+ 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""'");
+ }
+ 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""'");
+ }
+ 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;
return resultobj;
fail:
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
return NULL;
}
-SWIGINTERN PyObject *_wrap_CoreSession_end_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_transfer(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 *""'");
- }
- 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;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ int result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
- void *argp3 ;
- int res3 = 0 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
int res4 ;
- unsigned int val5 ;
- int ecode5 = 0 ;
+ char *buf4 = 0 ;
+ int alloc4 = 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 (!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 '" "PythonDTMFCallback" "', argument " "1"" of type '" "switch_core_session *""'");
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1"" of type '" "CoreSession *""'");
}
- arg1 = reinterpret_cast< switch_core_session * >(argp1);
- res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PythonDTMFCallback" "', argument " "2"" of type '" "void *""'");
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2"" of type '" "char *""'");
}
- {
- 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;
- }
+ 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 *""'");
}
- res4 = SWIG_ConvertPtr(obj3,SWIG_as_voidptrptr(&arg4), 0, 0);
+ arg3 = buf3;
+ 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_transfer" "', 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""'");
- }
- 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 );
+ 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_function_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 ;
- PyObject *arg2 = (PyObject *) 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 ;
+ 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_function_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_function_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);
- 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);
+ 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 *""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
- result = (PyObject *) ((arg1)->function);
- resultobj = result;
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_input_callback_state_threadState_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- input_callback_state *arg1 = (input_callback_state *) 0 ;
- PyThreadState *arg2 = (PyThreadState *) 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: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 *""'");
+ 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);
- 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 *""'");
+ 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 *""'");
}
- 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 *""'");
+ 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""'");
}
- arg1 = reinterpret_cast< input_callback_state * >(argp1);
- result = (PyThreadState *) ((arg1)->threadState);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PyThreadState, 0 | 0 );
+ 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 +4704,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 +4795,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 +4821,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 +4850,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 +4864,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 +4878,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 +4892,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/branches/greenlizard/src/switch_cpp.cpp
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_cpp.cpp (original)
+++ freeswitch/branches/greenlizard/src/switch_cpp.cpp Tue Jun 5 14:11:00 2007
@@ -17,11 +17,12 @@
}
}
-CoreSession::CoreSession(switch_core_session_t *session)
+CoreSession::CoreSession(switch_core_session_t *session_p)
{
init_vars();
- channel = switch_core_session_get_channel(session);
- switch_core_session_read_lock(session);
+ channel = switch_core_session_get_channel(session_p);
+ switch_core_session_read_lock(session_p);
+ this->session = session_p;
}
CoreSession::~CoreSession()
@@ -86,20 +87,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();
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "CoreSession::setDTMFCallback.");
if (cb) {
args.buf = buf;
args.buflen = buflen;
@@ -111,7 +117,8 @@
}
}
-int CoreSession::speakText(char *text)
+
+int CoreSession::speak(char *text)
{
switch_status_t status;
switch_codec_t *codec;
@@ -133,12 +140,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;
}
@@ -151,8 +168,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);
@@ -171,16 +195,64 @@
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;
+
+ 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();
+
+ return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
+
+}
+
+bool CoreSession::ready() {
+
+ switch_channel_t *channel;
+
+ if (!session) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "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_WARNING, "CoreSession::begin_allow_threads() called and does nothing\n");
}
void CoreSession::end_allow_threads() {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "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
05 Jun '07
Author: silik0n
Date: Tue Jun 5 13:42:15 2007
New Revision: 5269
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
Log:
Change register function to use To: header instead of the From. See RFC3261 section 10.
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Tue Jun 5 13:42:15 2007
@@ -24,7 +24,7 @@
* Contributor(s):
*
* Anthony Minessale II <anthmct(a)yahoo.com>
- * Ken Rice, Asteria Solutions Group, Inc <ken(a)asteriasgi.com>
+ * Ken Rice, krice(a)suspicious.org (work sponsored by CopperCom, Inc and Asteria Solutions Group, Inc)
* Paul D. Tinsley <pdt at jackhammer.org>
* Bret McDanel <trixter AT 0xdecafbad.com>
* Marcel Barbulescu <marcelbarbulescu(a)gmail.com>
@@ -275,14 +275,14 @@
uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_handle_t * nh, sip_t const *sip, sofia_regtype_t regtype, char *key,
uint32_t keylen, switch_event_t **v_event)
{
- sip_from_t const *from = NULL;
+ sip_to_t const *to = NULL;
sip_expires_t const *expires = NULL;
sip_authorization_t const *authorization = NULL;
sip_contact_t const *contact = NULL;
char *sql;
switch_event_t *s_event;
- const char *from_user = NULL;
- const char *from_host = NULL;
+ const char *to_user = NULL;
+ const char *to_host = NULL;
char contact_str[1024] = "";
char buf[512];
uint8_t stale = 0, forbidden = 0;
@@ -304,14 +304,14 @@
expires = sip->sip_expires;
authorization = sip->sip_authorization;
contact = sip->sip_contact;
- from = sip->sip_from;
+ to = sip->sip_to;
- if (from) {
- from_user = from->a_url->url_user;
- from_host = from->a_url->url_host;
+ if (to) {
+ to_user = to->a_url->url_user;
+ to_host = to->a_url->url_host;
}
- if (!from_user || !from_host) {
+ if (!to_user || !to_host) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not do authorization without a complete from header\n");
nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), TAG_END());
return 1;
@@ -322,8 +322,8 @@
display = contact->m_display;
if (switch_strlen_zero(display)) {
- if (from) {
- display = from->a_display;
+ if (to) {
+ display = to->a_display;
if (switch_strlen_zero(display)) {
display = "\"user\"";
}
@@ -385,7 +385,7 @@
}
if (auth_res != AUTH_OK && !stale) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "send %s for [%s@%s]\n", forbidden ? "forbidden" : "challange", from_user, from_host);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "send %s for [%s@%s]\n", forbidden ? "forbidden" : "challange", to_user, to_host);
if (auth_res == AUTH_FORBIDDEN) {
nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
} else {
@@ -412,10 +412,10 @@
switch_mutex_unlock(profile->ireg_mutex);
auth_str =
- switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", from_host, uuid_str, stale ? " stale=\"true\"," : "");
+ switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", to_host, uuid_str, stale ? " stale=\"true\"," : "");
if (regtype == REG_REGISTER) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Requesting Registration from: [%s@%s]\n", from_user, from_host);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Requesting Registration from: [%s@%s]\n", to_user, to_host);
nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END());
} else if (regtype == REG_INVITE) {
nua_respond(nh, SIP_407_PROXY_AUTH_REQUIRED, NUTAG_WITH_THIS(nua), SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END());
@@ -427,22 +427,22 @@
reg:
if (exptime) {
- if (!sofia_reg_find_reg_url(profile, from_user, from_host, buf, sizeof(buf))) {
+ if (!sofia_reg_find_reg_url(profile, to_user, to_host, buf, sizeof(buf))) {
sql = switch_mprintf("insert into sip_registrations values ('%q','%q','%q','%q', '%q', %ld)",
- from_user, from_host, contact_str, cd ? "Registered(NATHACK)" : "Registered", rpid, (long) time(NULL) + (long) exptime * 2);
+ to_user, to_host, contact_str, cd ? "Registered(NATHACK)" : "Registered", rpid, (long) time(NULL) + (long) exptime * 2);
} else {
sql =
switch_mprintf
("update sip_registrations set contact='%q', expires=%ld, rpid='%q' where user='%q' and host='%q'",
- contact_str, (long) time(NULL) + (long) exptime * 2, rpid, from_user, from_host);
+ contact_str, (long) time(NULL) + (long) exptime * 2, rpid, to_user, to_host);
}
if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_REGISTER) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "profile-name", "%s", profile->name);
- switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-user", "%s", from_user);
- switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-host", "%s", from_host);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-user", "%s", to_user);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-host", "%s", to_host);
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "contact", "%s", contact_str);
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid);
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%ld", (long) exptime);
@@ -456,26 +456,26 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
- "Register:\nFrom: [%s@%s]\nContact: [%s]\nExpires: [%ld]\n", from_user, from_host, contact_str, (long) exptime);
+ "Register:\nFrom: [%s@%s]\nContact: [%s]\nExpires: [%ld]\n", to_user, to_host, contact_str, (long) exptime);
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "sip");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->url);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, to_host);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Registered");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
switch_event_fire(&event);
}
} else {
- if ((sql = switch_mprintf("delete from sip_subscriptions where user='%q' and host='%q'", from_user, from_host))) {
+ if ((sql = switch_mprintf("delete from sip_subscriptions where user='%q' and host='%q'", to_user, to_host))) {
sofia_glue_execute_sql(profile, SWITCH_FALSE, sql, profile->ireg_mutex);
switch_safe_free(sql);
sql = NULL;
}
- if ((sql = switch_mprintf("delete from sip_registrations where user='%q' and host='%q'", from_user, from_host))) {
+ if ((sql = switch_mprintf("delete from sip_registrations where user='%q' and host='%q'", to_user, to_host))) {
sofia_glue_execute_sql(profile, SWITCH_FALSE, sql, profile->ireg_mutex);
switch_safe_free(sql);
sql = NULL;
@@ -483,7 +483,7 @@
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_OUT) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "sip");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->url);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s+%s@%s", SOFIA_CHAT_PROTO, from_user, from_host);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s+%s@%s", SOFIA_CHAT_PROTO, to_user, to_host);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "unavailable");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid);
@@ -495,7 +495,7 @@
if (switch_event_create(&event, SWITCH_EVENT_ROSTER) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "sip");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, to_host);
switch_event_fire(&event);
}
1
0
Author: anthm
Date: Tue Jun 5 12:52:50 2007
New Revision: 5268
Modified:
freeswitch/trunk/src/include/switch_utils.h
Log:
update
Modified: freeswitch/trunk/src/include/switch_utils.h
==============================================================================
--- freeswitch/trunk/src/include/switch_utils.h (original)
+++ freeswitch/trunk/src/include/switch_utils.h Tue Jun 5 12:52:50 2007
@@ -177,7 +177,7 @@
#define switch_set_string(_dst, _src) switch_copy_string(_dst, _src, sizeof(_dst))
-static __inline__ char *switch_clean_string(char *s)
+static inline char *switch_clean_string(char *s)
{ char *p;
for (p = s; p && *p; p++) { uint8_t x = (uint8_t) *p; if (x < 32 || x > 127) { *p = ' '; }
1
0
Author: anthm
Date: Tue Jun 5 12:50:51 2007
New Revision: 5267
Modified:
freeswitch/trunk/src/include/switch_utils.h
freeswitch/trunk/src/switch_caller.c
freeswitch/trunk/src/switch_channel.c
Log:
update
Modified: freeswitch/trunk/src/include/switch_utils.h
==============================================================================
--- freeswitch/trunk/src/include/switch_utils.h (original)
+++ freeswitch/trunk/src/include/switch_utils.h Tue Jun 5 12:50:51 2007
@@ -177,11 +177,13 @@
#define switch_set_string(_dst, _src) switch_copy_string(_dst, _src, sizeof(_dst))
-static __inline__ void switch_clean_string(char *s)
+static __inline__ char *switch_clean_string(char *s)
{ char *p;
for (p = s; p && *p; p++) { uint8_t x = (uint8_t) *p; if (x < 32 || x > 127) { *p = ' '; }
}
+
+ return s;
}
Modified: freeswitch/trunk/src/switch_caller.c
==============================================================================
--- freeswitch/trunk/src/switch_caller.c (original)
+++ freeswitch/trunk/src/switch_caller.c Tue Jun 5 12:50:51 2007
@@ -51,17 +51,17 @@
if (!context) {
context = "default";
}
- profile->username = switch_core_strdup(pool, switch_str_nil(username));
- profile->dialplan = switch_core_strdup(pool, switch_str_nil(dialplan));
- profile->caller_id_name = switch_core_strdup(pool, switch_str_nil(caller_id_name));
- profile->caller_id_number = switch_core_strdup(pool, switch_str_nil(caller_id_number));
- profile->network_addr = switch_core_strdup(pool, switch_str_nil(network_addr));
- profile->ani = switch_core_strdup(pool, switch_str_nil(ani));
- profile->aniii = switch_core_strdup(pool, switch_str_nil(aniii));
- profile->rdnis = switch_core_strdup(pool, switch_str_nil(rdnis));
- profile->source = switch_core_strdup(pool, switch_str_nil(source));
- profile->context = switch_core_strdup(pool, switch_str_nil(context));
- profile->destination_number = switch_core_strdup(pool, switch_str_nil(destination_number));
+ profile->username = switch_clean_string(switch_core_strdup(pool, switch_str_nil(username)));
+ profile->dialplan = switch_clean_string(switch_core_strdup(pool, switch_str_nil(dialplan)));
+ profile->caller_id_name = switch_clean_string(switch_core_strdup(pool, switch_str_nil(caller_id_name)));
+ profile->caller_id_number = switch_clean_string(switch_core_strdup(pool, switch_str_nil(caller_id_number)));
+ profile->network_addr = switch_clean_string(switch_core_strdup(pool, switch_str_nil(network_addr)));
+ profile->ani = switch_clean_string(switch_core_strdup(pool, switch_str_nil(ani)));
+ profile->aniii = switch_clean_string(switch_core_strdup(pool, switch_str_nil(aniii)));
+ profile->rdnis = switch_clean_string(switch_core_strdup(pool, switch_str_nil(rdnis)));
+ profile->source = switch_clean_string(switch_core_strdup(pool, switch_str_nil(source)));
+ profile->context = switch_clean_string(switch_core_strdup(pool, switch_str_nil(context)));
+ profile->destination_number = switch_clean_string(switch_core_strdup(pool, switch_str_nil(destination_number)));
switch_set_flag(profile, SWITCH_CPF_SCREEN);
}
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Tue Jun 5 12:50:51 2007
@@ -389,7 +389,7 @@
switch_mutex_lock(channel->profile_mutex);
switch_core_hash_delete(channel->variables, varname);
if (!switch_strlen_zero(value)) {
- switch_core_hash_insert_dup(channel->variables, varname, switch_core_session_strdup(channel->session, value));
+ switch_core_hash_insert_dup(channel->variables, varname, switch_clean_string(switch_core_session_strdup(channel->session, value)));
} else {
switch_core_hash_delete(channel->variables, varname);
}
1
0