|
Packit Service |
a2ae7a |
(*
|
|
Packit Service |
a2ae7a |
Module: Sip_Conf
|
|
Packit Service |
a2ae7a |
Parses /etc/asterisk/sip.conf
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
Author: Rob Tucker <rtucker@mozilla.com>
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Reference
|
|
Packit Service |
a2ae7a |
Lens parses the sip.conf with support for template structure
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: License
|
|
Packit Service |
a2ae7a |
This file is licenced under the LGPL v2+, like the rest of Augeas.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Lens Usage
|
|
Packit Service |
a2ae7a |
To be documented
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Configuration files
|
|
Packit Service |
a2ae7a |
This lens applies to /etc/asterisk/sip.conf. See <filter>.
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
module Sip_Conf =
|
|
Packit Service |
a2ae7a |
autoload xfm
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* INI File settings
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let comment = IniFile.comment IniFile.comment_re IniFile.comment_default
|
|
Packit Service |
a2ae7a |
let sep = IniFile.sep IniFile.sep_re IniFile.sep_default
|
|
Packit Service |
a2ae7a |
let empty = IniFile.empty
|
|
Packit Service |
a2ae7a |
let eol = IniFile.eol
|
|
Packit Service |
a2ae7a |
let comment_or_eol = comment | eol
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let entry = IniFile.indented_entry IniFile.entry_re sep comment
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let text_re = Rx.word
|
|
Packit Service |
a2ae7a |
let tmpl =
|
|
Packit Service |
a2ae7a |
let is_tmpl = [ label "@is_template" . Util.del_str "!" ]
|
|
Packit Service |
a2ae7a |
in let use_tmpl = [ label "@use_template" . store Rx.word ]
|
|
Packit Service |
a2ae7a |
in let comma = Util.delim ","
|
|
Packit Service |
a2ae7a |
in Util.del_str "(" . Sep.opt_space
|
|
Packit Service |
a2ae7a |
. Build.opt_list (is_tmpl|use_tmpl) comma
|
|
Packit Service |
a2ae7a |
. Sep.opt_space . Util.del_str ")"
|
|
Packit Service |
a2ae7a |
let title_comment_re = /[ \t]*[#;].*$/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let title_comment = [ label "#title_comment"
|
|
Packit Service |
a2ae7a |
. store title_comment_re ]
|
|
Packit Service |
a2ae7a |
let title = label "title" . Util.del_str "["
|
|
Packit Service |
a2ae7a |
. store text_re . Util.del_str "]"
|
|
Packit Service |
a2ae7a |
. tmpl? . title_comment? . eol
|
|
Packit Service |
a2ae7a |
let record = IniFile.record title entry
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let lns = IniFile.lns record comment
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let filter = incl "/etc/asterisk/sip.conf"
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let xfm = transform lns filter
|