Changeset 5566
- Timestamp:
- 01/10/08 14:06:39 (5 years ago)
- Files:
-
- modules/branches/2.4/core/functions.inc.php (modified) (11 diffs)
- modules/branches/2.4/core/page.trunks.php (modified) (10 diffs)
- modules/branches/2.4/dashboard/class.astinfo.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.4/core/functions.inc.php
r5563 r5566 943 943 $ext->add($trunkcontext, '_.', '', new ext_goto('1','${EXTEN}','from-trunk')); 944 944 break; 945 case 'DUNDI': 946 $macro_name = 'macro-dundi-'.substr($trunkprops['globalvar'],4); 947 $ext->addSwitch($macro_name,'DUNDI/'.$trunkprops['name']); 948 $ext->add($macro_name, 's', '', new ext_goto('1','${ARG1}')); 949 break; 945 950 default: 946 951 } … … 1018 1023 if(strpos($exten['args'],"MOHCLASS") !== false) 1019 1024 $ext->add($outrt['application'], $exten['extension'], '', new ext_setvar("MOHCLASS", '${IF($["x${MOHCLASS}"="x"]?'.substr($exten['args'],9).':${MOHCLASS})}' )); 1020 if(strpos($exten['args'],"dialout-trunk") !== false || strpos($exten['args'],"dialout-enum") !== false ) {1025 if(strpos($exten['args'],"dialout-trunk") !== false || strpos($exten['args'],"dialout-enum") !== false || strpos($exten['args'],"dialout-dundi") !== false) { 1021 1026 if ($exten['extension'] !== $lastexten) { 1022 1027 … … 1039 1044 } 1040 1045 } 1046 1041 1047 general_generate_indications(); 1042 1048 … … 1172 1178 1173 1179 1180 1181 1182 $context = 'macro-dialout-dundi'; 1183 $exten = 's'; 1184 1185 /* 1186 * Dialout Dundi Trunk 1187 */ 1188 $ext->add($context, $exten, '', new ext_set('DIAL_TRUNK', '${ARG1}')); 1189 $ext->add($context, $exten, '', new ext_execif('$[$["${ARG3}" != ""] & $["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]]', 'Authenticate', '${ARG3}')); 1190 $ext->add($context, $exten, '', new ext_gotoif('$["x${OUTDISABLE_${DIAL_TRUNK}}" = "xon"]', 'disabletrunk,1')); 1191 $ext->add($context, $exten, '', new ext_set('DIAL_NUMBER', '${ARG2}')); // fixlocalprefix depends on this 1192 $ext->add($context, $exten, '', new ext_set('DIAL_TRUNK_OPTIONS', '${DIAL_OPTIONS}')); // will be reset to TRUNK_OPTIONS if not intra-company 1193 $ext->add($context, $exten, '', new ext_set('GROUP()', 'OUT_${DIAL_TRUNK}')); 1194 $ext->add($context, $exten, '', new ext_gotoif('$["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = "foo"]', 'nomax')); 1195 $ext->add($context, $exten, '', new ext_gotoif('$[ ${GROUP_COUNT(OUT_${DIAL_TRUNK})} > ${OUTMAXCHANS_${DIAL_TRUNK}} ]', 'chanfull')); 1196 $ext->add($context, $exten, 'nomax', new ext_gotoif('$["${INTRACOMPANYROUTE}" = "YES"]', 'skipoutcid')); // Set to YES if treated like internal 1197 $ext->add($context, $exten, '', new ext_set('DIAL_TRUNK_OPTIONS', '${TRUNK_OPTIONS}')); 1198 $ext->add($context, $exten, '', new ext_macro('outbound-callerid', '${DIAL_TRUNK}')); 1199 $ext->add($context, $exten, 'skipoutcid', new ext_agi('fixlocalprefix')); // this sets DIAL_NUMBER to the proper dial string for this trunk 1200 $ext->add($context, $exten, '', new ext_set('OUTNUM', '${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER}')); // OUTNUM is the final dial number 1201 1202 // Back to normal processing, whether intracompany or not. 1203 // But add the macro-setmusic if we don't want music on this outbound call 1204 $ext->add($context, $exten, '', new ext_gotoif('$[$["${MOHCLASS}" = "default"] | $["foo${MOHCLASS}" = "foo"]]', 'gocall')); // Set to YES if we should pump silence 1205 $ext->add($context, $exten, '', new ext_set('DIAL_TRUNK_OPTIONS', 'M(setmusic^${MOHCLASS})${DIAL_TRUNK_OPTIONS}')); // set MoH or off 1206 1207 // This macro call will always be blank and is provided as a hook for customization required prior to making a call 1208 // such as adding SIP header information or other requirements. All the channel variables from above are present 1209 1210 $ext->add($context, $exten, 'gocall', new ext_macro('dialout-trunk-predial-hook')); 1211 $ext->add($context, $exten, '', new ext_gotoif('$["${PREDIAL_HOOK_RET}" = "BYPASS"]', 'bypass,1')); 1212 1213 $ext->add($context, $exten, '', new ext_gotoif('$["${custom}" = "AMP"]', 'customtrunk')); 1214 1215 $ext->add($context, $exten, '', new ext_macro('dundi-${DIAL_TRUNK}','${OUTNUM}')); 1216 $ext->add($context, $exten, '', new ext_goto(1, 's-${DIALSTATUS}')); 1217 1218 $ext->add($context, $exten, 'chanfull', new ext_noop('max channels used up')); 1219 1220 $exten = 's-BUSY'; 1221 $ext->add($context, $exten, '', new ext_noop('Dial failed due to trunk reporting BUSY - giving up')); 1222 $ext->add($context, $exten, '', new ext_playtones('busy')); 1223 $ext->add($context, $exten, '', new ext_busy(20)); 1224 1225 $exten = 's-NOANSWER'; 1226 $ext->add($context, $exten, '', new ext_noop('Dial failed due to trunk reporting NOANSWER - giving up')); 1227 $ext->add($context, $exten, '', new ext_playtones('congestion')); 1228 $ext->add($context, $exten, '', new ext_congestion(20)); 1229 1230 $exten = 's-CANCEL'; 1231 $ext->add($context, $exten, '', new ext_noop('Dial failed due to trunk reporting CANCEL - giving up')); 1232 $ext->add($context, $exten, '', new ext_playtones('congestion')); 1233 $ext->add($context, $exten, '', new ext_congestion(20)); 1234 1235 $exten = '_s-.'; 1236 $ext->add($context, $exten, '', new ext_gotoif('$["x${OUTFAIL_${ARG1}}" = "x"]', 'noreport')); 1237 $ext->add($context, $exten, '', new ext_agi('${OUTFAIL_${ARG1}}')); 1238 $ext->add($context, $exten, 'noreport', new ext_noop('TRUNK Dial failed due to ${DIALSTATUS} - failing through to other trunks')); 1239 1240 $ext->add($context, 'disabletrunk', '', new ext_noop('TRUNK: ${OUT_${DIAL_TRUNK}} DISABLED - falling through to next trunk')); 1241 $ext->add($context, 'bypass', '', new ext_noop('TRUNK: ${OUT_${DIAL_TRUNK}} BYPASSING because dialout-trunk-predial-hook')); 1242 1243 $ext->add($context, 'h', '', new ext_macro('hangupcall')); 1244 1245 1246 1174 1247 /* 1175 1248 * sets the callerid of the device to that of the logged in user … … 2783 2856 foreach ($unique_trunks as $trunk) { 2784 2857 list($tech,$name) = explode('/',$trunk[1]); 2785 $trunkinfo[$ name] = array(2858 $trunkinfo[$trunk[1]] = array( 2786 2859 'name' => $name, 2787 2860 'tech' => $tech, … … 2989 3062 2990 3063 if ($amp_conf["AMPDBENGINE"] == "sqlite3") 2991 $sql_code = "SELECT DISTINCT context, priority FROM extensions WHERE context LIKE 'outrt-%' AND (args LIKE 'dialout-trunk,".$trunknum.",%' OR args LIKE 'dialout-enum,".$trunknum.",%' ) ORDER BY context";3064 $sql_code = "SELECT DISTINCT context, priority FROM extensions WHERE context LIKE 'outrt-%' AND (args LIKE 'dialout-trunk,".$trunknum.",%' OR args LIKE 'dialout-enum,".$trunknum.",%' OR args LIKE 'dialout-dundi,".$trunknum.",%') ORDER BY context"; 2992 3065 else 2993 $sql_code = "SELECT DISTINCT SUBSTRING(context,7), priority FROM extensions WHERE context LIKE 'outrt-%' AND (args LIKE 'dialout-trunk,".$trunknum.",%' OR args LIKE 'dialout-enum,".$trunknum.",%' ) ORDER BY context";3066 $sql_code = "SELECT DISTINCT SUBSTRING(context,7), priority FROM extensions WHERE context LIKE 'outrt-%' AND (args LIKE 'dialout-trunk,".$trunknum.",%' OR args LIKE 'dialout-enum,".$trunknum.",%' OR args LIKE 'dialout-dundi,".$trunknum.",%') ORDER BY context"; 2994 3067 2995 3068 $results = sql( $sql_code, "getAll" ); … … 3327 3400 $pass_str = ""; 3328 3401 3329 if ($trunktech[$trunk] == "ENUM") 3402 if ($trunktech[$trunk] == "ENUM") { 3330 3403 $sql .= "'dialout-enum,".substr($trunk,4).",\${".$exten."},".$pass_str."'"; // cut off OUT_ from $trunk 3331 else 3404 } else if ($trunktech[$trunk] == "DUNDI") { 3405 $sql .= "'dialout-dundi,".substr($trunk,4).",\${".$exten."},".$pass_str."'"; // cut off OUT_ from $trunk 3406 } else { 3332 3407 $sql .= "'dialout-trunk,".substr($trunk,4).",\${".$exten."},".$pass_str."'"; // cut off OUT_ from $trunk 3408 } 3333 3409 $sql .= ")"; 3334 3410 … … 3445 3521 function core_routing_getroutepatterns($route) { 3446 3522 global $db; 3447 $sql = "SELECT extension, args FROM extensions WHERE context = 'outrt-".$route."' AND (args LIKE 'dialout-trunk%' OR args LIKE 'dialout-enum%') ORDER BY extension ";3523 $sql = "SELECT extension, args FROM extensions WHERE context = 'outrt-".$route."' AND (args LIKE 'dialout-trunk%' OR args LIKE 'dialout-enum%' OR args LIKE 'dialout-dundi%') ORDER BY extension "; 3448 3524 $results = $db->getAll($sql); 3449 3525 if(DB::IsError($results)) { … … 3473 3549 function core_routing_getroutetrunks($route) { 3474 3550 global $db; 3475 $sql = "SELECT DISTINCT args FROM extensions WHERE context = 'outrt-".$route."' AND (args LIKE 'dialout-trunk,%' OR args LIKE 'dialout-enum,%' ) ORDER BY CAST(priority as UNSIGNED) ";3551 $sql = "SELECT DISTINCT args FROM extensions WHERE context = 'outrt-".$route."' AND (args LIKE 'dialout-trunk,%' OR args LIKE 'dialout-enum,%' OR args LIKE 'dialout-dundi,%') ORDER BY CAST(priority as UNSIGNED) "; 3476 3552 $results = $db->getAll($sql); 3477 3553 if(DB::IsError($results)) { … … 3491 3567 $trunks[] = "OUT_".$matches[1]; 3492 3568 } 3569 } else if (preg_match('/^dialout-dundi,(\d+)/', $row[0], $matches)) { 3570 if (!in_array("OUT_".$matches[1], $trunks)) { 3571 $trunks[] = "OUT_".$matches[1]; 3572 } 3493 3573 } 3494 3574 } … … 3500 3580 function core_routing_getroutepassword($route) { 3501 3581 global $db; 3502 $sql = "SELECT DISTINCT args FROM extensions WHERE context = 'outrt-".$route."' AND (args LIKE 'dialout-trunk,%' OR args LIKE 'dialout-enum,%' ) ORDER BY CAST(priority as UNSIGNED) ";3582 $sql = "SELECT DISTINCT args FROM extensions WHERE context = 'outrt-".$route."' AND (args LIKE 'dialout-trunk,%' OR args LIKE 'dialout-enum,%' OR args LIKE 'dialout-dundi,%') ORDER BY CAST(priority as UNSIGNED) "; 3503 3583 $results = $db->getOne($sql); 3504 3584 if(DB::IsError($results)) { modules/branches/2.4/core/page.trunks.php
r5353 r5566 12 12 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 13 //GNU General Public License for more details. 14 15 14 16 15 … … 173 172 } 174 173 175 176 177 174 //get all rows from globals 178 175 $sql = "SELECT * FROM globals"; … … 218 215 <a href="<?php echo $_SERVER['PHP_SELF'].'?display='.urlencode($display); ?>&tech=ENUM"><?php echo _("Add ENUM Trunk")?></a><br><br> 219 216 <a href="<?php echo $_SERVER['PHP_SELF'].'?display='.urlencode($display); ?>&tech=CUSTOM"><?php echo _("Add Custom Trunk")?></a><br><br> 217 <a href="<?php echo $_SERVER['PHP_SELF'].'?display='.urlencode($display); ?>&tech=DUNDI"><?php echo _("Add DUNDi Trunk")?></a><br><br> 220 218 <?php 221 219 } else { … … 232 230 $failtrunk_enable = ($failtrunk == "")?'':'CHECKED'; 233 231 $disabletrunk = isset(${"OUTDISABLE_".$trunknum})?${"OUTDISABLE_".$trunknum}:''; 232 234 233 235 234 if ($tech!="enum") { … … 239 238 } 240 239 241 if ($tech!="custom" ) { // custom trunks will not have user/peer details in database table240 if ($tech!="custom" && $tech!="dundi") { // custom trunks will not have user/peer details in database table 242 241 // load from db 243 242 if (!isset($peerdetails)) { … … 270 269 unset($temp); 271 270 } 272 271 273 272 echo "<h2>".sprintf(_("Edit %s Trunk"),strtoupper($tech))."</h2>"; 274 273 ?> … … 314 313 315 314 echo "<h2>".sprintf("Add %s Trunk",strtoupper($tech))."</h2>"; 315 316 316 } 317 switch ($tech) { 318 case 'dundi': 319 $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.'); 320 break; 321 default: 322 $helptext = ''; 323 } 324 if ($helptext != '') { 325 if ($extdisplay) { 326 echo "<br /><br />"; 327 } 328 echo $helptext; 329 } 330 317 331 ?> 318 332 … … 664 678 <?php 665 679 break; 680 case "dundi": 681 ?> 682 <tr> 683 <td> 684 <a href=# class="info"><?php echo _("DUNDi Mapping")?><span><?php echo _("This is the name of the DUNDi mapping as defined in the [mappings] section of remote dundi.conf peers. This corresponds to the 'include' section of the peer details in the local dundi.conf file. This requires manual configuration of DUNDi to use this trunk.")?></span></a>: 685 </td><td> 686 <input type="text" size="35" maxlength="46" name="channelid" value="<?php echo htmlspecialchars($channelid) ?>"/> 687 <input type="hidden" size="14" name="usercontext" value="notneeded"/> 688 </td> 689 </tr> 690 <?php 691 break; 666 692 default: 667 693 ?> … … 768 794 return warnInvalid(theForm.dialoutprefix, msgInvalidOutboundDialPrefix); 769 795 770 <?php if ($tech != "enum" && $tech != "custom" ) { ?>796 <?php if ($tech != "enum" && $tech != "custom" && $tech != "dundi") { ?> 771 797 defaultEmptyOK = true; 772 798 if (isEmpty(theForm.channelid.value) || isWhitespace(theForm.channelid.value)) … … 775 801 if (theForm.channelid.value == theForm.usercontext.value) 776 802 return warnInvalid(theForm.usercontext, msgInvalidTrunkAndUserSame); 777 <?php } else if ($tech == "custom" ) { ?>803 <?php } else if ($tech == "custom" || $tech == "dundi") { ?> 778 804 if (isEmpty(theForm.channelid.value) || isWhitespace(theForm.channelid.value)) 779 805 return warnInvalid(theForm.channelid, msgInvalidChannelName); modules/branches/2.4/dashboard/class.astinfo.php
r5356 r5566 103 103 $online = !empty($matches[6]); 104 104 105 if (isset($trunks[ $matches[2]])) {105 if (isset($trunks['SIP/'.$matches[2]])) { 106 106 // this is a trunk 107 107 //TODO match trunk tech as well? … … 143 143 $online = !empty($matches[6]); 144 144 145 if (isset($trunks[ $matches[2]])) {145 if (isset($trunks['IAX2/'.$matches[2]])) { 146 146 // this is a trunk 147 147 //TODO match trunk tech as well?
