mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Add a non-invasive API for application level manipulation of T38 on a channel. This uses control frames (so they can even pass across IAX2) to negotiate T38 and provided a way of getting the current status of T38 using queryoption. This should by no means cause any issues and if it does I will take responsibility for it.
(closes issue #11873) Reported by: dimas Patches: v4-t38-api.patch uploaded by dimas (license 88) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103799 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -389,6 +389,17 @@ enum ast_channel_state {
|
||||
AST_STATE_MUTE = (1 << 16), /*!< Do not transmit voice data */
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Possible T38 states on channels
|
||||
*/
|
||||
enum ast_t38_state {
|
||||
T38_STATE_UNAVAILABLE, /*!< T38 is unavailable on this channel or disabled by configuration */
|
||||
T38_STATE_UNKNOWN, /*!< The channel supports T38 but the current status is unknown */
|
||||
T38_STATE_NEGOTIATING, /*!< T38 is being negotiated */
|
||||
T38_STATE_REJECTED, /*!< Remote side has rejected our offer */
|
||||
T38_STATE_NEGOTIATED, /*!< T38 established */
|
||||
};
|
||||
|
||||
/*! \brief Main Channel structure associated with a channel.
|
||||
* This is the side of it mostly used by the pbx and call management.
|
||||
*
|
||||
@@ -1300,10 +1311,10 @@ int ast_best_codec(int fmts);
|
||||
|
||||
/*! Checks the value of an option */
|
||||
/*!
|
||||
* Query the value of an option, optionally blocking until a reply is received
|
||||
* Query the value of an option
|
||||
* Works similarly to setoption except only reads the options.
|
||||
*/
|
||||
struct ast_frame *ast_channel_queryoption(struct ast_channel *channel, int option, void *data, int *datalen, int block);
|
||||
int ast_channel_queryoption(struct ast_channel *channel, int option, void *data, int *datalen, int block);
|
||||
|
||||
/*! Checks for HTML support on a channel */
|
||||
/*! Returns 0 if channel does not support HTML or non-zero if it does */
|
||||
@@ -1557,6 +1568,18 @@ static inline int ast_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds,
|
||||
#endif
|
||||
}
|
||||
|
||||
/*! \brief Retrieves the current T38 state of a channel */
|
||||
static inline enum ast_t38_state ast_channel_get_t38_state(struct ast_channel *chan)
|
||||
{
|
||||
enum ast_t38_state state = T38_STATE_UNAVAILABLE;
|
||||
int datalen = sizeof(state);
|
||||
|
||||
ast_channel_queryoption(chan, AST_OPTION_T38_STATE, &state, &datalen, 0);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DO_CRASH
|
||||
#define CRASH do { fprintf(stderr, "!! Forcing immediate crash a-la abort !!\n"); *((int *)0) = 0; } while(0)
|
||||
#else
|
||||
|
@@ -292,6 +292,15 @@ enum ast_control_frame_type {
|
||||
AST_CONTROL_HOLD = 16, /*!< Indicate call is placed on hold */
|
||||
AST_CONTROL_UNHOLD = 17, /*!< Indicate call is left from hold */
|
||||
AST_CONTROL_VIDUPDATE = 18, /*!< Indicate video frame update */
|
||||
AST_CONTROL_T38 = 19 /*!< T38 state change request/notification */
|
||||
};
|
||||
|
||||
enum ast_control_t38 {
|
||||
AST_T38_REQUEST_NEGOTIATE = 1, /*!< Request T38 on a channel (voice to fax) */
|
||||
AST_T38_REQUEST_TERMINATE, /*!< Terminate T38 on a channel (fax to voice) */
|
||||
AST_T38_NEGOTIATED, /*!< T38 negotiated (fax mode) */
|
||||
AST_T38_TERMINATED, /*!< T38 terminated (back to voice) */
|
||||
AST_T38_REFUSED /*!< T38 refused for some reason (usually rejected by remote end) */
|
||||
};
|
||||
|
||||
#define AST_SMOOTHER_FLAG_G729 (1 << 0)
|
||||
@@ -340,6 +349,12 @@ enum ast_control_frame_type {
|
||||
/*! Explicitly enable or disable echo cancelation for the given channel */
|
||||
#define AST_OPTION_ECHOCAN 8
|
||||
|
||||
/* !
|
||||
* Read-only. Allows query current status of T38 on the channel.
|
||||
* data: ast_t38state
|
||||
*/
|
||||
#define AST_OPTION_T38_STATE 10
|
||||
|
||||
struct oprmode {
|
||||
struct ast_channel *peer;
|
||||
int mode;
|
||||
|
Reference in New Issue
Block a user