00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208 #ifndef __OPAL_Q931_H
00209 #define __OPAL_Q931_H
00210
00211 #ifdef P_USE_PRAGMA
00212 #pragma interface
00213 #endif
00214
00215
00217
00220 class Q931 : public PObject
00221 {
00222 PCLASSINFO(Q931, PObject)
00223 public:
00224 enum MsgTypes {
00225 NationalEscapeMsg = 0x00,
00226 AlertingMsg = 0x01,
00227 CallProceedingMsg = 0x02,
00228 ConnectMsg = 0x07,
00229 ConnectAckMsg = 0x0f,
00230 ProgressMsg = 0x03,
00231 SetupMsg = 0x05,
00232 SetupAckMsg = 0x0d,
00233 ResumeMsg = 0x26,
00234 ResumeAckMsg = 0x2e,
00235 ResumeRejectMsg = 0x22,
00236 SuspendMsg = 0x25,
00237 SuspendAckMsg = 0x2d,
00238 SuspendRejectMsg = 0x21,
00239 UserInformationMsg = 0x20,
00240 DisconnectMsg = 0x45,
00241 ReleaseMsg = 0x4d,
00242 ReleaseCompleteMsg = 0x5a,
00243 RestartMsg = 0x46,
00244 RestartAckMsg = 0x4e,
00245 SegmentMsg = 0x60,
00246 CongestionCtrlMsg = 0x79,
00247 InformationMsg = 0x7b,
00248 NotifyMsg = 0x6e,
00249 StatusMsg = 0x7d,
00250 StatusEnquiryMsg = 0x75,
00251 FacilityMsg = 0x62
00252 };
00253
00254 Q931();
00255 Q931(const Q931 & other);
00256 Q931 & operator=(const Q931 & other);
00257
00258 void BuildFacility(int callRef, BOOL fromDest);
00259 void BuildInformation(int callRef, BOOL fromDest);
00260 void BuildProgress(
00261 int callRef,
00262 BOOL fromDest,
00263 unsigned description,
00264 unsigned codingStandard = 0,
00265 unsigned location = 0
00266 );
00267 void BuildNotify(int callRef, BOOL fromDest);
00268 void BuildCallProceeding(int callRef);
00269 void BuildSetupAcknowledge(int callRef);
00270 void BuildAlerting(int callRef);
00271 void BuildSetup(int callRef = -1);
00272 void BuildConnect(int callRef);
00273 void BuildConnectAck(int callRef, BOOL fromDest);
00274 void BuildStatus(int callRef, BOOL fromDest);
00275 void BuildStatusEnquiry(int callRef, BOOL fromDest);
00276 void BuildReleaseComplete(int callRef, BOOL fromDest);
00277
00278 BOOL Decode(const PBYTEArray & data);
00279 BOOL Encode(PBYTEArray & data) const;
00280
00281 void PrintOn(ostream & strm) const;
00282 PString GetMessageTypeName() const;
00283
00284 static unsigned GenerateCallReference();
00285 unsigned GetCallReference() const { return callReference; }
00286 BOOL IsFromDestination() const { return fromDestination; }
00287 MsgTypes GetMessageType() const { return messageType; }
00288
00289 enum InformationElementCodes {
00290 BearerCapabilityIE = 0x04,
00291 CauseIE = 0x08,
00292 ChannelIdentificationIE = 0x18,
00293 FacilityIE = 0x1c,
00294 ProgressIndicatorIE = 0x1e,
00295 CallStateIE = 0x14,
00296 DisplayIE = 0x28,
00297 KeypadIE = 0x2c,
00298 SignalIE = 0x34,
00299 ConnectedNumberIE = 0x4c,
00300 CallingPartyNumberIE = 0x6c,
00301 CalledPartyNumberIE = 0x70,
00302 RedirectingNumberIE = 0x74,
00303 UserUserIE = 0x7e
00304 };
00305 friend ostream & operator<<(ostream & strm, InformationElementCodes ie);
00306
00307 BOOL HasIE(InformationElementCodes ie) const;
00308 PBYTEArray GetIE(InformationElementCodes ie) const;
00309 void SetIE(InformationElementCodes ie, const PBYTEArray & userData);
00310 void RemoveIE(InformationElementCodes ie);
00311
00312 enum InformationTransferCapability {
00313 TransferSpeech,
00314 TransferUnrestrictedDigital = 8,
00315 TransferRestrictedDigital = 9,
00316 Transfer3_1kHzAudio = 16,
00317 TransferUnrestrictedDigitalWithTones = 17,
00318 TransferVideo = 24
00319 };
00320
00321 void SetBearerCapabilities(
00322 InformationTransferCapability capability,
00323 unsigned transferRate,
00324 unsigned codingStandard = 0,
00325 unsigned userInfoLayer1 = 5
00326 );
00327
00328 BOOL GetBearerCapabilities(
00329 InformationTransferCapability & capability,
00330 unsigned & transferRate,
00331 unsigned * codingStandard = NULL,
00332 unsigned * userInfoLayer1 = NULL
00333 );
00334
00335 enum CauseValues {
00336 UnknownCauseIE = 0,
00337 UnallocatedNumber = 1,
00338 NoRouteToNetwork = 2,
00339 NoRouteToDestination = 3,
00340 SendSpecialTone = 4,
00341 MisdialledTrunkPrefix = 5,
00342 ChannelUnacceptable = 6,
00343 CallAwarded = 7,
00344 Preemption = 8,
00345 PreemptionCircuitReserved = 9,
00346 NormalCallClearing = 16,
00347 UserBusy = 17,
00348 NoResponse = 18,
00349 NoAnswer = 19,
00350 SubscriberAbsent = 20,
00351 CallRejected = 21,
00352 NumberChanged = 22,
00353 Redirection = 23,
00354 ExchangeRoutingError = 25,
00355 NonSelectedUserClearing = 26,
00356 DestinationOutOfOrder = 27,
00357 InvalidNumberFormat = 28,
00358 FacilityRejected = 29,
00359 StatusEnquiryResponse = 30,
00360 NormalUnspecified = 31,
00361 NoCircuitChannelAvailable = 34,
00362 CallQueued = 35,
00363 NetworkOutOfOrder = 38,
00364 FrameModeOOS = 39,
00365 FrameModeOperational = 40,
00366 TemporaryFailure = 41,
00367 Congestion = 42,
00368 AccessInformationDiscarded = 43,
00369 RequestedCircuitNotAvailable = 44,
00370 PrecedenceCallBlocked = 46,
00371 ResourceUnavailable = 47,
00372 QoSNotAvailable = 49,
00373 RequestedFacilityNotSubscribed = 50,
00374 OutgoingCallsBarred = 52,
00375 OutgoingCallsBarredInCUG = 53,
00376 IncomingCallsBarred = 54,
00377 IncomingCallsBarredInCUG = 55,
00378 BearerCapNotAuthorised = 57,
00379 BearerCapNotPresentlyAvailable = 58,
00380 InconsistentOutgoingIE = 62,
00381 ServiceOptionNotAvailable = 63,
00382 BearerCapNotImplemented = 65,
00383 ChannelTypeNotImplemented = 66,
00384 RequestedFacilityNotImplemented = 69,
00385 OnlyRestrictedDigitalBearerCapAvailable = 70,
00386 ServiceOrOptionNotImplemented = 79,
00387 InvalidCallReference = 81,
00388 IdentifiedChannelNonExistent = 82,
00389 CallIdentifyNotSuspendedCall = 83,
00390 CallIdentifyInUse = 84,
00391 NoCallSuspended = 85,
00392 ClearedRequestedCallIdentity = 86,
00393 UserNotInCUG = 87,
00394 IncompatibleDestination = 88,
00395 NonexistentCUG = 90,
00396 InvalidTransitNetwork = 91,
00397 InvalidMessageUnspecified = 95,
00398 MandatoryIEMissing = 96,
00399 MessageTypeNonexistent = 97,
00400 MessageNotCompatible = 98,
00401 IENonExistantOrNotImplemented = 99,
00402 InvalidIEContents = 100,
00403 MessageNotCompatibleWithCallState = 101,
00404 TimerExpiry = 102,
00405 ParameterNonexistent = 103,
00406 UnrecognisedParamaterDiscarded = 110,
00407 ProtocolErrorUnspecified = 111,
00408 InterworkingUnspecified = 127,
00409 ErrorInCauseIE = 0x100
00410 };
00411 friend ostream & operator<<(ostream & strm, CauseValues cause);
00412
00413 void SetCause(
00414 CauseValues value,
00415 unsigned standard = 0,
00416 unsigned location = 0
00417 );
00418 CauseValues GetCause(
00419 unsigned * standard = NULL,
00420 unsigned * location = NULL
00421 ) const;
00422
00423 enum CallStates {
00424 CallState_Null = 0,
00425 CallState_CallInitiated = 1,
00426 CallState_OverlapSending = 2,
00427 CallState_OutgoingCallProceeding= 3,
00428 CallState_CallDelivered = 4,
00429 CallState_CallPresent = 6,
00430 CallState_CallReceived = 7,
00431 CallState_ConnectRequest = 8,
00432 CallState_IncomingCallProceeding= 9,
00433 CallState_Active = 10,
00434 CallState_DisconnectRequest = 11,
00435 CallState_DisconnectIndication = 12,
00436 CallState_SuspendRequest = 15,
00437 CallState_ResumeRequest = 17,
00438 CallState_ReleaseRequest = 19,
00439 CallState_OverlapReceiving = 25,
00440 CallState_ErrorInIE = 0x100
00441 };
00442 void SetCallState(
00443 CallStates value,
00444 unsigned standard = 0
00445 );
00446 CallStates GetCallState(
00447 unsigned * standard = NULL
00448 ) const;
00449
00450 enum SignalInfo {
00451 SignalDialToneOn,
00452 SignalRingBackToneOn,
00453 SignalInterceptToneOn,
00454 SignalNetworkCongestionToneOn,
00455 SignalBusyToneOn,
00456 SignalConfirmToneOn,
00457 SignalAnswerToneOn,
00458 SignalCallWaitingTone,
00459 SignalOffhookWarningTone,
00460 SignalPreemptionToneOn,
00461 SignalTonesOff = 0x3f,
00462 SignalAlertingPattern0 = 0x40,
00463 SignalAlertingPattern1,
00464 SignalAlertingPattern2,
00465 SignalAlertingPattern3,
00466 SignalAlertingPattern4,
00467 SignalAlertingPattern5,
00468 SignalAlertingPattern6,
00469 SignalAlertingPattern7,
00470 SignalAlertingOff = 0x4f,
00471 SignalErrorInIE = 0x100
00472 };
00473 void SetSignalInfo(SignalInfo value);
00474 SignalInfo GetSignalInfo() const;
00475
00476 void SetKeypad(const PString & digits);
00477 PString GetKeypad() const;
00478
00479 enum ProgressIndication {
00480 ProgressNotEndToEndISDN = 1,
00481
00482 ProgressDestinationNonISDN = 2,
00483 ProgressOriginNotISDN = 3,
00484 ProgressReturnedToISDN = 4,
00485 ProgressServiceChange = 5,
00486
00487 ProgressInbandInformationAvailable = 8
00488 };
00489
00490 void SetProgressIndicator(
00491 unsigned description,
00492 unsigned codingStandard = 0,
00493 unsigned location = 0
00494 );
00495 BOOL GetProgressIndicator(
00496 unsigned & description,
00497 unsigned * codingStandard = NULL,
00498 unsigned * location = NULL
00499 ) const;
00500
00501 void SetDisplayName(const PString & name);
00502 PString GetDisplayName() const;
00503
00504 enum NumberingPlanCodes {
00505 UnknownPlan = 0x00,
00506 ISDNPlan = 0x01,
00507 DataPlan = 0x03,
00508 TelexPlan = 0x04,
00509 NationalStandardPlan = 0x08,
00510 PrivatePlan = 0x09,
00511 ReservedPlan = 0x0f
00512 };
00513
00514 enum TypeOfNumberCodes {
00515 UnknownType = 0x00,
00516 InternationalType = 0x01,
00517 NationalType = 0x02,
00518 NetworkSpecificType = 0x03,
00519 SubscriberType = 0x04,
00520 AbbreviatedType = 0x06,
00521 ReservedType = 0x07
00522 };
00523
00524 void SetCallingPartyNumber(
00525 const PString & number,
00526 unsigned plan = 1,
00527 unsigned type = 0,
00528 int presentation = -1,
00529 int screening = -1
00530 );
00531 BOOL GetCallingPartyNumber(
00532 PString & number,
00533 unsigned * plan = NULL,
00534 unsigned * type = NULL,
00535 unsigned * presentation = NULL,
00536 unsigned * screening = NULL,
00537 unsigned defPresentation = 0,
00538 unsigned defScreening = 0
00539 ) const;
00540
00541 void SetCalledPartyNumber(
00542 const PString & number,
00543 unsigned plan = 1,
00544 unsigned type = 0
00545 );
00546 BOOL GetCalledPartyNumber(
00547 PString & number,
00548 unsigned * plan = NULL,
00549 unsigned * type = NULL
00550 ) const;
00551
00552 void SetRedirectingNumber(
00553 const PString & number,
00554 unsigned plan = 1,
00555 unsigned type = 0,
00556 int presentation = -1,
00557 int screening = -1,
00558 int reason = -1
00559 );
00560 BOOL GetRedirectingNumber(
00561 PString & number,
00562 unsigned * plan = NULL,
00563 unsigned * type = NULL,
00564 unsigned * presentation = NULL,
00565 unsigned * screening = NULL,
00566 unsigned * reason = NULL,
00567 unsigned defPresentation = 0,
00568 unsigned defScreening = 0,
00569 unsigned defReason =0
00570 ) const;
00571
00572 void SetConnectedNumber(
00573 const PString & number,
00574 unsigned plan = 1,
00575 unsigned type = 0,
00576 int presentation = -1,
00577 int screening = -1,
00578 int reason = -1
00579 );
00580 BOOL GetConnectedNumber(
00581 PString & number,
00582 unsigned * plan = NULL,
00583 unsigned * type = NULL,
00584 unsigned * presentation = NULL,
00585 unsigned * screening = NULL,
00586 unsigned * reason = NULL,
00587 unsigned defPresentation = 0,
00588 unsigned defScreening = 0,
00589 unsigned defReason =0
00590 ) const;
00591
00598 void SetChannelIdentification(
00599 unsigned interfaceType = 0,
00600 unsigned preferredOrExclusive = 0,
00601 int channelNumber = 1
00602 );
00603
00606 BOOL GetChannelIdentification(
00607 unsigned * interfaceType = NULL,
00608 unsigned * preferredOrExclusive = NULL,
00609 int * channelNumber = NULL
00610 ) const;
00611
00612 protected:
00613 unsigned callReference;
00614 BOOL fromDestination;
00615 unsigned protocolDiscriminator;
00616 MsgTypes messageType;
00617
00618 PDICTIONARY(InternalInformationElements, POrdinalKey, PBYTEArray);
00619 InternalInformationElements informationElements;
00620 };
00621
00622
00623 #endif // __OPAL_Q931_H
00624
00625