Changeset 7917

Show
Ignore:
Timestamp:
08/02/09 22:51:36 (4 years ago)
Author:
p_lindheimer
Message:

Merged revisions 7697,7699-7701,7703-7707,7709-7710,7713-7722,7725-7731,7735-7736,7739-7740,7744-7751,7753-7758,7761,7763,7765-7769,7771-7774,7776-7785,7787,7789-7791,7793-7794,7798,7806,7808-7809,7811-7813,7816,7818-7821,7838,7858-7865,7867,7871,7875-7878,7881-7882,7886-7887,7889-7890,7892-7893,7895-7896,7901 via svnmerge from
http://svn.freepbx.org/modules/branches/2.6

........

r7697 | p_lindheimer | 2009-05-07 20:35:14 -0700 (Thu, 07 May 2009) | 1 line


fixes #3478 this appears to be an asterisk issue as it does not happen on all systems. Putting patch into 2.6 and after proper testing we can look at back porting it to 2.5

........

r7713 | mickecarlsson | 2009-05-08 12:38:29 -0700 (Fri, 08 May 2009) | 1 line


Fixed spelling errors in dialparties.agi

........

r7721 | xrobau | 2009-05-13 15:48:19 -0700 (Wed, 13 May 2009) | 2 lines


Apply fixes from #3423

........

r7728 | mickecarlsson | 2009-05-14 21:57:43 -0700 (Thu, 14 May 2009) | 1 line


Fixed spelling errors in extensions.conf

........

r7731 | xrobau | 2009-05-15 11:33:22 -0700 (Fri, 15 May 2009) | 2 lines


Minor tabindex warning cleanups

........

r7751 | p_lindheimer | 2009-05-26 12:42:42 -0700 (Tue, 26 May 2009) | 1 line


closes #3691 added usage of EXTENSION_STATE in dialparties in place of manager connection when present

........

r7753 | p_lindheimer | 2009-05-26 16:27:57 -0700 (Tue, 26 May 2009) | 1 line


use the STAT() function in place of the checksound.agi script for Asterisk 1.4+ systems, in vmx locater, to check for file

........

r7754 | p_lindheimer | 2009-05-26 17:11:23 -0700 (Tue, 26 May 2009) | 1 line


fixes #3693 change ZAP to DAHDI in trunk tech when generating config in ZAP2DAHDI compatibility mode

........

r7784 | p_lindheimer | 2009-06-01 12:19:05 -0700 (Mon, 01 Jun 2009) | 1 line


fixes #3705 so & can be used in sip and iax secrets, also modifies core_trunks_getDetails to provide a table of all the trunks from the new trunk table if no paramter is passed

........

r7838 | p_lindheimer | 2009-06-20 09:46:08 -0700 (Sat, 20 Jun 2009) | 1 line


add alwaysauthreject=yes to sip settings to enhance security

........

r7871 | p_lindheimer | 2009-06-26 22:04:39 -0700 (Fri, 26 Jun 2009) | 1 line


fix bug when accessing a stale page where the trunk no longer exists and no technology type is returned resulting in a sql query accessing a blank table

........

r7901 | p_lindheimer | 2009-07-25 08:43:58 -0700 (Sat, 25 Jul 2009) | 1 line


fixes #3792 create astman handle from AGI's unique 'new' function

........

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.5

    • Property svnmerge-integrated changed from /modules/branches/2.4:1-5852,5908 /modules/branches/2.6:1-7080,7132,7158-7174,7177,7179-7186,7191-7202,7204-7226,7228-7250,7252-7273,7279-7286,7289-7292,7294-7295,7297-7312,7317-7331,7333-7340,7411,7413,7415-7417,7419-7420,7423-7434,7438-7439,7441-7442,7444-7446,7458-7469,7553,7609-7622,7786,7874 to /modules/branches/2.4:1-5852,5908 /modules/branches/2.6:1-7080,7132,7158-7174,7177,7179-7186,7191-7202,7204-7226,7228-7250,7252-7273,7279-7286,7289-7292,7294-7295,7297-7312,7317-7331,7333-7340,7411,7413,7415-7417,7419-7420,7423-7434,7438-7439,7441-7442,7444-7446,7458-7469,7553,7609-7622,7697,7699-7701,7703-7707,7709-7710,7713-7722,7725-7731,7735-7736,7739-7740,7744-7751,7753-7759,7761-7774,7776-7787,7789-7791,7793-7795,7798,7806-7809,7811-7813,7816,7818-7821,7838,7858-7867,7871,7874-7882,7886-7893,7895-7896,7901
  • modules/branches/2.5/core/agi-bin/dialparties.agi

    r7787 r7917  
    3131require_once "phpagi-asmanager.php"; 
    3232 
    33 $ext      = array();  // Hash that will contain our list of extensions to call 
    34 $ext_hunt = array();  // Hash that will contain our list of extensions to call used by huntgroup 
     33$ext      = array();  // Hash that will contain our list of extensions to call 
     34$ext_hunt = array();  // Hash that will contain our list of extensions to call used by huntgroup 
    3535$cidnum   = "";   // Caller ID Number for this call 
    3636$cidname  = "";   // Caller ID Name for this call 
    3737$timer    = "";   // Call timer for Dial command 
    38 $dialopts = "";   // options for dialing 
     38$dialopts = "";   // Options for dialing 
    3939$rc       = "";   // Catch return code 
    4040$priority = "";   // Next priority  
    4141$rgmethod = "";   // If Ring Group what ringing method was chosen 
    42 $screen   = false;  // initialize screen variable 
     42$screen   = false;  // Initialize screen variable 
    4343$dsarray  = array();  // This will hold all the dial strings, used to check for duplicate extensions 
    4444 
     
    5959$cfignore    = strtoupper(trim($cfignore)); 
    6060 
    61 $astman = new AGI_AsteriskManager( );  
    62 if (!$astman->connect("127.0.0.1", $ampmgruser , $ampmgrpass)) { 
    63   exit (1); 
     61$ast_ge_16   = version_compare($ast_version, "1.6", "ge"); 
     62$has_extension_state = (get_var( $AGI, "HAS_EXTENSION_STATE" ) || $ast_ge_16); 
     63// If we are 1.6 then we have the EXTENSION_STATE() function and don't need to use the manager 
     64// 
     65if (!$has_extension_state) { 
     66  $astman = $AGI->new_AsteriskManager(); 
     67  if (!$astman->connect("127.0.0.1", $ampmgruser , $ampmgrpass)) { 
     68    exit (1); 
     69  } 
    6470} 
    6571 
     
    162168 
    163169// Clear it now so subsequent transfers don't honor it any longer 
    164 // unless it's a ringallv2 in which case it is going to got though 
     170// unless it's a ringallv2 in which case it is going to get through 
    165171// another level of local channels 
    166172// 
     
    231237    } 
    232238  } else { 
    233     debug("extension not in group list, ringging only during prering time",4); 
     239    debug("extension not in group list, ringing only during prering time",4); 
    234240    $fmgrp_realprering = $fmgrp_prering; 
    235241    array_unshift($ext,$fmgrp); 
     
    247253  if (strlen($screen_call)) { 
    248254    if($screen_call == 'nomemory' && $cidnum != '')  { // This can't go in the dialplan because macro-dial can get called multiple times 
    249       // Do a security check, we only numeric callerid numbers, otherwise code could be incjected in a cidnum field 
     255      // Do a security check, we only numeric callerid numbers, otherwise code could be injected in a cidnum field 
    250256      // that could result in an arbitrary command being executed in this remove operation. 
    251257      if (ctype_digit($cidnum)) { 
     
    261267  } 
    262268} 
    263 // IF THE FIRST EXTENSION IS CALL FORWARD ENABLED (put in logic) then we don't do master mode 
     269// IF THE FIRST EXTENSION HAVE CALL FORWARD ENABLED (put in logic) then we don't do master mode 
    264270// which means we reset the flag here after detecting that and just say we are not in master 
    265271// mode and all is well. That means the loop below needs to be modified to detect the first 
     
    344350  // 
    345351  // if mastermode is set then the first extension will be examined and mastermode will be reset so that the others 
    346   // are left alone. If the remaining extensions are not to be tried, skipremaining will be set to 1 thus skipping them 
     352  // are left alone. If the remaining extensions are not to be tried, skipremaining will be set to 1 which will 
     353  // result in dndprimary being set to 1 thus diabling the remaining list. 
    347354  // 
    348355  // if cf unconditional was already detected on the primary, then mastermode will have been reset at this point 
     
    640647  // Asterisk 1.6 uses , instead of | and 1.4 can't recieve a , in the ds. 
    641648  // 
    642   if (version_compare($ast_version, "1.6", "ge")) {  
     649  if ($ast_ge_16) { 
    643650    $ds_seperator = ','; 
    644651  } else { 
     
    690697} 
    691698 
    692 $astman->disconnect(); 
     699if (!$has_extension_state) { 
     700  $astman->disconnect(); 
     701
    693702 
    694703// EOF dialparties.agi 
     
    711720   
    712721  if (strpos($extnum,'#') != 0) { 
    713     // "#" used to identify external numbers in forwards and callgourps 
     722    // "#" used to identify external numbers in forwards and callgroups 
    714723    // If using call confirmation, need to put the # back into the new dialstring 
    715724    // we then place all external calls (denoted with a # at the end) through 
     
    762771function is_ext_avail( $extnum ) { 
    763772  global $astman; 
    764    
    765   $status = $astman->ExtensionState( $extnum, 'from-internal' ); 
    766      
    767   $status = $status['Status']; 
    768   debug("ExtensionState: $status", 4); 
     773  global $AGI; 
     774  global $has_extension_state; 
     775 
     776  if ($has_extension_state) { 
     777    $extstate_result  = get_var( $AGI, "EXTENSION_STATE($extnum)" ); 
     778    switch ($extstate_result) { 
     779      case "NOT_INUSE": 
     780        $status = 0; 
     781        break; 
     782      case "INUSE": 
     783        $status = 1; 
     784        break; 
     785      case "BUSY": 
     786        $status = 2; 
     787        break; 
     788      case "UNAVAILABLE": 
     789        $status = 4; 
     790        break; 
     791      case "RINGING": 
     792        $status = 8; 
     793        break; 
     794      case "RINGINUSE": 
     795        $status = 9; 
     796        break; 
     797      case "HOLDINUSE": 
     798        $status = 17; 
     799        break; 
     800      case "ONHOLD": 
     801        $status = 16; 
     802        break; 
     803      case "UNKNOWN": 
     804      default: 
     805        $status = 4; 
     806    } 
     807    debug("EXTENSION_STATE: $status ($extstate_result)", 1); 
     808  } else { 
     809    $status = $astman->ExtensionState( $extnum, 'from-internal' ); 
     810    $status = $status['Status']; 
     811    debug("ExtensionState: $status", 1); 
     812  } 
    769813  return $status; 
    770814} 
  • modules/branches/2.5/core/agi-bin/enumlookup.agi

    r6188 r7917  
    44// Replacement for Asterisk's ENUMLOOKUP function.  
    55// Written by Rob Thomas <xrobau@gmail.com> 
    6 // Released under Version 2 of the GPL 
    7 // Originally written for use with FreePBX. 
    8  
    9 // Based on e164.org's enum.php script, available on http://www.e164.org/enum.phps 
     6// 
     7//    This file is part of FreePBX. http://www.freepbx.org 
     8// 
     9//    FreePBX is free software: you can redistribute it and/or modify 
     10//    it under the terms of the GNU Affero General Public License as 
     11//    published by the Free Software Foundation, either version 3 of the 
     12//    License, or (at your option) any later version. 
     13// 
     14//    FreePBX is distributed in the hope that it will be useful, 
     15//    but WITHOUT ANY WARRANTY; without even the implied warranty of 
     16//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     17//    GNU Affero General Public License for more details. 
     18// 
     19//    You should have received a copy of the GNU Affero General Public License 
     20//    along with FreePBX.  If not, see <http://www.gnu.org/licenses/>. 
     21// 
     22//    Copyright 2009 Rob Thomas 
     23//    Additional patch to support enum.conf by matka 
     24// 
     25//    Originally based on e164.org's enum.php script, available from 
     26//        http://www.e164.org/enum.phps 
    1027 
    1128/* --------WARNING--------- 
    1229 *  
    13  * This script is auto-copied from an included module and will get overwritten. 
    14  * If you modify it, you must change it to write only, in the agi-bin directory, 
    15  * to keep it from getting changed. 
    16  */ 
     30 * This script is automatically copied from $ASTMODULES/core/agi-bin and will be  
     31 * overwritten any time you do any module changes. To avoid this, either set this 
     32 * file to READ ONLY (chmod a-w enumlookup.agi) or alter the file in core. 
     33 * It's probably better to submit any changes or enhancements to the freepbx tracker 
     34 * and they'll be rolled into core! 
     35 * 
     36 * --------WARNING--------- 
     37*/ 
    1738 
    1839require_once "phpagi.php"; 
     
    2142$lookup = get_var( $AGI, "DIAL_NUMBER" ); 
    2243 
    23 $enums = Array( 
    24   'e164.org',  
    25   //'e164.arpa',  
    26   //'e164.info', 
    27 ); 
    28  
    29 // Go through the ENUM providers and look for the number. 
     44$enums = get_enum_providers(); 
    3045 
    3146$dialstr = ""; 
    3247 
    33 foreach ($enums as $enum) { 
     48foreach ($enums as $enum) {  // Go through the ENUM providers and look for the number. 
    3449  // Are we using php5 and can use get_dns_record? 
    3550    if (function_exists("dns_get_record")) { 
     
    5974      if (eregi('SIP|IAX', $row['tech'])) { 
    6075        $URI = $row['URI']; 
    61         $dialstr .= $nextURI[$URI]."|"; 
     76        // string delimiter defined in [macro-dialout-enum] 
     77        $dialstr .= $nextURI[$URI]."%"; 
    6278      } 
    6379    } 
     
    7187  global $AGI; 
    7288 
    73   $AGI->verbose("Looking up $lookup on $enum via shell command DIG",3);; 
     89  $AGI->verbose("Looking up $lookup on $enum via shell command DIG",3); 
    7490  $arpa = ""; 
    7591  for ($i = 0; $i < strlen($lookup); $i++) { 
     
    144160} 
    145161 
     162function get_enum_providers() { 
     163  // parse enum.conf config file  
     164  $localprefix_file = get_var($AGI, "ASTETCDIR")."/enum.conf";  
     165  if (file_exists($localprefix_file)) {  
     166    $section="general";  
     167    parse_conf($localprefix_file, $conf, $section);  
     168    if (count($conf) == 0) {  
     169      $AGI->verbose("Could not parse config file $localprefix_file - using default e164.org", 0);  
     170      return Array("e164.org"); 
     171    }  
     172  } else {  
     173    $AGI->verbose("Could not open config file $localprefix_file - using default e164.org", 0);  
     174    return Array("e164.org"); 
     175  }  
     176 
     177  $enums = Array();  
     178  // pickup search org from the conf array  
     179  if (isset($conf["general"])) {  
     180    foreach ($conf["general"] as $key=>$options) {  
     181      if (isset($options["search"])) {  
     182        foreach($options as $enumorgs) {  
     183          $enums[]=$enumorgs;  
     184        } // store each enumorg in array          
     185      } // else, diff option   
     186    } // else, this isn't the section we want  
     187  } // else, no config for this section  
     188} 
     189 
     190function parse_conf($filename, &$conf, &$section) {  
     191  global $AGI;  
     192  $AGI->verbose("Parsing config file $filename",3);  
     193 
     194  if (is_null($conf)) { $conf = array(); }  
     195 
     196  if (is_null($section)) { $section = "general"; }  
     197 
     198  if (file_exists($filename)) {  
     199    $fd = fopen($filename, "r");  
     200    while ($line = fgets($fd, 1024)) {  
     201      if (preg_match("/^\s*([a-zA-Z0-9-_]+)\s*=>\s*(.*?)\s*([;#].*)?$/",$line,$matches)) {  
     202        // name => => value  
     203        // keep [] to allow for duplicate options like search  
     204        // could extend options to include for example:  
     205        // skipgateway => slow-sip-gateway.com  
     206        // earlyexit => yes (to return only 1 enum from dns lookup)   
     207        $conf[$section][][$matches[1]] = $matches[2];  
     208      } else if (preg_match("/^\s*\[(.+)\]/",$line,$matches)) {  
     209        // section name  
     210        $section = strtolower($matches[1]);  
     211      } else if (preg_match("/^\s*#include\s+(.*)\s*([;#].*)?/",$line,$matches)) {  
     212        // include another file  
     213        if ($matches[1][0] == "/") {  
     214          // absolute path  
     215          $filename = $matches[1];  
     216        } else {  
     217          // relative path  
     218          $filename =  dirname($filename)."/".$matches[1];  
     219        }  
     220        parse_conf($filename, $conf, $section);  
     221      }  
     222    } 
     223  } 
     224} 
     225 
    146226?> 
  • modules/branches/2.5/core/etc/extensions.conf

    r7612 r7917  
    2323; any custom dialplan SHOULD be put in extensions_custom.conf which will       * 
    2424; not hurt a FreePBX generated dialplan. In some very rare and custom          * 
    25 ; situations users may have a need to override what freepbx automatically      * 
     25; situations users may have a need to override what FreePBX automatically      * 
    2626; generates. If so anything in this file will do that.  If you come up with a  * 
    2727; situation where you need to modify the existing dialplan or macro, please    * 
     
    4343#include extensions_custom.conf 
    4444 
    45 [from-trunk]             ; just an alias since VoIP shouldn't be called PSTN 
     45[from-trunk]        ; just an alias since VoIP shouldn't be called PSTN 
    4646include => from-pstn 
    4747 
    4848[from-pstn] 
    49 include => from-pstn-custom                     ; create this context in extensions_custom.conf to include customizations 
     49include => from-pstn-custom    ; create this context in extensions_custom.conf to include customizations 
    5050include => ext-did 
    5151include => ext-did-post-custom 
    52 include => from-did-direct    ; MODIFICATOIN (PL) for findmefollow if enabled, should be bofore ext-local 
     52include => from-did-direct    ; MODIFICATION (PL) for findmefollow if enabled, should be before ext-local 
    5353include => ext-did-catchall   ; THIS MUST COME AFTER ext-did 
    5454exten => fax,1,Goto(ext-fax,in_fax,1) 
     
    5757; 
    5858; Required to assure that direct dids go to personal ring group before local extension. 
    59 ; This could be auto-generated however I it is prefered to be put here and hard coded 
     59; This could be auto-generated however I it is preferred to be put here and hard coded 
    6060; so that it can be modified if ext-local should take precedence in certain situations. 
    6161; will have to decide what to do later. 
     
    101101exten => s,n,Goto(s,a42) 
    102102 
    103 ;Set Call Trace for each hunt member we are going to call "Memory groups have multiple members to set CALL TRACE For hence the loop 
     103;Set Call Trace for each hunt member we are going to call "Memory groups have multiple members to set CALL TRACE For" hence the loop 
    104104; 
    105105exten => s,n(a35),GotoIf($[$["${CALLTRACE_HUNT}" != "" ] & $["${RingGroupMethod}" = "memoryhunt" ]]?a36:a50)   
     
    295295; What to do on hangup.                                          
    296296[macro-hangupcall] 
    297 exten => s,1,ResetCDR(vw) 
    298 exten => s,n,NoCDR() 
    299   
    300297; Cleanup any remaining RG flag 
    301298; 
    302 exten => s,n,GotoIf($[ "x${USE_CONFIRMATION}" = "x" | "x${RINGGROUP_INDEX}" = "x" | "${CHANNEL}" != "${UNIQCHAN}"]?skiprg) 
     299exten => s,1,GotoIf($[ "x${USE_CONFIRMATION}" = "x" | "x${RINGGROUP_INDEX}" = "x" | "${CHANNEL}" != "${UNIQCHAN}"]?skiprg) 
    303300exten => s,n,Noop(Cleaning Up Confirmation Flag: RG/${RINGGROUP_INDEX}/${CHANNEL}) 
    304301exten => s,n,DBDel(RG/${RINGGROUP_INDEX}/${CHANNEL}) 
     
    350347 
    351348[macro-dialout-trunk-predial-hook] 
    352 ; this macro intentially left blank so it may be safely overwritten for any custom 
     349; this macro intentionally left blank so it may be safely overwritten for any custom 
    353350; requirements that an installation may have. 
    354351; 
     
    459456; with congestion since there have been observed cases of the call continuing if not stopped with a  
    460457; congestion, and this provides a slightly more friendly 'sorry' message in case the user is 
    461 ; legitamately trying to be cooperative.  
     458; legitimately trying to be cooperative.  
    462459; 
    463460; Note: the following options are configurable in privacy.conf: 
     
    476473exten => s,n(PRIVMGR),PrivacyManager() 
    477474exten => s,n,GotoIf($["${PRIVACYMGRSTATUS}"="FAILED"]?fail) 
    478 exten => s,n,SetCallerPres(allowed_passed_screen); stop gap until app_privacy.c clears unavailble bit 
     475exten => s,n,SetCallerPres(allowed_passed_screen); stop gap until app_privacy.c clears unavailable bit 
    479476exten => s,PRIVMGR+101(fail),Noop(STATUS: ${PRIVACYMGRSTATUS} CID: ${CALLERID(num)} ${CALLERID(name)} CALLPRES: ${CALLLINGPRES}) 
    480477exten => s,n,Playback(sorry-youre-having-problems) 
     
    490487; try to playback using macro-tts-sayXXXXX (where XXXXX is text/digits/etc, same as 
    491488; the macro below). If that macro exits with MACRO_OFFSET=100, then it's done,  
    492 ; therwise, fallback to the default asterisk method.  
     489; otherwise, fallback to the default asterisk method.  
    493490; 
    494491; say text is purely for text-to-speech, there is no fallback 
     
    544541[from-sip-external] 
    545542;give external sip users congestion and hangup 
    546 ; Yes. This is _really_ meant to be _. - I know asterisk whinges about it, but  
     543; Yes. This is _really_ meant to be _. - I know asterisk whines about it, but  
    547544; I do know what I'm doing. This is correct. 
    548545exten => _.,1,NoOp(Received incoming SIP connection from unknown peer to ${EXTEN}) 
     
    614611[macro-dial-confirm] 
    615612; This was written to make it easy to use macro-dial-confirm instead of macro-dial in generated dialplans. 
    616 ; This takes the same paramaters, with an additional paramater of the ring group Number 
     613; This takes the same parameters, with an additional parameter of the ring group Number 
    617614; ARG1 is the timeout 
    618615; ARG2 is the DIAL_OPTIONS 
     
    635632; USE_CONFIRMATION, RINGGROUP_INDEX 
    636633; 
    637 ; Thse are passed to inform dialparties to place external calls through the [grps] context 
     634; These are passed to inform dialparties to place external calls through the [grps] context 
    638635; 
    639636exten => s,n,Set(USE_CONFIRMATION=TRUE) 
     
    662659; 
    663660; ALERT_INFO is deprecated in Asterisk 1.4 but still used throughout the FreePBX dialplan and 
    664 ; usually set by dialparties.agi. This allows ineritance. Since no dialparties.agi here, set the 
     661; usually set by dialparties.agi. This allows inheritance. Since no dialparties.agi here, set the 
    665662; header if it is set. 
    666663; 
     
    712709;------------------------------------------------------------------------ 
    713710; This context is set as a target with FORWARD_CONTEXT when Call Forwarding is set to be 
    714 ; ignored in a ringgoup or other features that may take advantage of this. Server side 
     711; ignored in a ringgroup or other features that may take advantage of this. Server side 
    715712; CF is done in dialparties.agi but if a client device forwards a call, it will be caught 
    716713; and blocked here. 
  • modules/branches/2.5/core/functions.inc.php

    r7915 r7917  
    216216      $results2 = array(); 
    217217      foreach ($results2_pre as $element) { 
    218         $options = explode("&", $element['data']); 
    219         foreach ($options as $option) { 
    220           if (($element['keyword'] == 'disallow' && $option == 'all') | ($element['keyword'] == 'deny')) { 
    221             array_unshift($results2,array('keyword'=>$element['keyword'],'data'=>$option)); 
    222           } else { 
    223             $results2[] = array('keyword'=>$element['keyword'],'data'=>$option); 
     218        if (strtolower(trim($element['keyword'])) != 'secret') { 
     219          $options = explode("&", $element['data']); 
     220          foreach ($options as $option) { 
     221            if (($element['keyword'] == 'disallow' && $option == 'all') | ($element['keyword'] == 'deny')) { 
     222              array_unshift($results2,array('keyword'=>$element['keyword'],'data'=>$option)); 
     223            } else { 
     224              $results2[] = array('keyword'=>$element['keyword'],'data'=>$option); 
     225            } 
    224226          } 
     227        } else { 
     228          $results2[] = array('keyword'=>$element['keyword'],'data'=>$element['data']); 
    225229        } 
    226230      } 
    227231      unset($results2_pre); 
    228232 
     233      $context=''; 
    229234      foreach ($results2 as $result2) { 
    230         $option = $result2['data']
     235        $option = strtolower($result2['data'])
    231236        if ($ver12) { 
    232           $output .= $result2['keyword']."=$option\n"; 
     237          switch (strtolower($result2['keyword'])) { 
     238            case 'context': 
     239              $context = $option; 
     240              //fall-through 
     241            default: 
     242              $output .= $result2['keyword']."=".$result2['data']."\n"; 
     243          } 
    233244        } else { 
    234245          switch (strtolower($result2['keyword'])) { 
     
    239250                $output .= "insecure=port\n"; 
    240251              else 
    241                 $output .= $result2['keyword']."=$option\n"; 
     252                $output .= $result2['keyword']."=".$result2['data']."\n"; 
    242253              break; 
    243254            case 'allow': 
    244255            case 'disallow': 
    245256              if ($option != '') 
    246                 $output .= $result2['keyword']."=$option\n"; 
     257                $output .= $result2['keyword']."=".$result2['data']."\n"; 
    247258              break; 
    248259            case 'record_in': 
    249260            case 'record_out': 
    250261              break; 
     262            case 'context': 
     263              $context = $result2['data']; 
     264              //fall-through 
    251265            default: 
    252               $output .= $result2['keyword']."=$option\n"; 
     266              $output .= $result2['keyword']."=".$result2['data']."\n"; 
    253267          } 
    254268        } 
     
    347361      $results2 = array(); 
    348362      foreach ($results2_pre as $element) { 
    349         $options = explode("&", $element['data']); 
    350         foreach ($options as $option) { 
    351           if (($element['keyword'] == 'disallow' && $option == 'all') | ($element['keyword'] == 'deny')) { 
    352             array_unshift($results2,array('keyword'=>$element['keyword'],'data'=>$option)); 
    353           } else { 
    354             $results2[] = array('keyword'=>$element['keyword'],'data'=>$option); 
     363        if (strtolower(trim($element['keyword'])) != 'secret') { 
     364          $options = explode("&", $element['data']); 
     365          foreach ($options as $option) { 
     366            if (($element['keyword'] == 'disallow' && $option == 'all') | ($element['keyword'] == 'deny')) { 
     367              array_unshift($results2,array('keyword'=>$element['keyword'],'data'=>$option)); 
     368            } else { 
     369              $results2[] = array('keyword'=>$element['keyword'],'data'=>$option); 
     370            } 
    355371          } 
     372        } else { 
     373          $results2[] = array('keyword'=>$element['keyword'],'data'=>$element['data']); 
    356374        } 
    357375      } 
    358376      unset($results2_pre); 
    359377 
     378      $context=''; 
    360379      foreach ($results2 as $result2) { 
    361         $option = $result2['data']
     380        $option = strtolower($result2['data'])
    362381        if ($ver12) { 
    363           $output .= $result2['keyword']."=$option\n"; 
     382          switch (strtolower($result2['keyword'])) { 
     383            case 'context': 
     384              $context = $result2['data']; 
     385              //fall-through 
     386            default: 
     387              $output .= $result2['keyword']."=".$result2['data']."\n"; 
     388          } 
    364389        } else { 
    365390          switch ($result2['keyword']) { 
     
    372397                $output .= "transfer=mediaonly\n"; 
    373398              } else { 
    374                 $output .= $result2['keyword']."=$option\n"; 
     399                $output .= $result2['keyword']."=".$result2['data']."\n"; 
    375400              } 
    376401              break; 
     
    378403            case 'disallow': 
    379404              if ($option != '') 
    380                 $output .= $result2['keyword']."=$option\n"; 
     405                $output .= $result2['keyword']."=".$result2['data']."\n"; 
    381406              break; 
    382407            case 'record_in': 
    383408            case 'record_out': 
    384409              break; 
     410            case 'context': 
     411              $context = $option; 
     412              //fall-through 
    385413            default: 
    386               $output .= $result2['keyword']."=$option\n"; 
     414              $output .= $result2['keyword']."=".$result2['data']."\n"; 
    387415          } 
    388416        } 
     417      } 
     418      switch (substr($id,0,8)) { 
     419        case 'tr-peer-': 
     420          if ($context == '') { 
     421            $output .= "context=from-trunk-iax2-$account\n"; 
     422          } 
     423          break; 
     424        case 'tr-user-': 
     425          if ($context == '') { 
     426            $tn = substr($id, 8); 
     427            // this is a 'user' trunk, we need to get the name of the corresponding 'peer' 
     428            // trunk so we can set the context appropriately for the group count 
     429            // 
     430            $td = core_trunks_getDetails($tn); 
     431            if (isset($td['channelid'])) { 
     432              $output .= "context=from-trunk-iax2-".$td['channelid']."\n"; 
     433            } 
     434          } 
     435          break; 
     436        default: 
     437          if ($call_limit) { 
     438            $output .= $call_limit; 
     439          } 
    389440      } 
    390441      $output .= $additional."\n"; 
     
    630681  global $core_conf; 
    631682  global $chan_dahdi; 
     683  global $astman;; 
    632684 
    633685  $modulename = "core"; 
     
    651703          $core_conf->addSipGeneral('tos_audio','ef');   // Recommended setting from doc/ip-tos.txt 
    652704          $core_conf->addSipGeneral('tos_video','af41'); // Recommended setting from doc/ip-tos.txt 
     705          $core_conf->addSipGeneral('alwaysauthreject','yes'); 
    653706        } else { 
    654707          $core_conf->addSipGeneral('tos','0x68'); // This really doesn't do anything with astersk not running as root 
     
    11791232      foreach($globals as $global) { 
    11801233        $value = $global['value']; 
    1181         if ($chan_dahdi && substr($value, 0, 4) === 'ZAP/') { 
    1182           $value = 'DAHDI/' . substr($value, 4); 
    1183         } 
    11841234        $ext->addGlobal($global['variable'],$value); 
    11851235 
     
    12281278        $ext->addGlobal('CALLINGPRES_35', 'prohib'); 
    12291279        $ext->addGlobal('CALLINGPRES_67', 'unavailable'); 
     1280      } 
     1281 
     1282      // This checks if we have func_extstate loaded, if so we set the global which dialparties 
     1283      // can use (and any other AGI script) to determine that this function exists and not connect 
     1284      // to the manager to get the information 
     1285      // 
     1286      if (version_compare($version, '1.4', 'ge') && version_compare($version, '1.6', 'lt')) { 
     1287        $response = $astman->send_request('Command', array('Command' => 'module show like func_extstate')); 
     1288        if (preg_match('/1 modules loaded/', $response['data'])) { 
     1289          $ext->addGlobal('HAS_EXTENSION_STATE', 'TRUE'); 
     1290        } 
    12301291      } 
    12311292 
     
    20862147      // If the required voicemail file does not exist, then abort and go to normal voicemail behavior 
    20872148      // 
    2088       // TODO: there have been errors using System() with jump to 101 where asterisk works fine at the begining and 
    2089       //       then starts to jump to 101 even on success. This new mode is being tried with the SYSTEM Status which 
    2090       //       returns SUCCESS when the command returned succcessfully with a 0 app return code. 
     2149      // If 1.4 or above, use the STAT function to check for the file. Prior to 1.4, use the AGI script since the System() command tried 
     2150      // in the past had errors. 
    20912151      // 
    20922152      //exten => vmx,n,Macro(get-vmcontext,${ARG1}) 
     
    20942154      //;exten => vmx,n,TrySystem(/bin/ls ${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}.[wW][aA][vV]) 
    20952155      //$ext->add('macro-vm', 'vmx', '', new ext_trysystem('/bin/ls ${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}.[wW][aA][vV]')); 
    2096       //exten => vmx,n,AGI(checksound.agi,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/temp) 
    2097       $ext->add('macro-vm', 'vmx', '',new ext_agi('checksound.agi,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/temp')); 
    2098       //exten => vmx,n,GotoIf($["${SYSTEMSTATUS}" = "SUCCESS"]?tmpgreet) 
    2099       $ext->add('macro-vm','vmx', '', new ext_gotoif('$["${SYSTEMSTATUS}" = "SUCCESS"]','tmpgreet')); 
    2100       //exten => vmx,n,AGI(checksound.agi,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}) 
    2101       $ext->add('macro-vm', 'vmx', '',new ext_agi('checksound.agi,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}')); 
    2102       //exten => vmx,n,GotoIf($["${SYSTEMSTATUS}" != "SUCCESS"]?nofile) 
    2103       $ext->add('macro-vm','vmx', '', new ext_gotoif('$["${SYSTEMSTATUS}" != "SUCCESS"]','nofile')); 
     2156      if (version_compare($version, "1.4", "ge")) {  
     2157        $ext->add('macro-vm','vmx', '', new ext_gotoif('$[(${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/temp.wav)} = 1) || (${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/temp.WAV)} = 1)]','tmpgreet')); 
     2158        $ext->add('macro-vm','vmx', '', new ext_gotoif('$[(${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}.wav)} = 0) && (${STAT(f,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}.WAV)} = 0)]','nofile')); 
     2159      } else { 
     2160        $ext->add('macro-vm', 'vmx', '',new ext_agi('checksound.agi,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/temp')); 
     2161        $ext->add('macro-vm','vmx', '', new ext_gotoif('$["${SYSTEMSTATUS}" = "SUCCESS"]','tmpgreet')); 
     2162        $ext->add('macro-vm', 'vmx', '',new ext_agi('checksound.agi,${ASTSPOOLDIR}/voicemail/${VMCONTEXT}/${ARG1}/${MODE}')); 
     2163        $ext->add('macro-vm','vmx', '', new ext_gotoif('$["${SYSTEMSTATUS}" != "SUCCESS"]','nofile')); 
     2164      } 
    21042165      // Get the repeat, timeout and loop times to use if they are overriden form the global settings 
    21052166 
     
    36323693  // conditionally, delete from iax or sip 
    36333694  switch (strtolower($tech)) { 
     3695    case "iax2": 
     3696      $tech = "iax"; 
     3697      // fall through 
    36343698    case "iax": 
    36353699    case "iax2": 
     
    36453709  //echo "editTrunk($trunknum, $channelid, $dialoutprefix, $maxchans, $outcid, $peerdetails, $usercontext, $userconfig, $register)"; 
    36463710  $tech = core_trunks_getTrunkTech($trunknum); 
     3711  if ($tech == "") { 
     3712    return false; 
     3713  } 
    36473714  core_trunks_del($trunknum, $tech); 
    36483715  core_trunks_backendAdd($trunknum, $tech, $channelid, $dialoutprefix, $maxchans, $outcid, $peerdetails, $usercontext, $userconfig, $register, $keepcid, $failtrunk, $disabletrunk); 
     
    39414008  $tech = core_trunks_getTrunkTech($trunknum); 
    39424009   
    3943   if ($tech == "zap") return ""; // zap has no details 
     4010  if ($tech == "zap" || $tech == "") return ""; // zap has no details 
    39444011   
    39454012  $results = sql("SELECT keyword,data FROM $tech WHERE id = '9999$trunknum' ORDER BY flags, keyword DESC","getAll"); 
     
    39774044  $tech = core_trunks_getTrunkTech($trunknum); 
    39784045   
    3979   if ($tech == "zap") return ""; // zap has no details 
     4046  if ($tech == "zap" || $tech == "") return ""; // zap has no details 
    39804047   
    39814048  $results = sql("SELECT keyword,data FROM $tech WHERE id = '99999$trunknum' ORDER BY flags, keyword DESC","getAll"); 
     
    39964063  $tech = core_trunks_getTrunkTech($trunknum); 
    39974064   
    3998   if ($tech == "zap") return ""; // zap has no register 
     4065  if ($tech == "zap" || $tech == "") return ""; // zap has no register 
    39994066   
    40004067  $results = sql("SELECT keyword,data FROM $tech WHERE id = '9999999$trunknum'","getAll"); 
  • modules/branches/2.5/core/module.xml

    r7794 r7917  
    44  <category>Basic</category> 
    55  <name>Core</name> 
    6   <version>2.5.1.7</version> 
     6  <version>2.5.1.8</version> 
    77  <candisable>no</candisable> 
    88  <canuninstall>no</canuninstall> 
    99  <changelog> 
    10     *2.5.1.8* #3696 (requires framework updated first), #3706, #3712 
     10    *2.5.1.8* #3696 (requires framework updated first), #3706, #3712, #3478, #3423, #3691, #3693, #3705, #3792 
    1111    *2.5.1.7* #3517, #3653, #3591 
    1212    *2.5.1.6* #3439, #3526, #3534, moved macro-vm to auto-generation (WARNING: custom modification of macro-vm in extensions_custom.conf need to be moved to extensions_override_freepbx.conf 
  • modules/branches/2.5/core/page.did.php

    r7875 r7917  
    3131$pricid = isset($_REQUEST['pricid'])?$_REQUEST['pricid']:''; 
    3232 
     33$tabindex = 0; 
     34 
    3335if (isset($_REQUEST['submitclear']) && isset($_REQUEST['goto0'])) { 
    3436  $_REQUEST[$_REQUEST['goto0'].'0'] = ''; 
  • modules/branches/2.5/core/page.general.php

    r7342 r7917  
    1313 
    1414$action = isset($_REQUEST['action'])?$_REQUEST['action']:''; 
     15$tabindex = 0; 
    1516 
    1617$cm =& cronmanager::create($db); 
  • modules/branches/2.5/core/page.routing.php

    r6845 r7917  
    1717$extdisplay=isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:''; 
    1818$action = isset($_REQUEST['action'])?$_REQUEST['action']:''; 
     19 
     20$tabindex = 0; 
    1921 
    2022$repotrunkdirection = isset($_REQUEST['repotrunkdirection'])?$_REQUEST['repotrunkdirection']:'';