27 #ifndef OPAL_T38_T38PROTO_H
28 #define OPAL_T38_T38PROTO_H
36 #if OPAL_T38_CAPABILITY
45 class OpalFaxConnection;
49 class PASN_OctetString;
52 #define OPAL_OPT_STATION_ID "Station-Id"
53 #define OPAL_OPT_HEADER_INFO "Header-Info"
54 #define OPAL_NO_G711_FAX "No-G711-Fax"
55 #define OPAL_SWITCH_ON_CED "Switch-On-CED"
56 #define OPAL_T38_SWITCH_TIME "T38-Switch-Time"
58 #define OPAL_FAX_TIFF_FILE "TIFF-File"
60 #define OPAL_T38FaxRateManagement "T38FaxRateManagement"
61 #define OPAL_T38localTCF "localTCF"
62 #define OPAL_T38transferredTCF "transferredTCF"
63 #define OPAL_T38FaxVersion "T38FaxVersion"
64 #define OPAL_T38MaxBitRate "T38MaxBitRate"
65 #define OPAL_T38FaxMaxBuffer "T38FaxMaxBuffer"
66 #define OPAL_T38FaxMaxDatagram "T38FaxMaxDatagram"
67 #define OPAL_T38FaxUdpEC "T38FaxUdpEC"
68 #define OPAL_T38UDPFEC "t38UDPFEC"
69 #define OPAL_T38UDPRedundancy "t38UDPRedundancy"
70 #define OPAL_T38FaxFillBitRemoval "T38FaxFillBitRemoval"
71 #define OPAL_T38FaxTranscodingMMR "T38FaxTranscodingMMR"
72 #define OPAL_T38FaxTranscodingJBIG "T38FaxTranscodingJBIG"
73 #define OPAL_T38UseECM "Use-ECM"
74 #define OPAL_FaxStationIdentifier "Station-Identifier"
75 #define OPAL_FaxHeaderInfo "Header-Info"
76 #define OPAL_UDPTLRawMode "UDPTL-Raw-Mode"
77 #define OPAL_UDPTLRedundancy "UDPTL-Redundancy"
78 #define OPAL_UDPTLRedundancyInterval "UDPTL-Redundancy-Interval"
79 #define OPAL_UDPTLOptimiseRetransmit "UDPTL-Optimise-On-Retransmit"
80 #define OPAL_UDPTLKeepAliveInterval "UDPTL-Keep-Alive-Interval"
88 class OpalFaxConnection;
111 const char * g711Prefix =
"fax",
112 const char * t38Prefix =
"t38"
124 const PString & party,
125 void * userData = NULL,
126 unsigned int options = 0,
148 virtual bool IsAvailable()
const;
156 const PString & filename,
164 virtual void OnFaxCompleted(
165 OpalFaxConnection & connection,
173 const PString & GetDefaultDirectory()
const {
return m_defaultDirectory; }
177 void SetDefaultDirectory(
179 ) { m_defaultDirectory = dir; }
181 const PString & GetT38Prefix()
const {
return m_t38Prefix; }
186 PDirectory m_defaultDirectory;
218 OpalFaxEndPoint & endpoint,
219 const PString & filename,
227 ~OpalFaxConnection();
243 virtual bool SwitchFaxMediaStreams(
bool toT38);
244 virtual void OnSwitchedFaxMediaStreams(
bool toT38,
bool success);
245 virtual bool OnSwitchingFaxMediaStreams(
bool toT38);
254 virtual void OnFaxCompleted(
266 const PString & GetFileName()
const {
return m_filename; }
270 bool IsReceive()
const {
return m_receiving; }
275 void InternalOpenFaxStreams();
276 void InternalOnFaxCompleted();
284 unsigned m_switchTime;
285 atomic<bool> m_switchedOnUserInput;
288 PTimer m_switchTimer;
291 atomic<bool> m_completed;
295 typedef OpalFaxConnection OpalT38Connection;
297 class T38_UDPTLPacket;
302 static const PCaselessString & UDPTL();
304 OpalFaxSession(
const Init & init);
307 virtual const PCaselessString &
GetSessionType()
const {
return UDPTL(); }
310 virtual bool IsOpen()
const;
311 virtual bool Close();
327 void SetFrameFromIFP(
RTP_DataFrame & frame,
const PASN_OctetString & ifp,
unsigned sequenceNumber);
328 void DecrementSentPacketRedundancy(
bool stripRedundancy);
332 PSyncQueue<PBYTEArray> m_readQueue;
335 PINDEX m_datagramSize;
337 int m_consecutiveBadPackets;
338 bool m_awaitingGoodPacket;
339 T38_UDPTLPacket * m_receivedPacket;
340 unsigned m_expectedSequenceNumber;
341 int m_secondaryPacket;
343 std::map<int, int> m_redundancy;
344 PTimeInterval m_redundancyInterval;
345 PTimeInterval m_keepAliveInterval;
346 bool m_optimiseOnRetransmit;
347 std::vector<int> m_sentPacketRedundancy;
348 T38_UDPTLPacket * m_sentPacket;
349 PDECLARE_MUTEX(m_writeMutex);
350 PTimer m_timerWriteDataIdle;
351 PDECLARE_NOTIFIER(PTimer, OpalFaxSession, OnWriteDataIdle);
354 unsigned m_txPackets;
356 unsigned m_rxPackets;
357 unsigned m_missingPackets;
369 OpalFaxSession & session);
371 virtual PBoolean
Open();
372 virtual PBoolean
Start();
383 OpalFaxSession & m_session;
387 #endif // OPAL_T38_CAPABILITY
389 #endif // OPAL_T38_T38PROTO_H
virtual void OnClosedMediaStream(const OpalMediaStream &stream)
virtual PStringList GetAvailableStringOptions() const
virtual void OnReleased()
bool GetStatistics(const OpalMediaType &mediaType, bool source, OpalMediaStatistics &statistics) const
Get media statistics of the type, and of the specifed direction.
Definition: manager.h:150
virtual void OnUserInputTone(char tone, unsigned duration)
virtual OpalMediaStream * CreateMediaStream(const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource)
virtual void OnApplyStringOptions()
Call back for connection to act on changed string options.
Definition: localep.h:469
Definition: transports.h:788
virtual PBoolean SendUserInputTone(char tone, unsigned duration=0)
virtual PSafePtr< OpalConnection > MakeConnection(OpalCall &call, const PString &party, void *userData=NULL, unsigned int options=0, OpalConnection::StringOptions *stringOptions=NULL)
OpalLocalEndPoint & m_endpoint
Definition: localep.h:830
virtual void OnStopMediaPatch(OpalMediaPatch &patch)
Definition: connection.h:530
virtual void OnEstablished()
virtual void AdjustMediaFormats(bool local, const OpalConnection *otherConnection, OpalMediaFormatList &mediaFormats) const
virtual OpalMediaFormatList GetMediaFormats() const
PDECLARE_NOTIFIER(RTP_DataFrame, OpalConnection, OnRecordAudio)
Definition: connection.h:415
virtual OpalLocalConnection * CreateConnection(OpalCall &call, void *userData, unsigned options, OpalConnection::StringOptions *stringOptions)
virtual PString GetPrefixName() const
Definition: transports.h:151
virtual OpalMediaFormatList GetMediaFormats() const