aboutsummaryrefslogtreecommitdiffstats
path: root/packages/freeswitch
diff options
context:
space:
mode:
authorMark Crane <mcrane@pfsense.org>2008-12-12 10:16:06 +0000
committerMark Crane <mcrane@pfsense.org>2008-12-12 10:16:06 +0000
commit026145159210da2056b0bee191bfa54080b590d6 (patch)
treea2c6224c698180b51202d651d4839a7454bd98c3 /packages/freeswitch
parent1fb0997c705660b0232b2df71b11a1b0ef32992d (diff)
downloadpfsense-packages-026145159210da2056b0bee191bfa54080b590d6.tar.gz
pfsense-packages-026145159210da2056b0bee191bfa54080b590d6.tar.bz2
pfsense-packages-026145159210da2056b0bee191bfa54080b590d6.zip
FreeSWITCH package event_socket no longer requires the LAN interface IP. Clearing away a problem of using the FreeSWITCH package on an Appliance with a single interface.
Diffstat (limited to 'packages/freeswitch')
-rw-r--r--packages/freeswitch/freeswitch.inc64
-rw-r--r--packages/freeswitch/freeswitch.xml2
2 files changed, 43 insertions, 23 deletions
diff --git a/packages/freeswitch/freeswitch.inc b/packages/freeswitch/freeswitch.inc
index 02360120..195bfb11 100644
--- a/packages/freeswitch/freeswitch.inc
+++ b/packages/freeswitch/freeswitch.inc
@@ -74,25 +74,45 @@ function pkg_is_service_running($servicename)
function event_socket_create($host, $port, $password)
{
- $fp = fsockopen($host, $port, $errno, $errdesc)
- or die("Connection to $host failed");
- socket_set_blocking($fp,false);
-
- if ($fp) {
- while (!feof($fp)) {
- $buffer = fgets($fp, 1024);
- usleep(100); //allow time for reponse
- if (trim($buffer) == "Content-Type: auth/request") {
- fputs($fp, "auth $password\n\n");
- break;
- }
- }
- return $fp;
- }
- else {
- return false;
- }
-}
+ //$host has been deprecated
+
+ //build the interface list
+ $i = 0; $ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN');
+ for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
+ $ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
+ }
+
+ //get the interface ip addresses and try to connect to them
+ foreach ($ifdescrs as $ifdescr => $ifname){
+ $ifinfo = get_interface_info($ifdescr);
+ $interface_ip_address = $ifinfo['ipaddr'];
+
+ if (strlen($interface_ip_address) > 0) {
+
+ $fp = fsockopen($interface_ip_address, $port, $errno, $errdesc, 1);
+ socket_set_blocking($fp,false);
+
+ if (!$fp) {
+ //connection failed continue through the loop testing other addresses
+ //invalid handle
+ }
+ else {
+ //connected to the socket return the handle
+
+ while (!feof($fp)) {
+ $buffer = fgets($fp, 1024);
+ usleep(100); //allow time for reponse
+ if (trim($buffer) == "Content-Type: auth/request") {
+ fputs($fp, "auth $password\n\n");
+ break;
+ }
+ }
+ return $fp;
+ }
+
+ } //end if interface_ip_address
+ } //end foreach
+} //end function
function event_socket_request($fp, $cmd)
@@ -286,7 +306,7 @@ function sync_package_freeswitch_settings()
$fout = fopen("/usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml","w");
$tmpxml = "<configuration name=\"event_socket.conf\" description=\"Socket Client\">\n";
$tmpxml .= " <settings>\n";
- $tmpxml .= " <param name=\"listen-ip\" value=\"". $config['interfaces']['lan']['ipaddr'] ."\"/>\n";
+ $tmpxml .= " <param name=\"listen-ip\" value=\"0.0.0.0\"/>\n";
$tmpxml .= " <param name=\"listen-port\" value=\"" . $rowhelper['event_socket_port'] . "\"/>\n";
$tmpxml .= " <param name=\"password\" value=\"" . $rowhelper['event_socket_password'] . "\"/>\n";
$tmpxml .= " <!--<param name=\"apply-inbound-acl\" value=\"lan\"/>-->\n";
@@ -378,7 +398,7 @@ function sync_package_freeswitch_extensions()
foreach($config['installedpackages']['freeswitchextensions']['config'] as $rowhelper) {
- $fout = fopen("/usr/local/freeswitch/conf/directory/default/".$rowhelper['extension'].".xml","w");
+ $fout = fopen("/usr/local/freeswitch/conf/directory/default/".$rowhelper['extension'].".xml","w");
$tmpxml = "<include>\n";
$tmpxml .= " <user id=\"" . $rowhelper['extension'] . "\" mailbox=\"" . $rowhelper['mailbox'] . "\">\n";
@@ -1911,7 +1931,7 @@ function freeswitch_php_install_command()
}
$config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_version'] = "1.0.1 revision 10638.";
- $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_package_version'] = "0.4.2";
+ $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_package_version'] = "0.4.3";
conf_mount_ro();
diff --git a/packages/freeswitch/freeswitch.xml b/packages/freeswitch/freeswitch.xml
index 4fd2a128..f212eeeb 100644
--- a/packages/freeswitch/freeswitch.xml
+++ b/packages/freeswitch/freeswitch.xml
@@ -44,7 +44,7 @@
<requirements>Describe your package requirements here</requirements>
<faq>Currently there are no FAQ items provided.</faq>
<name>FreeSWITCH Settings</name>
- <version>0.4.2</version>
+ <version>0.4.3</version>
<title>FreeSWITCH: Settings</title>
<include_file>/usr/local/pkg/freeswitch.inc</include_file>
<menu>