iax2con.h
Go to the documentation of this file.
/*
*
* Inter Asterisk Exchange 2
*
* Open Phone Abstraction Library (OPAL)
*
* Describes the IAX2 extension of the OpalConnection class.
*
* Copyright (c) 2005 Indranet Technologies Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Open Phone Abstraction Library.
*
* The Initial Developer of the Original Code is Indranet Technologies Ltd.
*
* The author of this code is Derek J Smithies
*
* $Revision: 27078 $
* $Author: rjongbloed $
* $Date: 2012-02-29 22:40:38 -0600 (Wed, 29 Feb 2012) $
*/
#ifndef OPAL_IAX2_IAX2CON_H
#define OPAL_IAX2_IAX2CON_H
#ifndef _PTLIB_H
#include <ptlib.h>
#endif
#include <opal/buildopts.h>
#if OPAL_IAX2
#include <opal/connection.h>
#include <rtp/jitter.h>
#include <iax2/frame.h>
#include <iax2/iedata.h>
#include <iax2/processor.h>
#include <iax2/callprocessor.h>
#include <iax2/safestrings.h>
#include <iax2/sound.h>
class IAX2EndPoint;
class IAX2Connection : public OpalConnection
{
PCLASSINFO(IAX2Connection, OpalConnection);
public:
IAX2Connection(
OpalCall & call,
IAX2EndPoint & endpoint,
const PString & token,
void *userData,
const PString & remoteParty,
const PString & remotePartyName = PString::Empty()
);
~IAX2Connection();
void StartOperation();
virtual bool IsNetworkConnection() const { return true; }
virtual bool TransferConnection(
const PString & remoteParty
);
virtual void OnReleased();
OpalMediaFormatList GetMediaFormats() const { return remoteMediaFormats; }
void EndCallNow(
CallEndReason reason = EndedByLocalUser
);
void SendDtmf(const PString & dtmf);
virtual PBoolean SendUserInputString(const PString & value );
virtual PBoolean SendUserInputTone(char tone, unsigned duration );
PBoolean IsCallTerminating() { return iax2Processor.IsCallTerminating(); }
virtual void AnsweringCall(
AnswerCallResponse response
);
void OnConnected();
virtual PBoolean SetConnected();
void OnEstablished();
PBoolean SetAlerting(
const PString & calleeName,
PBoolean withMedia
);
virtual OpalMediaStream * CreateMediaStream(
const OpalMediaFormat & mediaFormat,
unsigned sessionID,
PBoolean isSource
);
void SetCallToken(PString newToken);
PString GetCallToken() { return iax2Processor.GetCallToken(); }
void TransmitFrameToRemoteEndpoint(IAX2Frame *src);
void PutSoundPacketToNetwork(PBYTEArray *sund);
void ReceivedSoundPacketFromNetwork(IAX2Frame *soundFrame);
PBoolean ReadSoundPacket(RTP_DataFrame & packet);
IAX2Remote & GetRemoteInfo() { return iax2Processor.GetRemoteInfo(); }
IAX2SequenceNumbers & GetSequenceInfo() { return iax2Processor.GetSequenceInfo(); }
const PTimeInterval & GetCallStartTick() { return iax2Processor.GetCallStartTick(); }
void OnSetUp();
PBoolean SetUpConnection();
PINDEX GetSupportedCodecs();
PINDEX GetPreferredCodec();
void BuildRemoteCapabilityTable(unsigned int remoteCapability, unsigned int format);
unsigned int ChooseCodec();
virtual bool Hold(
bool fromRemote,
bool placeOnHold
);
virtual bool IsOnHold(
bool fromRemote
);
void RemoteHoldConnection();
void RemoteRetrieveConnection();
void SetUserName(PString & inUserName) { userName = inUserName; };
PString GetUserName() const { return userName; };
void SetPassword(PString & inPassword) { password = inPassword; };
PString GetPassword() const { return password; };
virtual PBoolean ForwardCall(
const PString & forwardParty
);
void IncomingEthernetFrame (IAX2Frame *frame);
//static PBoolean IsStatusQueryEthernetFrame(IAX2Frame *frame);
IAX2EndPoint & GetEndPoint() { return endpoint; }
void ReportStatistics();
protected:
PString userName;
PString password;
IAX2EndPoint &endpoint;
OpalMediaFormatList remoteMediaFormats;
OpalMediaFormatList localMediaFormats;
IAX2CallProcessor & iax2Processor;
PBoolean local_hold;
PBoolean remote_hold;
OpalJitterBuffer jitterBuffer;
RTP_DataFrame::PayloadTypes opalPayloadType;
friend class IAX2CallProcessor;
};
#endif // OPAL_IAX2
#endif // OPAL_IAX2_IAX2CON_H
/* The comment below is magic for those who use emacs to edit this file.
* With the comment below, the tab key does auto indent to 2 spaces.
*
* Local Variables:
* mode:c
* c-basic-offset:2
* End:
*/
IAX2Connection::GetRemoteInfo
IAX2Remote & GetRemoteInfo()
Definition: iax2con.h:277
IAX2Connection::PutSoundPacketToNetwork
void PutSoundPacketToNetwork(PBYTEArray *sund)
IAX2Connection::RemoteHoldConnection
void RemoteHoldConnection()
IAX2SequenceNumbers
Definition: remote.h:230
IAX2Connection::GetCallToken
PString GetCallToken()
Definition: iax2con.h:255
IAX2Connection::SetCallToken
void SetCallToken(PString newToken)
sound.h
IAX2Processor::GetCallToken
PString GetCallToken()
IAX2Connection::OnConnected
void OnConnected()
IAX2Connection::remoteMediaFormats
OpalMediaFormatList remoteMediaFormats
Definition: iax2con.h:423
IAX2Connection::OnEstablished
void OnEstablished()
IAX2EndPoint
Definition: iax2ep.h:104
IAX2Remote
Definition: remote.h:59
IAX2Connection::SetAlerting
PBoolean SetAlerting(const PString &calleeName, PBoolean withMedia)
connection.h
IAX2Connection::password
PString password
Definition: iax2con.h:412
buildopts.h
IAX2Connection::CreateMediaStream
virtual OpalMediaStream * CreateMediaStream(const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource)
IAX2Connection
Definition: iax2con.h:63
IAX2Connection::ReportStatistics
void ReportStatistics()
IAX2Connection::iax2Processor
IAX2CallProcessor & iax2Processor
Definition: iax2con.h:430
IAX2Connection::GetSequenceInfo
IAX2SequenceNumbers & GetSequenceInfo()
Definition: iax2con.h:280
IAX2Connection::endpoint
IAX2EndPoint & endpoint
Definition: iax2con.h:419
IAX2Connection::remote_hold
PBoolean remote_hold
Definition: iax2con.h:436
IAX2CallProcessor::IsCallTerminating
PBoolean IsCallTerminating()
Definition: callprocessor.h:152
IAX2CallProcessor
Definition: callprocessor.h:57
IAX2Connection::BuildRemoteCapabilityTable
void BuildRemoteCapabilityTable(unsigned int remoteCapability, unsigned int format)
IAX2Connection::TransmitFrameToRemoteEndpoint
void TransmitFrameToRemoteEndpoint(IAX2Frame *src)
OpalConnection::remotePartyName
PString remotePartyName
Definition: connection.h:1800
IAX2Connection::Hold
virtual bool Hold(bool fromRemote, bool placeOnHold)
IAX2Connection::TransferConnection
virtual bool TransferConnection(const PString &remoteParty)
IAX2Connection::SetConnected
virtual PBoolean SetConnected()
IAX2Connection::ChooseCodec
unsigned int ChooseCodec()
RTP_DataFrame::PayloadTypes
PayloadTypes
Definition: rtp.h:86
IAX2Connection::EndCallNow
void EndCallNow(CallEndReason reason=EndedByLocalUser)
IAX2Connection::SetPassword
void SetPassword(PString &inPassword)
Definition: iax2con.h:369
IAX2Connection::OnSetUp
void OnSetUp()
IAX2Processor::GetCallStartTick
const PTimeInterval & GetCallStartTick()
Definition: processor.h:181
OpalMediaFormatList
Definition: mediafmt.h:72
IAX2Connection::userName
PString userName
Definition: iax2con.h:409
OpalConnection::AnswerCallResponse
AnswerCallResponse
Definition: connection.h:417
frame.h
IAX2Connection::GetCallStartTick
const PTimeInterval & GetCallStartTick()
Definition: iax2con.h:283
RTP_DataFrame
Definition: rtp.h:71
OpalJitterBuffer
Definition: jitter.h:55
OpalMediaFormat
Definition: mediafmt.h:724
IAX2Connection::GetUserName
PString GetUserName() const
Definition: iax2con.h:361
IAX2Connection::GetMediaFormats
OpalMediaFormatList GetMediaFormats() const
Definition: iax2con.h:144
IAX2Connection::IsOnHold
virtual bool IsOnHold(bool fromRemote)
IAX2Processor::GetRemoteInfo
IAX2Remote & GetRemoteInfo()
Definition: processor.h:178
OpalCall
Definition: call.h:65
iedata.h
IAX2Connection::ReadSoundPacket
PBoolean ReadSoundPacket(RTP_DataFrame &packet)
IAX2Connection::jitterBuffer
OpalJitterBuffer jitterBuffer
Definition: iax2con.h:442
IAX2Connection::opalPayloadType
RTP_DataFrame::PayloadTypes opalPayloadType
Definition: iax2con.h:451
IAX2Connection::SetUserName
void SetUserName(PString &inUserName)
Definition: iax2con.h:358
IAX2Connection::IsNetworkConnection
virtual bool IsNetworkConnection() const
Definition: iax2con.h:101
callprocessor.h
IAX2Connection::SendDtmf
void SendDtmf(const PString &dtmf)
IAX2Connection::GetPassword
PString GetPassword() const
Definition: iax2con.h:372
IAX2Connection::OnReleased
virtual void OnReleased()
IAX2Connection::GetPreferredCodec
PINDEX GetPreferredCodec()
IAX2Connection::StartOperation
void StartOperation()
processor.h
IAX2Connection::RemoteRetrieveConnection
void RemoteRetrieveConnection()
IAX2Connection::IsCallTerminating
PBoolean IsCallTerminating()
Definition: iax2con.h:161
IAX2Connection::SetUpConnection
PBoolean SetUpConnection()
IAX2Connection::ForwardCall
virtual PBoolean ForwardCall(const PString &forwardParty)
IAX2Connection::localMediaFormats
OpalMediaFormatList localMediaFormats
Definition: iax2con.h:427
IAX2Connection::GetEndPoint
IAX2EndPoint & GetEndPoint()
Definition: iax2con.h:399
OpalMediaStream
Definition: mediastrm.h:111
IAX2Connection::AnsweringCall
virtual void AnsweringCall(AnswerCallResponse response)
IAX2Connection::local_hold
PBoolean local_hold
Definition: iax2con.h:433
IAX2Processor::GetSequenceInfo
IAX2SequenceNumbers & GetSequenceInfo()
Definition: processor.h:148
OpalConnection
Definition: connection.h:353
IAX2Connection::IAX2Connection
IAX2Connection(OpalCall &call, IAX2EndPoint &endpoint, const PString &token, void *userData, const PString &remoteParty, const PString &remotePartyName=PString::Empty())
IAX2Connection::SendUserInputTone
virtual PBoolean SendUserInputTone(char tone, unsigned duration)
IAX2Frame
Definition: frame.h:75
safestrings.h
IAX2Connection::~IAX2Connection
~IAX2Connection()
IAX2Connection::SendUserInputString
virtual PBoolean SendUserInputString(const PString &value)
jitter.h
OpalConnection::EndedByLocalUser
Definition: connection.h:362
IAX2Connection::GetSupportedCodecs
PINDEX GetSupportedCodecs()
IAX2Connection::ReceivedSoundPacketFromNetwork
void ReceivedSoundPacketFromNetwork(IAX2Frame *soundFrame)
IAX2Connection::IncomingEthernetFrame
void IncomingEthernetFrame(IAX2Frame *frame)