Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Asterisk 1.8 package

    Scheduled Pinned Locked Moved pfSense Packages
    281 Posts 59 Posters 235.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      carlm
      last edited by

      Bug and fix

      I just found and fixed a bug in /usr/local/pkg/asterisk.inc (v0.3.1, not latest).

      Symptom:
      Every time the Asterisk package is started, the following files in /conf/asterisk are modified:
      asterisk.conf
      logger.conf

      Edits that the user has made to these files may be lost (if they overlap the modifications
      performed by asterisk.inc).

      Description:
      These files are supposed to be modified the FIRST time that the Asterisk package is started.
      When asterisk.inc modifies other .conf files it adds a flag comment '; by pfSense ;' .
      The flag comment is present in logger.conf, missing in asterisk.conf.
      The code in asterisk.inc doesn't, but should, check for presence of the flag comment in these two files and not modify them if the flag comment is present.

      Fix:
      In asterisk.inc:
      1. Add flag comment to asterisk.conf when modifying it.
      2. Do not modify asterisk.conf or logger.conf if the file already contains the flag comment.

      I have attached a .zip with both a unified context diff and the full file (patched), whichever you prefer to work with.
      Remember, this is for package v0.3.1 (what I'm running).
      The file asterisk.inc has changed since then.

      asterisk_inc_0_3_1-patch.zip

      1 Reply Last reply Reply Quote 0
      • D
        doktornotor Banned
        last edited by

        Any patches need to go to https://github.com/pfsense/pfsense-packages/ and obviously need to be against current code. Just a note.

        1 Reply Last reply Reply Quote 0
        • F
          Fesoj
          last edited by

          res_fax.so and res_fax_spandsp.so
          Hi,
          the package contains res_fax.so, but not res_fax_spandsp.so.  Is there a specific reason why this lib does not exits?

          I have a native build for res_fax_spandsp.so, but this does not seem to work (libspandsp does not seem to be able to find libjpeg, although it is also in /usr/local/lib).

          1 Reply Last reply Reply Quote 0
          • F
            Fesoj
            last edited by

            res_fax.so and res_fax_spandsp.so

            I found the place where to put symlinks for the missing libaries.

            Now I have the following problem

            [Oct 16 20:56:18] WARNING[-1]: loader.c:835 inspect_module: Module 'res_fax_spandsp.so' was not compiled with the same compile-time options as this version of Asterisk.
            [Oct 16 20:56:18] WARNING[-1]: loader.c:836 inspect_module: Module 'res_fax_spandsp.so' will not be initialized as it may cause instability.
            [Oct 16 20:56:18] WARNING[-1]: loader.c:923 load_resource: Module 'res_fax_spandsp' could not be loaded.
            

            The basic reason could be that the versions of Asterisk and the module are different: 1.8.32 vs. 1.8.x. I compiled Asterisk from the ports directory of the current 10.1 version, so I cannot arbitrarily choose the version.

            1 Reply Last reply Reply Quote 0
            • F
              Fesoj
              last edited by

              I am currently working with the Asterisk package, where I am using pfSense/Asterisk essentially as a session border controller.

              T.38 facsimiles are now working for me, which essentially involves patching the AST_BUILDOPT_SUM string inside the res_fax_spandsp.so lib. This is not really nice.

              After restarting, some configuration files seem to get modified every time. There is some funny stuff that gets appended to modules.conf and extensions.conf. Does anyone know why this is happening?

              After rebooting pfSense, there's also a problem with the SIP module on my box, which looks as if other network functions are not yet properly running. Waiting and restarting the Asterisk solves the problem

              Is currently someone working on this package? I have some spare time to work on the package.

              1 Reply Last reply Reply Quote 0
              • D
                doktornotor Banned
                last edited by

                1/ You do NOT make changes to config files via shell. They get lost. You configure things via GUI. If it's not possible, modify the GUI code and submit a pull request against the current code… Not outdated one that noone can install. Useless.
                2/ You do not produce any similar nonsense like binary patches mixing libraries from different binary packages. That has nothing to do with "work on the package". Noone will merge such crap.
                3/ About 99% of the world abandoned junk like fax ages ago. Hardly surprising noone tests it.
                4/ Before wasting time on trying to fix unfixable crap such as PBI, perhaps rather play with pfSense 2.3 and get it working there.

                P.S. My personal observation: There's tons of whole LOT more suitable places to run a PBX on. Such as some VM on a DMZed server. Frankly, why anyone thinks putting this monster on their firewall is a good idea goes beyond me. Especially when a VM-ready appliance incl. a configuration GUI is readily available for download! http://www.asterisk.org/downloads/asterisknow

                1 Reply Last reply Reply Quote 0
                • F
                  Fesoj
                  last edited by

                  @doktornotor - Maybe you don't know what the role of an SBC is. An SBC is not a PBX, although the package may be the same…

                  1 Reply Last reply Reply Quote 0
                  • C
                    carlm
                    last edited by

                    RTCP stats problem

                    CLI command 'sip show channelstats' issued during an active call: all data except duration is zero.
                    I've done 'rtcp set stats on'.
                    I've turned on rtcp debug: I get Sender Reports from both my endpoint and my provider's SIP proxy.

                    Just wondering:
                    Where does Asterisk store the RTCP stats? Memory? Disk? If disk, does the Asterisk init script need to create another directory under /var?

                    Thanks!

                    EDIT:
                    The problem is due to this Asterisk 1.8 open bug:

                    https://issues.asterisk.org/jira/browse/ASTERISK-18455

                    I temporarily forced Asterisk to transcode and I started getting valid data from 'sip show channelstats'.

                    1 Reply Last reply Reply Quote 0
                    • F
                      Fesoj
                      last edited by

                      There might be a different cause. Please check the value of directmedia in sip.conf. The default setting is "yes", where Asterisk tries to redirect media directly between caller and callee. In this case Asterisk doesn't see any audio and hence cannot generate any statistics.

                      1 Reply Last reply Reply Quote 0
                      • C
                        carlm
                        last edited by

                        In sip.conf all of my device definitions include directmedia=no, so that's not it.
                        But thanks for the suggestion.

                        1 Reply Last reply Reply Quote 0
                        • F
                          Fesoj
                          last edited by

                          The current Asterisk package generates an rc-file named asterisk.sh. This causes the service to get started two times in rc.start_packages, because the second instance cannot check that another instance is already running. It takes a moment before the pid file has been generated.

                          The package should generate a simple rc-file with the name asterisk, such that the manual boot time service does not get called.

                          1 Reply Last reply Reply Quote 0
                          • D
                            doktornotor Banned
                            last edited by

                            @Fesoj:

                            The package should generate a simple rc-file with the name asterisk, such that the manual boot time service does not get called.

                            What second instance? The /usr/local/etc/rc.d/asterisk script is removed on install.

                            https://github.com/pfsense/pfsense-packages/blob/master/config/asterisk/asterisk.inc#L41

                            1 Reply Last reply Reply Quote 0
                            • F
                              Fesoj
                              last edited by

                              Nope, the file asterisk never gets generated, only asterisk.sh. And this causes the problem of two instances.

                              1 Reply Last reply Reply Quote 0
                              • D
                                doktornotor Banned
                                last edited by

                                @Fesoj:

                                Nope, the file asterisk never gets generated, only asterisk.sh. And this causes the problem of two instances.

                                And it should NOT get generated. The only file that SHOULD exist is asterisk.sh. If you still have /usr/local/etc/rc.d/asterisk, just reinstall the package. (And, in general, do yourself a favor and do not upgrade packages on pfSense <2.3, uninstall and reinstall them instead. Otherwise, the updated install code simply is not used.)

                                1 Reply Last reply Reply Quote 0
                                • F
                                  Fesoj
                                  last edited by

                                  I think currently only asterisk.sh gets installed. asterisk.sh causes problems. I have to setup a new box tomorrow and then I'll have a look at what happens at a fresh install.

                                  <service>.sh should only be used for manual services outside any package. At least that's my understanding. Just have a look at rc.start_packages. Essentially $rcfiles = glob(RCFILEPREFIX . "*.sh"); grabs all .sh files and if a package uses the .sh extension itself; one potentially runs into problems if an executable cannot detect that another instance has already been started.</service>

                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    doktornotor Banned
                                    last edited by

                                    Sigh.

                                    1/ <service>.sh is used by pretty much any package out there. Usually generated by write_rcfile(). The scripts bundled with the PBI packages are NOT usable.
                                    2/ As already noted 3 times, you should NOT have any /usr/local/etc/rc.d/asterisk script in there. If you have, then delete it or reinstall the package and it will delete is on install.</service>

                                    1 Reply Last reply Reply Quote 0
                                    • F
                                      Fesoj
                                      last edited by

                                      The asterisk script is not generated, only asterisk.sh, but this script is called two times during system startup. Since Asterisk cannot detect almost parallel invocations, two instances are typically running. That's a problem. Therfore I suggested to give the first invocation a chance to get fully booted.

                                      If you don't believe me, insert a "logger" statement in asterisk.sh to see that "start" it is called twice at system startup.

                                      1 Reply Last reply Reply Quote 0
                                      • D
                                        doktornotor Banned
                                        last edited by

                                        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.

                                        1 Reply Last reply Reply Quote 0
                                        • F
                                          Fesoj
                                          last edited by

                                          There's only asterisk.sh, and this script gets called twice.

                                          1 Reply Last reply Reply Quote 0
                                          • D
                                            doktornotor Banned
                                            last edited by

                                            Yeah, so get it fixed in pfSense core. Every damn package out there uses what I already explained.

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.