head	1.1;
access;
symbols
	pkgsrc-2026Q3:1.1.0.8
	pkgsrc-2026Q3-base:1.1
	pkgsrc-2026Q2:1.1.0.6
	pkgsrc-2026Q2-base:1.1
	pkgsrc-2026Q1:1.1.0.4
	pkgsrc-2026Q1-base:1.1
	pkgsrc-2025Q4:1.1.0.2
	pkgsrc-2025Q4-base:1.1;
locks; strict;
comment	@# @;


1.1
date	2025.10.27.06.58.38;	author jnemeth;	state Exp;
branches;
next	;
commitid	cQXB8JNvDKKmYagG;


desc
@@


1.1
log
@comms/asterisk23: import asterisk-23.0.0

Asterisk is a complete PBX in software.  It provides all of the
features you would expect from a PBX and more. Asterisk does voice
over IP in three protocols, and can interoperate with almost all
standards-based telephony equipment using relatively inexpensive
hardware.

Asterisk provides Voicemail services with Directory, Call Conferencing,
Interactive Voice Response, Call Queuing. It has support for
three-way calling, caller ID services, ADSI, SIP and H.323 (as both
client and gateway).

This is a standard version.  It is scheduled to go to security
fixes only on October 15th, 2026, and EOL on October 15th, 2027.
See here for more information about Asterisk versions:
https://docs.asterisk.org/About-the-Project/Asterisk-Versions/
@
text
@$NetBSD: patch-contrib_scripts_vmail.cgi,v 1.1 2024/10/21 05:12:45 jnemeth Exp $

--- contrib/scripts/vmail.cgi.orig	2025-10-15 17:01:28.000000000 +0000
+++ contrib/scripts/vmail.cgi
@@@@ -145,7 +145,7 @@@@ sub check_login($$)
 		$context = "default";
 	}
 	if (!$filename) {
-		$filename = "/etc/asterisk/voicemail.conf";
+		$filename = "@@ASTETCDIR@@/voicemail.conf";
 	}
 #	print header;
 #	print "Including <h2>$filename</h2> while in <h2>$category</h2>...\n";
@@@@ -153,7 +153,7 @@@@ sub check_login($$)
 	while(<VMAIL>) {
 		chomp;
 		if (/include\s\"([^\"]+)\"$/) {
-			($tmp, $category) = &check_login("/etc/asterisk/$1", $category);
+			($tmp, $category) = &check_login("@@ASTETCDIR@@/$1", $category);
 			if (length($tmp)) {
 #				print "Got '$tmp'\n";
 				return ($tmp, $category);
@@@@ -209,7 +209,7 @@@@ sub validmailbox($$$$)
 		$context = "default";
 	}
 	if (!$filename) {
-		$filename = "/etc/asterisk/voicemail.conf";
+		$filename = "@@ASTETCDIR@@/voicemail.conf";
 	}
 	if (!$category) {
 		$category = "general";
@@@@ -218,7 +218,7 @@@@ sub validmailbox($$$$)
 	while (<VMAIL>) {
 		chomp;
 		if (/include\s\"([^\"]+)\"$/) {
-			($tmp, $category) = &validmailbox($mbox, $context, "/etc/asterisk/$1");
+			($tmp, $category) = &validmailbox($mbox, $context, "@@ASTETCDIR@@/$1");
 			if ($tmp) {
 				return ($tmp, $category);
 			}
@@@@ -265,7 +265,7 @@@@ sub mailbox_options()
 	local $tmp2;
 	local $tmp;
 	if (!$filename) {
-		$filename = "/etc/asterisk/voicemail.conf";
+		$filename = "@@ASTETCDIR@@/voicemail.conf";
 	}
 	if (!$category) {
 		$category = "general";
@@@@ -353,7 +353,7 @@@@ sub mailbox_list()
 sub msgcount() 
 {
 	my ($context, $mailbox, $folder) = @@_;
-	my $path = "/var/spool/asterisk/voicemail/$context/$mailbox/$folder";
+	my $path = "@@ASTSPOOLDIR@@/voicemail/$context/$mailbox/$folder";
 	if (opendir(DIR, $path)) {
 		my @@msgs = grep(/^msg....\.txt$/, readdir(DIR));
 		closedir(DIR);
@@@@ -377,7 +377,7 @@@@ sub msgcountstr()
 sub messages()
 {
 	my ($context, $mailbox, $folder) = @@_;
-	my $path = "/var/spool/asterisk/voicemail/$context/$mailbox/$folder";
+	my $path = "@@ASTSPOOLDIR@@/voicemail/$context/$mailbox/$folder";
 	if (opendir(DIR, $path)) {
 		my @@msgs = sort grep(/^msg....\.txt$/, readdir(DIR));
 		closedir(DIR);
@@@@ -402,7 +402,7 @@@@ sub getfields()
 {
 	my ($context, $mailbox, $folder, $msg) = @@_;
 	my $fields;
-	if (open(MSG, "</var/spool/asterisk/voicemail/$context/$mailbox/$folder/msg${msg}.txt")) {
+	if (open(MSG, "<@@ASTSPOOLDIR@@/voicemail/$context/$mailbox/$folder/msg${msg}.txt")) {
 		while(<MSG>) {
 			s/\#.*$//g;
 			if (/^(\w+)\s*\=\s*(.*)$/) {
@@@@ -527,7 +527,7 @@@@ _EOH
 	<input name="action" type=submit value="download">
 </td></tr>
 <tr><td colspan=2 align=center>
-<embed width=400 height=40 src="vmail.cgi?action=audio&folder=$folder&mailbox=$mbox&context=$context&password=$passwd&msgid=$msgid&format=$format&dontcasheme=$$.$format" autostart=yes loop=false></embed>
+<embed width=400 height=40 src="vmail?action=audio&folder=$folder&mailbox=$mbox&context=$context&password=$passwd&msgid=$msgid&format=$format&dontcasheme=$$.$format" autostart=yes loop=false></embed>
 </td></tr></table>
 </td></tr>
 </table>
@@@@ -555,7 +555,7 @@@@ sub message_audio()
 	}
 	&untaint($format);
 
-	my $path = "/var/spool/asterisk/voicemail/$context/$mailbox/$folder/msg${msgid}.$format";
+	my $path = "@@ASTSPOOLDIR@@/voicemail/$context/$mailbox/$folder/msg${msgid}.$format";
 
 	$msgid =~ /^\d\d\d\d$/ || die("Msgid Liar ($msgid)!");
 	grep(/^${format}$/, keys %formats) || die("Format Liar ($format)!");
@@@@ -776,11 +776,11 @@@@ sub message_rename()
 		die("Invalid old Message<BR>\n");
 	}
 	
-	my $path = "/var/spool/asterisk/voicemail/$context/$mbox/$newfolder";
+	my $path = "@@ASTSPOOLDIR@@/voicemail/$context/$mbox/$newfolder";
 	$path =~ /^(.*)$/;
 	$path = $1;
 	mkdir $path, 0770;
-	$path = "/var/spool/asterisk/voicemail/$context/$mbox/$oldfolder";
+	$path = "@@ASTSPOOLDIR@@/voicemail/$context/$mbox/$oldfolder";
 	opendir(DIR, $path) || die("Unable to open directory\n");
 	my @@files = grep /^msg${old}\.\w+$/, readdir(DIR);
 	closedir(DIR);
@@@@ -790,7 +790,7 @@@@ sub message_rename()
 			$tmp = $1;
 			$oldfile = $path . "/$tmp";
 			$tmp =~ s/msg${old}/msg${new}/;
-			$newfile = "/var/spool/asterisk/voicemail/$context/$mbox/$newfolder/$tmp";
+			$newfile = "@@ASTSPOOLDIR@@/voicemail/$context/$mbox/$newfolder/$tmp";
 #			print "Renaming $oldfile to $newfile<BR>\n";
 			rename($oldfile, $newfile);
 		}
@@@@ -851,15 +851,15 @@@@ sub message_copy()
 		die("Invalid old Message<BR>\n");
 	}
 	
-	my $path = "/var/spool/asterisk/voicemail/$context/$newmbox";
+	my $path = "@@ASTSPOOLDIR@@/voicemail/$context/$newmbox";
 	$path =~ /^(.*)$/;
 	$path = $1;
 	mkdir $path, 0770;
-	$path = "/var/spool/asterisk/voicemail/$context/$newmbox/INBOX";
+	$path = "@@ASTSPOOLDIR@@/voicemail/$context/$newmbox/INBOX";
 	$path =~ /^(.*)$/;
 	$path = $1;
 	mkdir $path, 0770;
-	$path = "/var/spool/asterisk/voicemail/$context/$mbox/$oldfolder";
+	$path = "@@ASTSPOOLDIR@@/voicemail/$context/$mbox/$oldfolder";
 	opendir(DIR, $path) || die("Unable to open directory\n");
 	my @@files = grep /^msg${old}\.\w+$/, readdir(DIR);
 	closedir(DIR);
@@@@ -869,7 +869,7 @@@@ sub message_copy()
 			$tmp = $1;
 			$oldfile = $path . "/$tmp";
 			$tmp =~ s/msg${old}/msg${new}/;
-			$newfile = "/var/spool/asterisk/voicemail/$context/$newmbox/INBOX/$tmp";
+			$newfile = "@@ASTSPOOLDIR@@/voicemail/$context/$newmbox/INBOX/$tmp";
 #			print "Copying $oldfile to $newfile<BR>\n";
 			&file_copy($oldfile, $newfile);
 		}
@@@@ -899,7 +899,7 @@@@ sub message_delete()
 	} else {
 		die("Invalid Message<BR>\n");
 	}
-	my $path = "/var/spool/asterisk/voicemail/$context/$mbox/$folder";
+	my $path = "@@ASTSPOOLDIR@@/voicemail/$context/$mbox/$folder";
 	opendir(DIR, $path) || die("Unable to open directory\n");
 	my @@files = grep /^msg${msg}\.\w+$/, readdir(DIR);
 	closedir(DIR);
@@@@ -935,7 +935,7 @@@@ sub message_forward()
 	my $txt;
 	$context = &untaint($context);
 	$newmbox = &untaint($newmbox);
-	my $path = "/var/spool/asterisk/voicemail/$context/$newmbox/INBOX";
+	my $path = "@@ASTSPOOLDIR@@/voicemail/$context/$newmbox/INBOX";
 	if ($msgs[0]) {
 		if (&lock_path($path) == 0) {
 			$msgcount = &msgcount($context, $newmbox, "INBOX");
@@@@ -985,7 +985,7 @@@@ sub message_delete_or_move()
 	$context = &untaint($context);
 	$mbox = &untaint($mbox);
 	$folder = &untaint($folder);
-	$path = "/var/spool/asterisk/voicemail/$context/$mbox/$folder";
+	$path = "@@ASTSPOOLDIR@@/voicemail/$context/$mbox/$folder";
 	if ($msgs[0]) {
 		if (&lock_path($path) == 0) {
 			my $msgcount = &msgcount($context, $mbox, $folder);
@
