Commit Graph

26208 Commits

Author SHA1 Message Date
Matthew Jordan 4b63da7f7d channels/chan_sip: Clarify WARNING message in mismatched SRTP scenario
When we receive an SDP as part of an offer/answer for a peer/friend has been
configured to require encryption, and that SDP offer/answer failed to provide
acceptable crypto attributes, we currently issue a WARNING that uses the phrase
"we" and "requested". In this case, both of those terms are ambiguous - the
user will probably think "we" is Asterisk (it most likely isn't) and it may
not be a "request", so much as an SDP that was received in some fashion.

This patch makes the WARNING messages slightly less bad and a bit more
accurate as well.

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432279 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-25 23:05:40 +00:00
Matthew Jordan d68012d1a3 channels/sip/sdp_crypto: Handle SRTP keys negotiated with key lifetime/MKI
Prior to this patch, SDP offers negotiating SDES-SRTP crypto attributes would
be rejected if those crypto attributes contained either a key lifetime or a
MKI parameter. While from a theoretical point of view this was defensible -
Asterisk does not support key lifetimes or multiple crypto keys - from a
practical point of view, this is quite a problem. A large number of endpoints
offer lifetimes/MKI, which Asterisk can tolerate so long as it doesn't actually
have to support anything more than a single key or refresh the key.
In reality, this is (so far as we've seen) always the case.

This patch is a forward port of Olle's work in the lingon-srtp-key-lifetime-1.8
branch. To quote Olle from ASTERISK-17721, it handles lifetime/MKI parameters
in the following fashion:

> The Lingon branch now handle lifetime and MKI parameters.
>
> We only accept lifetimes up to max for the crypto and higher than 10 hours
> for packetization of 20 ms (50 pps).
>
> We only handle MKI with index 1.
>
> We do not really bother with counting packets and reinviting at end of
> lifetime, so the min of 10 hours kind of takes care of most calls. If there
> are longer ones, we rely on the other side for re-invites.
>
> It's still not perfect, but I personally think this is an improvement. A
> configuration option for minimum lifetime accepted could be added.

When the patch was ported forward, I decided against adding a configuration
option as Olle's handling was more than sufficient for every case I've seen
come through the issue tracker or through interoperability testing. We can
revisit that decision if it proves to be false.

A few small other tweaks were made to the surrounding code to reduce
indentation and provide better type safety for the 'tag' parameter.

Review: https://reviewboard.asterisk.org/r/4419/
Review: https://reviewboard.asterisk.org/r/4418/

ASTERISK-17721 #close
Reported by: Terry Wilson

ASTERISK-17899 #close
Reported by: Dwayne Hubbard
patches:
  lingon-srtp-key-lifetime-1.8.diff uploaded by oej (License 5267)

ASTERISK-20233
Reported by: tootai

ASTERISK-22748
Reported by: Alejandro Mejia
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-25 21:42:39 +00:00
David M. Lee ff642289f4 Increase WebSocket frame size and improve large read handling
Some WebSocket applications, like [chan_respoke][], require a larger
frame size than the default 8k; this patch bumps the default to 16k.
This patch also fixes some problems exacerbated by large frames.

The sanity counter was decremented on every fread attempt in
ws_safe_read(), regardless of whether data was read from the socket or
not. For large frames, this could result in loss of sanity prior to
reading the entire frame. (16k frame / 1448 bytes per segment = 12
segments).

This patch changes the sanity counter so that it only decrements when
fread() doesn't read any bytes. This more closely matches the original
intention of ws_safe_read(), given that the error message is
"Websocket seems unresponsive".

This patch also properly logs EOF conditions, so disconnects are no
longer confused with unresponsive connections.

 [chan_respoke]: https://github.com/respoke/chan_respoke

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432238 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-25 20:47:39 +00:00
Richard Mudgett 57525c3cf2 config.h: Use real parameter names for ast_variable_new() define.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432220 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-24 23:00:24 +00:00
Matthew Jordan 8574c4d197 channels/chan_sip: Fix crash when transmitting packet after thread shutdown
When the monitor thread is stopped, its pthread ID is set to a specific value
(AST_PTHREADT_STOP) so that later portions of the code can determine whether
or not it is safe to manipulate the thread. Unfortunately, __sip_reliable_xmit
failed to check for that value, checking instead only for AST_PTHREAD_STOP.
Passing the invalid yet very specific value to pthread_kill causes a crash.

This patch adds a check for AST_PTHREADT_STOP in __sip_reliable_xmit such that
it doesn't attempt to poke the thread if the thread has already been stopped.

ASTERISK-24800 #close
Reported by: JoshE
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432200 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-24 22:14:44 +00:00
Matthew Jordan a528dfc9a7 ARI/PJSIP: Apply requesting channel's format cap to created channels
This patch addresses the following problems:
* ari/resource_channels: In ARI, we currently create a format capability
  structure of SLIN and apply it to the new channel being created. This was
  originally done when the PBX core was used to create the channel, as there
  was a condition where a newly created channel could be created without any
  formats. Unfortunately, now that the Dial API is being used, this has two
  drawbacks:
  (a) SLIN, while it will ensure audio will flows, can cause a lot of
      needless transcodings to occur, particularly when a Local channel is
      created to the dialplan. When no format capabilities are available, the
      Dial API handles this better by handing all audio formats to the requsted
      channels. As such, we defer to that API to provide the format
      capabilities.
  (b) If a channel (requester) is causing this channel to be created, we
      currently don't use its format capabilities as we are passing in our own.
      However, the Dial API will use the requester channel's formats if none
      are passed into it, and the requester channel exists and has format
      capabilities. This is the "best" scenario, as it is the most likely to
      create a media path that minimizes transcoding.
  Fixing this simply entails removing the providing of the format capabilities
  structure to the Dial API.

* chan_pjsip: Rather than blindly picking the first format in the format
  capability structure - which actually *can* be a video or text format - we
  select an audio format, and only pick the first format if that fails. That
  minimizes the weird scenario where we attempt to transcode between video/audio.

* res_pjsip_sdp_rtp: Applied the joint capapbilites to the format structure.
  Since ast_request already limits us down to one format capability once the
  format capabilities are passed along, there's no reason to squelch it here.

* channel: Fixed a comment. The reason we have to minimize our requested
  format capabilities down to a single format is due to Asterisk's inability
  to convey the format to be used back "up" a channel chain. Consider the
  following:

    PJSIP/A => L;1 <=> L;2 => PJSIP/B
    g,u,a     g,u,a    g,u,a      u

  That is, we have PJSIP/A dialing a Local channel, where the Local;2 dials
  PJSIP/B. PJSIP/A has native format capabilities g722,ulaw,alaw; the Local
  channel has inherited those format capabilities down the line; PJSIP/B
  supports only ulaw. According to these format capabilities, ulaw is
  acceptable and should be selected across all the channels, and no
  transcoding should occur. However, there is no way to convey this: when L;2
  and PJSIP/B are put into a bridge, we will select ulaw, but that is not
  conveyed to PJSIP/A and L;1. Thus, we end up with:

    PJSIP/A <=> L;1 <=> L;2 <=> PJSIP/B
      g          g   X   u        u

  Which causes g722 to be written to PJSIP/B.

  Even if we can convey the 'ulaw' choice back up the chain (which through
  some severe hacking in Local channels was accomplished), such that the chain
  looks like:

    PJSIP/A <=> L;1 <=> L;2 <=> PJSIP/B
      u          u       u         u

  We have no way to tell PJSIP/A's *channel driver* to Answer in the SDP back
  with only 'ulaw'. This results in all the channel structures being set up
  correctly, but PJSIP/A *still* sending g722 and causing the chain to fall
  apart.

  There's a lot of difficulty just in setting this up, as there are numerous
  race conditions in the act of bridging, and no clean mechanism to pass the
  selected format backwards down an established channel chain. As such, the
  best that can be done at this point in time is clarifying the comment.

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432196 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-24 22:00:51 +00:00
Kevin Harwell 91733b5d15 bridge_softmix: G.729 codec license held
When more than one call using the same codec type enters into a softmix bridge
and no audio is present for a channel the bridge optimizes the out frame by
using the same one for all channels with the same codec type. Unfortunately,
when that number (channels with same codec type) dropped to <= 1 the codec
was not dereferenced. At least not until all parties left the bridge. Thus in
the case of G.729 the license was not released. This patch ensures that the
codec is dereferenced immediately when the optimization no longer applies.

ASTERISK-24797 #close
Reported by: Luke Hulsey
Review: https://reviewboard.asterisk.org/r/4429/
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432176 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-24 18:38:03 +00:00
Joshua Colp bedf51b2ce res_ari_channels: Return a 404 response when a requested channel variable does not exist.
This change makes it so that if a channel variable is requested and it does not exist
a 404 response will be returned instead of an allocation failed response. This makes
it easier to debug and figure out what is going on for a user.

ASTERISK-24677 #close
Reported by: Joshua Colp
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432155 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-21 20:48:17 +00:00
Joshua Colp 87b7060f36 res_pjsip_registrar: Add Expires header to 200 OK if present in REGISTER.
Some implementations don't pay attention to the expires for individual contacts.
In this case they may consider the lack of an Expires header in the 200 OK as
unregistered. This change makes it so if an Expires header is present in the REGISTER
we will add one in the 200 OK.

ASTERISK-24785 #close
Reported by: Ross Beer
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432137 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-21 19:28:09 +00:00
Joshua Colp 283bb15c16 res_pjsip: Add a log message when creating a UAC dialog to a target URI that is invalid.
ASTERISK-24499 #close
Reported by: Rusty Newton
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432119 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-21 18:53:34 +00:00
Matthew Jordan b3c1ad5d73 apps/app_voicemail: Demote an ERROR message to a WARNING message
When using IMAP voicemail with FreePBX, you will often get ERROR messages
complaining about not being able to find a mailbox. This is due to how FreePBX
handles voicemail mailboxes. Unfortunately, app_voicemail has to consider this
a configuration error, as in any other system it would be indicative of
someone misconfiguring their system.

Regardless, a misconfiguration is a WARNING, and not an ERROR. This patch
demotes the message so that system administrators can hopefully reduce some
of the noise in their log files.

Note that in the original patch this was made into a NOTICE, but that's a
too forgiving.

ASTERISK-24790 #close
Reported by: Graham Barnett
patches:
  app_voicemail.c.patch_noise uploaded by Graham Barnett (License 6685)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432100 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-21 17:36:39 +00:00
Joshua Colp 2ea7ccbf70 http: Add missing html tag to 'httpstatus' functionality.
ASTERISK-24724 #close
Reported by: Ashley Sanders
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432080 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-21 14:06:20 +00:00
Corey Farrell e66b874f5d Allow shutdown to unload modules that register bucket scheme's or codec's.
* Change __ast_module_shutdown_ref to be NULL safe (11+).
* Allow modules that call ast_bucket_scheme_register or ast_codec_register
  to be unloaded during graceful shutdown only (13+ only).

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432060 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-21 02:58:19 +00:00
Corey Farrell bb71672a47 main/asterisk.c: Reverse #if statement in listener() to fix code folding.
listener() opens the same code block in two places (#if and #else).  This
confuses some folding editors causing it to think that an extra code block
was opened.  Folding in 'geany' causes all code after listener() to be
folded as if it were part of that procedure.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432057 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-21 02:51:35 +00:00
Corey Farrell ce50fa314a asterisk/lock.h: Fix syntax errors for non-gcc OSX with 64-bit integers.
Add a couple of missing closing brackets / parenthesis.

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432056 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-21 02:47:44 +00:00
Richard Mudgett bb06603d5f chan_dahdi/sig_analog: Put log message strings on one line.
With the log messages on one line, you can search for the log message seen
in the log and expect to find it.
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432036 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-20 17:55:41 +00:00
George Joseph 340818ad12 ASTERISK-24811: Add ast_sorcery_apply_config() to res_pjsip_publish_asterisk.
Matt Hoskins reported that res_pjsip_publish_asterisk wouldn't pull config from 
realtime.  Turns out it was just missing a call ast_sorcery_apply_config().

res_pjsip_acl was missing it as well, so I added it.  The other pjsip modules 
looked OK.

ASTERISK-24811 #close
Reported-by: Matt Hoskins
Tested-by: George Joseph
Tested-by: Matt Hoskins
patches:
	res_pjsip_publish_asterisk.c.patch submitted by Matt Hoskins (license 6688)

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432035 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-20 17:53:33 +00:00
Matthew Jordan 4dab71831f apps/app_voicemail: Fix IMAP header compatibility issue with Microsoft Exchange
When interfacing with Microsoft Exchange, custom headers will be returned as
all lower case. Currently, the IMAP header code will fail to parse the returned
custom headers, as it will be performing a case sensitive comparison. This can
cause playback of messages to fail, as needed information - such as origtime -
will not be present.

This patch updates app_voicemail's header parsing code to perform a case
insensitive lookup for the requested custom headers. Since the headers are
specific to Asterisk, e.g., 'x-asterisk-vm-orig-time', and headers should be
unique in an IMAP message, this should cause no issues with other systems.

ASTERISK-24787 #close
Reported by: Graham Barnett
patches:
  app_voicemail.c.patch_MSExchange uploaded by Graham Barnett (License 6685)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432014 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-20 15:47:46 +00:00
Richard Mudgett 05cc6d6d55 chan_dahdi: Remove some dead code.
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431994 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-19 21:26:55 +00:00
Richard Mudgett 252aee4228 ISDN AOC: Fix crash from an AOC-E message that doesn't have a channel association.
Processing an AOC-E event that does not or no longer has a channel
association causes a crash.

The problem with posting AOC events to the channel topic is that AOC-E
events don't always have a channel association and posting the event to
the all channels topic is just wrong.  AOC-E events do however have their
own charging association method to refer to the agreement with the
charging entity.

* Changed the AOC events to post to the AMI manager topic instead of the
channel topics.  If a channel is associated with the event then channel
snapshot information is supplied with the AMI event.

* Eliminated RAII_VAR() usage in aoc_to_ami() and ast_aoc_manager_event().

This patch supercedes the patch on Review: https://reviewboard.asterisk.org/r/4427/

ASTERISK-22670 #close
Reported by: klaus3000

ASTERISK-24689 #close
Reported by: Marcel Manz

ASTERISK-24740 #close
Reported by: Panos Gkikakis

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431975 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-19 18:26:49 +00:00
Richard Mudgett 6992b2e8fa res_pjsip_refer: Handle INVITE with Replaces failure after answer.
* Fixed hangup handling of the session->channel after answer if the
ast_channel_move() or ast_bridge_impart() fails.  We are still the thread
controlling the session->channel so we need to call ast_hangup() to kill
the channel.

* Fixed debug messages in refer_incoming_invite_request() referencing
incorrect channnels on success.  Code comments now say why the
session->channel cannot be used.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431957 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-19 17:37:00 +00:00
Matthew Jordan e3fd826cdb tcptls: Handle new OpenSSL compile time option to disable SSLv3
Some distributions are going to disable SSLv3 at compile time. This option can
be checked using the directive OPENSSL_NO_SSL3_METHOD. This patch updates the
TCP/TLS handling in Asterisk to look for that directive before attempting to
use the SSLv3 specific methods.

ASTERISK-24799 #close
Reported by: Alexander Traud
patches:
  no-ssl3-method.patch uploaded by Alexander Traud (License 6520)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431938 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-19 15:28:56 +00:00
Corey Farrell a4774ceaa5 Create work around for scheduler leaks during shutdown.
* Added ast_sched_clean_by_callback for cleanup of scheduled events
  that have not yet fired.
* Run all pending peercnt_remove_cb and replace_callno events in chan_iax2.
  Cleanup of replace_callno events is only run 11, since it no longer
  releases any references or allocations in 13+.

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431918 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-19 02:03:01 +00:00
Richard Mudgett 09bfe4b208 res_pjsip_refer: Fix crash from a REFER and BYE collision.
Analyzing a one-off crash on a busy system showed that processing a REFER
request had a NULL session channel pointer.  The only way I can think of
that could cause this is if an outgoing BYE transaction overlapped the
incoming REFER transaction in a collision.  Asterisk sends a BYE while the
phone sends a REFER to complete an attended transfer.

* Made check the session channel pointer before processing an incoming
REFER request in res_pjsip_refer.

* Fixed similar crash potential for res_pjsip supplement incoming request
processing for res_pjsip_sdp_rtp INFO, res_pjsip_caller_id INVITE/UPDATE,
res_pjsip_messaging MESSAGE, and res_pjsip_send_to_voicemail REFER
messages.

* Made res_pjsip_messaging respond to a message body too large with a 413
instead of ignoring it.

ASTERISK-24700 #close
Reported by: Zane Conkle

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431899 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-17 15:34:10 +00:00
Matthew Jordan d808eace5c res/res_rtp_asterisk: Fix crash in debug from RTCP reports without report block
When RTCP debugging was enabled, an RTCP report without a report block would
cause a crash. This was due to the verbose output not checking to see if the
report_block pointer was NULl before dereferencing it.

This patch adds the necessary check to prevent printing any verbose output
if the far side hasn't provided us the information they should have.

ASTERISK-24791 #close
Reported by: JoshE
Tested by: JoshE
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431880 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-16 21:29:39 +00:00
Joshua Colp 55eb8fc068 pjsip: Remove "contact" type from pjsip.conf.sample
The "contact" object is not meant to be configured from the pjsip.conf
configuration file. It is meant to be created as a result of a registration
and stored elsewhere.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431861 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-15 19:01:44 +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
Joshua Colp e78dd39885 res_sorcery_config: Improve object lookup times.
The res_sorcery_config module currently uses a fixed bucket
size of 53. This means that depending on the number of objects
you either end up with excess buckets or a lot of collisions.
Due to the way that res_sorcery_config is implemented it's actually
possible to make the bucket size dynamic based on the number of
objects. This is due to the fact that each loading of the config file
produces a new container and does not modify the existing one.
This change uses the number of expected objects and finds a prime
number near it. In practice depending on the number of objects this
can speed up lookups anywhere from 2X to 15X. This change also removes
the lock from the container as it is not needed.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-15 17:43:21 +00:00
Joshua Colp e6fe69b76c res_pjsip: Add "pjsip show version" CLI command.
When debugging things it can be useful to know absolutely what
version of pjproject res_pjsip is running against. This change
adds a "pjsip show version" CLI command which can be used to
query for this.

ASTERISK-24685 #close
Reported by: Joshua Colp

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431825 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-15 16:01:09 +00:00
Joshua Colp 17f9e0cacc res_timing_pthread: Fix leaky pipes.
During some refactoring the way private information for timers
was stored was changed. As a result of this the action which normally
removed the timer upon closure in res_timing_pthread was also removed
causing the timer to remain after it should using up resources.
This change ensures that the timer is removed upon closure.

ASTERISK-24768 #close
Reported by: Matthias Urlichs
patches:
 timer.patch submitted by Matthias Urlichs (license 5508)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431808 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-15 12:41:06 +00:00
Matthew Jordan d1bd8b091b apps/app_mixmonitor: Move Test Event for MIXMONITOR_END to after it finishes
The Test Event for MIXMONITOR_END - which signals that a MixMonitor has
completed - technically fired before the filestream was closed. If a test
used this to trigger a condition to verify that the file was written, it
could result in a race condition where the file size would not be what the
test expected.

Luckily, no tests were using this (although they should have been). Since the
test event needed to be moved after the point where the MixMonitor autochan has
been destroyed, the test event no longer emits the channel name. Luckily,
nothing needs it.
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431790 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-15 00:33:22 +00:00
Joshua Colp 455a98a2f8 sorcery: Output an error message if a wizard is specified for an object type and it isn't found.
ASTERISK-24612 #close
Reported by: Joshua Colp
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431772 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-14 19:46:09 +00:00
Joshua Colp fae6bf8ace res_pjsip_exten_state: Improve log message when a subscription is attempted to a non-existent extension.
ASTERISK-24716 #close
Reported by: Rusty Newton
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431755 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-14 18:31:15 +00:00
Joshua Colp cc96e4a7ef Multiple revisions 431751-431752
........
  r431751 | file | 2015-02-14 14:19:07 -0400 (Sat, 14 Feb 2015) | 5 lines
  
  chan_pjsip: Fix crash when CHANNEL dialplan function is invoked with pjsip argument and no type.
  
  ASTERISK-24771 #close
  Reported by: Niklas Larsson
........
  r431752 | file | 2015-02-14 14:20:27 -0400 (Sat, 14 Feb 2015) | 2 lines
  
  'information' ends with an 'n'.
........

Merged revisions 431751-431752 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431753 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-14 18:21:02 +00:00
Richard Mudgett f00ebf0a2d res_pjsip_session: Fix double re-INVITE collision crash.
A multi-asterisk box setup with direct media enabled would occasionally
crash when two re-INVITE collisions on a call leg happen in a row.

The re-INVITE logic only had one timer struct to defer the re-INVITE.
When the second collision happens the timer struct is overwritten and put
into the timer heap again.  Resources for the first timer are leaked and
the heap has two positions occupied by the same timer struct.  Now the
heap ordering is potentially corrupted, the timer will fire twice, and any
resources allocated for the second timer will be released twice.

* The solution is to put the collided re-INVITE into the delayed requests
queue with all the other delayed requests and cherry pick the next request
that can come off the queue when an event happens.

* Changed to put delayed BYE requests at the head of the delayed queue.
There is no sense in processing delayed UPDATEs and re-INVITEs when a BYE
has been requested.

* Made the start of a BYE request flush the delayed requests queue to
prevent a delayed request from overlapping the BYE transaction.  I saw a
few cases where a delayed re-INVITE got started after the BYE transaction
started.

* Changed the delayed_request struct to use an enum instead of a string
for the request method.  Cherry picking the queue is easier with an enum
than string comparisons and the compiler can warn if a switch statement
does not cover all defined enum values.

* Improved the debug output to give more information.  It helps to know
which channel is involved with an endpoint.  Trunks can have many channels
associated with the endpoint at the same time.

ASTERISK-24727 #close
Reported by: Mark Michelson

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431735 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-13 17:24:08 +00:00
Matthew Jordan 29f66b0429 ARI/PJSIP: Add the ability to redirect (transfer) a channel in a Stasis app
This patch adds a new feature to ARI to redirect a channel to another server,
and fixes a few bugs in PJSIP's handling of the Transfer dialplan
application/ARI redirect capability.

*New Feature*
A new operation has been added to the ARI channels resource, redirect. With
this, a channel in a Stasis application can be redirected to another endpoint
of the same underlying channel technology.

*Bug fixes*
In the process of writing this new feature, two bugs were fixed in the PJSIP
stack:
(1) The existing .transfer channel callback had the limitation that it could
    only transfer channels to a SIP URI, i.e., you had to pass
    'PJSIP/sip:foo@my_provider.com' to the dialplan application. While this is
    still supported, it is somewhat unintuitive - particularly in a world full
    of endpoints. As such, we now also support specifying the PJSIP endpoint to
    transfer to.
(2) res_pjsip_multihomed was, unfortunately, trying to 'help' a 302 redirect by
    updating its Contact header. Alas, that resulted in the forwarding
    destination set by the dialplan application/ARI resource/whatever being
    rewritten with very incorrect information. Hence, we now don't bother
    updating an outgoing response if it is a 302. Since this took a looong time
    to find, some additional debug statements have been added to those modules
    that update the Contact headers.

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

ASTERISK-24015 #close
Reported by: Private Name

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431718 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-12 20:34:37 +00:00
Kevin Harwell 9d081ed06c res_pjsip: dtls_handler causes Asterisk to crash
There have been a couple of times where a crash occurred in the dtls_handler
section of the code for res_pjsip. Unfortunately, in working this issue the
problem was unable to be reproduced. After looking at the backtraces and
through the code the current best guess as to why this happened might be due
to a reentrance problem and the strtok function. So, the current fix is to
convert the strtok function into the reentrant version of the function,
strtok_r.

ASTERISK-24741 #close
Reported by: Zane Conkle
Review: https://reviewboard.asterisk.org/r/4409/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431699 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11 18:03:01 +00:00
Kevin Harwell cc85e55d88 ari_websockets: removed extra check on websocket session read
When merging the websocket timeout issue (ASTERISK-24701) an extra, almost
duplicate, check was left in the code that should not have been. This removes
it.

ASTERISK-24701 #close
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/4412/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431695 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11 17:45:00 +00:00
Richard Mudgett e2d3215b83 HTTP: Stop accepting requests on final system shutdown.
There are three CLI commands to stop and restart Asterisk each.

1) core stop/restart now - Hangup all calls and stop or restart Asterisk.
New channels are prevented while the shutdown request is pending.

2) core stop/restart gracefully - Stop or restart Asterisk when there are
no calls remaining in the system.  New channels are prevented while the
shutdown request is pending.

3) core stop/restart when convenient - Stop or restart Asterisk when there
are no calls in the system.  New calls are not prevented while the
shutdown request is pending.

ARI has made stopping/restarting Asterisk more problematic.  While a
shutdown request is pending it is desirable to continue to process ARI
HTTP requests for current calls.  To handle the current calls while a
shutdown request is pending, a new committed to shutdown phase is needed
so ARI applications can deal with the calls until the system is fully
committed to shutdown.

* Added a new shutdown committed phase so ARI applications can deal with
calls until the final committed to shutdown phase is reached.

* Made refuse new HTTP requests when the system has reached the final
system shutdown phase.  Starting anything while the system is actively
releasing resources and unloading modules is not a good thing.

* Split the bridging framework shutdown to not cleanup the global bridging
containers when shutting down in a hurry.  This is similar to how other
modules prevent crashes on rapid system shutdown.

* Moved ast_begin_shutdown(), ast_cancel_shutdown(), and
ast_shutting_down().  You should not have to include channel.h just to
access these system functions.

ASTERISK-24752 #close
Reported by: Matthew Jordan

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431694 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11 17:39:13 +00:00
Matthew Jordan 5a17ed7a38 channels/chan_sip: Fix RealTime error during SIP unregistration with MariaDB
When a SIP device that has its registration stored in RealTime unregisters,
the entry for that device is updated with blank values, i.e., "", indicating
that it is no longer registered. Unfortunately, one of those values that is
'blanked' is the device's port. If the column type for the port is not a
string datatype (the recommended type is integer), an ODBC or database error
will be thrown. MariaDB does not coerce empty strings to a valid integer value.

This patch updates the query run from chan_sip such that it replaces the port
value with a value of '0', as opposed to a blank value. This is the value that
other database backends coerce the empty string ("") to already, and the
handling of reading a RealTime registration value from a backend already
anticipates receiving a port of '0' from the backends.

ASTERISK-24772 #close
Reported by: Richard Miller
patches:
  chan_sip.diff uploaded by Richard Miller (License 5685)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431675 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11 17:13:28 +00:00
Corey Farrell 8cc50b1ebc Enable REF_DEBUG for ast_module_ref / ast_module_unref.
Add ast_module_shutdown_ref for use by modules that can
only be unloaded during graceful shutdown.

When REF_DEBUG is enabled:
* Add an empty ao2 object to struct ast_module.
* Allocate ao2 object when the module is loaded.
* Perform an ao2_ref in each place where mod->usecount is manipulated.
* ao2_cleanup on module unload.

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431672 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11 17:03:04 +00:00
Kevin Harwell 137c4b0778 res_http_websocket: websocket write timeout fails to fully disconnect
When writing to a websocket if a timeout occurred the underlying socket did not
get closed/disconnected. This patch makes sure the websocket gets disconnected
on a write timeout. Also a notice is logged stating that the websocket was
disconnected.

ASTERISK-24701 #close
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/4412/
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431671 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11 16:52:55 +00:00
George Joseph 49161d8df8 res_pjsip_config_wizard: Add ability to auto-create hints.
Looking at the Super Awesome Company sample reminded me that creating hints is 
just plain gruntwork.  So you can now have the pjsip conifg wizard auto-create 
them for you.

Specifying 'hint_exten' in the wizard will create 
'exten => <hint_exten>,hint/PJSIP/<wizard_id>'
in whatever is specified for 'hint_context'.

Specifying 'hint_application' in the wizard will create
'exten => <hint_exten>,1,<hint_application>'
in whatever is specified for 'hint_context'.

The default for 'hint_context' is the endpoint's context.
There's no default for 'hint_application'.  If not specified, no app is added.
There's no default for 'hint_exten'.  If not specified, neither the hint itself 
nor the application will be created.

Some may think this is the slippery slope to users.conf but hints are a basic 
necessity for phones unlike voicemail, manager, etc that users.conf creates.

Tested-by: George Joseph
Review: https://reviewboard.asterisk.org/r/4383/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431644 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-10 23:17:17 +00:00
Matthew Jordan 858e825568 res/ari/resource_channels: Add missing 'no_answer' reason to DELETE /channels
One of the canonical reasons for hanging up a channel is because the far end
failed to answer - or because someone else answered, and we want to get rid of
this channel. This patch adds the missing value to the 'reason' query parameter
for the DELETE /channels operation.

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

ASTERISK-24745 #close
Reported by: Ben Merrills
patches:
  add_no_answer_ari_hangup_cause.diff uploaded by Ben Merrills (License 6678)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-09 03:12:16 +00:00
Matthew Jordan 17247daae6 res/res_odbc: Remove unneeded queries when determining if a table exists
This patch modifies the ast_odbc_find_table function such that it only performs
a lookup of the requested table if the table is not already known. Prior to
this patch, a queries would be executed against the database even if the table
was already known and cached.

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

ASTERISK-24742 #close
Reported by: ibercom
patches:
  patch.diff uploaded by ibercom (License 6599)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431619 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-09 02:35:31 +00:00
Matthew Jordan 2ebe811d80 res/res_pjsip_sdp_rtp: Fix leak of local ICE candidates when applying to SDP
When an SDP is created for an outgoing request/response, the ICE candidates
obtained from the RTP instance are currently leaked. This causes the ao2
container that holds the candidates to never properly be reclaimed when the
RTP instance is destroyed.

This patch properly decrements the ICE candidates' container if it is
successfully obtained.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431601 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-08 17:24:22 +00:00
Scott Griepentrog 7ca1a0da04 various: cleanup issues found during leak hunt
In this collection of small patches to prevent
Valgrind errors are: fixes for reference leaks
in config hooks, evaluating a parameter beyond
bounds, and accessing a structure after a lock
where it could have been already free'd.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431584 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-06 21:26:46 +00:00
Joshua Colp a79c920aa1 res_pjsip_keepalive: Don't crash if PJSIP module is not loaded.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431556 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-04 01:27:52 +00:00
Joshua Colp 03ce56d6c5 sorcery: Don't try to load object types which haven't been defined.
The act of defining wizards for an object type in sorcery.conf will
create a minimal object type. This can cause a problem when a module
has multiple sorcery instances (which all get the wizards from sorcery.conf
applied) but the sorcery instances do not all contain full information
about the object types. Upon loading errors will occur stating that
the objects can not be created. This is confusing and is actually
perfectly fine.

This change makes it so that only object types which have been fully
defined will be loaded.

ASTERISK-24748 #close
Reported by: Joshua Colp
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-04 00:59:14 +00:00
Joshua Colp 14a57782a6 res_format_attr_h264: Fix crash when determining joint capability.
The res_format_attr_h264 module currently incorrectly attempts to
copy SPS and PPS information from the wrong attribute. This change
fixes that.

ASTERISK-24616 #close
Reported by: Yura Kocyuba

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431522 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-31 16:28:33 +00:00