use an enum for control frame types

support sending control frames with payload


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26093 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Kevin P. Fleming 20 years ago
parent c22eb692a1
commit 16f1acc37f

@ -738,10 +738,25 @@ int ast_queue_hangup(struct ast_channel *chan)
} }
/*! \brief Queue a control frame */ /*! \brief Queue a control frame */
int ast_queue_control(struct ast_channel *chan, int control) int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control)
{ {
struct ast_frame f = { AST_FRAME_CONTROL, }; struct ast_frame f = { AST_FRAME_CONTROL, };
f.subclass = control;
return ast_queue_frame(chan, &f);
}
/*! \brief Queue a control frame with payload */
int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control,
const void *data, size_t datalen)
{
struct ast_frame f = { AST_FRAME_CONTROL, };
f.subclass = control; f.subclass = control;
f.data = (void *) data;
f.datalen = datalen;
return ast_queue_frame(chan, &f); return ast_queue_frame(chan, &f);
} }

@ -605,9 +605,28 @@ int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f);
/*! \brief Queue a hangup frame */ /*! \brief Queue a hangup frame */
int ast_queue_hangup(struct ast_channel *chan); int ast_queue_hangup(struct ast_channel *chan);
/*! \brief Queue a control frame */ /*!
int ast_queue_control(struct ast_channel *chan, int control); \brief Queue a control frame with payload
\param chan channel to queue frame onto
\param control type of control frame
\return zero on success, non-zero on failure
*/
int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type control);
/*!
\brief Queue a control frame with payload
\param chan channel to queue frame onto
\param control type of control frame
\param data pointer to payload data to be included in frame
\param datalen number of bytes of payload data
\return zero on success, non-zero on failure
The supplied payload data is copied into the frame, so the caller's copy
is not modified nor freed, and the resulting frame will retain a copy of
the data even if the caller frees their local copy.
*/
int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control,
const void *data, size_t datalen);
/*! \brief Change channel name */ /*! \brief Change channel name */
void ast_change_name(struct ast_channel *chan, char *newname); void ast_change_name(struct ast_channel *chan, char *newname);

@ -240,43 +240,26 @@ extern struct ast_frame ast_null_frame;
#define AST_FORMAT_MAX_VIDEO (1 << 24) #define AST_FORMAT_MAX_VIDEO (1 << 24)
#define AST_FORMAT_VIDEO_MASK (((1 << 25)-1) & ~(AST_FORMAT_AUDIO_MASK)) #define AST_FORMAT_VIDEO_MASK (((1 << 25)-1) & ~(AST_FORMAT_AUDIO_MASK))
/* Control frame types */ enum ast_control_frame_type {
/*! Other end has hungup */ AST_CONTROL_HANGUP = 1, /*! Other end has hungup */
#define AST_CONTROL_HANGUP 1 AST_CONTROL_RING = 2, /*! Local ring */
/*! Local ring */ AST_CONTROL_RINGING = 3, /*! Remote end is ringing */
#define AST_CONTROL_RING 2 AST_CONTROL_ANSWER = 4, /*! Remote end has answered */
/*! Remote end is ringing */ AST_CONTROL_BUSY = 5, /*! Remote end is busy */
#define AST_CONTROL_RINGING 3 AST_CONTROL_TAKEOFFHOOK = 6, /*! Make it go off hook */
/*! Remote end has answered */ AST_CONTROL_OFFHOOK = 7, /*! Line is off hook */
#define AST_CONTROL_ANSWER 4 AST_CONTROL_CONGESTION = 8, /*! Congestion (circuits busy) */
/*! Remote end is busy */ AST_CONTROL_FLASH = 9, /*! Flash hook */
#define AST_CONTROL_BUSY 5 AST_CONTROL_WINK = 10, /*! Wink */
/*! Make it go off hook */ AST_CONTROL_OPTION = 11, /*! Set a low-level option */
#define AST_CONTROL_TAKEOFFHOOK 6 AST_CONTROL_RADIO_KEY = 12, /*! Key Radio */
/*! Line is off hook */ AST_CONTROL_RADIO_UNKEY = 13, /*! Un-Key Radio */
#define AST_CONTROL_OFFHOOK 7 AST_CONTROL_PROGRESS = 14, /*! Indicate PROGRESS */
/*! Congestion (circuits busy) */ AST_CONTROL_PROCEEDING = 15, /*! Indicate CALL PROCEEDING */
#define AST_CONTROL_CONGESTION 8 AST_CONTROL_HOLD = 16, /*! Indicate call is placed on hold */
/*! Flash hook */ AST_CONTROL_UNHOLD = 17, /*! Indicate call is left from hold */
#define AST_CONTROL_FLASH 9 AST_CONTROL_VIDUPDATE = 18, /*! Indicate video frame update */
/*! Wink */ };
#define AST_CONTROL_WINK 10
/*! Set a low-level option */
#define AST_CONTROL_OPTION 11
/*! Key Radio */
#define AST_CONTROL_RADIO_KEY 12
/*! Un-Key Radio */
#define AST_CONTROL_RADIO_UNKEY 13
/*! Indicate PROGRESS */
#define AST_CONTROL_PROGRESS 14
/*! Indicate CALL PROCEEDING */
#define AST_CONTROL_PROCEEDING 15
/*! Indicate call is placed on hold */
#define AST_CONTROL_HOLD 16
/*! Indicate call is left from hold */
#define AST_CONTROL_UNHOLD 17
/*! Indicate video frame update */
#define AST_CONTROL_VIDUPDATE 18
#define AST_SMOOTHER_FLAG_G729 (1 << 0) #define AST_SMOOTHER_FLAG_G729 (1 << 0)

Loading…
Cancel
Save