ad_library { Definitions for VXML You may use this software free under the GNU General Public License. @author Eve Andersson (eveander@eveander.com) } # HTML entity/ iso8859-1 character code map # for vxml purposes, it's useful to have the HTML entity as the key, since these # are what we need to strip out ns_share -init { set html_to_iso_character_codes(À\;) "À\;" set html_to_iso_character_codes(Á\;) "Á\;" set html_to_iso_character_codes(Â\;) "Â\;" set html_to_iso_character_codes(Ã\;) "Ã\;" set html_to_iso_character_codes(Ä\;) "Ä\;" set html_to_iso_character_codes(Å\;) "Å\;" set html_to_iso_character_codes(Æ\;) "Æ\;" set html_to_iso_character_codes(Ç\;) "Ç\;" set html_to_iso_character_codes(È\;) "È\;" set html_to_iso_character_codes(É\;) "É\;" set html_to_iso_character_codes(Ê\;) "Ê\;" set html_to_iso_character_codes(Ë\;) "Ë\;" set html_to_iso_character_codes(Ì\;) "Ì\;" set html_to_iso_character_codes(Í\;) "Í\;" set html_to_iso_character_codes(Î\;) "Î\;" set html_to_iso_character_codes(Ï\;) "Ï\;" set html_to_iso_character_codes(Ð\;) "Ð\;" set html_to_iso_character_codes(&Dstrok\;) "Ð\;" set html_to_iso_character_codes(Ñ\;) "Ñ\;" set html_to_iso_character_codes(Ò\;) "Ò\;" set html_to_iso_character_codes(Ó\;) "Ó\;" set html_to_iso_character_codes(Ô\;) "Ô\;" set html_to_iso_character_codes(Õ\;) "Õ\;" set html_to_iso_character_codes(Ö\;) "Ö\;" set html_to_iso_character_codes(Ø\;) "Ø\;" set html_to_iso_character_codes(Ù\;) "Ù\;" set html_to_iso_character_codes(Ú\;) "Ú\;" set html_to_iso_character_codes(Û\;) "Û\;" set html_to_iso_character_codes(Ü\;) "Ü\;" set html_to_iso_character_codes(Ý\;) "Ý\;" set html_to_iso_character_codes(Þ\;) "Þ\;" set html_to_iso_character_codes(ß\;) "ß\;" set html_to_iso_character_codes(à\;) "à\;" set html_to_iso_character_codes(á\;) "á\;" set html_to_iso_character_codes(â\;) "â\;" set html_to_iso_character_codes(ã\;) "ã\;" set html_to_iso_character_codes(ä\;) "ä\;" set html_to_iso_character_codes(å\;) "å\;" set html_to_iso_character_codes(æ\;) "æ\;" set html_to_iso_character_codes(ç\;) "ç\;" set html_to_iso_character_codes(è\;) "è\;" set html_to_iso_character_codes(é\;) "é\;" set html_to_iso_character_codes(ê\;) "ê\;" set html_to_iso_character_codes(ë\;) "ë\;" set html_to_iso_character_codes(ì\;) "ì\;" set html_to_iso_character_codes(í\;) "í\;" set html_to_iso_character_codes(î\;) "î\;" set html_to_iso_character_codes(ï\;) "ï\;" set html_to_iso_character_codes(ð\;) "ð\;" set html_to_iso_character_codes(ñ\;) "ñ\;" set html_to_iso_character_codes(ò\;) "ò\;" set html_to_iso_character_codes(ó\;) "ó\;" set html_to_iso_character_codes(ô\;) "ô\;" set html_to_iso_character_codes(õ\;) "õ\;" set html_to_iso_character_codes(ö\;) "ö\;" set html_to_iso_character_codes(ø\;) "ø\;" set html_to_iso_character_codes(ù\;) "ù\;" set html_to_iso_character_codes(ú\;) "ú\;" set html_to_iso_character_codes(û\;) "û\;" set html_to_iso_character_codes(ü\;) "ü\;" set html_to_iso_character_codes(ý\;) "ý\;" set html_to_iso_character_codes(þ\;) "þ\;" set html_to_iso_character_codes(ÿ\;) "ÿ\;" } html_to_iso_character_codes ad_proc vxml_convert_illegal_characters { the_string } { Changes < to <, > to > and & to & (otherwise, these break VXML). Also convert HTML character codes (e.g., ö) to the right iso8859-1 code (e.g., ö). } { # first character code conversions ns_share html_to_iso_character_codes foreach html_code [array names html_to_iso_character_codes] { # in the iso code, change & to \\& and ; to \; set iso_code [lindex [array get html_to_iso_character_codes $html_code] 1] regsub -all "&" $iso_code {\\&} iso_code regsub -all $html_code $the_string $iso_code the_string } # change & to & only if & is not followed by a # regsub -all "&(\[^#\])" $the_string {\&\1} the_string regsub -all "&$" $the_string {\&} the_string regsub -all < $the_string \\<\; the_string regsub -all > $the_string \\>\; the_string return $the_string } ad_proc vxml_return_content { content } { ns_return doesn't work for returning VXML (there appears to be a hidden character ^@ at the end which confuses the VXML parser), so this ns_writes the headers explicitly } { set header_time [ns_httptime [ns_time]] set content_length [expr [string length $content] + 1] ns_write "HTTP/1.0 200 OK MIME-Version: 1.0 Date: $header_time Server: NaviServer/2.0 AOLserver/2.3.2 Content-Type: text/plain Content-Length: $content_length $content" } ad_proc vxml_tellme_phone_dir_passcode {} { # CHANGE ME return "1111" }