Asterisk Ver0-1-0/Main2 Dial
main ¶* int main(int argc, char *argv[])
If the readfs , writefs , and errorfds arguments are all null pointers and the timeout argument is a null pointer, select() blocks until interrupted by a signal. model.txt Description of call model: Incoming Call: Channel backend waits for a RING or equivalent on some sort of interface. Typically this is done in its own thread. When a RING is detected, the backend should create a channel structure and then call ast_pbx_start() on that channel, which will create a thread to monitor that interface. At this point, the PBX and/or applications it launches will manage the interface, and it need not be monitored by the aforementioned thread. When the applications are finished, the requisite hangup function will be called, at which the channel can be considered to be no longer valid, and the thread that controls it will immenantly be terminated. * include/logger.h
struct ast_app { /* Name of the application */ char name[AST_MAX_APP]; int (*execute)(struct ast_channel *chan, void *data); struct ast_app *next; }; static struct ast_app *apps = NULL; static struct pbx_builtin { char name[AST_MAX_APP]; int (*execute)(struct ast_channel *chan, void *data); } builtins[] = { /* These applications are built into the PBX core and do not need separate modules */ { "Answer", pbx_builtin_answer }, { "Goto", pbx_builtin_goto }, { "Hangup", pbx_builtin_hangup }, { "DigitTimeout", pbx_builtin_dtimeout }, { "ResponseTimeout", pbx_builtin_rtimeout }, { "BackGround", pbx_builtin_background }, { "Wait", pbx_builtin_wait }, }; * int load_pbx(void)
struct module { int (*load_module)(void); int (*unload_module)(void); int (*usecount)(void); char *(*description)(void); void *lib; char resource[256]; struct module *next; }; static struct module *module_list=NULL;* int ast_load_resource(char *resource_name)
ast_load ¶* config.c
struct ast_variable { char *name; char *value; struct ast_variable *next; }; struct ast_category { char name[80]; struct ast_variable *root; struct ast_category *next; }; struct ast_config { /* Maybe this structure isn't necessary but we'll keep it for now */ struct ast_category *root; }; * struct ast_config *ast_load(char *configfile)
chan_ixj.c ¶Connected to the PhoneJack PCI card is a Nortel Venture phone. My phone.conf file has "mode=dialtone", "format=slinear", "echocancel=off", "txgain=100%", "rxgain=1.0", and "device => /dev/phone0" * load_module()
ast_channel_register ¶struct ast_channel { char name[AST_CHANNEL_NAME]; /* ASCII Description of channel name */ pthread_t blocker; /* If anyone is blocking, this is them */ char *blockproc; /* Procedure causing blocking */ int blocking; /* Whether or not we're blocking */ struct sched_context *sched; /* Schedule context */ int streamid; /* For streaming playback, the schedule ID */ struct ast_filestream *stream; /* Stream itself. */ struct ast_channel *trans; /* Translator if present */ struct ast_channel *master; /* Master channel, if this is a translator */ int fd; /* File descriptor for channel -- all must have a file descriptor! */ char *type; /* Type of channel */ int state; /* State of line */ int rings; /* Number of rings so far */ int stack; /* Current level of application */ int format; /* Kinds of data this channel can natively handle */ char *dnid; /* Malloc'd Dialed Number Identifier */ char *callerid; /* Malloc'd Caller ID */ char context[AST_MAX_EXTENSION]; /* Current extension context */ char exten[AST_MAX_EXTENSION]; /* Current extension number */ int priority; /* Current extension priority */ void *app[AST_CHANNEL_MAX_STACK]; /* Application information -- see assigned numbers */ struct ast_channel_pvt *pvt; /* Private channel implementation details */ jmp_buf jmp[AST_CHANNEL_MAX_STACK]; /* Jump buffer used for returning from applications */ struct ast_pbx *pbx; struct ast_channel *next; /* For easy linking */ }; struct chanlist { char type[80]; char description[80]; int capabilities; struct ast_channel * (*requester)(char *type, int format, void *data); struct chanlist *next; } *backends = NULL; * int ast_channel_register(char *type, char *description, int capabilities, struct ast_channel *(*requester)(char *type, int format, void *data))
* static int dial_exec(struct ast_channel *chan, void *data)
restart_monitor ¶
read, write, exception, time ¼º°ø½Ã, select´Â ÆÄÀÏÁöÁ¤ÀÚÁýÇÕ¿¡ Ç¥ÇÔµÈ ¼ýÀÚ¸¦ ¹ÝȯÇϸç, ¸®ÅÏÇϱâÀü¿¡ ŸÀӾƿôÀÌ ¹ß»ýÇϸé 0À» ¹ÝȯÇÑ´Ù. ÀÌ·¯½Ã -1ÀÌ ¹ÝȯµÇ¸ç, errno´Â Àû´çÇÑ °ªÀ¸·Î ¼³Á¤µÈ´Ù. * static void ixj_mini_packet(struct ixj_pvt *i)
ixj_check_exception ¶typedef struct { unsigned int dtmf_ready:1; unsigned int hookstate:1; unsigned int pstn_ring:1; unsigned int caller_id:1; unsigned int pstn_wink:1; unsigned int f0:1; unsigned int f1:1; unsigned int f2:1; unsigned int f3:1; unsigned int reserved:23; }IXJ_EXCEPT; typedef union { IXJ_EXCEPT bits; unsigned int bytes; }IXJ_EXCEPTION; The dtmf_ready bit indicates if there is data waiting in the DTMF buffer. The hookstate bit is set if there is a change in hookstate status, it does not indicate the current state of the hookswitch. The pstn_ring bit indicates that the DAA on a LineJACK card has detected ring voltage on the PSTN port. The caller_id bit indicates that caller_id data has been received and is available. The pstn_wink bit indicates that the DAA on the LineJACK has received a wink from the telco switch * static void ixj_check_exception(struct ixj_pvt *i)
#define HELPER_EXISTS 0 #define HELPER_SPAWN 1 #define HELPER_EXEC 2* int ast_exists_extension(struct ast_channel *c, char *context, char *exten, int priority)
ast_pbx_start ¶* int ast_pbx_start(struct ast_channel *c)
|