t38proto.h
Go to the documentation of this file.
/*
* t38proto.h
*
* T.38 protocol handler
*
* Open Phone Abstraction Library
*
* Copyright (c) 2001 Equivalence Pty. 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 H323 Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Contributor(s): ______________________________________.
*
* $Revision: 28445 $
* $Author: rjongbloed $
* $Date: 2012-10-02 20:11:02 -0500 (Tue, 02 Oct 2012) $
*/
#ifndef OPAL_T38_T38PROTO_H
#define OPAL_T38_T38PROTO_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <opal/buildopts.h>
#if OPAL_FAX
#include <ptlib/pipechan.h>
#include <opal/mediafmt.h>
#include <opal/mediastrm.h>
#include <opal/localep.h>
class OpalTransport;
class T38_IFPPacket;
class PASN_OctetString;
class OpalFaxConnection;
#define OPAL_OPT_STATION_ID "Station-Id"
#define OPAL_OPT_HEADER_INFO "Header-Info"
#define OPAL_NO_G111_FAX "No-G711-Fax"
#define OPAL_SWITCH_ON_CED "Switch-On-CED"
#define OPAL_T38_SWITCH_TIME "T38-Switch-Time"
#define OPAL_FAX_TIFF_FILE "TIFF-File"
class OpalFaxConnection;
class OpalFaxEndPoint : public OpalLocalEndPoint
{
PCLASSINFO(OpalFaxEndPoint, OpalLocalEndPoint);
public:
OpalFaxEndPoint(
OpalManager & manager,
const char * g711Prefix = "fax",
const char * t38Prefix = "t38"
);
~OpalFaxEndPoint();
virtual PSafePtr<OpalConnection> MakeConnection(
OpalCall & call,
const PString & party,
void * userData = NULL,
unsigned int options = 0,
OpalConnection::StringOptions * stringOptions = NULL
);
virtual OpalMediaFormatList GetMediaFormats() const;
virtual bool IsAvailable() const;
virtual OpalFaxConnection * CreateConnection(
OpalCall & call,
void * userData,
OpalConnection::StringOptions * stringOptions,
const PString & filename,
bool receiving,
bool disableT38
);
virtual void OnFaxCompleted(
OpalFaxConnection & connection,
bool failed
);
const PString & GetDefaultDirectory() const { return m_defaultDirectory; }
void SetDefaultDirectory(
const PString & dir
) { m_defaultDirectory = dir; }
const PString & GetT38Prefix() const { return m_t38Prefix; }
protected:
PString m_t38Prefix;
PDirectory m_defaultDirectory;
};
class OpalFaxConnection : public OpalLocalConnection
{
PCLASSINFO(OpalFaxConnection, OpalLocalConnection);
public:
OpalFaxConnection(
OpalCall & call,
OpalFaxEndPoint & endpoint,
const PString & filename,
bool receiving,
bool disableT38,
OpalConnection::StringOptions * stringOptions = NULL
);
~OpalFaxConnection();
virtual PString GetPrefixName() const;
virtual OpalMediaFormatList GetMediaFormats() const;
virtual void AdjustMediaFormats(bool local, const OpalConnection * otherConnection, OpalMediaFormatList & mediaFormats) const;
virtual void OnEstablished();
virtual void OnReleased();
virtual OpalMediaStream * CreateMediaStream(const OpalMediaFormat & mediaFormat, unsigned sessionID, PBoolean isSource);
virtual void OnStartMediaPatch(OpalMediaPatch & patch);
virtual void OnStopMediaPatch(OpalMediaPatch & patch);
virtual PBoolean SendUserInputTone(char tone, unsigned duration);
virtual void OnUserInputTone(char tone, unsigned duration);
virtual bool SwitchFaxMediaStreams(bool toT38);
virtual void OnSwitchedFaxMediaStreams(bool toT38, bool success);
virtual bool OnSwitchingFaxMediaStreams(bool toT38);
virtual void OnFaxCompleted(
bool failed
);
#if OPAL_STATISTICS
virtual void GetStatistics(
OpalMediaStatistics & statistics
) const;
#endif
const PString & GetFileName() const { return m_filename; }
bool IsReceive() const { return m_receiving; }
protected:
PDECLARE_NOTIFIER(PTimer, OpalFaxConnection, OnSwitchTimeout);
PDECLARE_NOTIFIER(PThread, OpalFaxConnection, OpenFaxStreams);
void SetFaxMediaFormatOptions(OpalMediaFormat & mediaFormat) const;
OpalFaxEndPoint & m_endpoint;
PString m_filename;
bool m_receiving;
bool m_disableT38;
OpalMediaFormat m_tiffFileFormat;
#if OPAL_STATISTICS
void InternalGetStatistics(OpalMediaStatistics & statistics, bool terminate) const;
OpalMediaStatistics m_finalStatistics;
#endif
enum {
e_AwaitingSwitchToT38,
e_SwitchingToT38,
e_CompletedSwitch
} m_state;
PTimer m_switchTimer;
friend class OpalFaxMediaStream;
};
typedef OpalFaxConnection OpalT38Connection; // For backward compatibility
#endif // OPAL_FAX
#endif // OPAL_T38_T38PROTO_H
OpalFaxEndPoint::SetDefaultDirectory
void SetDefaultDirectory(const PString &dir)
Definition: t38proto.h:152
OpalFaxConnection::m_endpoint
OpalFaxEndPoint & m_endpoint
Definition: t38proto.h:255
OpalManager
Definition: manager.h:74
OpalFaxEndPoint::GetMediaFormats
virtual OpalMediaFormatList GetMediaFormats() const
OpalFaxConnection::SendUserInputTone
virtual PBoolean SendUserInputTone(char tone, unsigned duration)
OpalFaxConnection
Definition: t38proto.h:183
OpalFaxConnection::GetMediaFormats
virtual OpalMediaFormatList GetMediaFormats() const
OpalFaxConnection::SetFaxMediaFormatOptions
void SetFaxMediaFormatOptions(OpalMediaFormat &mediaFormat) const
OpalFaxConnection::e_CompletedSwitch
Definition: t38proto.h:268
OpalFaxConnection::AdjustMediaFormats
virtual void AdjustMediaFormats(bool local, const OpalConnection *otherConnection, OpalMediaFormatList &mediaFormats) const
buildopts.h
OpalFaxConnection::OnStartMediaPatch
virtual void OnStartMediaPatch(OpalMediaPatch &patch)
OpalLocalConnection
Definition: localep.h:360
OpalFaxConnection::e_AwaitingSwitchToT38
Definition: t38proto.h:266
OpalFaxConnection::OnSwitchingFaxMediaStreams
virtual bool OnSwitchingFaxMediaStreams(bool toT38)
OpalTransport
Definition: transports.h:703
OpalFaxEndPoint::OpalFaxEndPoint
OpalFaxEndPoint(OpalManager &manager, const char *g711Prefix="fax", const char *t38Prefix="t38")
OpalFaxConnection::m_state
enum OpalFaxConnection::@44 m_state
OpalFaxConnection::e_SwitchingToT38
Definition: t38proto.h:267
OpalFaxConnection::~OpalFaxConnection
~OpalFaxConnection()
OpalFaxConnection::IsReceive
bool IsReceive() const
Definition: t38proto.h:246
OpalFaxEndPoint::IsAvailable
virtual bool IsAvailable() const
OpalFaxConnection::OnFaxCompleted
virtual void OnFaxCompleted(bool failed)
OpalFaxConnection::GetFileName
const PString & GetFileName() const
Definition: t38proto.h:242
OpalFaxConnection::m_receiving
bool m_receiving
Definition: t38proto.h:257
OpalFaxConnection::m_tiffFileFormat
OpalMediaFormat m_tiffFileFormat
Definition: t38proto.h:259
localep.h
OpalFaxConnection::OpalFaxMediaStream
friend class OpalFaxMediaStream
Definition: t38proto.h:273
OpalFaxConnection::m_disableT38
bool m_disableT38
Definition: t38proto.h:258
OpalFaxConnection::m_switchTimer
PTimer m_switchTimer
Definition: t38proto.h:271
OpalFaxConnection::GetPrefixName
virtual PString GetPrefixName() const
OpalMediaFormatList
Definition: mediafmt.h:72
OpalLocalConnection::endpoint
OpalLocalEndPoint & endpoint
Definition: localep.h:522
OpalConnection::StringOptions
Definition: connection.h:462
OpalFaxEndPoint::CreateConnection
virtual OpalFaxConnection * CreateConnection(OpalCall &call, void *userData, OpalConnection::StringOptions *stringOptions, const PString &filename, bool receiving, bool disableT38)
OpalLocalEndPoint
Definition: localep.h:50
OpalMediaPatch
Definition: patch.h:60
OpalT38Connection
OpalFaxConnection OpalT38Connection
Definition: t38proto.h:277
OpalMediaFormat
Definition: mediafmt.h:724
OpalCall
Definition: call.h:65
OpalFaxConnection::m_finalStatistics
OpalMediaStatistics m_finalStatistics
Definition: t38proto.h:262
OpalFaxConnection::OnUserInputTone
virtual void OnUserInputTone(char tone, unsigned duration)
OpalFaxConnection::OnEstablished
virtual void OnEstablished()
OpalFaxConnection::PDECLARE_NOTIFIER
PDECLARE_NOTIFIER(PTimer, OpalFaxConnection, OnSwitchTimeout)
OpalFaxEndPoint::GetT38Prefix
const PString & GetT38Prefix() const
Definition: t38proto.h:156
OpalEndPoint::manager
OpalManager & manager
Definition: endpoint.h:807
OpalFaxConnection::CreateMediaStream
virtual OpalMediaStream * CreateMediaStream(const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource)
mediafmt.h
OpalFaxEndPoint::m_defaultDirectory
PDirectory m_defaultDirectory
Definition: t38proto.h:161
OpalFaxConnection::OnStopMediaPatch
virtual void OnStopMediaPatch(OpalMediaPatch &patch)
OpalMediaStream
Definition: mediastrm.h:111
OpalFaxEndPoint::~OpalFaxEndPoint
~OpalFaxEndPoint()
OpalConnection
Definition: connection.h:353
OpalFaxEndPoint::GetDefaultDirectory
const PString & GetDefaultDirectory() const
Definition: t38proto.h:148
OpalFaxConnection::OnSwitchedFaxMediaStreams
virtual void OnSwitchedFaxMediaStreams(bool toT38, bool success)
mediastrm.h
OpalFaxEndPoint::m_t38Prefix
PString m_t38Prefix
Definition: t38proto.h:160
OpalMediaStatistics
Definition: rtp.h:370
OpalFaxEndPoint
Definition: t38proto.h:80
OpalFaxConnection::InternalGetStatistics
void InternalGetStatistics(OpalMediaStatistics &statistics, bool terminate) const
OpalFaxConnection::m_filename
PString m_filename
Definition: t38proto.h:256
OpalFaxConnection::GetStatistics
virtual void GetStatistics(OpalMediaStatistics &statistics) const
OpalFaxConnection::OnReleased
virtual void OnReleased()
OpalFaxConnection::SwitchFaxMediaStreams
virtual bool SwitchFaxMediaStreams(bool toT38)
OpalFaxEndPoint::OnFaxCompleted
virtual void OnFaxCompleted(OpalFaxConnection &connection, bool failed)
OpalFaxEndPoint::MakeConnection
virtual PSafePtr< OpalConnection > MakeConnection(OpalCall &call, const PString &party, void *userData=NULL, unsigned int options=0, OpalConnection::StringOptions *stringOptions=NULL)
OpalFaxConnection::OpalFaxConnection
OpalFaxConnection(OpalCall &call, OpalFaxEndPoint &endpoint, const PString &filename, bool receiving, bool disableT38, OpalConnection::StringOptions *stringOptions=NULL)