mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 04:31:50 +00:00
merge fix for MODLANG-33 and MODLANG-34.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5374 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
+92
-19
@@ -20,39 +20,112 @@ switch_status_t process_callback_result(char *raw_result,
|
||||
struct input_callback_state *cb_state,
|
||||
switch_core_session_t *session);
|
||||
|
||||
|
||||
typedef struct input_callback_state {
|
||||
void *function; // pointer to the language specific callback function
|
||||
// eg, PyObject *pyfunc
|
||||
void *threadState; // pointer to the language specific thread state
|
||||
// eg, PyThreadState *threadState
|
||||
void *extra; // currently used to store a switch_file_handle_t
|
||||
char *funcargs; // extra string that will be passed to callback function
|
||||
};
|
||||
|
||||
|
||||
class CoreSession {
|
||||
private:
|
||||
protected:
|
||||
switch_input_args_t args;
|
||||
switch_input_args_t *ap;
|
||||
char *uuid;
|
||||
char *tts_name;
|
||||
char *voice_name;
|
||||
void store_file_handle(switch_file_handle_t *fh);
|
||||
public:
|
||||
CoreSession(char *uuid);
|
||||
CoreSession(switch_core_session_t *new_session);
|
||||
~CoreSession();
|
||||
virtual ~CoreSession();
|
||||
switch_core_session_t *session;
|
||||
switch_channel_t *channel;
|
||||
input_callback_state cb_state;
|
||||
int answer();
|
||||
int preAnswer();
|
||||
void hangup(char *cause);
|
||||
void setVariable(char *var, char *val);
|
||||
char *getVariable(char *var);
|
||||
int playFile(char *file, char *timer_name);
|
||||
void setDTMFCallback(switch_input_callback_function_t cb, void *buf, uint32_t buflen);
|
||||
int speakText(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 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,
|
||||
char *digits_regex);
|
||||
int streamfile(char *file, void *cb_func, char *funcargs, int starting_sample_count);
|
||||
void execute(char *app, char *data);
|
||||
void begin_allow_threads();
|
||||
void end_allow_threads();
|
||||
|
||||
protected:
|
||||
char *uuid;
|
||||
char *tts_name;
|
||||
char *voice_name;
|
||||
/** \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);
|
||||
|
||||
|
||||
/** \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 transfer(char *extensions, char *dialplan, char *context);
|
||||
|
||||
/** \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);
|
||||
|
||||
/** \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);
|
||||
virtual void begin_allow_threads();
|
||||
virtual void end_allow_threads();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user