Commit Graph

729 Commits

Author SHA1 Message Date
George Joseph e252aff9ad debug_utilities: Install ast_logescalator to /var/lib/asterisk/scripts
Forgot to install it with the original patch

Change-Id: I8bdb540a6694971ae5fe21f48d532332c6482e4c
2017-01-31 12:48:14 -06:00
George Joseph ef4deb8ecd debug_utilities: Add ast_logescalator
The escalator works by creating a set of startup commands in cli.conf
that set up logger channels and issue the debug commands for the
subsystems specified.  If asterisk is running when it is executed,
the same commands will be issued to the running instance.  The original
cli.conf is saved before any changes are made and can be restored by
executing '$prog --reset'.

The log output will be stored in...
$astlogdir/message.$uniqueid
$astlogdir/debug.$uniqueid
$astlogdir/dtmf.$uniqueid
$astlogdir/fax.$uniqueid
$astlogdir/security.$uniqueid
$astlogdir/pjsip_history.$uniqueid
$astlogdir/sip_history.$uniqueid

Some minor tweaks were made to chan_sip, and res_pjsip_history
so their history output could be send to a log channel as packets
are captured.

A minor tweak was also made to manager so events are output to verbose
when "manager set debug on" is issued.

Change-Id: I799f8e5013b86dc5282961b27383d134bf09e543
2017-01-27 15:10:02 -06:00
George Joseph d16b3a9917 debug_utilities: Create ast_loggrabber
ast_loggrabber gathers log files from customizable search patterns,
optionally converts POSIX timestamps to a readable format and
tarballs the results.

Also a few tweaks were made to ast_coredumper.

Change-Id: I8bfe1468ada24c1344ce4abab7b002a59a659495
(cherry picked from commit c709152878)
2017-01-20 11:20:22 -06:00
George Joseph 0d53c91fba debug_utilities: Create the ast_coredumper utility
This utility allows easy manipulation of asterisk coredumps.

* Configurable search paths and patterns for existing coredumps
* Can generate a consistent coredump from the running instance
* Can dump the lock_infos table from a coredump
* Dumps backtraces to separate files...
  - thread apply 1 bt full -> <coredump>.thread1.txt
  - thread apply all bt -> <coredump>.brief.txt
  - thread apply all bt full -> <coredump>.full.txt
  - lock_infos table -> <coredump>.locks.txt
* Can tarball corefiles and optionally delete them after processing
* Can tarball results files and optionally delete them after processing
* Converts ':' in coredump and results file names '-' to facilitate
  uploading.  Jira for instance, won't accept file names with colons
  in them.

Tested on Fedora24+, Ubuntu14+, Debian6+, CentOS6+ and FreeBSD9+[1].

[1] For *BSDs, the "devel/gdb" package might have to be installed to
get a recent gdb.  The utility will check all instances of gdb
it finds in $PATH and if one isn't found that can run python, it
prints a friendly error.

Change-Id: I935d37ab9db85ef923f32b05579897f0893d33cd
(cherry picked from commit cb47b45560)
2017-01-11 12:11:45 -06:00
Joshua Colp a7d856cd96 res_pjsip_endpoint_identifier_ip: Add support for SRV lookups.
This change implements SRV support for the IP based endpoint
identifier module. All possible addresses through SRV are looked
up and added as matches. If no SRV records are available a
fallback to normal host resolution is done. If an IP address
is provided then no SRV lookup occurs.

This is configured using the "srv_lookups" option on the
identify section and defaults to "yes".

ASTERISK-26693

Change-Id: I6b641e275bf96629320efa8b479737062aed82ac
2017-01-06 09:00:22 -06:00
Tzafrir Cohen bab253ac9f Fixes to various issues reported by pyflakes
Pyflake is a python (2) source checker. This patch fixes various
(mostly trivial) errors and warnings it reports.

Change-Id: Ia35c5ac61751b927814cf693994c632c412386ea
2016-12-21 11:02:20 +02:00
Richard Mudgett d27dee3cca autosupport: Add 'pjproject show buildopts'
Change-Id: I8aa55a7c3fb175235ddc7f85e9457d5102d06fa7
2016-12-15 13:27:56 -06:00
Joshua Colp aed6c219a3 pjsip: Fix a few media bugs with reinvites and asymmetric payloads.
When channel format changes occurred as a result of an RTP
re-negotiation the bridge was not informed this had happened.
As a result the bridge technology was not re-evaluated and the
channel may have been in a bridge technology that was incompatible
with its formats. The bridge is now unbridged and the technology
re-evaluated when this occurs.

The chan_pjsip module also allowed asymmetric codecs for sending
and receiving. This did not work with all devices and caused one
way audio problems. The default has been changed to NOT do this
but to match the sending codec to the receiving codec. For users
who want asymmetric codecs an option has been added, asymmetric_rtp_codec,
which will return chan_pjsip to the previous behavior.

The codecs returned by the chan_pjsip module when queried by
the bridge_native_rtp module were also not reflective of the
actual negotiated codecs. The nativeformats are now returned as
they reflect the actual negotiated codecs.

ASTERISK-26423 #close

Change-Id: I6ec88c6e3912f52c334f1a26983ccb8f267020dc
2016-10-26 12:48:57 +00:00
Joshua Colp 403c4f5833 pjsip: Support dual stack automatically.
This change adds support for dual stack automatically. No
configuration is required and the IP address and version
in the SIP messages and SDP will be automatically changed
based on the transport over which the message is being
sent. RTP usage has also been changed to listen on both
IPv4 and IPv6 simultaneously to allow media to flow, and
to allow ICE support on both simultaneously. This also
allows failover between IPv6 and IPv4 to work as expected.

ASTERISK-26309 #close

Change-Id: I235a421d8f9a326606d861b449fa6fe3a030572d
2016-10-23 13:53:55 +00:00
zuul 1ca148cae8 Merge "Add text of cdr directory into README.md for ast-db-manage" 2016-10-11 19:45:14 -05:00
George Joseph 442b597929 alembic: Allow cdr, config and voicemail to exist in the same schema
cdr, config and voicemail are all separate alembic trees.  Because
alembic's default is to use a table named 'alembic_version' to store
the current tree revision, the 3 trees can't exist in the same schema
without stepping on each other.

Now each tree uses 'alembic_version_<tree_name>' as the version table.
Each tree's env.py script now first checks for 'alembic_version'.  If
it finds it AND its revision is in the tree's history, the script
renames it to 'alembic_version_<tree_name>'.  Regardless, the script
then continues with the migration using 'alembic_version_<tree_name>'
and creates that table if it's not found.  The result is that if an
existing 'alembic_version' table was found but it didn't belong to this
tree, it's left alone and 'alembic_version_<tree_name>' is used or
created.

WARNING:  If multiple trees are using the same schema, they MUST NOT
CRU or D any objects with names that might exist in the other trees.
An example would be 'yesno_values' type.  If two trees perform
operations on it, one tree could pull it out from under the other.
Thankfully we currently don't share any names among cdr, config and
voicemail.

NOTE:  Since the env.py scripts in each tree were identical, a common
env.py has been placed in the ast-db-manage directory and a symlink
to it has been placed in each tree directory.

ASTERISK-24311 #close
Reported-by: Dafi Ni

Change-Id: I4d593f000350deb5d21a14fa1e9bc3896844d898
2016-10-07 07:49:42 -05:00
Rodrigo Ramírez Norambuena 79532bca75 Add text of cdr directory into README.md for ast-db-manage
Change-Id: I68321c4bea50730c39fdb486e5f23aeadd1ad636
2016-09-30 18:32:19 -03:00
zuul e2d3882b30 Merge "sip_to_pjsip.py: Map legacy_useroption_parsing." 2016-09-14 15:03:46 -05:00
zuul cbd6f7001e Merge "res_pjsip: Add ignore_uri_user_options option." 2016-09-14 12:27:28 -05:00
zuul 50c3bb2631 Merge "contrib: Let safe_asterisk script continue without /dev/tty9." 2016-09-12 08:42:18 -05:00
Richard Mudgett 82ec58aa91 sip_to_pjsip.py: Map legacy_useroption_parsing.
Map the sip.conf general section legacy_useroption_parsing to the
new pjsip.conf global ignore_uri_user_options.

ASTERISK-26316
Reported by: Kevin Harwell

Change-Id: I78108a31995db19d41f4e1a07b3324692c5363fc
2016-09-09 17:13:14 -05:00
Richard Mudgett ba362822f3 res_pjsip: Add ignore_uri_user_options option.
This implements the chan_sip legacy_useroption_parsing option but with a
better name.

* Made the caller-id number and redirecting number strings obtained from
incoming SIP URI user fields always truncated at the first semicolon.
People don't care about anything after the semicolon showing up on their
displays even though the RFC allows the semicolon.

ASTERISK-26316 #close
Reported by: Kevin Harwell

Change-Id: Ib42b0e940dd34d84c7b14bc2e90d1ba392624f62
2016-09-09 17:13:02 -05:00
zuul 9d54dd04bb Merge "res/res_pjsip: Add preferred_codec_only config to pjsip endpoint." 2016-09-09 13:56:16 -05:00
Walter Doekes 56caf5402c contrib: Let safe_asterisk script continue without /dev/tty9.
If you use the safe_asterisk script, it uses hardcoded defaults before
running configurable values from /etc/asterisk/startup.d. The hardcoded
default has TTY=9. Some containerized environments don't have such a
TTY, and safe_asterisk would stop.

The custom configuration from /etc/asterisk/startup.d/* isn't read until
after it stopped, so changing TTY in a custom config did not help.

This changeset changes safe_asterisk to continue if the TTY setting was
untouched and /dev/tty9 and /dev/vc/9 aren't found.

Change-Id: I2c7cdba549b77f418a0af4cb1227e8e6fe4148fc
2016-09-09 13:26:01 +02:00
Aaron An 2a50c29101 res/res_pjsip: Add preferred_codec_only config to pjsip endpoint.
This patch add config to pjsip by endpoint.
;preferred_codec_only=yes
; Respond to a SIP invite with the single most preferred codec
; rather than advertising all joint codec capabilities. This
; limits the other side's codec choice to exactly what we prefer.

ASTERISK-26317 #close
Reported by: AaronAn
Tested by: AaronAn

Change-Id: Iad04dc55055403bbf5ec050997aee2dadc4f0762
2016-09-09 05:36:19 -05:00
zuul 05240e2b57 Merge "sip_to_pjsip.py: Map canreinvite as directmedia alias." 2016-09-06 16:30:33 -05:00
zuul eae37c3524 Merge "sip_to_pjsip.py: Fix typo converting outboundproxy registration." 2016-09-06 15:26:23 -05:00
Richard Mudgett edcf09e47c sip_to_pjsip.py: Map canreinvite as directmedia alias.
Change-Id: I48b8e150f96a3d2a24d8fc25fbe4f5aff9f4a6b2
2016-09-02 13:07:08 -05:00
Richard Mudgett 47336a0bdd sip_to_pjsip.py: Fix typo converting outboundproxy registration.
Change-Id: I6f30e5f9fcf8469ba0079fbf884047d54c2c0b15
2016-09-02 13:05:16 -05:00
Richard Mudgett dba02575fc sip_to_pjsip.py: Fix comment typo and tabs.
Change-Id: If35174614545727817d329c60ba4456c028941b5
2016-09-02 13:03:09 -05:00
Alexander Traud f35501b8c9 sip_to_pjsip: Migrate IPv4/IPv6 (Dual Stack) configurations.
When using the migration script sip_to_pjsip.py, and your sip.conf is
configured with bindaddr=::, two transports are written to pjsip.conf, one for
0.0.0.0 (IPv4) and one for [::] (IPv6). That way, PJProject listens on the IPv4
and IPv6 wildcards; a IPv4/IPv6 Dual Stack configuration on a single interface
like in chan_sip.

Furthermore, the script internal functions "build_host" and "split_hostport"
did not parse Literal IPv6 addresses as expected (like [::1]:5060). This change
makes sure, even such addresses are parsed correctly.

ASTERISK-26309

Change-Id: Ia4799a0f80fc30c0550fc373efc207c3330aeb48
2016-08-26 12:49:50 +02:00
zuul c6ed91a9c8 Merge "sip_to_pjsip: Map externhost/ip to Transports." 2016-08-19 17:54:48 -05:00
zuul be26a93687 Merge "sip_to_pjsip: Add cert_file." 2016-08-19 12:39:07 -05:00
zuul d86ee51ca0 Merge "res_pjsip: Add contact_user to endpoint" 2016-08-19 10:08:11 -05:00
Alexander Traud 02a82f758e sip_to_pjsip: Add cert_file.
When using the migration script sip_to_pjsip.py, cert_file was not migrated to
pjsip.conf. A previous change regarding this contained a copy/paste error.

ASTERISK-22374

Change-Id: I0fa72e9412117d53b4284fc6b83fa5b2b95ba03b
2016-08-19 10:59:40 +02:00
Joshua Colp b544bfbbd5 Merge "sip_to_pjsip: Write cos and tos." 2016-08-18 18:55:35 -05:00
Kevin Harwell 966527249e sip_to_pjsip: Set correct tls transport method
A recent update had a copy/paste error where the unused variable 'val' was
being passed to the set_value function instead of the 'method' value itself.

This patch passes in the right variable.

ASTERISK-22374

Change-Id: I895b7b3779ce4442bc58b8ec40d59dd29bb43f06
2016-08-18 12:04:56 -05:00
Joshua Colp 2dba6d0371 Merge "sip_to_pjsip: Parse register even with transport." 2016-08-18 11:50:16 -05:00
Joshua Colp 71b3751093 Merge "sip_to_pjsip: Write local_net, contact_acl, contact_deny, and contact_permit." 2016-08-18 11:49:53 -05:00
Joshua Colp 54c5bb0287 Merge "sip_to_pjsip: Map (session-)timers correctly." 2016-08-18 11:49:15 -05:00
Joshua Colp 5899b4c593 Merge "sip_to_pjsip: Add cert_file and ca_list_path." 2016-08-18 11:48:32 -05:00
Joshua Colp 560c2abdec Merge "sip_to_pjsip: Write username even without authname." 2016-08-18 11:48:23 -05:00
Joshua Colp 14284aee45 Merge "sip_to_pjsip: Map the TLS method correctly." 2016-08-18 11:47:29 -05:00
Joshua Colp 0a09ab5b1c Merge "sip_to_pjsip: Add compactheaders, timerb, timert1, and useragent." 2016-08-18 11:46:39 -05:00
Joshua Colp 91624f439c Merge "sip_to_pjsip: Write media_encryption." 2016-08-18 11:45:56 -05:00
Alexander Traud e55d1e47aa sip_to_pjsip: Map the TLS method correctly.
When using the migration script sip_to_pjsip.py and tlsclientmethod is not set
in sip.conf, the default value of chan_sip (sslv23) is copied to pjsip.conf, to
overwrite the default of the PJProject (tlsv1). This makes sure, res_pjsip is
offering/using not just TLSv1.0 but TLSv1.2 as well.

ASTERISK-22374

Change-Id: Ie530a3dae9926ae14f3920a21be1e2edb15bda4f
2016-08-18 15:19:15 +02:00
Alexander Traud da14c439a3 sip_to_pjsip: Add compactheaders, timerb, timert1, and useragent.
When using the migration script sip_to_pjsip.py, no section of type=system or
type=general were created. Therefore the keys compactheaders, timerb, timert1,
and useragent were not migrated to pjsip.conf.

ASTERISK-22374

Change-Id: I318a453843227ea36bf130d392d4abd7bd26b5a1
2016-08-18 15:17:47 +02:00
Alexander Traud 675721a7ab sip_to_pjsip: Map (session-)timers correctly.
When using the migration script sip_to_pjsip.py, session-timers=accept and
session-timers=refuse were mapped to wrong values.

ASTERISK-22374

Change-Id: Ie4e90d5f6a29aff07837b7fe5bc8aea5fb6fc092
2016-08-18 15:16:45 +02:00
Alexander Traud acc5237e91 sip_to_pjsip: Write username even without authname.
When using the migration script sip_to_pjsip.py, now the (mandatory) username is
written to pjsip.conf, even if there was no (optional) authname in the register
string in sip.conf.

ASTERISK-22374

Change-Id: Ie53e1997104cd2674821688b8a8247249f5e156f
2016-08-18 15:15:38 +02:00
Alexander Traud 3eb02235f5 sip_to_pjsip: Parse register even with transport.
When using the migration script sip_to_pjsip.py and the register string
started with a transport in sip.conf - like tls://... - register was not parsed
correctly and therefore not migrated correctly to pjsip.conf.

ASTERISK-22374

Change-Id: I44c12104eea2bd8558ada6d25d77edfecd92edd2
2016-08-18 15:14:36 +02:00
Alexander Traud 9907e2b1c1 sip_to_pjsip: Write local_net, contact_acl, contact_deny, and contact_permit.
When using the migration script sip_to_pjsip.py, those keys got missing. These
keys might appear several times and the function "merge_value" tried to collect
those. However, because these keys have different names in sip.conf and
pjsip.conf, "merge_value" was not able to find the new key name in sip.conf.
This change lets "merge_value" search with the old key name in sip.conf and
write with the new key name in pjsip.conf.

ASTERISK-22374

Change-Id: Ie53c5278ae6f1cb8fa7e96c5289877d46981d9d2
2016-08-18 15:13:03 +02:00
Alexander Traud c0e0075718 sip_to_pjsip: Map externhost/ip to Transports.
When using the migration script sip_to_pjsip.py, the externhost or externip of
sip.conf were erroneously written to Endpoints instead to Transports.

ASTERISK-22374

Change-Id: I2c5873386cfc388899fa9cf2368639dd12f1b8e4
2016-08-18 15:11:02 +02:00
Alexander Traud a937c2ccb1 sip_to_pjsip: Add defaultexpiry, maxexpiry, and minexpiry.
When using the migration script sip_to_pjsip.py, defaultexpiry, maxexpiry, and
minexpiry were not migrated to pjsip.conf.

ASTERISK-22374

Change-Id: I007fbf543dcadc96fc3ed71c54da502bcb209b7b
2016-08-18 15:04:53 +02:00
Alexander Traud 163cc2d68f sip_to_pjsip: Write media_encryption.
When using the migration script sip_to_pjsip.py, encryption=yes got missing and
media_encryption=sdes was not written to pjsip.conf, because of a typo.

ASTERISK-22374

Change-Id: I0fc3e55dc512a57603ae0fef41baacccf2a35c05
2016-08-18 15:03:24 +02:00
Alexander Traud d8b5970749 sip_to_pjsip: Write cos and tos.
When using the migration script sip_to_pjsip.py, both tos_sip and cos_sip got
missed, because of a typo. Therefore, cos and tos were not written to
pjsip.conf. Furthermore, that revealed a misuse of an internal function, caused
by a copy-and-paste error.

ASTERISK-22374

Change-Id: Id245ebadf70ab9776eb280c026288540af3af5c2
2016-08-18 15:02:07 +02:00
Alexander Traud 38491401b5 sip_to_pjsip: Add cert_file and ca_list_path.
When using the migration script sip_to_pjsip.py, cert_file and ca_list_path were
not migrated to pjsip.conf.

ASTERISK-22374

Change-Id: I4612877d190b7f86a48698cefbf5c4db6c265825
2016-08-18 14:55:58 +02:00
George Joseph 534063fd67 res_pjsip: Add contact_user to endpoint
contact_user, when specified on an endpoint, will override the user
portion of the Contact header on outgoing requests.

Change-Id: Icd4ebfda2f2e44d3ac749d0b4066630e988407d4
2016-08-17 16:21:19 -05:00
Kevin Harwell b3c2f1164b alembic: add auth_username to endpoint's identify_by enum
A new identify_by option was added recently, auth_username. However, this
setting was not added as an allowable choice in the database enumeration
value.

This patch updates the current enumeration, adding in the new setting.

ASTERISK-26268 #close

Change-Id: Ib4788e8485e4cd40172ec0abbf5810a147ab8bf8
2016-08-11 10:50:09 -05:00
zuul 3eeeb13481 Merge "alembic/sqlalchemy: auto increment only allowed on a single column" 2016-08-10 21:00:42 -05:00
Kevin Harwell d4170df40a alembic/sqlalchemy: auto increment only allowed on a single column
The extensions table defined two columns (id and priority) as primary key
autoincrement columns. However only one is allowed when defining the primary
key.

This patch removes the autoincrement attribute from the priority column since
it does not need to be as such and really should not have been on there in the
first place.

This patch also removes 'context', 'exten', and 'priority' from the primary key
index and creates a new combined unique contraint index on them.

ASTERISK-26183 #close

Change-Id: Ib9c712c612a4d7ec1edb0dcb77f1bae0905a470b
2016-08-10 13:49:48 -05:00
Alexei Gradinari 403b63571c res_pjsip_mwi: fix unsolicited mwi blocks PJSIP stack
The PJSIP taskprocessors could be overflowed on startup
if there are many (thousands) realtime endpoints
configured with unsolicited mwi.
The PJSIP stack could be totally unresponsive for a few minutes
after boot completed.

This patch creates a separate PJSIP serializers pool for mwi
and makes unsolicited mwi use serializers from this pool.
This patch also adds 2 new global options to tune taskprocessor
alert levels: 'mwi_tps_queue_high' and 'mwi_tps_queue_low'.

This patch also adds new global option 'mwi_disable_initial_unsolicited'
to disable sending unsolicited mwi to all endpoints on startup.
If disabled then unsolicited mwi will start processing
on next endpoint's contact update.

ASTERISK-26230 #close

Change-Id: I4c8ecb82c249eb887930980a800c9f87f28f861a
2016-08-08 13:57:58 -05:00
Joshua Colp 90b30b21ac astconfigparser: Really handle case where line is simply a comment.
The regular expression would match causing the code that handled
the line if it was merely a comment to never get executed.

Change-Id: I3e4022481037ebcba9905587fe8c764b4ce21819
2016-08-03 09:49:45 -05:00
Joshua Colp a7ae48441f astconfigparser: Handle case where line is simply a comment.
Change-Id: I2dea5815363f4d787d709228a04f33baee383ef5
2016-07-29 04:49:06 -05:00
Joshua Colp 1e7168aee0 astconfigparser.py: Update with realtime fixes.
When configuring SIP URIs in the pjsip.conf file it is
necessary to escape the semicolon so the parser does not
treat it as a comment. This change allows this to work in
the astconfigparser implementation.

A secondary bug where some data was lost if a configuration
option included a "=" in its value was also fixed.

A bug where sections would be considered equal despite
being different has also been fixed.

Change-Id: If229f656ef22050b50e7b34e90c4bffe796431f8
2016-07-26 17:31:06 -05:00
Mark Michelson 76781a0964 Fix sqlalchemy error regarding identifier length.
sqlalchemy was complaining:

sqlalchemy.exc.IdentifierError: Identifier
'ps_contacts_qualifyfreq_exptime' exceeds maximum length of 30
characters

This fixes the problem by changing the index name to be
"ps_contacts_qualifyfreq_exp" instead.

ASTERISK-26227 #close
Reported by Mark Michelson

Change-Id: I0ed784f87504be2a59ee8d3242ef6f625d5ed1a9
2016-07-22 14:47:00 -05:00
Richard Mudgett e739888d99 res_pjsip: Add fax_detect_timeout endpoint option.
The new endpoint option allows the PJSIP channel driver's fax_detect
endpoint option to timeout on a call after the specified number of
seconds into a call.  The new feature is disabled if the timeout is set
to zero.  The option is disabled by default.

ASTERISK-26214
Reported by: Richard Mudgett

Change-Id: Id5a87375fb2c4f9dc1d4b44c78ec8735ba65453d
2016-07-19 10:33:45 -05:00
Joshua Colp c2a72e6aa6 Merge "install_prereq: Checkout of libSRTP 1.5.x." 2016-07-12 19:30:38 -05:00
Alexander Traud 8476a9332f install_prereq: Checkout of libSRTP 1.5.x.
Since 5th November 2014, the master branch of libSRTP changed the prefix of
several member names and is not compatible with the source code in Asterisk
anymore. Therefore instead, this change checks out the latest version of the
libSRTP 1.5.x branch. Furthermore now, libSRTP is compiled with OpenSSL as
backend. This makes AES-GCM and AES-IN possible.

ASTERISK-22131 #close

Change-Id: I2e396cdc01da0ff610686e398ed210ca7408f7d6
2016-07-11 17:18:56 +02:00
Alexei Gradinari 1c949eea6c res_pjsip: Added "subscribe_context" to endpoint
If specified, incoming SUBSCRIBE requests will be searched for the matching
extension in the indicated context. If no "subscribe_context" is specified,
then the "context" setting is used.

ASTERISK-25471 #close

Change-Id: I3fb7a15f5bc154079bd348c08b7ad1cdd2d5e514
2016-07-06 10:30:27 -04:00
Joshua Colp 040a11cecd Merge "res_pjsip: improve realtime performance #2" 2016-06-30 15:53:24 -05:00
Alexei Gradinari 6fa3ed0679 res_pjsip: improve realtime performance #2
The patch removes updating all Endpoints' status on startup.
Instead, only non-qualified aors with static contact
and non-qualified non-expired contacts are retrieved from the realtime to
update the endpoint status to ONLINE.
The endpoint name was added to the contact object to simply find the endpoint
that created this contact.

The status of endpoints with qualified aors will be updated by 'qualify'
functions.

ASTERISK-26061 #close

Change-Id: Id324c1776fa55d3741e0c5457ecac0304cb1a0df
2016-06-22 15:29:50 -04:00
Mark Michelson b6bd97eea2 Fix Alembic upgrades.
A non-existent constraint was being referenced in the upgrade script.
This patch corrects the problem by removing the reference.

In addition, the head of the alembic branch referred to a non-existent
revision. This has been fixed by referring to the proper revision.

This patch fixes another realtime problem as well. Our Alembic scripts
store booleans as yes or no values. However, Sorcery tries to insert
"true" or "false" instead. This patch introduces a new boolean type that
translates to "yes" or "no" instead.

ASTERISK-26128 #close

Change-Id: I51574736a881189de695a824883a18d66a52dcef
2016-06-22 12:23:44 -05:00
Joshua Colp 4505a59dc9 alembic: Fix migration.
The 81b01a191a46_pjsip_add_contact_reg_server.py script was attempting
to use UniqueConstraint and failing. It was not imported and after
importing it also continued to fail.

I've changed the script to use the explicit name of the constraint
instead.

Change-Id: I2438b0be90b7ce583b47dd27983c0c1a02cea5b9
2016-06-02 05:00:51 -05:00
Alexei Gradinari 31f17abe44 res_pjsip: add "via_addr", "via_port", "call_id" to contact
As res_pjsip_nat rewrites contact's address, only the last Via header
can contain the source address of registered endpoint.
Also Call-Id header may contain the source address of registered
endpoint.

Added "via_addr", "via_port", "call_id" to contact.
Added new fields ViaAddress, CallID to AMI event ContactStatus.

ASTERISK-26011

Change-Id: I36bcc0bf422b3e0623680152d80486aeafe4c576
2016-05-26 16:18:11 -05:00
Alexei Gradinari 69a85a519f res_pjsip: Endpoint IP Access Controls
With the old SIP module we can use IP access controls per peer.
PJSIP module missing this feature.

This patch added next configuration Endpoint options:
    "acl" - list of IP ACL section names in acl.conf
    "deny" - List of IP addresses to deny access from
    "permit" - List of IP addresses to permit access from
    "contact_acl" - List of Contact ACL section names in acl.conf
    "contact_deny" - List of Contact header addresses to deny
    "contact_permit" - List of Contact header addresses to permit

This patch also better logging failed request:
    add custom message instead of "No matching endpoint found"
    add SIP method to logging

ASTERISK-25900

Change-Id: I456dea3909d929d413864fb347d28578415ebf02
2016-05-13 12:46:52 -04:00
Joshua Colp 87787bb889 Merge "res_pjsip: improve realtime performance" 2016-05-11 10:58:54 -05:00
Alexei Gradinari cc4c5f5693 res_pjsip: improve realtime performance
This patch modified pjsip_options to retrieve only
permament contacts for aor if the qualify_frequency is > 0
and persisted contacts if the qualify_frequency is > 0.

This patch also fixed a bug in res_sorcery_astdb.
res_sorcery_astdb doesn't save object data retrived from astdb.

ASTERISK-25826

Change-Id: I1831fa46c4578eae5a3e574ee3362fddf08a1f05
2016-05-05 10:45:49 -05:00
Alexei Gradinari 4df48581f1 pjsip: Added "reg_server" to contacts (fixed alembic)
ASTERISK-25931

Change-Id: Icc4321a88f5c93ff809da3f372eebbf69c6a8549
2016-05-05 10:21:53 -05:00
zuul d9ed4e3153 Merge "pjproject_bundled: Various fixes discovered during testing of OSes" 2016-05-03 19:11:18 -05:00
George Joseph e61716b774 pjproject_bundled: Various fixes discovered during testing of OSes
For all OSes:
* Disabled third-party codecs in pjproject and added
  '--disable-speex-codec --disable-speex-aec --disable-gsm-codec' to the
  configure options since we don't use the pjsip codec capability.

FreeBSD:
* Added FreeBSD support to install_prereq.
* Changed pjproject/configure.m4 to use $GNU_MAKE instead of hardcoding "make".
* Added __progname and environ to asterisk.exports.in.
* Reverted the use of ldconfig to create shared library symlinks to ln.
* Only enable epoll in pjproject if `uname -s` is Linux.
* Added a patch to pjproject to take the name of the 'make' command from
  an environment variable if supplied.  This is needed for the python bindings.
  (merged by Teluu into pjproject trunk 5/3/2016)
FreeBSD support isn't complete.  Still some general issues regarding
make/gmake having nothing to do with pjproject.  With some handholding it DOES
build successfully.

CentOS:
Added 'patch' and 'bzip2' to install_prereq PACKAGES_RH.
CentOS 6/7 32/64 build and run the pjsip testsuite successfully.

Ubuntu:
No changes required.
Ubuntu 15/16 32/64 build and run the pjsip testsuite successfully.

Debian:
No changes required.
Debian 6/7/8 32/64 build and run the pjsip testsuite successfully.

There will utimately be a follow-up patch to create an install_prereq for
the testsuite as I've discovered a few missing requirements.

ASTERISK-25968 #close

Change-Id: I5756a07facfc63798115a5e73a8709382fe9259c
2016-05-03 07:56:18 -05:00
Alexei Gradinari 2b1edee772 pjsip: Added "reg_server" to contacts.
If the Asterisk system name is set in asterisk.conf, it will be stored
into the "reg_server" field in the ps_contacts table to facilitate
multi-server setups.

ASTERISK-25931

Change-Id: Ia8f6bd2267809c78753b52bcf21835b9b59f4cb8
2016-05-02 10:01:40 -03:00
George Joseph 4ebf9a938d res_pjsip: Add ability to identify by Authorization username
A feature of chan_sip that service providers relied upon was the ability to
identify by the Authorization username.  This is most often used when customers
have a PBX that needs to register rather than identify by IP address.  From my
own experiance, this is pretty common with small businesses who otherwise
don't need a static IP.

In this scenario, a register from the customer's PBX may succeed because From
will usually contain the PBXs account id but an INVITE will contain the caller
id.  With nothing recognizable in From, the service provider's Asterisk can
never match to an endpoint and the INVITE just stays unauthorized.

The fixes:

A new value "auth_username" has been added to endpoint/identify_by that
will use the username and digest fields in the Authorization header
instead of username and domain in the the From header to match an endpoint,
or the To header to match an aor.  This code as added to
res_pjsip_endpoint_identifier_user rather than creating a new module.

Although identify_by was always a comma-separated list, there was only
1 choice so order wasn't preserved.  So to keep the order, a vector was added
to the end of ast_sip_endpoint.  This is only used by res_pjsip_registrar
to find the aor.  The res_pjsip_endpoint_identifier_* modules are called in
globals/endpoint_identifier_order.

Along the way, the logic in res_pjsip_registrar was corrected to match
most-specific to least-specific as res_pjsip_endpoint_identifier_user does.

The order is:

username@domain
username@domain_alias
username

Auth by username does present 1 problem however, the first INVITE won't have
an Authorization header so the distributor, not finding a match on anything,
sends a securty_alert.  It still sends a 401 with a challenge so the next
INVITE will have the Authorization header and presumably succeed.  As a result
though, that first security alert is actually a false alarm.

To address this, a new feature has been added to pjsip_distributor that keeps
track of unidentified requests and only sends the security alert if a
configurable number of unidentified requests come from the same IP in a
configurable amout of time.  Those configuration options have been added to
the global config object.  This feature is only used when auth_username
is enabled.

Finally, default_realm was added to the globals object to replace the hard
coded "asterisk" used when an endpoint is not yet identified.

The testsuite tests all pass but new tests are forthcoming for this new
feature.

ASTERISK-25835 #close
Reported-by: Ross Beer

Change-Id: I30ba62d208e6f63439600916fcd1c08a365ed69d
2016-04-27 16:33:51 -05:00
Alexei Gradinari 860b135c88 res_pjsip: disable multi domain to improve realtime performace
This patch added new global pjsip option 'disable_multi_domain'.
Disabling Multi Domain can improve Realtime performance by reducing
number of database requests.

ASTERISK-25930 #close

Change-Id: I2e7160f3aae68475d52742107949a799aa2c7dc7
2016-04-27 10:58:43 -05:00
George Joseph 751d7a5a49 alembic: Remove batch operations (and sqlite support)
Because SQLite doesn't support full ALTER capabilities, alembic scripts
require batch operations.  However, that capability wasn't available until
0.7.0 which some distributions haven't reached yet.  Therefore, the batch
operations introduced in commit 86d6e44cc (review 2319) have been reverted
and SQLite is unsupported again, for now anyway.

Tested the full upgrade and downgrade on MySQL/Mariadb and Postgresql.

ASTERISK-25890 #close
Reported-by: Harley Peters

Change-Id: I82eba5456736320256f6775f5b0b40133f4d1c80
2016-04-07 13:35:35 -05:00
Joshua Colp 86ccd1bd2b Merge "install_prereq: Fix check_installed_debs remove subversion" 2016-04-04 17:39:45 -05:00
George Joseph 060b7b83bc install_prereq: Fix check_installed_debs remove subversion
check_installed_debs wasn't handling virtual packages like libsrtp-dev and
libresample-dev and on multiarch systems it was accidentally filtering out all
packages if any :i386 packages were found instead of just filtering out the
:i386 packages themselves.

Change-Id: Ifd68da0d1ee30cc84df14de3f9b9079d7c3cecda
2016-04-04 13:47:21 -05:00
George Joseph e2524fcee3 res_pjsip_mwi: Add voicemail extension and mwi_subscribe_replaces_unsolicited
res_pjsip_mwi was missing the chan_sip "vmexten" functionality which adds
the Message-Account header to the MWI NOTIFY.  Also, specifying mailboxes
on endpoints for unsolicited mwi and on aors for subscriptions required
that the admin know in advance which the client wanted.  If you specified
mailboxes on the endpoint, subscriptions were rejected even if you also
specified mailboxes on the aor.

Voicemail extension:
* Added a global default_voicemail_extension which defaults to "".
* Added voicemail_extension to both endpoint and aor.
* Added ast_sip_subscription_get_dialog for support.
* Added ast_sip_subscription_get_sip_uri for support.

When an unsolicited NOTIFY is constructed, the From header is parsed, the
voicemail extension from the endpoint is substituted for the user, and the
result placed in the Message-Account field in the body.

When a subscribed NOTIFY is constructed, the subscription dialog local uri
is parsed, the voicemail_extension from the aor (looked up from the
subscription resource name) is substituted for the user, and the result
placed in the Message-Account field in the body.

If no voicemail extension was defined, the Message-Account field is not added
to the NOTIFY body.

mwi_subscribe_replaces_unsolicited:
* Added mwi_subscribe_replaces_unsolicited to endpoint.

The previous behavior was to reject a subscribe if a previous internal
subscription for unsolicited MWI was found for the mailbox.  That remains the
default.  However, if there are mailboxes also set on the aor and the client
subscribes and mwi_subscribe_replaces_unsolicited is set, the existing internal
subscription is removed and replaced with the external subscription.  This
allows an admin to configure mailboxes on both the endpoint and aor and allows
the client to select which to use.

ASTERISK-25865 #close
Reported-by: Ross Beer

Change-Id: Ic15a9415091760539c7134a5ba3dc4a6a1217cea
2016-03-30 13:23:54 -05:00
George Joseph c948ce9651 sorcery/res_pjsip: Refactor for realtime performance
There were a number of places in the res_pjsip stack that were getting
all endpoints or all aors, and then filtering them locally.

A good example is pjsip_options which, on startup, retrieves all
endpoints, then the aors for those endpoints, then tests the aors to see
if the qualify_frequency is > 0.  One issue was that it never did
anything with the endpoints other than retrieve the aors so we probably
could have skipped a step and just retrieved all aors. But nevermind.

This worked reasonably well with local config files but with a realtime
backend and thousands of objects, this was a nightmare.  The issue
really boiled down to the fact that while realtime supports predicates
that are passed to the database engine, the non-realtime sorcery
backends didn't.

They do now.

The realtime engines have a scheme for doing simple comparisons. They
take in an ast_variable (or list) for matching, and the name of each
variable can contain an operator.  For instance, a name of
"qualify_frequency >" and a value of "0" would create a SQL predicate
that looks like "where qualify_frequency > '0'".  If there's no operator
after the name, the engines add an '=' so a simple name of
"qualify_frequency" and a value of "10" would return exact matches.

The non-realtime backends decide whether to include an object in a
result set by calling ast_sorcery_changeset_create on every object in
the internal container.  However, ast_sorcery_changeset_create only does
exact string matches though so a name of "qualify_frequency >" and a
value of "0" returns nothing because the literal "qualify_frequency >"
doesn't match any name in the objset set.

So, the real task was to create a generic string matcher that can take a
left value, operator and a right value and perform the match. To that
end, strings.c has a new ast_strings_match(left, operator, right)
function.  Left and right are the strings to operate on and the operator
can be a string containing any of the following: = (or NULL or ""), !=,
>, >=, <, <=, like or regex.  If the operator is like or regex, the
right string should be a %-pattern or a regex expression.  If both left
and right can be converted to float, then a numeric comparison is
performed, otherwise a string comparison is performed.

To use this new function on ast_variables, 2 new functions were added to
config.c.  One that compares 2 ast_variables, and one that compares 2
ast_variable lists.  The former is useful when you want to compare 2
ast_variables that happen to be in a list but don't want to traverse the
list.  The latter will traverse the right list and return true if all
the variables in it match the left list.

Now, the backends' fields_cmp functions call ast_variable_lists_match
instead of ast_sorcery_changeset_create and they can now process the
same syntax as the realtime engines.  The realtime backend just passes
the variable list unaltered to the engine.  The only gotcha is that
there's no common realtime engine support for regex so that's been noted
in the api docs for ast_sorcery_retrieve_by_fields.

Only one more change to sorcery was done...  A new config flag
"allow_unqualified_fetch" was added to reg_sorcery_realtime.
"no": ignore fetches if no predicate fields were supplied.
"error": same as no but emit an error. (good for testing)
"yes": allow (the default);
"warn": allow but emit a warning. (good for testing)

Now on to res_pjsip...

pjsip_options was modified to retrieve aors with qualify_frequency > 0
rather than all endpoints then all aors.  Not only was this a big
improvement in realtime retrieval but even for config files there's an
improvement because we're not going through endpoints anymore.

res_pjsip_mwi was modified to retieve only endpoints with something in
the mailboxes field instead of all endpoints then testing mailboxes.

res_pjsip_registrar_expire was completely refactored.  It was retrieving
all contacts then setting up scheduler entries to check for expiration.
Now, it's a single thread (like keepalive) that periodically retrieves
only contacts whose expiration time is < now and deletes them.  A new
contact_expiration_check_interval was added to global with a default of
30 seconds.

Ross Beer reports that with this patch, his Asterisk startup time dropped
from around an hour to under 30 seconds.

There are still objects that can't be filtered at the database like
identifies, transports, and registrations.  These are not going to be
anywhere near as numerous as endpoints, aors, auths, contacts however.

Back to allow_unqualified_fetch.  If this is set to yes and you have a
very large number of objects in the database, the pjsip CLI commands
will attempt to retrive ALL of them if not qualified with a LIKE.
Worse, if you type "pjsip show endpoint <tab>" guess what's going to
happen? :)  Having a cache helps but all the objects will have to be
retrieved at least once to fill the cache.  Setting
allow_unqualified_fetch=no prevents the mass retrieve and should be used
on endpoints, auths, aors, and contacts.  It should NOT be used for
identifies, registrations and transports since these MUST be
retrieved in bulk.

Example sorcery.conf:

[res_pjsip]
endpoint=config,pjsip.conf,criteria=type=endpoint
endpoint=realtime,ps_endpoints,allow_unqualified_fetch=error

ASTERISK-25826 #close
Reported-by: Ross Beer
Tested-by: Ross Beer

Change-Id: Id2691e447db90892890036e663aaf907b2dc1c67
2016-03-27 22:43:27 -05:00
Leif Madsen 0da36fca6b Add initial support to build Docker images
This work-in-progress is the first step to being able to reliably
build Asterisk containers from the Asterisk source. I'm submitting
this based on feedback gained at AstriDevCon 2015.

Information about how to use this is provided in contrib/docker/README.md
and will result in a local Asterisk container being built right from
your source. I believe this can eventually be automated via
hub.docker.com.

Change-Id: Ifa070706d40e56755797097b6ed72c1e243bd0d1
2016-03-17 09:53:57 -05:00
George Joseph 471ff375fd install_prereq: Add packages for bundled pjproject
RedHat/CentOS needs python-devel
Debian/Ubuntu needs automake, libsrtp-dev and python-dev

Ubuntu also needed libncurses5-dev for cmenuselect so while not
needed for pjproject, I adedd it anyway.

Change-Id: Idf5fa16e2d87c687439621507e122cb9461d7089
2016-03-05 17:46:15 -06:00
George Joseph b8b7c2e428 alembic: Fix downgrade and tweak for sqlite
Downgrade had a few issues.  First there was an errant 'update' statement in
add_auto_dtmf_mode that looks like it was a copy/paste error.  Second, we
weren't cleaning up the ENUMs so subsequent upgrades on postgres failed
because the types already existed.

For sqlite...  sqlite doesn't support ALTER or DROP COLUMN directly.
Fortunately alembic batch_operations takes care of this for us if we
use it so the alter and drops were converted to use batch operations.

Here's an example downgrade:

    with op.batch_alter_table('ps_endpoints') as batch_op:
        batch_op.drop_column('tos_audio')
        batch_op.drop_column('tos_video')
        batch_op.add_column(sa.Column('tos_audio', yesno_values))
        batch_op.add_column(sa.Column('tos_video', yesno_values))
        batch_op.drop_column('cos_audio')
        batch_op.drop_column('cos_video')
        batch_op.add_column(sa.Column('cos_audio', yesno_values))
        batch_op.add_column(sa.Column('cos_video', yesno_values))

    with op.batch_alter_table('ps_transports') as batch_op:
        batch_op.drop_column('tos')
        batch_op.add_column(sa.Column('tos', yesno_values))
    # Can't cast integers to YESNO_VALUES, so dropping and adding is required
        batch_op.drop_column('cos')
        batch_op.add_column(sa.Column('cos', yesno_values))

Upgrades from base to head and downgrades from head to base were tested
repeatedly for postgresql, mysql/mariadb, and sqlite3.

Change-Id: I862b0739eb3fd45ec3412dcc13c2340e1b7baef8
2016-03-02 15:42:01 -07:00
George Joseph ba8adb4ce3 res_pjsip/config_transport: Allow reloading transports.
The 'reload' mechanism actually involves closing the underlying
socket and calling the appropriate udp, tcp or tls start functions
again.  Only outbound_registration, pubsub and session needed work
to reset the transport before sending requests to insure that the
pjsip transport didn't get pulled out from under them.

In my testing, no calls were dropped when a transport was changed
for any of the 3 transport types even if ip addresses or ports were
changed. To be on the safe side however, a new transport option was
added (allow_reload) which defaults to 'no'.  Unless it's explicitly
set to 'yes' for a transport, changes to that transport will be ignored
on a reload of res_pjsip.  This should preserve the current behavior.

Change-Id: I5e759850e25958117d4c02f62ceb7244d7ec9edf
2016-02-19 18:57:55 -06:00
George Joseph 9b13ab6a63 pjsip/alembic: Add missing columns to system and registration
ps_systems needed disable_tcp_switch
ps_registrations needed line and endpoint

ASTERISK-25737 #close

Change-Id: Iaf9c2d69e62243d9fa53104c28c5339c47d4ac19
2016-02-04 14:23:45 -06:00
George Joseph 52b29f9b4c pjsip/alembic: Fix definition of qualify_timeout
A recent commit set qualify_timeout to Decimal which isn't supported.
This path corrects it to Float.

Change-Id: I038f5274ba8cb60f8518a5845ce448d49306aadf
2016-01-31 20:20:47 -06:00
Richard Mudgett a4dcbdf50f Fix alembic branches on master.
Change-Id: I64ed21fec50eb833641ca49d92184f6aaabd86e8
2016-01-19 14:16:17 -06:00
Joshua Colp 2cdbd4d711 Merge "pjsip/alembic: Fix qualify_timeout column definition" 2016-01-18 05:49:45 -06:00
Daniel Journo c60d6c0162 pjsip/alembic: Fix qualify_timeout column definition
Corrects the qualify_timeout column type from Integer to Decimal

ASTERISK-25686 #close
Reported-by: Marcelo Terres

Change-Id: I757d0e3c011ee9be6cd5abd48bc92441a405d3c8
2016-01-16 19:58:17 +00:00
Daniel Journo 8182146e85 pjsip: Add option global/regcontext
Added new global option (regcontext) to pjsip. When set, Asterisk will
dynamically create and destroy a NoOp priority 1 extension
for a given endpoint who registers or unregisters with us.

ASTERISK-25670 #close
Reported-by: Daniel Journo

Change-Id: Ib1530c5b45340625805c057f8ff1fb240a43ea62
2016-01-13 11:42:20 -06:00
Richard Mudgett 1fffe71f77 res_pjsip_log_forwarder.c: Add CLI "pjsip show buildopts".
PJPROJECT has a function available to dump the compile time
options used when building the library.

* Add CLI "pjsip show buildopts" command.

* Update contrib/scripts/autosupport to get pjproject information.

Change-Id: Id93a6a916d765b2a2e5a1aeb54caaf83206be748
2016-01-12 20:27:47 -06:00
George Joseph a41aab477a pjsip_sdp_rtp: Add option endpoint/bind_rtp_to_media_address
On a system with multiple ip addresses in the same subnet, if a
transport is bound to a specific ip address and endpoint/media_address
 is set, the SIP/SDP will have the correct address in all fields but
the rtp stream MAY still originate from one of the other ip addresses,
most probably the "primary" ip address.  This happens because
 res_pjsip_sdp_rtp/create_rtp always calls ast_instance_new with
the "all" ip address (0.0.0.0 or ::).

The new option causes res_pjsip_sdp_rtp/create_rtp to call
ast_rtp_instance_new with the endpoint's media_address (if specified)
instead of the "all" address.  This causes the packets to originate from
the specified address.

ASTERISK-25632
ASTERISK-25637
Reported-by: Olivier Krief
Reported-by: Dan Journo

Change-Id: I3dfaa079e54ba7fb7c4fd1f5f7bd9509bbf8bd88
2016-01-11 18:41:31 -06:00
Joshua Colp e106292a92 Merge "Alembic: Increase column size of PJSIP AOR "contact"." 2016-01-11 16:59:11 -06:00
Joshua Colp 8bd9e2dcc0 Merge "Alembic: Add PJSIP global keep_alive_interval." 2016-01-11 16:59:05 -06:00
Mark Michelson c5e16fe33a Alembic: Add PJSIP global keep_alive_interval.
The keep_alive_interval option was added about a year ago, but no
alembic revision was created to add the appropriate column to the
database.

This commit fixes the problem and adds the column. This was discovered
by running the testsuite with automatic conversion to realtime enabled.

Change-Id: If3ef92a7c4f4844d08f8aae170d2178aec5c4c1a
2016-01-08 14:29:17 -06:00
Walter Doekes 64b2046f3d Add sipp-sendfax.xml and spandspflow2pcap.py to contrib/scripts.
The spandspflow2pcap.py creates pcap files from fax.log files, generated
through 'fax set debug on' when receiving a fax. An example fax.log is
included as spandspflow2pcap.log.

The sipp-sendfax.xml SIPp scenario can be used to replay that fax with a
recent version of SIPp.

ASTERISK-25660 #close

Change-Id: I4de8f28b084055b482ab8a5b28d28b605b0ed526
2016-01-06 14:12:40 +01:00
Mark Michelson cfb34adb83 Alembic: Increase column size of PJSIP AOR "contact".
When running the PJSIP AMI "show_endpoint" test with automatic
conversion to realtime, the test would fail. This was because the AOR
"contact" column was sized at 40, and the configured contact was larger
than that.

This commit increases the size of the contact column to 255 characters.

Change-Id: Ia65bc7fd37699b7c0eaef9629a1a31eab9a24ba1
2015-12-16 11:34:22 -06:00
Corey Farrell cd5ae02812 Increase account code maximum length to 80.
This increases the maximum length of account code's to match
extensions.  This ensures it is always possible to set an
accountcode to ${EXTEN} without truncation.

ASTERISK-23904
Reported by: Ben Merrills

Change-Id: If122602304ce03362722eb213a3111b32da5eeb9
2015-11-05 10:20:34 -05:00
Joshua Colp 17be8b9c20 Merge "install_prereq: Update repositories before install on Debian systems" 2015-10-26 13:51:28 -05:00
Rodrigo Ramírez Norambuena 88f3dbaec9 install_prereq: Update repositories before install on Debian systems
When to install packages the indexed local is more old of the
version of software on the repository they have been upgraded by security
update then get the package will give 404 not found.

The patch prevent by update local index to repository for aptitude before
install.

ASTERISK-25495 #close

Reporte by: Rodrigo Ramírez Norambuena

Change-Id: I645959e553aac542805ced394cac2dca964051fa
2015-10-26 05:09:40 -03:00
Kevin Harwell 691c0e0b31 res_pjsip_outbound_registration: registration stops due to fatal 4xx response
During outbound registration it is possible to receive a fatal (any permanent/
non-temporary 4xx, 5xx, 6xx) response from the registrar that is simply due
to a problem with the registrar itself. Upon receiving the failure response
Asterisk terminates outbound registration for the given endpoint.

This patch adds an option, 'fatal_retry_interval', that when set continues
outbound registration at the given interval up to 'max_retries' upon receiving
a fatal response.

ASTERISK-25485 #close

Change-Id: Ibc2c7b47164ac89cc803433c0bbe7063bfa143a2
2015-10-23 09:42:46 -05:00
Matt Jordan b9bd249a85 contrib/scripts/autosupport: Update for Asterisk 13
This patch adds some minor tweaks for autosupport to update it for Asterisk 13.
This includes:
* Finally removing most references to Zaptel
* Adding support for some additional 'core' commands, and fixing nomenclature
  that generally hasn't been used for some time
* Adding some PJSIP/SIP commands to gather endpoints/peers and active channels

Change-Id: Ic997b418cbd9313588b6608e50f47b0ce6f4f1f1
(cherry picked from commit 9fc9777fa3)
2015-10-20 12:12:26 -05:00
Joshua Colp 96c26f497a Merge "Scripts: check file versions of Asterisk and dependencies" 2015-09-28 06:50:12 -05:00
Scott Griepentrog d6472d96b3 Scripts: check file versions of Asterisk and dependencies
To help in diagnosing mismatched modules and libraries, this
script scans for version, repository, and source information
and reports what is found.

ASTERISK-25376 #close
Reported by: Ashley Sanders

Change-Id: Ib0642d0fb96712476f59760d6d137a24633fe2d6
2015-09-25 15:07:44 -05:00
Mark Michelson 993ae9a669 res_pjsip: Change default from user value.
When Asterisk sends an outbound SIP request, if there is no direct
reason to place a specific value for the username in the From header,
Asterisk would generate a UUID. For example, this would happen when
sending outbound OPTIONS requests when qualifying or when sending
outbound INVITE requests when originating (if no explicit caller ID were
provided). The issue is that some SIP providers reject these sorts of
requests with a "Name too long" error response.

This patch aims to fix this by changing the default outbound username in
From headers to "asterisk". This value can be overridden by changing the
default_from_user option in the global options if desired.

ASTERISK-25377 #close
Reported by Mark Michelson

Change-Id: I6a4d34a56ff73ff4f661b0075aeba5461b7f3190
2015-09-04 14:48:20 -05:00
Scott Griepentrog 53e2a6a829 contrib: script install_prereq should install sqlite3
Asterisk needs the sqlite 3 library, which is package
sqlite-devel in CentOS. By adding this package to the
script, a problem with configure failing is resolved.

ASTERISK-25331 #close
Reported by: Kevin Harwell

Change-Id: I90efaf6a01914fea03f21e5cdbd91c348f44b0ec
2015-08-19 10:30:12 -05:00
Joshua Colp 309dd2a409 pjsip: Add rtp_timeout and rtp_timeout_hold endpoint options.
This change adds support for the 'rtp_timeout' and 'rtp_timeout_hold'
endpoint options. These allow the channel to be hung up if RTP
is not received from the remote endpoint for a specified number of
seconds.

ASTERISK-25259 #close

Change-Id: I3f39daaa7da2596b5022737b77799d16204175b9
2015-07-24 12:43:43 -03:00
Mark Michelson 2b42264e66 res_pjsip: Add rtp_keepalive endpoint option.
This adds an "rtp_keepalive" option for PJSIP endpoints. Similar to the
chan_sip option, this specifies an interval, in seconds, at which we
will send RTP comfort noise frames. This can be useful for keeping RTP
sessions alive as well as keeping NAT associations alive during lulls.

ASTERISK-25242 #close
Reported by Mark Michelson

Change-Id: I3b9903d99e35fe5d0b53ecc46df82c750776bc8d
2015-07-20 12:37:01 -05:00
Kevin Harwell 93ac45d3bd res_pjsip: Add option to force G.726 to be treated as AAL2 packed.
Some phones send g.726 audio packed for AAL2, which differs from what is
recommended by RFC 3351. If Asterisk receives audio formatted as such when
negotiating g.726 then it sounds a bit distorted. Added an option to
res_pjsip_endpoint that allows g.726 negotiated audio to be treated as g.726
AAL2 packed.

ASTERISK-25158 #close
Reported by: Steve Pitts

Change-Id: Ie7e21f75493d7fe53e75e12c971e72f5afa33615
2015-06-15 12:40:03 -05:00
Rodrigo Ramírez Norambuena 6737ded058 install_prereq: Check if is installed aptitude otherwise to install.
If in Debian or system based, dont have aptitude installed the script do
nothing. This patch checked if aptitude  installed, if not installed.

Also, if execute script with all packages installed yet, the script not show
nothing and return exit 1 because the command 'grep' get nothing from pipe from
'awk'.

ASTERISK-25113 #close
Reported By: Rodrigo Ramírez Norambuena <decipher.hk@gmail.com>

Change-Id: Iebdff55805d3917166e5e08e0a1e2176f36ff27f
2015-06-03 21:12:50 -04:00
Corey Farrell 478fb4a388 MALLOC_DEBUG: Replace WRAP_LIBC_MALLOC with ASTMM_LIBC.
There are 3 ways that calls directly to standard allocator functions can
be dealt with:
1. Block their use, cause them to generate an error.  This is the default.
2. Replace them with the Asterisk equivalent function calls.
3. Leave them alone.

This change allows one of these 3 options to be selected by any source.
The source just needs to define ASTMM_LIBC to ASTMM_BLOCK, ASTMM_REDIRECT,
or ASTMM_IGNORE to use option 1, 2 or 3 respectively.  Normally ASTMM_BLOCK
is the correct option, so it is default when ASTMM_LIBC is not defined.
In some cases when building 3rd party code it is desirable to have it use
Asterisk functions, without changing the whole source - ASTMM_REDIRECT
accomplishes this.  When using 3rd party libraries sometimes a static
inline function will make use of malloc or free.  In these cases it may
be unsafe to replace the allocator in the header, as it's possible the
memory could be freed by the library using standard allocators.  For
those cases ASTMM_IGNORE is needed.

Change-Id: I8afef4bc7f3b93914263ae27d3a5858b69663fc7
2015-05-13 21:55:07 -04:00
George Joseph cf637f2510 doc: Make progdocs play nice with git
Moved contrib/asterisk-ng-doxygen to doc/asterisk-ng-doxygen.in

Changed /Makefile to copy asterisk-ng-doxygen.in to
asterisk-ng-doxygen then modify it with version instead of
modifying asterisk-ng-doxygen directly.  Updated clean
targets as well.

Updated /.gitignore and doc/.gitignore.

Change-Id: I38712d3e334fa4baec19d30d05de8c6f28137622
2015-05-07 22:26:31 -06:00
Ivan Poddubny b885f719bf contrib/editors: Fix vim syntax highlighting of comments in config files
* Added a lookbehind to one-line comment matcher to skip escaped
   semicolons.
 * Added support for block comments.

Change-Id: Id17dfaeda8ed4be572e8107a0c010066584aaee7
2015-05-07 19:37:42 +00:00
Matt Jordan 75c0aa6979 contrib/ast-db-manage: Add Postgres ENUM type support in auto DTMF mode update
The upgrade script for auto DTMF mode (31cd4f4891ec) added in 88b0fa7755
failed to add ENUM support for Postgres databases. This requires a
specific import from the sqlalchemy.dialects.postgresql package. This
patch corrects this error, which allows for Postgres update scripts to
be generated.

ASTERISK-24706

Change-Id: I4742ac8efa533cd6f18e0bdd907b339a9aedf015
2015-05-03 20:32:53 -05:00
Joshua Colp 7c18edaa10 Merge "Example script for scan-build (the llvm static analyzer)" 2015-04-28 07:15:47 -05:00
Corey Farrell 5c1d07baf0 Astobj2: Allow reference debugging to be enabled/disabled by config.
* The REF_DEBUG compiler flag no longer has any effect on code that uses
  Astobj2.  It is used to determine if reference debugging is enabled by
  default.  Reference debugging can be enabled or disabled in asterisk.conf.
* Caller information is provided in logger errors for ao2 bad magic numbers.
* Optimizes AO2 by merging internal functions with the public counterpart.
  This was possible now that we no longer require a dual ABI.

ASTERISK-24974 #close
Reported by: Corey Farrell

Change-Id: Icf3552721fe999365ba8a8cf00a965aa6b897cc1
2015-04-27 18:37:26 -04:00
Diederik de Groot 1e74793061 Example script for scan-build (the llvm static analyzer)
- Added Pre-amble (Options / Flags / Usage Example / GNU License)
 - Extended Configurability
 - Made Executable

ASTERISK-24917
Change-Id: I70405fe54e4be7dbfbcb62e291690069b88617a8
2015-04-24 09:47:29 -05:00
George Joseph c6ed681638 res_pjsip: Add global option to limit the maximum time for initial qualifies
Currently when Asterisk starts initial qualifies of contacts are spread out
randomly between 0 and qualify_timeout to prevent network and system overload.
If a contact's qualify_frequency is 5 minutes however, that contact may be
unavailable to accept calls for the entire 5 minutes after startup.  So while
staggering the initial qualifies is a good idea, basing the time on
qualify_timeout could leave contacts unavailable for too long.

This patch adds a new global parameter "max_initial_qualify_time" that sets the
maximum time for the initial qualifies.  This way you could make sure that all
your contacts are initialy, randomly qualified within say 30 seconds but still
have the contact's ongoing qualifies at a 5 minute interval.

If max_initial_qualify_time is > 0, the formula is initial_interval =
min(max_initial_interval, qualify_timeout * random().  If not set,
qualify_timeout is used.

The default is "0" (disabled).

ASTERISK-24863 #close

Change-Id: Ib80498aa1ea9923277bef51d6a9015c9c79740f4
Tested-by: George Joseph <george.joseph@fairview5.com>
2015-04-16 16:44:45 -05:00
George Joseph 51886c68dc pjsip_options: Add qualify_timeout processing and eventing
This is the second follow-on to https://reviewboard.asterisk.org/r/4572/ and the
discussion at
http://lists.digium.com/pipermail/asterisk-dev/2015-March/073921.html

The basic issues are that changes in contact status don't cause events to be
emitted for the associated endpoint.  Only dynamic contact add/delete actions
update the endpoint.  Also, the qualify timeout is fixed by pjsip at 32 seconds
which is a long time.

This patch makes use of the new transaction timeout feature in r4585 and
provides the following capabilities...

1.  A new aor/contact variable 'qualify_timeout' has been added that allows the
user to specify the maximum time in milliseconds to wait for a response to an
OPTIONS message.  The default is 3000ms.  When the timer expires, the contact is
marked unavailable.

2.  Contact status changes are now propagated up to the endpoint as follows...
When any contact is 'Available', the endpoint is marked as 'Reachable'.  When
all contacts are 'Unavailable', the endpoint is marked as 'Unreachable'.  The
existing endpoint events are generated appropriately.

ASTERISK-24863 #close

Change-Id: Id0ce0528e58014da1324856ea537e7765466044a
Tested-by: Dmitriy Serov
Tested-by: George Joseph <george.joseph@fairview5.com>
2015-04-16 09:34:56 -05:00
Matthew Jordan 8bae18ab93 res_pjsip: Add an 'auto' option for DTMF Mode
This patch adds support for automatically detecting the type of DTMF that a
PJSIP endpoint supports. When the 'dtmf_mode' endpoint option is set to 'auto',
the channel created for an endpoint will attempt to determine if RFC 4733
DTMF is supported. If so, it will use that DTMF type. If not, the DTMF type
for the channel will be set to inband.

Review: https://reviewboard.asterisk.org/r/4438

ASTERISK-24706 #close
Reported by: yaron nahum
patches:
  yaron_patch_3_Feb.diff submitted by yaron nahum (License 6676)
........

Merged revisions 434637 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434638 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-04-10 17:56:47 +00:00
Richard Mudgett cb1c639817 Add missing file. ASTERISK-24781
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433597 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-27 17:58:16 +00:00
Kevin Harwell 79a81fed59 alemebic scripts: endpoint identifier order option
The script was added in 13, but when committed to trunk it caused a branch to
occur due to some trunk only alemebic changes. This fixes it so that the new
'add_pjsip_endpoint_identifier_order script points to the correct down revision.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433152 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-19 15:27:56 +00:00
Kevin Harwell aef7278af6 res_pjsip: Allow configuration of endpoint identifier query order
This patch fixes previously reverted code that caused binary incompatibility
problems with some modules. And like the original patch it makes sure that
no matter what order the endpoint identifier modules were loaded, priority is
given based on the ones specified in the new global 'endpoint_identifier_order'
option.

ASTERISK-24840
Reported by: Mark Michelson
Review: https://reviewboard.asterisk.org/r/4489/
........

Merged revisions 433028 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17 18:22:20 +00:00
Kevin Harwell d42c6adb1a Revert - res_pjsip: Allow configuration of endpoint identifier query order
Due to a break in binary compatibility with some other modules these changes
are being reverted until the issue can be resolved.

ASTERISK-24840
Reported by: Mark Michelson
........

Merged revisions 432868 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432869 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13 14:55:44 +00:00
Kevin Harwell 1ce529d30e res_pjsip: allow configuration of endpoint identifier query order
It's possible to have a scenario that will create a conflict between endpoint
identifiers. For instance an incoming call could be identified by two different
endpoint identifiers and the one chosen depended upon which identifier module
loaded first. This of course causes problems when, for example, the incoming
call is expected to be identified by username, but instead is identified by ip.
This patch adds a new 'global' option to res_pjsip called
'endpoint_identifier_order'. It is a comma separated list of endpoint
identifier names that specifies the order by which identifiers are processed
and checked.

ASTERISK-24840 #close
Reported by: Mark Michelson
Review: https://reviewboard.asterisk.org/r/4455/
........

Merged revisions 432638 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432639 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-09 16:13:40 +00:00
Joshua Colp 55709bc1f7 install_prereq: Tweak flags when configuring pjproject.
This change does two things:
1. Disables debugging so assertions which can return an error do,
instead of asserting.
2. Enables IPv6 support.

ASTERISK-24632 #close
Reported by: Rusty Newton
........

Merged revisions 431843 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431844 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-15 18:00:18 +00:00
Walter Doekes 49cbfa7de6 Fix typo's (retrieve, specified, address).
........

Merged revisions 430996 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 430998 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431000 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-23 15:13:08 +00:00
Matthew Jordan 14b8e03dad contrib/scripts/install_prereq: Don't install 32-bit packages on 64-bit hosts
On Debian based systems, the install_prereq tool uses a search command on
Debian that results in selecting both 64-bit and 32-bit packages. Besides the
waste of disk space, this can actually cause aptitude use 100% of memory on a
VM with 1GB of RAM as it tried to work out all of the 32-bit package
dependencies.

This patch filters out the 32-bit packages on a 64-bit machine, and leaves
32-bit machines alone.

ASTERISK-24048 #close
Reported by: Ben Klang
Tested by: Ben Klang, Matt Jordan
patches:
  install_prereq_64-bit_compat.patch uploaded by Ben Klang (License 5876)
........

Merged revisions 430798 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 430799 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430800 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-20 02:41:09 +00:00
Scott Griepentrog fba836cc02 sip_to_pjsip: improve ability to parse input files
General improvements to SIP to PJSIP conversion utility:

1) track default section of input file to allow parsing
   an include file that doesn't specify a [section]

2) informatively handle case of assignment without [section]

3) correctly handle getting sections from included files
   - [section]'s are inherited by included file

4) provide null string as default transport bind ip

5) gracefully handle missing portions of registration string

6) denote steps of operation during conversion and confirm
   top level files as a convenience

ASTERISK-24474 #close
Review: https://reviewboard.asterisk.org/r/4280/
Reported by: John Kiniston
........

Merged revisions 430469 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430470 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-09 22:09:04 +00:00
Joshua Colp 7f8b7ace72 res_pjsip_sdp_rtp: Add support for optimistic SRTP.
Optimistic SRTP is the ability to enable SRTP but not have it be
a fatal requirement. If SRTP can be used it will be, if not it won't be.
This gives you a better chance of using it without having your sessions
fail when it can't be.

Encrypt all the things!

Review: https://reviewboard.asterisk.org/r/3992/
........

Merged revisions 428222 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428224 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-19 12:50:47 +00:00
Joshua Colp b2e766a6b7 alembic: Fix alembic migration for 'moh_passthrough' option in res_pjsip.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-19 12:45:47 +00:00
Joshua Colp ac091d4184 chan_pjsip: Add support for passing hold and unhold requests through.
This change adds an option, moh_passthrough, that when enabled will pass
hold and unhold requests through using a SIP re-invite. When placing on
hold a re-invite with sendonly will be sent and when taking off hold a
re-invite with sendrecv will be sent. This allows remote servers to handle
the musiconhold instead of the local Asterisk instance being responsible.

Review: https://reviewboard.asterisk.org/r/4103/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@427112 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-03 14:45:01 +00:00
Corey Farrell bf684b63a3 REF_DEBUG: Install refcounter.py to $(ASTDATADIR)/scripts
This change ensures refcounter.py is installed to a place where it
can be found by the Asterisk testsuite if REF_DEBUG is enabled.

ASTERISK-24432 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4094/
........

Merged revisions 426830 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 426831 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 426832 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 426833 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@426834 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-31 03:09:48 +00:00
Joshua Colp 7144c739e9 res_pjsip: Add 'user_eq_phone' option to add a 'user=phone' parameter when applicable.
This change adds a configuration option which adds a 'user=phone' parameter if the user
portion of the request URI or the From URI is determined to be a number.

Review: https://reviewboard.asterisk.org/r/4073/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425804 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-17 11:30:23 +00:00
Walter Doekes d0255c4a46 safe_asterisk: Don't automatically exceed MAXFILES value of 2^20.
On systems with lots of RAM (e.g. 24GB) /proc/sys/fs/file-max divided
by two can exceed the per-process file limit of 2^20. This patch
ensures the value is capped.

(Patch cleaned up by me.)

ASTERISK-24011 #close
Reported by: Michael Myles
Patches:
  safe_asterisk-ulimit.diff uploaded by Michael Myles (License #6626)
........

Merged revisions 424875 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 424878 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 424879 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 424880 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424881 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-09 08:10:35 +00:00
Jonathan Rose b15cd42b5b Alembic: Add enumerator value to sippeers -> directmedia - 'outgoing'
The 'outgoing' value was left off of the enumerator when first creating the
column. This patch adds it, and should gracefully upgrade keeping the existing
data in tact.

ASTERISK-23781 #close
Reported by: Stephen More
Review: https://reviewboard.asterisk.org/r/4013/
........

Merged revisions 424372 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 424373 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424380 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-02 20:23:38 +00:00
Walter Doekes b56dfb78c5 autosupport: Fix bashism.
'==' is bashism (bashspecific, fails when dash is /bin/sh). Anyway, a
'case' works better there.

Originally committed in r375059 and r375060 on 2012-10-16 21:13:08.

ASTERISK-20567 #close
Reported by: Tzafrir Cohen
........

Merged revisions 424117 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 424125 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 424126 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424127 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-29 21:32:10 +00:00
Richard Mudgett 3c1804eb0d format_mp3: Made the get script conditionally apply patch if not already there.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424039 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-26 15:51:22 +00:00
Walter Doekes 37179a2b1f core: Don't allow free to mean ast_free (and malloc, etc..).
This gets rid of most old libc free/malloc/realloc and replaces them
with ast_free and friends. When compiling with MALLOC_DEBUG you'll
notice it when you're mistakenly using one of the libc variants. For
the legacy cases you can define WRAP_LIBC_MALLOC before including
asterisk.h.

Even better would be if the errors were also enabled when compiling
without MALLOC_DEBUG, but that's a slightly more invasive header
file change.

Those compiling addons/format_mp3 will need to rerun
./contrib/scripts/get_mp3_source.sh.

ASTERISK-24348 #related
Review: https://reviewboard.asterisk.org/r/4015/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423978 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-26 14:41:38 +00:00
Richard Mudgett a7add3a257 astobj2.c/refcounter.py: Fix to deal with invalid object refs.
* Make astob2 REF_DEBUG output an invalid object line when an invalid ao2
object ref/unref is attempted.  This is similar to the
constructor/destructor lines.

* Fixed refcounter.py to handle skewed objects that have
constructor/destructor states.

* Made refcounter.py highlight the invalid ao2 object refs by putting them
in their own section of the processed output file.

* Made refcounter.py highlight unreffing an object by more than one that
results in a negative ref count and the object being destroyed.  The
abnormally destroyed object is reported in the invalid and finalized
object sections of the output.

Review: https://reviewboard.asterisk.org/r/3971/
........

Merged revisions 423349 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 423400 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 423416 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 423418 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423422 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-18 16:56:40 +00:00
Walter Doekes 77834b72d3 contrib: Fix verifyi typo in alembic DB script ps_transport table.
Reported by: Zogot (on IRC)
Patches:
  tmp.diff uploaded by Zogot, cleaned up by me.
........

Merged revisions 423128 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 423129 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423130 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-15 10:50:11 +00:00
Matthew Jordan add46fd27c app_queue: Add RealTime support for queue rules
This patch gives the optional ability to keep queue rules in RealTime. It is
important to note that with this patch:
 (a) Queue rules in RealTime are only examined on module load/reload
 (b) Queue rules are loaded both from the queuerules.conf file as well as the
     RealTime backend
To inform app_queue to examine RealTime for queue rules, a new setting has been
added to queuerules.conf's general section "realtime_rules". RealTime queue
rules will only be used when this setting is set to "yes".

The schema for the database table supports a rule_name, time, min_penalty, and
max_penalty columns. min_penalty and max_penalty can be relative, if a '-' or
'+' literal is provided. Otherwise, the penalties are treated as constants.

For example:
rule_name, time, min_penalty, max_penalty
'default', '10', '20', '30'
'test2', '20', '30', '55'
'test2', '25', '-11', '+1111'
'test2', '400', '112', '333'
'test3', '0', '4564', '46546'
'test_rule', '40', '15', '50'

which would result in :

Rule: default
 - After 10 seconds, adjust QUEUE_MAX_PENALTY to 30 and adjust
   QUEUE_MIN_PENALTY to 20
Rule: test2
 - After 20 seconds, adjust QUEUE_MAX_PENALTY to 55 and adjust
   QUEUE_MIN_PENALTY to 30
 - After 25 seconds, adjust QUEUE_MAX_PENALTY by 1111 and adjust
   QUEUE_MIN_PENALTY by -11
 - After 400 seconds, adjust QUEUE_MAX_PENALTY to 333 and adjust
   QUEUE_MIN_PENALTY to 112
Rule: test3
 - After 0 seconds, adjust QUEUE_MAX_PENALTY to 46546 and adjust
   QUEUE_MIN_PENALTY to 4564
Rule: test_rule
 - After 40 seconds, adjust QUEUE_MAX_PENALTY to 50 and adjust
   QUEUE_MIN_PENALTY to 15

If you use RealTime, the queue rules will be always reloaded on a module
reload, even if the underlying file did not change. With the option disabled,
the rules will only be reloaded if the file was modified.

Review: https://reviewboard.asterisk.org/r/3607/

ASTERISK-23823 #close
Reported by: Michael K
patches:
  app_queue.c_realtime_trunk.patch uploaded by Michael K (License 6621)
........

Merged revisions 420624 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420625 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-11 00:14:53 +00:00
Richard Mudgett 8bdf374c4a Fix alembic script to work properly in offline mode.
When run in offline mode, this would attempt to check the database for
the presence of a type it was going to try to create. I now check the
context to see if we're running in offline mode and change a parameter
accordingly.
........

Merged revisions 407567 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420237 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-06 18:12:48 +00:00
Richard Mudgett 5273a14839 Add alembic script that adds contact user_agent and endpoint message_context.
........

Merged revisions 411514 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420236 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-06 17:56:09 +00:00
Richard Mudgett a6612e80aa alembic: Adjust sippeers, queue_members, and voicemail_messages tables.
* Increased the sippeers useragent max string size to 255.

* Changed the queue_members uniqueid to an auto incremented integer
instead of a string.

* Increased the voicemail_messages BLOB size to LONGBLOB on mysql.

* Fixed the add_tables_for_pjsip config change version downgrade actions
to drop a table it created.

* Adjusted the sample alembic.ini files cdr.ini.sample, config.ini.sample,
and voicemail.ini.sample to give a mysql and postgres sqlalchemy.url
lines.

ASTERISK-23847 #close
Reported by: Stephen More

ASTERISK-23825 #close
Reported by: Stephen More

ASTERISK-23909 #close
Reported by: Stephen More

Review: https://reviewboard.asterisk.org/r/3870/
........

Merged revisions 420211 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420212 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-06 17:04:08 +00:00
Matthew Jordan fd94fea599 res_pjsip: Support setting a default accountcode on endpoints
Most channel drivers let you specify a default accountcode to be set on
channels associated with a particular peer/endpoint/object. Prior to this
patch, chan_pjsip/res_pjsip did not support such a setting.

This patch adds a new setting to the res_pjsip endpoint object, 'accountcode'.
When a channel is created that is associated with an endpoint with this value
set, the channel will automatically have its accountcode property set to the
value configured for the endpoint.

Review: https://reviewboard.asterisk.org/r/3724/

ASTERISK-24000 #close
Reported by: Matt Jordan
........

Merged revisions 418756 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-16 14:03:51 +00:00
Corey Farrell fcdc4ad0bf astobj2: work around REF_DEBUG race which causes out of order log entries
* Update refcounter.py to use delta's to track the current reference count.
* Use result from internal_ao2_ref to write old_refcount to refs_log.

Review: https://reviewboard.asterisk.org/r/3756/
........

Merged revisions 418504 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 418505 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 418506 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418507 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-13 21:57:00 +00:00
Tzafrir Cohen da469fd9f6 dahdi_span_config_hook: automatically register new dahdi channels
Install a hook script for DAHDI to register new spans with Asterisk
automatically by running:

  asterisk -rx 'dahdi create channel FIRST LAST'

Review: https://reviewboard.asterisk.org/r/3157/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417863 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-03 14:08:02 +00:00
Joshua Colp 6e60f5d317 Recorded merge of revisions 417677 from http://svn.asterisk.org/svn/asterisk/branches/11
........
res_rtp_asterisk: Add SHA-256 support for DTLS and perform DTLS negotiation on RTCP.

This change fixes up DTLS support in res_rtp_asterisk so it can accept and provide
a SHA-256 fingerprint, so it occurs on RTCP, and so it occurs after ICE negotiation
completes. Configuration options to chan_sip and chan_pjsip have also been added to
allow behavior to be tweaked (such as forcing the AVP type media transports in SDP).

ASTERISK-22961 #close
Reported by: Jay Jideliov

Review: https://reviewboard.asterisk.org/r/3679/
Review: https://reviewboard.asterisk.org/r/3686/
........

Merged revisions 417678 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417679 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-30 19:51:28 +00:00
Corey Farrell 9a495107b8 refcounter.py: prevent use of excessive RAM with large refs logs
When processing a 212MB refs file, refcounter.py used over 3GB of RAM.
This change greatly reduces memory usage in two ways:

* Saving object history in whole lines instead of separated values.
* Not saving normal/skewed/leaked object lists unless they are requested.

ASTERISK-23921 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/3668/
........

Merged revisions 417480 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 417481 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 417483 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417485 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-27 19:18:32 +00:00
Joshua Colp 58f4c18ab6 res_pjsip_pubsub: Persist subscriptions in sorcery so they are recreated on startup.
This change makes res_pjsip_pubsub persist inbound subscriptions in sorcery. By default
this uses the local astdb but it can also be configured to store within an outside
database. When Asterisk is started these subscriptions are recreated if they have not
expired. Notifications are sent to the devices which have subscribed and they are none
the wiser that the system has restarted.

Review: https://reviewboard.asterisk.org/r/3598/
........

Merged revisions 415766 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415767 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-12 11:34:36 +00:00
Walter Doekes 3b0ad74e17 safe_asterisk: Overwrite old safe_asterisk on make install.
From now on, make install will overwrite safe_asterisk with the
latest version. You need to move any local modifications to files
inside /etc/asterisk/startup.d, if you have any.

See also commits r394939 and r397938.

ASTERISK-21965 #close
Patches:
  safe_asterisk.patch uploaded by jkister (License 6232, modified by me)
........

Merged revisions 415748 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-12 07:52:59 +00:00
Walter Doekes ce733a02b4 safe_asterisk: Cleanup additions to r415132.
* Replaced a stray echo that should've been a message call in
  safe_asterisk. This replaces a conditional log message by a slightly
  different message. Please update your log parsing scripts.
* Made the $NOTIFY mail Subject more verbose by adding the machine name
  and exitstatus.

(Note that a 'make install' still won't overwrite your old safe_asterisk
if it exists. See ASTERISK-21965.)

ASTERISK-23492 #close
........

Merged revisions 415521 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 415522 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 415523 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415524 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-09 12:12:25 +00:00
Walter Doekes cfb9c8bff1 safe_asterisk: Cleanup and debian compatibility.
Cleans up the safe_asterisk script and adds the ASTSAFE_FOREGROUND
option that allows the debian asterisk init script to capture the
right pid.

* Drop the vim #modeline which wasn't used. Use test consistently
  without the odd configure xno syntax. Double quote all paths.
  General cleanup.
* Don't output message()s to the console but only to TTY if set.
* Allow TTY to be "no" as well as empty (debian compatibility with
  debian/patches/safe_asterisk-config).
* Add option to export ASTSAFE_FOREGROUND=1 from the init script
  that calls this to disable backgrounding. Debian uses a similar
  method in debian/patches/safe_asterisk-nobg).

ASTERISK-23492 #close
Review: https://reviewboard.asterisk.org/r/3574/
........

Merged revisions 415132 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 415171 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 415172 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415173 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-04 20:16:40 +00:00
Matthew Jordan 4bf21353de ast-db-manage/cdr/env.py: Don't fail if a config file can't be loaded
When generating SQL files via the repotools alembic_creator.py script, a
configuration object is used programatically with SQLAlechemy, as opposed to
a configuration file. This patch ignores failures to interpret a config file,
as ... there isn't one in this case.
........

Merged revisions 414763 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414764 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-28 17:44:49 +00:00
Kevin Harwell 798b21a914 pjsip realtime: increase the size of some columns
The string lengths on certain columns created through alembic for PJSIP were
too short. For instance, columns containing URIs are currently set to 40
characters, but this can be too small and result in truncated values.  Added
an alembic migration script that increases the size of these columns and a
few others to 255.

ASTERISK-23639 #close
Reported by: Mark Michelson
Review: https://reviewboard.asterisk.org/r/3475/
........

Merged revisions 412992 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412993 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-24 14:37:54 +00:00
Matthew Jordan 4f30c7e91f main/astobj2: Make REF_DEBUG a menuselect item; improve REF_DEBUG output
This patch does the following:
(1) It makes REF_DEBUG a meneselect item. Enabling REF_DEBUG now enables
    REF_DEBUG globally throughout Asterisk.
(2) The ref debug log file is now created in the AST_LOG_DIR directory.
    Every run will now blow away the previous run (as large ref files
    sometimes caused issues). We now also no longer open/close the file
    on each write, instead relying on fflush to make sure data gets written
    to the file (in case the ao2 call being performed is about to cause a
    crash)
(3) It goes with a comma delineated format for the ref debug file. This
    makes parsing much easier. This also now includes the thread ID of the
    thread that caused ref change.
(4) A new python script instead for refcounting has been added in the
    contrib/scripts folder.
(5) The old refcounter implementation in utils/ has been removed.

Review: https://reviewboard.asterisk.org/r/3377/
........

Merged revisions 412114 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 412115 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 412153 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412154 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-11 02:59:19 +00:00
Matthew Jordan 2dae3d6ea3 contrib/realtime: Remove empty SQL script files
Since the relatime scripts are now managed by Alembic, the previous realtime
scripts were previously removed. However, the removal process messed up, as
the files were still in the repository. The contents were just empty.

This removes the files from the tree.
........

Merged revisions 411442 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411443 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-28 14:19:20 +00:00
Richard Mudgett 4b18b3bb4d Fix 'alembic branches' merge conflict as described by the web page.
........

Merged revisions 411191 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411192 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-26 16:05:00 +00:00
Jonathan Rose ff63012c4e PJSIP: TOS values should be represented as decimals in sorcery objects
(closes issue ASTERISK-23235)
Reported by: George Joseph
Review: https://reviewboard.asterisk.org/r/3324/
........

Merged revisions 410574 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410575 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-14 16:42:54 +00:00
Jonathan Rose f0b8590c14 pjsip configuration: Make transport TOS values consistent with endpoints
Transport TOS values were interpreted as DSCP values without being documented
as such. Endpoint TOS values (tos_audio/tos_video) behaved normally as TOS
values have historically. This patch makes the transport TOS values behave as
TOS values and makes all TOS values readable as string values (e.g. AF11).
In addition, alembic scripts have been updated to use the proper field types
for all TOS/COS values.

(issue ASTERISK-23235)
Reported by: George Joseph
Review: https://reviewboard.asterisk.org/r/3304/
........

Merged revisions 410028 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-06 19:04:58 +00:00
Richard Mudgett 15140883d0 alembic: Add missing queue and CDR table creation scripts.
* Added the queues and queue_members tables to the config alembic scripts.

* Added the CDR table alembic creation script.  The CDR table is more of
an example for new setups since the actual table can be fully customized
in cdr_adaptive_odbc.conf.

(closes issue ASTERISK-23233)
Reported by: jmls

Review: https://reviewboard.asterisk.org/r/3227/
........

Merged revisions 409885 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409889 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-05 18:51:37 +00:00
Sean Bright 0dad46d297 Fix references to 'keys' CLI commands in astgenkey
........

Merged revisions 409777 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 409778 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 409779 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409780 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-05 12:06:48 +00:00
Richard Mudgett ce18fcebf3 alembic: Add svn:ignore *.pyc to directories and svn:executable to *.py files.
........

Merged revisions 408297 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408299 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-18 19:19:37 +00:00
Kevin Harwell 6a1cb65679 pjsip realtime: already created enum failure for postgresql
If an enum had been previously created the alembic script would attempt to
re-create it and an error would be generated while running migrations for a
postgresql server.  The work around for this is to use the ENUM object type
for postgres as opposed to the generic enum type used by sqlalchemy. Using
this type in the script seems to work properly for both postgres and mysql.
........

Merged revisions 407572 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407574 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-06 18:11:34 +00:00
Kevin Harwell 10e38fb10c res_pjsip: Config option to enable PJSIP logger at load time.
Added a "debug" configuration option for res_pjsip that when set to "yes"
enables SIP messages to be logged.  It is specified under the "system" type.
Also added an alembic script to add the option to realtime.

(closes issue ASTERISK-23038)
Reported by: Rusty Newton
Review: https://reviewboard.asterisk.org/r/3148/
........

Merged revisions 407036 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407037 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-31 23:15:47 +00:00
Kevin Harwell e29c5e0c5c alembic: script modifications due to errors
A couple of the scripts had errors that would not allow a full migration to
take place.  The extensions table needed to make its 'id' column a primary
key in order to work with mysql.  The other script ...add_endpoints... was
missing tables that it was trying to add columns to.

Added the primary key on id for extensions and added the tables in for the
missing pjsip configuration options.  While it is not ideal to modify already
released scripts this was a case where it had to be done due to errors in
the script and lacking a better alternative.

Review: https://reviewboard.asterisk.org/r/3167/
........

Merged revisions 407019 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-31 22:23:42 +00:00
Tzafrir Cohen 6b019afada live_ast: run wrapped programs with exec
live_ast can be used as a wrapper script to run asterisk, gdb or
valgrind. In those cases it runs them and returns the result. It is more
useful to use 'exec' to avoid having another odd process in the chain.

Review: https://reviewboard.asterisk.org/r/3110/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406503 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-26 14:19:14 +00:00
Kinsey Moore 7cbb6eab15 PJSIP: Add Path header support
This adds Path support to chan_pjsip in res_pjsip_path.c with minimal
additions in res_pjsip_registrar.c to store the path and additions in
res_pjsip_outbound_registration.c to enable advertisement of path
support to registrars and intervening proxies.

Path information is stored on contacts and is enabled via Address of
Record (AoRs) and Registration configuration sections.

While adding path support, it became necessary to be able to add SIP
supplements that handled messages outside of sessions, so a framework
for handling these types of hooks was added in parallel to the
already-existing session supplements and several senders of
out-of-dialog requests were refactored as a result.

(closes issue ASTERISK-21084)
Review: https://reviewboard.asterisk.org/r/3050/
........

Merged revisions 405565 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405566 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-15 13:16:10 +00:00
Scott Griepentrog d2eb007bf0 realtime: Create extensions in alembic ast-db-manage contribution
When the alembic scripts were written for creating Asterisk
realtime databases the extensions table for dialplan wasn't
included.  This update creates the extensions table.

(closes issue ASTERISK-22815)
Reported by: Zone Conkle
Review: https://reviewboard.asterisk.org/r/3064/
........

Merged revisions 403713 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403714 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-12 19:46:54 +00:00
Kevin Harwell 76a2b855e1 res_pjsip: convert configuration settings names to snake case some more
Updated the alembic script for pjsip.  Also, the dtls config parsing stuff was
expecting strings with no underscores, so removed the underscores from the
option name before passing it to the parser.
........

Merged revisions 403082 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403083 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-22 22:37:30 +00:00
Kevin Harwell 1c45a32ee8 res_pjsip: convert configuration settings names to snake case
Renamed, where appropriate, the configuration options for chan/res_pjsip to use
snake case (compound words separated by an underscore).  For example, faxdetect
will become fax_detect, recordofffeature will become record_off_feature, etc...

Review: https://reviewboard.asterisk.org/r/3002/
........

Merged revisions 403022 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403051 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-22 17:27:55 +00:00
Mark Michelson dd221c74c5 Update the conversion script from sip.conf to pjsip.conf
(closes issue ASTERISK-22374)
Reported by Matt Jordan

Review: https://reviewboard.asterisk.org/r/2846
........

Merged revisions 402327 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402328 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-31 22:09:47 +00:00
Matthew Jordan 2e24dfe4d1 Update Alembic database scripts for external scripting and PostgreSQL, Oracle
This patch does the following:
1) The env scripts have been updated to be tolerant of a NULL configuration
   file. This occurs when configuration is provided by an external script,
   such that the actual config.ini file is not used.
2) Enum types have all been given names. This is needed for PostgreSQL script
   generation.
3) The identifier meetme_confno_starttime_endtime is greater than 30
   characters, and hence invalid for Oracle databases. This has been truncated
   down to meetme_confno_start_end.
........

Merged revisions 400383 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402073 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-27 02:39:34 +00:00
David M. Lee 14dc5776d2 This is just a quick script for dumping swagger-ui into static-http,
so that it can be served by the Asterisk web server.

I had to change the Makefile in order to recursively install content
from the static-http directory, hence the code review instead of just
putting it in.

Review: https://reviewboard.asterisk.org/r/2924/
........

Merged revisions 401261 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401263 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-18 21:51:01 +00:00
Jonathan Rose 44bd543181 chan_pjsip: Add alembic scripts for generating db tables for PJSIP
Also updates sample configurations for sorcery and extconfig to
demonstrate how to use databases created by that alembic script.

(closes issue ASTERISK-22133)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2892/
........

Merged revisions 400532 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400533 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-04 18:13:37 +00:00
Matthew Jordan 449afdd9e8 Revert r394939 due to (numerous) objections
The patch from ASTERISK-21965 was committed perhaps a bit too hastily. Walter
and Tzafrir have pointed out numerous issues with the approach and have
propsed an alternative in r/2757. Since it's not a time critical issue and
is not worth holding up the release of 12 for it, I've gone ahead and reverted
r394939 from 12/trunk and re-opened ASTERISK-21965.
........

Merged revisions 397938 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397939 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-29 20:22:08 +00:00
Matthew Jordan 72cf2779e8 Actually *add* the database schema management utilities
In r397874, the scripts were removed... but not replaced. Thanks to
Michael Young for noticing this!
........

Merged revisions 397911 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397912 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-29 12:30:07 +00:00
Matthew Jordan 629f43d2b6 Add database schema management using Alembic
This patch replaces contrib/realtime/ with a new setup for managing the
database schema required for database integration with Asterisk.  In
addition to initializing a database with the proper schema, alembic can do a
database migration to assist with upgrading Asterisk in the future.
Hopefully this helps make setting up and operating Asterisk with a database
easier.

With this the schema only needs to be maintained in one place instead of
once per database.  The schemas I have added here have a bit of improvement
over the examples that were there before (some added consistency and added
some missing indexes).  Managing the schema in one place here also applies
to all databases supported by SQLAlchemy.

See contrib/ast-db-manage/README.md for more details.

Review: https://reviewboard.asterisk.org/r/2731

patch by Russell Bryant (license 6300)
........

Merged revisions 397874 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397875 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-28 20:55:53 +00:00
Kevin Harwell 882ba86434 PSJIP - sip.conf to res_sip.conf script
Most, if not all, of the backing features of a conf file should now be
implemented (e.g. multi-line comments, includes, templates, etc...).  A
few of the options still need to be mapped.  Those are currently listed
in the 'sip_to_res_sip.py' file.

Things to do:

(1) There is more work to do here, at least for the sip.conf items that
aren't currently parsed. An issue will be created for that.
(2) All of the scripts should probably be passed through pylint and have
as many PEP8 issues fixed as possible.
(3) A public review is probably warranted at that point of the entire script.

Reported by: Matt Jordan


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397567 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23 17:45:05 +00:00
Kinsey Moore 03090a88ba Fix documentation replication issues
This prevents XML documentation duplication by expanding channel and
bridge snapshot tags into channel and bridge snapshot parameter sets
with a given prefix or defaulting to no prefix. This also prevents
documentation from becoming fractured and out of date by keeping all
variations of the documentation in template form such that it only
needs to be updated once and keeps maintenance to a minimum.

Review: https://reviewboard.asterisk.org/r/2708/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395985 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-01 17:07:52 +00:00
Jason Parker 644b0e576a Add pjproject to install_prereq.
Also fixes spacing, in passing.

(closes issue ASTERISK-22131)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395283 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-24 18:51:06 +00:00
Matthew Jordan 54803338b4 Always install safe_asterisk; add configuration file support
This patch modifies the behavior of safe_asterisk in two ways:
(1) It modifies the Asterisk Makefile such that safe_asterisk is always
    installed on a 'make install'. This was done as bugfixes in the
    safe_asterisk script were not applied in previous version of Asterisk
    without first removing the old version of the script.
(2) In order to keep a newly installed version of safe_asterisk from impacting
    local modifications, a new config file - safe_asterisk.conf.sample - has
    been provided. Settings that were previously modified in safe_asterisk can
    be set there instead.

(closes issue ASTERISK-21965)
Reported by: Jeremy Kister
patches:
  safe_asterisk.patch uploaded by jkister (License 6232)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394939 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-21 18:12:00 +00:00
Matthew Jordan 44fe8fcb91 Update PostgreSQL realtime scripts with schema for queue_log table
This patch updates the realtime SQL scripts with an entry that will create the
queue_log table. This brings the PostgreSQL scripts inline with the MySQL
scripts, with respect to what tables they will create.

(closes issue ASTERISK-21021)
Reported by: Eugene
patches:
  queue_log.sql uploaded by varnav (license 6360)
........

Merged revisions 394896 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 394897 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394898 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-21 02:39:37 +00:00
Kevin Harwell 5d9ac58d8e PSJIP - sip.conf to res_sip.conf script
** This script is in no way finished.

Started the initial "cut" at converting a sip.conf file to a res_sip.conf file.
Hopefully the bulk of the framework is in place and only a few minor adjustments
need to be made when an option mapping is added that "doesn't fit".  This script
and supporting files should be executable against python version 2.5.

An OrderedDict class (backported from a newer version of python) is included.
A MultiOrderedDict class is implemented so options, when added, should be able
to be added in order and allowed to have multiple values.

Currently the scripts supports the majority of endpoint options found in
res_sip.conf.  Support has also been added for Aor(s) and the ACL/security
sections.  Inside the sip_to_res_sip.py file one can see a list of options
that still need to be mapped.

Also items that still need to be done: templates, includes, parsing '=>'
delimiter.  Note that some code is hopefully in place already to support
templates (e.g. lookup/retrieving defaults from them).  However, the
parsing of and adding of the section needs to be done.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394024 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-10 22:26:13 +00:00
Tzafrir Cohen 51c54ddf8d ast_tls_cert: don't recreate generated files
Don't regenrate cat.cfg, ca.crt and ca.key if they were already created
on a previous run.

(closes issue ASTERISK-21932)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393383 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-07-02 08:23:16 +00:00
Matthew Jordan f3bfece4c3 Update autosupport script
This patch updates the autosupport script to collect all information available
to the Asterisk CLI command "digium_phones". It also makes minor improvements
in options handling.

(closes issue AST-1163)
Reported by: Trey Blancher
patches:
  390347_autosupport.diff uploaded by tblancher (License 5821)
  390348_autosupport.diff uploaded by tblancher (License 5821)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392409 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-21 14:21:16 +00:00
David M. Lee d4e25a456e install_prereq: Build jansson from source, when necessary
When r383579 was committed, it made Jansson a required dependency.

While libjansson-dev and jansson-devel are available on recent
distros, some older (but still supported) distros don't have
it. There's a pull request[1] to get it into repoforge, but that still
doesn't help everyone. (And helps no one until the pull request is
merged and packages are built).

This patch adds Jansson install from source to the install_unpackaged()
function. There are a few gotcha's, which makes this change not
completely trivial.

 * Since Jansson may be installed by a package, don't install from
   source if a package installation can be found
   * libresample may also be installed via package, so I added a
     similar check to that.
 * Since Jansson installs into /usr/local, this patch also adds
   /usr/local/lib to /etc/ld.so.conf.d so that the library can be
   found.
   * The alternative was to install into /usr, but then it gets
     complicated having to deal with EL's /usr/lib{32,64} shenanigans.

 [1]: https://github.com/repoforge/rpms/pull/250

Review: https://reviewboard.asterisk.org/r/2414/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384488 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-01 20:10:47 +00:00
David M. Lee c2ae4acb15 install_prereq: removed some out-of-date comments
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383747 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-25 19:28:04 +00:00
David M. Lee 2e0f5cc854 install_prereq: Adding jansson-devel to RH packages
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383728 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-25 17:12:03 +00:00
Michael L. Young 6a57a36d28 Update Contributed Realtime Schema Files - IPv6 Addresses
This commit updates some fields in the contributed realtime schema files to
handle IPv6 addresses.

(closes issue ASTERISK-21173)
Reported by: Torrey Searle
Patches:
  realtime_sql.patch Torrey Searle (license 5334)
  asterisk-21173-update-ip-fields.diff Michael L. Young (license 5026)
........

Merged revisions 382939 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 382940 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382941 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-12 20:41:42 +00:00
Matthew Jordan 8d5c36c9bb Add RFC 3327 Path header support to chan_sip
This patch adds support for RFC 3327 "Path" headers. This can be enabled in
sip.conf using the 'supportpath' setting, either on a global basis or on a
peer basis. This setting enables Asterisk to route outgoing out-of-dialog
requests via a set of proxies by using a pre-loaded route-set defined by the
Path headers in the REGISTER request. This patch also adds Realtime support
for dynamically updating the Path information for a peer.

A huge thank-you to Klaus Darillion and Olle E Johansson for their efforts
in writing this patch.

Review: https://reviewboard.asterisk.org/r/2235/
Review: https://reviewboard.asterisk.org/r/991/

(closes issue ASTERISK-16884)
Reported by: klaus3000
Tested by: klaus3000, oej, mjordan
patches:
  path-1.8.0-patch.txt uploaded by klaus3000 (License 5054)
  oolong-path-support-trunk in team branch by oej (License 5267)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382440 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-05 13:14:43 +00:00
Michael L. Young a3ad8b28e6 Fix / Clean Up Some Items To Handle The New auto_* NAT Options
The original report had to do with a realtime peer behind NAT being pruned and
the peer's private address being used instead of its external address.  Upon
debugging, it was discovered that this was being caused by the addition of
the auto_force_rport and auto_comedia settings.

This patch does the following:

* Adds a missing note to the CHANGES file indicating that the default global nat
  setting is auto_force_rport

* Constify the 'req' parameter for check_via()

* Add calls to check_via() in a couple of places in order for the auto_*
  settings to do their job in attempting to determine if NAT is involved

* Set the flags SIP_NAT_FORCE_RPORT and SIP_PAGE2_SYMMETRICRTP if the auto_*
  settings are in use where it was needed

* Moves the copying of peer flags up in build_peer() to before they are used;
  this fixes the realtime prune issue

* Update the contrib/realtime schemas to allow the nat column to handle the
  different nat setting combinations we have

This patch received a review and "Ship It!" on the issue itself.

(closes issue ASTERISK-20904)
Reported by: JoshE
Tested by: JoshE, Michael L. Young
Patches:
  asterisk-20904-nat-auto-and-rt-peersv2.diff Michael L. Young (license 5026)
........

Merged revisions 382322 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382323 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-01 04:32:01 +00:00
Kinsey Moore fa83a52b33 Add support for DPMA to autosupport
This adds the ability to get the DPMA version, a listing of the local
firmware directory, and indexes of configured remote directories.

(closes issue AST-1070)
Reported By: Malcolm Davenport
Tested By: Kinsey Moore <kmoore@digium.com>


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380004 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-23 16:50:00 +00:00
Matthew Jordan a3e7a77a82 Update init.d scripts to handle stderr; readd splash screen for remote consoles
When r376428 was commited to re-order start up sequences to be more tolerant of
forking with thread primitives, a few items were changed that caused changes
in behavior on some distros. This includes:
 * Not displaying the splash screen on a remote console.
 * Displaying an error message on stderr when a remote console cannot connect
   to a running instance of Asterisk.

In the first case, the splash screen was re-added (thanks to Michael L. Young).
In the second case, the various init.d scripts were modified to pipe stderr
to /dev/null, as the error message is useful - if you execute a remote
console or a remote console command execution and it fail, it should tell
you. Note that the error message was always present, it just failed to be
printed prior to r376428.

Much thanks to the folks who quickly reported this problem, provided solutions,
and promptly tested the various init.d scripts on a variety of distros.

(closes issue ASTERISK-20945)
Reported by: Warren Selby
Tested by: Michael L. Young, Jamuel Starkey, kaldemar, Danny Nicholas, mjordan
patches:
  asterisk-20945-remote-intro-msg.diff uploaded by elguero (license 5026)
  ASTERISK-20945-1.8-mjordan.diff uploaded by mjordan (license 6283)
........

Merged revisions 379760 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 379777 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 379790 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379791 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-21 20:41:12 +00:00
Andrew Latham 08e6ae82a6 Add LDAP libraries to install script
Add LDAP dev package to Debian/Ubuntu install list.  Existed in Redhat already.

(issue ASTERISK-20886)
........

Merged revisions 379643 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379644 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-21 04:50:09 +00:00
Jason Parker 73b33dbacf Reduce number of packages install_prereq installs on Debian systems.
'search' will look for any package containing the name provided, so we need to
force a more exact search.
........

Merged revisions 379276 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 379277 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379278 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-16 21:13:53 +00:00