[Asterisk-Users] Direct entry to your own voice mailbox
Florian Overkamp
florian at obsimref.com
Mon Jul 7 11:15:05 MST 2003
Citeren Dan <dtoma at fx.ro>:
> There is any possibility to dial a specific extension and then enter in your
> own mailbox (the one defined for that specific SIP phone) without asking for
> the exxtension number but only for the password?
>
> I want to be the same extension for all phones, not a specific one for each
> of them.
Hi,
this is one tool I have used a lot up to now; I have a simple conversion
table: callerid -> voicemailbox. You could simply used ${CALLERID} or
something, but I also have some remote cellphones and the likes...
#!/usr/bin/php4 -q
<?
// Set some parameters
ob_implicit_flush(true); // Don't buffer output
set_time_limit(0); // This program may take forever
// Setup file handles
$stdin = fopen("php://stdin", "r");
set_file_buffer($stdin, 0);
$stderr = fopen("php://stderr", "a");
set_file_buffer($stderr, 0);
// Do function definitions before we start the main loop
function read() {
global $stdin;
$input=fgets($stdin, 255);
return str_replace("\n", "", $input);
return $input;
}
function errlog($line) {
global $stderr;
fputs($stderr, $line."\n");
}
// parse agi headers into array $agi["callerid"]
while ($env=read()) {
errlog($env);
$s = split(": ",$env);
$agi[str_replace("agi_","",$s[0])] = trim($s[1]);
echo "VERBOSE \"".$s[0].": ".$s[1]."\" 1\n";
if (($env == "") || ($env == "\n")) {
break;
}
}
// Main run
$clid = $agi["callerid"];
switch($clid) {
// enter the mailbox number for each valid callerid
// prepend 's' if you wish to trust the callerid and skip the password check
case "0612345678": $parms = "s1000"; break;
default: $parms = "0"; break;
}
if($parms != "") $parms = " $parms";
echo "EXEC VoiceMailMain$parms\n";
// Close file handles
fclose($stdin);
fclose($stderr);
?>
--
Met vriendelijke groet,
Florian Overkamp
ObSimRef BV
More information about the asterisk-users
mailing list