?? libpri.h
字號(hào):
typedef struct pri_event_restart { int e; int channel;} pri_event_restart;typedef struct pri_event_ringing { int e; int channel; int cref; q931_call *call;} pri_event_ringing;typedef struct pri_event_answer { int e; int channel; int cref; q931_call *call;} pri_event_answer;typedef struct pri_event_facname { int e; char callingname[256]; char callingnum[256]; int channel; int cref; q931_call *call;} pri_event_facname;typedef struct pri_event_ring { int e; int channel; /* Channel requested */ int callingpres; /* Presentation of Calling CallerID */ int callingplan; /* Dialing plan of Calling entity */ char callingnum[256]; /* Calling number */ char callingname[256]; /* Calling name (if provided) */ int calledplan; /* Dialing plan of Called number */ int ani2; /* ANI II */ char callednum[256]; /* Called number */ char redirectingnum[256]; /* Redirecting number */ char useruserinfo[256]; /* User->User info */ int flexible; /* Are we flexible with our channel selection? */ int cref; /* Call Reference Number */ int ctype; /* Call type (see PRI_TRANS_CAP_* */ int layer1; /* User layer 1 */ int complete; /* Have we seen "Complete" i.e. no more number? */ q931_call *call; /* Opaque call pointer */ char callingsubaddr[256]; /* Calling parties subaddress */} pri_event_ring;typedef struct pri_event_hangup { int e; int channel; /* Channel requested */ int cause; int cref; q931_call *call; /* Opaque call pointer */} pri_event_hangup; typedef struct pri_event_restart_ack { int e; int channel;} pri_event_restart_ack;typedef struct pri_event_proceeding { int e; int channel;} pri_event_proceeding; typedef struct pri_event_setup_ack { int e; int channel;} pri_event_setup_ack;typedef struct pri_event_notify { int e; int channel; int info;} pri_event_notify;typedef union { int e; pri_event_generic gen; /* Generic view */ pri_event_restart restart; /* Restart view */ pri_event_error err; /* Error view */ pri_event_facname facname; /* Caller*ID Name on Facility */ pri_event_ring ring; /* Ring */ pri_event_hangup hangup; /* Hang up */ pri_event_ringing ringing; /* Ringing */ pri_event_ringing answer; /* Answer */ pri_event_restart_ack restartack; /* Restart Acknowledge */ pri_event_proceeding proceeding; /* Call proceeding & Progress */ pri_event_setup_ack setup_ack; /* SETUP_ACKNOWLEDGE structure */ pri_event_notify notify; /* Notification */} pri_event;struct pri;struct pri_sr;/* Create a D-channel on a given file descriptor. The file descriptor must be a channel operating in HDLC mode with FCS computed by the fd's driver. Also it must be NON-BLOCKING! Frames received on the fd should include FCS. Nodetype must be one of PRI_NETWORK or PRI_CPE. switchtype should be PRI_SWITCH_* */extern struct pri *pri_new(int fd, int nodetype, int switchtype);/* Set Network Specific Facility for PRI */extern void pri_set_nsf(struct pri *pri, int nsf);/* Set debug parameters on PRI -- see above debug definitions */extern void pri_set_debug(struct pri *pri, int debug);/* Run PRI on the given D-channel, taking care of any events that need to be handled. If block is set, it will block until an event occurs which needs to be handled */extern pri_event *pri_dchannel_run(struct pri *pri, int block);/* Check for an outstanding event on the PRI */pri_event *pri_check_event(struct pri *pri);/* Give a name to a given event ID */extern char *pri_event2str(int id);/* Give a name toa node type */extern char *pri_node2str(int id);/* Give a name to a switch type */extern char *pri_switch2str(int id);/* Print an event */extern void pri_dump_event(struct pri *pri, pri_event *e);/* Turn an event ID into a string */extern char *pri_event2str(int e);/* Turn presentation into a string */extern char *pri_pres2str(int pres);/* Turn numbering plan into a string */extern char *pri_plan2str(int plan);/* Turn cause into a string */extern char *pri_cause2str(int cause);/* Acknowledge a call and place it on the given channel. Set info to non-zero if there is in-band data available on the channel */extern int pri_acknowledge(struct pri *pri, q931_call *call, int channel, int info);/* Send a digit in overlap mode */extern int pri_information(struct pri *pri, q931_call *call, char digit);/* Answer the incomplete(call without called number) call on the given channel. Set non-isdn to non-zero if you are not connecting to ISDN equipment */extern int pri_need_more_info(struct pri *pri, q931_call *call, int channel, int nonisdn);/* Answer the call on the given channel (ignored if you called acknowledge already). Set non-isdn to non-zero if you are not connecting to ISDN equipment */extern int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn);/* Set CRV reference for GR-303 calls */#undef pri_release#undef pri_disconnect/* backwards compatibility for those who don't use asterisk with libpri */#define pri_release(a,b,c) \ pri_hangup(a,b,c)#define pri_disconnect(a,b,c) \ pri_hangup(a,b,c)/* Hangup a call */#define PRI_HANGUPextern int pri_hangup(struct pri *pri, q931_call *call, int cause);#define PRI_DESTROYCALLextern void pri_destroycall(struct pri *pri, q931_call *call);extern int pri_reset(struct pri *pri, int channel);/* Create a new call */extern q931_call *pri_new_call(struct pri *pri);/* Retrieve CRV reference for GR-303 calls. Returns >0 on success. */extern int pri_get_crv(struct pri *pri, q931_call *call, int *callmode);/* Retrieve CRV reference for GR-303 calls. CRV must be >0, call mode should be 0 */extern int pri_set_crv(struct pri *pri, q931_call *call, int crv, int callmode);/* How long until you need to poll for a new event */extern struct timeval *pri_schedule_next(struct pri *pri);/* Run any pending schedule events */extern pri_event *pri_schedule_run(struct pri *pri);extern int pri_call(struct pri *pri, q931_call *c, int transmode, int channel, int exclusive, int nonisdn, char *caller, int callerplan, char *callername, int callerpres, char *called,int calledplan, int ulayer1);extern struct pri_sr *pri_sr_new(void);extern void pri_sr_free(struct pri_sr *sr);extern int pri_sr_set_channel(struct pri_sr *sr, int channel, int exclusive, int nonisdn);extern int pri_sr_set_bearer(struct pri_sr *sr, int transmode, int userl1);extern int pri_sr_set_called(struct pri_sr *sr, char *called, int calledplan, int complete);extern int pri_sr_set_caller(struct pri_sr *sr, char *caller, char *callername, int callerplan, int callerpres);extern int pri_setup(struct pri *pri, q931_call *call, struct pri_sr *req); /* Override message and error stuff */extern void pri_set_message(void (*__pri_error)(char *));extern void pri_set_error(void (*__pri_error)(char *));/* Set overlap mode */#define PRI_SET_OVERLAPDIALextern void pri_set_overlapdial(struct pri *pri,int state);#define PRI_DUMP_INFO_STRextern char *pri_dump_info_str(struct pri *pri);/* Get file descriptor */extern int pri_fd(struct pri *pri);#define PRI_PROGRESS/* Send call proceeding */extern int pri_progress(struct pri *pri, q931_call *c, int channel, int info);#define PRI_PROCEEDING_FULL/* Send call proceeding */extern int pri_proceeding(struct pri *pri, q931_call *c, int channel, int info);/* Enslave a PRI to another, so they share the same call list (and maybe some timers) */extern void pri_enslave(struct pri *master, struct pri *slave);#define PRI_GR303_SUPPORT#define PRI_ENSLAVE_SUPPORT#define PRI_SETUP_CALL#define PRI_RECEIVE_SUBADDR#endif/* Send notification */extern int pri_notify(struct pri *pri, q931_call *c, int channel, int info);
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -