]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
7 years agoUpdate for certified/13.13-cert9 certified/13.13 certified/13.13-cert9
George Joseph [Wed, 13 Dec 2017 14:34:09 +0000 (09:34 -0500)] 
Update for certified/13.13-cert9

7 years agoAST-2017-012: Place single RTCP report block at beginning of report.
Joshua Colp [Thu, 30 Nov 2017 16:12:55 +0000 (16:12 +0000)] 
AST-2017-012: Place single RTCP report block at beginning of report.

When the RTCP code was transitioned over to Stasis a code change
was made to keep track of how many reports are present. This count
controlled where report blocks were placed in the RTCP report.

If a compound RTCP packet was received this logic would incorrectly
place a report block in the wrong location resulting in a write
to an invalid location.

This change removes this counting logic and always places the report
block at the first position. If in the future multiple reports are
supported the logic can be extended but for now keeping a count
serves no purpose.

ASTERISK-27382
ASTERISK-27429

Change-Id: Iad6c8a9985c4b608ef493e19c421211615485116

7 years agoCDR: Fix deadlock setting some CDR values.
Richard Mudgett [Wed, 6 Dec 2017 00:04:47 +0000 (18:04 -0600)] 
CDR: Fix deadlock setting some CDR values.

Setting channel variables with the AMI Originate action caused a deadlock
when you set CDR(amaflags) or CDR(accountcode).  This path has the channel
locked when the CDR function is called.  The CDR function then
synchronously passes the job to a stasis thread.  The stasis handling
function then attempts to lock the channel.  Deadlock results.

* Avoid deadlock by making the CDR function handle setting amaflags and
accountcode directly on the channel rather than passing it off to the CDR
processing code under a stasis thread to do it.

* Made the CHANNEL function and the CDR function process amaflags the same
way.

* Fixed referencing the wrong message type in cdr_prop_write().

ASTERISK-27460

Change-Id: I5eacb47586bc0b8f8ff76a19bd92d1dc38b75e8f

7 years agoUpdate for certified/13.13-cert8 certified/13.13-cert8
George Joseph [Fri, 1 Dec 2017 19:42:21 +0000 (14:42 -0500)] 
Update for certified/13.13-cert8

7 years agoAST-2017-013: chan_skinny: Call pthread_detach when sess threads end
George Joseph [Thu, 30 Nov 2017 20:38:50 +0000 (13:38 -0700)] 
AST-2017-013: chan_skinny: Call pthread_detach when sess threads end

chan_skinny creates a new thread for each new session.  In trying
to be a good cleanup citizen, the threads are joinable and the
unload_module function does a pthread_cancel() and a pthread_join()
on any sessions that are active at that time.  This has an
unintended side effect though. Since you can call pthread_join on a
thread that's already terminated, pthreads keeps the thread's
storage around until you explicitly call pthread_join (or
pthread_detach()).   Since only the module_unload function was
calling pthread_join, and even then only on the ones active at the
tme, the storage for every thread/session ever created sticks
around until asterisk exits.

* A thread can detach itself so the session_destroy() function
  now calls pthread_detach() just before it frees the session
  memory allocation.  The module_unload function still takes care
  of the ones that are still active should the module be unloaded.

ASTERISK-27452
Reported by: Juan Sacco

Change-Id: I9af7268eba14bf76960566f891320f97b974e6dd

7 years agopjsip: Add patch to allow all transports to be destroyed.
Joshua Colp [Fri, 10 Nov 2017 13:06:38 +0000 (13:06 +0000)] 
pjsip: Add patch to allow all transports to be destroyed.

If a transport is created with the same transport type, source
IP address, and source port as one that already exists the old
transport is moved into a linked list called "tp_list".

If this old transport is later shutdown it will not be destroyed
as the process checks whether the transport is valid or not. This
check does not look at the "tp_list" when making the determination
causing the transport to not be destroyed.

This change updates the logic to query not just the main storage
method for transports but also the "tp_list".

Upstream issue https://trac.pjsip.org/repos/ticket/2061

ASTERISK-27411

Change-Id: Ic5c2bb60226df0ef1c8851359ed8d4cd64469429

7 years agoUpdate for certified/13.13-cert7 certified/13.13-cert7
George Joseph [Wed, 8 Nov 2017 16:59:06 +0000 (11:59 -0500)] 
Update for certified/13.13-cert7

7 years agoMerge "AST-2017-009: pjproject: Add validation of numeric header values" into certifi...
George Joseph [Wed, 8 Nov 2017 15:53:20 +0000 (09:53 -0600)] 
Merge "AST-2017-009: pjproject: Add validation of numeric header values" into certified/13.13

7 years agoMerge "AST-2017-011 - res_pjsip_session: session leak when a call is rejected" into...
George Joseph [Wed, 8 Nov 2017 15:45:16 +0000 (09:45 -0600)] 
Merge "AST-2017-011 - res_pjsip_session: session leak when a call is rejected" into certified/13.13

7 years agoAST-2017-009: pjproject: Add validation of numeric header values
George Joseph [Thu, 19 Oct 2017 18:53:32 +0000 (12:53 -0600)] 
AST-2017-009: pjproject: Add validation of numeric header values

Parsing the numeric header fields like cseq, ttl, port, etc. all
had the potential to overflow, either causing unintended values to
be captured or, if the values were subsequently converted back to
strings, a buffer overrun.  To address this, new "strto" functions
have been created that do range checking and those functions are
used wherever possible in the parser.

 * Created pjlib/include/limits.h and pjlib/include/compat/limits.h
   to either include the system limits.h or define common numeric
   limits if there is no system limits.h.

 * Created strto*_validate functions in sip_parser that take bounds
   and on failure call the on_str_parse_error function which prints
   an error message and calls PJ_THROW.

 * Updated sip_parser to validate the numeric fields.

 * Fixed an issue in sip_transport that prevented error messages
   from being properly displayed.

 * Added "volatile" to some variables referenced in PJ_CATCH blocks
   as the optimizer was sometimes optimizing them away.

 * Fixed length calculation in sip_transaction/create_tsx_key_2543
   to account for signed ints being 11 characters, not 9.

ASTERISK-27319
Reported by: Youngsung Kim at LINE Corporation

Change-Id: I48de2e4ccf196990906304e8d7061f4ffdd772ff

7 years agoAST-2017-011 - res_pjsip_session: session leak when a call is rejected
Kevin Harwell [Thu, 19 Oct 2017 18:35:16 +0000 (13:35 -0500)] 
AST-2017-011 - res_pjsip_session: session leak when a call is rejected

A previous commit made it so when an invite session transitioned into a
disconnected state destruction of the Asterisk pjsip session object was
postponed until either a transport error occurred or the event timer
expired. However, if a call was rejected (for instance a 488) before the
session was fully established the event timer may not have been initiated,
or it was canceled without triggering either of the session finalizing states
mentioned above.

Really the only time destruction of the session should be delayed is when a
BYE is being transacted. This is because it's possible in some cases for the
session to be disconnected, but the BYE is still transacting.

This patch makes it so the session object always gets released (no more
memory leak) when the pjsip session is in a disconnected state. Except when
the method is a BYE. Then it waits until a transport error occurs or an event
timeout.

ASTERISK-27345 #close

Reported by: Corey Farrell

Change-Id: I1e724737b758c20ac76d19d3611e3d2876ae10ed

7 years agoAST-2017-010: Fix cdr_object_update_party_b_userfield_cb() buf overrun
Richard Mudgett [Tue, 3 Oct 2017 21:19:52 +0000 (16:19 -0500)] 
AST-2017-010: Fix cdr_object_update_party_b_userfield_cb() buf overrun

cdr_object_update_party_b_userfield_cb() could overrun the fixed buffer if
the supplied string is too long.  The long string could be supplied by
external means using the CDR(userfield) function.

This may seem reminiscent to AST-2017-001 (ASTERISK_26897) and it is.  The
earlier patch fixed the buffer overrun for Party A's userfield while this
patch fixes the same thing for Party B's userfield.

ASTERISK-27337

Change-Id: I0fa767f65ecec7e676ca465306ff9e0edbf3b652

7 years agoUpdate for certified/13.13-cert6 certified/13.13-cert6
Joshua Colp [Tue, 19 Sep 2017 16:09:42 +0000 (11:09 -0500)] 
Update for certified/13.13-cert6

7 years agoAST-2017-008: Improve RTP and RTCP packet processing.
Richard Mudgett [Fri, 25 Aug 2017 22:05:06 +0000 (17:05 -0500)] 
AST-2017-008: Improve RTP and RTCP packet processing.

Validate RTCP packets before processing them.

* Validate that the received packet is of a minimum length and apply the
RFC3550 RTCP packet validation checks.

* Fixed potentially reading garbage beyond the received RTCP record data.

* Fixed rtp->themssrc only being set once when the remote could change
the SSRC.  We would effectively stop handling the RTCP statistic records.

* Fixed rtp->themssrc to not treat a zero value as special by adding
rtp->themssrc_valid to indicate if rtp->themssrc is available.

ASTERISK-27274

Make strict RTP learning more flexible.

Direct media can cause strict RTP to attempt to learn a remote address
again before it has had a chance to learn the remote address the first
time.  Because of the rapid relearn requests, strict RTP could latch onto
the first remote address and fail to latch onto the direct media remote
address.  As a result, you have one way audio until the call is placed on
and off hold.

The new algorithm learns remote addresses for a set time (1.5 seconds)
before locking the remote address.  In addition, we must see a configured
number of remote packets from the same address in a row before switching.

* Fixed strict RTP learning from always accepting the first new address
packet as the new stream.

* Fixed strict RTP to initialize the expected sequence number with the
last received sequence number instead of the last transmitted sequence
number.

* Fixed the predicted next sequence number calculation in
rtp_learning_rtp_seq_update() to handle overflow.

ASTERISK-27252

Change-Id: Ia2d3aa6e0f22906c25971e74f10027d96525f31c

7 years agostasis/control: Fix possible deadlock with swap channel
George Joseph [Fri, 1 Sep 2017 10:17:02 +0000 (04:17 -0600)] 
stasis/control:  Fix possible deadlock with swap channel

If an error occurs during a bridge impart it's possible that
the "bridge_after" callback might try to run before
control_swap_channel_in_bridge has been signalled to continue.
Since control_swap_channel_in_bridge is holding the control lock
and the callback needs it, a deadlock will occur.

* control_swap_channel_in_bridge now only holds the control
  lock while it's actually modifying the control structure and
  releases it while the bridge impart is running.
* bridge_after_cb is now tolerant of impart failures.

Change-Id: Ifd239aa93955b3eb475521f61e284fcb0da2c3b3

7 years agoUpdate for certified/13.13-cert5 certified/13.13-cert5
Kevin Harwell [Thu, 31 Aug 2017 15:48:30 +0000 (10:48 -0500)] 
Update for certified/13.13-cert5

7 years agoMerge "res_rtp_asterisk: Only learn a new source in learn state." into certified...
Joshua Colp [Thu, 31 Aug 2017 11:38:00 +0000 (06:38 -0500)] 
Merge "res_rtp_asterisk: Only learn a new source in learn state." into certified/13.13

7 years agoAST-2017-006: Fix app_minivm application MinivmNotify command injection
Corey Farrell [Sun, 2 Jul 2017 00:24:27 +0000 (20:24 -0400)] 
AST-2017-006: Fix app_minivm application MinivmNotify command injection

An admin can configure app_minivm with an externnotify program to be run
when a voicemail is received.  The app_minivm application MinivmNotify
uses ast_safe_system() for this purpose which is vulnerable to command
injection since the Caller-ID name and number values given to externnotify
can come from an external untrusted source.

* Add ast_safe_execvp() function.  This gives modules the ability to run
external commands with greater safety compared to ast_safe_system().
Specifically when some parameters are filled by untrusted sources the new
function does not allow malicious input to break argument encoding.  This
may be of particular concern where CALLERID(name) or CALLERID(num) may be
used as a parameter to a script run by ast_safe_system() which could
potentially allow arbitrary command execution.

* Changed app_minivm.c:run_externnotify() to use the new ast_safe_execvp()
instead of ast_safe_system() to avoid command injection.

* Document code injection potential from untrusted data sources for other
shell commands that are under user control.

ASTERISK-27103

Change-Id: I7552472247a84cde24e1358aaf64af160107aef1

7 years agores_rtp_asterisk: Only learn a new source in learn state.
Joshua Colp [Mon, 22 May 2017 15:36:38 +0000 (15:36 +0000)] 
res_rtp_asterisk: Only learn a new source in learn state.

This change moves the logic which learns a new source address
for RTP so it only occurs in the learning state. The learning
state is entered on initial allocation of RTP or if we are
told that the remote address for the media has changed. While
in the learning state if we continue to receive media from
the original source we restart the learning process. It is
only once we receive a sufficient number of RTP packets from
the new source that we will switch to it. Once this is done
the closed state is entered where all packets that do not
originate from the expected source are dropped.

The learning process has also been improved to take into
account the time between received packets so a flood of them
while in the learning state does not cause media to be switched.

Finally RTCP now drops packets which are not for the learned
SSRC if strict RTP is enabled.

ASTERISK-27013

Change-Id: I56a96e993700906355e79bc880ad9d4ad3ab129c

8 years agores_musiconhold: Add kill_escalation_delay, kill_method to class
George Joseph [Tue, 11 Jul 2017 12:26:27 +0000 (06:26 -0600)] 
res_musiconhold:  Add kill_escalation_delay, kill_method to class

By default, when res_musiconhold reloads or unloads, it sends a HUP
signal to custom applications (and all descendants), waits 100ms,
then sends a TERM signal, waits 100ms, then finally sends a KILL
signal.  An application which is interacting with an external
device and/or spawns children of its own may not be able to exit
cleanly in the default times, expecially if sent a KILL signal, or
if it's children are getting signals directly from
res_musiconhoild.

* To allow extra time, the 'kill_escalation_delay'
  class option can be used to set the number of milliseconds
  res_musiconhold waits before escalating kill signals, with the
  default being the current 100ms.

* To control to whom the signals are sent, the "kill_method" class
  option can be set to "process_group" (the default, existing
  behavior), which sends signals to the application and its
  descendants directly, or "process" which sends signals only to the
  application itself.

Change-Id: Iff70a1a9405685a9021a68416830c0db5158603b

8 years agoMerge "pjsip_distributor.c: Fix deadlock with TCP type transports." into certified...
Jenkins2 [Wed, 5 Jul 2017 20:36:26 +0000 (15:36 -0500)] 
Merge "pjsip_distributor.c: Fix deadlock with TCP type transports." into certified/13.13

8 years agopjsip_distributor.c: Fix deadlock with TCP type transports.
Richard Mudgett [Thu, 29 Jun 2017 23:27:20 +0000 (18:27 -0500)] 
pjsip_distributor.c: Fix deadlock with TCP type transports.

When a SIP message comes in on a transport, pjproject obtains the lock on
the transport and pulls the data out of the socket.  Unlike UDP, the TCP
transport does not allow concurrent access.  Without concurrency the
transport lock is not released when the transport's message complete
callback is called.  The processing continues and eventually Asterisk
starts processing the SIP message.  The first thing Asterisk tries to do
is determine the associated dialog of the message to determine the
associated serializer.  To get the associated serializer safely requires
us to get the dialog lock.

To send a request or response message for a dialog, pjproject obtains the
dialog lock and then obtains the transport lock.  Deadlock can result
because of the opposite order the locks are obtained.

* Fix the deadlock by obtaining the serializer associated with the dialog
another way that doesn't involve obtaining the dialog lock.  In this case,
we use an ao2 container to hold the associated endpoint and serializer.
The new locks are held a brief time and won't overlap other existing lock
times.

ASTERISK-27090 #close

Change-Id: I9ed63f4da9649e9db6ed4be29c360968917a89bd

8 years agochan_pjsip: Fix ability to send UPDATE on COLP
George Joseph [Thu, 29 Jun 2017 19:50:14 +0000 (13:50 -0600)] 
chan_pjsip:  Fix ability to send UPDATE on COLP

When connected_line_method is "invite", we're supposed to determine
if the client can support UPDATE and if it can, send UPDATE instead
of INVITE to avoid the SDP renegotiation.  Not only was pjproject
not setting the PJSIP_INV_SUPPORT_UPDATE flag, we were testing
that invite_tsx wasn't NULL which isn't always the case.

* Updated chan_pjsip/update_connected_line_information to drop the
  requirement that invite_tsx isn't NULL.
* Submitted patch to pjproject sip_inv.c that sets the
  PJSIP_INV_SUPPORT_UPDATE flag correctly.
* Updated pjsip.conf.sample to clarify what happens when "invite"
  is specified.

ASTERISK-27095

Change-Id: Ic2381b3567b8052c616d96fbe79564c530e81560

8 years agoMerge "core_local: local channel data not being properly unref'ed and unlocked" into...
Joshua Colp [Wed, 21 Jun 2017 23:15:02 +0000 (18:15 -0500)] 
Merge "core_local: local channel data not being properly unref'ed and unlocked" into certified/13.13

8 years agocore_local: local channel data not being properly unref'ed and unlocked
Kevin Harwell [Tue, 20 Jun 2017 20:41:14 +0000 (15:41 -0500)] 
core_local: local channel data not being properly unref'ed and unlocked

In an earlier version of Asterisk a local channel [un]lock all functions were
added in order to keep a crash from occurring when a channel hung up too early
during an attended transfer. Unfortunately, when a transfer failure occurs and
depending on the timing, the local channels sometime do not get properly
unlocked and deref'ed after being locked and ref'ed. This happens because the
underlying local channel structure gets NULLed out before unlocking.

This patch reworks those [un]lock functions and makes sure the values that get
locked and ref'ed later get unlocked and deref'ed.

ASTERISK-27074 #close

Change-Id: Ice96653e29bd9d6674ed5f95feb6b448ab148b09

8 years agobridge: stuck channel(s) after failed attended transfer
Kevin Harwell [Tue, 20 Jun 2017 21:01:48 +0000 (16:01 -0500)] 
bridge: stuck channel(s) after failed attended transfer

If an attended transfer failed it was possible for some of the channels
involved to get "stuck" because Asterisk was not hanging up the transfer target.

This patch ensures Asterisk hangs up the transfer target when an attended
transfer failure occurs.

ASTERISK-27075 #close

Change-Id: I98a6ecd92d3461ab98c36f0d9451d23adaf3e5f9

8 years agores_pjsip_refer/session: Calls dropped during transfer
Kevin Harwell [Tue, 13 Jun 2017 19:17:29 +0000 (14:17 -0500)] 
res_pjsip_refer/session: Calls dropped during transfer

When doing an attended transfer it's possible for the transferer, after
receiving an accepted response from Asterisk, to send a BYE to Asterisk,
which can then be processed before Asterisk has time to start and/or
complete the transfer process. This of course causes the transfer to not
complete successfully, thus dropping the call.

This patch makes it so any BYEs received from the transferer, after the REFER,
that initiate a session end are deferred until the transfer is complete. This
allows the channel that would have otherwise been hung up by Asterisk to
remain available throughout the transfer process.

ASTERISK-27053 #close

Change-Id: I43586db79079457d92d71f1fd993be9a3b409d5a

8 years agoUpdate for certified/13.13-cert4 certified/13.13-cert4
Matthew Fredrickson [Fri, 19 May 2017 20:45:57 +0000 (15:45 -0500)] 
Update for certified/13.13-cert4

8 years agoMerge "AST-2017-004: chan_skinny: Add EOF check in skinny_session" into certified...
Matthew Fredrickson [Fri, 19 May 2017 20:11:26 +0000 (15:11 -0500)] 
Merge "AST-2017-004: chan_skinny:  Add EOF check in skinny_session" into certified/13.13

8 years agoMerge "AST-2017-003: Handle zero-length body parts correctly." into certified/13.13
Matthew Fredrickson [Fri, 19 May 2017 20:11:16 +0000 (15:11 -0500)] 
Merge "AST-2017-003: Handle zero-length body parts correctly." into certified/13.13

8 years agoAST-2017-004: chan_skinny: Add EOF check in skinny_session
George Joseph [Thu, 13 Apr 2017 16:14:48 +0000 (10:14 -0600)] 
AST-2017-004: chan_skinny:  Add EOF check in skinny_session

The while(1) loop in skinny_session wasn't checking for EOF so
a packet that was longer than a header but still truncated
would spin the while loop infinitely.  Not only does this
permanently tie up a thread and drive a core to 100% utilization,
the call of ast_log() in such a tight loop eats all available
process memory.

Added poll with timeout to top of read loop

ASTERISK-26940 #close
Reported-by: Sandro Gauci
Change-Id: I2ce65f3c5cb24b4943a9f75b64d545a1e2cd2898

8 years agoAST-2017-003: Handle zero-length body parts correctly.
Mark Michelson [Thu, 13 Apr 2017 22:17:36 +0000 (17:17 -0500)] 
AST-2017-003: Handle zero-length body parts correctly.

ASTERISK-26939 #close

Change-Id: I7ea235ab39833a187db4e078f0788bd0af0a24fd

8 years agoAST-2017-002: Ensure transaction key buffer is large enough.
Mark Michelson [Thu, 13 Apr 2017 22:16:42 +0000 (17:16 -0500)] 
AST-2017-002: Ensure transaction key buffer is large enough.

ASTERISK-26938 #close

Change-Id: I266490792fd8896a23be7cb92f316b7e69356413

8 years agoUpdate for certified/13.13-cert3 certified/13.13-cert3
Joshua Colp [Tue, 4 Apr 2017 12:37:14 +0000 (07:37 -0500)] 
Update for certified/13.13-cert3

8 years agoCDR: Protect from data overflow in ast_cdr_setuserfield.
Corey Farrell [Mon, 27 Mar 2017 14:03:49 +0000 (10:03 -0400)] 
CDR: Protect from data overflow in ast_cdr_setuserfield.

ast_cdr_setuserfield wrote to a fixed length field using strcpy. This could
result in a buffer overrun when called from chan_sip or func_cdr. This patch
adds a maximum bytes written to the field by using ast_copy_string instead.

ASTERISK-26897 #close
patches:
  0001-CDR-Protect-from-data-overflow-in-ast_cdr_setuserfie.patch submitted
    by Corey Farrell (license #5909)

Change-Id: Ib23ca77e9b9e2803a450e1206af45df2d2fdf65c

8 years agoapp_queue: Member stuck as pending after forwarding previous call from queue
Robert Mordec [Tue, 14 Mar 2017 14:27:56 +0000 (15:27 +0100)] 
app_queue: Member stuck as pending after forwarding previous call from queue

Queue member will get stuck in pending_members if queue calls a device
that is different from the one observed for state changes.

This patch removes members from pending_members as a result of channel stasis
events such as blind or attended transfers and hangup.

ASTERISK-26862 #close

Change-Id: I8bf6df487b9bb35726c08049ff25cdad5e357727

8 years agoUpdate for certified/13.13-cert2 certified/13.13-cert2
Richard Mudgett [Tue, 7 Mar 2017 18:43:07 +0000 (13:43 -0500)] 
Update for certified/13.13-cert2

8 years agochan_pjsip: fix switching sending codec when asymmetric_rtp_codec=no 71/5071/1
Alexei Gradinari [Tue, 15 Nov 2016 21:01:27 +0000 (16:01 -0500)] 
chan_pjsip: fix switching sending codec when asymmetric_rtp_codec=no

The sending codec is switched to the receiving codec and then
is switched back to the best native codec on EVERY receiving RTP packets.
This is because after call of ast_channel_set_rawwriteformat there is call
of ast_set_write_format which calls set_format which sets rawwriteformat
to the best native format.

This patch adds a new function ast_set_write_format_path which set
specific write path on channel and uses this function to switch
the sending codec.

ASTERISK-26603 #close

Change-Id: I5b7d098f8b254ce8f45546e6c36e5d324737f71d
(cherry picked from commit cf6d13180effc92a2483dccc68f2f188689a40fa)

8 years agopjproject: Fixes to resolve DNS SRV crashes. 41/5041/1
Richard Mudgett [Mon, 13 Feb 2017 23:11:06 +0000 (17:11 -0600)] 
pjproject: Fixes to resolve DNS SRV crashes.

* Re #1945 (misc): Don't trigger SRV complete callback when there is a
parse error.

* srv_resolver.c: Don't try to send query if already considered resolved.

** In resolve_hostnames() don't try to resolve a query that is already
considered resolved.

** In resolve_hostnames() fix DNS typo in comments.

** In build_server_entries() move a common expression assigning to cnt
earlier.

* sip_transport.c: Fix tdata object name to actually contain the pointer.

It helps if the logs referencing a tdata object buffer actually have a
name that includes the correct pointer as part of the name.  Also since
the tdata has its own pool it helps if any logs referencing the pool have
the same name as the tdata object.  This change brings tdata logging in
line with how tsx objects are named.

ASTERISK-26669 #close
ASTERISK-26738 #close

Change-Id: I56af2ded25476b3e870ca586ee69ed6954ef75af

8 years agopjproject: Increase SENDER_WIDTH column size for 64-bit system logs. 40/5040/1
Richard Mudgett [Mon, 20 Feb 2017 19:38:58 +0000 (13:38 -0600)] 
pjproject: Increase SENDER_WIDTH column size for 64-bit system logs.

ASTERISK-26669
ASTERISK-26738

Change-Id: Ibae6fc8cae69a1f04df0c577c4c11200499d6fe0

8 years agopjsip_distributor.c: Update some debug messages to get transaction name. 39/5039/1
Richard Mudgett [Mon, 6 Feb 2017 20:26:30 +0000 (14:26 -0600)] 
pjsip_distributor.c: Update some debug messages to get transaction name.

* Removed overloaded unmatched response ignore.  We obviously sent the
request so we shouldn't ignore it because it isn't new work.

ASTERISK-26669
ASTERISK-26738

Change-Id: I55fb5cadc83a8e6699b347c6dc7fa32c5a617d37

8 years agores_pjsip: Record the serializer earlier on the tdata. 38/5038/1
Richard Mudgett [Sat, 4 Feb 2017 22:00:14 +0000 (16:00 -0600)] 
res_pjsip: Record the serializer earlier on the tdata.

When PJPROJECT needs to do a DNS resolution and there is not a cached
entry available, the SIP request message goes out on the PJSIP monitor
thread instead of the original serializer thread.  Thus when the response
comes back it does not get processed by the original sending serializer.

This patch records the serializer on tdata before passing a request
message to PJPROJECT where it can in Asterisk code.  There are several
places in PJPROJECT for outbound registration and publishing support that
would need to record the serializer.  Unfortunately, without replacing the
PJPROJECT DNS resolver as was done in v14 we cannot fix those without
modifying PJPROJECT.

Even if we backported the DNS resolver from v14, the outbound registration
refresh timer does not go out on a serializer thread but the PJSIP monitor
thread.  Fortunately, Asterisk's outbound publish support doesn't use the
auto refresh timer that would also not go out under the serializer thread.

This patch is v13 only.

ASTERISK-26669
ASTERISK-26738

Change-Id: I9997b9ed6dbcebd2c37d6a67dc6dcee9c78914a4

8 years agoUpdate for certified/13.13-cert1 certified/13.13-cert1
George Joseph [Mon, 13 Feb 2017 19:25:52 +0000 (14:25 -0500)] 
Update for certified/13.13-cert1

8 years agoUpdate for certified/13.13-cert1-rc4 certified/13.13-cert1-rc4
George Joseph [Wed, 8 Feb 2017 18:58:00 +0000 (13:58 -0500)] 
Update for certified/13.13-cert1-rc4

8 years agoRevert "Update qualifies when AOR configuration changes." 05/4905/1
Mark Michelson [Wed, 8 Feb 2017 17:50:11 +0000 (11:50 -0600)] 
Revert "Update qualifies when AOR configuration changes."

This reverts commit 6492e91392b8fd394193e411c6eb64b45486093f.

The change in question was intended to prevent the need to reload in
order to update qualifies on contacts when an AOR changes. However, this
ended up causing a deadlock instead.

Change-Id: I1a835c90a5bb65b6dc3a1e94cddc12a4afc3d71e

8 years agoUpdate for certified/13.13-cert1-rc3 certified/13.13-cert1-rc3
Mark Michelson [Fri, 3 Feb 2017 19:58:32 +0000 (14:58 -0500)] 
Update for certified/13.13-cert1-rc3

8 years agoMerge "Update qualifies when AOR configuration changes." into certified/13.13
zuul [Fri, 3 Feb 2017 15:24:33 +0000 (09:24 -0600)] 
Merge "Update qualifies when AOR configuration changes." into certified/13.13

8 years agoMerge "channel.c: Fix unbalanced read queue deadlocking local channels." into certifi...
zuul [Fri, 3 Feb 2017 05:54:09 +0000 (23:54 -0600)] 
Merge "channel.c: Fix unbalanced read queue deadlocking local channels." into certified/13.13

8 years agoMerge "astobj2.c: Add excessive ref count trap." into certified/13.13
George Joseph [Fri, 3 Feb 2017 05:27:55 +0000 (23:27 -0600)] 
Merge "astobj2.c: Add excessive ref count trap." into certified/13.13

8 years agoMerge "res_agi: Prevent an AGI from eating frames it should not. (Re-do)" into certif...
zuul [Fri, 3 Feb 2017 05:21:39 +0000 (23:21 -0600)] 
Merge "res_agi: Prevent an AGI from eating frames it should not. (Re-do)" into certified/13.13

8 years agoMerge "Add reload options to CLI/AMI stale object commands." into certified/13.13
Joshua Colp [Fri, 3 Feb 2017 00:08:35 +0000 (18:08 -0600)] 
Merge "Add reload options to CLI/AMI stale object commands." into certified/13.13

8 years agochannel.c: Fix unbalanced read queue deadlocking local channels. 83/4883/1
Richard Mudgett [Wed, 1 Feb 2017 00:28:15 +0000 (18:28 -0600)] 
channel.c: Fix unbalanced read queue deadlocking local channels.

Using the timerfd timing module can cause channel freezing, lingering, or
deadlock issues.  The problem is because this is the only timing module
that uses an associated alert-pipe.  When the alert-pipe becomes
unbalanced with respect to the number of frames in the read queue bad
things can happen.  If the alert-pipe has fewer alerts queued than the
read queue then nothing might wake up the thread to handle received frames
from the channel driver.  For local channels this is the only way to wake
up the thread to handle received frames.  Being unbalanced in the other
direction is less of an issue as it will cause unnecessary reads into the
channel driver.

ASTERISK-26716 is an example of this deadlock which was indirectly fixed
by the change that found the need for this patch.

* In channel.c:__ast_queue_frame(): Adding frame lists to the read queue
did not add the same number of alerts to the alert-pipe.  Correspondingly,
when there is an exceptionally long queue event, any removed frames did
not also remove the corresponding number of alerts from the alert-pipe.

ASTERISK-26632 #close

Change-Id: Ia98137c5bf6e9d6d202ce0eb36441851875863f6

8 years agores_agi: Prevent an AGI from eating frames it should not. (Re-do) 82/4882/1
Richard Mudgett [Tue, 31 Jan 2017 22:38:49 +0000 (16:38 -0600)] 
res_agi: Prevent an AGI from eating frames it should not. (Re-do)

A dialplan intercept routine is equivalent to an interrupt routine.  As
such, the routine must be done quickly and you do not have access to the
media stream.  These restrictions are necessary because the media stream
is the responsibility of some other code and interfering with or delaying
that processing is bad.  A possible future dialplan processing
architecture change may allow the interception routine to run in a
different thread from the main thread handling the media and remove the
execution time restriction.

* Made res_agi.c:run_agi() running an AGI in an interception routine run
in DeadAGI mode.  No touchy channel frames.

ASTERISK-25951

ASTERISK-26343

ASTERISK-26716

Change-Id: I638f147ca7a7f2590d7194a8ef4090eb191e4e43

8 years agoFrame deferral: Revert API refactoring. 81/4881/1
Richard Mudgett [Tue, 31 Jan 2017 22:32:18 +0000 (16:32 -0600)] 
Frame deferral: Revert API refactoring.

There are several issues with deferring frames that are caused by the
refactoring.

1) The code deferring frames mishandles adding a deferred frame to the
deferred queue.  As a result the deferred queue can only be one frame
long.

2) Deferrable frames can come directly from the channel driver as well as
the read queue.  These frames need to be added to the deferred queue.

3) Whoever is deferring frames is really only doing the __ast_read() to
collect deferred frames and doesn't care about the returned frames except
to detect a hangup event.  When frame deferral is completed we must make
the normal frame processing see the hangup as a frame anyway.  As such,
there is no need to have varying hangup frame deferral methods.  We also
need to be aware of the AST_SOFTHANGUP_ASYNCGOTO hangup that isn't real.
That fake hangup is to cause the PBX thread to break out of loops to go
execute a new dialplan location.

4) To properly deal with deferrable frames from the channel driver as
pointed out by (2) above, means that it is possible to process a dialplan
interception routine while frames are deferred because of the
AST_CONTROL_READ_ACTION control frame.  Deferring frames is not
implemented as a re-entrant operation so you could have the unsupported
case of two sections of code thinking they have control of the media
stream.

A worse problem is because of the bad implementation of the AMI PlayDTMF
action.  It can cause two threads to be deferring frames on the same
channel at the same time.  (ASTERISK_25940)

* Rather than fix all these problems simply revert the API refactoring as
there is going to be only autoservice and safe_sleep deferring frames
anyway.

ASTERISK-26343

ASTERISK-26716 #close

Change-Id: I45069c779aa3a35b6c863f65245a6df2c7865496

8 years agoastobj2.c: Add excessive ref count trap. 71/4871/1
Richard Mudgett [Tue, 10 Jan 2017 23:37:38 +0000 (17:37 -0600)] 
astobj2.c: Add excessive ref count trap.

Change-Id: I32e6a589cf9009450e4ff7cb85c07c9d9ef7fe4a

8 years agores_pjsip: Handle invocation of callback on outgoing request when error occurs. 68/4868/1
Joshua Colp [Tue, 31 Jan 2017 17:17:50 +0000 (17:17 +0000)] 
res_pjsip: Handle invocation of callback on outgoing request when error occurs.

There are some error cases in PJSIP when sending a request that will
result in the callback for the request being invoked.  The code did not
handle this case and assumed on every error case that the callback was not
invoked.

The code has been changed to check whether the callback has been invoked
and if so to absorb the error and treat it as a success.

ASTERISK-26679
ASTERISK-26699

Change-Id: I563982ba204da5aa1428989a11c06dd9087fea91

8 years agoUpdate qualifies when AOR configuration changes. 61/4861/1
Mark Michelson [Wed, 1 Feb 2017 19:54:50 +0000 (13:54 -0600)] 
Update qualifies when AOR configuration changes.

Prior to this change, qualifies would only update in the following
cases:
* A reload of res_pjsip.so was issued.
* A dynamic contact was re-registered after its AOR's qualify_frequency
  had been changed
This does not work well if you are using realtime for your AORs. You can
update your database to have a new qualify_frequency, but the permanent
contacts on that AOR will not have their qualifies updated. And the
dynamic contacts on that AOR will not have their qualifies updated until
the next registration, which could be a long time.

This change seeks to fix this problem by making it so that whenever AOR
configuration is applied, the contacts pertaining to that AOR have their
qualifies updated.

Additions from this patch:
* AOR sorcery objects now have an apply handler that calls into a newly
  added function in the OPTIONS code. This causes all contacts
  associated with that AOR to re-schedule qualifies.
* When it is time to qualify a contact, the OPTIONS code checks to see
  if the AOR can still be retrieved. If not, then qualification is
  canceled on the contact.

Alterations from this patch:
* The registrar code no longer updates contact's qualify_frequence and
  qualify_timeout. There is no point to this since those values already
  get updated when the AOR changes.
* Reloading res_pjsip.so no longer calls the OPTIONS initialization
  function. Reloading res_pjsip.so results in re-loading AORs, which
  results in re-scheduling qualifies.

Change-Id: I2e7c3316da28f389c45954f24c4e9389abac1121

8 years agodebug_utilities: Install ast_logescalator to /var/lib/asterisk/scripts 50/4850/1
George Joseph [Tue, 31 Jan 2017 18:46:08 +0000 (11:46 -0700)] 
debug_utilities: Install ast_logescalator to /var/lib/asterisk/scripts

Forgot to install it with the original patch

Change-Id: I8bdb540a6694971ae5fe21f48d532332c6482e4c

8 years agodebug_utilities: Add ast_logescalator 34/4834/4
George Joseph [Wed, 25 Jan 2017 12:50:43 +0000 (05:50 -0700)] 
debug_utilities:  Add ast_logescalator

The escalator works by creating a set of startup commands in cli.conf
that set up logger channels and issue the debug commands for the
subsystems specified.  If asterisk is running when it is executed,
the same commands will be issued to the running instance.  The original
cli.conf is saved before any changes are made and can be restored by
executing '$prog --reset'.

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

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

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

Change-Id: I799f8e5013b86dc5282961b27383d134bf09e543

8 years agoMerge "PJPROJECT logging: Fix detection of max supported log level." into certified...
George Joseph [Fri, 27 Jan 2017 00:52:54 +0000 (18:52 -0600)] 
Merge "PJPROJECT logging: Fix detection of max supported log level." into certified/13.13

8 years agoMerge "ari: Implement 'debug all' and request/response logging" into certified/13.13
George Joseph [Fri, 27 Jan 2017 00:20:34 +0000 (18:20 -0600)] 
Merge "ari: Implement 'debug all' and request/response logging" into certified/13.13

8 years agoAdd reload options to CLI/AMI stale object commands. 19/4819/1
Mark Michelson [Wed, 25 Jan 2017 21:26:53 +0000 (15:26 -0600)] 
Add reload options to CLI/AMI stale object commands.

Marking an object as stale in a memory cache is supposed to prime the
cache so that the next time the item is retrieved, the stale item is
deleted from the cache and a background task is run to re-populate the
cache with a fresh version of the object.

The problem is, there are some object types out there for which there is
no natural reason that they would be retrieved from the backend with any
regularity. Outbound PJSIP registrations are a good example of this. At
startup, they are read, and an object-specific state is created that
refers to the initially-retrieved object for all time.

Adding the "reload" option to the CLI/AMI commands gives the cache the
opportunity to manually re-retrieve the object from the backend, both
storing the new object in the cache and applying the new object's
configuration to the module that uses that object.

Change-Id: Ieb1fe7270ceed491f057ec5cbf0e097bde96c5c8

8 years agoapp_queue: Ensure member is removed from pending when hanging up. 13/4813/1
Martin Tomec [Fri, 9 Dec 2016 18:23:37 +0000 (19:23 +0100)] 
app_queue: Ensure member is removed from pending when hanging up.

In some cases member is added to pending_members, and the channel
is hung up before any extension state change. So the member would
stay in pending_members forever. So when we call do_hang, we
should also remove member from pending.

ASTERISK-26621 #close

Change-Id: Iae476b5c06481db18ebe0fa594b3e80fdc9a7d54
(cherry picked from commit d13be4eff699449172efbd9fed0ee97f6a790b6a)

8 years agoPJPROJECT logging: Fix detection of max supported log level. 70/4770/2
Richard Mudgett [Sat, 21 Jan 2017 03:13:34 +0000 (21:13 -0600)] 
PJPROJECT logging: Fix detection of max supported log level.

The mechanism used for detecting the maximum log level compiled into the
linked pjproject did not work.  The API call simply stores the requested
level into an integer and does no range checking.  Asterisk was assuming
that there was range checking and limited the new value to the allowable
range.  To get the actual maximum log level compiled into the linked
pjproject we need to get and save off the initial set log level from
pjproject.  This is the maximum log level supported.

* Get and save off the initial log level setting before altering it to the
desired level on startup.  This has to be done by a macro rather than
calling a core function to avoid incorrectly linking pjproject.

* Split the initial log level warning messages to warn if the linked
pjproject cannot support the requested startup level and if it is too low
to get the pjproject buildopts for "pjproject show buildopts".

* Adjust the CLI "pjproject set log level" to check the saved max log
level and to generate normal output messages instead of a warning message.

ASTERISK-26743 #close

Change-Id: I40aa76653e2a1dece66c3f8734594b4f0471cfb4

8 years agoari: Implement 'debug all' and request/response logging 50/4750/2
George Joseph [Thu, 19 Jan 2017 15:05:36 +0000 (08:05 -0700)] 
ari: Implement 'debug all' and request/response logging

The 'ari set debug' command has been enhanced to accept 'all' as an
application name.  This allows dumping of all apps even if an app
hasn't registered yet.  To accomplish this, a new global_debug global
variable was added to res/stasis/app.c and new APIs were added to
set and query the value.

'ari set debug' now displays requests and responses as well as events.
This required refactoring the existing debug code.

* The implementation for 'ari set debug' was moved from stasis/cli.{c,h}
  to ari/cli.{c,h}, and stasis/cli.{c,h} were deleted.
* In order to print the body of incoming requests even if a request
  failed, the consumption of the body was moved from the ari stubs
  to ast_ari_callback in res_ari.c and the moustache templates were
  then regenerated.  The body is now passed to ast_ari_invoke and then
  on to the handlers.  This results in code savings since that template
  was inserted multiple times into all the stubs.

An additional change was made to the ao2_str_container implementation
to add partial key searching and a sort function.  The existing cli
code assumed it was already there when it wasn't so the tab completion
was never working.

Change-Id: Ief936f747ce47f1fb14035fbe61152cf766406bf

8 years agopjproject_bundled: Fix setting max log level 60/4760/2
George Joseph [Mon, 23 Jan 2017 15:10:50 +0000 (08:10 -0700)] 
pjproject_bundled: Fix setting max log level

An earlier attempt to prevent pjsua from spitting out an extra 6795
lines of debug output every time the testsuite called it was also
turning off the ability for asterisk to output debug info when it
needed to.  This patch reverts the earlier fix and instead adds
a pjproject patch that sets the startup log level to 1 for pjsua
pjsystest and the pjsua python binding.  This is an asterisk-only
patch that does not affect pjproject functionality and will not be
submitted upstream.

Change-Id: I347a8b58b2626f2906ccfc1d339e907627a0c9e8

8 years agoMerge "debug_utilities: Create ast_loggrabber" into certified/13.13
zuul [Fri, 20 Jan 2017 19:45:32 +0000 (13:45 -0600)] 
Merge "debug_utilities:  Create ast_loggrabber" into certified/13.13

8 years agodebug_utilities: Create ast_loggrabber 24/4724/3
George Joseph [Fri, 13 Jan 2017 17:03:15 +0000 (10:03 -0700)] 
debug_utilities:  Create ast_loggrabber

ast_loggrabber gathers log files from customizable search patterns,
optionally converts POSIX timestamps to a readable format and
tarballs the results.

Also a few tweaks were made to ast_coredumper.

Change-Id: I8bfe1468ada24c1344ce4abab7b002a59a659495
(cherry picked from commit 5fa1c56d7e76999aa14f133a33f6b168e7c3b99c)

8 years agoUpdate for certified/13.13-cert1-rc2 certified/13.13-cert1-rc2
Mark Michelson [Thu, 19 Jan 2017 19:18:36 +0000 (14:18 -0500)] 
Update for certified/13.13-cert1-rc2

8 years agoMerge "pjproject_bundled: Fix compilation with MALLOC_DEBUG" into certified/13.13
Joshua Colp [Wed, 18 Jan 2017 01:18:00 +0000 (19:18 -0600)] 
Merge "pjproject_bundled:  Fix compilation with MALLOC_DEBUG" into certified/13.13

8 years agoMerge "pjproject_bundled: Compile pjsua with max log level = 2" into certified/13.13
Joshua Colp [Wed, 18 Jan 2017 01:17:57 +0000 (19:17 -0600)] 
Merge "pjproject_bundled:  Compile pjsua with max log level = 2" into certified/13.13

8 years agoMerge "debug_utilities: Create the ast_coredumper utility" into certified/13.13
Joshua Colp [Tue, 17 Jan 2017 21:57:53 +0000 (15:57 -0600)] 
Merge "debug_utilities:  Create the ast_coredumper utility" into certified/13.13

8 years agopjproject_bundled: Fix compilation with MALLOC_DEBUG 28/4728/1
George Joseph [Sun, 8 Jan 2017 16:29:01 +0000 (09:29 -0700)] 
pjproject_bundled:  Fix compilation with MALLOC_DEBUG

When MALLOC_DEBUG was specified, make was failing.  Immediately
remaking would work.  The issues was in the ordering of the make
dependencies.

Change-Id: If6030b54fc693f3179f32bfd20c6b5d5f1b3f7cd
(cherry picked from commit f8cd73ec3c159f2e6c464952c92d8fdb69394371)

8 years agopjproject_bundled: Compile pjsua with max log level = 2 27/4727/1
George Joseph [Tue, 3 Jan 2017 21:14:09 +0000 (14:14 -0700)] 
pjproject_bundled:  Compile pjsua with max log level = 2

A while back, we changed config_site.h to set PJ_LOG_MAX_LEVEL = 6.
This allowed us to control the log level better from inside Asterisk.
An unfortunate side effect of this was that the pjsua binary and
python bindings were also compiled with log level set to 6 so whenever
a testsuite test that uses pjsua runs, it spits out 6795 lines of
debug in an instant even before the test starts.  I believe this
overruns the Jenkins capture buffer and prevents the test from
properly terminating.  In turn, this results in the testsuite just
hanging until the job is killed.  It's more frequent on the higher
end agents because they can spit out the messages faster.

Unfortunately, the messages are all spit out before we have control
of the python pj.Lib instance where we can set logging levels so the
only alternative was to actually compile pjsua and _pjsua.so with an
overridden PJ_LOG_MAX_LEVEL.  Although defining a lower max level was
done in the Makefile, the define in config_site.h had to be wrapped
with "#ifndef" so the change would take effect.

Change-Id: I2af9e7d48dde1927279c586c9c725d868fe6f3ff
(cherry picked from commit d7e5a747c312de18647213359103ce6022776864)

8 years agopjproject_bundled: Make build single threaded 25/4725/2
George Joseph [Sun, 18 Dec 2016 21:23:17 +0000 (14:23 -0700)] 
pjproject_bundled:  Make build single threaded

There were just too many issues in various environments with
multi threaded building of pjproject.  It doesn't really speed
things up anyway since asterisk is already being compiled in
parallel.

Change-Id: Ie5648fb91bb89b4224b6bf43a0daa1af793c4ce1
(cherry picked from commit 815f7551550908c83220196ba08742af0c745772)

8 years agoPJPROJECT logging: Made easier to get available logging levels. 26/4726/1
Richard Mudgett [Thu, 24 Nov 2016 00:27:54 +0000 (18:27 -0600)] 
PJPROJECT logging: Made easier to get available logging levels.

Use of the new logging is as simple as issuing the new CLI command or
setting the new pjproject.conf option.

Other options that can affect the logging are how you have the pjproject
log levels mapped to Asterisk log types in pjproject.conf and if you have
configured Asterisk to log the DEBUG type messages.  Altering the
pjproject.conf level mapping shouldn't be necessary for most installations
as the default mapping is sensible.  Configuring Asterisk to log the DEBUG
message type is standard practice for collecting debug information.

* Added CLI "pjproject set log level" command to dynamically adjust the
maximum pjproject log message level.

* Added CLI "pjproject show log level" command to see the currently set
maximum pjproject log message level.

* Added pjproject.conf startup section "log_level" option to set the
initial maximum pjproject log message level so all messages could be
captured from initialization.

* Set PJ_LOG_MAX_LEVEL to 6 to compile in all defined logging levels into
bundled pjproject.  Pjproject will use the currently set run time log
level to determine if a log message is generated just like Asterisk
verbose and debug logging levels.

* In log_forwarder(), made always log enabled and mapped pjproject log
messages.  DEBUG mapped log messages are no longer gated by the current
Asterisk debug logging level.

* Removed RAII_VAR() from res_pjproject.c:get_log_level().

ASTERISK-26630 #close

Change-Id: I6dca12979f482ffb0450aaf58db0fe0f6d2e5389

8 years agodebug_utilities: Create the ast_coredumper utility 23/4723/1
George Joseph [Wed, 11 Jan 2017 00:10:39 +0000 (17:10 -0700)] 
debug_utilities:  Create the ast_coredumper utility

This utility allows easy manipulation of asterisk coredumps.

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

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

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

Change-Id: I935d37ab9db85ef923f32b05579897f0893d33cd
(cherry picked from commit 47474cfd54a9185c1433464ccfd6301427a03957)

8 years agoMerge "res_rtp_asterisk.c: Fix uninitialized memory crash." into certified/13.13
Joshua Colp [Mon, 9 Jan 2017 13:22:12 +0000 (07:22 -0600)] 
Merge "res_rtp_asterisk.c: Fix uninitialized memory crash." into certified/13.13

8 years agoMerge "chan_rtp.c: Fix uninitialized memory crash." into certified/13.13
Joshua Colp [Mon, 9 Jan 2017 13:21:32 +0000 (07:21 -0600)] 
Merge "chan_rtp.c: Fix uninitialized memory crash." into certified/13.13

8 years agoMerge "res_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip()." into certifi...
zuul [Fri, 6 Jan 2017 19:16:08 +0000 (13:16 -0600)] 
Merge "res_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip()." into certified/13.13

8 years agoMerge "acl.c: Improve ast_ouraddrfor() diagnostic messages." into certified/13.13
George Joseph [Thu, 5 Jan 2017 04:09:36 +0000 (22:09 -0600)] 
Merge "acl.c: Improve ast_ouraddrfor() diagnostic messages." into certified/13.13

8 years agoMerge "chan_pjsip: Use session for retrieving CHANNEL() information." into certified...
George Joseph [Wed, 4 Jan 2017 22:25:37 +0000 (16:25 -0600)] 
Merge "chan_pjsip: Use session for retrieving CHANNEL() information." into certified/13.13

8 years agochan_pjsip: Use session for retrieving CHANNEL() information. 74/4674/3
Joshua Colp [Thu, 22 Dec 2016 22:00:58 +0000 (22:00 +0000)] 
chan_pjsip: Use session for retrieving CHANNEL() information.

The CHANNEL() dialplan function implementation for PJSIP allows
querying of PJSIP specific information. This used the channel
passed in to get the PJSIP session and associated information.
It is possible for this channel to be masqueraded and end
up as a different channel type by the time the information
request is actually acted upon.

This change retrieves the PJSIP session safely and accesses
data from it (including channel). This provides a guarantee
that the session and channel will not be altered when the
request is being acted upon.

ASTERISK-26673

Change-Id: I335e12b89e1820cafdd92b3e7526b8ba649eb7e6

8 years agobridge_native_rtp.c: Fix native rtp bridge data race. 81/4681/1
Richard Mudgett [Fri, 23 Dec 2016 18:10:40 +0000 (12:10 -0600)] 
bridge_native_rtp.c: Fix native rtp bridge data race.

native_rtp_bridge_compatible() didn't lock the bridge channels before
checking the channels for native bridging ability.  As a result, one of
the channel's native format capabilities structure got replaced out from
under the native bridge check.  Use of a stale pointer to freed memory
causes bad things to happen.

MALLOC_DEBUG, DO_CRASH, and the
tests/channels/pjsip/transfers/blind_transfer/caller_direct_media
testsuite test caught this.

* Add missing channel locking in native_rtp_bridge_compatible().

Change-Id: If25fdb3ac8e85563c4857fb8216b3d9dc3d0fa53

8 years agores_rtp_asterisk.c: Fix uninitialized memory crash. 70/4670/1
Richard Mudgett [Wed, 21 Dec 2016 22:28:00 +0000 (16:28 -0600)] 
res_rtp_asterisk.c: Fix uninitialized memory crash.

ast_rtp_remote_address_set() could pass an uninitialized 'us' parameter to
ast_ouraddrfor().  If ast_ouraddrfor() returns an error then the 'us'
parameter may not get initialized.  Thus when the code tries to save the
'us' parameter to the local address we could try to copy a ridiculous
sized memory buffer and segfault.

* Made pass an initialized 'us' parameter to ast_ouraddrfor().

* Optimized out the 'us' struct variable.

ASTERISK-26672 #close

Change-Id: I4acea5dcdf0813da2c7d3e11c2d6067d160d17dc

8 years agochan_rtp.c: Fix uninitialized memory crash. 69/4669/1
Richard Mudgett [Wed, 21 Dec 2016 23:54:42 +0000 (17:54 -0600)] 
chan_rtp.c: Fix uninitialized memory crash.

unicast_rtp_request() could pass an uninitialized 'us' parameter to
ast_ouraddrfor().  If ast_ouraddrfor() returns an error then the 'us'
parameter may not get initialized.  Thus when the code tries to save the
'us' parameter to the local address we could try to copy a ridiculous
sized memory buffer and segfault.

* Made pass an initialized 'us' parameter to ast_ouraddrfor() and abort
the UnicastRTP channel request if it fails.

ASTERISK-26672

Change-Id: I1ef7a7c09f4da4f15dcb6de660d2bcac5f2a95c0

8 years agores_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip(). 68/4668/1
Richard Mudgett [Wed, 21 Dec 2016 23:55:48 +0000 (17:55 -0600)] 
res_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip().

We access uninitialized memory when the 'ourip' parameter does not
have an initial guess to our IP address.

ASTERISK-26672

Change-Id: I35507ea1ad7455d2be188f6ccdd4add7bd150e15

8 years agoacl.c: Improve ast_ouraddrfor() diagnostic messages. 67/4667/1
Richard Mudgett [Wed, 21 Dec 2016 22:25:00 +0000 (16:25 -0600)] 
acl.c: Improve ast_ouraddrfor() diagnostic messages.

* Made not generate strings unless they will actually be used.

ASTERISK-26672

Change-Id: I155fbe7fdff5ce47dfe5326f3baf5446849702c3

8 years agoMerge "res_pjsip: Add/update ERROR msg if invalid URI." into certified/13.13
zuul [Tue, 20 Dec 2016 05:26:34 +0000 (23:26 -0600)] 
Merge "res_pjsip: Add/update ERROR msg if invalid URI." into certified/13.13

8 years agoMerge "MESSAGE: Flush Message/ast_msg_queue channel alert pipe." into certified/13.13
zuul [Tue, 20 Dec 2016 05:26:00 +0000 (23:26 -0600)] 
Merge "MESSAGE: Flush Message/ast_msg_queue channel alert pipe." into certified/13.13

8 years agoMerge "chan_dahdi.c: Fix bounds check regression." into certified/13.13
George Joseph [Tue, 20 Dec 2016 04:22:11 +0000 (22:22 -0600)] 
Merge "chan_dahdi.c: Fix bounds check regression." into certified/13.13

8 years agochan_dahdi.c: Fix bounds check regression. 32/4632/1
Richard Mudgett [Wed, 14 Dec 2016 20:21:47 +0000 (14:21 -0600)] 
chan_dahdi.c: Fix bounds check regression.

Caused by ASTERISK-25494

Change-Id: I1fc408c1a083745ff59da5c4113041bbfce54bcb

8 years agores_pjsip: Add/update ERROR msg if invalid URI. 28/4628/1
Richard Mudgett [Tue, 13 Dec 2016 20:34:54 +0000 (14:34 -0600)] 
res_pjsip: Add/update ERROR msg if invalid URI.

ASTERISK-24499

Change-Id: Ie305153e47e922233b2ff24715e0e326e5fa3a6c

8 years agoMESSAGE: Flush Message/ast_msg_queue channel alert pipe. 27/4627/1
Richard Mudgett [Tue, 13 Dec 2016 00:38:42 +0000 (18:38 -0600)] 
MESSAGE: Flush Message/ast_msg_queue channel alert pipe.

ASTERISK-25083

Change-Id: Id54baa57a8dbca84e29f28bcd2ffc0a5ac12d8b2

8 years agores_sorcery_memory_cache: Change an error to a debug message 20/4620/1
George Joseph [Tue, 13 Dec 2016 20:06:34 +0000 (13:06 -0700)] 
res_sorcery_memory_cache:  Change an error to a debug message

When a sorcery user calls ast_sorcery_delete on an object that
may have already expired from the cache, res_sorcery_memory_cache
spits out an ERROR.  Since this can happen frequently and validly when
an inbound registration expires after the cache entry expired, the
errors are unnecessary and misleading.  Changed to a debug/1.

Change-Id: Idf3a67038c16e3da814cf612ff4d6d18ad29ecd7

8 years agoMerge "res_pjsip_registrar: AMI Add RegistrationInboundContactStatuses command" into...
zuul [Fri, 9 Dec 2016 03:12:38 +0000 (21:12 -0600)] 
Merge "res_pjsip_registrar: AMI Add RegistrationInboundContactStatuses command" into certified/13.13

8 years agoMerge "res_format_attr_opus: Fix crash when fmtp contains spaces." into certified...
Kevin Harwell [Thu, 8 Dec 2016 17:07:35 +0000 (11:07 -0600)] 
Merge "res_format_attr_opus: Fix crash when fmtp contains spaces." into certified/13.13

8 years agochan_sip: Do not allow non-SP/HTAB between header key and colon. 85/4585/1
Walter Doekes [Wed, 30 Nov 2016 15:31:39 +0000 (16:31 +0100)] 
chan_sip: Do not allow non-SP/HTAB between header key and colon.

RFC says SIP headers look like:

    HCOLON  =  *( SP / HTAB ) ":" SWS
    SWS     =  [LWS]                    ; sep whitespace
    LWS     =  [*WSP CRLF] 1*WSP        ; linear whitespace
    WSP     =  SP / HTAB                ; from rfc2234

chan_sip implemented this:

    HCOLON  =  *( LOWCTL / SP ) ":" SWS
    LOWCTL  = %x00-1F                   ; CTL without DEL

This discrepancy meant that SIP proxies in front of Asterisk with
chan_sip could pass on unknown headers with \x00-\x1F in them, which
would be treated by Asterisk as a different (known) header.  For
example, the "To\x01:" header would gladly be forwarded by some proxies
as irrelevant, but chan_sip would treat it as the relevant "To:" header.

Those relying on a SIP proxy to scrub certain headers could mistakenly
get unexpected and unvalidated data fed to Asterisk.

This change fixes so chan_sip only considers SP/HTAB as valid tokens
before the colon, making it agree on the headers with other speakers of
SIP.

ASTERISK-26433 #close
AST-2016-009

Change-Id: I78086fbc524ac733b8f7f78cb423c91075fd489b

8 years agores_format_attr_opus: Fix crash when fmtp contains spaces. 81/4581/1
Joshua Colp [Tue, 15 Nov 2016 00:18:21 +0000 (00:18 +0000)] 
res_format_attr_opus: Fix crash when fmtp contains spaces.

When an opus offer or answer was received that contained an
fmtp line with spaces between the attributes the module would
fail to properly parse it and crash due to recursion.

This change makes the module handle the space properly and
also removes the recursion requirement.

ASTERISK-26579

Change-Id: I01f53e5d9fa9f1925a7365f8d25071b5b3ac2dc3

8 years agores_pjsip_registrar: AMI Add RegistrationInboundContactStatuses command 70/4570/2
George Joseph [Tue, 6 Dec 2016 20:54:25 +0000 (13:54 -0700)] 
res_pjsip_registrar: AMI Add RegistrationInboundContactStatuses command

The PJSIPShowRegistrationsInbound AMI command was just dumping out
all AORs which was pretty useless and resource heavy since it had
to get all endpoints, then all aors for each endpoint, then all
contacts for each aor.

PJSIPShowRegistrationInboundContactStatuses sends ContactStatusDetail
events which meets the intended purpose of the other command and has
significantly less overhead.  Also, some additional fields that were
added to Contact since the original creation of the ContactStatusDetail
event have been added to the end of the event.

For compatibility purposes, PJSIPShowRegistrationsInbound is left
intact.

ASTERISK-26644 #close

Change-Id: I326f12c9ecb52bf37ba03f0748749de4da01490a