<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/1116/">https://reviewboard.asterisk.org/r/1116/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On March 29th, 2011, 10:38 a.m., <b>Matthew Nicholson</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/1116/diff/8/?file=15881#file15881line58" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/apps/app_faxdetect.c</a>
<span style="font-weight: normal;">
(Diff revision 8)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static const char app_faxdetect[] = "FaxDetect";</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">58</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="k">static</span> <span class="kt">int</span> <span class="nf">faxdetect_exec</span><span class="p">(</span><span class="k">struct</span> <span class="n">ast_channel</span> <span class="o">*</span><span class="n">chan</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">data</span><span class="p">)</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">A new application specifically for fax detection should not be necessary.</pre>
</blockquote>
<p>On March 31st, 2011, 12:45 a.m., <b>irroot</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">There is a application for this indeed esp with T.38
previously when i wanted to receive a fax id answer / playtones / wait on the channel for the fax tone the channel driver will then divert it to fax exten [and disable ec] where i could check on the routing and even route it back to the same channel it would have gone to in the first place. once answered by the device diverting to the fax extension would leave the fax machine "negotiating" and not available for a fax so if im only using local fax app im fine here and it is not needed a perhaps WaitForFax is a more appropriate name for this app. this also removes the "i got a hangup" complaint where a fax would come in the user answers does not hear the initial tone and there is no call and assumes a call was dropped even if there was a fax in the inbox.
this faxdetect is a enhancement on wait in that it runs DSP and will "queue" T.38 negotiation on detect making the switchover more painless.
for outbound faxes this will have little application as the framehook bellow will cater for it.
i find this most useful and have been using it for a long time.</pre>
</blockquote>
<p>On March 31st, 2011, 9:20 a.m., <b>Matthew Nicholson</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">For the use case you describe, you should just be able to turn on fax detection in chan_sip and do a Wait() on the channel in question before connecting the call. chan_sip will detect the fax and send it to the fax exten.</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I have a feeling you guys are talking about two different things here, and this needs to be cleared up.
Once we have T.38 gateway support, there are two *entirely different* kinds of FAX detection possible.
The first is what we have always had, where we listen for a CNG tone which is an indication that a calling endpoint is indeed a (non-V.34) FAX terminal trying to initiate a FAX transaction (sending, or polling to receive). When this type of detection is enabled, the channel is generally sent to a different extension in the dialplan, so the dialplan can decide how it wants to route the call.
The second is detection of a *called* FAX terminal which is indicating that it is ready to initiate a FAX transaction (receiving, or being polled to send). This is done by detecting the V.21 preamble at the beginning of the called FAX terminal's first message after CED. When this is detected by the T.38 gateway code (*NOT* the channel driver), then T.38 negotiation should be initiated to the calling channel, and if it succeeds, a T.38 gateway session would be setup between the channel connected to the called FAX terminal (where the FAX transaction will occur in T.30 mode over modems) and the channel connected to the calling FAX terminal (where the FAX transaction will occur in T.38 mode). This has *nothing* to do with call routing, and switching into and back out of gateway mode can (and should) occur without the dialplan even being aware that it happened. This is explained on the wiki page that Matt linked to earlier, but if it's not clear then we might need to improve the page.
So, in many cases, a single call could easily end up using *both* forms of FAX detection: first, the call arrives and the caller hears some prompts, or is sent to a queue, or a device is dialed to accept the call... but while that is happening, the 'faxdetect' code hears a CNG from the calling end, and redirects the call to the 'fax' extension. The dialplan then calls out to a FAX machine connected via some mechanism, and when that machine answers, it sends CED followed by one of a few initial FAX transaction messages. When it does this, the V.21 preamble at the beginning of that message is detected, and the T.38 gateway code is triggered to start doing its thing.
One more note: the faxdetect code (triggered by CNG) does *NOT* disable echo cancellation. Echo cancellers that are G.168 compliant detect CED tones generated by *called* FAX terminals and take action themselves to reconfigure properly so as to not interfere with a FAX transaction.</pre>
<br />
<p>- Kevin</p>
<br />
<p>On March 16th, 2011, 8:40 a.m., irroot wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.orgrb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers, Russell Bryant, dimas, Leif Madsen, and dafe_von_cetin.</div>
<div>By irroot.</div>
<p style="color: grey;"><i>Updated 2011-03-16 08:40:59</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Hi there the patch that was going around circa 2008 to implement this in 1.4/1.6 app_fax has been moved to trunk [1.10]
ive made some cleanups and moved it into res_fax res_fax_spandsp this is the framework and not production code
unfortunately i have no means of testing it at the moment and require help.
i have cleaned the code up substantially it is related to R459
hope this is found useful and aids in the goal to get it in 1.10.
Adds application FaxGateway / FaxDetect
Adds alternate bridge to Dial with new option.</pre>
</td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://issues.asterisk.org/view.php?id=13405">13405</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/apps/app_faxdetect.c <span style="color: grey">(PRE-CREATION)</span></li>
<li>/trunk/channels/chan_sip.c <span style="color: grey">(310546)</span></li>
<li>/trunk/channels/sip/include/sip.h <span style="color: grey">(310546)</span></li>
<li>/trunk/configs/res_fax.conf.sample <span style="color: grey">(310546)</span></li>
<li>/trunk/configs/sip.conf.sample <span style="color: grey">(310546)</span></li>
<li>/trunk/include/asterisk/channel.h <span style="color: grey">(310546)</span></li>
<li>/trunk/include/asterisk/res_fax.h <span style="color: grey">(310546)</span></li>
<li>/trunk/main/channel.c <span style="color: grey">(310546)</span></li>
<li>/trunk/res/res_fax.c <span style="color: grey">(310546)</span></li>
<li>/trunk/res/res_fax_spandsp.c <span style="color: grey">(310546)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/1116/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>