Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 2 additions & 49 deletions freeswitch/fs/lib/astpp.xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function xml_not_found() {
}

// Build acl xml
// ASTPPCOM-1321 Ashish start
function load_acl($logger, $db, $config) {
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n";
$xml .= "<document type=\"freeswitch/xml\">\n";
Expand All @@ -60,55 +61,6 @@ function load_acl($logger, $db, $config) {
$xml .= " <node type=\"allow\" cidr=\"" . $res_acl_value ['ip'] . "\"/>\n";
}

// For gateways
/* $query = "SELECT * FROM gateways WHERE status=0";
$logger->log ( "Sofia Gateway Query : " . $query );
$sp_gw = $db->run ( $query );
$logger->log ( $sp_gw );

foreach ( $sp_gw as $sp_gw_key => $sp_gw_value ) {

$sp_gw_settings = json_decode ( $sp_gw_value ['gateway_data'], true );
foreach ( $sp_gw_settings as $sp_gw_settings_key => $sp_gw_settings_value ) {
if ($sp_gw_settings_value != "" && $sp_gw_settings_key == "proxy") {
$tmp_ip_arr = explode ( ":", $sp_gw_settings_value );
if (filter_var($tmp_ip_arr [0], FILTER_VALIDATE_IP) || preg_match("/^(?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.){1,126}(?!\d+)[a-zA-Z\d]{1,63}$/", $tmp_ip_arr [0])) {
if(preg_match("/[a-zA-Z\-]/i", $tmp_ip_arr [0])){
$ips = gethostbynamel($tmp_ip_arr [0]);
foreach ($ips as $ip => $value){
$tmp_ip_arr [0] = $value;
}
}
$xml .= " <node type=\"allow\" cidr=\"" . $tmp_ip_arr [0] . "/32\"/>\n";
}
}
}
}*/

// For opensips
if ($config ['opensips'] == '0') {
if(preg_match("/[a-zA-Z\-]/i", $config ['opensips_domain'])){
$ips = gethostbynamel($config ['opensips_domain']);
foreach ($ips as $ip => $value){
$config ['opensips_domain'] = $value;
}
}
$xml .= "<node type=\"allow\" cidr=\"" . $config ['opensips_domain'] . "/32\"/>\n";
$xml .= " </list>\n";
// For loopback
$xml .= "<list name=\"loopback.auto\" default=\"allow\">\n";
$xml .= "<node type=\"allow\" cidr=\"" . $config ['opensips_domain'] . "/32\"/>\n";
$xml .= "</list>\n";
// For event handing
$xml .= "<list name=\"event\" default=\"deny\">\n";
$xml .= "<node type=\"allow\" cidr=\"" . $config ['opensips_domain'] . "/32\"/>\n";
}
else{
$xml .= " </list>\n";
// For event handing
$xml .= "<list name=\"event\" default=\"deny\">\n";
}

$xml .= "<node type=\"allow\" cidr=\"127.0.0.0/8\"/>\n";
$xml .= "</list>\n";
$xml .= " </network-lists>\n";
Expand All @@ -118,6 +70,7 @@ function load_acl($logger, $db, $config) {
$logger->log ( $xml );
return $xml;
}
// ASTPPCOM-1321 Ashish end

// Build sofia xml
function load_sofia($logger, $db, $config) {
Expand Down
4 changes: 3 additions & 1 deletion web_interface/astpp/application/libraries/astpp/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -2016,7 +2016,9 @@ function get_timezone_offset() {
return $gmtoffset;
}
function sip_profile_date() {
$defualt_profile_data = '{"rtp-ip":"$${local_ip_v4}","dialplan":"XML","user-agent-string":"ASTPP","debug":"0","sip-trace":"no","tls":"false","inbound-reg-force-matching-username":"true","disable-transcoding":"true","all-reg-options-ping":"false","unregister-on-options-fail":"true","log-auth-failures":"true","status":"0","inbound-bypass-media":"false","inbound-proxy-media":"false","disable-transfer":"true","enable-100rel":"false","rtp-timeout-sec":"60","dtmf-duration":"2000","manual-redirect":"false","aggressive-nat-detection":"false","enable-timer":"false","minimum-session-expires":"120","session-timeout-pt":"1800","auth-calls":"true","apply-inbound-acl":"default","inbound-codec-prefs":"PCMU,PCMA,G729","outbound-codec-prefs":"PCMU,PCMA,G729","inbound-late-negotiation":"false"}';
// ASTPPCOM-1321 Ashish start
$defualt_profile_data = '{"rtp-ip":"$${local_ip_v4}","dialplan":"XML","user-agent-string":"ASTPP","debug":"0","sip-trace":"no","tls":"false","inbound-reg-force-matching-username":"true","disable-transcoding":"true","all-reg-options-ping":"false","unregister-on-options-fail":"true","log-auth-failures":"true","status":"0","inbound-bypass-media":"false","inbound-proxy-media":"false","disable-transfer":"true","enable-100rel":"false","rtp-timeout-sec":"60","dtmf-duration":"2000","manual-redirect":"false","aggressive-nat-detection":"true","enable-timer":"false","minimum-session-expires":"120","session-timeout-pt":"1800","auth-calls":"true","apply-inbound-acl":"default","inbound-codec-prefs":"PCMU,PCMA,G729","outbound-codec-prefs":"PCMU,PCMA,G729","inbound-late-negotiation":"false","ext-rtp-ip":"$${local_ip_v4}","ext-sip-ip":"$${local_ip_v4}","sip-capture":"no","rtp-timer-name":"soft","rtp-hold-timeout-sec":"1800","rfc2833-pt":"101","presence-privacy":"$${presence_privacy}","presence-hosts":"$${domain},$${local_ip_v4}","pass-callee-id":"false","nonce-ttl":"60","manage-presence":"true","inbound-codec-negotiation":"generous","hold-music":"$${hold_music}","forward-unsolicited-mwi-notify":"false","dtmf_type":"rfc2833","context":"default","challenge-realm":"auto_from","auth-all-packets":"false"}';
// ASTPPCOM-1321 Ashish end
return $defualt_profile_data;
}
function set_refill_coupon_status($select = '', $table = '', $status = '') {
Expand Down