Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Thu Apr 18, 2024 6:24 am
Predictive Dialer


All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: HowTo enable TLS/SRTP in A2Billing
PostPosted: Tue Sep 24, 2013 1:01 am 
Offline

Joined: Thu Sep 19, 2013 8:02 pm
Posts: 2
Can TLS/SRTP be configured/enabled with a2billing?
I have done TSL/SRTP with Asterisk/FreePBX successfully, but I cannot seem to find how/where to configure transport and encryption for sip settings?


Top
 Profile  
 
 Post subject: Re: HowTo enable TLS/SRTP in A2Billing
PostPosted: Mon Sep 30, 2013 9:53 pm 
Offline

Joined: Thu Sep 19, 2013 8:02 pm
Posts: 2
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 ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 
VoIP Billing solution


All times are UTC


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group