Changeset 8612
- Timestamp:
- 01/14/10 17:22:41 (3 years ago)
- Files:
-
- modules/branches/2.7/fax/functions.inc.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.7/fax/functions.inc.php
r8611 r8612 255 255 //TODO: we want to get rid of this since it will be 2.7 only... 256 256 // 257 $fax_dahdi_faxdetect=fax_dahdi_faxdetect(); 258 $fax_sip_faxdetect=fax_sip_faxdetect(); 259 $dahdi=ast_with_dahdi()?_('Dahdi'):_('Zaptel'); 260 $fax_detect=fax_detect(); 257 261 $html='<script type="text/javascript">$(document).ready(function(){ 258 262 $("input[name=Submit]").click(function(){ 259 263 if($("input[name=faxenabled]:checked").val()=="true" && !$("input[name=gotoFAX]:checked").val()){//ensure the user selected a fax destination 260 alert('._('"You have selected Fax Detection on this route. Please select a valid destination to route calls detected as faxes to."').');return false; 261 } 262 }) 263 }); 264 </script>'; 264 alert('._('"You have selected Fax Detection on this route. Please select a valid destination to route calls detected as faxes to."').');return false; } }) });</script>'; 265 265 $html .= '<tr><td colspan="2"><h5>'; 266 266 $html .= _("Fax Detect"); 267 267 $html .= '<hr></h5></td></tr>'; 268 $fax= fax_detect();269 if(!$fax['module']){//error message if there are no modules loaded in asterisk268 $fax=$fax_detect; 269 /*if(!$fax['module']){//error message if there are no modules loaded in asterisk 270 270 $html .= '<table><tr><td><style>.faxerror{color:red; '.(($faxenabled == 'no')?'':'display: none;').'}</style><span class=faxerror>'._('It seems that you dont have fax receving modules installed in Asterisk or Asterisk is unreachable.<br/> Fax-related dialplan will <strong>NOT</strong> be generated!<br /> Please contact your vendor for more information.').'</span></td></tr></table>'; 271 } 271 }*/ 272 272 if($fax['module'] == 'res_fax' && $fax['license'] < 1){//error message if there are no fax licenses 273 273 $html .= '<table><tr><td><style>.faxerror{color:red; '.(($faxenabled == 'no')?'':'display: none;').'}</style><span class=faxerror>'._('It seems that you dont have any fax licenses on this system. Fax-related dialplan will <strong>NOT</strong> be generated!<br /> Please contact your vendor for more information.').'</span></td></tr></table>'; … … 276 276 $html .= '<td><a href="#" class="info">'; 277 277 $html .= _("Detect Faxes").'<span>'._("Attemp to detect faxes on this DID.<ul><li>No: No attempts are made to auto-determain the call type; all calls sent to destination below. Use this option if this DID is used exclusevly for voice OR fax.</li><li>Yes: try to auto determain the type of call; route to the fax destination if call is a fax, otherwise send to regular destination. Use this option if you receive both voice and fax calls on this line</li></ul>").'.</span></a>:</td>'; 278 //js to show/hide the detection type/time/destination279 $js = "if ($('input[name=extension]').val() == ''){//disable if there is no did280 alert('"._('Fax detection can only be enabled when the Inbound Route contains a DID')."');return false;281 }282 if ($(this).val() == 'true'){283 $('.faxdetect').slideDown();284 $('select[name=faxdetection]').trigger('click');285 }else{286 $('.faxdetect').slideUp();287 $('select[name=faxdetection]').trigger('click');288 }289 if(\$(this).val() == 'true'){\$('.faxerror').show();}else{\$('.faxerror').hide();//show error notice if it exists, only when using faxdetect290 }";291 $html .= '<td><input type="radio" name="faxenabled" value="false" CHECKED onclick="'.$js.'"/>No';292 $html .= '<input type="radio" name="faxenabled" value="true" '.(($faxenabled == 'yes')?'CHECKED':'').' onclick="'.$js.'"/>Yes</td></tr>';293 $html .= '</table>';294 278 279 //dont allow detection to be set if we have no valid detection types 280 if(!$fax_dahdi_faxdetect&&!$fax_sip_faxdetect){ 281 $js="if ($(this).val() == 'true'){ 282 alert('"._('No fax detection methods found or no valid licences. Faxing cannot be enabled.')."');return false; 283 }"; 284 $html .= '<td><input type="radio" name="faxenabled" value="false" CHECKED />No'; 285 $html .= '<input type="radio" name="faxenabled" value="true" onclick="'.$js.'"/>Yes</td></tr>'; 286 $html .= '</table>'; 287 }else{//show detection options 288 //js to show/hide the detection type/time/destination 289 $js = "if ($('input[name=extension]').val() == ''){//disable if there is no did 290 alert('"._('Fax detection can only be enabled when the Inbound Route contains a DID')."');return false; 291 } 292 if ($(this).val() == 'true'){ 293 $('.faxdetect').slideDown(); 294 $('select[name=faxdetection]').trigger('click'); 295 }else{ 296 $('.faxdetect').slideUp(); 297 $('select[name=faxdetection]').trigger('click'); 298 } 299 if(\$(this).val() == 'true'){\$('.faxerror').show();}else{\$('.faxerror').hide();//show error notice if it exists, only when using faxdetect 300 }"; 301 $html .= '<td><input type="radio" name="faxenabled" value="false" CHECKED onclick="'.$js.'"/>No'; 302 $html .= '<input type="radio" name="faxenabled" value="true" '.(($faxenabled == 'yes')?'CHECKED':'').' onclick="'.$js.'"/>Yes</td></tr>'; 303 $html .= '</table>'; 304 } 295 305 //fax detection+destinations 296 306 $html .= '<table class=faxdetect '.($faxdetection?'':'style="display: none;"').'>'; 297 307 $info = engine_getinfo(); 298 $html .= '<tr><td width="156px"><a href="#" class="info">'._( "Fax Detection type").'<span>'._("Type of fax detection to use.<ul><li>".(ast_with_dahdi()?"Dahdi":"Zaptel").": use ".(ast_with_dahdi()?"Dahdi":"Zaptel")." fax detection; requires 'faxdetect=' to be set to 'incoming' or 'both' in ".(ast_with_dahdi()?"dahdi":"zaptel").".conf</li><li>Sip: use sip fax detection (t38). Requires asterisk 1.6.2 or greater and 'faxdetect=yes' in the sip config files</li></ul>").'.</span></a>:</td>';308 $html .= '<tr><td width="156px"><a href="#" class="info">'._('Fax Detection type').'<span>'._("Type of fax detection to use.<ul><li>".$dahdi.": use ".$dahdi." fax detection; requires 'faxdetect=' to be set to 'incoming' or 'both' in ".$dahdi.".conf</li><li>Sip: use sip fax detection (t38). Requires asterisk 1.6.2 or greater and 'faxdetect=yes' in the sip config files</li></ul>").'.</span></a>:</td>'; 299 309 $html .= '<td><select name="faxdetection" tabindex="'.++$tabindex.'">'; 300 310 //$html .= '<option value="Auto"'.($faxdetection == 'auto' ? 'SELECTED' : '').'>'. _("Auto").'</option>';<li>Auto: allow the system to chose the best fax detection method</li> 301 $html .= '<option value="dahdi" '.($faxdetection == 'dahdi' ? 'SELECTED' : '').' '.( fax_dahdi_faxdetect()?'':'disabled').'>'. _((ast_with_dahdi()?"Dahdi":"Zaptel")).'</option>';302 $html .= '<option value="sip" '.($faxdetection == 'sip' ? 'SELECTED' : '').' '.((($info['version'] >= "1.6.2") && fax_sip_faxdetect())?'':'disabled').'>'. _("Sip").'</option>';311 $html .= '<option value="dahdi" '.($faxdetection == 'dahdi' ? 'SELECTED' : '').' '.($fax_dahdi_faxdetect?'':'disabled').'>'.$dahdi.'</option>'; 312 $html .= '<option value="sip" '.($faxdetection == 'sip' ? 'SELECTED' : '').' '.((($info['version'] >= "1.6.2") && $fax_sip_faxdetect)?'':'disabled').'>'. _("Sip").'</option>'; 303 313 /* 304 314 * code for nvfaxdetect. I'm not sure if we should be offering this, … … 314 324 */ 315 325 //if we cant find ANY valid faxdetect type, then dont show options 316 $html .= '<tr class=faxdetectionwait '.( fax_detect()&& fax_dahdi_faxdetect()?'':'style="display: none;"').'><td><a href="#" class="info">'._("Fax Detection Time").'<span>'._('How long to wait and try to detect fax. Please note that callers to a '.(ast_with_dahdi()?"dahdi":"zaptel").' channel will hear ringing for this amount of time (i.e. the system wont "answer" the call, it will just play ringing)').'.</span></a>:</td>';326 $html .= '<tr class=faxdetectionwait '.($fax_detect&& $fax_dahdi_faxdetect?'':'style="display: none;"').'><td><a href="#" class="info">'._("Fax Detection Time").'<span>'._('How long to wait and try to detect fax. Please note that callers to a '.$dahdi.' channel will hear ringing for this amount of time (i.e. the system wont "answer" the call, it will just play ringing)').'.</span></a>:</td>'; 317 327 $html .= '<td><select name="faxdetectionwait" tabindex="'.++$tabindex.'">'; 318 328 if(!$faxdetectionwait){$faxdetectionwait=4;}//default wait time is 4 second … … 322 332 //if we cant find ANY valid faxdetect type, then dont show options 323 333 $html .= '</select></td></tr>'; 324 $html .= '<tr class=faxdestination '.(fax_detect()?'':'style="display: none;"').'><td><a href="#" class="info">'._("Fax Destination").'<span>'._('Where to send the call if we detect that its a fax').'.</span></a>:</td>'; 334 $html .= 335 $html .= '<tr class=faxdestination '.($fax_detect?'':'style="display: none;"').'><td><a href="#" class="info">'._("Fax Destination").'<span>'._('Where to send the call if we detect that its a fax').'.</span></a>:</td>'; 325 336 $html .= '</tr>'; 326 $html .= fax_detect()?drawselects(isset($faxdestination)?$faxdestination:null,'FAX'):'';337 $html .= $fax_detect?drawselects(isset($faxdestination)?$faxdestination:null,'FAX'):''; 327 338 $html .= '</table>'; 328 339 $html .= '<table>';
