mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 12:42:02 +00:00
add transfer capability and small ways to test it
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1290 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -1352,6 +1352,18 @@ DoxyDefine(apr_status_t switch_queue_trypop(switch_queue_t *queue, void **data);
|
||||
DoxyDefine(apr_status_t switch_queue_trypush(switch_queue_t *queue, void *data);)
|
||||
#define switch_queue_trypush apr_queue_trypush
|
||||
|
||||
|
||||
typedef apr_thread_rwlock_t switch_thread_rwlock_t;
|
||||
|
||||
#define switch_thread_rwlock_create apr_thread_rwlock_create
|
||||
#define switch_thread_rwlock_destroy apr_thread_rwlock_destroy
|
||||
#define switch_thread_rwlock_pool_get apr_thread_rwlock_pool_get
|
||||
#define switch_thread_rwlock_rdlock apr_thread_rwlock_rdlock
|
||||
#define switch_thread_rwlock_tryrdlock apr_thread_rwlock_tryrdlock
|
||||
#define switch_thread_rwlock_trywrlock apr_thread_rwlock_trywrlock
|
||||
#define switch_thread_rwlock_unlock apr_thread_rwlock_unlock
|
||||
#define switch_thread_rwlock_wrlock apr_thread_rwlock_wrlock
|
||||
|
||||
/**
|
||||
* @defgroup switch_thread_mutex Thread Mutex Routines
|
||||
* @ingroup switch_apr
|
||||
|
||||
@@ -87,6 +87,9 @@ struct switch_caller_profile {
|
||||
char *chan_name;
|
||||
/*! unique id */
|
||||
char *uuid;
|
||||
/*! context */
|
||||
char *context;
|
||||
struct switch_caller_profile *next;
|
||||
};
|
||||
|
||||
/*! \brief An Abstract Representation of a dialplan Application */
|
||||
@@ -162,6 +165,7 @@ SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_memory_
|
||||
char *ani2,
|
||||
char *rdnis,
|
||||
char *source,
|
||||
char *context,
|
||||
char *destination_number);
|
||||
|
||||
/*!
|
||||
|
||||
@@ -41,14 +41,20 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __FORMATBUG
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <switch.h>
|
||||
|
||||
typedef struct {
|
||||
struct switch_channel_timetable {
|
||||
switch_time_t created;
|
||||
switch_time_t answered;
|
||||
switch_time_t hungup;
|
||||
} switch_channel_timetable_t;
|
||||
struct switch_channel_timetable *next;
|
||||
};
|
||||
|
||||
typedef struct switch_channel_timetable switch_channel_timetable_t;
|
||||
|
||||
/**
|
||||
* @defgroup switch_channel Channel Functions
|
||||
|
||||
@@ -118,6 +118,28 @@ SWITCH_DECLARE(switch_status) switch_core_destroy(void);
|
||||
///\}
|
||||
|
||||
|
||||
///\defgroup sh Read/Write Locking
|
||||
///\ingroup core1
|
||||
///\{
|
||||
/*!
|
||||
\brief Acquire a read lock on the session
|
||||
\param session the session to acquire from
|
||||
\return success if it is safe to read from the session
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status) switch_core_session_read_lock(switch_core_session *session);
|
||||
|
||||
/*!
|
||||
\brief Acquire a write lock on the session
|
||||
\param session the session to acquire from
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_core_session_write_lock(switch_core_session *session);
|
||||
|
||||
/*!
|
||||
\brief Unlock a read or write lock on as given session
|
||||
\param session the session
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_core_session_rwunlock(switch_core_session *session);
|
||||
///\}
|
||||
|
||||
///\defgroup sh State Handlers
|
||||
///\ingroup core1
|
||||
@@ -277,6 +299,7 @@ SWITCH_DECLARE(char *) switch_core_session_get_uuid(switch_core_session *session
|
||||
\brief Locate a session based on it's uuiid
|
||||
\param uuid_str the unique id of the session you want to find
|
||||
\return the session or NULL
|
||||
\note if the session was located it will have a read lock obtained which will need to be released with switch_core_session_rwunlock()
|
||||
*/
|
||||
SWITCH_DECLARE(switch_core_session *) switch_core_session_locate(char *uuid_str);
|
||||
|
||||
|
||||
@@ -167,6 +167,16 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi
|
||||
void *session_data,
|
||||
void *peer_session_data);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Transfer an existing session to another location
|
||||
\param session the session to transfer
|
||||
\param extension the new extension
|
||||
\param dialplan the new dialplan (OPTIONAL, may be NULL)
|
||||
\param context the new context (OPTIONAL, may be NULL)
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status) switch_ivr_session_transfer(switch_core_session *session, char *extension, char *dialplan, char *context);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -60,6 +60,8 @@ struct switch_state_handler_table {
|
||||
switch_state_handler on_loopback;
|
||||
/*! executed when the state changes to transmit*/
|
||||
switch_state_handler on_transmit;
|
||||
/*! executed when the state changes to hold*/
|
||||
switch_state_handler on_hold;
|
||||
};
|
||||
|
||||
/*! \brief Node in which to store custom outgoing channel callback hooks */
|
||||
|
||||
@@ -297,6 +297,7 @@ CS_RING - Channel is looking for a dialplan
|
||||
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_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>
|
||||
@@ -308,6 +309,7 @@ typedef enum {
|
||||
CS_TRANSMIT,
|
||||
CS_EXECUTE,
|
||||
CS_LOOPBACK,
|
||||
CS_HOLD,
|
||||
CS_HANGUP,
|
||||
CS_DONE
|
||||
} switch_channel_state;
|
||||
@@ -325,6 +327,8 @@ CF_ORIGINATOR = (1 << 3) - Channel is an originator
|
||||
CF_TRANSFER = (1 << 4) - Channel is being transfered
|
||||
CF_ACCEPT_CNG = (1 << 5) - Channel will accept CNG frames
|
||||
CF_LOCK_THREAD = (1 << 6) - Prevent the channel thread from exiting while this flag is set
|
||||
CF_BRIDGED = (1 << 7) - Channel in a bridge
|
||||
CF_HOLD = (1 << 8) - Channel is on hold
|
||||
</pre>
|
||||
*/
|
||||
|
||||
@@ -335,7 +339,9 @@ typedef enum {
|
||||
CF_ORIGINATOR = (1 << 3),
|
||||
CF_TRANSFER = (1 << 4),
|
||||
CF_ACCEPT_CNG = (1 << 5),
|
||||
CF_LOCK_THREAD = (1 << 6)
|
||||
CF_LOCK_THREAD = (1 << 6),
|
||||
CF_BRIDGED = (1 << 7),
|
||||
CF_HOLD = (1 << 8)
|
||||
} switch_channel_flag;
|
||||
|
||||
|
||||
|
||||
@@ -180,6 +180,8 @@ SWITCH_DECLARE(char *) switch_cut_path(char *in);
|
||||
SWITCH_DECLARE(char *) switch_string_replace(const char *string, const char *search, const char *replace);
|
||||
SWITCH_DECLARE(switch_status) switch_string_match(const char *string, size_t string_len, const char *search, size_t search_len);
|
||||
|
||||
#define SWITCH_READ_ACCEPTABLE(status) status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user