| | 3 | |
|---|
| | 4 | function fax_getdest($exten) { |
|---|
| | 5 | return array("ext-fax,$exten,1"); |
|---|
| | 6 | } |
|---|
| | 7 | |
|---|
| | 8 | function fax_getdestinfo($dest) { |
|---|
| | 9 | global $amp_conf; |
|---|
| | 10 | if (substr(trim($dest),0,8) == 'ext-fax,') { |
|---|
| | 11 | $usr = explode(',',$dest); |
|---|
| | 12 | $usr = $usr[1]; |
|---|
| | 13 | $thisusr = fax_get_user($usr); |
|---|
| | 14 | if (empty($thisusr)) { |
|---|
| | 15 | return array(); |
|---|
| | 16 | } else { |
|---|
| | 17 | $display = ($amp_conf['AMPEXTENSIONS'] == "deviceanduser")?'users':'extensions'; |
|---|
| | 18 | return array('description' => sprintf(_("Fax user %s"),$usr), |
|---|
| | 19 | 'edit_url' => 'config.php?display='.$display.'&extdisplay='.urlencode($usr), |
|---|
| | 20 | ); |
|---|
| | 21 | } |
|---|
| | 22 | } else { |
|---|
| | 23 | return false; |
|---|
| | 24 | } |
|---|
| | 25 | } |
|---|
| | 26 | |
|---|
| | 27 | function fax_check_destinations($dest=true) { |
|---|
| | 28 | global $active_modules; |
|---|
| | 29 | |
|---|
| | 30 | $destlist = array(); |
|---|
| | 31 | if (is_array($dest) && empty($dest)) { |
|---|
| | 32 | return $destlist; |
|---|
| | 33 | } |
|---|
| | 34 | $sql = "SELECT a.extension, a.cidnum, b.description, a.destination FROM fax_incoming a JOIN incoming b "; |
|---|
| | 35 | $sql .= "WHERE a.extension = b.extension AND a.cidnum = b.cidnum AND a.legacy_email IS NULL "; |
|---|
| | 36 | if ($dest !== true) { |
|---|
| | 37 | $sql .= "AND a.destination in ('".implode("','",$dest)."') "; |
|---|
| | 38 | } |
|---|
| | 39 | $sql .= "ORDER BY extension, cidnum"; |
|---|
| | 40 | $results = sql($sql,"getAll",DB_FETCHMODE_ASSOC); |
|---|
| | 41 | |
|---|
| | 42 | //$type = isset($active_modules['announcement']['type'])?$active_modules['announcement']['type']:'setup'; |
|---|
| | 43 | |
|---|
| | 44 | foreach ($results as $result) { |
|---|
| | 45 | $thisdest = $result['destination']; |
|---|
| | 46 | $thisid = $result['extension'].'/'.$result['cidnum']; |
|---|
| | 47 | $destlist[] = array( |
|---|
| | 48 | 'dest' => $thisdest, |
|---|
| | 49 | 'description' => sprintf(_("Inbound Fax Detection: %s (%s)"),$result['description'],$thisid), |
|---|
| | 50 | 'edit_url' => 'config.php?display=did&extdisplay='.urlencode($thisid), |
|---|
| | 51 | ); |
|---|
| | 52 | } |
|---|
| | 53 | return $destlist; |
|---|
| | 54 | } |
|---|
| 420 | | sql("INSERT INTO fax_incoming (cidnum, extension, detection, detectionwait, destination, legacy_email) VALUES ('".$db->escapeSimple($cidnum)."', '".$db->escapeSimple($extension)."', '".$db->escapeSimple($detection)."', '".$db->escapeSimple($detectionwait)."', '".$db->escapeSimple($dest)."','".$db->escapeSimple($legacy_email)."')"); |
|---|
| | 476 | $legacy_email = $legacy_email === null ? 'NULL' : "'".$db->escapeSimple("$legacy_email")."'"; |
|---|
| | 477 | sql("INSERT INTO fax_incoming (cidnum, extension, detection, detectionwait, destination, legacy_email) VALUES ('".$db->escapeSimple($cidnum)."', '".$db->escapeSimple($extension)."', '".$db->escapeSimple($detection)."', '".$db->escapeSimple($detectionwait)."', '".$db->escapeSimple($dest)."',".$legacy_email.")"); |
|---|