Asterisk 1.8 package
-
FFS!!!! Your issue is having TWO scripts when you should have one, and that one should be called asterisk.sh. Reinstall the package or delete it manually. Explained 4 times by now. >:(
Period.
-
There's only asterisk.sh, and this script gets called twice.
-
Yeah, so get it fixed in pfSense core. Every damn package out there uses what I already explained.
-
Hoops! There was an "asterisk" script withoug the .sh extension…
-
Incredible. Won't explain for the fifth time. Pretty much every package out there uses <something>.sh with no problem. If you have issue with something called twice, then fix the code that's calling something twice.
And - while here… that pfSense core code show grow itself some brain and produce an API for disabling packages. Instead of people hacking code that creates the script on enabling the package and remove it on disabling. rc.conf.local ain't usable for this, perhaps/etc/rc.conf.d/ could.</something>
-
I just started a fresh 2.2.5 install (virtual machine) and the default installation starts Asterisk twice as described here:
https://forum.pfsense.org/index.php?topic=102591.0
asterisk.sh gets called twice and there are no old installations and there is no single asterisk script in the rc.d dir. A couple of days ago I added a logger() statement in asterisk.sh and the script was indeed called twice, which explains the two instances.Tomorrow I'll setup a new machine and then I'll report again. I have about half a dozen 2.2.4 boxes with older installations, so I cannot exclude that there are still asterisk scripts or whatever, like the one I checked about an hour ago.
-
Initially asterisk.sh gets called in the background and the .sh loop calls it directly, so a short sleep may or may not solve the problem.
I am too tired now, but my basic idea is that anything that gets called in the background with start_service(), will not get called subsequently. Should be easy to implement.
-
I am too tired now, but my basic idea is that anything that gets called in the background with start_service(), will not get called subsequently. Should be easy to implement.
Kindly post the output of the following (paste to Diagnostics - Command Prompt - PHP execute)
require_once("/etc/inc/pkg-utils.inc"); $rcfiles = glob(RCFILEPREFIX . "*.sh"); if (!$rcfiles) $rcfiles = array(); else { $rcfiles = array_flip($rcfiles); if (!$rcfiles) $rcfiles = array(); } if (is_array($config['installedpackages']['package'])) { foreach($config['installedpackages']['package'] as $pkgid => $package) { $internal_name = get_pkg_internal_name($package); unset($rcfiles[RCFILEPREFIX . strtolower($internal_name) . ".sh"]); } } var_dump($rcfiles);
since whatever you are describing simply doesn't happen with sane configuration. The .sh script just won't run from the $shell = @popen("/bin/sh", "w"); part because it's unset with the
unset($rcfiles[RCFILEPREFIX . strtolower($internal_name) . ".sh"]);
line.
-
https://github.com/pfsense/pfsense-packages/pull/1191 should fix whatever is fixable in the package regarding service (re)starts.
-
Kindly post the output of the following (paste to Diagnostics - Command Prompt - PHP execute)
I see this only briefly flashing on the console. Are these messages also written into some file?
-
Console?! Diagnostics - Command Prompt - PHP execute is not briefly flashing anywhere. Regardless, the PR has been merged.
-
One can call log_error() to show things on the console, which I used for my tests. I also saw a couple of echos in rc.start_packages, but I did not check where the output is going (probably nowhere, without a web interface). The same would apply to your var_dump() call.
I could explicitly call rc.start_packages and rc.stop_packages, but I don't know whether this is equivalent to what happens at boot time. It will take some time before I've studied all the php stuff….
-
I would suggest installing 0.3.4 before wasting more time here.
-
Can the Asterisk package meanwhile work as an endpoint for T.38 faxes? No? My custom package does. There's nothing in the GUI that depends on the specific Asterisk version, so why is 1.8 used? No hangup handlers, no named ACLs, no AMI security events, no RESTful interface, but a lot of useless modules. Maybe it is you who should not waste time with Asterisk. Have you figured out meanwhile why a B2BUA makes sense in a firewall?
-
Dude, I have no clue why are you aiming your rants at me. You can test with 0.3.4 to see whether your "started twice on boot" issue is fixed.
-
I'd like to suggest a small patch for /usr/local/etc/rc.d/asterisk.sh, actually for the sync_package_asterisk function in /usr/local/pkg/asterisk.inc.
In line 396 in asterisk.inc add
if [ ! -e /var/db/asterisk/astdb ] && [ -e /cf/conf/asterisk/astdb.backup ]; then cp /cf/conf/asterisk/astdb.backup /var/db/asterisk/astdb chown asterisk:asterisk /var/db/asterisk/astdb chmod 0775 /var/db/asterisk/astdb fi
Then add after line 408:
$stop .= "\n\tif [ -e /var/db/asterisk/astdb ]; then\n\t"; $stop .= "\tcp -f /var/db/asterisk/astdb /cf/conf/asterisk/astdb.backup\n\tfi;"
The associated patch would be:
396a397,402 > if [ ! -e /var/db/asterisk/astdb ] && [ -e /cf/conf/asterisk/astdb.backup ]; then > cp /cf/conf/asterisk/astdb.backup /var/db/asterisk/astdb > chown asterisk:asterisk /var/db/asterisk/astdb > chmod 0775 /var/db/asterisk/astdb > fi > 402a409,410 > $stop .= "\n\tif [ -e /var/db/asterisk/astdb ]; then\n\t"; > $stop .= "\tcp -f /var/db/asterisk/astdb /cf/conf/asterisk/astdb.backup\n\tfi;"
The additions save and restore the astdb file when Asterisk gets stopped or restarted. For convenience, I selected the /cf/conf/asterisk directory, such that it gets saved with the configuration backup command.
The background of this patch is to make Asterisk work properly when RAM disks are used (Advanced->Miscellaneous). Asterisk itself always tries to use astdb, regardless of whether app_db, or func_db are loaded, and tries to keep track of current registrations across program invocations. Otherwise, phones have to register again before they can be used. Typical registry expiry times are 1h, so this could be a problem in larger installations. At home one would simply restart the phones, I guess.
-
Asterisk 0.3.4 does not start from GUI
New install of pfSense nanoBSD 2.2.5
Restore last config from 2.2.4, which had Asterisk 0.3.1 installed
Asterisk 0.3.4 gets installed automatically
Asterisk does not start
Asterisk can't be started manually from Status->Services
Asterisk can be started manually via ssh:
/usr/local/etc/rc.d/asterisk.sh startLong story short
–-------------------v0.3.1 asterisk.xml service definition defined rcfile as "asterisk"
v0.3.4 asterisk.xml service definition defines rcfile as "asterisk.sh" : correct
After restoring config where rcfile was "asterisk" and installing v0.3.4 (in that order), config.xml service definition still defines rcfile as "asterisk", i.e., the old service definition isn't updated when v0.3.4 is installed.Workaround: Edit config.xml manually, changing asterisk rcfile definition from "asterisk" to "asterisk.sh". Then delete /tmp/config.cache.
This workaround shouldn't need to be repeated in the future.I don't know why config.xml isn't being updated when v0.3.4 is installed.
-
I don't know why config.xml isn't being updated when v0.3.4 is installed.
Because the install code is cached in various broken ways… General hint: Do not upgrade packages on pfSense <2.3; uninstall + reinstall the new version.
-
Hi,
Is there any HOWTO for newbie telling how to start using the asterisk on pfsense?
I installed the package and started it, but there are a lot of config files …I am complete newbie in the ASTERISK, I am just a user of PFSense. All VoIP phones I use connect to external VoIP provider, which is not very optimal.
I would like to test asterisk and maybe in the feature instead of configure my phones to use external provider I would go for having VoIP PBX in my LAN.
But have no idea where to start.Please give me some advice.
Thanks
-
You'll have to deal mostly with sip.conf and extensions.conf, only. Maybe you want to play a bit with modules.conf.
I'd recommend
http://www.asteriskdocs.org/en/2nd_Edition/asterisk-book-html-chunk/index.html
to start with and I'd set up a virtual machine for initial explorations and not use the pfSense package.The Asterisk package for pfSense does not really have a GUI, you need to edit the configuration files manually, but the benefit is that this is much more flexible.