Changeset 8041
- Timestamp:
- 08/14/09 20:39:37 (4 years ago)
- Files:
-
- modules/branches/2.6/core/module.xml (modified) (2 diffs)
- modules/branches/2.6/core/page.trunks.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.6/core/module.xml
r8021 r8041 4 4 <category>Basic</category> 5 5 <name>Core</name> 6 <version>2.6.0beta1. 2</version>6 <version>2.6.0beta1.3</version> 7 7 <publisher>FreePBX</publisher> 8 8 <license>GPLv2+</license> … … 10 10 <canuninstall>no</canuninstall> 11 11 <changelog> 12 *2.6.0beta1.3* trunk tab improvements 12 13 *2.6.0beta1.2* added more sql escape in devices 13 14 *2.6.0beta1.1* #3696, (needs framework updated), #3702, #3706, #3712, #3691, #3693, #3705, #3644, #3739, #3741, #3744, #3790 modules/branches/2.6/core/page.trunks.php
r7880 r8041 21 21 $display='trunks'; 22 22 $extdisplay=isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:''; 23 $trunknum = ltrim($extdisplay,'OUT_'); 24 23 25 $action = isset($_REQUEST['action'])?$_REQUEST['action']:''; 24 $tech = strtolower(isset($_REQUEST['tech'])?$_REQUEST['tech']:''); 25 26 $trunknum = ltrim($extdisplay,'OUT_'); 27 28 29 // populate some global variables from the request string 30 $set_globals = array("outcid","maxchans","dialoutprefix","channelid","peerdetails","usercontext","userconfig","register","keepcid","failtrunk","disabletrunk"); 31 foreach ($set_globals as $var) { 32 if (isset($_REQUEST[$var])) { 33 $$var = stripslashes( $_REQUEST[$var] ); 34 } 35 } 36 37 // ensure that keepcid is set to something: 38 if (!isset($keepcid)) { 39 $keepcid = "off"; 40 } 41 // ensure that failtrunk is set to something: 42 if (!isset($failtrunk)) { 43 $failtrunk = ""; 44 } 26 27 $tech = strtolower(isset($_REQUEST['tech'])?$_REQUEST['tech']:''); 28 $outcid = isset($_REQUEST['outcid'])?$_REQUEST['outcid']:''; 29 $maxchans = isset($_REQUEST['maxchans'])?$_REQUEST['maxchans']:''; 30 $dialoutprefix= isset($_REQUEST['dialoutprefix'])?$_REQUEST['dialoutprefix']:''; 31 $channelid = isset($_REQUEST['channelid'])?$_REQUEST['channelid']:''; 32 $peerdetails = isset($_REQUEST['peerdetails'])?$_REQUEST['peerdetails']:''; 33 $usercontext = isset($_REQUEST['usercontext'])?$_REQUEST['usercontext']:''; 34 $userconfig = isset($_REQUEST['userconfig'])?$_REQUEST['userconfig']:''; 35 $register = isset($_REQUEST['register'])?$_REQUEST['register']:''; 36 $keepcid = isset($_REQUEST['keepcid'])?$_REQUEST['keepcid']:'off'; 37 $disabletrunk = isset($_REQUEST['disabletrunk'])?$_REQUEST['disabletrunk']:'off'; 38 $provider = isset($_REQUEST['provider'])?$_REQUEST['provider']:''; 39 $trunk_name = isset($_REQUEST['trunk_name'])?$_REQUEST['trunk_name']:''; 40 41 $failtrunk = isset($_REQUEST['failtrunk'])?$_REQUEST['failtrunk']:''; 45 42 $failtrunk_enable = ($failtrunk == "")?'':'CHECKED'; 46 43 47 if (!isset($disabletrunk)) {48 $disabletrunk = "off";49 }50 51 44 if (isset($_REQUEST["dialrules"])) { 52 //$dialpattern = $_REQUEST["dialpattern"];53 45 $dialrules = explode("\n",$_REQUEST["dialrules"]); 54 46 … … 74 66 switch ($action) { 75 67 case "addtrunk": 76 if (!isset($failtrunk)) 77 $failtrunk=""; 78 $trunknum = core_trunks_add($tech, $channelid, $dialoutprefix, $maxchans, $outcid, $peerdetails, $usercontext, $userconfig, $register, $keepcid, trim($failtrunk),$disabletrunk); 68 $trunknum = core_trunks_add($tech, $channelid, $dialoutprefix, $maxchans, $outcid, $peerdetails, $usercontext, $userconfig, $register, $keepcid, trim($failtrunk), $disabletrunk, $trunk_name, $provider); 79 69 80 70 core_trunks_addDialRules($trunknum, $dialrules); … … 83 73 break; 84 74 case "edittrunk": 85 if (!isset($failtrunk)) 86 $failtrunk=""; 87 core_trunks_edit($trunknum, $channelid, $dialoutprefix, $maxchans, $outcid, $peerdetails, $usercontext, $userconfig, $register, $keepcid, trim($failtrunk), $disabletrunk); 88 89 /* //DIALRULES 90 deleteTrunkRules($channelid); 91 addTrunkRules($channelid, $dialrules); 92 */ 75 core_trunks_edit($trunknum, $channelid, $dialoutprefix, $maxchans, $outcid, $peerdetails, $usercontext, $userconfig, $register, $keepcid, trim($failtrunk), $disabletrunk, $trunk_name, $provider); 93 76 94 77 // this can rewrite too, so edit is the same … … 100 83 101 84 core_trunks_del($trunknum); 85 core_trunks_deleteDialRules($trunknum); 102 86 core_routing_trunk_del($trunknum); 103 104 /* //DIALRULES105 deleteTrunkRules($channelid);106 */107 core_trunks_deleteDialRules($trunknum);108 87 needreload(); 109 88 redirect_standard(); … … 178 157 } 179 158 180 //get all rows from globals181 $sql = "SELECT * FROM globals";182 $globals = $db->getAll($sql);183 if(DB::IsError($globals)) {184 die_freepbx($globals->getMessage());185 }186 187 //create a set of variables that match the items in global[0]188 foreach ($globals as $global) {189 ${trim($global[0])} = htmlentities($global[1]);190 }191 192 159 ?> 193 160 </div> … … 198 165 <?php 199 166 //get existing trunk info 200 $tresults = core_trunks_list(); 167 $tresults = core_trunks_getDetails(); 168 //$tresults = core_trunks_list(); 201 169 202 170 foreach ($tresults as $tresult) { 203 $background = ($tresult[2] == 'on')?'#DDD':''; 204 echo "\t<li><a ".($extdisplay==$tresult[0] ? 'class="current"':'')." href=\"config.php?display=".urlencode($display)."&extdisplay=".urlencode($tresult[0])."\" title=\"".urlencode($tresult[1])."\" style=\"background: $background;\" >"._("Trunk")." ".substr(str_replace('AMP:', '', $tresult[1]),0,15)."</a></li>\n"; 171 $background = ($tresult['disabled'] == 'on')?'#DDD':''; 172 switch ($tresult['tech']) { 173 case 'enum': 174 $label = substr($tresult['name'],0,15)." ENUM"; 175 break; 176 case 'dundi': 177 $label = substr($tresult['name'],0,15)." (DUNDi)"; 178 break; 179 case 'iax2': 180 $tresult['tech'] = 'iax'; 181 case 'zap': 182 case 'dahdi': 183 case 'sip': 184 case 'iax': 185 case 'custom': 186 default: 187 $label = substr($tresult['name'],0,15)." (".$tresult['tech'].")"; 188 break; 189 } 190 echo "\t<li><a ".($trunknum==$tresult['trunkid'] ? 'class="current"':'')." href=\"config.php?display=".urlencode($display)."&extdisplay=OUT_".urlencode($tresult['trunkid'])."\" title=\"".urlencode($tresult['name'])."\" style=\"background: $background;\" >".$label."</a></li>\n"; 205 191 } 206 192 … … 219 205 $trunks = array( 220 206 array('url'=> $baseURL.'tech=ZAP', 'tlabel' => _("Add Zap Trunk").(ast_with_dahdi()?" ("._("DAHDI compatibility mode").")":"" )), 207 array('url'=> $baseURL.'tech=SIP', 'tlabel' => _("Add SIP Trunk")), 221 208 array('url'=> $baseURL.'tech=IAX2', 'tlabel' => _("Add IAX2 Trunk")), 222 array('url'=> $baseURL.'tech=SIP', 'tlabel' => _("Add SIP Trunk")),223 209 array('url'=> $baseURL.'tech=ENUM', 'tlabel' => _("Add ENUM Trunk")), 224 210 array('url'=> $baseURL.'tech=DUNDI', 'tlabel' => _("Add DUNDi Trunk")), … … 242 228 $failtrunk_enable = ($failtrunk == "")?'':'CHECKED'; 243 229 $disabletrunk = htmlentities($trunk_details['disabled']); 230 $provider = $trunk_details['provider']; 231 $trunk_name = htmlentities($trunk_details['name']); 244 232 245 233 if ($tech!="enum") { … … 249 237 if ($tech!="custom" && $tech!="dundi") { // custom trunks will not have user/peer details in database table 250 238 // load from db 251 if ( !isset($peerdetails)) {239 if (empty($peerdetails)) { 252 240 $peerdetails = core_trunks_getTrunkPeerDetails($trunknum); 253 241 } 254 255 if (!isset($usercontext)) { 242 if (empty($usercontext)) { 256 243 $usercontext = htmlentities($trunk_details['usercontext']); 257 244 } 258 245 259 if ( !isset($userconfig)) {246 if (empty($userconfig)) { 260 247 $userconfig = core_trunks_getTrunkUserConfig($trunknum); 261 248 } 262 249 263 if ( !isset($register)) {250 if (empty($register)) { 264 251 $register = core_trunks_getTrunkRegister($trunknum); 265 252 } 266 253 } 267 254 } 268 269 255 if (count($dialrules) == 0) { 270 256 if ($temp = core_trunks_getDialRules($trunknum)) { … … 279 265 } 280 266 281 282 267 $upper_tech = strtoupper($tech); 283 268 echo "<h2>".sprintf(_("Edit %s Trunk"),$upper_tech).($upper_tech == 'ZAP' && ast_with_dahdi()?" ("._("DAHDI compatibility Mode").")":"")."</h2>"; 284 $tlabel = sprintf(_("Delete Trunk %s"),substr($channelid,0,20)); 269 $tname = $trunk_name != '' ? $trunk_name : $channelid; 270 $tlabel = sprintf(_("Delete Trunk %s"),substr($tname,0,20)); 285 271 $label = '<span><img width="16" height="16" border="0" title="'.$tlabel.'" alt="" src="images/core_delete.png"/> '.$tlabel.'</span>'; 286 272 ?> … … 332 318 $helptext = _('FreePBX offers limited support for DUNDi trunks and additional manual configuration is required. The trunk name should correspond to the [mappings] section of the remote dundi.conf systems. For example, you may have a mapping on the remote system, and corresponding configurations in dundi.conf locally, that looks as follows:<br /><br />[mappings]<br />priv => dundi-extens,0,IAX2,priv:${SECRET}@218.23.42.26/${NUMBER},noparital<br /><br />In this example, you would create this trunk and name it priv. You would then create the corresponding IAX2 trunk with proper settings to work with DUNDi. This can be done by making an IAX2 trunk in FreePBX or by using the iax_custom.conf file.<br />The dundi-extens context in this example must be created in extensions_custom.conf. This can simply include contexts such as ext-local, ext-intercom-users, ext-paging and so forth to provide access to the corresponding extensions and features provided by these various contexts and generated by FreePBX.'); 333 319 break; 320 case 'sip': 321 break; 334 322 default: 335 323 $helptext = ''; … … 349 337 <input type="hidden" name="action" value=""/> 350 338 <input type="hidden" name="tech" value="<?php echo $tech?>"/> 339 <input type="hidden" name="provider" value="<?php echo $provider?>"/> 351 340 <table> 352 341 <tr> … … 357 346 <tr> 358 347 <td> 359 <a href=# class="info"><?php echo _(" Outbound Caller ID")?><span><br><?php echo _("Caller ID for calls placed out on this trunk<br><br>Format: <b>\"caller name\" <#######></b>. You can also use the magic string 'hidden' to hide the CallerID sent out over Digital lines ONLY (E1/T1/J1/BRI/SIP/IAX)")?><br><br></span></a>:348 <a href=# class="info"><?php echo _("Trunk Description")?><span><br><?php echo _("Descriptive Name for this Trunk")?><br><br></span></a>: 360 349 </td><td> 361 <input type="text" size="20" name="outcid" value="<?php echo $outcid;?>" tabindex="<?php echo ++$tabindex;?>"/> 362 </td> 363 </tr> 364 <tr> 365 <td> 366 <a href="#" class="info"><?php echo _("Never Override CallerID")?><span><br><?php echo _("Some VoIP providers will drop the call if you try to send an invalid CallerID (one you don't 'own.' Use this to never send a CallerID that you haven't explicitly specified in this trunk or in the outbound callerid field of an extension/user. You might notice this problem if you discover that Follow-Me or RingGroups with external numbers don't work properly. Checking this box has the effect of disabling 'foreign' callerids from going out this trunk. You must define an Outbound Caller ID on the this trunk when checking this.");?><br /><br /></span></a>: 350 <input type="text" size="30" name="trunk_name" value="<?php echo $trunk_name;?>" tabindex="<?php echo ++$tabindex;?>"/> 351 </td> 352 </tr> 353 <tr> 354 <td> 355 <a href=# class="info"><?php echo _("Outbound Caller ID")?><span><br><?php echo _("Caller ID for calls placed out on this trunk<br><br>Format: <b><#######></b>. You can also use the format: \"hidden\" <b><#######></b> to hide the CallerID sent out over Digital lines if supported (E1/T1/J1/BRI/SIP/IAX).")?><br><br></span></a>: 356 </td><td> 357 <input type="text" size="30" name="outcid" value="<?php echo $outcid;?>" tabindex="<?php echo ++$tabindex;?>"/> 358 </td> 359 </tr> 360 <tr> 361 <td> 362 <a href="#" class="info"><?php echo _("Block Foreign CallerIDs")?><span><br><?php echo _("Some VoIP providers will drop the call if you try to send an invalid CallerID (one you don't 'own.' Use this to never send a CallerID that you haven't explicitly specified in this trunk or in the outbound callerid field of an extension/user. You might notice this problem if you discover that Follow-Me or RingGroups with external numbers don't work properly. Checking this box has the effect of disabling 'foreign' callerids from going out this trunk. You must define an Outbound Caller ID on the this trunk when checking this.");?><br /><br /></span></a>: 367 363 </td><td> 368 364 <input type="checkbox" name="keepcid" <?php if ($keepcid=="on") {echo "checked";}?> tabindex="<?php echo ++$tabindex;?>"/> … … 394 390 </td> 395 391 </tr> 396 397 392 <tr> 398 393 <td><a class="info" href="#"><?php echo _("Monitor Trunk Failures")?><span><?php echo _("If checked, supply the name of a custom AGI Script that will be called to report, log, email or otherwise take some action on trunk failures that are not caused by either NOANSWER or CANCEL.")?></span></a>:
