IAX2 section of the OPAL library

# Overview

    This is the IAX2 section of the OPAL library.

    It is an implementation of the IAX2 voip protocol.

Version
  1.0

Author
  Derek J Smithies

# Architecture

There is one instance of a IAX2Receiver class, which listens on port 4569 for incoming IAX2 packets. Incoming packets (from all calls) go via the one instance of the IAX2Receiver class.

Incoming packets may be used to generate a new IAX2Connection class (if it is a request to open a call). Incoming packets are then passed on to the IAX2Connection class for handling. Note that all connections listen to the same IAX2Receiver.

There is one instance of a IAX2Transmit class, which sends data out port 4569 to the remote endpoint. Outgoing packets (from all calls) go via the one instance of a IAX2Transmit class. Note that all connections send data to the same IAX2Transmit.

# Available classes

## The following classes are key to the implementation of IAX2 in the opal library

- IAX2FrameIdValue - Element of an internal list, used to keep track of incoming IAX2FullFrame out sequence numbers.
- IAX2FrameList - A list of frames, which can be accessed in a thread safe fashion.
- IAX2Connection - Manage the IAX2 protocol for one call, and connect to Opal
- IAX2EndPoint - Manage the IAX2 protocol specific issues which are common to all calls, and connect to Opal.
- IAX2Processor - Separate thread to handle all IAX2 protocol requests, and transfer media frames.
- IAX2IncomingEthernetFrames - Separate thread to transfer all frames from the IAX2Receiver to the appropriate IAX2Connection.
- OpalIAX2MediaStream - Transfer media frames between IAX2Connection to Opal.
- IAX2PacketIdList - A list of IAX2FrameIdValue elements, which is used to keep track of incoming IAX2FullFrame out sequence numbers
- IAX2Receiver - Handles the reception of data from the remote node
- IAX2Remote - contain information about the remote node.
- SafeString - handle a PString in a thread safe fashion.
- SafeStrings - Handle a PStringArray in a thread safe fashion.
- IAX2SoundList - Maintain a list of the sound packets as read from the microphone.
- IAX2Transmit - Send IAX2 packets to the remote node, and handle retransmit issues.
- IAX2WaitingForAck - A predefined action, that is to carried out (by one particular IAX2Processor) on receiving an ack.

## classes for holding the UDP data about to be sent to (or received from) the network.

- IAX2Frame - the parent class of all frames.
- IAX2MiniFrame - a UDP frame of data for sending voice/audio. Not as large as a IAX2FullFrame
- IAX2FullFrame - the parent class of all full frames.
- IAX2FullFrameCng - Transfers Cng (comfort noise generation)
- IAX2FullFrameDtmf
- IAX2FullFrameHtml
- IAX2FullFrameImage
- IAX2FullFrameNull
- IAX2FullFrameProtocol - managing the session (and doesn't really do anything in IAX2)
- IAX2FullFrameSessionControl - carries information about call control, registration, authentication etc.
- IAX2FullFrameText
- IAX2FullFrameVideo
- IAX2FullFrameVoice

## classes for carrying information in the IAX2FullFrameSessionControl UDP frames

- IAX2Ie - the parent of all information element types

## classes for the different data types expressed in an Ie

- IAX2IeBinary - a series of Bytes in the data field.
- IAX2IeByte - Byte of data in data field.
- IAX2IeChar - character of data in the data field
- IAX2IeDateAndTime - data field contains a 32 bit number with date and time (2 sec resolution)
- IAX2IeInt - data field contains an integer.
- IAX2IeNone - there is no data field.
- IAX2IeShort - data field contains a short
- IAX2IeSockaddrIn - data field contains a sockaddr_in, which is address and port
- IAX2IeString - data field contains a string - there is no zero byte at the end.
- IAX2IeUInt - data field contains an unsigned int.
- IAX2IeUShort - data field contains an unsigned short.

## Classes for each of the possible Ie types

- IAX2IeAdsicpe
- IAX2IeAesProvisioning
- IAX2IeApparentAddr
- IAX2IeAuthMethods
- IAX2IeAutoAnswer
- IAX2IeBlockOfData
- IAX2IeCallNo
- IAX2IeCalledContext
- IAX2IeCalledNumber
- IAX2IeCallingAni
- IAX2IeCallingName
- IAX2IeCallingNumber
- IAX2IeCallingPres
- IAX2IeCallingTns
- IAX2IeCallingTon
- IAX2IeCallToken
- IAX2IeCapability
- IAX2IeCause - text description of what happened (typically used at call completion, explaining why the call was finished)
- IAX2IeCauseCode - numeric value describing why the call was completed.
- IAX2IeChallenge
- IAX2IeCodecPrefs
- IAX2IeData
- IAX2IeDateAndTime
- IAX2IeDateTime - 32 bit value (2 sec accuracy) of the date and time. Year is in range of 2000-2127.
- IAX2IeDeviceType
- IAX2IeDnid
- IAX2IeDpStatus
- IAX2IeDroppedFrames
- IAX2IeEncKey
- IAX2IeEncryption
- IAX2IeFirmwareVer
- IAX2IeFormat
- IAX2IeFwBlockData
- IAX2IeFwBlockDesc
- IAX2IeIaxUnknown
- IAX2IeInvalidElement
- IAX2IeLanguage
- IAX2IeList
- IAX2IeMd5Result
- IAX2IeMsgCount
- IAX2IeMusicOnHold
- IAX2IePassword
- IAX2IeProvVer
- IAX2IeProvisioning
- IAX2IeRdnis
- IAX2IeReceivedDelay
- IAX2IeReceivedFrames
- IAX2IeReceivedJitter
- IAX2IeReceivedLoss
- IAX2IeReceivedOoo
- IAX2IeRefresh
- IAX2IeRsaResult
- IAX2IeSamplingRate - sampling rate in hertz. Typically, the value is 8000
- IAX2IeServiceIdent
- IAX2IeTransferId
- IAX2IeUserName - data field contains the username of the transmitting node
- IAX2IeVersion - version of IAX in opertion, typically the value is 2