6 years agopjsip_loging_refactor: Rename res_pjsip_log_forwarder to res_pjproject
George Joseph [Tue, 19 Jan 2016 01:01:36 +0000 (18:01 -0700)]
pjsip_loging_refactor: Rename res_pjsip_log_forwarder to res_pjproject

Change-Id: I5387821f29e5caa0cba0b7d62b0fc0d341e7e20b

6 years agoMerge "Update version number in features.conf.sample"
Mark Michelson [Mon, 18 Jan 2016 23:31:40 +0000 (17:31 -0600)]
Merge "Update version number in features.conf.sample"

6 years agoMerge "pjsip/alembic: Fix qualify_timeout column definition"
Joshua Colp [Mon, 18 Jan 2016 11:49:45 +0000 (05:49 -0600)]
Merge "pjsip/alembic:  Fix qualify_timeout column definition"

6 years agoMerge "func_channel: Add help text for undocumented CHANNEL function arguments"
Joshua Colp [Sun, 17 Jan 2016 19:48:32 +0000 (13:48 -0600)]
Merge "func_channel: Add help text for undocumented CHANNEL function arguments"

6 years agoMerge "main/config: Clean config maps on shutdown."
Joshua Colp [Sun, 17 Jan 2016 17:44:38 +0000 (11:44 -0600)]
Merge "main/config: Clean config maps on shutdown."

6 years agoUpdate version number in features.conf.sample
Daniel Journo [Sat, 16 Jan 2016 19:18:19 +0000 (19:18 +0000)]
Update version number in features.conf.sample

Update the version number in the comments from Asterisk 12 to Asterisk 12+

Change-Id: Ie692ac8cda3c993c3bf10f27f51a1cca3317ec7b

6 years agopjsip/alembic: Fix qualify_timeout column definition
Daniel Journo [Wed, 13 Jan 2016 21:58:22 +0000 (21:58 +0000)]
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

6 years agoMerge "bridge_basic: don't play an attended transfer fail sound after target hangs up"
Joshua Colp [Sat, 16 Jan 2016 14:29:58 +0000 (08:29 -0600)]
Merge "bridge_basic: don't play an attended transfer fail sound after target hangs up"

6 years agoMerge "bridge_basic: don't cache xferfailsound during an attended transfer"
Joshua Colp [Sat, 16 Jan 2016 14:29:17 +0000 (08:29 -0600)]
Merge "bridge_basic: don't cache xferfailsound during an attended transfer"

6 years agoMerge "taskprocessor.c: Simplify ast_taskprocessor_get() return code."
Joshua Colp [Sat, 16 Jan 2016 14:28:16 +0000 (08:28 -0600)]
Merge "taskprocessor.c: Simplify ast_taskprocessor_get() return code."

6 years agomain/config: Clean config maps on shutdown.
Corey Farrell [Sat, 16 Jan 2016 01:52:26 +0000 (20:52 -0500)]
main/config: Clean config maps on shutdown.

ASTERISK-25700 #close

Change-Id: I096da84f9c62c6095f68bcf98eac4b7c7868e808

6 years agobridge_basic: don't cache xferfailsound during an attended transfer
Kevin Harwell [Thu, 14 Jan 2016 20:42:57 +0000 (14:42 -0600)]
bridge_basic: don't cache xferfailsound during an attended transfer

The xferfailsound was read from the channel at the beginning of the transfer,
and that value is "cached" for the duration of the transfer. Therefore, changing
the xferfailsound on the channel using the FEATURE() dialplan function does
nothing once the transfer is under way.

This makes it so the transfer code instead gets the xferfailsound configuration
options from the channel when it is actually going to be used.

This patch also fixes a potential memory leak of the props object as well as
making sure the condition variable gets initialized before being destroyed.

ASTERISK-25696 #close

Change-Id: Ic726b0f54ef588bd9c9c67f4b0e4d787934f85e4

6 years agotaskprocessor.c: Simplify ast_taskprocessor_get() return code.
Richard Mudgett [Fri, 10 Jul 2015 15:37:35 +0000 (10:37 -0500)]
taskprocessor.c: Simplify ast_taskprocessor_get() return code.

Change-Id: Id5bd18ef1f60ef8be453e677e98478298358a9d1

6 years agoastmm.c: Add more stats to CLI "memory show" commands.
Richard Mudgett [Thu, 14 Jan 2016 00:20:57 +0000 (18:20 -0600)]
astmm.c: Add more stats to CLI "memory show" commands.

* Add freed regions totals to allocations and summary.

* Add totals for all allocations and not just the selected allocations.

Change-Id: I61d5a5112617b0733097f2545a3006a344b4032a

6 years agobridge_basic: don't play an attended transfer fail sound after target hangs up
Kevin Harwell [Thu, 14 Jan 2016 22:00:50 +0000 (16:00 -0600)]
bridge_basic: don't play an attended transfer fail sound after target hangs up

If the attended transfer destination answers (picks call up or goes to
voicemail) and then hangs up on the transferer then transferer hears the
fail sound.

This patch makes it so the fail sound is not played when the transfer
destination/target hangs up after answering.

ASTERISK-25697 #close

Change-Id: I97f142fe4fc2805d1a24b7c16143069dc03d9ded

6 years agofunc_channel: Add help text for undocumented CHANNEL function arguments
Rusty Newton [Thu, 14 Jan 2016 15:26:15 +0000 (09:26 -0600)]
func_channel: Add help text for undocumented CHANNEL function arguments

Adding help text documentation for:
* hangupsource
* appname
* appdata
* exten
* context
* channame
* uniqueid
* linkedid

ASTERISK-24097 #close
Reported by: Steven T. Wheeler
Tested by: Rusty Newton

Change-Id: Ib94b00568b0433987df87d5b67ea529b5905754d

6 years agoMerge "pjsip: Add option global/regcontext"
Joshua Colp [Thu, 14 Jan 2016 12:32:12 +0000 (06:32 -0600)]
Merge "pjsip:  Add option global/regcontext"

6 years agopjsip: Add option global/regcontext
Daniel Journo [Sun, 10 Jan 2016 22:22:12 +0000 (22:22 +0000)]
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

6 years agoapp: Queue hangup if channel is hung up during sub or macro execution.
Joshua Colp [Tue, 12 Jan 2016 17:14:29 +0000 (13:14 -0400)]
app: Queue hangup if channel is hung up during sub or macro execution.

This issue was exposed when executing a connected line subroutine.
When connected or redirected subroutines or macros are executed it is
expected that the underlying applications and logic invoked are fast
and do not consume frames. In practice this constraint is not enforced
and if not adhered to will cause channels to continue when they shouldn't.
This is because each caller of the connected or redirected logic does not
check whether the channel has been hung up on return. As a result the
the hung up channel continues.

This change makes it so when the API to execute a subroutine or
macro is invoked the channel is checked to determine if it has hung up.
If it has then a hangup is queued again so the caller will see it
and stop.

ASTERISK-25690 #close

Change-Id: I1f9a8ceb1487df0389f0d346ce0f6dcbcaf476ea

6 years agoMerge "res_pjsip_log_forwarder.c: Add CLI "pjsip show buildopts"."
Mark Michelson [Wed, 13 Jan 2016 15:48:57 +0000 (09:48 -0600)]
Merge "res_pjsip_log_forwarder.c: Add CLI "pjsip show buildopts"."

6 years agores_musiconhold: Prevent multiple simultaneous reloads.
Sean Bright [Wed, 13 Jan 2016 13:20:24 +0000 (08:20 -0500)]
res_musiconhold: Prevent multiple simultaneous reloads.

There are two ways in which the reload() function in res_musiconhold can be
called from the CLI:

  * module reload
  * moh reload

In the former case, the module loader holds a lock that prevents multiple
concurrent calls, but in the latter there is no such protection.

This patch changes the 'moh reload' CLI command to invoke the module loader
directly, rather than call reload() explicitly.

ASTERISK-25687 #close

Change-Id: I408968b4c8932864411b7f9ad88cfdc7b9ba711c

6 years agores_pjsip_log_forwarder.c: Add CLI "pjsip show buildopts".
Richard Mudgett [Tue, 12 Jan 2016 20:25:09 +0000 (14:25 -0600)]
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

6 years agoMerge "pjsip_sdp_rtp: Add option endpoint/bind_rtp_to_media_address"
Joshua Colp [Wed, 13 Jan 2016 01:45:27 +0000 (19:45 -0600)]
Merge "pjsip_sdp_rtp:  Add option endpoint/bind_rtp_to_media_address"

6 years agoMerge "res_pjsip: Create human friendly serializer names."
Joshua Colp [Tue, 12 Jan 2016 19:59:48 +0000 (13:59 -0600)]
Merge "res_pjsip: Create human friendly serializer names."

6 years agoMerge "res_sorcery_realtime: Remove leading ^ requirement."
Joshua Colp [Tue, 12 Jan 2016 19:59:26 +0000 (13:59 -0600)]
Merge "res_sorcery_realtime: Remove leading ^ requirement."

6 years agoMerge topic 'update_taskprocessor_commands'
Joshua Colp [Tue, 12 Jan 2016 19:25:48 +0000 (13:25 -0600)]
Merge topic 'update_taskprocessor_commands'

* changes:
  Sorcery: Create human friendly serializer names.
  Stasis: Create human friendly taskprocessor/serializer names.
  taskprocessor.c: New API for human friendly taskprocessor names.
  taskprocessor.c: Sort CLI "core show taskprocessors" output.

6 years agoMerge "taskprocessor.c: Fix CLI "core show taskprocessors" output format."
Joshua Colp [Tue, 12 Jan 2016 19:18:58 +0000 (13:18 -0600)]
Merge "taskprocessor.c: Fix CLI "core show taskprocessors" output format."

6 years agoMerge topic 'update_taskprocessor_commands'
Joshua Colp [Tue, 12 Jan 2016 19:18:35 +0000 (13:18 -0600)]
Merge topic 'update_taskprocessor_commands'

* changes:
  taskprocessor.c: Fix CLI "core show taskprocessors" unref.
  taskprocessor.c: Add CLI "core ping taskprocessor" missing unlock.

6 years agoMerge "ccss.c: Replace space in taskprocessor name."
Joshua Colp [Tue, 12 Jan 2016 19:17:54 +0000 (13:17 -0600)]
Merge "ccss.c: Replace space in taskprocessor name."

6 years agores_sorcery_realtime: Remove leading ^ requirement.
Mark Michelson [Tue, 12 Jan 2016 16:36:15 +0000 (10:36 -0600)]
res_sorcery_realtime: Remove leading ^ requirement.

res_sorcery_realtime's search-by-regex callback performed a check to
ensure that the passed-in regex began with a caret (^). If it did not,
then no results would be returned.

This callback only started to become used when "like" support was added
to PJSIP CLI commands. The CLI command for listing objects would pass an
empty regex ("") to the sorcery backend if no "like" statement was
present. For most sorcery backends, this resulted in returning all
objects. However, for realtime, this resulted in returning no objects.

This commit seeks to fix the regression by removing the requirement from
res_sorcery_realtime for the passed-in-regex to begin with a caret.

ASTERISK-25689 #close
Reported by Marcelo Terres

Change-Id: I22b4dc5d7f3f11bb29ac2e42ef94682e9bab3b20

6 years agoMerge "app_queue: Add member flag "in_call" to prevent reading wrong lastcall time"
Joshua Colp [Tue, 12 Jan 2016 12:05:30 +0000 (06:05 -0600)]
Merge "app_queue: Add member flag "in_call" to prevent reading wrong lastcall time"

6 years agopjsip_sdp_rtp: Add option endpoint/bind_rtp_to_media_address
George Joseph [Thu, 7 Jan 2016 17:57:01 +0000 (10:57 -0700)]
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 ( 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.

Reported-by: Olivier Krief
Reported-by: Dan Journo

Change-Id: I3dfaa079e54ba7fb7c4fd1f5f7bd9509bbf8bd88

6 years agoMerge "Revert "pjsip_location: Delete contact_status object when contact is deleted""
Mark Michelson [Mon, 11 Jan 2016 23:43:39 +0000 (17:43 -0600)]
Merge "Revert "pjsip_location: Delete contact_status object when contact is deleted""

6 years agoMerge "pbx: Deadlock between contexts container and context_merge locks"
Joshua Colp [Mon, 11 Jan 2016 23:37:18 +0000 (17:37 -0600)]
Merge "pbx: Deadlock between contexts container and context_merge locks"

6 years agoMerge "Alembic: Increase column size of PJSIP AOR "contact"."
Joshua Colp [Mon, 11 Jan 2016 22:59:10 +0000 (16:59 -0600)]
Merge "Alembic: Increase column size of PJSIP AOR "contact"."

6 years agoMerge "Alembic: Add PJSIP global keep_alive_interval."
Joshua Colp [Mon, 11 Jan 2016 22:59:04 +0000 (16:59 -0600)]
Merge "Alembic: Add PJSIP global keep_alive_interval."

6 years agoMerge "pbx_dundi: Run cleanup on failed load."
Joshua Colp [Mon, 11 Jan 2016 22:54:56 +0000 (16:54 -0600)]
Merge "pbx_dundi: Run cleanup on failed load."

6 years agoMerge "res_crypto: Perform cleanup at shutdown."
Joshua Colp [Mon, 11 Jan 2016 22:35:03 +0000 (16:35 -0600)]
Merge "res_crypto: Perform cleanup at shutdown."

6 years agoMerge "res_calendar: Cleanup scheduler context at unload."
Joshua Colp [Mon, 11 Jan 2016 20:35:50 +0000 (14:35 -0600)]
Merge "res_calendar: Cleanup scheduler context at unload."

6 years agoMerge "manager: Cleanup manager_channelvars during shutdown."
Joshua Colp [Mon, 11 Jan 2016 20:35:13 +0000 (14:35 -0600)]
Merge "manager: Cleanup manager_channelvars during shutdown."

6 years agoMerge "devicestate: Cleanup engine thread during graceful shutdown."
Joshua Colp [Mon, 11 Jan 2016 20:34:55 +0000 (14:34 -0600)]
Merge "devicestate: Cleanup engine thread during graceful shutdown."

6 years agopbx: Deadlock between contexts container and context_merge locks
Kevin Harwell [Fri, 8 Jan 2016 22:59:44 +0000 (16:59 -0600)]
pbx: Deadlock between contexts container and context_merge locks

Recent changes (ASTERISK-25394 commit 2bd27d12223fe33b58c453965ed5c6ed3af7c4f5)
introduced the possibility of a deadlock. Due to the mentioned modifications
ast_change_hints now needs to keep both merge/delete and state callbacks from
occurring while it executes. Unfortunately, sometimes ast_change_hints can be
called with the contexts container locked. When this happens it's possible for
another thread to grab the context_merge_lock before the thread calling into
ast_change_hints does and then try to obtain the contexts container lock. This
of course causes a deadlock between the two threads. The thread calling into
ast_change_hints waits for the other thread to release context_merge_lock and
the other thread is waiting on that one to release the contexts container lock.

Unfortunately, there is not a great way to fix this problem. When hints change,
the subsequent state callbacks cannot run at the same time as a merge/delete,
nor when the usual state callbacks do. This patch alleviates the problem by
having those particular callbacks (the ones run after a hint change) occur in a
serialized task. By moving the context_merge_lock to a task it can now safely be
attempted or held without a deadlock occurring.

ASTERISK-25640 #close
Reported by: Krzysztof Trempala

Change-Id: If2210ea241afd1585dc2594c16faff84579bf302

6 years agodevicestate: Cleanup engine thread during graceful shutdown.
Corey Farrell [Sun, 10 Jan 2016 23:08:16 +0000 (18:08 -0500)]
devicestate: Cleanup engine thread during graceful shutdown.

ASTERISK-25681 #close

Change-Id: I64337c70f0ebd8c77f70792042684607c950c8f1

6 years agomanager: Cleanup manager_channelvars during shutdown.
Corey Farrell [Sun, 10 Jan 2016 19:51:00 +0000 (14:51 -0500)]
manager: Cleanup manager_channelvars during shutdown.

ASTERISK-25680 #close

Change-Id: I3251d781cbc3f48a6a7e1b969ac4983f552b2446

6 years agores_calendar: Cleanup scheduler context at unload.
Corey Farrell [Sun, 10 Jan 2016 19:27:57 +0000 (14:27 -0500)]
res_calendar: Cleanup scheduler context at unload.

ASTERISK-25679 #close

Change-Id: I839159bf6882cccc1b23494c7aa2bc2a2624613f

6 years agores_rtp_asterisk: Revert DTLS negotiation changes.
Joshua Colp [Fri, 8 Jan 2016 17:49:02 +0000 (13:49 -0400)]
res_rtp_asterisk: Revert DTLS negotiation changes.

Due to locking issues within pjnath these changes are being
reverted until pjnath can be changed.


Revert "res_rtp_asterisk.c: Fix DTLS negotiation delays."

This reverts commit 24ae124e4f7310cfa64c187b944b2ffc060da28d.

Change-Id: I2986cfb2c43dc14455c1bcaf92c3804f9da49705

Revert "res_rtp_asterisk: Resolve further timing issues with DTLS negotiation"

This reverts commit 965a0eee46d24321f74c244e23c5a5f45e67e12b.

Change-Id: Ie68fafde27dad4b03cb7a1e27ce2a8502c3f7bbe

6 years agoRevert "pjsip_location: Delete contact_status object when contact is deleted"
George Joseph [Sat, 9 Jan 2016 23:57:45 +0000 (16:57 -0700)]
Revert "pjsip_location: Delete contact_status object when contact is deleted"

This reverts commit 0a9941de9d24093b5ff44096d1d7406f29d11e45.


This patch causes another problem and should not have been needed.
Before this patch, persistent_endpoint_contact_deleted_observer WAS
deleting the contact_status when ast_sip_location_delete_contact was
called.  By deleting it yourself in ast_sip_location_delete_contact
it was gone before the observer could run and the observer therefore
was throwing an error and not sending stasis/AMI/statsd messages.

So, I don't think this was the cause of your original issue.  I also
had verified the contact AMI and statsd lifecycle and it was working.
I'll double check now though.

Reported-by: Daniel Journo

Change-Id: Ib586a6b7f90acb641b0c410f659743ab90e84f1a

6 years agopbx_dundi: Run cleanup on failed load.
Corey Farrell [Sun, 10 Jan 2016 00:04:34 +0000 (19:04 -0500)]
pbx_dundi: Run cleanup on failed load.

During failed startup of pbx_dundi no cleanup was performed.  Add a call
to unload_module before returning AST_MODULE_LOAD_DECLINE.

ASTERISK-25677 #close

Change-Id: I8ffa226fda4365ee7068ac1f464473f1a4ebbb29

6 years agores_crypto: Perform cleanup at shutdown.
Corey Farrell [Sat, 9 Jan 2016 19:28:31 +0000 (14:28 -0500)]
res_crypto: Perform cleanup at shutdown.

This change causes res_crypto to unregister CLI at shutdown while still
preventing the module from being unloaded.

ASTERISK-25673 #close

Change-Id: Ie5d57338dc2752abfc0dd05d0eec86413f2304fc

6 years agoMerge "include/asterisk/time.h: Renamed global declaration:tv"
Joshua Colp [Sat, 9 Jan 2016 17:15:22 +0000 (11:15 -0600)]
Merge "include/asterisk/time.h: Renamed global declaration:tv"

6 years agores_pjsip: Create human friendly serializer names.
Richard Mudgett [Thu, 7 Jan 2016 01:10:16 +0000 (19:10 -0600)]
res_pjsip: Create human friendly serializer names.

PJSIP name formats:
pjsip/aor/<aor>-<seq> -- registrar thread pool serializer
pjsip/default-<seq> -- default thread pool serializer
pjsip/messaging -- messaging thread pool serializer
pjsip/outreg/<registration>-<seq> -- outbound registration thread pool
pjsip/pubsub/<endpoint>-<seq> -- pubsub thread pool serializer
pjsip/refer/<endpoint>-<seq> -- REFER thread pool serializer
pjsip/session/<endpoint>-<seq> -- session thread pool serializer
pjsip/websocket-<seq> -- websocket thread pool serializer

Change-Id: Iff9df8da3ddae1132cb2ef65f64df0c465c5e084

6 years agoSorcery: Create human friendly serializer names.
Richard Mudgett [Thu, 7 Jan 2016 01:09:43 +0000 (19:09 -0600)]
Sorcery: Create human friendly serializer names.

Sorcery name formats:
sorcery/<type>-<seq> -- Sorcery thread pool serializer

Change-Id: Idc2e5d3dbab15c825b97c38c028319a0d2315c47

6 years agoStasis: Create human friendly taskprocessor/serializer names.
Richard Mudgett [Thu, 7 Jan 2016 01:09:59 +0000 (19:09 -0600)]
Stasis: Create human friendly taskprocessor/serializer names.

Stasis name formats:
subm:<topic>-<seq> -- Stasis subscription mailbox task processor
subp:<topic>-<seq> -- Stasis subscription thread pool serializer

Change-Id: Id19234b306e3594530bb040bc95d977f18ac7bfd

6 years agotaskprocessor.c: New API for human friendly taskprocessor names.
Richard Mudgett [Thu, 7 Jan 2016 22:15:35 +0000 (16:15 -0600)]
taskprocessor.c: New API for human friendly taskprocessor names.

* Add new API call to get a sequence number for use in human friendly
taskprocessor names.

* Add new API call to create a taskprocessor name in a given buffer and
append a sequence number.

Change-Id: Iac458f05b45232315ed64aa31b1df05b875537a9

6 years agotaskprocessor.c: Fix CLI "core show taskprocessors" output format.
Richard Mudgett [Wed, 6 Jan 2016 23:19:19 +0000 (17:19 -0600)]
taskprocessor.c: Fix CLI "core show taskprocessors" output format.

Update the CLI "core show taskprocessors" output format to not be
distorted because UUID names are longer than previously used taskprocessor

Change-Id: I1a5c82ce3e8f765a0627796aba87f8f7be077601

6 years agotaskprocessor.c: Fix CLI "core show taskprocessors" unref.
Richard Mudgett [Fri, 8 Jan 2016 03:07:49 +0000 (21:07 -0600)]
taskprocessor.c: Fix CLI "core show taskprocessors" unref.

Change-Id: I1d9f4e532caa6dfabe034745dd16d06134efdce5

6 years agoccss.c: Replace space in taskprocessor name.
Richard Mudgett [Thu, 7 Jan 2016 01:00:27 +0000 (19:00 -0600)]
ccss.c: Replace space in taskprocessor name.

The CLI "core ping taskprocessor" command does not work very
well with taskprocessor names that have spaces in them.  You
have to put quotes around the name so using tab completion
becomes awkward.

Change-Id: I29e806dd0a8a0256f4e2e0a7ab88c9e19ab0eda0

6 years agotaskprocessor.c: Sort CLI "core show taskprocessors" output.
Richard Mudgett [Fri, 8 Jan 2016 02:44:18 +0000 (20:44 -0600)]
taskprocessor.c: Sort CLI "core show taskprocessors" output.

Change-Id: I71e7bf57c7b908c8b8c71f1816348ed7c5a5d51e

6 years agotaskprocessor.c: Add CLI "core ping taskprocessor" missing unlock.
Richard Mudgett [Tue, 5 Jan 2016 22:54:06 +0000 (16:54 -0600)]
taskprocessor.c: Add CLI "core ping taskprocessor" missing unlock.

Change-Id: I78247e0faf978bf850b5ba4e9f4933ab3c59d17b

6 years agoMerge "main: Use ast_strdup instead of strdup"
Mark Michelson [Fri, 8 Jan 2016 20:46:51 +0000 (14:46 -0600)]
Merge "main: Use ast_strdup instead of strdup"

6 years agoAlembic: Add PJSIP global keep_alive_interval.
Mark Michelson [Wed, 16 Dec 2015 17:25:13 +0000 (11:25 -0600)]
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

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

6 years agoinclude/asterisk/time.h: Renamed global declaration:tv
Diederik de Groot [Thu, 7 Jan 2016 09:21:03 +0000 (10:21 +0100)]
include/asterisk/time.h: Renamed global declaration:tv

Renamed global declaration:tv to dummy_tv_var_for_types,
which would oltherwise cause 'shadow' warnings when 'tv'
was declared as a local variable elsewhere.

Added comment to note that dummy_tv_var_for_types is never
really exported and only used as a place holder.

ASTERISK-25627 #close

Change-Id: I9a6e17995006584f3627efe8988e3f8aa0f5dc28

6 years agoPJSIP: Prevent deadlock due to dialog/transaction lock inversion.
Mark Michelson [Thu, 7 Jan 2016 21:37:36 +0000 (15:37 -0600)]
PJSIP: Prevent deadlock due to dialog/transaction lock inversion.

A deadlock was observed where the monitor thread was stuck, therefore
resulting in no incoming SIP traffic being processed.

The problem occurred when two 200 OK responses arrived in response to a
terminating NOTIFY request sent from Asterisk. The first 200 OK was
dispatched to a threadpool worker, who locked the corresponding
transaction. The second 200 OK arrived, resulting in the monitor thread
locking the dialog. At this point, the two threads are at odds, because
the monitor thread attempts to lock the transaction, and the threadpool
thread loops attempting to try to lock the dialog.

In this case, the fix is to not have the monitor thread attempt to hold
both the dialog and transaction locks at the same time. Instead, we
release the dialog lock before attempting to lock the transaction.

There have also been some debug messages added to the process in an
attempt to make it more clear what is going on in the process.

ASTERISK-25668 #close
Reported by Mark Michelson

Change-Id: I4db0705f1403737b4360e33a8e6276805d086d4a

6 years agoast_format_cap_append_by_type: Resolve codec reference leak.
Corey Farrell [Thu, 7 Jan 2016 15:39:19 +0000 (10:39 -0500)]
ast_format_cap_append_by_type: Resolve codec reference leak.

This resolves a reference leak caused by ASTERISK-25535.  The pointer
returned by ast_format_get_codec is saved so it can be released.

ASTERISK-25664 #close

Change-Id: If9941b1bf4320b2c59056546d6bce9422726d1ec

6 years agomain: Use ast_strdup instead of strdup
Diederik de Groot [Thu, 7 Jan 2016 09:33:02 +0000 (10:33 +0100)]
main: Use ast_strdup instead of strdup

Fix compile error in main/utils.c because strdup was used in dummy_start

Change-Id: Id61a6cf4f3cbf235450441e10e7da101a6335793

6 years agoMerge "cel/cel_radius: Fix wrong pointer."
Joshua Colp [Wed, 6 Jan 2016 18:02:36 +0000 (12:02 -0600)]
Merge "cel/cel_radius: Fix wrong pointer."

6 years agoMerge "Add sipp-sendfax.xml and to contrib/scripts."
Joshua Colp [Wed, 6 Jan 2016 16:55:06 +0000 (10:55 -0600)]
Merge "Add sipp-sendfax.xml and to contrib/scripts."

6 years agoAdd sipp-sendfax.xml and to contrib/scripts.
Walter Doekes [Wed, 6 Jan 2016 13:12:40 +0000 (14:12 +0100)]
Add sipp-sendfax.xml and to contrib/scripts.

The 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

6 years agoMerge topic 'pbx-split'
Joshua Colp [Wed, 6 Jan 2016 12:13:29 +0000 (06:13 -0600)]
Merge topic 'pbx-split'

* changes:
  main/pbx: Move hangup handler routines to pbx_hangup_handler.c.
  main/pbx: Move dialplan application management routines to pbx_app.c.
  main/pbx: Move switch routines to pbx_switch.c.

6 years agoMerge "main/pbx: Move timing routines to pbx_timing.c."
Joshua Colp [Wed, 6 Jan 2016 12:09:48 +0000 (06:09 -0600)]
Merge "main/pbx: Move timing routines to pbx_timing.c."

6 years agocel/cel_radius: Fix wrong pointer.
Aaron An [Mon, 4 Jan 2016 10:26:55 +0000 (18:26 +0800)]
cel/cel_radius: Fix wrong pointer.

The macro ADD_VENDOR_CODE defined in the cel_radius.c should use the parameter
y not the address of y.

I capture the radius UDP packet via tcpdump, and the AV pairs are not correct,
then i review the source code and compare it with cdr/cdr_radius.c. Fix it and
 it works.

ASTERISK-25647 #close
Reported by: Aaron An
Tested by: Aaron An

Change-Id: I72889bccd8fde120d47aa659edc0e7e6d4d019f0

6 years agoMerge "main/pbx: Move variable routines to pbx_variables.c."
Matt Jordan [Tue, 5 Jan 2016 19:38:45 +0000 (13:38 -0600)]
Merge "main/pbx: Move variable routines to pbx_variables.c."

6 years agomain/pbx: Move hangup handler routines to pbx_hangup_handler.c.
Corey Farrell [Tue, 5 Jan 2016 02:23:01 +0000 (21:23 -0500)]
main/pbx: Move hangup handler routines to pbx_hangup_handler.c.

This is the sixth patch in a series meant to reduce the bulk of pbx.c.
This moves hangup handler management functions to their own source.

Change-Id: Ib25a75aa57fc7d5c4294479e5cc46775912fb104

6 years agoapp_queue: Add member flag "in_call" to prevent reading wrong lastcall time
Martin Tomec [Mon, 21 Dec 2015 17:07:14 +0000 (18:07 +0100)]
app_queue: Add member flag "in_call" to prevent reading wrong lastcall time

Member lastcall time is updated later than member status. There was chance to
check wrapuptime for available member with wrong (old) lastcall time.
New boolean flag "in_call" is set to true right before connecting call, and
reset to false after update of lastcall time. Members with "in_call" set to true
are treat as unavailable.

ASTERISK-19820 #close

Change-Id: I1923230cf9859ee51563a8ed420a0628b4d2e500

6 years agoMerge "Happy new year 2016."
Matt Jordan [Tue, 5 Jan 2016 15:39:47 +0000 (09:39 -0600)]
Merge "Happy new year 2016."

6 years agoMerge "voicemail: Move app_voicemail / res_mwi_external conflict to runtime"
Joshua Colp [Tue, 5 Jan 2016 11:55:55 +0000 (05:55 -0600)]
Merge "voicemail: Move app_voicemail / res_mwi_external conflict to runtime"

6 years agomain/pbx: Move dialplan application management routines to pbx_app.c.
Corey Farrell [Tue, 5 Jan 2016 01:46:25 +0000 (20:46 -0500)]
main/pbx: Move dialplan application management routines to pbx_app.c.

This is the sixth patch in a series meant to reduce the bulk of pbx.c.
This moves dialplan application management functions to their own source.

Change-Id: I444c10fb90a3cdf9f3047605d6a8aad49c22c44c

6 years agomain/pbx: Move switch routines to pbx_switch.c.
Corey Farrell [Tue, 5 Jan 2016 00:20:35 +0000 (19:20 -0500)]
main/pbx: Move switch routines to pbx_switch.c.

This is the fifth patch in a series meant to reduce the bulk of pbx.c.
This moves ast_switch functions to their own source.

Change-Id: Ic2592a18a5c4d8a3c2dcf9786c9a6f650a8c628e

6 years agomain/pbx: Move timing routines to pbx_timing.c.
Corey Farrell [Tue, 5 Jan 2016 00:00:23 +0000 (19:00 -0500)]
main/pbx: Move timing routines to pbx_timing.c.

This is the fourth patch in a series meant to reduce the bulk of pbx.c.
This moves pbx timing functions to their own source.

Change-Id: I05c45186cb11edfc901e95f6be4e6a8abf129cd6

6 years agovoicemail: Move app_voicemail / res_mwi_external conflict to runtime
George Joseph [Wed, 30 Dec 2015 16:49:03 +0000 (09:49 -0700)]
voicemail: Move app_voicemail / res_mwi_external conflict to runtime

The menuselect conflict between app_voicemail and res_mwi_external
makes it hard to package 1 version of Asterisk.  There no actual
build dependencies between the 2 so moving this check to runtime
seems like a better solution.

The ast_vm_register and ast_vm_greeter_register functions in app.c
were modified to return AST_MODULE_LOAD_DECLINE instead of -1 if there
is already a voicemail module registered. The modules' load_module
functions were then modified to return DECLINE instead of -1 to the
loader.  Since -1 is interpreted by the loader as AST_MODULE_LOAD_FAILURE,
the modules were incorrectly causing Asterisk to stop so this needed
to be cleaned up anyway.

Now you can build both and use modules.conf to decide which voicemail
implementation to load.

The default menuselect options still build app_voicemail and not
res_mwi_external but if both ARE built, res_mwi_external will load
first and become the voicemail provider unless modules.conf rules
prevent it.  This is noted in CHANGES.

Change-Id: I7d98d4e8a3b87b8df9e51c2608f0da6ddfb89247

6 years agomain/pbx: Move variable routines to pbx_variables.c.
Corey Farrell [Mon, 4 Jan 2016 22:15:14 +0000 (17:15 -0500)]
main/pbx: Move variable routines to pbx_variables.c.

This is the third patch in a series meant to reduce the bulk of pbx.c.
This moves channel and global variable routines to their own source.

Change-Id: Ibe8fb4647db11598591d443a99e3f99200a56bc6

6 years agoapp_dial: Immediately exit dial if the caller is already hung up.
Richard Mudgett [Fri, 4 Dec 2015 23:22:29 +0000 (17:22 -0600)]
app_dial: Immediately exit dial if the caller is already hung up.

If a caller hangs up before dial is executed within an AGI then the AGI
has likely eaten all queued frames before executing the dial in DeadAGI
mode.  With the caller hung up and no pending frames from the caller's
read queue, dial would not know that the call has hung up until a called
channel answers.  It is rather annoying to whoever just answered the
non-existent call.

Dial should not continue execution in DeadAGI mode, hangup handlers, or
the h exten.

* Added a check early in dial to abort dialing if the caller has hungup.

ASTERISK-25307 #close
Reported by: David Cunningham

Change-Id: Icd1bc0764726ef8c809f76743ca008d0f102f418

6 years agoMerge "main/cdr: Allow setting properties on a finalized CDR if it is the last one"
Matt Jordan [Mon, 4 Jan 2016 15:02:53 +0000 (09:02 -0600)]
Merge "main/cdr: Allow setting properties on a finalized CDR if it is the last one"

6 years agoMerge "main/cdr: Set the end time on a CDR if endbeforehexten is Yes"
Matt Jordan [Mon, 4 Jan 2016 15:02:47 +0000 (09:02 -0600)]
Merge "main/cdr: Set the end time on a CDR if endbeforehexten is Yes"

6 years agomain/cdr: Allow setting properties on a finalized CDR if it is the last one
Matt Jordan [Sat, 2 Jan 2016 16:26:04 +0000 (10:26 -0600)]
main/cdr: Allow setting properties on a finalized CDR if it is the last one

Prior to this patch, we explicitly disallowed setting any properties on a
finalized CDR. This seemed like a good idea at the time; in practice, it was
more restrictive.

There are weird and strange scenarios where setting a property on a finalized
CDR is definitely wrong. For example, we may Fork a CDR, finalizing the
previous one, then change a property. In said case, the old CDR is supposed
to now be 'immutable' (so to speak), and should not be updated. From the
perspective of the code, a forked CDR that is finalized is just finalized.
Hence why we decided these should not be updated.

In practice, it is much more common to want to set a property on a CDR in
the h extension or in a hangup handler. Disallowing a common scenario to make
an esoteric behaviour work isn't good. This patch fixes this by allowing
callers to set a property IF we are the last CDR in the chain. This preserves
the finalized CDR if it was forked, while allowing the more common case to

ASTERISK-25458 #close

Change-Id: Icf3553c607b9f561152a41e6d8381d594ccdf4b9

6 years agomain/cdr: Set the end time on a CDR if endbeforehexten is Yes
Matt Jordan [Sat, 2 Jan 2016 16:23:39 +0000 (10:23 -0600)]
main/cdr: Set the end time on a CDR if endbeforehexten is Yes

Prior to this patch, the CDR engine attempted to set the end time on a CDR
that was executing hangup logic and with endbeforehexten set to Yes by
calling a function that inspects the properties on the Party A snapshot to
determine if we are ready to set the end time. That always failed. This is
because a Party A snapshot is not updated for CDRs that are executing hangup
logic with endbeforehexten=Yes.

Instead of calling a function that looks at the Party A snapshot, we just
simply set the end time on the CDR. This is safe to call multiple times, and is
safe to call at this point as we know that (a) we are executing hangup logic,
and (b) we are supposed to set the end time at this point.


Change-Id: I0c27b493861f9c13c43addbbb21257f79047a3b3

6 years agomain/pbx: Move custom function routines to pbx_functions.c.
Corey Farrell [Thu, 31 Dec 2015 02:51:47 +0000 (21:51 -0500)]
main/pbx: Move custom function routines to pbx_functions.c.

This is the second patch in a series meant to reduce the bulk of pbx.c.
This moves custom function management routines to their own source.

Change-Id: I34a6190282f781cdbbd3ce9d3adeac3c3805e177

6 years agoMerge "main/pbx: Move pbx_builtin dialplan applications to pbx_builtins.c"
Matt Jordan [Fri, 1 Jan 2016 15:25:41 +0000 (09:25 -0600)]
Merge "main/pbx: Move pbx_builtin dialplan applications to pbx_builtins.c"

6 years agoHappy new year 2016.
Rodrigo Ramírez Norambuena [Fri, 1 Jan 2016 11:25:41 +0000 (08:25 -0300)]
Happy new year 2016.

Change-Id: I22d3c90f6f27df82e915bbf81c1d91221f7a945e

6 years agoMerge "res_pjsip_history: Add a module that provides PJSIP history for debugging"
Matt Jordan [Fri, 1 Jan 2016 04:42:26 +0000 (22:42 -0600)]
Merge "res_pjsip_history: Add a module that provides PJSIP history for debugging"

6 years agores_pjsip_history: Add a module that provides PJSIP history for debugging
Matt Jordan [Sun, 13 Dec 2015 19:09:42 +0000 (13:09 -0600)]
res_pjsip_history: Add a module that provides PJSIP history for debugging

This patch adds a new module, res_pjsip_history, that provides a slightly
better way of debugging SIP message traffic on a busy Asterisk system. The
existing mechanisms all rely on passively dumping a SIP message to the CLI.
While this is perfectly fine for logging purposes and well controlled
environments, on many installations, the amount of SIP messages Asterisk
receives will quickly swamp the CLI. This makes it difficult to view/capture
those messages that you want to diagnose in real time.

This patch provides another way of handling this. When enabled, the module
will store SIP message traffic in memory. This traffic can then be queried
at leisure.

In order to make the querying useful, a CLI command has been implemented,
'pjsip show history', that supports a basic expression syntax similar to
SQL or other query languages. A small number of useful fields have been
added in this initial patch; additional fields can easily be added in
later improvements. Those fields are:
 - number: The entry index in the history
 - timestamp: The time the message was recieved
 - addr: The source/destination address of the message
 - sip.msg.request.method: The request method
 - The Call-ID header

Note - this is a resurrection of the module initially proposed on Review Board

Change-Id: I39bd74ce998e99ad5ebc0aab3e84df3a150f8e36

6 years agomain/pbx: Move pbx_builtin dialplan applications to pbx_builtins.c
George Joseph [Tue, 29 Dec 2015 01:18:01 +0000 (18:18 -0700)]
main/pbx: Move pbx_builtin dialplan applications to pbx_builtins.c

We joked about splitting pbx.c into multiple files but this first step was
fairly easy.  All of the pbx_builtin dialplan applications have been moved
into pbx_builtins.c and a new pbx_private.h file was added. load_pbx_builtins()
is called by asterisk.c just after load_pbx().

A few functions were renamed and are cross-exposed between the 2 source files.

Change-Id: I87066be3dbf7f5822942ac1449d98cc43fc7561a

6 years agoMerge "res_http_websocket.c: prevent avoidable disconnections caused by write errors"
Joshua Colp [Thu, 31 Dec 2015 00:43:34 +0000 (18:43 -0600)]
Merge "res_http_websocket.c: prevent avoidable disconnections caused by write errors"

6 years agoMerge "test_time: Provide a timeout when waiting."
Joshua Colp [Mon, 28 Dec 2015 22:34:32 +0000 (16:34 -0600)]
Merge "test_time: Provide a timeout when waiting."

6 years agoMerge "endpoint/stasis: Eliminate duplicate events on endpoint status change"
Matt Jordan [Mon, 28 Dec 2015 21:11:06 +0000 (15:11 -0600)]
Merge "endpoint/stasis: Eliminate duplicate events on endpoint status change"

6 years agotest_time: Provide a timeout when waiting.
Joshua Colp [Mon, 28 Dec 2015 20:02:19 +0000 (16:02 -0400)]
test_time: Provide a timeout when waiting.

The test_timezone_watch unit test is written to expect a
condition to be signaled when the inotify daemon thread runs.
There exists a small window where the test_timezone_watch
thread can signal the inotify daemon thread while it is not
reading on the underlying file descriptor. If this occurs
the test_timezone_watch thread will wait indefinitely for a
signal that will never arrive.

This change adds a timeout to the condition so it will return
regardless after a period of time.

Change-Id: Ifed981879df6de3d93acd3ee0a70f92546517390

6 years agotests/test_stasis_endpoints: Remove expected duplicate events
Matt Jordan [Fri, 25 Dec 2015 02:26:46 +0000 (20:26 -0600)]
tests/test_stasis_endpoints: Remove expected duplicate events

The cache_clear test was written to expect duplicate Stasis messages
sent from the technology endpoint to the all caching topic. This patch
fixes the test to no longer expect these duplicate messages.


Change-Id: I58075d70d6cdf42e792e0fb63ba624720bfce981

6 years agores_http_websocket.c: prevent avoidable disconnections caused by write errors
Dade Brandon [Fri, 25 Dec 2015 04:19:59 +0000 (20:19 -0800)]
res_http_websocket.c: prevent avoidable disconnections caused by write errors

Updated ast_websocket_write to encode the entire frame in to one
write operation, to ensure that we don't end up with a situation
where the websocket header has been sent, while the body can not
be written.

Previous to August's patch in commit b9bd3c14, certain network
conditions could cause the header to be written, and then the
sub-sequent body to fail - which would cause the next successful
write to contain a new header, and a new body (resulting in
the peer receiving two headers - the second of which would be
read as part of the body for the first header).

This was patched to have both write operations individually fail
by closing the websocket.

In a case available to the submitter of this patch, the same
body which would consistently fail to write, would succeed
if written at the same time as the header.

This update merges the two operations in to one, adds debug messages
indicating the reason for a websocket connection being closed during
a write operation, and clarifies some variable names for code legibility.

Change-Id: I4db7a586af1c7a57184c31d3d55bf146f1a40598

6 years agoendpoint/stasis: Eliminate duplicate events on endpoint status change
George Joseph [Wed, 27 May 2015 18:22:39 +0000 (12:22 -0600)]
endpoint/stasis: Eliminate duplicate events on endpoint status change

When an endpoint is created, its messages are forwarded to both the tech
endpoint topic and the all endpoints topic. This is done so that various
parties interested in endpoint messages can subscribe to just the tech
endpoint and receive all messages associated with that particular technology,
as opposed to subscribing to the all endpoints topic. Unfortunately, when the
tech endpoint is created, it also forwards all of its messages to the all
topic. This results in duplicate messages whenever an endpoint publishes its

This patch resolves the duplicate message issue by creating a new function
for Stasis caching topics, stasis_cp_sink_create. In most respects, this acts
as a normal caching topic, save that it no longer forwards messages it receives
to the all endpoints topic. This allows it to act as an aggregation "sink",
while preserving the necessary caching behaviour.

ASTERISK-25137 #close
Reported-by: Vitezslav Novy

ASTERISK-25116 #close
Reported-by: George Joseph <>
Tested-by: George Joseph <>

Change-Id: Ie47784adfb973ab0063e59fc18f390d7dd26d17b

6 years agoMerge "bridge_basic.c: Fix GOTO_ON_BLINDXFR"
Matt Jordan [Mon, 28 Dec 2015 15:44:27 +0000 (09:44 -0600)]
Merge "bridge_basic.c: Fix GOTO_ON_BLINDXFR"