Commit Graph

392 Commits

Author SHA1 Message Date
George Joseph 1a0acabb8a ast_coredumper: Increase reliability
Instead of searching for the asterisk binary and the modules in the
filesystem, we now get their locations, along with libdir, from
the coredump itself...

For the binary, we can use `gdb -c <coredump> ... "info proc exe"`.
gdb can print this even without having the executable and symbols.

Once we have the binary, we can get the location of the modules with
`gdb ... "print ast_config_AST_MODULE_DIR`

If there was no result then either it's not an asterisk coredump
or there were no symbols loaded.  Either way, it's not usable.

For libdir, we now run "strings" on the note0 section of the
coredump (which has the shared library -> memory address xref) and
search for "libasteriskssl|libasteriskpj", then take the dirname.

Since we're now getting everything from the coredump, it has to be
correct as long as we're not crossing namespace boundaries like
running asterisk in a docker container but trying to run
ast_coredumper from the host using a shared file system (which you
shouldn't be doing).

There is still a case for using --asterisk-bin and/or --libdir: If
you've updated asterisk since the coredump was taken, the binary,
libraries and modules won't match the coredump which will render it
useless.  If you can restore or rebuild the original files that
match the coredump and place them in a temporary directory, you can
use --asterisk-bin, --libdir, and a new --moddir option to point to
them and they'll be correctly captured in a tarball created
with --tarball-coredumps.  If you also use --tarball-config, you can
use a new --etcdir option to point to what normally would be the
/etc/asterisk directory.

Also addressed many "shellcheck" findings.

Resolves: #445
2023-12-06 21:24:28 +00:00
Sean Bright 91c8866ff3 live_ast: Add astcachedir to generated asterisk.conf.
`astcachedir` (added in b0842713) was not added to `live_ast` so
continued to point to the system `/var/cache` directory instead of the
one in the live environment.
2023-11-09 18:53:59 +00:00
George Joseph 0c6253b9b8 safe_asterisk: Change directory permissions to 755
If the safe_asterisk script detects that the /var/lib/asterisk
directory doesn't exist, it now creates it with 755 permissions
instead of 770.  safe_asterisk needing to create that directory
should be extremely rare though because it's normally created
by 'make install' which already sets the permissions to 755.

Resolves: #316
2023-09-13 15:17:22 +00:00
Jason D. McCormick 6a55551c5c install_prereq: Fix dependency install on aarch64.
Fixes dependency solutions in install_prereq for Debian aarch64
platforms. install_prereq was attempting to forcibly install 32-bit
armhf packages due to the aptitude search for dependencies.

Resolves: #37
2023-08-14 17:26:32 +00:00
Naveen Albert 2159ec8532 logrotate: Fix duplicate log entries.
The Asterisk logrotate script contains explicit
references to files with the .log extension,
which are also included when *log is expanded.
This causes issues with newer versions of logrotate.
This fixes this by ensuring that a log file cannot
be referenced multiple times after expansion occurs.

Resolves: #96
ASTERISK-30442
Reported by: EN Barnett
Tested by: EN Barnett
2023-05-25 10:38:50 -06:00
Sean Bright 0d6b271831
core: Cleanup gerrit and JIRA references. (#58)
* Remove .gitreview and switch to pulling the main asterisk branch
  version from configure.ac instead.

* Replace references to JIRA with GitHub.

* Other minor cleanup found along the way.

Resolves: #39
2023-05-03 09:37:57 -06:00
The_Blode 0c50ab0d4f install_prereq: Add Linux Mint support.
ASTERISK-30359 #close

Change-Id: I9c140c7f12ca7dafe65c317f2a26122cf2c72556
2023-04-10 13:05:47 -05:00
Mike Bradeen 4095a382da chan_sip: Remove deprecated module.
ASTERISK-30297

Change-Id: Ic700168c80b68879d9cee8bb07afe2712fb17996
2023-01-03 09:00:42 -06:00
Mike Bradeen de3ce178ab chan_alsa: Remove deprecated module.
ASTERISK-30298

Change-Id: I5c8afb781528afdf55d237e3bffa5e4a862ae8c7
2022-12-09 08:26:42 -07:00
Mike Bradeen d0140fc7fe app_osplookup: Remove deprecated module.
ASTERISK-30302

Change-Id: I2268189646fa0b587675d8619322818143172474
2022-12-08 08:11:30 -06:00
Frederic Van Espen cb44ceadec ast_coredumper: Fix deleting results when output dir is set
When OUTPUTDIR is set to another directory and the
--delete-results-after is set, the resulting txt files are
not deleted.

ASTERISK-29794 #close

Change-Id: I1c0071f6809a1e3f5cfc455d6eb08378bc0d7286
2021-12-15 12:39:36 -06:00
Josh Soref 815e99d5ea contrib: Spelling fixes
Correct typos of the following word families:

standard
increase
comments
valgrind
promiscuous
editing
libtonezone
storage
aggressive
whitespace
russellbryant
consecutive
peternixon

ASTERISK-29714

Change-Id: I9cafbf41b579c9c0c84c81719d2c4f900beec245
2021-11-16 06:02:11 -06:00
George Joseph 8aea2e5929 ast_coredumper: Refactor to better find things
The search for a running asterisk when --running is used
has been greatly simplified and in the event it doesn't
work, you can now specify a pid to use on the command
line with --pid.

The search for asterisk modules when --tarball-coredumps
is used has been enhanced to have a better chance of finding
them and in the event it doesn't work, you can now specify
--libdir on the command line to indicate the library directory
where they were installed.

The DATEFORMAT variable was renamed to DATEOPTS and is now
passed to the 'date' utility rather than running DATEFORMAT
as a command.

The coredump and output files are now renamed with DATEOPTS.
This can be disabled by specifying --no-rename.

Several confusing and conflicting options were removed:
--append-coredumps
--conffile
--no-default-search
--tarball-uniqueid

The script was re-structured to make it easier for follow.

Change-Id: I674be64bdde3ef310b6a551d4911c3b600ffee59
2021-10-28 13:50:43 -05:00
Joshua C. Colp 20b2741232 chan_vpb: Remove deprecated module.
ASTERISK-29597

Change-Id: I19bb39eed0257ddfef453eb2df5646d073d50fe1
2021-08-17 10:38:05 -03:00
Joshua C. Colp 6ecc48086c chan_nbs: Remove deprecated module.
ASTERISK-29595

Change-Id: Ib5c7d43a780f2fb94cee90738e4c1af211ae4a33
2021-08-17 10:36:19 -03:00
Naveen Albert c8bf8a54c2 sip_to_pjsip: Fix missing cases
Adds the "auto" case which is valid with
both chan_sip dtmfmode and chan_pjsip's
dtmf_mode, adds subscribecontext to
subscribe_context conversion, and accounts
for cipher = ALL being invalid.

ASTERISK-29459

Change-Id: Ie27d6606efad3591038000e5f3c34fa94730f6f2
2021-06-08 15:32:02 -05:00
Joshua C. Colp 531eb65cf3 svn: Switch to https scheme.
Some versions of SVN seemingly don't follow the redirect
to https.

Change-Id: Ia7c76c18cb620bcf56f08e1211a7d80d321fe253
2021-04-25 04:46:48 -05:00
Ben Ford 55c53de022 logging: Add .log to samples and update asterisk.logrotate.
Added .log extension to the sample logs in logger.conf.sample so that
they will be able to be opened in the browser when attached to JIRA
tickets. Because of this, asterisk.logrotate has also been updated to
look for .log extensions instead of no extension for log files such as
full and messages.

Change-Id: I5de743c03f08047d6c6cc80cac5019ae0c4c200f
2021-03-25 09:24:20 -05:00
Sean Bright a5d55fc9e1 sip_to_pjsip.py: Handle #include globs and other fixes
* Wildcards in #includes are now properly expanded

* Implement operators for Section class to allow sorting

ASTERISK-29142 #close

Change-Id: I9b9cd95f4cbe5c24506b75d17173c5aa1a83e5df
2020-11-05 08:55:13 -06:00
Alexander Traud f3452c85e5 install_prereq: Add GMime 3.0.
Ubuntu 20.10 does not come with GMime 2.6. Ubuntu 16.04 LTS does not
come with GMime 3.0. aptitude ignores any missing package. Therefore,
it installs the correct package(s). However, in Ubuntu 18.04 LTS and
Ubuntu 20.04 LTS, both versions are installed alongside although only
one is really needed.

Change-Id: Ic58aa9f2e131d94671f286f17dbd61e1ccbabcb7
2020-10-28 08:50:53 -05:00
George Joseph 5989e0de0f ast_coredumper: Fix issues with naming
If you run ast_coredumper --tarball-coredumps in the same directory
as the actual coredump, tar can fail because the link to the
actual coredump becomes recursive.  The resulting tarball will
have everything _except_ the coredump (which is usually what
you need)

There's also an issue that the directory name in the tarball
is the same as the coredump so if you extract the tarball the
directory it creates will overwrite the coredump.

So:

 * Made the link to the coredump use the absolute path to the
   file instead of a relative one.  This prevents the recursive
   link and allows tar to add the coredump.

 * The tarballed directory is now named <coredump>.output instead
   of just <coredump> so if you expand the tarball it won't
   overwrite the coredump.

Change-Id: I8b3eeb26e09a577c702ff966924bb0a2f9a759ea
2020-08-31 17:13:38 -05:00
Alexander Traud f225e9bf35 sip_nat_settings: Update script for latest Linux.
With the latest Linux, 'ifconfig' is not installed on default anymore.
Furthermore, the output of the current net-tools 'ifconfig' changed.
Therefore, parsing failed. This update uses 'ip addr show' instead.
Finally, the service for the external IP changed.

Change-Id: I9b1a7c3f457e3553b50a3e9a55524e40d70245a0
2020-08-28 15:48:50 -05:00
Alexander Traud a107e85b2e install_prereq: Add libcap for high bits in DiffServ/ToS.
works automatically; see Mantis 7047 (now ASTERISK-6863)

Change-Id: I27d2c109180bd857b6757fd532de48eddb78aee6
2020-04-16 10:29:30 -05:00
Alexander Traud 610e058189 BuildSystem: Search for Python/C API when possibly needed only.
The Python/C API is used only if the Test Framework was enabled in Asterisk
'make menuselect'. The Test Framework is available only if the Developer Mode
was enabled in Asterisk './configure --enable-dev-mode'. And that Python/C API
is used only if the PJProject was found and not disabled in Asterisk; the user
did not go for './configure --without-pjproject'.

Furthermore, because version 2 of that Python/C API is required (currently) and
because some platforms do not offer a generic version 2, the script searches
for 2.7 explicitly as well.

To avoid version mismatch between the Python/C API and the Python environment,
the script searches for the latter in the same versions, in the same the order
as well. Because this Python/C API is just for (some) Asterisk contributors,
the script also goes for the Python 3 environment as a last resort for all
other Asterisk users. This allows 'make full' even on minimal installations of
Ubuntu 18.04 LTS and newer.

Because the Python/C API is Asterisk contributor specific, the Python packages
are removed from the script './contrib/scripts/install_prereq' as this script
is intended for Asterisk users. Asterisk contributors have to install much more
packages in any case, like:
sudo apt install autoconf automake git git-review python2.7-dev

ASTERISK-28824
ASTERISK-27717

Change-Id: Id46d357e18869f64dcc217b8fdba821b63eeb876
2020-04-13 17:21:46 -05:00
Kevin Harwell 26713dc88b ast_coredumper: add Asterisk information dump
This patch makes it so ast_coredumper now outputs the following information to
a *-info.txt file when processing a core file:

  asterisk version and "built by" string
  BUILD_OPTS
  system start, and last reloaded date/time
  taskprocessor list
  equivalent of "bridge show all"
  equivalent of "core show channels verbose"

Also a slight modification was made when trying to obtain the pid(s) of a
running Asterisk. If it fails to retrieve any it now reports an error.

Change-Id: I54f35c19ab69b8f8dc78cc933c3fb7c99cef346b
2020-03-26 08:27:55 -05:00
Sean Bright de6919f339 ast_tls_cert: Allow private key size to be set on command line
The default size in release branches will be 1024 but we'll use 2048 in master.

ASTERISK~28750

Change-Id: I435cea18bdd58824ed2b55259575c7ec7133842a
2020-02-19 09:42:03 -05:00
Sylvain Afchain 0c02d0a450 install_prereq: Install aptitude non-interactively
Currently aptitude is installed using interactive mode. This patch
changes this to use the non-interactive mode as it can block
automatic dependencies installation, ex: CI, Docker build.

ASTERISK-28726 #close

Change-Id: I271ee00d230513a6f044810351a32d83b2181133
2020-02-05 06:20:07 -06:00
Pascal Cadotte Michaud e494d5fd76
sip_to_pjsip.py: Fix trustrpid typo
ASTERISK-28664 #close

Change-Id: I6c28b1002fd7075ae0ed36f026f8c1855c9418a6
2019-12-17 13:10:17 -05:00
Walter Doekes 4304c6534a
contrib/scripts: Make spandspflow2pcap.py Python 2.7+/3.3+ compatible
Change-Id: Ica182a891743017ff3cda16de3d95335fffd9a91
2019-07-22 17:43:48 +02:00
Sean Bright f098d4a325 sip_to_pjsip: Make multiline comment parsing consistent with Asterisk
In Asterisk configuration, a multiline comment starts with ;-- as long as it is
not followed by another dash (i.e. ;--- is not a multiline comment).

ASTERISK-28323 #close

Change-Id: I32dc38e0fac01d3c0805d27d35d2365a7c37ca72
2019-03-04 13:40:43 -06:00
George Joseph 809e836265 ast_coredumper: Refactor the pid determination process
In order to get a dump of the running process, we need to find the
pid of the main asterisk process.  This can be tricky if there are
also instances of "asterisk -r" running or if an alternate location
for asterisk.conf was specified on the command line with the -C
option that also specified an alternation location for the pid file.

So now...

1. We find the asterisk executable with "which" or the --asterisk-bin
   command line option.
2. If there's only 1 process with an executable path that matches,
   we use that pid.  If not...
3. We try "<asterisk-bin> -rx 'core show settings'" and parse the
   output to find the pidfile, then read that for the pid.  If that
   didn't work...
4. We get a list of all the pids matching <asterisk-bin> and look
   in /proc/<pid>/cmdline for a -C argument and retry the "core show
   settings" using the same -C option.  We can't parse the output
   of "ps" to get the -C path because it may contain spaces.  The
   contents of /proc/<pid>/cmdline are delimited by NULLs.  For BSDs
   we may have to mount /proc first. :(

ASTERISK-28221
Reported by: Andrew Nagy

Change-Id: I8aa1f3f912f949df2b5348908803c636bde1d57c
2018-12-24 14:17:38 -05:00
Pascal Cadotte Michaud ebff81e3a0
contrib/sip_to_pjsip: add a --quiet option to avoid prints
Using the --quiet or -q option in conjonction with /dev/stdout as the output
file allow the output to be used as a valid configuration.

Given a script that generates a valid sip.conf I can pipe the output of that
script into `sip_to_pjsip.py -q /dev/stdin /dev/stdout`. This allow me to use
that piped command in my pjsip.conf using the `exec` command.

ASTERISK-28136

Change-Id: I7b0e2e90e2549f3f8e01dc96701f111b5874c88d
2018-11-01 08:50:19 -04:00
Pascal Cadotte Michaud b0155f7e58 contrib/sip_to_pjsip: handle setvar in conversion
Given a sip.conf with the following content:

setvar FOO=1
setvar BAR=42

I want my generated pjsip.conf to containt the following set_vars

set_var FOO=1
set_var BAR=42

in the matching endpoint section.

Change-Id: I6c822401fda4133c3b44bf31e655b4eb939d4d26
2018-10-30 10:26:07 -05:00
Corey Farrell 79677ead28 refdebug: Create refstats.py script.
This allows us to process AO2 statistics for total objects, memory
usage, memory overhead and lock usage.

* Install refstats.py and reflocks.py into the Asterisk scripts folder.
* Enable support for reflocks.py without DEBUG_THREADS.

Steal a bit from the ao2 magic to flag when an object lock is used.
Remove 'lockobj' from reflocks.py since we can now record 'used' or
'unused' for those objects.

Add comments to explain thread safety of the 'struct __priv_data'
bitfields.

Change-Id: I84e9d679cc86d772cc97c888d9d856a17e0d3a4a
2018-10-15 15:35:35 -05:00
George Joseph 772d991a43 Merge "ast_coredumper: Remove .gdbinit file on exit" 2018-10-04 09:43:09 -05:00
Sean Bright b2ed667712 ast_coredumper: Remove .gdbinit file on exit
Change-Id: I1297de78628773ca368e687c6f148bf74857cae9
2018-10-03 17:03:09 -05:00
George Joseph a29cefe5b2 ast_coredumper: Don't use "declare -n"
Change-Id: I7ddfed4cd6549a0cd458e4d5cf9ac95d784de6cb
2018-10-03 15:30:22 -05:00
Corey Farrell 13df745278
astobj2: Record lock usage to refs log when DEBUG_THREADS is enabled.
When DEBUG_THREADS is enabled we can know if the astobj2 mutex / rwlock
was ever used, so it can be recorded in the REF_DEBUG destructor entry.

Create contrib/scripts/reflocks.py to process locking used by
allocator.  This can be used to identify places where
AO2_ALLOC_OPT_LOCK_NOLOCK should be used to reduce memory usage.

Change-Id: I2e3cd23336a97df2692b545f548fd79b14b53bf4
2018-10-01 22:27:30 -04:00
Corey Farrell 246c39e46c
install_prereq: Remove unpackaged version of jansson.
This is removed in favor of ./configure --with-jansson-bundled.  The
install-unpackaged command would only install jansson once, so once
installed it would never update, where the bundled copy will be kept up
to date.

Change-Id: Ideab1f65419608d3795aa608e9da873823cc42d3
2018-09-17 13:58:10 -04:00
Richard Mudgett 58c3677581 contrib/scripts: Make astgenkey executable
Change-Id: I11641d65592536dea9cbca5aa94a24c25d24dd5f
2018-08-14 12:10:01 -05:00
George Joseph 2bf26ce5ac ast_coredumper: Fix output directory and variable precedence
The OUTPUTDIR variable in ast_debug_tools.conf.sample is now set
to "/tmp" instead of "/some/directory".

Variables set on the command line or that are already in the
environment now take predecence over variables set in the config files.

ASTERISK-27846
Reported by: Ted G

Change-Id: Ie8baec52d531886bf5849ec1d59bb59dc87ad387
2018-05-24 12:59:37 -06:00
Alexander Traud 2d81709ab1 sip_to_pjsip: Enable python3 compatibility.
The script remains compatible with Python 2.7 but now also works with
Python 3.3 and newer; to ease the migration from chan_sip to chan_pjsip.

ASTERISK-27811

Change-Id: I59cc6b52a1a89777eebcf25b3023bdf93babf835
2018-05-09 09:38:38 -04:00
Alexander Traud 6e9a612293 install_prereq: Add DragonFly BSD.
ASTERISK-27820

Change-Id: I718ddb000fe5184b1bdc7759da67a370a7520144
2018-04-20 12:18:06 +02:00
Corey Farrell 879e592baf Build System: Enable python3 compatibility.
* Consistently use spaces in rest-api-templates/asterisk_processor.py.
* Exclude third-party from docs/full-en_US.xml.
* Add docs/full-en_US.xml to .gitignore.
* Use list() to convert python3 view.
* Use python3 print function.
* Replace cmp() with equivalent equation.
* Replace reference to out of scope subtype variable with name
  parameter.
* Use unescaping triple bracket notation in mustache templates where
  needed.  This causes behavior of Python2 to be maintained when using
  Python3.
* Fix references to has_websocket / is_websocket in
  res_ari_resource.c.mustache.
* Update calculation of has_websocket to use any().
* Use unicode mode for writing output file in transform.py.
* Replace 'from swagger_model import *' with explicit import of required
  symbols.

I have not tested spandspflow2pcap.py or voicemailpwcheck.py, only the
print syntax has been fixed.

Change-Id: If5c5b556a2800d41a3e2cfef080ac2e151178c33
2018-04-09 10:07:38 -04:00
Joshua Colp edba638a72 Merge "install_prereq: Add Gentoo Linux." 2018-04-03 07:32:23 -05:00
Alexander Traud 07cf6b1437 install_prereq: Add Slackware (somehow).
ASTERISK-27770

Change-Id: Ib87e0483c785542238cfe34c1e884d5a31edfaab
2018-03-23 19:15:09 +01:00
Alexander Traud 307a295d00 install_prereq: Add Gentoo Linux.
ASTERISK-27769

Change-Id: Ieb13293cd67481f3a33f58f6f7c8c3ee1e338e7a
2018-03-23 15:13:44 +01:00
Alexander Traud 10a978829e BuildSystem: Remove unused dependency on libltdl.
Asterisk does not need the development package of libltdl, because it does not
use any symbol of -lltdl directly. Instead, it uses the runtime package via the
shared library -lodbc. On the supported platforms, that shared library declares
its dependency on -lltdl correctly, otherwise AST_EXT_LIB_CHECK would have
failed.

ASTERISK-27745

Change-Id: Icd315809b8e7978203431f3afb66240dd3a040ba
2018-03-17 11:00:06 +01:00
Alexander Traud dbf5ff6ed0 install_prereq: Add Arch Linux.
ASTERISK-27738

Change-Id: I7ca620e3c4dfb4b064a19382c4915aeb42a2a09f
2018-03-15 14:24:56 +01:00
Alexander Traud b0fff03bb5 install_prereq: Add SUSE.
ASTERISK-27736

Change-Id: I4cafc8973349d50a7cb7919ddf0bb1aaef4bfc3e
2018-03-14 14:57:16 +01:00