| 284 | | // append a hash sign so we can send out on chan_local below unless cfingore is set |
|---|
| 285 | | if ($cfignore) { |
|---|
| 286 | | unset($ext[$count]); |
|---|
| 287 | | debug("Extension $k has call forward set to $cf", 1); |
|---|
| 288 | | $AGI->set_variable('DIALSTATUS','NOANSWER'); |
|---|
| | 281 | |
|---|
| | 282 | |
|---|
| | 283 | // Check for call forwarding first |
|---|
| | 284 | // If call forward is enabled, we use chan_local |
|---|
| | 285 | // Hacky. We should be using an associative array, shouldn't we? |
|---|
| | 286 | // More hacks: ignore CF if caller is the extension this extension is forwarded to. |
|---|
| | 287 | if (!isset($realcalleridnum)) { |
|---|
| | 288 | $realcalleridnum = get_var( $AGI, "REALCALLERIDNUM" ); |
|---|
| | 289 | } |
|---|
| | 290 | if (!isset($blindtransfer)) { |
|---|
| | 291 | $blindtransfer = get_var( $AGI, "BLINDTRANSFER" ); |
|---|
| | 292 | } |
|---|
| | 293 | if (!isset($ampuser)) { |
|---|
| | 294 | $ampuser = get_var( $AGI, "AMPUSER" ); |
|---|
| | 295 | if ($ampuser == '') { |
|---|
| | 296 | $ampuser = $cidnum; |
|---|
| | 297 | } |
|---|
| | 298 | } |
|---|
| | 299 | if ( ($ampuser == $cf) || ($realcalleridnum == $cf) || (strstr($blindtransfer,"/".$cf."-")) ) { |
|---|
| | 300 | debug("Extension $k cf is ignored", 1); |
|---|
| 290 | | $ext[$count] = $cf.'#'; |
|---|
| 291 | | debug("Extension $k has call forward set to $cf", 1); |
|---|
| 292 | | } |
|---|
| 293 | | |
|---|
| 294 | | // if this is the primary extension and CF enabled, then cancel mastermode |
|---|
| 295 | | // whether it is or not, no need to check. |
|---|
| 296 | | // |
|---|
| 297 | | if ($count == 0) { |
|---|
| 298 | | $mastermode = 0; |
|---|
| 299 | | $pr_dialstatus = ""; // not relevant if not mastermode, clear it so dnd doesn't propagate, and other |
|---|
| 300 | | debug("Primary ext is CF so disabling mastermode if it was set", 4); |
|---|
| | 302 | if ($k == $cf) { |
|---|
| | 303 | debug("Loop detected, extension $k cf is ignored", 1); |
|---|
| | 304 | } else { |
|---|
| | 305 | // append a hash sign so we can send out on chan_local below unless cfingore is set |
|---|
| | 306 | if ($cfignore) { |
|---|
| | 307 | unset($ext[$count]); |
|---|
| | 308 | debug("Extension $k has call forward set to $cf", 1); |
|---|
| | 309 | $AGI->set_variable('DIALSTATUS','NOANSWER'); |
|---|
| | 310 | } else { |
|---|
| | 311 | $ext[$count] = $cf.'#'; |
|---|
| | 312 | debug("Extension $k has call forward set to $cf", 1); |
|---|
| | 313 | } |
|---|
| | 314 | |
|---|
| | 315 | // if this is the primary extension and CF enabled, then cancel mastermode |
|---|
| | 316 | // whether it is or not, no need to check. |
|---|
| | 317 | // |
|---|
| | 318 | if ($count == 0) { |
|---|
| | 319 | $mastermode = 0; |
|---|
| | 320 | $pr_dialstatus = ""; // not relevant if not mastermode, clear it so dnd doesn't propagate, and other |
|---|
| | 321 | debug("Primary ext is CF so disabling mastermode if it was set", 4); |
|---|
| | 322 | } |
|---|
| | 323 | } |
|---|