Since I was unable to find a solution on-line and nobody replied to my post, I decided to hack together a solution to this problem.
The problem:
It seems Asterisk Realtime doesn't support the transport=tls and encryption=yes sip configuration methods, and seems that a2billing doesn't want to support anything that is not supported by realtime, so no TSL/SRTP in a2billing.
The solution:
Use a2billing without realtime and hack the a2billing code so that you can add any sip/iax configuration variables from the a2billing gui.
HowTo:
I will presume that you've already configured Asterisk to support TLS.
1. Open A2Billing GUI, navigate to System Settings -> Global Lists and search for the 'use_realtime' key. Change it to 'no'.
To be on the safe side, you can disable realtime fully by uncommenting the following lines in /etc/asterisk/extconfig.conf
Code:
;[settings]
;iaxusers => mysql,general,cc_iax_buddies
;iaxpeers => mysql,general,cc_iax_buddies
;sipusers => mysql,general,cc_sip_buddies
;sippeers => mysql,general,cc_sip_buddies
;extensions => mysql,general,cc_sip_buddies
and unloading the realtime modules in /etc/asterisk/modules.conf
Code:
noload => res_config_mysql.so
noload => app_realtime.so
noload => func_realtime.so
noload => pbx_realtime.so
noload => res_realtime.so
2. Change the following code in /var/www/html/a2billing/common/lib/Class.Realtime.php
Code:
if (trim($list_names[$i]) == 'allow') {
$codecs = explode(",", $data[$i +1]);
$line = "";
foreach ($codecs as $value)
$line .= trim($list_names[$i]) . '=' . $value . "\n";
} else {
$line = (trim($list_names[$i]) . '=' . $data[$i +1] . "\n");
}
to this
Code:
if (trim($list_names[$i]) == 'allow') {
$codecs = explode(",", $data[$i +1]);
$line = "";
foreach ($codecs as $value)
$line .= trim($list_names[$i]) . '=' . $value . "\n";
} elseif (trim($list_names[$i]) == 'setvar') {
$confvars = explode(",", $data[$i +1]);
$line = "";
foreach ($confvars as $confvar)
$line .= (trim($confvar) . "\n");
} else {
$line = (trim($list_names[$i]) . '=' . $data[$i +1] . "\n");
}
3. Edit your SIP/IAX extension(s) and add whatever sip or iax configuration options that you want, that are missing in the a2billing gui, by adding them as comma separated key=value pairs in the 'SETVAR' field. Then save your changes, generate the sip/iax configuration file and reload asterisk.
Example: If you edit sip extension XXX from the a2billing gui and put 'transport=tls,encryption=yes' in the 'SETVAR' field, you will have effectively added the two sip configuration options in the /etc/asterisk/additional_a2billing_sip.conf for that extension.
IMPORTANT: Using this hack will disable/remove the 'setvar' conf option. It will will never be loaded/set in the sip/iax configuration set! You can easily change the code to use any other sip/iax configuration option that you are not using yourself, but the setvar field in the a2billing database has the appropriate configuration to handle many key=value pairs.
Enjoy