0) { $response .= $buffer; } if ($contentlength == 0) { //if contentlenght is already don't process again if (strlen(trim($buffer)) > 0) { //run only if buffer has content $temparray = split(":", trim($buffer)); if ($temparray[0] == "Content-Length") { $contentlength = trim($temparray[1]); } } } usleep(100); //allow time for reponse //optional because of script timeout //don't let while loop become endless if ($i > 10000) { break; } if ($contentlength > 0) { //is contentlength set //stop reading if all content has been read. if (strlen($response) >= $contentlength) { break; } } $i++; } return $response; } else { echo "no handle"; } } function event_socket_request_cmd($cmd) { global $config; $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']; $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']; $host = $config['interfaces']['lan']['ipaddr']; if (pkg_is_service_running('freeswitch')) { $fp = event_socket_create($host, $port, $password); $response = event_socket_request($fp, $cmd); fclose($fp); } unset($host, $port, $password); } function sync_package_freeswitch_settings() { global $config; if($config['installedpackages']['freeswitchsettings']['config'] != "") { conf_mount_rw(); config_unlock(); foreach($config['installedpackages']['freeswitchsettings']['config'] as $rowhelper) { $fout = fopen("/usr/local/freeswitch/conf/directory/default/default.xml","w"); $tmpxml = "\n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= "\n"; fwrite($fout, $tmpxml); unset($tmpxml); fclose($fout); $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml","w"); $tmpxml = "\n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= ""; fwrite($fout, $tmpxml); unset($tmpxml, $event_socket_password); fclose($fout); $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/xml_rpc.conf","w"); $tmpxml = "\n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= "\n"; fwrite($fout, $tmpxml); unset($tmpxml, $event_socket_password); fclose($fout); } conf_mount_ro(); $cmd = "api reloadxml"; event_socket_request_cmd($cmd); unset($cmd); } } function sync_package_freeswitch_dialplan() { global $config; conf_mount_rw(); config_unlock(); if(strlen($config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml']) == 0) { /* dialplan not found in the pfsense config.xml get the default dialplan and save to config.xml. */ $filename = "/usr/local/freeswitch/conf/dialplan/default.xml"; $fout = fopen($filename,"r"); $tmpxml = fread($fout, filesize($filename)); $config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml'] = base64_encode($tmpxml); unset($filename, $dialplan); fclose($fout); } else { /* found the dialplan in the pfsense config.xml save it to default.xml. */ $fout = fopen("/usr/local/freeswitch/conf/dialplan/default.xml","w"); $tmpxml = $config['installedpackages']['freeswitchdialplan']['config'][0]['dialplan_default_xml']; fwrite($fout, base64_decode($tmpxml)); fclose($fout); unset($tmpxml); } conf_mount_ro(); $cmd = "api reloadxml"; event_socket_request_cmd($cmd); unset($cmd); } function sync_package_freeswitch_extensions() { global $config; if($config['installedpackages']['freeswitchextensions']['config'] != "") { conf_mount_rw(); config_unlock(); /* delete all old extensions to prepare for new ones */ unlink_if_exists("/usr/local/freeswitch/conf/directory/default/1*.xml"); unlink_if_exists("/usr/local/freeswitch/conf/directory/default/2*.xml"); unlink_if_exists("/usr/local/freeswitch/conf/directory/default/3*.xml"); unlink_if_exists("/usr/local/freeswitch/conf/directory/default/4*.xml"); unlink_if_exists("/usr/local/freeswitch/conf/directory/default/5*.xml"); unlink_if_exists("/usr/local/freeswitch/conf/directory/default/6*.xml"); unlink_if_exists("/usr/local/freeswitch/conf/directory/default/7*.xml"); unlink_if_exists("/usr/local/freeswitch/conf/directory/default/8*.xml"); unlink_if_exists("/usr/local/freeswitch/conf/directory/default/9*.xml"); foreach($config['installedpackages']['freeswitchextensions']['config'] as $rowhelper) { $fout = fopen("/usr/local/freeswitch/conf/directory/default/".$rowhelper['extension'].".xml","w"); $tmpxml = "\n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; /* Disabled until further testing */ /* if (strlen($rowhelper['vm-mailto']) > 0) { */ /* $tmpxml .= " \n"; */ /* $tmpxml .= " \n"; */ /* $tmpxml .= " \n"; */ /* } */ /* */ /* Voicemail Mail To */ /* vm-mailto */ /* Optional: Enter the email address to send voicemail to. */ /* input */ /* */ $tmpxml .= " >\n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; if (strlen($rowhelper['effective_caller_id_number']) > 0) { $tmpxml .= " \n"; $tmpxml .= " \n"; } if (strlen($rowhelper['outbound_caller_id_number']) > 0) { $tmpxml .= " \n"; $tmpxml .= " \n"; } $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= "\n"; fwrite($fout, $tmpxml); unset($tmpxml); fclose($fout); } conf_mount_ro(); $cmd = "api reloadxml"; event_socket_request_cmd($cmd); unset($cmd); } } function sync_package_freeswitch_gateways() { global $config; if($config['installedpackages']['freeswitchgateways']['config'] != "") { conf_mount_rw(); config_unlock(); /* delete all old gateways to prepare for new ones */ unlink_if_exists("/usr/local/freeswitch/conf/sip_profiles/external/*.xml"); foreach($config['installedpackages']['freeswitchgateways']['config'] as $rowhelper) { $fout = fopen("/usr/local/freeswitch/conf/sip_profiles/external/".$rowhelper['gateway'].".xml","w"); $tmpxml .= "\n"; $tmpxml .= " \n"; if (strlen($rowhelper['username']) > 0) { $tmpxml .= " \n"; } if (strlen($rowhelper['password']) > 0) { $tmpxml .= " \n"; } if (strlen($rowhelper['realm']) > 0) { $tmpxml .= " \n"; } if (strlen($rowhelper['from-user']) > 0) { $tmpxml .= " \n"; } if (strlen($rowhelper['from-domain']) > 0) { $tmpxml .= " \n"; } if (strlen($rowhelper['proxy']) > 0) { $tmpxml .= " \n"; } if (strlen($rowhelper['expire-seconds']) > 0) { $tmpxml .= " \n"; } if (strlen($rowhelper['register']) > 0) { $tmpxml .= " \n"; } if (strlen($rowhelper['register-transport']) > 0) { $tmpxml .= " \n"; } if (strlen($rowhelper['retry-seconds']) > 0) { $tmpxml .= " \n"; } if (strlen($rowhelper['extension']) > 0) { $tmpxml .= " \n"; } if (strlen($rowhelper['context']) > 0) { $tmpxml .= " \n"; } if (strlen($rowhelper['caller-id-in-from']) > 0) { $tmpxml .= " \n"; } if (strlen($rowhelper['supress-cng']) > 0) { $tmpxml .= " \n"; } $tmpxml .= " \n"; $tmpxml .= ""; fwrite($fout, $tmpxml); unset($tmpxml); fclose($fout); } conf_mount_ro(); $cmd = "api sofia profile external restart reloadxml"; event_socket_request_cmd($cmd); unset($cmd); } } function sync_package_freeswitch_modules() { global $config; conf_mount_rw(); config_unlock(); foreach($config['installedpackages']['freeswitchmodules']['config'] as $rowhelper) { $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/modules.conf.xml","w"); $tmpxml =""; $tmpxml .= "\n"; $tmpxml .= " \n"; $tmpxml .= "\n"; $tmpxml .= " \n"; if ($rowhelper['mod_console'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_logfile'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_syslog'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= "\n"; if ($rowhelper['mod_yaml'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= "\n"; $tmpxml .= " \n"; $tmpxml .= " \n"; if ($rowhelper['mod_enum'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= "\n"; $tmpxml .= " \n"; if ($rowhelper['mod_xml_rpc'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_xml_curl'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_xml_cdr'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= "\n"; $tmpxml .= " \n"; if ($rowhelper['mod_cdr_csv'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_event_multicast'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_event_socket'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_zeroconf'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= "\n"; $tmpxml .= " \n"; if ($rowhelper['mod_ldap'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= "\n"; $tmpxml .= " \n"; if ($rowhelper['mod_dingaling'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_iax'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_portaudio'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_alsa'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_sofia'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_loopback'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_wanpipe'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_woomera'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_openzap'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= "\n"; $tmpxml .= " \n"; if ($rowhelper['mod_commands'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_conference'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_dptools'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_expr'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_fifo'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_voicemail'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_limit'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_esf'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_fsv'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= "\n"; $tmpxml .= " \n"; if ($rowhelper['mod_snom'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= "\n"; $tmpxml .= " \n"; if ($rowhelper['mod_dialplan_directory'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_dialplan_xml'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_dialplan_asterisk'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= "\n"; $tmpxml .= " \n"; if ($rowhelper['mod_voipcodecs'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_g723_1'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_g729'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_amr'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_ilbc'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_speex'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_h26x'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= "\n"; $tmpxml .= " \n"; if ($rowhelper['mod_sndfile'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_native_file'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= " \n"; if ($rowhelper['mod_shout'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= " \n"; if ($rowhelper['mod_local_stream'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_tone_stream'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= "\n"; $tmpxml .= " \n"; $tmpxml .= "\n"; $tmpxml .= " \n"; if ($rowhelper['mod_spidermonkey'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_perl'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_python'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_java'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_lua'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= "\n"; $tmpxml .= " \n"; if ($rowhelper['mod_flite'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_pocketsphinx'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_cepstral'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_openmrcp'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_rss'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= "\n"; $tmpxml .= " \n"; if ($rowhelper['mod_say_en'] == "enable"){ $tmpxml .= " \n"; } if ($rowhelper['mod_say_zh'] == "enable"){ $tmpxml .= " \n"; } $tmpxml .= " \n"; $tmpxml .= ""; fwrite($fout, $tmpxml); unset($tmpxml); fclose($fout); } conf_mount_ro(); $cmd = "api reloadxml"; event_socket_request_cmd($cmd); unset($cmd); } function sync_package_freeswitch_public() { global $config; conf_mount_rw(); config_unlock(); if(strlen($config['installedpackages']['freeswitchpublic']['config'][0]['public_xml']) == 0) { /* dialplan_public_xml not found in the pfsense config.xml get the default public.xml and save to config.xml. */ $filename = "/usr/local/freeswitch/conf/dialplan/public/00_inbound_did.xml"; $fout = fopen($filename,"r"); $tmpxml = fread($fout, filesize($filename)); $config['installedpackages']['freeswitchpublic']['config'][0]['public_xml'] = base64_encode($tmpxml); unset($filename, $tmpxml); fclose($fout); } else { /* found dialplan_public_xml in the pfsense config.xml save it to public.xml. */ $fout = fopen("/usr/local/freeswitch/conf/dialplan/public/00_inbound_did.xml","w"); $tmpxml = $config['installedpackages']['freeswitchpublic']['config'][0]['public_xml']; fwrite($fout, base64_decode($tmpxml)); fclose($fout); unset($tmpxml); } conf_mount_ro(); $cmd = "api reloadxml"; event_socket_request_cmd($cmd); unset($cmd); } function sync_package_freeswitch_vars() { global $config; conf_mount_rw(); config_unlock(); if(strlen($config['installedpackages']['freeswitchvars']['config'][0]['vars_xml']) == 0) { /* dialplan not found in the pfsense config.xml get the default dialplan and save to config.xml. */ $filename = "/usr/local/freeswitch/conf/vars.xml"; $fout = fopen($filename,"r"); $tmpxml = fread($fout, filesize($filename)); $config['installedpackages']['freeswitchvars']['config'][0]['vars_xml'] = base64_encode($tmpxml); unset($filename, $dialplan); fclose($fout); } else { /* found the dialplan in the pfsense config.xml save it to default.xml. */ $fout = fopen("/usr/local/freeswitch/conf/vars.xml","w"); $tmpxml = $config['installedpackages']['freeswitchvars']['config'][0]['vars_xml']; fwrite($fout, base64_decode($tmpxml)); fclose($fout); unset($tmpxml); } conf_mount_ro(); $cmd = "api reloadxml"; event_socket_request_cmd($cmd); unset($cmd); } function sync_package_freeswitch_internal() { global $config; conf_mount_rw(); config_unlock(); if(strlen($config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml']) == 0) { /* internal_xml not found in the pfsense config.xml get the internal.xml and save to config.xml. */ $filename = "/usr/local/freeswitch/conf/sip_profiles/internal.xml"; $fout = fopen($filename,"r"); $tmpxml = fread($fout, filesize($filename)); $config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml'] = base64_encode($tmpxml); unset($filename, $dialplan); fclose($fout); } else { /* found the internal_xml in the pfsense config.xml save it to internal.xml. */ $fout = fopen("/usr/local/freeswitch/conf/sip_profiles/internal.xml","w"); $tmpxml = $config['installedpackages']['freeswitchinternal']['config'][0]['internal_xml']; fwrite($fout, base64_decode($tmpxml)); fclose($fout); unset($tmpxml); } conf_mount_ro(); $cmd = "api reloadxml"; event_socket_request_cmd($cmd); unset($cmd); } function sync_package_freeswitch_external() { global $config; conf_mount_rw(); config_unlock(); if(strlen($config['installedpackages']['freeswitchexternal']['config'][0]['external_xml']) == 0) { /* external_xml not found in the pfsense config.xml get the external.xml and save to config.xml. */ $filename = "/usr/local/freeswitch/conf/sip_profiles/external.xml"; $fout = fopen($filename,"r"); $tmpxml = fread($fout, filesize($filename)); $config['installedpackages']['freeswitchexternal']['config'][0]['external_xml'] = base64_encode($tmpxml); unset($filename, $dialplan); fclose($fout); } else { /* found the external_xml in the pfsense config.xml save it to external.xml. */ $fout = fopen("/usr/local/freeswitch/conf/sip_profiles/external.xml","w"); $tmpxml = $config['installedpackages']['freeswitchexternal']['config'][0]['external_xml']; fwrite($fout, base64_decode($tmpxml)); fclose($fout); unset($tmpxml); } conf_mount_ro(); $cmd = "api reloadxml"; event_socket_request_cmd($cmd); unset($cmd); } function sync_package_freeswitch() { global $config; sync_package_freeswitch_settings(); sync_package_freeswitch_dialplan(); sync_package_freeswitch_extensions(); sync_package_freeswitch_gateways(); sync_package_freeswitch_modules(); sync_package_freeswitch_public(); sync_package_freeswitch_vars(); sync_package_freeswitch_internal(); sync_package_freeswitch_external(); } function freeswitch_php_install_command() { global $config; conf_mount_rw(); config_lock(); if (!is_dir('/usr/local/www/freeswitch/')) { exec("mkdir /usr/local/www/freeswitch/"); } exec("cp /tmp/freeswitch_status.tmp /usr/local/www/freeswitch/freeswitch_status.php"); unlink_if_exists("/tmp/freeswitch_status.tmp"); exec("tar zxvf /tmp/freeswitch.tgz -C /usr/local/"); unlink_if_exists("/tmp/freeswitch.tgz"); /* freeswitch settings defaults */ if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan']) == 0) { $config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan'] = "US"; } if(strlen($config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']) == 0) { $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'] = "ClueCon"; } if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']) == 0) { $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'] = "8021"; } if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_http_port']) == 0) { $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_http_port'] = "8787"; } if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm']) == 0) { $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm'] = "freeswitch"; } if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user']) == 0) { $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user'] = "freeswitch"; } if (strlen($config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass']) == 0) { $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass'] = "works"; } $numbering_plan = $config['installedpackages']['freeswitchsettings']['config'][0]['numbering_plan']; $event_socket_password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password']; $event_socket_port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port']; $xml_rpc_http_port = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_http_port']; $xml_rpc_auth_realm = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_realm']; $xml_rpc_auth_user = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_user']; $xml_rpc_auth_pass = $config['installedpackages']['freeswitchsettings']['config'][0]['xml_rpc_auth_pass']; $fout = fopen("/usr/local/freeswitch/conf/autoload_configs/event_socket.conf.xml","w"); $tmpxml = "\n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= " \n"; $tmpxml .= ""; fwrite($fout, $tmpxml); unset($tmpxml); fclose($fout); /* freeswitch modules defaults */ if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_console']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_console'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_logfile']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_logfile'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_syslog']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_syslog'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_yaml']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_yaml'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_enum']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_enum'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_rpc']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_rpc'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_curl']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_curl'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_cdr']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_xml_cdr'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_cdr_csv']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_cdr_csv'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_multicast']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_multicast'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_socket']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_event_socket'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_zeroconf']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_zeroconf'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_ldap']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_ldap'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dingaling']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dingaling'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_iax']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_iax'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_portaudio']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_portaudio'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_alsa']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_alsa'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_sofia']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_sofia'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_loopback']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_loopback'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_wanpipe']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_wanpipe'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_woomera']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_woomera'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_openzap']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_openzap'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_commands']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_commands'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_conference']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_conference'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dptools']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dptools'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_expr']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_expr'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_fifo']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_fifo'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_voicemail']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_voicemail'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_limit']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_limit'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_esf']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_esf'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_fsv']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_fsv'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_snom']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_snom'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_directory']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_directory'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_xml']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_xml'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_asterisk']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_dialplan_asterisk'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_voipcodecs']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_voipcodecs'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_g723_1']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_g723_1'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_g729']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_g729'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_amr']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_amr'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_ilbc']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_ilbc'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_speex']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_speex'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_h26x']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_h26x'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_sndfile']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_sndfile'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_native_file']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_native_file'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_shout']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_shout'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_local_stream']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_local_stream'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_tone_stream']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_tone_stream'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_spidermonkey']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_spidermonkey'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_perl']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_perl'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_python']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_python'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_java']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_java'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_lua']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_lua'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_flite']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_flite'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_pocketsphinx']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_pocketsphinx'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_cepstral']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_cepstral'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_openmrcp']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_openmrcp'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_rss']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_rss'] = "disable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_en']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_en'] = "enable"; } if (strlen($config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_zh']) == 0) { $config['installedpackages']['freeswitchmodules']['config'][0]['mod_say_zh'] = "disable"; } write_rcfile(array( "file" => "freeswitch.sh", "start" => "/usr/local/freeswitch/bin/./freeswitch -nc", "stop" => "/usr/local/freeswitch/bin/./freeswitch -stop" ) ); exec("rm -R /freeswitch"); sync_package_freeswitch(); $handle = popen("/usr/local/etc/rc.d/freeswitch.sh start", "r"); pclose($handle); $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_version'] = "1.0.1 revision 9759."; $config['installedpackages']['freeswitchsettings']['config'][0]['freeswitch_package_version'] = "0.1.1"; conf_mount_ro(); config_unlock(); } function freeswitch_deinstall_command() { conf_mount_rw(); config_lock(); exec("killall -9 freeswitch"); unlink_if_exists("/usr/local/pkg/freeswitch.xml"); unlink_if_exists("/usr/local/pkg/freeswitch.inc"); unlink_if_exists("/usr/local/pkg/freeswitch_dialplan.xml"); unlink_if_exists("/usr/local/pkg/freeswitch_extensions.xml"); unlink_if_exists("/usr/local/pkg/freeswitch_external.xml"); unlink_if_exists("/usr/local/pkg/freeswitch_gateways.xml"); unlink_if_exists("/usr/local/pkg/freeswitch_internal.xml"); unlink_if_exists("/usr/local/pkg/freeswitch_modules.xml"); unlink_if_exists("/usr/local/pkg/freeswitch_public.xml"); unlink_if_exists("/usr/local/pkg/freeswitch_vars.xml"); unlink_if_exists("/usr/local/www/freeswitch/freeswitch_status.xml"); exec("rm -R /usr/local/freeswitch/"); exec("rm -R /usr/local/www/freeswitch/"); unlink_if_exists("/usr/local/etc/rc.d/freeswitch.sh"); unlink_if_exists("/tmp/freeswitch.tar.gz"); unlink_if_exists("/tmp/pkg_mgr_FreeSWITCH.log"); conf_mount_ro(); config_unlock(); } ?>