ooq931.h
来自「一个非常美妙的proxy。功能强大。基于sip的协议。如果还要的话」· C头文件 代码 · 共 767 行 · 第 1/2 页
H
767 行
/* * Copyright (C) 2004-2005 by Objective Systems, Inc. * * This software is furnished under an open source license and may be * used and copied only in accordance with the terms of this license. * The text of the license may generally be found in the root * directory of this installation in the COPYING file. It * can also be viewed online at the following URL: * * http://www.obj-sys.com/open/license.html * * Any redistributions of this file including modified versions must * maintain this copyright notice. * *****************************************************************************//** * @file ooq931.h * This file contains functions to support call signalling. */#ifndef _OOQ931HDR_H_#define _OOQ931HDR_H_#include "ooasn1.h"#include "ootypes.h"#include "H323-MESSAGES.h"#ifdef __cplusplusextern "C" {#endif#ifndef EXTERN#ifdef MAKE_DLL#define EXTERN __declspec(dllexport)#else#define EXTERN#endif /* MAKE_DLL */#endif /* EXTERN *//** * @defgroup q931 Q.931/H.2250 Message Handling * @{ *//* Maximum length of the Calling/Called party number number */#define OO_MAX_NUMBER_LENGTH 50/* Maximum value for a call token identifier */#define OO_MAX_CALL_TOKEN 9999/* Q.931 packet must be at least 5 bytes long */#define Q931_E_TOOSHORT (-1001) /* callReference field must be 2 bytes long */#define Q931_E_INVCALLREF (-1002) /* invalid length of message */#define Q931_E_INVLENGTH (-1003) enum Q931MsgTypes { Q931NationalEscapeMsg = 0x00, Q931AlertingMsg = 0x01, Q931CallProceedingMsg = 0x02, Q931ConnectMsg = 0x07, Q931ConnectAckMsg = 0x0f, Q931ProgressMsg = 0x03, Q931SetupMsg = 0x05, Q931SetupAckMsg = 0x0d, Q931ResumeMsg = 0x26, Q931ResumeAckMsg = 0x2e, Q931ResumeRejectMsg = 0x22, Q931SuspendMsg = 0x25, Q931SuspendAckMsg = 0x2d, Q931SuspendRejectMsg = 0x21, Q931UserInformationMsg = 0x20, Q931DisconnectMsg = 0x45, Q931ReleaseMsg = 0x4d, Q931ReleaseCompleteMsg = 0x5a, Q931RestartMsg = 0x46, Q931RestartAckMsg = 0x4e, Q931SegmentMsg = 0x60, Q931CongestionCtrlMsg = 0x79, Q931InformationMsg = 0x7b, Q931NotifyMsg = 0x6e, Q931StatusMsg = 0x7d, Q931StatusEnquiryMsg = 0x75, Q931FacilityMsg = 0x62};enum Q931IECodes { Q931BearerCapabilityIE = 0x04, Q931CauseIE = 0x08, Q931FacilityIE = 0x1c, Q931ProgressIndicatorIE = 0x1e, Q931CallStateIE = 0x14, Q931DisplayIE = 0x28, Q931SignalIE = 0x34, Q931CallingPartyNumberIE = 0x6c, Q931CalledPartyNumberIE = 0x70, Q931RedirectingNumberIE = 0x74, Q931UserUserIE = 0x7e, Q931KeypadIE = 0x2c};enum Q931InformationTransferCapability { Q931TransferSpeech, Q931TransferUnrestrictedDigital = 8, Q931TransferRestrictedDigital = 9, Q931Transfer3_1kHzAudio = 16, Q931TrasnferUnrestrictedDigitalWithTones = 17, Q931TransferVideo = 24};enum Q931CauseValues { Q931UnallocatedNumber = 0x01, Q931NoRouteToNetwork = 0x02, Q931NoRouteToDestination = 0x03, Q931ChannelUnacceptable = 0x06, Q931NormalCallClearing = 0x10, Q931UserBusy = 0x11, Q931NoResponse = 0x12, Q931NoAnswer = 0x13, Q931SubscriberAbsent = 0x14, Q931CallRejected = 0x15, Q931NumberChanged = 0x16, Q931Redirection = 0x17, Q931DestinationOutOfOrder = 0x1b, Q931InvalidNumberFormat = 0x1c, Q931NormalUnspecified = 0x1f, Q931StatusEnquiryResponse = 0x1e, Q931NoCircuitChannelAvailable = 0x22, Q931NetworkOutOfOrder = 0x26, Q931TemporaryFailure = 0x29, Q931Congestion = 0x2a, Q931RequestedCircuitUnAvailable = 0x2c, Q931ResourcesUnavailable = 0x2f, Q931IncompatibleDestination = 0x58, Q931ProtocolErrorUnspecified = 0x6f, Q931RecoveryOnTimerExpiry = 0x66, Q931InvalidCallReference = 0x51, Q931ErrorInCauseIE = 0};enum Q931SignalInfo { Q931SignalDialToneOn, Q931SignalRingBackToneOn, Q931SignalInterceptToneOn, Q931SignalNetworkCongestionToneOn, Q931SignalBusyToneOn, Q931SignalConfirmToneOn, Q931SignalAnswerToneOn, Q931SignalCallWaitingTone, Q931SignalOffhookWarningTone, Q931SignalPreemptionToneOn, Q931SignalTonesOff = 0x3f, Q931SignalAlertingPattern0 = 0x40, Q931SignalAlertingPattern1, Q931SignalAlertingPattern2, Q931SignalAlertingPattern3, Q931SignalAlertingPattern4, Q931SignalAlertingPattern5, Q931SignalAlertingPattern6, Q931SignalAlertingPattern7, Q931SignalAlretingOff = 0x4f, Q931SignalErrorInIE = 0x100};enum Q931NumberingPlanCodes { Q931UnknownPlan = 0x00, Q931ISDNPlan = 0x01, Q931DataPlan = 0x03, Q931TelexPlan = 0x04, Q931NationalStandardPlan = 0x08, Q931PrivatePlan = 0x09, Q931ReservedPlan = 0x0f};enum Q931TypeOfNumberCodes { Q931UnknownType = 0x00, Q931InternationalType = 0x01, Q931NationalType = 0x02, Q931NetworkSpecificType = 0x03, Q931SubscriberType = 0x04, Q931AbbreviatedType = 0x06, Q931ReservedType = 0x07};enum Q931CodingStandard{ Q931CCITTStd = 0, Q931ReservedInternationalStd, Q931NationalStd, Q931NetworkStd};enum Q931TransferMode { Q931TransferCircuitMode = 0, /* 00 */ Q931TransferPacketMode = 2 /* 10 */};enum Q931TransferRate{ Q931TransferRatePacketMode = 0x00, /* 00000 */ Q931TransferRate64Kbps = 0x10, /* 10000 */ Q931TransferRate128kbps = 0x11, /* 10001 */ Q931TransferRate384kbps = 0x13, /* 10011 */ Q931TransferRate1536kbps = 0x15, /* 10101 */ Q931TransferRate1920kbps = 0x17 /* 10111 */};enum Q931UserInfoLayer1Protocol{ Q931UserInfoLayer1CCITTStdRate = 1, Q931UserInfoLayer1G711ULaw, Q931UserInfoLayer1G711ALaw, Q931UserInfoLayer1G721ADPCM, Q931UserInfoLayer1G722G725, Q931UserInfoLayer1H261, Q931UserInfoLayer1NonCCITTStdRate, Q931UserInfoLayer1CCITTStdRateV120, Q931UserInfoLayer1X31};/* Structure to build store outgoing encoded UUIE The different fields in the structure have octet lengths as specified in the spec. */typedef struct Q931InformationElement { int discriminator; int offset; int length; ASN1OCTET data[1];} Q931InformationElement;/** * Q.931 message structure. Contains context for memory allocation, * protocol discriminator, call reference, meesage type and list of * user-user information elements (IEs). */typedef struct Q931Message { ASN1UINT protocolDiscriminator; ASN1UINT callReference; ASN1BOOL fromDestination; ASN1UINT messageType; /* Q931MsgTypes */ ASN1UINT tunneledMsgType; /* The H245 message this message is tunneling*/ ASN1INT logicalChannelNo; /* channel number associated with tunneled */ /* message, 0 if no channel */ DList ies; Q931InformationElement *bearerCapabilityIE; Q931InformationElement *callingPartyNumberIE; Q931InformationElement *calledPartyNumberIE; Q931InformationElement *causeIE; Q931InformationElement *keypadIE; H225H323_UserInformation *userInfo;} Q931Message;/** * This structure is used to hold an H.323 alias address. */typedef struct OOAliases { int type; /*!< H.225 AliasAddress choice option (t value) */ char *value; /*!< H.225 AliasAddress value */ OOBOOL registered; struct OOAliases *next;} OOAliases;#define ooAliases OOAliasesstruct OOH323CallData;/* * These are message callbacks which can be used by user applications * to perform application specific things on receiving a particular * message or before sending a particular message. For ex. user application * can change values of some parameters of setup message before it is actually * sent out. *//** * This callback is triggered when an H.225 SETUP message is received by * the application. * @param call The call the message is associated with. * @param pmsg Q.931 message structure. * @return OO_OK if message processing successful or OO_FAILED if not. */typedef int (*cb_OnReceivedSetup) (struct OOH323CallData *call, struct Q931Message *pmsg);/** * This callback is triggered when an H.225 CONNECT message is received by * the application. * @param call The call the message is associated with. * @param pmsg Q.931 message structure. * @return OO_OK if message processing successful or OO_FAILED if not. */typedef int (*cb_OnReceivedConnect) (struct OOH323CallData *call, struct Q931Message *pmsg);/** * This callback is triggered after an H.225 SETUP message has been * constructed and is ready to be sent out. It provides the application * with an opportunity to add additional non-standard information. * @param call The call the message is associated with. * @param pmsg Q.931 message structure. * @return OO_OK if message processing successful or OO_FAILED if not. */typedef int (*cb_OnBuiltSetup) (struct OOH323CallData *call, struct Q931Message *pmsg);/** * This callback is triggered after an H.225 CONNECT message has been * constructed and is ready to be sent out. It provides the application * with an opportunity to add additional non-standard information. * @param call The call the message is associated with. * @param pmsg Q.931 message structure. * @return OO_OK if message processing successful or OO_FAILED if not. */typedef int (*cb_OnBuiltConnect) (struct OOH323CallData *call, struct Q931Message *pmsg);/** * This structure holds the various callback functions that are * triggered when H.225 messages are received or constructed. * @see ooH323EpSetH225MsgCallbacks */typedef struct OOH225MsgCallbacks { cb_OnReceivedSetup onReceivedSetup; cb_OnReceivedConnect onReceivedConnect; cb_OnBuiltSetup onBuiltSetup; cb_OnBuiltConnect onBuiltConnect;} OOH225MsgCallbacks;/** * This function is invoked to decode a Q931 message. * * @param call Handle to call which owns the message. * @param msg Pointer to the Q931 message * @param length Length of the encoded data * @param data Pointer to the data to be decoded * * @return Completion status - 0 on success, -1 on failure */EXTERN int ooQ931Decode (struct OOH323CallData *call, Q931Message* msg, int length, ASN1OCTET *data);/** * This function is used to decode the UUIE of the message from the list of * ies. It decodes the User-User ie and populates the userInfo field of the * message. * @param q931Msg Pointer to the message whose User-User ie has to be * decoded. * * @return OO_OK, on success. OO_FAILED, on failure. */ EXTERN int ooDecodeUUIE(Q931Message *q931Msg);/** * This function is used to encode the UUIE field of the Q931 message. * It encodes UUIE and adds the encoded data to the list of ies. * @param q931msg Pointer to the Q931 message whose UUIE field has to be * encoded. * * @return OO_OK, on success. OO_FAILED, on failure. */EXTERN int ooEncodeUUIE(Q931Message *q931msg);/** * This function is invoked to retrieve an IE element from a Q931 message. * * @param q931msg Pointer to the Q931 message * @param ieCode IE code for the IE element to be retrieved * * @return Pointer to a Q931InformationElement contating * the IE element. */EXTERN Q931InformationElement* ooQ931GetIE (const Q931Message* q931msg, int ieCode);/** * This function is invoked to print a Q931 message. * * @param q931msg Pointer to the Q931 message * * @return - none */EXTERN void ooQ931Print (const Q931Message* q931msg);/** * This function is invoked to create an outgoing Q931 message.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?