<html>
<head>
<base href="https://wiki.asterisk.org/wiki">
<link rel="stylesheet" href="/wiki/s/en/2176/25/9/_/styles/combined.css?spaceKey=AST&forWysiwyg=true" type="text/css">
</head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
<h2><a href="https://wiki.asterisk.org/wiki/display/AST/T.38+Fax+Gateway">T.38 Fax Gateway</a></h2>
<h4>Page <b>edited</b> by <a href="https://wiki.asterisk.org/wiki/display/~mdavenport">Malcolm Davenport</a>
</h4>
<div id="versionComment">
<b>Comment:</b>
typo police<br />
</div>
<br/>
<h4>Changes (1)</h4>
<div id="page-diffs">
<table class="diff" cellpadding="0" cellspacing="0">
<tr><td class="diff-snipped" >...<br></td></tr>
<tr><td class="diff-unchanged" >h4. Enabling T.38 Gateway mode <br> <br></td></tr>
<tr><td class="diff-changed-lines" >In order to affect this new T.38 Gateway capability, <span class="diff-changed-words">an<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">d</span></span> additional option, gateway, has been added to the FAXOPT Dialplan Function. Enabling this option can be done like: <br></td></tr>
<tr><td class="diff-unchanged" > <br>{noformat} <br></td></tr>
<tr><td class="diff-snipped" >...<br></td></tr>
</table>
</div> <h4>Full Content</h4>
<div class="notificationGreySide">
<h3><a name="T.38FaxGateway-FullT.38Capabilities"></a>Full T.38 Capabilities</h3>
<p>Initial support for handling of T.38 sessions was merged into the Asterisk 1.4 codebase. Inside of Asterisk 1.4, it is possible to perform what is referred to as T.38 passthrough. T.38 Passthrough allows Asterisk to carry T.38 UDPTL from one T.38-speaking endpoint to another T.38-speaking endpoint. Asterisk does not modify the media. Asterisk 1.6, in addition to its T.38 passthrough capabilities, introduced T.38 termination support, such that T.38 fax sessions could be initiated from locally stored TIFF files (SendFax) or that T.38 fax sessions could be terminated into locally stored TIFF files (ReceiveFax). The basic faxing capabilities of Asterisk 1.8 remained the same as 1.6.</p>
<p>The limitation of these versions of Asterisk is that while 1.6 - 1.8 are fully capable of passing through or terminating T.38 sessions, there is no capability for T.38 gateway. Older versions of Asterisk cannot directly pass a fax from the PSTN or a non-T.38 endpoint to a T.38 endpoint. Instead, older versions of Asterisk require that two separate calls be established - e.g. one to receive the Fax into a TIFF file (ReceiveFax), and an entirely separate call to send the Fax from a TIFF file to a fax machine (SendFax), or vice versa.</p>
<p>Asterisk 10 overcomes this limitation and provides full T.38 Fax Gateway support. T.38 Gateway provides a number of advantages over the older, two-step store-and-forward method (generally referred to as T.37). Advantages include: end-to-end confirmation of receipt (with two separate calls the callee doesn't necessarily know the caller was trying to send them a fax), reduced time to fax (not receiving and then sending separately cuts the time in half), and increased reliability (no concerns about the reliability of local file storage or the TIFF interpreters).</p>
<h4><a name="T.38FaxGateway-EnablingT.38Gatewaymode"></a>Enabling T.38 Gateway mode</h4>
<p>In order to affect this new T.38 Gateway capability, an additional option, gateway, has been added to the FAXOPT Dialplan Function. Enabling this option can be done like:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>exten => 1,1,NoOp()
exten => 1,n,Set(FAXOPT(gateway)=yes)
exten => 1,n,Dial(SIP/mypeer,20)
</pre>
</div></div>
<p>Here, we use the gateway option in combination with the Dial application:</p>
<h4><a name="T.38FaxGateway-UsingT.38Gatewaymode"></a>Using T.38 Gateway mode</h4>
<p>T.38 Gateway mode should be used when one leg of a call is not capable of T.38 mode. In the event that both legs are capable and Gateway mode is configured, then the Gateway will step out of the way, allowing transparent T.38 passthrough.</p>
<p>The T.38 Gateway code uses an audiohook to monitor the line for the presence of fax. The monitoring checks for both V.21 preamble and T.38 Re-INVITE from the remote party. If neither is detected within a 10 second window, the Gateway shuts down, removing the audiohook from the channel, and allows the call to complete transparently.</p>
<h4><a name="T.38FaxGateway-T.38GatewaywithLocalTerminationFallback"></a>T.38 Gateway with Local Termination Fallback</h4>
<p>It is also possible to use Gateway mode in combination with local Termination mode for calls received by Asterisk - if, for example the second call leg to a peer or number is not possible. In order to accomplish this, Gateway mode must be disabled on the current channel, or the ReceiveFax application will not be run. This can be accomplished like:</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>exten => 1,1,NoOp()
exten => 1,n,Set(FAXOPT(gateway)=yes)
exten => 1,n,Dial(SIP/mypeer,20)
exten => 1,n,Verbose(Failed to dial 'SIP/mypeer': ${DIALSTATUS})
exten => 1,n,Set(FAXOPT(gateway)=no)
exten => 1,n,ReceiveFax(myreceivedfile.tiff,d)
</pre>
</div></div>
<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/wiki/images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>It is possible to set a channel variable for a SIP peer such that gateway mode is <b>always</b> enabled. This can be accomplished for a SIP peer in sip.conf like:
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>[mypeer]
type=peer
host=dynamic
secret=chooseabetterpassword
context=default
setvar=FAXOPT(gateway)=yes
</pre>
</div></div></td></tr></table></div>
<h4><a name="T.38FaxGateway-T.38GatewayFaxActivityTimeout"></a>T.38 Gateway Fax Activity Timeout</h4>
<p>By default, gateway mode will remain enabled throughout the life of a channel. An optional timeout can be enabled to automatically disable gateway mode if there is no fax activity a given time after two channels are bridged. Enabling a timeout also has the side effect of reserving fax resources for a channel. The timeout can be enabled by passing second parameter (a timeout in seconds) when setting <tt>FAXOPT(gateway)</tt>.</p>
<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
<pre>exten => 1,1,NoOp()
exten => 1,n,Set(FAXOPT(gateway)=yes,10) ; disable gateway if there is no fax activity in 10 seconds
exten => 1,n,Dial(SIP/mypeer,20)
</pre>
</div></div>
</div>
<div id="commentsSection" class="wiki-content pageSection">
<div style="float: right;" class="grey">
<a href="https://wiki.asterisk.org/wiki/users/removespacenotification.action?spaceKey=AST">Stop watching space</a>
<span style="padding: 0px 5px;">|</span>
<a href="https://wiki.asterisk.org/wiki/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
<a href="https://wiki.asterisk.org/wiki/display/AST/T.38+Fax+Gateway">View Online</a>
|
<a href="https://wiki.asterisk.org/wiki/pages/diffpagesbyversion.action?pageId=17203206&revisedVersion=14&originalVersion=13">View Changes</a>
|
<a href="https://wiki.asterisk.org/wiki/display/AST/T.38+Fax+Gateway?showComments=true&showCommentArea=true#addcomment">Add Comment</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>