Commit Graph

4667 Commits

Author SHA1 Message Date
George Joseph 93894d53c4 config: bug: fix truncation of included config files on permissions error
ast_config_text_file_save() currently truncates include files as they
are processed.  If a subsequent include file or the main config file has
a permissions error that prevents writing, earlier include files are left
truncated resulting in a frantic search for backups.

This patch causes ast_config_text_file_save to check for write access
on all files before it truncates any of them.

Will be applied 1.8 > trunk.

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

Merged revisions 422900 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

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

Merged revisions 422904 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422906 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-10 16:07:04 +00:00
Matthew Jordan 71acca4de2 main/cdr: Copy over location information during a fork
When a CDR is forked, a new CDR is created and appended to the CDR chain for
the Party A. The forked CDR starts life off as a clone of the last
non-finalized for the particular Party A. In the past, merely copying over
the snapshots for Party A/Party B would be sufficient. However, as the CDRs
now contain cached information from Party A - specifically application/data,
context, and extension - we need to copy that over during a fork as well.

Huzzah for unit tests catching this when the context/extension were derived
from a cached value on the CDR instead of on Party A.
........

Merged revisions 422769 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422771 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-06 22:50:24 +00:00
Matthew Jordan e4591f98b1 main/rtp_engine: Format NTP timestamps as unsigned ints
On some systems, a timeval's tv_sec/tv_usec will be unsigned lont ints, as
opposed to long ints. When the RTP engine formats these as strings, it was
previously formatting them as signed integers, which can result in some
odd negative timestamp values (particularly on 32-bit systems). This patch
formats the values as unsigned long integers.
........

Merged revisions 422766 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422768 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-06 22:22:34 +00:00
Matthew Jordan d42b116925 main/cdrs: Preserve context/extension when executing a Macro or GoSub
The context/extension in a CDR is generally considered the destination of a
call. When looking at a 2-party call CDR, users will typically be presented
with the following:

context    exten      channel     dest_channel app  data
default    1000       SIP/8675309 SIP/1000     Dial SIP/1000,,20

However, if the Dial actually takes place in a Macro, the current behaviour
in 12 will result in the following CDR:

context    exten      channel     dest_channel app  data
macro-dial s          SIP/8675309 SIP/1000     Dial SIP/1000,,20

The same is true of a GoSub:

context    exten      channel     dest_channel app  data
subs       dial_stuff SIP/8675309 SIP/1000     Dial SIP/1000,,20

This generally makes the context/exten fields less than useful.

It isn't hard to preserve these values in the CDR state machine; however, we
need to have something that informs us when a channel is executing a
subroutine. Prior to this patch, there isn't anything that does this.

This patch solves this problem by adding a new channel flag,
AST_FLAG_SUBROUTINE_EXEC. This flag is set on a channel when it executes a
Macro or a GoSub. The CDR engine looks for this value when updating a Party A
snapshot; if the flag is present, we don't override the context/exten on the
main CDR object. In a funny quirk, executing a hangup handler must *not* abide
by this logic, as the endbeforehexten logic assumes that the user wants to see
data that occurs in hangup logic, which includes those subroutines. Since
those execute outside of a typical Dial operation (and will typically have
their own dedicated CDR anyway), this is unlikely to cause any heartburn.

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

ASTERISK-24254 #close
Reported by: tm1000, Tony Lewis
Tested by: Tony Lewis
........

Merged revisions 422718 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422720 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-05 22:04:33 +00:00
Matthew Jordan 4499eb05d8 main/cdr: Fix crash/memory consumption in CDRs in multi-party bridge scenarios
This patch fixes an issue where CDRs would get stuck generating an infinite
number of CDRs, eventually crashing Asterisk (and consuming a lot of memory
along the way).

When a channel enters into a multi-party bridge, the CDR engine creates
mappings of each participant to each other participant, picking the 'A' party
as it goes. So, if we have four channels in a multi-party bridge (Alice, Bob,
Charlie, Denise), we would have something like:

Alice => Bob
Alice => Charlie
Alice => Denise
Bob => Charlie
Bob => Denise
Charlie => Denise

This works fine when participants enter the bridge a single time.

When a participant leaves a bridge, the CDRs for that channel are transitioned
to a finalized state.

The bug occurs if Bob rejoins. When the CDR engine creates mappings between the
channels, it walks through all the participants currently in the bridge, and
realizes that no one in the bridge can create a CDR with the channel (Bob).
As such it creates a new CDR for the candidate and appends it to that
candidate's chain. Unfortunately, on this particular code path, it doesn't
stop traversing the candidate's chain. Since we just added ourselves to the
chain, this causes the loop to keep going, constantly adding new CDRs.

This patch makes it so the engine bails when it creates a CDR match in this
case.

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

ASTERISK-24241 #close
Reported by: Deepak Singh Rawat
Tested by: Deepak Singh Rawat

ASTERISK-24208
Reported by: Frankie Chin
........

Merged revisions 422715 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422717 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-05 21:56:52 +00:00
Jonathan Rose 85878c4dd8 Dial API: Add a dial option to indicate the dialed channel will replace dialer
Adds an option to the dial API that marks an outgoing dial as replacing the dialing channel for the purpose of propagating accountcode. When it is used, AST_CHANNEL_REQUESTOR_REPLACEMENT is used instead of AST_CHANNEL_REQUESTOR_BRIDGE_PEER when setting accountcodes on the involved channels with ast_channel_req_accountcodes.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422697 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-05 20:22:12 +00:00
Jonathan Rose e19017fc00 Call IDs: Fix appearance of call ID in core show channels when NULL
NULL call IDs were meant to appear as '(none)' but instead were showing
the contents of an uninitialized character buffer.

ASTERISK-24223
Review: https://reviewboard.asterisk.org/r/3979/
........

Merged revisions 422664 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422683 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-05 19:39:04 +00:00
Richard Mudgett 5a1de68b9a devicestate.c: Minor tweaks
* In ast_state_chan2dev() use ARRAY_LEN() instead of a sentinel value in
chan2dev[].

* Fix some comments in chan_iax2.c.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-05 17:45:03 +00:00
Jonathan Rose af75e45da1 Manager: Require read permission for SYSTEM in order to send FullyBooted
Review: https://reviewboard.asterisk.org/r/3969/
........

Merged revisions 422584 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

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

Merged revisions 422626 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422632 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-04 22:05:41 +00:00
Matthew Jordan 897cbf6a4f main/cli: Do not attempt to show CDR data for internal channels
Internal channels don't have CDRs. Querying the CDR engine for their variables
will make it cranky.
........

Merged revisions 422506 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422524 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-09-01 15:25:26 +00:00
George Joseph 59d4dbd3d0 manager: Make WaitEvent action respect eventfilters
A WaitEvent issued via an http session isn't respecting eventfilters defined
for the user. I just added a match_filter to the predicate that controls
astman_append.

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

Merged revisions 422439 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

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

Merged revisions 422441 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422443 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-30 17:24:57 +00:00
Richard Mudgett 4728c05957 sched: Fix typo and whitespace change.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422201 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-28 00:16:01 +00:00
Kinsey Moore bf85018107 CallerID: Fix parsing of malformed callerid
This allows the callerid parsing function to handle malformed input
strings and strings containing escaped and unescaped double quotes.
This also adds a unittest to cover many of the cases where the parsing
algorithm previously failed.

Review: https://reviewboard.asterisk.org/r/3923/
Review: https://reviewboard.asterisk.org/r/3933/
........

Merged revisions 422112 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

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

Merged revisions 422114 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-27 15:39:35 +00:00
Mark Michelson c5ab4adf17 Fix race condition in the scheduler when deleting a running entry.
When scheduled tasks run, they are removed from the heap (or hashtab).
When a scheduled task is deleted, if the task can't be found in the
heap (or hashtab), an assertion is triggered. If DO_CRASH is enabled,
this assertion causes a crash.

The problem is, sometimes it just so happens that someone attempts
to delete a scheduled task at the time that it is running, leading
to a crash. This change corrects the issue by tracking which task
is currently running. If that task is attempted to be deleted,
then we mark the task, and then wait for the task to complete.
This way, we can be sure to coordinate task deletion and memory
freeing.

ASTERISK-24212
Reported by Matt Jordan

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

Merged revisions 422070 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422072 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-26 22:14:46 +00:00
Matthew Jordan 1498ae0830 main/message: Add a new-line to a DEBUG message
........

Merged revisions 421859 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421861 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-22 14:09:07 +00:00
Matthew Jordan f3a525e9a6 ARI: Fix implicit answer when playback is initiated on unanswered channel
When issuing a POST /channels/{channel_id}/play on a channel that is not
yet answered, ARI is supposed to:
* Queue up an AST_CONTROL_PROGRESS on the channel
* Start up the playback of the media

Instead, we sneak an answer on the channel right before starting playing media.

This is due to ARI's usage of control_streamfile. This function implicitly
answers the channel (and doesn't give ARI the option to stop it). The answering
of the channel here is probably unnecessary:
* app_voicemail, by far the biggest consumer of this function, always answers
  the channels anyway
* control stream file (in res_agi) and ControlPlayback probably shouldn't be
  implicitly answering the channel. Answering should not be tied directly to
  playing back media.

As it turns out, the answering of the channel here is pretty old:
356042    twilson       if (ast_channel_state(chan) != AST_STATE_UP) {
  3087      anthm               res = ast_answer(chan);
180259   tilghman       }

(As in, ancient?)

Note that others ran into this problem and commented about it on various
mailing lists.

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

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

Merged revisions 421695 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421699 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-21 15:25:25 +00:00
Matthew Jordan 085d5a2629 Clean up files that do not end with newlines
Trivial patch to add new lines to several files missing them. This fixes
warnings when compiling with gcc 4.1.2 on CentOS 5.

ASTERISK-24245 #close
Reported by: Shaun Ruffell
patches:
  0002-Trivial-addition-of-newlines-at-end-of-three-files.patch uploaded by Shaun Ruffell (License 5417)
........

Merged revisions 421677 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421679 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-21 14:52:28 +00:00
Matthew Jordan da91946df7 uri: Quiet warning about type qualifiers ignored on function return type
This patch fixes gcc warnings that occur due to the type qualifier 'const'
being ignored on a return type of int.

ASTERISK-24246 #close
Reported by: Shaun Ruffell
patches:
  0001-main-uri-Quiet-warning-about-ignored-attribute-on-re.patch uploaded by Shaun Ruffell (License 5417)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421676 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-21 14:42:12 +00:00
Richard Mudgett b7f98c3da4 chan_pjsip: Update media translation paths when new SDP negotiated.
On a SIP reinvite that changes media strams, the PJSIP channel driver was
flooding the log with "Asked to transmit frame type %s, while native
formats is %s" warnings.

* Fixes PJSIP not setting up translation paths when the formats change on
a reinvite.  AFS-63 was effectively reintroduced because of the media
formats work.  res_pjsip_sdp_rtp.c:set_caps()

* Improved the unexpected frame format WARNING message to include more
information.

* Added protective locking while altering formats on a channel.  Reworked
set_format() to simplify and protect the formats under manipulation.

* Restored some code that got lost in the media_formats work.
(channel.c:set_format() and res_pjsip_sdp_rtp.c:set_caps())

AFS-137 #close
Reported by: Mark Michelson

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421646 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-20 22:52:44 +00:00
Richard Mudgett 4672c139dd cli.c: Fix tab completion of "module load" when MALLOC_DEBUG is enabled.
filename_completion_function() returns memory that was not allocated by
the MALLOC_DEBUG allocation tracker so the memory must be freed by
ast_std_free().
........

Merged revisions 421600 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

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

Merged revisions 421608 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-20 22:23:23 +00:00
Kinsey Moore 36f4bff943 Stasis: Add information to blind transfer event
When a blind transfer occurs that is forced to create a local channel
pair to satisfy the transfer request, information about the local
channel pair is not published. This adds a field to describe that
channel to the blind transfer message struct so that this information
is conveyed properly to consumers of the blind transfer message.

This also fixes a bug in which Stasis() was unable to properly identify
the channel that was replacing an existing Stasis-controlled channel
due to a blind transfer.

Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3921/
........

Merged revisions 421537 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-20 13:06:33 +00:00
Kinsey Moore 01f1ff1f77 AMI: Add AllVariables parameter to Status
This adds the AllVariables parameter to the Status AMI action such that
if defined and set to "true", all channel variables will be reported in
the subsequent Status event(s). This parameter does not negate the
functionality of the "Variables" parameter so that global variables and
dialplan functions can be requested.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421534 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-20 12:39:39 +00:00
Kinsey Moore a85a483fcd AMI Docs: Fix Status channel parameter optionality
........

Merged revisions 421442 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

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

Merged revisions 421444 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421446 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-19 19:43:14 +00:00
Matthew Jordan ba5d5da60b Improve call forwarding reporting, especially with regards to ARI.
This patch addresses a few issues:

1) The order of Dial events have been changed when performing a call forward.
   The order has now been altered to
    1) Dial begins dialing channel A.
    2) When A forwards the call to B, we issue the dial end event to channel
       A, indicating the dial is being canceled due to a forward to B.
    3) When the call to channel B occurs, we then issue a new dial begin to
       channel B.

2) Call forwards are now reported on the calling channel, not the peer channel.

3) AMI DialEnd events have been altered to display the extension the call is
   being forwarded to when relevant.

4) You can now get the values of channel variables for channels that are not
   currently in the Stasis application. This brings the retrieval of channel
   variables more in line with the rest of channel read operations since they
   may be performed on channels not in Stasis.

ASTERISK-24134 #close
Reported by Matt Jordan

ASTERISK-24138 #close
Reported by Matt Jordan

Patches:
	forward-shenanigans.diff uploaded by Matt Jordan (License #6283)

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421310 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-18 00:57:01 +00:00
Jonathan Rose 9b658b7c60 Bridging: Fix a behavioral change when checking if a channel is leaving a bridge
r420934 introduced some failures in the test suite.  Upon investigating, it was
discovered that differences in the way we were evaluating whether a channel was in
the process of leaving a bridge were causing some reinvites not to occur (mostly
reinvites back to Asterisk when ending a call). This patch fixes that behavioral
change.

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

Merged revisions 421186 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421195 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-15 17:26:12 +00:00
Matthew Jordan 0d0a616e1a app_voicemail/app: Remove test events that were duplicated by r421059
Moving the test event raised when a file is played back (which occurred in
r421059) broke the ever loving snot out of the voicemail tests. This caused
duplicate test events to get raised, as app_voicemail and main/app were raising
events prior to call ast_streamfile. The voicemail tests did not enjoy getting
multiple events.

Since raising the playback event in ast_streamfile is far more useful to the
vast majority of tests, this patch keeps the call there and simply removes the
extraneous calls that duplicated the event.
........

Merged revisions 421125 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

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

Merged revisions 421165 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421167 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-15 15:50:46 +00:00
Matthew Jordan 513981c89d main/file: Move test event to emit PLAYBACK event more consistently
This is being done in advance of the test for ASTERISK-23953
........

Merged revisions 421059 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

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

Merged revisions 421061 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421063 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-14 20:59:15 +00:00
Matthew Jordan 0b11c48522 cel: Make sure channels in extra fields include their unique IDs as well
CEL typically tracks a lot of information using the unique ID of the channel.
This is typically needed due to tying events together using the linked ID of
the various channels involved in a "call", which is derived from the channel ID
of the oldest channel involved in a bridge (or in the case of a Dial, the
parent channel).

Previously, we had updated the extra fields to include the involved channel
names, but forgot to put in the unique ID. This patch corrects that error.
........

Merged revisions 421037 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@421043 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-14 19:21:51 +00:00
Richard Mudgett e4b32731b9 channel_internal_api.c: Replace some code with ao2_replace().
Use ao2_replace() instead of ao2_cleanup(); ao2_bump().

ao2_replace() has the advantange of not altering the ref count if the
replaced pointer is the same.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420993 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-14 16:01:39 +00:00
Jonathan Rose d4695774e7 Bridges: Fix feature interruption/unintended kick caused by external actions
If a manager or CLI user attached a mixmonitor to a call running a dynamic
bridge feature while in a bridge, the feature would be interrupted and the
channel would be forcibly kicked out of the bridge (usually ending the call
during a simple 1 to 1 call). This would also occur during any similar action
that could set the unbridge soft hangup flag, so the fix for this was to
remove unbridge from the soft hangup flags and make it a separate thing all
together.

ASTERISK-24027 #close
Reported by: mjordan
Review: https://reviewboard.asterisk.org/r/3900/
........

Merged revisions 420934 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-13 16:24:37 +00:00
Kinsey Moore 6a6702bb0f AMI: Improve documentation for Status action
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420921 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-13 14:31:46 +00:00
Walter Doekes 52c94d3af4 logger: Don't store verbose-magic in the log files.
In r399267, the verbose2magic stuff was edited. This time it results
in magic characters in the log files for multiline messages.

In trunk (and 13) this was fixed by the "stripping" of those
characters from multiline messages (in r414798).

This fix is altered to actually strip the characters and not replace
them with blanks.

Review: https://reviewboard.asterisk.org/r/3901/
Review: https://reviewboard.asterisk.org/r/3902/
........

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

Merged revisions 420898 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420900 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-13 07:54:10 +00:00
Walter Doekes 1e0846167b general: Fix memory Corruption in __ast_string_field_ptr_build_va.
If the space left in a stringfield is between 0 and
(alignof(ast_string_field_allocation)-1) adding new data would cause
memory corruption, because we would assume enough space (unsigned
underrun).

Thanks Arnd Schmitter for reporting and finding out the cause!

ASTERISK-23508 #close
Reported by: Arnd Schmitter
Tested by: Arnd Schmitter, JoshE

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

Merged revisions 420680 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

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

Merged revisions 420716 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420718 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-11 10:41:07 +00:00
Walter Doekes b2afbc48e4 tcptls: Avoid compiler warning on non-dev-mode.
........

Merged revisions 420654 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

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

Merged revisions 420656 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-11 09:55:13 +00:00
Matthew Jordan 008c1ad9bf main/message: remove debug message
........

Merged revisions 420533 from http://svn.asterisk.org/svn/asterisk/branches/12
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420535 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-08 12:33:06 +00:00
Kinsey Moore 6653d7e8ee Stasis: Correct blind transfer message generation
This fixes the json object creation format string and key name for the
BridgeBlindTransfer Stasis event allowing it to be published properly.
........

Merged revisions 420414 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420415 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-07 21:17:05 +00:00
Kinsey Moore d442ffd59c Stasis: Ensure transfer messages follow validation rules
This makes Stasis() event generation for transfer messages follow
validation rules. Currently, ast_json_null() is being used in place of
omitting a key entirely which falls afoul of these validation rules.

https://reviewboard.asterisk.org/r/3892/
........

Merged revisions 420408 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420410 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-07 20:24:15 +00:00
Mark Michelson cb55679aed Ensure bridges exist when trying to determine bridged parties when publishing transfer information.
........

Merged revisions 420387 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420388 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-07 19:44:32 +00:00
Mark Michelson 99d0bccd35 Add support for RFC 4662 resource list subscriptions.
This commit adds the ability for a user to configure
a resource list in pjsip.conf. Subscribing to this
list simultaneously subscribes the subscriber to all
resources listed. This has the potential to reduce
the amount of SIP traffic when loads of subscribers
on a system attempt to subscribe to each others' states.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-07 19:26:32 +00:00
Richard Mudgett ea7d4ab09e chan_iax2: Several media format fixes.
* Fixed the iax.conf bandwidth option.  This is the root cause of
ASTERISK-24150.

* Added checks in iax2_request() to ensure that there are actual formats
requested for the new channel to prevent any more fracks from issues like
ASTERISK-24150.  This is a consequence of the iax.conf bandwidth option
not working.

* Fixed struct iax2_codec_pref.order member size mismatch issue when
converting to and from the codec preference order list passed over the
wire.  In addition the values sent over the wire are now compatible with
previous Asterisk versions.

* Fixed several issues dealing with the struct iax2_codec_pref members.
Off-by-one, array limit errors, and the order/framing members always need
to be updated together.

* Made iax2_request() setup the channel's native format preference order
according to the user's wishes.  The new media format strategy needs the
order specified earler.

* Fixed usage of ast_format_compatibility_bitfield2format().  The function
can return NULL if the bitfield was not associated with a function.

* Deleted dead code iax2_codec_pref_getsize() and
iax2_codec_pref_setsize().

* Made iax2_parse_allow_disallow() and iax2_codec_pref_string() call
iax2_codec_pref_to_cap() instead of inlining it.

* Made IAX_CAPABILITY_MEDBANDWIDTH, IAX_CAPABILITY_LOWBANDWIDTH, and
IAX_CAPABILITY_LOWFREE constants again as they were in Asterisk v1.8.

* Renamed prefs to prefs_global so it won't get confused with the local
pref versions.

* Fixed too small buffer in handle_cli_iax2_show_peer().

* Fixed ast_cli() calls in handle_cli_iax2_show_peer() to output complete
lines.

* Changed struct create_addr_info.prefs to be struct iax2_codec_pref as an
optimization so iax2_request() and iax2_call() do less work.

* Fixed a potential deadlock in ast_iax2_new() on an off-nominal path when
the pbx could not get started.

* Made set_config() setup a local prefs list along side the local
capability format bitfield.  Once the config is loaded, then the local
copies are put into the global versions.

* Fix unininialized codec_buf in function_iaxpeer().

ASTERISK-24150 #close
Reported by: Scott Griepentrog

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-07 18:51:16 +00:00
Kinsey Moore 0ac7f96057 Stasis: Convey transfer information to applications
This fixes a class of issues where Stasis applications were not made
aware that their channels were being manipulated or replaced by
external entitiessuch as transfers, AMI commands, or dialplan
applications such as Bridge(). Inconsistent information such as
StasisEnd events with unknown channels as a result of masquerades has
also been corrected. To accomplish these fixes, several new fields
were added to blind and attended transfer messages as well as
StasisStart and BridgeAttendedTransfer Stasis events.

ASTERISK-23941 #close
Review: https://reviewboard.asterisk.org/r/3865/
Review: https://reviewboard.asterisk.org/r/3857/
Review: https://reviewboard.asterisk.org/r/3852/
Review: https://reviewboard.asterisk.org/r/3816/
Review: https://reviewboard.asterisk.org/r/3731/
Review: https://reviewboard.asterisk.org/r/3729/
Review: https://reviewboard.asterisk.org/r/3728/
........

Merged revisions 420325 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420338 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-07 15:30:19 +00:00
Matthew Jordan 98af8fb715 pbx: Filter out pattern matching hints in responses sent to ExtensionStateList
Hints that are a pattern match are technically stored in the hint container in
the same fashion as concrete implementations of hints. The pattern matching
hints, however, are not "real" in the sense that things can subscribe to them:
rather, they are stored in the hints container so that when a subscription is
made a "real" hint can be generated for the subscription if one does not yet
exist. The extension state core takes care of this correctly by matching
against non-pattern matching extensions prior to pattern matching extensions.

Because of this, however, the ExtensionStateList AMI action was returning
pattern matching hints when executed. These hints are meaningless from the
perspective of AMI clients: their state will never change, they cannot be
subscribed to, and events would never normally be generated from them. As such,
we now filter these out of the response.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420309 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-07 14:17:54 +00:00
George Joseph 3e5ab6ca39 pbx_lua: fix regression with global sym export and context clash by pbx_config.
ASTERISK-23818 (lua contexts being overwritten by contexts of the same name in
pbx_config) surfaced because pbx_lua, having the AST_MODFLAG_GLOBAL_SYMBOLS
set, was always force loaded before pbx_config.  Since I couldn't find any
reason for pbx_lua to export it's symbols to the rest of Asterisk, I simply
changed the flag to AST_MODFLAG_DEFAULT.  Problem solved.  What I didn't
realize was that the symbols need to be exported not because Asterisk needs
them but because any external Lua modules like luasql.mysql need the base
Lua language APIs exported (ASTERISK-17279).

Back to ASTERISK-23818...  It looks like there's an issue in pbx.c where
context_merge was only merging includes, switches and ignore patterns if
the context was already existing AND has extensions, or if the context was
brand new.  If pbx_lua is loaded before pbx_config, the context will exist
BUT pbx_lua, being implemented as a switch, will never place extensions in
it, just the switch statement.  The result is that when pbx_config loads,
it never merges the switch statement created by pbx_lua into the final
context.

This patch sets pbx_lua's modflag back to AST_MODFLAG_GLOBAL_SYMBOLS and adds
an "else if" in context_merge that catches the case where an existing context
has includes, switchs or ingore patterns but no actual extensions.

ASTERISK-23818 #close
Reported by: Dennis Guse
Reported by: Timo Teräs
Tested by: George Joseph
Review: https://reviewboard.asterisk.org/r/3891/
........

Merged revisions 420146 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

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

Merged revisions 420148 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420149 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-06 16:12:26 +00:00
Kinsey Moore f1036f40dc Stasis: Allow message types to be blocked
This introduces stasis.conf and a mechanism to prevent certain message
types from being published. Internally, this works by preventing the
chosen message types from being created which ensures that those
message types can never be published. This patch also adjusts message
publishers such that message payloads are not created if the related
message type is not available.

ASTERISK-23943 #close
Review: https://reviewboard.asterisk.org/r/3823/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420124 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-06 12:55:28 +00:00
Matthew Jordan 47bf7efc4d Multiple revisions 420089-420090,420097
........
  r420089 | mjordan | 2014-08-05 15:10:52 -0500 (Tue, 05 Aug 2014) | 72 lines
  
  ARI: Add channel technology agnostic out of call text messaging
  
  This patch adds the ability to send and receive text messages from various
  technology stacks in Asterisk through ARI. This includes chan_sip (sip),
  res_pjsip_messaging (pjsip), and res_xmpp (xmpp). Messages are sent using the
  endpoints resource, and can be sent directly through that resource, or to a
  particular endpoint.
  
  For example, the following would send the message "Hello there" to PJSIP
  endpoint alice with a display URI of sip:asterisk@mycooldomain.org:
  
  ari/endpoints/sendMessage?to=pjsip:alice&from=sip:asterisk@mycooldomain.org&body=Hello+There
  
  This is equivalent to the following as well:
  
  ari/endpoints/PJSIP/alice/sendMessage?from=sip:asterisk@mycooldomain.org&body=Hello+There
  
  Both forms are available for message technologies that allow for arbitrary
  destinations, such as chan_sip.
  
  Inbound messages can now be received over ARI as well. An ARI application that
  subscribes to endpoints will receive messages from those endpoints:
  
  {
    "type": "TextMessageReceived",
    "timestamp": "2014-07-12T22:53:13.494-0500",
    "endpoint": {
      "technology": "PJSIP",
      "resource": "alice",
      "state": "online",
      "channel_ids": []
    },
    "message": {
      "from": "\"alice\" <sip:alice@127.0.0.1>",
      "to": "pjsip:asterisk@127.0.0.1",
      "body": "Watson, come here.",
      "variables": []
    },
    "application": "testsuite"
  }
  
  The above was made possible due to some rather major changes in the message
  core. This includes (but is not limited to):
  - Users of the message API can now register message handlers. A handler has
    two callbacks: one to determine if the handler has a destination for the
    message, and another to handle it.
  - All dialplan functionality of handling a message was moved into a message
    handler provided by the message API.
  - Messages can now have the technology/endpoint associated with them.
    Various other properties are also now more easily accessible.
  - A number of ao2 containers that weren't really needed were replaced with
    vectors. Iteration over ao2_containers is expensive and pointless when
    the lifetime of things is well defined and the number of things is very
    small.
  
  res_stasis now has a new file that makes up its structure, messaging. The
  messaging functionality implements a message handler, and passes received
  messages that match an interested endpoint over to the app for processing.
  
  Note that inadvertently while testing this, I reproduced ASTERISK-23969.
  res_pjsip_messaging was incorrectly parsing out the 'to' field, such that
  arbitrary SIP URIs mangled the endpoint lookup. This patch includes the
  fix for that as well.
  
  Review: https://reviewboard.asterisk.org/r/3726
  
  ASTERISK-23692 #close
  Reported by: Matt Jordan
  
  ASTERISK-23969 #close
  Reported by: Andrew Nagy
........
  r420090 | mjordan | 2014-08-05 15:16:37 -0500 (Tue, 05 Aug 2014) | 2 lines
  
  Remove automerge properties :-(
........
  r420097 | mjordan | 2014-08-05 16:36:25 -0500 (Tue, 05 Aug 2014) | 2 lines
  
  test_message: Fix strict-aliasing compilation issue
........

Merged revisions 420089-420090,420097 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420098 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-05 21:44:09 +00:00
Jonathan Rose 2e350d6bd6 chan_iax2: Fix a crash that occurs when using allow=all for an IAX2 peer
Or any combination of codecs that includes Opus.

ASTERISK-24107 #close
Review: https://reviewboard.asterisk.org/r/3885/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420028 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-05 13:59:53 +00:00
Richard Mudgett e2d8fce2a3 Remove duplicate definitions of ast_format_vp8.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420007 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-04 21:00:51 +00:00
Rusty Newton 1dce73d278 Manager - Improve documentation for manager commands Getvar and Setvar.
The documentation for these commands did not make it clear that they could
accept expressions and functions. Modified to make this clear, but tried
not to be overly explicit.

ASTERISK-21178 #close
Reported by: Rusty Newton
Tested by: Rusty Newton

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

Merged revisions 419942 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

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

Merged revisions 419944 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419945 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-04 19:47:06 +00:00
Matthew Jordan bbeaeea1a3 res_hep_rtcp: Add module that sends RTCP information to a Homer Server
This patch adds a new module to Asterisk, res_hep_rtcp. The module subscribes
to the RTCP topics in Stasis and receives RTCP information back from the
message bus. It encodes into HEPv3 packets and sends the information to the
res_hep module for transmission.

Using this, someone with a Homer server can get live call quality monitoring
for all RTP-based channels in their Asterisk 12+ systems.

In addition, there were a few bugs in the RTP engine, res_rtp_asterisk, and
chan_pjsip that were uncovered by the tests written for the Asterisk Test
Suite. This patch fixes the following:
1) chan_pjsip failed to set its channel unique ids on its RTP instance on
   outbound calls. It now does this in the appropriate location, in the
   serialized call callback.
2) The rtp_engine was overflowing some values when packed into JSON.
   Specifically, some longs and unsigned ints can't be be packed into integer
   values, for obvious reasons. Since libjansson only supports integers,
   floats, strings, booleans, and objects, we print these values into strings.
3) res_rtp_asterisk had a few problems:
   (a) it would emit a source IP address of 0.0.0.0 if bound to that IP
       address. We now use ast_find_ourip to get a better IP address, and
       properly marshal the result into an ast_strdupa'd string.
   (b) Reports can be generated with no report bodies. In particular, this
       occurs when a sender is transmitting information to a receiver (who
       will send no RTP back to the sender). As such, the sender has no report
       body for what it received. We now properly handle this case, and the
       sender will emit SR reports with no body. Likewise, if we receive an
       RTCP packet with no report body, we will still generate the appropriate
       events.

ASTERISK-24119 #close
........

Merged revisions 419823 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419825 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-31 11:57:51 +00:00
Matthew Jordan 922e3203a9 xmldocs: Add support for an <example> tag in the Asterisk XML Documentation
This patch adds support for an <example /> tag in the XML documentation schema.

For CLI help, this doesn't change the formatting too much:
 - Preceeding white space is removed
 - Unlike with para elements, new lines are preserved

However, having an <example /> tag in the XML schema allows for the wiki
documentation generation script to surround the documentation with {code} or
{noformat} tags, generating much better content for the wiki - and allowing us
to put dialplan examples (and other code snippets, if desired) into the
documentation for an application/function/AMI command/etc.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419822 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-31 11:49:40 +00:00