mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
inter session communication goodies
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@309 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -47,6 +47,37 @@ extern "C" {
|
||||
#define SWITCH_MAX_CORE_THREAD_SESSION_OBJS 128
|
||||
#define SWITCH_MAX_STREAMS 128
|
||||
|
||||
/*! \brief A message object designed to allow unlike technologies to exchange data */
|
||||
struct switch_core_session_message {
|
||||
/*! uuid of the sender (for replies)*/
|
||||
char *from;
|
||||
/*! enumeration of the type of message */
|
||||
switch_core_session_message_t message_id;
|
||||
|
||||
/*! optional numeric arg*/
|
||||
int numeric_arg;
|
||||
/*! optional string arg*/
|
||||
char *string_arg;
|
||||
/*! optional string arg*/
|
||||
size_t string_arg_size;
|
||||
/*! optional arbitrary pointer arg */
|
||||
void *pointer_arg;
|
||||
/*! optional arbitrary pointer arg's size */
|
||||
size_t pointer_arg_size;
|
||||
|
||||
/*! optional numeric reply*/
|
||||
int numeric_reply;
|
||||
/*! optional string reply*/
|
||||
char *string_reply;
|
||||
/*! optional string reply*/
|
||||
size_t string_reply_size;
|
||||
/*! optional arbitrary pointer reply */
|
||||
void *pointer_reply;
|
||||
/*! optional arbitrary pointer reply's size */
|
||||
size_t pointer_reply_size;
|
||||
|
||||
};
|
||||
|
||||
/*! \brief A generic object to pass as a thread's session object to allow mutiple arguements and a pool */
|
||||
struct switch_core_thread_session {
|
||||
/*! status of the thread */
|
||||
@@ -213,6 +244,14 @@ SWITCH_DECLARE(void) switch_core_session_signal_state_change(switch_core_session
|
||||
*/
|
||||
SWITCH_DECLARE(char *) switch_core_session_get_uuid(switch_core_session *session);
|
||||
|
||||
/*!
|
||||
\brief Send a message to another session using it's uuid
|
||||
\param uuid_str the unique id of the session you want to send a message to
|
||||
\param message the switch_core_session_message object to send
|
||||
\return the status returned by the message handler
|
||||
*/
|
||||
SWITCH_DECLARE (switch_status) switch_core_session_message_send(char *uuid_str, switch_core_session_message *message);
|
||||
|
||||
/*!
|
||||
\brief Retrieve private user data from a session
|
||||
\param session the session to retrieve from
|
||||
@@ -293,6 +332,13 @@ SWITCH_DECLARE(switch_status) switch_core_session_outgoing_channel(switch_core_s
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status) switch_core_session_answer_channel(switch_core_session *session);
|
||||
|
||||
/*!
|
||||
\brief Receive a message on a given session
|
||||
\param session the session to receive the message from
|
||||
\return the status returned by the message handler
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status) switch_core_session_receive_message(switch_core_session *session, switch_core_session_message *message);
|
||||
|
||||
/*!
|
||||
\brief Read a frame from a session
|
||||
\param session the session to read from
|
||||
|
||||
@@ -76,6 +76,13 @@ struct switch_io_event_hook_answer_channel {
|
||||
struct switch_io_event_hook_answer_channel *next;
|
||||
};
|
||||
|
||||
/*! \brief Node in which to store custom receive message callback hooks */
|
||||
struct switch_io_event_hook_receive_message {
|
||||
/*! the answer channel callback hook*/
|
||||
switch_receive_message_hook receive_message;
|
||||
struct switch_io_event_hook_receive_message *next;
|
||||
};
|
||||
|
||||
/*! \brief Node in which to store custom read frame channel callback hooks */
|
||||
struct switch_io_event_hook_read_frame {
|
||||
/*! the read frame channel callback hook*/
|
||||
@@ -124,6 +131,8 @@ struct switch_io_event_hooks {
|
||||
struct switch_io_event_hook_outgoing_channel *outgoing_channel;
|
||||
/*! a list of answer channel hooks */
|
||||
struct switch_io_event_hook_answer_channel *answer_channel;
|
||||
/*! a list of receive message hooks */
|
||||
struct switch_io_event_hook_receive_message *receive_message;
|
||||
/*! a list of read frame hooks */
|
||||
struct switch_io_event_hook_read_frame *read_frame;
|
||||
/*! a list of write frame hooks */
|
||||
@@ -156,6 +165,8 @@ struct switch_io_routines {
|
||||
switch_status (*waitfor_write)(switch_core_session *, int, int);
|
||||
/*! send a string of DTMF digits to a session's channel */
|
||||
switch_status (*send_dtmf)(switch_core_session *, char *);
|
||||
/*! receive a message from another session*/
|
||||
switch_status (*receive_message)(switch_core_session *, switch_core_session_message *);
|
||||
};
|
||||
|
||||
/*! \brief Abstraction of an module endpoint interface
|
||||
|
||||
@@ -44,6 +44,21 @@ extern "C" {
|
||||
#define SWITCH_GLOBAL_VERSION "1"
|
||||
#define SWITCH_MAX_CODECS 30
|
||||
|
||||
|
||||
/*!
|
||||
\enum switch_core_session_message_t
|
||||
\brief Possible types of messages for inter-session communication
|
||||
<pre>
|
||||
SWITCH_MESSAGE_REDIRECT_AUDIO - Indication to redirect audio to another location if possible
|
||||
SWITCH_MESSAGE_TRANSMIT_TEXT - A text message
|
||||
</pre>
|
||||
*/
|
||||
typedef enum {
|
||||
SWITCH_MESSAGE_REDIRECT_AUDIO,
|
||||
SWITCH_MESSAGE_TRANSMIT_TEXT
|
||||
} switch_core_session_message_t;
|
||||
|
||||
|
||||
/*!
|
||||
\enum switch_stack_t
|
||||
\brief Expression of how to stack a list
|
||||
@@ -140,7 +155,7 @@ typedef enum {
|
||||
|
||||
<pre>
|
||||
CF_SEND_AUDIO = (1 << 0) - Channel will send audio
|
||||
CF_RECV_AUDIO = (1 << 1) - Channel will recieve audio
|
||||
CF_RECV_AUDIO = (1 << 1) - Channel will receive audio
|
||||
CF_ANSWERED = (1 << 2) - Channel is answered
|
||||
CF_OUTBOUND = (1 << 3) - Channel is an outbound channel
|
||||
</pre>
|
||||
@@ -283,6 +298,7 @@ typedef enum {
|
||||
} switch_event_t;
|
||||
|
||||
|
||||
typedef struct switch_core_session_message switch_core_session_message;
|
||||
typedef struct switch_audio_resampler switch_audio_resampler;
|
||||
typedef struct switch_event_header switch_event_header;
|
||||
typedef struct switch_event switch_event;
|
||||
@@ -312,6 +328,7 @@ typedef struct switch_core_thread_session switch_core_thread_session;
|
||||
typedef struct switch_codec_implementation switch_codec_implementation;
|
||||
typedef struct switch_io_event_hook_outgoing_channel switch_io_event_hook_outgoing_channel;
|
||||
typedef struct switch_io_event_hook_answer_channel switch_io_event_hook_answer_channel;
|
||||
typedef struct switch_io_event_hook_receive_message switch_io_event_hook_receive_message;
|
||||
typedef struct switch_io_event_hook_read_frame switch_io_event_hook_read_frame;
|
||||
typedef struct switch_io_event_hook_write_frame switch_io_event_hook_write_frame;
|
||||
typedef struct switch_io_event_hook_kill_channel switch_io_event_hook_kill_channel;
|
||||
@@ -329,6 +346,7 @@ typedef switch_caller_extension *(*switch_dialplan_hunt_function)(switch_core_se
|
||||
typedef switch_status (*switch_event_handler)(switch_core_session *);
|
||||
typedef switch_status (*switch_outgoing_channel_hook)(switch_core_session *, switch_caller_profile *, switch_core_session *);
|
||||
typedef switch_status (*switch_answer_channel_hook)(switch_core_session *);
|
||||
typedef switch_status (*switch_receive_message_hook)(switch_core_session *, switch_core_session_message *);
|
||||
typedef switch_status (*switch_read_frame_hook)(switch_core_session *, switch_frame **, int, switch_io_flag, int);
|
||||
typedef switch_status (*switch_write_frame_hook)(switch_core_session *, switch_frame *, int, switch_io_flag, int);
|
||||
typedef switch_status (*switch_kill_channel_hook)(switch_core_session *, int);
|
||||
|
||||
Reference in New Issue
Block a user