📄 frame.h
字号:
/* * Asterisk -- An open source telephony toolkit. * * Copyright (C) 1999 - 2005, Digium, Inc. * * Mark Spencer <markster@digium.com> * * See http://www.asterisk.org for more information about * the Asterisk project. Please do not directly contact * any of the maintainers of this project for assistance; * the project provides a web site, mailing lists and IRC * channels for your use. * * This program is free software, distributed under the terms of * the GNU General Public License Version 2. See the LICENSE file * at the top of the source tree. *//*! \file * \brief Asterisk internal frame definitions. * \arg For an explanation of frames, see \ref Def_Frame * \arg Frames are send of Asterisk channels, see \ref Def_Channel */#ifndef _ASTERISK_FRAME_H#define _ASTERISK_FRAME_H#if defined(__cplusplus) || defined(c_plusplus)extern "C" {#endif#include <sys/types.h>#include <sys/time.h>#include "asterisk/endian.h"struct ast_codec_pref { char order[32];};/*! \page Def_Frame AST Multimedia and signalling frames \section Def_AstFrame What is an ast_frame ? A frame of data read used to communicate between between channels and applications. Frames are divided into frame types and subclasses. \par Frame types \arg \b VOICE: Voice data, subclass is codec (AST_FORMAT_*) \arg \b VIDEO: Video data, subclass is codec (AST_FORMAT_*) \arg \b DTMF: A DTMF digit, subclass is the digit \arg \b IMAGE: Image transport, mostly used in IAX \arg \b TEXT: Text messages \arg \b HTML: URL's and web pages \arg \b T38: T38 Fax transport frames \arg \b IAX: Private frame type for the IAX protocol \arg \b CNG: Comfort noice frames \arg \b CONTROL: A control frame, subclass defined as AST_CONTROL_ \arg \b NULL: Empty, useless frame \par Files \arg frame.h Definitions \arg frame.c Function library \arg \ref Def_Channel Asterisk channels \section Def_ControlFrame Control Frames Control frames send signalling information between channels and devices. They are prefixed with AST_CONTROL_, like AST_CONTROL_FRAME_HANGUP \arg \b HANGUP The other end has hungup \arg \b RING Local ring \arg \b RINGING The other end is ringing \arg \b ANSWER The other end has answered \arg \b BUSY Remote end is busy \arg \b TAKEOFFHOOK Make it go off hook (what's "it" ? ) \arg \b OFFHOOK Line is off hook \arg \b CONGESTION Congestion (circuit is busy, not available) \arg \b FLASH Other end sends flash hook \arg \b WINK Other end sends wink \arg \b OPTION Send low-level option \arg \b RADIO_KEY Key radio (see app_rpt.c) \arg \b RADIO_UNKEY Un-key radio (see app_rpt.c) \arg \b PROGRESS Other end indicates call progress \arg \b PROCEEDING Indicates proceeding \arg \b HOLD Call is placed on hold \arg \b UNHOLD Call is back from hold \arg \b VIDUPDATE Video update requested*//*! \brief Data structure associated with a single frame of data */struct ast_frame { /*! Kind of frame */ int frametype; /*! Subclass, frame dependent */ int subclass; /*! Length of data */ int datalen; /*! Number of 8khz samples in this frame */ int samples; /*! Was the data malloc'd? i.e. should we free it when we discard the frame? */ int mallocd; /*! How many bytes exist _before_ "data" that can be used if needed */ int offset; /*! Optional source of frame for debugging */ const char *src; /*! Pointer to actual data */ void *data; /*! Global delivery time */ struct timeval delivery; /*! Next/Prev for linking stand alone frames */ struct ast_frame *prev; /*! Next/Prev for linking stand alone frames */ struct ast_frame *next; };#define AST_FRIENDLY_OFFSET 64 /*! It's polite for a a new frame to have this number of bytes for additional headers. */#define AST_MIN_OFFSET 32 /*! Make sure we keep at least this much handy *//*! Need the header be free'd? */#define AST_MALLOCD_HDR (1 << 0)/*! Need the data be free'd? */#define AST_MALLOCD_DATA (1 << 1)/*! Need the source be free'd? (haha!) */#define AST_MALLOCD_SRC (1 << 2)/* Frame types *//*! A DTMF digit, subclass is the digit */#define AST_FRAME_DTMF 1/*! Voice data, subclass is AST_FORMAT_* */#define AST_FRAME_VOICE 2/*! Video frame, maybe?? :) */#define AST_FRAME_VIDEO 3/*! A control frame, subclass is AST_CONTROL_* */#define AST_FRAME_CONTROL 4/*! An empty, useless frame */#define AST_FRAME_NULL 5/*! Inter Asterisk Exchange private frame type */#define AST_FRAME_IAX 6/*! Text messages */#define AST_FRAME_TEXT 7/*! Image Frames */#define AST_FRAME_IMAGE 8/*! HTML Frame */#define AST_FRAME_HTML 9/*! Comfort Noise frame (subclass is level of CNG in -dBov), body may include zero or more 8-bit quantization coefficients */#define AST_FRAME_CNG 10/*! T.38 Fax-over-IP data stream */#define AST_FRAME_T38 11/* HTML subclasses *//*! Sending a URL */#define AST_HTML_URL 1/*! Data frame */#define AST_HTML_DATA 2/*! Beginning frame */#define AST_HTML_BEGIN 4/*! End frame */#define AST_HTML_END 8/*! Load is complete */#define AST_HTML_LDCOMPLETE 16/*! Peer is unable to support HTML */#define AST_HTML_NOSUPPORT 17/*! Send URL, and track */#define AST_HTML_LINKURL 18/*! No more HTML linkage */#define AST_HTML_UNLINK 19/*! Reject link request */#define AST_HTML_LINKREJECT 20/* Data formats for capabilities and frames alike *//*! G.723.1 compression */#define AST_FORMAT_G723_1 (1 << 0)/*! GSM compression */#define AST_FORMAT_GSM (1 << 1)/*! Raw mu-law data (G.711) */#define AST_FORMAT_ULAW (1 << 2)/*! Raw A-law data (G.711) */#define AST_FORMAT_ALAW (1 << 3)/*! ADPCM (G.726, 32kbps) */#define AST_FORMAT_G726 (1 << 4)/*! ADPCM (IMA) */#define AST_FORMAT_ADPCM (1 << 5)/*! Raw 16-bit Signed Linear (8000 Hz) PCM */#define AST_FORMAT_SLINEAR (1 << 6)/*! LPC10, 180 samples/frame */#define AST_FORMAT_LPC10 (1 << 7)/*! G.729A audio */#define AST_FORMAT_G729A (1 << 8)/*! SpeeX Free Compression */#define AST_FORMAT_SPEEX (1 << 9)/*! iLBC Free Compression */#define AST_FORMAT_ILBC (1 << 10)/*! Maximum audio format */#define AST_FORMAT_MAX_AUDIO (1 << 15)/*! JPEG Images */#define AST_FORMAT_JPEG (1 << 16)/*! PNG Images */#define AST_FORMAT_PNG (1 << 17)/*! H.261 Video */#define AST_FORMAT_H261 (1 << 18)/*! H.263 Video */#define AST_FORMAT_H263 (1 << 19)/*! H.263+ Video */#define AST_FORMAT_H263_PLUS (1 << 20)/*! Maximum video format */#define AST_FORMAT_MAX_VIDEO (1 << 24)/* Control frame types *//*! Other end has hungup */#define AST_CONTROL_HANGUP 1/*! Local ring */#define AST_CONTROL_RING 2/*! Remote end is ringing */#define AST_CONTROL_RINGING 3/*! Remote end has answered */#define AST_CONTROL_ANSWER 4/*! Remote end is busy */#define AST_CONTROL_BUSY 5/*! Make it go off hook */#define AST_CONTROL_TAKEOFFHOOK 6/*! Line is off hook */#define AST_CONTROL_OFFHOOK 7/*! Congestion (circuits busy) */#define AST_CONTROL_CONGESTION 8/*! Flash hook */#define AST_CONTROL_FLASH 9/*! 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -