First one to write about is the include_file support. Over the time, with addition of new features, the config file got bigger and bigger. Being in consultancy business, I have hundreds of config files and deployments to maintain. In terms of structure, there are some parts repeating in most of configs, like:
- sanity checks
- authentication
- nat traversal
- presence handling, a.s.0.
kamailio-sanity.cfg:
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}
if ( msg:len >= 8192 ) {
sl_send_reply("513", "Message too big");
exit;
}
if ( is_method("NOTIFY") && uri==myself
&& $hdr(Event) =~ "keep-alive" )
{
sl_send_reply("200", "OK - keepalive");
exit;
}
Now, at the top of main route block in each config, I include the 'kamailio-sanity.cfg' file:
kamailio.cfg:
Note that you can use include_file anywhere in your config file - included file must contain valid config statements for the part where is included (e.g., global parameters, modules loading, module parameters, routing actions, etc.).
...
route {
include_file "kamailio-sanity.cfg"
...
}
...
Next is going to be about #!define support, which completes perfectly the include_file feature to ease the maintenance, troubleshooting and development of config files.
No comments:
Post a Comment