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
#ifndef __OPAL_Q931_H
00200
#define __OPAL_Q931_H
00201
00202
#ifdef P_USE_PRAGMA
00203
#pragma interface
00204
#endif
00205
00206
00208
00211 class Q931 :
public PObject
00212 {
00213 PCLASSINFO(
Q931, PObject)
00214
public:
00215 enum MsgTypes {
00216
NationalEscapeMsg = 0x00,
00217
AlertingMsg = 0x01,
00218
CallProceedingMsg = 0x02,
00219
ConnectMsg = 0x07,
00220
ConnectAckMsg = 0x0f,
00221
ProgressMsg = 0x03,
00222
SetupMsg = 0x05,
00223
SetupAckMsg = 0x0d,
00224
ResumeMsg = 0x26,
00225
ResumeAckMsg = 0x2e,
00226
ResumeRejectMsg = 0x22,
00227
SuspendMsg = 0x25,
00228
SuspendAckMsg = 0x2d,
00229
SuspendRejectMsg = 0x21,
00230
UserInformationMsg = 0x20,
00231
DisconnectMsg = 0x45,
00232
ReleaseMsg = 0x4d,
00233
ReleaseCompleteMsg = 0x5a,
00234
RestartMsg = 0x46,
00235
RestartAckMsg = 0x4e,
00236
SegmentMsg = 0x60,
00237
CongestionCtrlMsg = 0x79,
00238
InformationMsg = 0x7b,
00239
NotifyMsg = 0x6e,
00240
StatusMsg = 0x7d,
00241
StatusEnquiryMsg = 0x75,
00242
FacilityMsg = 0x62
00243 };
00244
00245
Q931();
00246
Q931(
const Q931 & other);
00247
Q931 & operator=(
const Q931 & other);
00248
00249
void BuildFacility(
int callRef, BOOL fromDest);
00250
void BuildInformation(
int callRef, BOOL fromDest);
00251
void BuildProgress(
00252
int callRef,
00253 BOOL fromDest,
00254
unsigned description,
00255
unsigned codingStandard = 0,
00256
unsigned location = 0
00257 );
00258
void BuildNotify(
int callRef, BOOL fromDest);
00259
void BuildCallProceeding(
int callRef);
00260
void BuildSetupAcknowledge(
int callRef);
00261
void BuildAlerting(
int callRef);
00262
void BuildSetup(
int callRef = -1);
00263
void BuildConnect(
int callRef);
00264
void BuildConnectAck(
int callRef, BOOL fromDest);
00265
void BuildStatus(
int callRef, BOOL fromDest);
00266
void BuildStatusEnquiry(
int callRef, BOOL fromDest);
00267
void BuildReleaseComplete(
int callRef, BOOL fromDest);
00268
00269 BOOL Decode(
const PBYTEArray & data);
00270 BOOL Encode(PBYTEArray & data)
const;
00271
00272
void PrintOn(ostream & strm)
const;
00273 PString
GetMessageTypeName() const;
00274
00275 static
unsigned GenerateCallReference();
00276 unsigned GetCallReference()
const {
return callReference; }
00277 BOOL
IsFromDestination()
const {
return fromDestination; }
00278 MsgTypes GetMessageType()
const {
return messageType; }
00279
00280 enum InformationElementCodes {
00281
BearerCapabilityIE = 0x04,
00282
CauseIE = 0x08,
00283
ChannelIdentificationIE = 0x18,
00284
FacilityIE = 0x1c,
00285
ProgressIndicatorIE = 0x1e,
00286
CallStateIE = 0x14,
00287
DisplayIE = 0x28,
00288
KeypadIE = 0x2c,
00289
SignalIE = 0x34,
00290
ConnectedNumberIE = 0x4c,
00291
CallingPartyNumberIE = 0x6c,
00292
CalledPartyNumberIE = 0x70,
00293
RedirectingNumberIE = 0x74,
00294
UserUserIE = 0x7e
00295 };
00296
friend ostream & operator<<(ostream & strm, InformationElementCodes ie);
00297
00298 BOOL HasIE(InformationElementCodes ie)
const;
00299 PBYTEArray GetIE(InformationElementCodes ie)
const;
00300
void SetIE(InformationElementCodes ie,
const PBYTEArray & userData);
00301
void RemoveIE(InformationElementCodes ie);
00302
00303 enum InformationTransferCapability {
00304
TransferSpeech,
00305
TransferUnrestrictedDigital = 8,
00306
TransferRestrictedDigital = 9,
00307
Transfer3_1kHzAudio = 16,
00308
TrasnferUnrestrictedDigitalWithTones = 17,
00309
TransferVideo = 24
00310 };
00311
00312
void SetBearerCapabilities(
00313 InformationTransferCapability capability,
00314
unsigned transferRate,
00315
unsigned codingStandard = 0,
00316
unsigned userInfoLayer1 = 5
00317 );
00318
00319 BOOL GetBearerCapabilities(
00320 InformationTransferCapability & capability,
00321
unsigned & transferRate,
00322
unsigned * codingStandard = NULL,
00323
unsigned * userInfoLayer1 = NULL
00324 );
00325
00326 enum CauseValues {
00327
UnknownCauseIE = 0,
00328
UnallocatedNumber = 1,
00329
NoRouteToNetwork = 2,
00330
NoRouteToDestination = 3,
00331
SendSpecialTone = 4,
00332
MisdialledTrunkPrefix = 5,
00333
ChannelUnacceptable = 6,
00334
NormalCallClearing = 16,
00335
UserBusy = 17,
00336
NoResponse = 18,
00337
NoAnswer = 19,
00338
SubscriberAbsent = 20,
00339
CallRejected = 21,
00340
NumberChanged = 22,
00341
Redirection = 23,
00342
ExchangeRoutingError = 25,
00343
NonSelectedUserClearing = 26,
00344
DestinationOutOfOrder = 27,
00345
InvalidNumberFormat = 28,
00346
FacilityRejected = 29,
00347
StatusEnquiryResponse = 30,
00348
NormalUnspecified = 31,
00349
NoCircuitChannelAvailable = 34,
00350
NetworkOutOfOrder = 38,
00351
TemporaryFailure = 41,
00352
Congestion = 42,
00353
RequestedCircuitNotAvailable = 44,
00354
ResourceUnavailable = 47,
00355
ServiceOptionNotAvailable = 63,
00356
InvalidCallReference = 81,
00357
ClearedRequestedCallIdentity = 86,
00358
IncompatibleDestination = 88,
00359
IENonExistantOrNotImplemented= 99,
00360
TimerExpiry = 102,
00361
ProtocolErrorUnspecified = 111,
00362
InterworkingUnspecified = 127,
00363
ErrorInCauseIE = 0x100
00364 };
00365
friend ostream & operator<<(ostream & strm, CauseValues cause);
00366
00367
void SetCause(
00368 CauseValues value,
00369
unsigned standard = 0,
00370
unsigned location = 0
00371 );
00372 CauseValues GetCause(
00373
unsigned * standard = NULL,
00374
unsigned * location = NULL
00375 )
const;
00376
00377 enum CallStates {
00378
CallState_Null = 0,
00379
CallState_CallInitiated = 1,
00380
CallState_OverlapSending = 2,
00381
CallState_OutgoingCallProceeding= 3,
00382
CallState_CallDelivered = 4,
00383
CallState_CallPresent = 6,
00384
CallState_CallReceived = 7,
00385
CallState_ConnectRequest = 8,
00386
CallState_IncomingCallProceeding= 9,
00387
CallState_Active = 10,
00388
CallState_DisconnectRequest = 11,
00389
CallState_DisconnectIndication = 12,
00390
CallState_SuspendRequest = 15,
00391
CallState_ResumeRequest = 17,
00392
CallState_ReleaseRequest = 19,
00393
CallState_OverlapReceiving = 25,
00394
CallState_ErrorInIE = 0x100
00395 };
00396
void SetCallState(
00397 CallStates value,
00398
unsigned standard = 0
00399 );
00400 CallStates GetCallState(
00401
unsigned * standard = NULL
00402 )
const;
00403
00404 enum SignalInfo {
00405
SignalDialToneOn,
00406
SignalRingBackToneOn,
00407
SignalInterceptToneOn,
00408
SignalNetworkCongestionToneOn,
00409
SignalBusyToneOn,
00410
SignalConfirmToneOn,
00411
SignalAnswerToneOn,
00412
SignalCallWaitingTone,
00413
SignalOffhookWarningTone,
00414
SignalPreemptionToneOn,
00415
SignalTonesOff = 0x3f,
00416
SignalAlertingPattern0 = 0x40,
00417
SignalAlertingPattern1,
00418
SignalAlertingPattern2,
00419
SignalAlertingPattern3,
00420
SignalAlertingPattern4,
00421
SignalAlertingPattern5,
00422
SignalAlertingPattern6,
00423
SignalAlertingPattern7,
00424
SignalAlertingOff = 0x4f,
00425
SignalErrorInIE = 0x100
00426 };
00427
void SetSignalInfo(SignalInfo value);
00428 SignalInfo
GetSignalInfo() const;
00429
00430
void SetKeypad(const PString & digits);
00431 PString GetKeypad() const;
00432
00433 enum ProgressIndication {
00434
ProgressNotEndToEndISDN = 1,
00435
00436
ProgressDestinationNonISDN = 2,
00437
ProgressOriginNotISDN = 3,
00438
ProgressReturnedToISDN = 4,
00439
ProgressServiceChange = 5,
00440
00441
ProgressInbandInformationAvailable = 8
00442 };
00443
00444
void SetProgressIndicator(
00445
unsigned description,
00446
unsigned codingStandard = 0,
00447
unsigned location = 0
00448 );
00449 BOOL GetProgressIndicator(
00450
unsigned & description,
00451
unsigned * codingStandard = NULL,
00452
unsigned * location = NULL
00453 )
const;
00454
00455
void SetDisplayName(
const PString & name);
00456 PString
GetDisplayName() const;
00457
00458 enum NumberingPlanCodes {
00459
UnknownPlan = 0x00,
00460
ISDNPlan = 0x01,
00461
DataPlan = 0x03,
00462
TelexPlan = 0x04,
00463
NationalStandardPlan = 0x08,
00464
PrivatePlan = 0x09,
00465
ReservedPlan = 0x0f
00466 };
00467
00468 enum TypeOfNumberCodes {
00469
UnknownType = 0x00,
00470
InternationalType = 0x01,
00471
NationalType = 0x02,
00472
NetworkSpecificType = 0x03,
00473
SubscriberType = 0x04,
00474
AbbreviatedType = 0x06,
00475
ReservedType = 0x07
00476 };
00477
00478
void SetCallingPartyNumber(
00479
const PString & number,
00480
unsigned plan = 1,
00481
unsigned type = 0,
00482
int presentation = -1,
00483
int screening = -1
00484 );
00485 BOOL GetCallingPartyNumber(
00486 PString & number,
00487
unsigned * plan = NULL,
00488
unsigned * type = NULL,
00489
unsigned * presentation = NULL,
00490
unsigned * screening = NULL,
00491
unsigned defPresentation = 0,
00492
unsigned defScreening = 0
00493 )
const;
00494
00495
void SetCalledPartyNumber(
00496
const PString & number,
00497
unsigned plan = 1,
00498
unsigned type = 0
00499 );
00500 BOOL GetCalledPartyNumber(
00501 PString & number,
00502
unsigned * plan = NULL,
00503
unsigned * type = NULL
00504 )
const;
00505
00506
void SetRedirectingNumber(
00507
const PString & number,
00508
unsigned plan = 1,
00509
unsigned type = 0,
00510
int presentation = -1,
00511
int screening = -1,
00512
int reason = -1
00513 );
00514 BOOL GetRedirectingNumber(
00515 PString & number,
00516
unsigned * plan = NULL,
00517
unsigned * type = NULL,
00518
unsigned * presentation = NULL,
00519
unsigned * screening = NULL,
00520
unsigned * reason = NULL,
00521
unsigned defPresentation = 0,
00522
unsigned defScreening = 0,
00523
unsigned defReason =0
00524 )
const;
00525
00526
void SetConnectedNumber(
00527
const PString & number,
00528
unsigned plan = 1,
00529
unsigned type = 0,
00530
int presentation = -1,
00531
int screening = -1,
00532
int reason = -1
00533 );
00534 BOOL GetConnectedNumber(
00535 PString & number,
00536
unsigned * plan = NULL,
00537
unsigned * type = NULL,
00538
unsigned * presentation = NULL,
00539
unsigned * screening = NULL,
00540
unsigned * reason = NULL,
00541
unsigned defPresentation = 0,
00542
unsigned defScreening = 0,
00543
unsigned defReason =0
00544 )
const;
00545
00552
void SetChannelIdentification(
00553
unsigned interfaceType = 0,
00554
unsigned preferredOrExclusive = 0,
00555
int channelNumber = 1
00556 );
00557
00560 BOOL GetChannelIdentification(
00561
unsigned * interfaceType = NULL,
00562
unsigned * preferredOrExclusive = NULL,
00563
int * channelNumber = NULL
00564 )
const;
00565
00566
protected:
00567 unsigned callReference;
00568 BOOL
fromDestination;
00569 unsigned protocolDiscriminator;
00570 MsgTypes messageType;
00571
00572
PDICTIONARY(InternalInformationElements, POrdinalKey, PBYTEArray);
00573 InternalInformationElements
informationElements;
00574 };
00575
00576
00577
#endif // __OPAL_Q931_H
00578
00579