3 Parses /etc/asterisk/sip.conf
5 Author: Rob Tucker <rtucker@mozilla.com>
8 Lens parses the sip.conf with support for template structure
11 This file is licenced under the LGPL v2+, like the rest of Augeas.
16 About: Configuration files
17 This lens applies to /etc/asterisk/sip.conf. See <filter>.
23 (************************************************************************
25 *************************************************************************)
27 let comment = IniFile.comment IniFile.comment_re IniFile.comment_default
28 let sep = IniFile.sep IniFile.sep_re IniFile.sep_default
29 let empty = IniFile.empty
31 let comment_or_eol = comment | eol
34 let entry = IniFile.indented_entry IniFile.entry_re sep comment
38 let is_tmpl = [ label "@is_template" . Util.del_str "!" ]
39 in let use_tmpl = [ label "@use_template" . store Rx.word ]
40 in let comma = Util.delim ","
41 in Util.del_str "(" . Sep.opt_space
42 . Build.opt_list (is_tmpl|use_tmpl) comma
43 . Sep.opt_space . Util.del_str ")"
44 let title_comment_re = /[ \t]*[#;].*$/
46 let title_comment = [ label "#title_comment"
47 . store title_comment_re ]
48 let title = label "title" . Util.del_str "["
49 . store text_re . Util.del_str "]"
50 . tmpl? . title_comment? . eol
51 let record = IniFile.record title entry
53 let lns = IniFile.lns record comment
55 let filter = incl "/etc/asterisk/sip.conf"
57 let xfm = transform lns filter