Changeset 3406
- Timestamp:
- 12/21/06 19:41:20 (5 years ago)
- Files:
-
- freepbx/trunk/amp_conf/agi-bin/dialparties.agi (modified) (10 diffs)
- freepbx/trunk/amp_conf/astetc/extensions.conf (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk/amp_conf/agi-bin/dialparties.agi
r3395 r3406 60 60 $pr_dialstatus = get_var( $AGI, "PR_DIALSTATUS" ); 61 61 62 $fmgrp = get_var( $AGI, "FMGRP" ); 62 63 $nodest = get_var( $AGI, "NODEST" ); 63 64 if (empty($nodest)) $nodest = ''; 64 65 66 $ringgroup_index = get_var( $AGI, "RINGGROUP_INDEX" ); 65 67 $use_confirmation = get_var( $AGI, "USE_CONFIRMATION" ); 66 $ringgroup_index = get_var( $AGI, "RINGGROUP_INDEX" ); 68 if (empty($use_confirmation)) $use_confirmation = "FALSE"; 69 debug("USE_CONFIRMATION: '$use_confirmation'", 4); 70 debug("RINGGROUP_INDEX: '$ringgroup_index'", 4); 67 71 68 72 if (empty($timer)) $timer = 0; … … 70 74 if (empty($rgmethod)) $rgmethod = "none"; 71 75 72 if (empty($use_confirmation)) $use_confirmation = "FALSE";73 76 74 77 debug("Methodology of ring is '$rgmethod'", 1); 75 debug("USE_CONFIRMATION: '$use_confirmation'", 4);76 debug("RINGGROUP_INDEX: '$ringgroup_index'", 4);77 78 78 79 // reset the ringgroup method to its fundamental algorithm and pull out if 79 80 // master mode. 81 82 $recall_mastermode=$rgmethod; 80 83 81 84 if ($rgmethod == "ringall-prim") { … … 89 92 $mastermode = 1; 90 93 } else 94 } elseif ($rgmethod == "ringallv2-prim") 95 { 96 $rgmethod = "ringallv2"; 97 $mastermode = 1; 91 98 $mastermode = 0; 92 99 … … 96 103 // if they set a -prim mode in one of the others 97 104 // 98 if ( ($use_confirmation != "FALSE") && ( $rgmethod != "ringall") ) {99 debug("Unsupported RingMethod reset to: '$rgmethod'", 1);105 if ( ($use_confirmation != "FALSE") && (trim($rgmethod) != "ringall") && (trim($rgmethod) != "ringallv2") ) { 106 debug("Unsupported RingMethod: '$rgmethod' resetting to ringall", 1); 100 107 $rgmethod = "ringall"; 101 108 } … … 119 126 120 127 $arg_cnt++; 128 } 129 130 // FollowMe Preparation for Pre-Ring: 131 // 132 // If the primary extension is in the ringgroup list, then it should be rung 133 // during both the pre-ring time and the list time, so it's real prering time 134 // is the entire time. If it is not in the list, then it should only ring 135 // for the pre-ring time. This section determines the times and then adds it 136 // to the list if not already there, so that the dialstring is computed 137 // appropriately. This section also makes sure that the primary extension 138 // is at the top of the list. 139 // 140 // Notes before I forget. The primary may have been in the list and screwed 141 // above. So ... do I need to move this up, probably. 142 // 143 if ($rgmethod == "ringallv2" && $fmgrp != "") { 144 145 $fmgrp_primaryremoved = 0; 146 147 $fmgrp_prering = $AGI->database_get('AMPUSER', $fmgrp."/followme/prering"); 148 $fmgrp_prering = $fmgrp_prering['data'] > 1 ? $fmgrp_prering['data'] : 2; 149 150 $fmgrp_grptime = $AGI->database_get('AMPUSER', $fmgrp."/followme/grptime"); 151 $fmgrp_grptime = $fmgrp_grptime['data']; 152 153 debug("got fmgrp_prering: $fmgrp_prering, fmgrp_grptime: $fmgrp_grptime",4); 154 155 $fmgrp_totalprering = $fmgrp_grptime + $fmgrp_prering; 156 157 debug("fmgrp_totalprering: $fmgrp_totalprering",4); 158 159 if (in_array($fmgrp, $ext)) { 160 debug("found extension in pre-ring and array",4); 161 $fmgrp_realprering = $fmgrp_totalprering; 162 if ($ext[0] != $fmgrp) { 163 $tmpx=array_flip($ext); 164 unset($ext[$tmpx[$fmgrp]]); 165 array_unshift($ext,$fmgrp); 166 } 167 } else { 168 debug("extension not in group list, ringging only during perring time",4); 169 $fmgrp_realprering = $fmgrp_prering; 170 array_unshift($ext,$fmgrp); 171 } 172 debug("ringallv2 ring times: REALPRERING: $fmgrp_realprering, PRERING: $fmgrp_prering",4); 121 173 } 122 174 … … 164 216 // Now check for DND 165 217 foreach ( $ext as $k ) 166 { //if ( !preg_match($k, "/\#/", $matches) )218 { 167 219 if ( (strpos($k,"#")==0) ) 168 220 { … … 180 232 { 181 233 $dndprimary = 1; 234 $fmgrp_primaryremoved = 1; 182 235 debug("Primary extension is DND, so if mastermode, all should be dnd", 4); 183 236 } … … 190 243 191 244 // Main calling loop 245 // 192 246 $skipremaining = 0; // used to allow primary to ring but skip the rest 193 194 247 $ds = ''; 195 248 foreach ( $ext as $k ) … … 343 396 { 344 397 $dsarray[$realext] = 1; // could be dial string i suppose but currently only using for duplicate check 345 $extds = get_dial_string( $AGI, $extnum, $use_confirmation, $ringgroup_index); 346 if (strlen($extds)) $ds .= $extds . '&'; 398 399 $extds = get_dial_string( $AGI, $extnum, $use_confirmation, $ringgroup_index); 400 if (strlen($extds)) $ds .= $extds . '&'; 347 401 348 402 // Update Caller ID for calltrace application … … 422 476 if (!strlen($ds)) 423 477 { 478 // FollowMe Changes: 479 // 480 // We need to determine if the generated dialstring can be dialed as is. This will be the case if there are no 481 // or is only a single extension to dial. 482 // 483 // First, unset any blank fields so we know how many extensions there are to call. 484 // 485 // If mastermode (skipremaining == 1) was triggered then we just set the ringtime to what the primary extension 486 // should ring for and let this dialstring go. 487 // 488 // If there is only one extension in the list, then we need to determine how long to ring it (depending on if it 489 // was the primary or another extension, then let the generated dialstring ring it. 490 // 491 // Otherwise, we need to re-create the dialstring to be processed by our special dialplan that will ring the 492 // primary extension and hold the group list for the required delay. Also - if we are in a call confirmation mode 493 // then we need to reset the call confirm variables with one level of inheritance so that they remain in the new 494 // channels but don't get further propogated after that. We also clear it for the remainder of this instance since 495 // we are not yet triggering further actions until the next call. 496 // 497 // Notes: $fmgrp_primaryremoved is set to 1 if the primary has been removed from the list so we know that it was dnd-ed. 498 // this only matters in non-prim mode, where we need to know if the remaining list contains the primary extension 499 // or not. 500 // 501 if ($rgmethod == 'ringallv2') { 502 $count = 0; 503 foreach ($ext as $x) { 504 if ($x == '') { 505 unset($ext[$count]); 506 } 507 $count++; 508 } 509 510 if (($skipremaining == 1) || (count($ext) == 1 && $fmgrp_primaryremoved == 0)) { 511 $timer = $fmgrp_realprering; 512 } elseif (count($ext) == 1 && $fmgrp_primaryremoved == 1) { 513 $timer = $fmgrp_grptime; 514 } elseif (count($ext) == 1) { 515 $timer = $fmgrp_totalprering; // not sure what would trigger this ? 516 } else { 517 $timer = $fmgrp_totalprering; 518 $ds = "Local/FMPR-".array_shift($ext)."@from-internal&Local/FMGL-".implode('-',$ext)."@from-internal"; 519 520 $fmgrp_fmunique = $AGI->request['agi_channel']; 521 $AGI->set_variable('_FMUNIQUE',$fmgrp_fmunique); 522 $AGI->set_variable('_RingGroupMethod',"ringall"); 523 $fmgrp_prering -= 2; 524 $AGI->set_variable('_FMPRERING',$fmgrp_prering); 525 $AGI->set_variable('_FMREALPRERING',$fmgrp_realprering); 526 $AGI->set_variable('_FMGRPTIME',$fmgrp_grptime); 527 $AGI->set_variable('_FMPRIME',($recall_mastermode == "ringallv2")?"FALSE":"TRUE"); 528 529 debug("FMUNIQUE: $fmgrp_fmunique, FMRERING: $fmgrp_prering, FMREALPRERING: $fmgrp_realprering, FMGRPTIME: $fmgrp_grptime",4); 530 531 if ($use_confirmation != 'FALSE') { 532 $AGI->set_variable('_USE_CONFIRMATION',$use_confirmation); 533 $AGI->set_variable('_RINGGROUP_INDEX',$ringgroup_index); 534 $use_confirmation = 'FALSE'; 535 } 536 } 537 } 538 539 if ($nodest != '' && $use_confirmation == 'FALSE') { 540 if (strpos($dialopts,"M(auto-blkvm)") > 0 || strpos($dialopts,"M(auto-blkvm)") === 0 || 541 strpos($dialopts,"M(auto-confirm") > 0 || strpos($dialopts,"M(auto-confirm") === 0 || 542 strpos($dialopts,"M(confirm") > 0 || strpos($dialopts,"M(confirm") === 0) { 543 debug("NODEST: $nodest blkvm enabled macro already in dialopts: $dialopts",4); 544 } else { 545 $dialopts .= "M(auto-blkvm)"; 546 debug("NODEST: $nodest adding M(auto-blkvm) to dialopts: $dialopts",4); 547 } 548 } 549 424 550 $AGI->noop(''); 425 551 } else { freepbx/trunk/amp_conf/astetc/extensions.conf
r3395 r3406 281 281 ; Cleanup any remaining RG flag 282 282 ; 283 exten => s,n,GotoIf($[ " foo${USE_CONFIRMATION}" = "foo" | "foo${RINGGROUP_INDEX}" = "foo" | "${CHANNEL}" != "${UNIQCHAN}"]?skiprg)283 exten => s,n,GotoIf($[ "x${USE_CONFIRMATION}" = "x" | "x${RINGGROUP_INDEX}" = "x" | "${CHANNEL}" != "${UNIQCHAN}"]?skiprg) 284 284 exten => s,n,Noop(Cleaning Up Confirmation Flag: RG/${RINGGROUP_INDEX}/${CHANNEL}) 285 285 exten => s,n,DBDel(RG/${RINGGROUP_INDEX}/${CHANNEL}) … … 287 287 ; Cleanup any remaining BLKVM flag 288 288 ; 289 exten => s,n(skiprg),GotoIf($[ " foo${BLKVM_BASE}" = "foo" | "BLKVM/${BLKVM_BASE}/${CHANNEL}" != "${BLKVM_OVERRIDE}" ]?theend)289 exten => s,n(skiprg),GotoIf($[ "x${BLKVM_BASE}" = "x" | "BLKVM/${BLKVM_BASE}/${CHANNEL}" != "${BLKVM_OVERRIDE}" ]?skipblkvm) 290 290 exten => s,n,Noop(Cleaning Up Block VM Flag: ${BLKVM_OVERRIDE}) 291 291 exten => s,n,DBDel(${BLKVM_OVERRIDE}) 292 292 293 exten => s,n(theend),Wait(5) 293 ; Cleanup any remaining FollowMe DND flags 294 ; 295 exten => s,n(skipblkvm),GotoIf($[ "x${FMGRP}" = "x" | "x${FMUNIQUE}" = "x" | "${CHANNEL}" != "${FMUNIQUE}" ]?theend) 296 exten => s,n,DBDel(FM/DND/${FMGRP}/${CHANNEL}) 297 298 exten => s,n(theend),Wait(2) 294 299 exten => s,n,Hangup 295 300 … … 802 807 exten => s,n,Playtones(congestion) 803 808 exten => s,n,Congestion(5) 809 include => findmefollow-ringallv2 804 810 exten => h,1,NoOp(Hangup) 805 811 exten => i,1,NoOp(Invalid) … … 1048 1054 ;------------------------------------------------------------------------ 1049 1055 1056 ;------------------------------------------------------------------------ 1057 ; [findmefollow-ringallv2] 1058 ;------------------------------------------------------------------------ 1059 ; This context, to be included in from-internal, implements the PreRing part of findmefollow 1060 ; as well as the GroupRing part. It also communicates between the two so that if DND is set 1061 ; on the primary extension, and mastermode is enabled, then the other extensions will not ring 1062 ; 1063 ;------------------------------------------------------------------------ 1064 [findmefollow-ringallv2] 1065 exten => _FMPR-.,1,Noop(In FMPR ${FMGRP} with ${EXTEN:5}) 1066 exten => _FMPR-.,n,Set(RingGroupMethod=) 1067 exten => _FMPR-.,n,Set(USE_CONFIRMATION=) 1068 exten => _FMPR-.,n,Set(RINGGROUP_INDEX=) 1069 exten => _FMPR-.,n,Macro(simple-dial,${EXTEN:5},${FMREALPRERING}) 1070 exten => _FMPR-.,n,GotoIf($["${DIALSTATUS}" != "BUSY"]?nodnd) 1071 exten => _FMPR-.,n,Set(DB(FM/DND/${FMGRP}/${FMUNIQUE})=DND) 1072 exten => _FMPR-.,n(nodnd),Noop(Ending FMPR ${FMGRP} with ${EXTEN:5} and dialstatus ${DIALSTATUS}) 1073 exten => _FMPR-.,n,Hangup() 1074 1075 exten => _FMGL-.,1,Noop(In FMGL ${FMGRP} with ${EXTEN:5}) 1076 exten => _FMGL-.,n,Wait(1) 1077 exten => _FMGL-.,n,GotoIf($["${DB(FM/DND/${FMGRP}/${FMUNIQUE})}" = "DND"]?dodnd) 1078 exten => _FMGL-.,n,Wait(1) 1079 exten => _FMGL-.,n,GotoIf($["${DB(FM/DND/${FMGRP}/${FMUNIQUE})}" = "DND"]?dodnd) 1080 exten => _FMGL-.,n,Wait(${FMPRERING}) 1081 exten => _FMGL-.,n,GotoIf($["${DB(FM/DND/${FMGRP}/${FMUNIQUE})}" = "DND"]?dodnd) 1082 exten => _FMGL-.,n,DBDel(FM/DND/${FMGRP}/${FMUNIQUE}) 1083 exten => _FMGL-.,n(dodial),Macro(dial,${FMGRPTIME},${DIAL_OPTIONS},${EXTEN:5}) 1084 exten => _FMGL-.,n,Noop(Ending FMGL ${FMGRP} with ${EXTEN:5} and dialstatus ${DIALSTATUS}) 1085 exten => _FMGL-.,n,Hangup() 1086 exten => _FMGL-.,n+10(dodnd),DBDel(FM/DND/${FMGRP}/${FMUNIQUE}) 1087 exten => _FMGL-.,n,GotoIf($["${FMPRIME}" = "FALSE"]?dodial) 1088 exten => _FMGL-.,n,Noop(Got DND in FMGL ${FMGRP} with ${EXTEN:5} in ${RingGroupMethod} mode, aborting) 1089 exten => _FMGL-.,n,Hangup() 1090 1091 ;------------------------------------------------------------------------ 1092 1050 1093 ; ############################################################################ 1051 1094 ; Extension Contexts [ext]
