Changeset 3335

Show
Ignore:
Timestamp:
12/17/06 21:34:55 (5 years ago)
Author:
qldrob
Message:

Manually merge #3332 from 2.2 into trunk.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/amp_conf/htdocs/admin/modules/core/functions.inc.php

    r3254 r3335  
    191191          // extensions_custom.conf 
    192192          $ext->add($context, $exten, '', new ext_setvar('FROM_DID',$exten)); 
    193  
    194           if (!empty($item['mohclass']) && trim($item['mohclass']) != 'default') { 
    195               $ext->add($context, $exten, '', new ext_setmusiconhold($item['mohclass'])); 
    196           } 
    197193 
    198194          // If we require RINGING, signal it as soon as we enter. 
     
    303299          $ext->add($context, $exten, '', new ext_setvar('FROM_DID',$exten)); 
    304300 
    305           if (!empty($item['mohclass']) && trim($item['mohclass']) != 'default') { 
    306             $ext->add($context, $exten, '', new ext_setmusiconhold($item['mohclass'])); 
    307           } 
    308301           
    309302          if ($item['faxexten'] != "default") { 
     
    388381          if(strpos($exten['args'],"INTRACOMPANYROUTE") !== false) 
    389382            $ext->add($outrt['application'], $exten['extension'], '', new ext_setvar("INTRACOMPANYROUTE",substr($exten['args'],18))); 
    390           if(strpos($exten['args'],"MOHCLASS") !== false) 
    391             $ext->add($outrt['application'], $exten['extension'], '', new ext_setvar("MOHCLASS",substr($exten['args'],9))); 
    392383          if(strpos($exten['args'],"dialout-trunk") !== false) 
    393384            $ext->add($outrt['application'], $exten['extension'], '', new ext_macro($exten['args'])); 
     
    495486  if (empty($existing)) { 
    496487    $destination=${$goto_indicate0.'0'}; 
    497     $sql="INSERT INTO incoming (cidnum,extension,destination,faxexten,faxemail,answer,wait,privacyman,alertinfo, channel, ringing, mohclass) values ('$cidnum','$extension','$destination','$faxexten','$faxemail','$answer','$wait','$privacyman','$alertinfo', '$channel', '$ringing', '$mohclass')"; 
     488    $sql="INSERT INTO incoming (cidnum,extension,destination,faxexten,faxemail,answer,wait,privacyman,alertinfo, channel, ringing) values ('$cidnum','$extension','$destination','$faxexten','$faxemail','$answer','$wait','$privacyman','$alertinfo', '$channel', '$ringing')"; 
    498489    sql($sql); 
    499490  } else { 
     
    11141105   
    11151106  //insert into users table 
    1116   $sql="INSERT INTO users (extension,password,name,voicemail,ringtimer,noanswer,recording,outboundcid,directdid,didalert,faxexten,faxemail,answer,wait,privacyman,mohclass) values (\""; 
     1107  $sql="INSERT INTO users (extension,password,name,voicemail,ringtimer,noanswer,recording,outboundcid,directdid,didalert,faxexten,faxemail,answer,wait,privacyman) values (\""; 
    11171108  $sql.= "$extension\", \""; 
    11181109  $sql.= isset($password)?$password:''; 
     
    11441135  $sql.= "\", \""; 
    11451136  $sql.= isset($privacyman)?$privacyman:''; 
    1146   $sql.= "\", \""; 
    1147         $sql.= isset($mohclass)?$mohclass:''; 
     1137 
    11481138  $sql.= "\")"; 
    11491139  sql($sql); 
     
    12541244 
    12551245function core_directdid_list(){ 
    1256   $sql = "SELECT extension, directdid, didalert, mohclass, faxexten, faxemail, answer, wait, privacyman FROM users WHERE directdid IS NOT NULL AND directdid != ''"; 
     1246  $sql = "SELECT extension, directdid, didalert, faxexten, faxemail, answer, wait, privacyman FROM users WHERE directdid IS NOT NULL AND directdid != ''"; 
    12571247  return sql($sql,"getAll",DB_FETCHMODE_ASSOC); 
    12581248} 
     
    18401830 
    18411831 
    1842 function core_routing_add($name, $patterns, $trunks, $method, $pass, $emergency = "", $intracompany = "", $mohsilence = "") { 
    1843  
     1832function core_routing_add($name, $patterns, $trunks, $method, $pass, $emergency = "", $intracompany = "") { 
    18441833  global $db; 
    18451834 
     
    19221911    } 
    19231912 
    1924     // Next Priority (either first, second or third depending on above) 
    1925     if(!empty($mohsilence) && trim($mohsilence) != 'default') { 
    1926          $startpriority += 1; 
    1927          $sql = "INSERT INTO extensions (context, extension, priority, application, args, descr) VALUES "; 
    1928          $sql .= "('outrt-".$name."', "; 
    1929          $sql .= "'".$pattern."', "; 
    1930          $sql .= "'".$startpriority."', "; 
    1931          $sql .= "'SetVar', "; 
    1932          $sql .= "'MOHCLASS=".$mohsilence."', "; 
    1933          $sql .= "'Do not play moh on this route')"; 
    1934          $result = $db->query($sql); 
    1935         if(DB::IsError($result)) { 
    1936              die($result->getMessage()); 
    1937         } 
    1938     } 
    1939  
    19401913    $first_trunk = 1; 
    19411914    foreach ($trunks as $priority => $trunk) { 
     
    20191992} 
    20201993 
    2021 function core_routing_edit($name, $patterns, $trunks, $pass, $emergency="", $intracompany = "", $mohsilence="") { 
     1994function core_routing_edit($name, $patterns, $trunks, $pass, $emergency="", $intracompany = "") { 
    20221995  core_routing_del($name); 
    2023   core_routing_add($name, $patterns, $trunks,"edit", $pass, $emergency, $intracompany, $mohsilence); 
     1996  core_routing_add($name, $patterns, $trunks,"edit", $pass, $emergency, $intracompany); 
    20241997} 
    20251998 
     
    21722145       } 
    21732146       return $intracompany; 
    2174 } 
    2175  
    2176 //get mohsilence routing status for this route 
    2177 function core_routing_getroutemohsilence($route) { 
    2178  
    2179        global $db; 
    2180        $sql = "SELECT DISTINCT args FROM extensions WHERE context = 'outrt-".$route."' AND (args LIKE 'MOHCLASS%') "; 
    2181        $results = $db->getOne($sql); 
    2182        if(DB::IsError($results)) { 
    2183                die($results->getMessage()); 
    2184        } 
    2185        if (preg_match('/^.*=(.*)/', $results, $matches)) { 
    2186                $mohsilence = $matches[1]; 
    2187        } else { 
    2188                $mohsilence = ""; 
    2189        } 
    2190        return $mohsilence; 
    21912147} 
    21922148 
     
    22832239    $currentcomponent->setoptlistopts('faxdestoptions', 'sort', false); 
    22842240 
    2285     if (function_exists('music_list')) { 
    2286         $tresults = music_list("/var/lib/asterisk/mohmp3"); 
    2287         if (isset($tresults[0])) { 
    2288       foreach ($tresults as $tresult) { 
    2289           $currentcomponent->addoptlistitem('mohclass', $tresult, $tresult); 
    2290       } 
    2291         $currentcomponent->setoptlistopts('mohclass', 'sort', false); 
    2292         } 
    2293     } 
    2294  
    22952241    //get unique devices to finishoff faxdestoptions list 
    22962242    $devices = core_devices_list(); 
     
    23162262  // Ensure variables possibly extracted later exist 
    23172263  $name = $directdid = $didalert = $outboundcid = $answer = null; 
    2318   $record_in = $record_out = $faxexten = $faxemail = $mohclass =  null; 
     2264  $record_in = $record_out = $faxexten = $faxemail = null; 
    23192265 
    23202266  // Init vars from $_REQUEST[] 
     
    23832329      $currentcomponent->addjsfunc('onsubmit()', "\treturn checkBlankUserPwd();\n", 9); 
    23842330    } 
    2385     $currentcomponent->addguielem($section, new gui_textbox('name', $name, 'Display Name', 'The caller id name for calls from this user will be set to this name. Only enter the name, NOT the number.', '!isCallerID()', $msgInvalidDispName, false)); 
     2331    $currentcomponent->addguielem($section, new gui_textbox('name', $name, 'Display Name', 'The caller id name for calls from this user will be set to this name. Only enter the name, NOT the number.', '!isCallerID()', $msgInvalidOutboundCID, false)); 
    23862332     
    23872333    $section = 'Extension Options'; 
    23882334    $currentcomponent->addguielem($section, new gui_textbox('directdid', $directdid, 'Direct DID', "The direct DID that is associated with this extension. The DID should be in the same format as provided by the provider (e.g. full number, 4 digits for 10x4, etc).<br><br>Format should be: <b>XXXXXXXXXX</b><br><br>Leave this field blank to disable the direct DID feature for this extension. All non-numeric characters will be stripped."), 3); 
    23892335    $currentcomponent->addguielem($section, new gui_textbox('didalert', $didalert, 'DID Alert Info', "Alert Info can be used for distinctive ring on SIP phones. Set this value to the desired Alert Info to be sent to the phone when this DID is called. Leave blank to use default values. Will have no effect if no Direct DID is set")); 
    2390     if (function_exists('music_list')) { 
    2391         $currentcomponent->addguielem($section, new gui_selectbox('mohclass', $currentcomponent->getoptlist('mohclass'), $mohclass, 'Music on Hold', "Set the MoH class that will be used for calls that come in on this Direct DID. For example, choose a type appropriate for a originating country which may have announcements in their language. Only effects MoH class when the call came in from the Direct DID.", false)); 
    2392     } 
    23932336    $currentcomponent->addguielem($section, new gui_textbox('outboundcid', $outboundcid, 'Outbound CID', "Overrides the caller id when dialing out a trunk. Any setting here will override the common outbound caller id set in the Trunks admin.<br><br>Format: <b>\"caller name\" &lt;#######&gt;</b><br><br>Leave this field blank to disable the outbound callerid feature for this user.", '!isCallerID()', $msgInvalidOutboundCID, true)); 
    23942337 
     
    26912634                core_devices_add($deviceid,$tech,$devinfo_dial,$devicetype,$deviceuser,$description,$emergency_cid); 
    26922635                needreload(); 
    2693     redirect_standard_continue(); 
     2636    if ($deviceuser != 'new') { 
     2637      redirect_standard_continue(); 
     2638    } 
    26942639        break; 
    26952640        case "del": 
    26962641                core_devices_del($extdisplay); 
    26972642                needreload(); 
    2698     redirect_standard_continue(); 
     2643    if ($deviceuser != 'new') { 
     2644      redirect_standard_continue(); 
     2645    } 
    26992646        break; 
    27002647        case "edit":  //just delete and re-add