Commit Graph

27572 Commits

Author SHA1 Message Date
Joshua Colp b543e389d0 Merge "res_calendar: Cleanup scheduler context at unload." 2016-01-11 14:35:51 -06:00
Joshua Colp 3a2d91c282 Merge "manager: Cleanup manager_channelvars during shutdown." 2016-01-11 14:35:14 -06:00
Joshua Colp 7be4629752 Merge "devicestate: Cleanup engine thread during graceful shutdown." 2016-01-11 14:34:55 -06:00
Kevin Harwell 7760029f19 pbx: Deadlock between contexts container and context_merge locks
Recent changes (ASTERISK-25394 commit 2bd27d1222)
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
2016-01-11 13:46:25 -06:00
Corey Farrell e9c2c1dc67 devicestate: Cleanup engine thread during graceful shutdown.
ASTERISK-25681 #close

Change-Id: I64337c70f0ebd8c77f70792042684607c950c8f1
2016-01-10 17:16:28 -06:00
Corey Farrell 90c0dcaee4 manager: Cleanup manager_channelvars during shutdown.
ASTERISK-25680 #close

Change-Id: I3251d781cbc3f48a6a7e1b969ac4983f552b2446
2016-01-10 13:53:25 -06:00
Corey Farrell a868a381f0 res_calendar: Cleanup scheduler context at unload.
ASTERISK-25679 #close

Change-Id: I839159bf6882cccc1b23494c7aa2bc2a2624613f
2016-01-10 13:32:59 -06:00
Joshua Colp a1c43022d2 res_rtp_asterisk: Revert DTLS negotiation changes.
Due to locking issues within pjnath these changes are being
reverted until pjnath can be changed.

ASTERISK-25645

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

This reverts commit 24ae124e4f.

Change-Id: I2986cfb2c43dc14455c1bcaf92c3804f9da49705

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

This reverts commit 965a0eee46.

Change-Id: Ie68fafde27dad4b03cb7a1e27ce2a8502c3f7bbe
2016-01-09 18:38:32 -06:00
George Joseph 220ba979cf Revert "pjsip_location: Delete contact_status object when contact is deleted"
This reverts commit 0a9941de9d.

Matt,

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.

ASTERISK-25675
Reported-by: Daniel Journo

Change-Id: Ib586a6b7f90acb641b0c410f659743ab90e84f1a
2016-01-09 18:13:27 -06:00
Corey Farrell 26e0e113dc 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
2016-01-09 18:07:18 -06:00
Corey Farrell dc2c000fd5 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
2016-01-09 13:39:09 -06:00
Joshua Colp e6f77da664 Merge "include/asterisk/time.h: Renamed global declaration:tv" 2016-01-09 11:15:23 -06:00
Richard Mudgett 0bca2a5c26 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
serializer
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
2016-01-08 22:11:45 -06:00
Richard Mudgett f0f5fbbc01 Sorcery: Create human friendly serializer names.
Sorcery name formats:
sorcery/<type>-<seq> -- Sorcery thread pool serializer

Change-Id: Idc2e5d3dbab15c825b97c38c028319a0d2315c47
2016-01-08 22:11:29 -06:00
Richard Mudgett b1c7ae9afc 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
2016-01-08 22:11:29 -06:00
Richard Mudgett 3e857bb347 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
2016-01-08 22:11:01 -06:00
Richard Mudgett 84c245d38c 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
names.

Change-Id: I1a5c82ce3e8f765a0627796aba87f8f7be077601
2016-01-08 21:05:16 -06:00
Richard Mudgett 7d86979ea0 taskprocessor.c: Fix CLI "core show taskprocessors" unref.
Change-Id: I1d9f4e532caa6dfabe034745dd16d06134efdce5
2016-01-08 21:05:16 -06:00
Richard Mudgett 1fb39aa8a0 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
2016-01-08 21:05:16 -06:00
Richard Mudgett 71bb7b9c40 taskprocessor.c: Sort CLI "core show taskprocessors" output.
Change-Id: I71e7bf57c7b908c8b8c71f1816348ed7c5a5d51e
2016-01-08 21:05:16 -06:00
Richard Mudgett b025e1982f taskprocessor.c: Add CLI "core ping taskprocessor" missing unlock.
Change-Id: I78247e0faf978bf850b5ba4e9f4933ab3c59d17b
2016-01-08 21:05:16 -06:00
Mark Michelson a146bde1f7 Merge "main: Use ast_strdup instead of strdup" 2016-01-08 14:46:51 -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
Diederik de Groot 6745cd6529 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
2016-01-08 06:20:22 +01:00
Mark Michelson 1afc8432dc 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
2016-01-07 16:25:03 -06:00
Corey Farrell 5d8c42c6d3 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
2016-01-07 10:39:19 -05:00
Diederik de Groot 7856762f2f main: Use ast_strdup instead of strdup
Fix compile error in main/utils.c because strdup was used in dummy_start

Change-Id: Id61a6cf4f3cbf235450441e10e7da101a6335793
2016-01-07 10:34:15 +01:00
Joshua Colp 0f87b89b32 Merge "cel/cel_radius: Fix wrong pointer." 2016-01-06 12:02:36 -06:00
Joshua Colp 9cded6eb36 Merge "Add sipp-sendfax.xml and spandspflow2pcap.py to contrib/scripts." 2016-01-06 10:55:06 -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
Joshua Colp c8e786ff66 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.
2016-01-06 06:13:29 -06:00
Joshua Colp e00e6a606e Merge "main/pbx: Move timing routines to pbx_timing.c." 2016-01-06 06:09:48 -06:00
Aaron An 084563e136 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
2016-01-06 09:48:35 +08:00
Matt Jordan f3a052667e Merge "main/pbx: Move variable routines to pbx_variables.c." 2016-01-05 13:38:45 -06:00
Corey Farrell 36f1eaf0b5 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
2016-01-05 12:08:40 -05:00
Martin Tomec 90b06d1a3c 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
2016-01-05 17:44:11 +01:00
Matt Jordan 193ac48db0 Merge "Happy new year 2016." 2016-01-05 09:39:47 -06:00
Joshua Colp 0c62e0a55c Merge "voicemail: Move app_voicemail / res_mwi_external conflict to runtime" 2016-01-05 05:55:56 -06:00
Corey Farrell 3507494b8a 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
2016-01-04 20:46:25 -05:00
Corey Farrell 54a8f1a396 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
2016-01-04 19:20:35 -05:00
Corey Farrell c3c8b8e41d 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
2016-01-04 19:00:23 -05:00
George Joseph 6d18fe151c 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
2016-01-04 17:31:24 -06:00
Corey Farrell 5ee5c3739e 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
2016-01-04 17:15:14 -05:00
Richard Mudgett f88b952093 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
2016-01-04 13:34:13 -06:00
Matt Jordan 839f328601 Merge "main/cdr: Allow setting properties on a finalized CDR if it is the last one" 2016-01-04 09:02:54 -06:00
Matt Jordan 5201984ed6 Merge "main/cdr: Set the end time on a CDR if endbeforehexten is Yes" 2016-01-04 09:02:48 -06:00
Matt Jordan e9dd16364e 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
function.

ASTERISK-25458 #close

Change-Id: Icf3553c607b9f561152a41e6d8381d594ccdf4b9
2016-01-02 10:38:08 -06:00
Matt Jordan 153547a9b1 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.

ASTERISK-25458

Change-Id: I0c27b493861f9c13c43addbbb21257f79047a3b3
2016-01-02 10:36:10 -06:00
Corey Farrell f9bfc2450e 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
2016-01-01 13:48:36 -05:00
Matt Jordan 11d99e0809 Merge "main/pbx: Move pbx_builtin dialplan applications to pbx_builtins.c" 2016-01-01 09:25:42 -06:00