| 1 |
<?php |
|---|
| 2 |
/* $Id:$ */ |
|---|
| 3 |
|
|---|
| 4 |
// returns a associative arrays with keys 'destination' and 'description' |
|---|
| 5 |
function pbdirectory_destinations() { |
|---|
| 6 |
// return an associative array with destination and description |
|---|
| 7 |
$extens[] = array('destination' => 'app-pbdirectory,pbdirectory,1', 'description' => 'Phonebook Directory'); |
|---|
| 8 |
return $extens; |
|---|
| 9 |
} |
|---|
| 10 |
|
|---|
| 11 |
function pbdirectory_get_config($engine) { |
|---|
| 12 |
$modulename = 'pbdirectory'; |
|---|
| 13 |
|
|---|
| 14 |
// This generates the dialplan |
|---|
| 15 |
global $ext; |
|---|
| 16 |
switch($engine) { |
|---|
| 17 |
case "asterisk": |
|---|
| 18 |
$fcc = new featurecode('pbdirectory', 'app-pbdirectory'); |
|---|
| 19 |
$code = $fcc->getCodeActive(); |
|---|
| 20 |
unset($fcc); |
|---|
| 21 |
|
|---|
| 22 |
if (!empty($code)) { |
|---|
| 23 |
$ext->add('app-pbdirectory', $code, '', new ext_answer()); |
|---|
| 24 |
$ext->add('app-pbdirectory', $code, '', new ext_wait(1)); |
|---|
| 25 |
$ext->add('app-pbdirectory', $code, '', new ext_goto(1,'pbdirectory')); |
|---|
| 26 |
} |
|---|
| 27 |
|
|---|
| 28 |
$ext->add('app-pbdirectory', 'pbdirectory', '', new ext_agi('pbdirectory')); |
|---|
| 29 |
$ext->add('app-pbdirectory', 'pbdirectory', '', new ext_gotoif('$["${dialnumber}"=""]','hangup,1')); |
|---|
| 30 |
$ext->add('app-pbdirectory', 'pbdirectory', '', new ext_noop('Got number to dial: ${dialnumber}')); |
|---|
| 31 |
$ext->add('app-pbdirectory', 'pbdirectory', '', new ext_dial('Local/${dialnumber}@from-internal/n','','')); |
|---|
| 32 |
$ext->add('app-pbdirectory', 'hangup', '', new ext_hangup()); |
|---|
| 33 |
|
|---|
| 34 |
$ext->addInclude('from-internal-additional', 'app-pbdirectory'); |
|---|
| 35 |
|
|---|
| 36 |
break; |
|---|
| 37 |
} |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
?> |
|---|