📄 libpri.h
字号:
/* * libpri: An implementation of Primary Rate ISDN * * Written by Mark Spencer <markster@digium.com> * * Copyright (C) 2001, Digium, Inc. * All Rights Reserved. *//* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. * * In addition, when this program is distributed with Asterisk in * any form that would qualify as a 'combined work' or as a * 'derivative work' (but not mere aggregation), you can redistribute * and/or modify the combination under the terms of the license * provided with that copy of Asterisk, instead of the license * terms granted here. */ #ifndef _LIBPRI_H#define _LIBPRI_H/* Node types */#define PRI_NETWORK 1#define PRI_CPE 2/* Debugging */#define PRI_DEBUG_Q921_RAW (1 << 0) /* Show raw HDLC frames */#define PRI_DEBUG_Q921_DUMP (1 << 1) /* Show each interpreted Q.921 frame */#define PRI_DEBUG_Q921_STATE (1 << 2) /* Debug state machine changes */#define PRI_DEBUG_CONFIG (1 << 3) /* Display error events on stdout */#define PRI_DEBUG_Q931_DUMP (1 << 5) /* Show interpreted Q.931 frames */#define PRI_DEBUG_Q931_STATE (1 << 6) /* Debug Q.931 state machine changes */#define PRI_DEBUG_Q931_ANOMALY (1 << 7) /* Show unexpected events */#define PRI_DEBUG_APDU (1 << 8) /* Debug of APDU components such as ROSE */#define PRI_DEBUG_AOC (1 << 9) /* Debug of Advice of Charge ROSE Messages */#define PRI_DEBUG_ALL (0xffff) /* Everything *//* Switch types */#define PRI_SWITCH_UNKNOWN 0#define PRI_SWITCH_NI2 1 /* National ISDN 2 */#define PRI_SWITCH_DMS100 2 /* DMS 100 */#define PRI_SWITCH_LUCENT5E 3 /* Lucent 5E */#define PRI_SWITCH_ATT4ESS 4 /* AT&T 4ESS */#define PRI_SWITCH_EUROISDN_E1 5 /* Standard EuroISDN (CTR4, ETSI 300-102) */#define PRI_SWITCH_EUROISDN_T1 6 /* T1 EuroISDN variant (ETSI 300-102) */#define PRI_SWITCH_NI1 7 /* National ISDN 1 */#define PRI_SWITCH_GR303_EOC 8 /* GR-303 Embedded Operations Channel */#define PRI_SWITCH_GR303_TMC 9 /* GR-303 Timeslot Management Channel */#define PRI_SWITCH_QSIG 10 /* QSIG Switch *//* Switchtypes 11 - 20 are reserved for internal use *//* PRI D-Channel Events */#define PRI_EVENT_DCHAN_UP 1 /* D-channel is up */#define PRI_EVENT_DCHAN_DOWN 2 /* D-channel is down */#define PRI_EVENT_RESTART 3 /* B-channel is restarted */#define PRI_EVENT_CONFIG_ERR 4 /* Configuration Error Detected */#define PRI_EVENT_RING 5 /* Incoming call */#define PRI_EVENT_HANGUP 6 /* Call got hung up */#define PRI_EVENT_RINGING 7 /* Call is ringing (alerting) */#define PRI_EVENT_ANSWER 8 /* Call has been answered */#define PRI_EVENT_HANGUP_ACK 9 /* Call hangup has been acknowledged */#define PRI_EVENT_RESTART_ACK 10 /* Restart complete on a given channel */#define PRI_EVENT_FACNAME 11 /* Caller*ID Name received on Facility */#define PRI_EVENT_INFO_RECEIVED 12 /* Additional info (keypad) received */#define PRI_EVENT_PROCEEDING 13 /* When we get CALL_PROCEEDING or PROGRESS */#define PRI_EVENT_SETUP_ACK 14 /* When we get SETUP_ACKNOWLEDGE */#define PRI_EVENT_HANGUP_REQ 15 /* Requesting the higher layer to hangup */#define PRI_EVENT_NOTIFY 16 /* Notification received */#define PRI_EVENT_PROGRESS 17 /* When we get CALL_PROCEEDING or PROGRESS */#define PRI_EVENT_KEYPAD_DIGIT 18 /* When we receive during ACTIVE state *//* Simple states */#define PRI_STATE_DOWN 0#define PRI_STATE_UP 1#define PRI_PROGRESS_MASK/* Progress indicator values */#define PRI_PROG_CALL_NOT_E2E_ISDN (1 << 0)#define PRI_PROG_CALLED_NOT_ISDN (1 << 1)#define PRI_PROG_CALLER_NOT_ISDN (1 << 2)#define PRI_PROG_INBAND_AVAILABLE (1 << 3)#define PRI_PROG_DELAY_AT_INTERF (1 << 4)#define PRI_PROG_INTERWORKING_WITH_PUBLIC (1 << 5)#define PRI_PROG_INTERWORKING_NO_RELEASE (1 << 6)#define PRI_PROG_INTERWORKING_NO_RELEASE_PRE_ANSWER (1 << 7)#define PRI_PROG_INTERWORKING_NO_RELEASE_POST_ANSWER (1 << 8)#define PRI_PROG_CALLER_RETURNED_TO_ISDN (1 << 9)/* Numbering plan identifier */#define PRI_NPI_UNKNOWN 0x0#define PRI_NPI_E163_E164 0x1#define PRI_NPI_X121 0x3#define PRI_NPI_F69 0x4#define PRI_NPI_NATIONAL 0x8#define PRI_NPI_PRIVATE 0x9#define PRI_NPI_RESERVED 0xF/* Type of number */#define PRI_TON_UNKNOWN 0x0#define PRI_TON_INTERNATIONAL 0x1#define PRI_TON_NATIONAL 0x2#define PRI_TON_NET_SPECIFIC 0x3#define PRI_TON_SUBSCRIBER 0x4#define PRI_TON_ABBREVIATED 0x6#define PRI_TON_RESERVED 0x7/* Redirection reasons */#define PRI_REDIR_UNKNOWN 0x0#define PRI_REDIR_FORWARD_ON_BUSY 0x1#define PRI_REDIR_FORWARD_ON_NO_REPLY 0x2#define PRI_REDIR_DEFLECTION 0x3#define PRI_REDIR_DTE_OUT_OF_ORDER 0x9#define PRI_REDIR_FORWARDED_BY_DTE 0xA#define PRI_REDIR_UNCONDITIONAL 0xF/* Dialing plan */#define PRI_INTERNATIONAL_ISDN 0x11#define PRI_NATIONAL_ISDN 0x21#define PRI_LOCAL_ISDN 0x41#define PRI_PRIVATE 0x49#define PRI_UNKNOWN 0x0/* Presentation */#define PRES_ALLOWED_USER_NUMBER_NOT_SCREENED 0x00#define PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN 0x01#define PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN 0x02#define PRES_ALLOWED_NETWORK_NUMBER 0x03#define PRES_PROHIB_USER_NUMBER_NOT_SCREENED 0x20#define PRES_PROHIB_USER_NUMBER_PASSED_SCREEN 0x21#define PRES_PROHIB_USER_NUMBER_FAILED_SCREEN 0x22#define PRES_PROHIB_NETWORK_NUMBER 0x23#define PRES_NUMBER_NOT_AVAILABLE 0x43/* Causes for disconnection */#define PRI_CAUSE_UNALLOCATED 1#define PRI_CAUSE_NO_ROUTE_TRANSIT_NET 2 /* !Q.SIG */#define PRI_CAUSE_NO_ROUTE_DESTINATION 3#define PRI_CAUSE_CHANNEL_UNACCEPTABLE 6#define PRI_CAUSE_CALL_AWARDED_DELIVERED 7 /* !Q.SIG */#define PRI_CAUSE_NORMAL_CLEARING 16#define PRI_CAUSE_USER_BUSY 17#define PRI_CAUSE_NO_USER_RESPONSE 18#define PRI_CAUSE_NO_ANSWER 19#define PRI_CAUSE_CALL_REJECTED 21#define PRI_CAUSE_NUMBER_CHANGED 22#define PRI_CAUSE_DESTINATION_OUT_OF_ORDER 27#define PRI_CAUSE_INVALID_NUMBER_FORMAT 28#define PRI_CAUSE_FACILITY_REJECTED 29 /* !Q.SIG */#define PRI_CAUSE_RESPONSE_TO_STATUS_ENQUIRY 30#define PRI_CAUSE_NORMAL_UNSPECIFIED 31#define PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION 34#define PRI_CAUSE_NETWORK_OUT_OF_ORDER 38 /* !Q.SIG */#define PRI_CAUSE_NORMAL_TEMPORARY_FAILURE 41#define PRI_CAUSE_SWITCH_CONGESTION 42 /* !Q.SIG */#define PRI_CAUSE_ACCESS_INFO_DISCARDED 43 /* !Q.SIG */#define PRI_CAUSE_REQUESTED_CHAN_UNAVAIL 44#define PRI_CAUSE_PRE_EMPTED 45 /* !Q.SIG */#define PRI_CAUSE_FACILITY_NOT_SUBSCRIBED 50 /* !Q.SIG */#define PRI_CAUSE_OUTGOING_CALL_BARRED 52 /* !Q.SIG */#define PRI_CAUSE_INCOMING_CALL_BARRED 54 /* !Q.SIG */#define PRI_CAUSE_BEARERCAPABILITY_NOTAUTH 57#define PRI_CAUSE_BEARERCAPABILITY_NOTAVAIL 58#define PRI_CAUSE_SERVICEOROPTION_NOTAVAIL 63 /* Q.SIG */#define PRI_CAUSE_BEARERCAPABILITY_NOTIMPL 65#define PRI_CAUSE_CHAN_NOT_IMPLEMENTED 66 /* !Q.SIG */#define PRI_CAUSE_FACILITY_NOT_IMPLEMENTED 69 /* !Q.SIG */#define PRI_CAUSE_INVALID_CALL_REFERENCE 81#define PRI_CAUSE_IDENTIFIED_CHANNEL_NOTEXIST 82 /* Q.SIG */#define PRI_CAUSE_INCOMPATIBLE_DESTINATION 88#define PRI_CAUSE_INVALID_MSG_UNSPECIFIED 95 /* !Q.SIG */#define PRI_CAUSE_MANDATORY_IE_MISSING 96#define PRI_CAUSE_MESSAGE_TYPE_NONEXIST 97#define PRI_CAUSE_WRONG_MESSAGE 98#define PRI_CAUSE_IE_NONEXIST 99#define PRI_CAUSE_INVALID_IE_CONTENTS 100#define PRI_CAUSE_WRONG_CALL_STATE 101#define PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE 102#define PRI_CAUSE_MANDATORY_IE_LENGTH_ERROR 103 /* !Q.SIG */#define PRI_CAUSE_PROTOCOL_ERROR 111#define PRI_CAUSE_INTERWORKING 127 /* !Q.SIG *//* Transmit capabilities */#define PRI_TRANS_CAP_SPEECH 0x0#define PRI_TRANS_CAP_DIGITAL 0x08#define PRI_TRANS_CAP_RESTRICTED_DIGITAL 0x09#define PRI_TRANS_CAP_3_1K_AUDIO 0x10#define PRI_TRANS_CAP_7K_AUDIO 0x11 /* Depriciated ITU Q.931 (05/1998)*/#define PRI_TRANS_CAP_DIGITAL_W_TONES 0x11#define PRI_TRANS_CAP_VIDEO 0x18#define PRI_LAYER_1_ITU_RATE_ADAPT 0x21#define PRI_LAYER_1_ULAW 0x22#define PRI_LAYER_1_ALAW 0x23#define PRI_LAYER_1_G721 0x24#define PRI_LAYER_1_G722_G725 0x25#define PRI_LAYER_1_H223_H245 0x26#define PRI_LAYER_1_NON_ITU_ADAPT 0x27#define PRI_LAYER_1_V120_RATE_ADAPT 0x28#define PRI_LAYER_1_X31_RATE_ADAPT 0x29/* Intermediate rates for V.110 */#define PRI_INT_RATE_8K 1#define PRI_INT_RATE_16K 2#define PRI_INT_RATE_32K 3/* Rate adaption for bottom 5 bits of rateadaption */#define PRI_RATE_USER_RATE_MASK 0x1F#define PRI_RATE_ADAPT_UNSPEC 0x00#define PRI_RATE_ADAPT_0K6 0x01#define PRI_RATE_ADAPT_1K2 0x02#define PRI_RATE_ADAPT_2K4 0x03#define PRI_RATE_ADAPT_3K6 0x04#define PRI_RATE_ADAPT_4K8 0x05#define PRI_RATE_ADAPT_7K2 0x06#define PRI_RATE_ADAPT_8K 0x07#define PRI_RATE_ADAPT_9K6 0x08#define PRI_RATE_ADAPT_14K4 0x09#define PRI_RATE_ADAPT_16K 0x0A#define PRI_RATE_ADAPT_19K2 0x0B#define PRI_RATE_ADAPT_32K 0x0C#define PRI_RATE_ADAPT_38K4 0x0D#define PRI_RATE_ADAPT_48K 0x0E#define PRI_RATE_ADAPT_56K 0x0F#define PRI_RATE_ADAPT_57K6 0x12#define PRI_RATE_ADAPT_28K8 0x13#define PRI_RATE_ADAPT_24K 0x14#define PRI_RATE_ADAPT_0K1345 0x15#define PRI_RATE_ADAPT_0K1 0x16#define PRI_RATE_ADAPT_0K075_1K2 0x17#define PRI_RATE_ADAPT_1K2_0K075 0x18#define PRI_RATE_ADAPT_0K05 0x19#define PRI_RATE_ADAPT_0K075 0x1A#define PRI_RATE_ADAPT_0K110 0x1B#define PRI_RATE_ADAPT_0K150 0x1C#define PRI_RATE_ADAPT_0K200 0x1D#define PRI_RATE_ADAPT_0K300 0x1E#define PRI_RATE_ADAPT_12K 0x1F/* in-band negotiation flag for rateadaption bit 5 */#define PRI_RATE_ADAPT_NEGOTIATION_POSS 0x20/* async flag for rateadaption bit 6 */#define PRI_RATE_ADAPT_ASYNC 0x40/* Notifications */#define PRI_NOTIFY_USER_SUSPENDED 0x00 /* User suspended */#define PRI_NOTIFY_USER_RESUMED 0x01 /* User resumed */#define PRI_NOTIFY_BEARER_CHANGE 0x02 /* Bearer service change (DSS1) */#define PRI_NOTIFY_ASN1_COMPONENT 0x03 /* ASN.1 encoded component (DSS1) */#define PRI_NOTIFY_COMPLETION_DELAY 0x04 /* Call completion delay */#define PRI_NOTIFY_CONF_ESTABLISHED 0x42 /* Conference established */#define PRI_NOTIFY_CONF_DISCONNECTED 0x43 /* Conference disconnected */#define PRI_NOTIFY_CONF_PARTY_ADDED 0x44 /* Other party added */#define PRI_NOTIFY_CONF_ISOLATED 0x45 /* Isolated */#define PRI_NOTIFY_CONF_REATTACHED 0x46 /* Reattached */#define PRI_NOTIFY_CONF_OTHER_ISOLATED 0x47 /* Other party isolated */#define PRI_NOTIFY_CONF_OTHER_REATTACHED 0x48 /* Other party reattached */#define PRI_NOTIFY_CONF_OTHER_SPLIT 0x49 /* Other party split */#define PRI_NOTIFY_CONF_OTHER_DISCONNECTED 0x4a /* Other party disconnected */#define PRI_NOTIFY_CONF_FLOATING 0x4b /* Conference floating */#define PRI_NOTIFY_WAITING_CALL 0x60 /* Call is waiting call */#define PRI_NOTIFY_DIVERSION_ACTIVATED 0x68 /* Diversion activated (DSS1) */#define PRI_NOTIFY_TRANSFER_ALERTING 0x69 /* Call transfer, alerting */#define PRI_NOTIFY_TRANSFER_ACTIVE 0x6a /* Call transfer, active */#define PRI_NOTIFY_REMOTE_HOLD 0x79 /* Remote hold */#define PRI_NOTIFY_REMOTE_RETRIEVAL 0x7a /* Remote retrieval */#define PRI_NOTIFY_CALL_DIVERTING 0x7b /* Call is diverting */#define PRI_COPY_DIGITS_CALLED_NUMBER/* Network Specific Facilities (AT&T) */#define PRI_NSF_NONE -1#define PRI_NSF_SID_PREFERRED 0xB1#define PRI_NSF_ANI_PREFERRED 0xB2#define PRI_NSF_SID_ONLY 0xB3#define PRI_NSF_ANI_ONLY 0xB4#define PRI_NSF_CALL_ASSOC_TSC 0xB9#define PRI_NSF_NOTIF_CATSC_CLEARING 0xBA#define PRI_NSF_OPERATOR 0xB5#define PRI_NSF_PCCO 0xB6#define PRI_NSF_SDN 0xE1#define PRI_NSF_TOLL_FREE_MEGACOM 0xE2#define PRI_NSF_MEGACOM 0xE3#define PRI_NSF_ACCUNET 0xE6#define PRI_NSF_LONG_DISTANCE_SERVICE 0xE7#define PRI_NSF_INTERNATIONAL_TOLL_FREE 0xE8#define PRI_NSF_ATT_MULTIQUEST 0xF0#define PRI_NSF_CALL_REDIRECTION_SERVICE 0xF7typedef struct q931_call q931_call;typedef struct pri_event_generic { /* Events with no additional information fall in this category */ int e;} pri_event_generic;typedef struct pri_event_error { int e; char err[256];} pri_event_error;typedef struct pri_event_restart { int e; int channel;} pri_event_restart;typedef struct pri_event_ringing { int e; int channel; int cref; int progress; int progressmask; q931_call *call; char useruserinfo[260]; /* User->User info */} pri_event_ringing;typedef struct pri_event_answer { int e; int channel; int cref; int progress; int progressmask; q931_call *call; char useruserinfo[260]; /* User->User info */} pri_event_answer;typedef struct pri_event_facname { int e; char callingname[256]; char callingnum[256]; int channel; int cref; q931_call *call; int callingpres; /* Presentation of Calling CallerID */ int callingplan; /* Dialing plan of Calling entity */} pri_event_facname;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -