mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 20:51:58 +00:00
Media Management (Sponsored By Front Logic)
This modification makes it possible to change the media path of session in the switch on-the-fly and from the dialplan. It adds some API interface calls usable from a remote client such as mod_event_socket or the test console. 1) media [off] <uuid> Turns on/off the media on the call described by <uuid> The media will be redirected as desiered either into the switch or point to point. 2) hold [off] <uuid> Turns on/off endpoint specific hold state on the session described by <uuid> 3) broadcast <uuid> "<path>[ <timer_name>]" or "speak:<tts_engine>|<tts_voice>|<text>[|<timer_name>]" [both] A message will be sent to the call described by uuid instructing it to play the file or speak the text indicated. If the 'both' option is specified both ends of the call will hear the message otherwise just the uuid specified will hear the message. During playback when only one side is hearing the message the other end will hear silence. If media is not flowing across the switch when the message is broadcasted, the media will be directed to the switch for the duration of the call and then returned to it's previous state. Also the no_media=true option in the dialplan before a bridge makes it possible to place a call while proxying the session description from one endpoint to the other and establishing an immidiate point-to-point media connection with no media on the switch. <action application="set" data="no_media=true"/> <action application="bridge" data="sofia/mydomain.com/myid@myhost.com"/> *NOTE* when connecting two outbound legs by using the "originate" api command with an extension that has no_media=true enabled, the media for the first leg will be engaged with the switch until the second leg has answered and the other session description is available to establish a point to point connection at which time point-to-point mode will be enabled. *NOTE* it is reccommended you rebuild FreeSWITCH with "make sure" as there have been some changes to the core. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3245 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -274,7 +274,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, char *extension, char *dialplan, char *context);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Bridge two existing sessions
|
||||
\param originator_uuid the uuid of the originator
|
||||
@@ -283,6 +282,59 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(char *originator_uuid, char *originatee_uuid);
|
||||
|
||||
/*!
|
||||
\brief Signal a session to request direct media access to it's remote end
|
||||
\param uuid the uuid of the session to request
|
||||
\param flags flags to influence behaviour (SMF_REBRIDGE to rebridge the call in media mode)
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_media(char *uuid, switch_media_flag_t flags);
|
||||
|
||||
/*!
|
||||
\brief Signal a session to request indirect media allowing it to exchange media directly with another device
|
||||
\param uuid the uuid of the session to request
|
||||
\param flags flags to influence behaviour (SMF_REBRIDGE to rebridge the call in no_media mode)
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(char *uuid, switch_media_flag_t flags);
|
||||
|
||||
/*!
|
||||
\brief Signal the session with a protocol specific hold message.
|
||||
\param uuid the uuid of the session to hold
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_hold_uuid(char *uuid);
|
||||
|
||||
/*!
|
||||
\brief Signal the session with a protocol specific unhold message.
|
||||
\param uuid the uuid of the session to hold
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_unhold_uuid(char *uuid);
|
||||
|
||||
/*!
|
||||
\brief Signal the session with a protocol specific hold message.
|
||||
\param session the session to hold
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session);
|
||||
|
||||
/*!
|
||||
\brief Signal the session with a protocol specific unhold message.
|
||||
\param uuid the uuid of the session to unhold
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_unhold(switch_core_session_t *session);
|
||||
|
||||
/*!
|
||||
\brief Signal the session to broadcast audio
|
||||
\param uuid the uuid of the session to broadcast on
|
||||
\param path the path data of the broadcast "/path/to/file.wav [<timer name>]" or "speak:<engine>|<voice>|<Text to say>"
|
||||
\param flags flags to send to the request (SMF_ECHO_BRIDGED to send the broadcast to both sides of the call)
|
||||
\return SWITCH_STATUS_SUCCESS if all is well
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(char *uuid, char *path, switch_media_flag_t flags);
|
||||
|
||||
/*!
|
||||
\brief Transfer variables from one session to another
|
||||
\param sessa the original session
|
||||
|
||||
@@ -60,6 +60,8 @@ struct switch_state_handler_table {
|
||||
switch_state_handler_t on_transmit;
|
||||
/*! executed when the state changes to hold*/
|
||||
switch_state_handler_t on_hold;
|
||||
/*! executed when the state changes to hibernate*/
|
||||
switch_state_handler_t on_hibernate;
|
||||
};
|
||||
|
||||
struct switch_stream_handle {
|
||||
|
||||
@@ -74,12 +74,25 @@ SWITCH_BEGIN_EXTERN_C
|
||||
|
||||
#define SWITCH_R_SDP_VARIABLE "_switch_r_sdp_"
|
||||
#define SWITCH_L_SDP_VARIABLE "_switch_l_sdp_"
|
||||
#define SWITCH_BRIDGE_VARIABLE "BRIDGETO"
|
||||
#define SWITCH_SIGNAL_BRIDGE_VARIABLE "SIGNAL_BRIDGETO"
|
||||
#define SWITCH_B_SDP_VARIABLE "_switch_m_sdp_"
|
||||
#define SWITCH_BRIDGE_VARIABLE "_bridge_to_"
|
||||
#define SWITCH_SIGNAL_BRIDGE_VARIABLE "_signal_bridge_to_"
|
||||
#define SWITCH_ORIGINATOR_VARIABLE "_originator_"
|
||||
#define SWITCH_LOCAL_MEDIA_IP_VARIABLE "_local_media_ip_"
|
||||
#define SWITCH_LOCAL_MEDIA_PORT_VARIABLE "_local_media_port_"
|
||||
#define SWITCH_REMOTE_MEDIA_IP_VARIABLE "_remote_media_ip_"
|
||||
#define SWITCH_REMOTE_MEDIA_PORT_VARIABLE "_remote_media_port_"
|
||||
|
||||
|
||||
#define SWITCH_BITS_PER_BYTE 8
|
||||
typedef uint8_t switch_byte_t;
|
||||
|
||||
typedef enum {
|
||||
SMF_NONE = 0,
|
||||
SMF_REBRIDGE = (1 << 0),
|
||||
SMF_ECHO_BRIDGED = (1 << 1)
|
||||
} switch_media_flag_t;
|
||||
|
||||
typedef enum {
|
||||
SWITCH_BITPACK_MODE_RFC3551,
|
||||
SWITCH_BITPACK_MODE_AAL2
|
||||
@@ -246,6 +259,10 @@ typedef enum {
|
||||
SWITCH_MESSAGE_INDICATE_BRIDGE - indicate a bridge starting
|
||||
SWITCH_MESSAGE_INDICATE_UNBRIDGE - indicate a bridge ending
|
||||
SWITCH_MESSAGE_INDICATE_TRANSFER - indicate a transfer is taking place
|
||||
SWITCH_MESSAGE_INDICATE_MEDIA - indicate media is required
|
||||
SWITCH_MESSAGE_INDICATE_NOMEDIA - indicate no-media is required
|
||||
SWITCH_MESSAGE_INDICATE_HOLD - indicate hold
|
||||
SWITCH_MESSAGE_INDICATE_UNHOLD - indicate unhold
|
||||
</pre>
|
||||
*/
|
||||
typedef enum {
|
||||
@@ -255,7 +272,11 @@ typedef enum {
|
||||
SWITCH_MESSAGE_INDICATE_BRIDGE,
|
||||
SWITCH_MESSAGE_INDICATE_UNBRIDGE,
|
||||
SWITCH_MESSAGE_INDICATE_TRANSFER,
|
||||
SWITCH_MESSAGE_INDICATE_RINGING
|
||||
SWITCH_MESSAGE_INDICATE_RINGING,
|
||||
SWITCH_MESSAGE_INDICATE_MEDIA,
|
||||
SWITCH_MESSAGE_INDICATE_NOMEDIA,
|
||||
SWITCH_MESSAGE_INDICATE_HOLD,
|
||||
SWITCH_MESSAGE_INDICATE_UNHOLD,
|
||||
} switch_core_session_message_types_t;
|
||||
|
||||
|
||||
@@ -376,6 +397,7 @@ CS_TRANSMIT - Channel is in a passive transmit state
|
||||
CS_EXECUTE - Channel is executing it's dialplan
|
||||
CS_LOOPBACK - Channel is in loopback
|
||||
CS_HOLD - Channel is on hold
|
||||
CS_HIBERNATE - Channel is in a sleep state
|
||||
CS_HANGUP - Channel is flagged for hangup and ready to end
|
||||
CS_DONE - Channel is ready to be destroyed and out of the state machine
|
||||
</pre>
|
||||
@@ -388,6 +410,7 @@ typedef enum {
|
||||
CS_EXECUTE,
|
||||
CS_LOOPBACK,
|
||||
CS_HOLD,
|
||||
CS_HIBERNATE,
|
||||
CS_HANGUP,
|
||||
CS_DONE
|
||||
} switch_channel_state_t;
|
||||
@@ -412,6 +435,8 @@ CF_TAGGED = (1 << 10) - Channel is tagged
|
||||
CF_WINNER = (1 << 11) - Channel is the winner
|
||||
CF_CONTROLLED = (1 << 12) - Channel is under control
|
||||
CF_NOMEDIA = (1 << 13) - Channel has no media
|
||||
CF_SUSPEND = (1 << 14) - Suspend i/o
|
||||
CF_EVENT_PARSE = (1 << 15) - Suspend control events
|
||||
</pre>
|
||||
*/
|
||||
|
||||
@@ -429,7 +454,9 @@ typedef enum {
|
||||
CF_TAGGED = (1 << 10),
|
||||
CF_WINNER = (1 << 11),
|
||||
CF_CONTROLLED = (1 << 12),
|
||||
CF_NOMEDIA = (1 << 13)
|
||||
CF_NOMEDIA = (1 << 13),
|
||||
CF_SUSPEND = (1 << 14),
|
||||
CF_EVENT_PARSE = (1 << 15)
|
||||
} switch_channel_flag_t;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user