提交 4b9afa2b authored 作者: Anthony Minessale's avatar Anthony Minessale

unicast framework

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4900 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 a1c4a22e
...@@ -208,6 +208,22 @@ sub call_command($$$) { ...@@ -208,6 +208,22 @@ sub call_command($$$) {
return $self->sendmsg($hash); return $self->sendmsg($hash);
} }
sub unicast($$$$$$) {
my $self = shift;
my $hash = {
'command' => "sendmsg",
'call-command' => "unicast",
'local_ip' => $_[0],
'local_port' => $_[1],
'remote_ip' => $_[2],
'remote_port' => $_[3],
'transport' => $_[4]
};
return $self->sendmsg($hash);
}
sub call_data($) { sub call_data($) {
my $self = shift; my $self = shift;
......
...@@ -42,6 +42,28 @@ ...@@ -42,6 +42,28 @@
#include <switch.h> #include <switch.h>
SWITCH_BEGIN_EXTERN_C SWITCH_BEGIN_EXTERN_C
struct switch_unicast_conninfo {
switch_core_session_t *session;
switch_codec_t read_codec;
switch_frame_t write_frame;
switch_byte_t write_frame_data[SWITCH_RECOMMENDED_BUFFER_SIZE];
switch_socket_t *socket;
char *local_ip;
uint32_t local_port;
char *remote_ip;
uint32_t remote_port;
switch_sockaddr_t *local_addr;
switch_sockaddr_t *remote_addr;
switch_mutex_t *flag_mutex;
int32_t flags;
int type;
int transport;
int stream_id;
};
typedef struct switch_unicast_conninfo switch_unicast_conninfo_t;
/** /**
* @defgroup switch_ivr IVR Library * @defgroup switch_ivr IVR Library
* @ingroup core1 * @ingroup core1
...@@ -49,6 +71,15 @@ SWITCH_BEGIN_EXTERN_C ...@@ -49,6 +71,15 @@ SWITCH_BEGIN_EXTERN_C
* building blocks for a higher level IVR interface. * building blocks for a higher level IVR interface.
* @{ * @{
*/ */
SWITCH_DECLARE(switch_status_t) switch_ivr_deactivate_unicast(switch_core_session_t *session);
SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session,
char *local_ip,
uint32_t local_port,
char *remote_ip,
uint32_t remote_port,
char *transport);
/*! /*!
\brief Generate an XML CDR report. \brief Generate an XML CDR report.
\param session the session to get the data from. \param session the session to get the data from.
......
...@@ -117,6 +117,13 @@ SWITCH_BEGIN_EXTERN_C ...@@ -117,6 +117,13 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_BITS_PER_BYTE 8 #define SWITCH_BITS_PER_BYTE 8
typedef uint8_t switch_byte_t; typedef uint8_t switch_byte_t;
typedef enum {
SUF_NONE = 0,
SUF_THREAD_RUNNING = (1 << 0),
SUF_READY = (1 << 1)
} switch_unicast_flag_t;
typedef enum { typedef enum {
SWITCH_FALSE = 0, SWITCH_FALSE = 0,
SWITCH_TRUE = 1 SWITCH_TRUE = 1
...@@ -531,6 +538,7 @@ CF_GEN_RINGBACK = (1 << 17) - Channel is generating it's own ringback ...@@ -531,6 +538,7 @@ CF_GEN_RINGBACK = (1 << 17) - Channel is generating it's own ringback
CF_RING_READY = (1 << 18) - Channel is ready to send ringback CF_RING_READY = (1 << 18) - Channel is ready to send ringback
CF_BREAK = (1 << 19) - Channel should stop what it's doing CF_BREAK = (1 << 19) - Channel should stop what it's doing
CF_BROADCAST = (1 << 20) - Channel is broadcasting CF_BROADCAST = (1 << 20) - Channel is broadcasting
CF_UNICAST = (1 << 21) - Channel has a unicast connection
</pre> </pre>
*/ */
...@@ -555,7 +563,8 @@ typedef enum { ...@@ -555,7 +563,8 @@ typedef enum {
CF_GEN_RINGBACK = (1 << 17), CF_GEN_RINGBACK = (1 << 17),
CF_RING_READY = (1 << 18), CF_RING_READY = (1 << 18),
CF_BREAK = (1 << 19), CF_BREAK = (1 << 19),
CF_BROADCAST = (1 << 20) CF_BROADCAST = (1 << 20),
CF_UNICAST = (1 << 21)
} switch_channel_flag_t; } switch_channel_flag_t;
......
...@@ -599,6 +599,8 @@ SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session) ...@@ -599,6 +599,8 @@ SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session)
switch_channel_dequeue_dtmf(channel, buf, sizeof(buf)); switch_channel_dequeue_dtmf(channel, buf, sizeof(buf));
} }
switch_ivr_deactivate_unicast(session);
switch_channel_clear_flag(channel, CF_BREAK); switch_channel_clear_flag(channel, CF_BREAK);
} }
...@@ -647,6 +649,8 @@ SWITCH_DECLARE(void) switch_core_session_destroy(switch_core_session_t **session ...@@ -647,6 +649,8 @@ SWITCH_DECLARE(void) switch_core_session_destroy(switch_core_session_t **session
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Close Channel %s\n", switch_channel_get_name((*session)->channel)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Close Channel %s\n", switch_channel_get_name((*session)->channel));
switch_ivr_deactivate_unicast(*session);
switch_scheduler_del_task_group((*session)->uuid_str); switch_scheduler_del_task_group((*session)->uuid_str);
switch_mutex_lock(runtime.session_table_mutex); switch_mutex_lock(runtime.session_table_mutex);
......
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论