Commit Graph

27210 Commits

Author SHA1 Message Date
Mark Michelson 5ec076b3b8 Merge "res_pjsip_outbound_registration.c: Fix 423 response handling." 2015-11-20 13:03:35 -06:00
Joshua Colp 66d9eab072 Merge "res_format_attr_h264: Do not reset string buffer." 2015-11-20 09:20:43 -06:00
Matt Jordan 1ef6c35367 Merge "res/res_pjsip_outbound_registration: Apply configuration on object type load" 2015-11-20 06:15:49 -06:00
Joshua Colp b52b494004 Merge "StatsD: Add sample rate compatibility" 2015-11-19 10:27:07 -06:00
Matt Jordan 1bca90fcbe res/res_pjsip_outbound_registration: Apply configuration on object type load
When Asterisk is configured to use a dynamic sorcery backend (such as
res_sorcery_astdb) with 'registration' objects, it will fail to create the
internal state objects associated with the registration objects on module
load. This is due to nothing actually querying for the specific objects
and calling their sorcery apply handler during module load.

This patch fixes that by calling get_registrations in the sorcery observer's
object_type_loaded handler. Doing this causes the sorcery backends to be
asked for the current state of all registration objects, which causes the
apply handler to be called and the internal run-time state to be created.

ASTERISK-25575 #close

Change-Id: Ie9306e797098c6d4da7bcf4a5434a15891508b23
2015-11-19 09:44:39 -06:00
Alexander Traud 92ea46ba94 res_format_attr_h264: Do not reset string buffer.
When no parameter is present, Asterisk does not generate the line fmtp, as
expected. However, because a buffer was reset, even rtpmap and fmtp of previous
media codecs got removed. Now, Asterisk does not reset other codecs in case of
no parameter for H.264.

ASTERISK-25573 #close

Change-Id: I93811331f4a28c45418a9e14ee46c0debd47a286
2015-11-19 08:09:51 +01:00
Matt Jordan 65102d19bc Merge "app_bridgeaddchan: ability to barge into existing call" 2015-11-18 21:30:49 -06:00
Alec Davis 8c14b91651 app_bridgeaddchan: ability to barge into existing call
To be able to barge into a call by dialling a prefix+extension that maps
to the extensions device.

Senario is that DECT headset users may be away from their desks and need
to transfer the call, the goal is that from any phone they dial a prefix
then their extension and are added to the bridge that they are in, from
there they can drop the headset call, as it's also on the handset,
and transfer the caller.

The dialplan would look like, where prefix=73, extension = 8512;
exten => _738512,1,BridgeAdd(SIP/cisco0001)

ASTERISK-25551 #close
Reported By: Alec Davis

Change-Id: I8eb5096a02168dcc8d7aeea416ef36ba4ed10540
2015-11-19 11:37:59 +13:00
tcambron 05addf3d8f StatsD: Add sample rate compatibility
Implemented support for the StatsD sample rate parameter,
which is a parameter for determining when to send computed
statistics to a client.

Valid sample rate values are:
Less than or equal to 0.0 will never be sent.
Between 0.0 and 1.0 will randomly be sent.
Greater than or equal to 1.0 will always be sent.

ASTERISK-25419
Reported By: Ashley Sanders

Change-Id: I11d315d0a5034fffeae1178e650aa8264485ed52
2015-11-18 15:01:37 -06:00
Richard Mudgett eaf898ac88 res_pjsip_outbound_registration.c: Fix 423 response handling.
Receiving a 423 Interval Too Brief response after authentication for an
outbound registration attempt results in assuming that the registrar has
rejected the registration permanently.  If there are no configured retries
for fatal responses then the outbound registration is stopped for that
endpoint.

For registrations, PJSIP/PJPROJECT intercepts the handling of 423
responses and does not include any authentication in the updated
registration request.  When the updated request is challenged then the
Asterisk code assumes that we were challenged again because the peer
rejected the authentication we sent earlier.

* Made registration challenges keep track of the CSeq number to determine
if the received challenge response was for the request we thought we sent.
If the response's CSeq number differs from the CSeq number we last sent
with authentication then authenticate again because it is a challenge to a
different request.

Change-Id: I81b4bd36d1be095bab606e34b8b44e6302971b09
2015-11-18 13:26:49 -06:00
Matt Jordan e90bb44b76 Merge "res_pjsip_rfc3326.c: Fix crash when channel goes away." 2015-11-18 07:33:57 -06:00
Alec Davis 4013f9d577 app_queue: (try_calling): mutex 'qe->chan' freed more times than we've locked!
commit aae45acbd (Mark Michelson 2015-04-15 10:38:02 -0500 6525)
refer ASTERISK-24958

above commit removed ast_channel_lock(qe->chan);
but failed to remove corresponding ast_channel_unlock(qe->chan);

ASTERISK-25561 #close
Reported Alec Davis

Change-Id: Ie05f4e2d08912606178bf1fded57cc022c7a2e1a
2015-11-18 19:21:54 +13:00
Matt Jordan f57da2ae90 Merge "format: Register format-attribute module with cached formats." 2015-11-17 14:35:22 -06:00
Matt Jordan e6ac74f0f7 Merge "res/res_pjsip: Fix off nominal crash with requests that fail and have a timer" 2015-11-17 12:59:36 -06:00
Joshua Colp e18b07da9d Merge "Confbridge: Add a user timeout option" 2015-11-17 08:12:27 -06:00
George Joseph 6919daab61 dns: Fix pointer increment in dns_parse_answer_ex
When dns_parse_answer_ex was iterating over the answers it
wasn't incrementing the answer pointer correctly after the first
answer.  The result was that no answers after the first
were being returned.  For results where multiple records should
have been sorted by priority, weight, etc., there was nothing
to sort so the only the first record was returned even if it
wouldn't have been the correct record based on the sort.

ASTERISK-25565 #close
Reported-by: Daniel Tryba
Tested-by George Joseph

Change-Id: I8622604fefdcd3c11e2c5609a6382e53b1467b0b
2015-11-16 15:10:20 -07:00
Mark Michelson ed13732188 Confbridge: Add a user timeout option
This option adds the ability to specify a timeout, in seconds, for a
participant in a ConfBridge. When the user's timeout has been reached,
the user is ejected from the conference with the CONFBRIDGE_RESULT
channel variable set to "TIMEOUT".

The rationale for this change is that there have been times where we
have seen channels get "stuck" in ConfBridge because a network issue
results in a SIP BYE not being received by Asterisk. While these
channels can be hung up manually via CLI/AMI/ARI, adding some sort of
automatic cleanup of the channels is a nice feature to have.

ASTERISK-25549 #close
Reported by Mark Michelson

Change-Id: I2996b6c5e16a3dda27595f8352abad0bda9c2d98
2015-11-16 14:13:13 -06:00
Matt Jordan a83e426e91 res/res_pjsip: Fix off nominal crash with requests that fail and have a timer
When a request is sent using pjsip_endpt_send_request and fails, a condition
exists where the request wrapper, which is an AO2 object, may be de-ref'd
more times than it should. This occurs when the request's callback is called,
and, in the callback, the timer on the PJSIP heap is cancelled. When that
occurs, the request wrapper's lifetime is decremented. When
pjsip_endpt_send_request fails, we unilaterally decrement the lifetime of
the request wrapper again, even though we've already cancelled the reference
associated with the timer.

This patch checks the return result of pj_timer_heap_cancel_if_active before
removing the reference associated with the timer. We now only decrement it
in this case if a timer is cancelled as a result of the function call.

Change-Id: I21332343a1a019c1117076f9bf2df27be2850102
2015-11-16 14:09:55 -06:00
Joshua Colp a1fcf6f7b2 hashtab: Add NULL check when destroying iterator.
The hashtab API is pretty NULL tolerant which has resulted
in remaining callers not doing much checks themselves.
Unfortunately the function to destroy an iterator does not
do a NULL check and will result in a crash if passed NULL.
This change fixes that.

ASTERISK-25552 #close

Change-Id: Ic1bf8eec3639e5a440f1c941d3ae3893ac6ed619
2015-11-14 08:06:48 -05:00
Richard Mudgett 436023a322 res_pjsip_rfc3326.c: Fix crash when channel goes away.
If an authenticated incoming caller does not respond to our 200 OK INVITE
response with an ACK then PJSIP will hangup the call.  Unfortunately,
there is a chance that the session's channel will go away between one use
of the channel pointer and another when building the BYE request because
the BYE is being built by the monitor thread and not the call's serializer
thread.

* Added a check to ensure that the thread trying to add the Reason header
is the call's serializer thread.  This ensures that the channel will not
go away on us.

Change-Id: I866388d2b97ea2032eaae3f3ab3f1ca6cbd2df89
2015-11-13 16:34:41 -05:00
Mark Michelson e8881e1770 Taskprocessors: Increase high-water mark
In practical tests, we have seen certain taskprocessors, specifically
Stasis subscription taskprocessors, cross the recently-added high-water
mark and emit a warning. This high-water mark warning is only intended
to be emitted when things have tanked on the system and things are
heading south quickly. In the practical tests, the Stasis taskprocessors
sometimes had a max depth of 180 tasks in them, and Asterisk wasn't in
any danger at all.

As such, this ups the high-water mark to 500 tasks instead. It also
redefines the SIP threadpool request denial number to be a multiple of
the taskprocessor high-water mark.

Change-Id: Ic8d3e9497452fecd768ac427bb6f58aa616eebce
2015-11-13 14:19:35 -06:00
Alexander Traud fd23d423d8 format: Register format-attribute module with cached formats.
In Asterisk 13, cached formats are created before their corresponding format-
attribute module is registered. Cached formats are involved when a local
extension is called. Therefore, ast_format_generate_sdp_fmtp did not work
on local extensions. This change affects the Opus Codec, H.263 (Plus), H.264,
and format-attribute modules provided externally.

ASTERISK-25160 #close

Change-Id: I1ea1f0483e5261e2a050112e4ebdfc22057d1354
2015-11-13 09:32:52 +01:00
Mark Michelson 40b58a5d2b res_pjsip distributor: Don't send 503 response to responses.
When the SIP threadpool is backed up with tasks, we send 503 responses
to ensure that we don't try to overload ourselves. The problem is that
we were not insuring that we were not trying to send a 503 to an
incoming SIP response.

This change makes it so that we only send the 503 on incoming requests.

Change-Id: Ie2b418d89c0e453cc6c2b5c7d543651c981e1404
2015-11-12 11:17:51 -06:00
Joshua Colp 6879ce7fba Merge "res_pjsip: Deny requests when threadpool queue is backed up." 2015-11-12 10:56:09 -06:00
Matt Jordan 1d4f813a07 Merge "format_cap: Don't append the 'none' format when appending all." 2015-11-12 10:54:01 -06:00
Mark Michelson 264c74aa22 res_pjsip: Deny requests when threadpool queue is backed up.
We have observed situations where the SIP threadpool may become
deadlocked. However, because incoming traffic is still arriving, the SIP
threadpool's queue can continue to grow, eventually running the system
out of memory.

This change makes it so that incoming traffic gets rejected with a 503
response if the queue is backed up too much.

Change-Id: I4e736d48a2ba79fd1f8056c0dcd330e38e6a3816
2015-11-12 11:39:41 -05:00
Joshua Colp 469ad02404 Merge "Further fixes to improper usage of scheduler" 2015-11-12 07:56:36 -06:00
Joshua Colp a159747660 format_cap: Don't append the 'none' format when appending all.
When appending all formats of a type all the codecs are iterated
and added. This operation was incorrectly adding the ast_format_none
format which is special in that it is supposed to be used when no
format is present. It shouldn't be appended.

ASTERISK-25535

Change-Id: I7b00f3bdf4a5f3022e483d6ece602b1e8b12827c
2015-11-12 08:48:42 -05:00
Steve Davies d982b99e71 Further fixes to improper usage of scheduler
When ASTERISK-25449 was closed, a number of scheduler issues mentioned in
the comments were missed. These have since beed raised in ASTERISK-25476
and elsewhere.

This patch attempts to collect all of the scheduler issues discovered so
far and address them sensibly.

ASTERISK-25476 #close

Change-Id: I87a77d581e2e0d91d33b4b2fbff80f64a566d05b
2015-11-12 11:46:43 +00:00
Joshua Colp 2954354404 threadpool: Handle worker thread transitioning to dead when going active.
This change adds handling of dead worker threads when moving them
to be active. When this happens the worker thread is removed from
both the active and idle threads container. If no threads are able
to be moved to active then the pool grows as configured.

A unit test has also been added which thrashes the idle timeout
and thread activation to exploit any race conditions between the
two.

ASTERISK-25546 #close

Change-Id: I6c455f9a40de60d9e86458d447b548fb52ba1143
2015-11-11 14:18:39 -05:00
Matt Jordan c1abe8906d Merge "rtp_engine: Init a format-attribute module to its RFC defaults." 2015-11-11 08:19:39 -06:00
Matt Jordan 21ee2f029c Merge "Increase account code maximum length to 80." 2015-11-11 08:09:18 -06:00
Matt Jordan 9c9ebbd482 Merge "dns: Use ntohl for ans->ttl in dns_parse_answer_ex" 2015-11-11 08:09:06 -06:00
Matt Jordan d77bba4326 Merge "res_pjsip_sdp_rtp: Enable Opus to be negotiated via SIP/SDP." 2015-11-11 08:08:55 -06:00
Matt Jordan 7987bf54c6 Merge "ast_format_cap: Avoid format creation on module load, use cache instead." 2015-11-11 08:08:02 -06:00
Matt Jordan 8b4b3e9b88 Merge "xmldoc: Improve xmldoc wrapping of 'core show ...' output." 2015-11-11 08:06:54 -06:00
Alexander Traud 525c7ab780 rtp_engine: Init a format-attribute module to its RFC defaults.
Previously, format-attribute modules relied on an existing fmtp line in SDP
negotiation. However, fmtp is optional for several formats like the Opus Codec.
Now, the format-attribute module is called with an empty fmtp, which allows the
module to initialise itself to RFC defaults. Furthermore now, Asterisk is able
to differentiate between internally and externally created formats.

ASTERISK-25537 #close

Change-Id: I28f680cef7fdf51c0969ff8da71548edad72ec52
2015-11-11 15:00:26 +01:00
Joshua Colp d8dadf4894 Merge "taskprocessor: Add high water mark warnings" 2015-11-11 07:10:42 -06:00
Joshua Colp e4af14784e Merge "Remove ABI compatibility stub functions." 2015-11-10 16:11:07 -06:00
Joshua Colp 0be147f713 Merge "ast_format_cap_get_names: To display all formats, the buffer was increased." 2015-11-10 14:58:18 -06:00
Corey Farrell be93036a4e Remove ABI compatibility stub functions.
ABI compatibility stubs existed for ast_app_separate_args and ast_verbose,
this is not needed in master.

Change-Id: I07b4d2c16079da3c2c6efa55df4a74368e0bd453
2015-11-10 15:37:09 -05:00
Corey Farrell 02a124eda5 Remove execute permission from dns_system_resolver.c
Change-Id: I3185735db42064bab00d3e073aed703385a00bf4
2015-11-10 15:35:27 -05:00
Joshua Colp 131b750fc6 Merge "func_callerid: Document that CALLERID(pres) is available." 2015-11-10 10:04:50 -06:00
Alexander Traud cf79b62778 ast_format_cap_get_names: To display all formats, the buffer was increased.
ASTERISK-25533 #close

Change-Id: Ie1a9d1a6511b3f1a56b93d04475fbf8a4e40010a
2015-11-09 16:58:52 +01:00
Alexander Traud e85f0c81af ast_format_cap: Avoid format creation on module load, use cache instead.
Since Asterisk 13, formats are immutable and cached. However while loading a
module like chan_sip, some formats were created instead using cached ones.

ASTERISK-25535 #close

Change-Id: I479cdc220d5617c840a98f3389b3bd91e91fbd9b
2015-11-09 14:05:14 +01:00
Walter Doekes 7dd8f89a50 func_callerid: Document that CALLERID(pres) is available.
CALLERPRES() says that it's deprecated in favor of CALLERID(num-pres)
and CALLERID(name-pres).  But for channel driver that don't make a
distinction between the two (e.g. SIP), it makes more sense to get/set
both at once.  This change reveals the availability of CALLERID(pres),
CONNECTEDLINE(pres), REDIRECTING(orig-pres), REDIRECTING(to-pres) and
REDIRECTING(from-pres).

ASTERISK-25373 #close

Change-Id: I5614ae4ab7d3bbe9c791c1adf147e10de8698d7a
2015-11-06 18:03:47 -05:00
Walter Doekes 39daf9f066 docs: Fix a few typo's in app docs (more then, resourse).
Change-Id: Iba57efadf6c0b822e762c7a001bc89611d98afd7
2015-11-06 16:46:31 -05:00
George Joseph d82a4b098f dns: Use ntohl for ans->ttl in dns_parse_answer_ex
dns_parse_answer_ex was not converting ans->ttl from network
by order to host byte order which was causing certain ttls
it to go negative. In turn this was causing answer edit checks
to fail.

ASTERISK-25528 #close
Reported-by: Daniel Tryba
Tested-by: George Joseph

Change-Id: I31505132d6321c46d2f39fd06c20ee808a864037
2015-11-06 13:19:11 -07:00
Walter Doekes 74e7333317 xmldoc: Improve xmldoc wrapping of 'core show ...' output.
Previously, the wrapping did both lookahead and lookback, which,
together with color escape sequences, caused some lines to be wrapped
way earlier than other lines.  This led to inconsistent output.

This simplifies the wrapping code and makes it more sane: if maxcolumns
is hit, we simply jump back to the last space and wrap there.

ASTERISK-25527 #close

Change-Id: I56d01c6f9a812642b1b05535c98d4db48d17c957
2015-11-06 08:46:24 -05:00
Alexander Traud 9d6e917349 res_pjsip_sdp_rtp: Enable Opus to be negotiated via SIP/SDP.
In SIP/SDP, Opus has two channels always (see RFC 7587 section 7). The actual
amount of channels is negotiated in-band. Therefore now, the Opus codec and its
attribute rtpmap are registered with two channels.

ASTERISK-24779 #close
Reported by: PowerPBX
Tested by: Alexander Traud
patches:
  asterisk-24779.patch submitted by Sean Bright (license #5060)

Change-Id: Ic7ac13cafa1d3450b4fa4987350924b42cbb657b
2015-11-06 13:59:30 +01:00