/usr/include/opal/t38/t38proto.h is in libopal-dev 3.10.10~dfsg-2.1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | /*
* 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" ///< String option for fax station ID string
#define OPAL_OPT_HEADER_INFO "Header-Info" ///< String option for transmitted fax page header
#define OPAL_NO_G111_FAX "No-G711-Fax" ///< Suppress G.711 fall back
#define OPAL_SWITCH_ON_CED "Switch-On-CED" ///< Try switch to T.38 on receipt of CED tone
#define OPAL_T38_SWITCH_TIME "T38-Switch-Time" ///< Seconds for fail safe switch to T.38 mode
#define OPAL_FAX_TIFF_FILE "TIFF-File"
///////////////////////////////////////////////////////////////////////////////
class OpalFaxConnection;
/** Fax Endpoint.
This class represents connection that can take a standard group 3 fax
TIFF file and produce either T.38 packets or actual tones represented
by a stream of PCM. For T.38 it is expected the second connection in the
call supports T.38 e.g. SIP or H.323. If PCM is being used then the second
connection may be anything that supports PCM, such as SIP or H.323 using
G.711 codec or OpalLineEndpoint which could the send the TIFF file to a
physical fax machine.
Relies on the presence of the spandsp plug in to do the hard work.
*/
class OpalFaxEndPoint : public OpalLocalEndPoint
{
PCLASSINFO(OpalFaxEndPoint, OpalLocalEndPoint);
public:
/**@name Construction */
//@{
/**Create a new endpoint.
*/
OpalFaxEndPoint(
OpalManager & manager, ///< Manager of all endpoints.
const char * g711Prefix = "fax", ///< Prefix for URL style address strings
const char * t38Prefix = "t38" ///< Prefix for URL style address strings
);
/**Destroy endpoint.
*/
~OpalFaxEndPoint();
//@}
/**@name Overrides from OpalEndPoint */
//@{
virtual PSafePtr<OpalConnection> MakeConnection(
OpalCall & call, ///< Owner of connection
const PString & party, ///< Remote party to call
void * userData = NULL, ///< Arbitrary data to pass to connection
unsigned int options = 0, ///< options to pass to conneciton
OpalConnection::StringOptions * stringOptions = NULL ///< Options to pass to connection
);
/**Get the data formats this endpoint is capable of operating.
This provides a list of media data format names that may be used by an
OpalMediaStream may be created by a connection from this endpoint.
Note that a specific connection may not actually support all of the
media formats returned here, but should return no more.
*/
virtual OpalMediaFormatList GetMediaFormats() const;
//@}
/**@name Fax specific operations */
//@{
/**Determine if the fax plug in is available, that is fax system can be used.
*/
virtual bool IsAvailable() const;
/**Create a connection for the fax endpoint.
*/
virtual OpalFaxConnection * CreateConnection(
OpalCall & call, ///< Owner of connection
void * userData, ///< Arbitrary data to pass to connection
OpalConnection::StringOptions * stringOptions, ///< Options to pass to connection
const PString & filename, ///< filename to send/receive
bool receiving, ///< Flag for receiving/sending fax
bool disableT38 ///< Flag to disable use of T.38
);
/**Fax transmission/receipt completed.
Default behaviour releases the connection.
*/
virtual void OnFaxCompleted(
OpalFaxConnection & connection, ///< Connection that completed.
bool failed ///< Fax ended with failure
);
//@}
/**@name Member variable access */
/**Get the default directory for received faxes.
*/
const PString & GetDefaultDirectory() const { return m_defaultDirectory; }
/**Set the default directory for received faxes.
*/
void SetDefaultDirectory(
const PString & dir /// New directory for fax reception
) { m_defaultDirectory = dir; }
const PString & GetT38Prefix() const { return m_t38Prefix; }
//@}
protected:
PString m_t38Prefix;
PDirectory m_defaultDirectory;
};
///////////////////////////////////////////////////////////////////////////////
/** Fax Connection.
There are six modes of operation:
Mode receiving disableT38 filename
TIFF -> T.38 false false "something.tif"
T.38 -> TIFF true false "something.tif"
TIFF -> G.711 false true "something.tif"
G.711 ->TIFF true true "something.tif"
T.38 -> G.711 false don't care PString::Empty()
G.711 -> T.38 true don't care PString::Empty()
If T.38 is involved then there is generally two stages to the setup, as
indicated by the m_switchedToT38 flag. When false then we are in audio
mode looking for CNG/CED tones. When true, then we are switching, or have
switched, to T.38 operation. If the switch fails, then the m_disableT38
is set and we proceed in fall back mode.
*/
class OpalFaxConnection : public OpalLocalConnection
{
PCLASSINFO(OpalFaxConnection, OpalLocalConnection);
public:
/**@name Construction */
//@{
/**Create a new endpoint.
*/
OpalFaxConnection(
OpalCall & call, ///< Owner calll for connection
OpalFaxEndPoint & endpoint, ///< Owner endpoint for connection
const PString & filename, ///< TIFF file name to send/receive
bool receiving, ///< True if receiving a fax
bool disableT38, ///< True if want to force G.711
OpalConnection::StringOptions * stringOptions = NULL ///< Options to pass to connection
);
/**Destroy endpoint.
*/
~OpalFaxConnection();
//@}
/**@name Overrides from OpalLocalConnection */
//@{
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);
//@}
/**@name New operations */
//@{
/**Fax transmission/receipt completed.
Default behaviour calls equivalent function on OpalFaxEndPoint.
*/
virtual void OnFaxCompleted(
bool failed ///< Fax ended with failure
);
#if OPAL_STATISTICS
/**Get fax transmission/receipt statistics.
*/
virtual void GetStatistics(
OpalMediaStatistics & statistics ///< Statistics for call
) const;
#endif
/**Get the file to send/receive
*/
const PString & GetFileName() const { return m_filename; }
/**Get receive fax flag.
*/
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
|