Commit Graph

4730 Commits

Author SHA1 Message Date
Matthew Jordan 97834718c2 Remove many deprecated modules
Billing records are fair,
To get paid is quite bright,
You should really use ODBC;
Good-bye cdr_sqlite.

Microsoft did once push H.323,
Hell, we all remember NetMeeting.
But try to compile chan_h323 now
And you will take quite a beating.

The XMPP and SIP war was fierce,
And in the distant fray
Was birthed res_jabber/chan_jingle;
But neither to stay.

For everyone did care and chase what Google professed.
"Free Internet Calling" was what devotees cried,
But Google did change the specs so often
That the developers were happy the day chan_gtalk died.

And then there was that odd application
Dedicated to the Polish tongue.
app_saycountpl was subsumed by Say;
One could say its bell was rung.

To read and parse a file from the dialplan
You could (I guess) use an application.
app_readfile did fill that purpose, but I think
A function is perhaps better in its creation.

Barging is rude, I'm not sure why we do it.
Inwardly, the caller will probably sigh.
But if you really must do it,
Don't use app_dahdibarge, use ChanSpy.

We all despise the sound of tinny robots
It makes our queues so cold.
To control such an abomination
It's better to not use Wait/SetMusicOnHold.

It's often nice to know properties of a channel
It makes our calls right
We have a nice function called CHANNEL
And so SIPCHANINFO is sent off into the night.

And now things get odd;
Apparently one could delimit with a colon
Properties from the SIPPEER function!
Commas are in; all others are done.

Finally, a word on pipes and commas.
We're sorry. We can't say it enough.
But those compatibility options in asterisk.conf;
To maintain them forever was just too tough.

This patch removes:

* cdr_sqlite
* chan_gtalk
* chan_jingle
* chan_h323
* res_jabber
* app_saycountpl
* app_readfile
* app_dahdibarge

It removes the following applications/functions:

* WaitMusicOnHold
* SetMusicOnHold
* SIPCHANINFO

It removes the colon delimiter from the SIPPEER function.

Finally, it also removes all compatibility options that were configurable from
asterisk.conf, as these all applied to compatibility with Asterisk 1.4 systems.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@418019 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-04 13:26:37 +00:00
Richard Mudgett 9b10813a2b res_ari: Fix some off-nominal paths just dropping the HTTP connection.
* Removed some incorrect newlines on ast_http_error() messages in
manager.c.

* Removed an incorrect newline in res_ari_channels.c.

Addendum to ASTERISK-23552
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417933 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-03 19:06:12 +00:00
Jonathan Rose 04a9123309 pbx_config: Add manager actions to add/remove extensions
Adds two new manager commands to pbx_config - DialplanExtensionAdd and
DialplanExtensionRemove which allow manager users to create and delete
extensions respectively.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417910 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-03 17:20:00 +00:00
Richard Mudgett dbec5e0d8d HTTP: Add persistent connection support.
Persistent HTTP connection support is needed due to the increased usage of
the Asterisk core HTTP transport and the frequency at which REST API calls
are going to be issued.

* Add http.conf session_keep_alive option to enable persistent
connections.

* Parse and discard optional chunked body extension information and
trailing request headers.

* Increased the maximum application/json and
application/x-www-form-urlencoded body size allowed to 4k.  The previous
1k was kind of small.

* Removed a couple inlined versions of ast_http_manid_from_vars() by
calling the function.  manager.c:generic_http_callback() and
res_http_post.c:http_post_callback()

* Add missing va_end() in ast_ari_response_error().

* Eliminated unnecessary RAII_VAR() use in http.c:auth_create().

ASTERISK-23552 #close
Reported by: Scott Griepentrog

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417901 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-03 17:16:55 +00:00
Matthew Jordan 758b13858b main/tcptls: Add checks for OpenSSL Elliptic Curve support
The patch for ASTERISK-23905 that added PFS support in Asterisk depends on the
elliptic curve library support being present in OpenSSL. As it turns out, some
versions of OpenSSL don't have this library - notably the version running on
our build agents.

This patch fixes the build by providing a configure check for the specific
library calls that the PFS patch relies on.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417900 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-03 16:55:44 +00:00
Matthew Jordan eaee92198d main/tcptls: Add support for Perfect Forward Secrecy
This patch enables Perfect Forward Secrecy (PFS) in Asterisk's core TLS API.
Modules that wish to enable PFS should consider the following:

- Ephemeral ECDH (ECDHE) is enabled by default. To disable it, do not
  specify a ECDHE cipher suite in a module's configuration, for example:
  tlscipher=AES128-SHA:DES-CBC3-SHA

- Ephemeral DH (DHE) is disabled by default. To enable it, add DH parameters
  into the private key file, i.e., tlsprivatekey. For an example, see the
  default dh2048.pem at
http://www.opensource.apple.com/source/OpenSSL098/OpenSSL098-35.1/src/apps/dh2048.pem?txt

- Because clients expect the server to prefer PFS, and because OpenSSL sorts
  its cipher suites by bit strength, (see "openssl ciphers -v DEFAULT")
  consider re-ordering your cipher suites in the conf file. For example:
tlscipher=AES128+kEECDH:AES128+kEDH:3DES+kEDH:AES128-SHA:DES-CBC3-SHA:-ADH:-AECDH
  will use PFS when offered by the client. Clients which do not offer PFS
  fall-back to AES-128 (or even 3DES as recommend by RFC 3261).

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

ASTERISK-23905 #close
Reported by: Alexander Traud
patches:
  tlsPFS_for_HEAD.patch uploaded by Alexander Traud (License 6520)
  tlsPFS.patch uploaded by Alexander Traud (License 6520)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417803 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-03 12:10:17 +00:00
Matthew Jordan d1c6a9e69e main/untils: Prevent potential infinite loop in ast_careful_fwrite
A loop in ast_careful_fwrite exists that will continually attempt to write to
a file stream, even in the presence of EAGAIN/EINTR errors. However, if a
connection that uses ast_careful_fwrite closes suddenly, ast_careful_fwrite's
call to fflush may return EAGAIN/EINTER along with EOF. A subsequent call to
fflush will return EOF but not clear errno, resulting in an infinite loop.

This patch clears errno after it is detected and handled the loop, such that
any subsequent call to fflush will not get erroneously stuck.

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

#ASTERISK-23984 #close
Reported by: Steve Davies
patches:
  fflush_loop_fix uploaded by one47 (License 5012)
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417800 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-03 11:27:25 +00:00
Joshua Colp 6e60f5d317 Recorded merge of revisions 417677 from http://svn.asterisk.org/svn/asterisk/branches/11
........
res_rtp_asterisk: Add SHA-256 support for DTLS and perform DTLS negotiation on RTCP.

This change fixes up DTLS support in res_rtp_asterisk so it can accept and provide
a SHA-256 fingerprint, so it occurs on RTCP, and so it occurs after ICE negotiation
completes. Configuration options to chan_sip and chan_pjsip have also been added to
allow behavior to be tweaked (such as forcing the AVP type media transports in SDP).

ASTERISK-22961 #close
Reported by: Jay Jideliov

Review: https://reviewboard.asterisk.org/r/3679/
Review: https://reviewboard.asterisk.org/r/3686/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417679 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-30 19:51:28 +00:00
Matthew Jordan af90afd90c app_voicemail, say: Add support for Japanese Language
This patch adds support for the Japanese language to both the say family of
applications, as well as for VoiceMail and VoiceMailMain. A new pack of
language sounds will be released at the same time as the next major version
of Asterisk to support the new language features.

The language features can be enabled using a language code of 'ja'.

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

ASTERISK-23324 #close
Reported by: Kevin McCoy
patches:
  app_voicemail.c.20140226.jb.patch uploaded by Kevin McCoy (License 6586)
  say.c.20140226.jb.patch uploaded by Kevin McCoy (License 6586)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417591 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-30 04:00:19 +00:00
Richard Mudgett 3148dfbd11 event.c: Fix type mismatch errors in ie_maps[].
In v12+ the type values from the table are only used by the CEL unit
tests.  Since the unit tests were only comparing a generated expected
event with a real event to see if the ie contents matched and using the
same table IE_PLTYPE values to read the event contents, the type
mismatches were not detected.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417571 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-27 23:21:44 +00:00
Corey Farrell 024316fa3a Ensure REF_DEBUG records entrys for attempts to ao2_ref an invalid object
This change ensures that __ao2_ref_debug writes to ref_log when given a
non-NULL pointer to an invalid ao2 object.  This is to ensure that we
record any attempt manipulate references of already freed objects.

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417511 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-27 19:27:59 +00:00
Kinsey Moore 6145a57c83 CEL: Add bridge tech to relevant CEL records
Add the "bridge_technology" extra field key to BRIDGE_ENTER and
BRIDGE_EXIT CEL events to convey the bridge technology in use at the
time the record was generated.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417383 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-26 14:48:21 +00:00
Kinsey Moore e977b7936b Bridging: Allow channels to define bridging hooks
This patch allows the current owner of a channel to define various
feature hooks to be made available once the channel has entered a
bridge. This includes any hooks that are setup on the
ast_bridge_features struct such as DTMF hooks, bridge event hooks
(join, leave, etc.), and interval hooks.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417361 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-26 12:43:47 +00:00
Matthew Jordan f27074eeb7 udptl: Correct FEC to not consider negative sequence numbers as missing
When using FEC, with span=3 and entries=4 Asterisk will attempt to repair
the packet with sequence number 5, as it will see that packet -4 is
missing. The result is Asterisk sending garbage packets that can kill a
fax.

This patch adds a check to see if the sequence number is valid before
checking if the packet is missing.

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

#ASTERISK-23908 #close
Reported by: Torrey Searle
patches:
  udptl_fec.patch uploaded by Torrey Searle (License 5334)
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417327 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-26 12:24:25 +00:00
Corey Farrell 4a7a36a0a1 ao2_container node object ignores REF_DEBUG in all places except one
Almost every reference operation against container node's uses
__ao2_alloc or __ao2_ref, thereby preventing ref logging for
the nodes.  One node reference is released with ao2_t_ref, causing
refcounter.py to falsely report skews and leaks for many nodes.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417213 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-25 18:57:04 +00:00
Corey Farrell db6a8a6347 Move eid functions to utils.c, mark netsock.h deprecated
Move eid functions from netsock.c to utils.c.  These functions were
already published by utils.h.  Flag netsock.h as deprecated and switch
res_pjsip_session.h to use netsock2.h.  The only code that still uses
netsock.h is chan_iax2.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417167 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-24 02:50:15 +00:00
Richard Mudgett eb2aded25c core_unreal: Fix off by one buffer overwrite error.
Appending the ;2 to the user supplied ;1 uniqueid to create the ;2 version
if the user did not also supply an extra uniqueid for the ;2 channel
resulted in allocating a buffer that was one byte too small.

* Fix off by one error in ast_unreal_new_channels() when generating the ;2
uniqueid from the user suppled ;1 version.

* Pulled some long assignment lines from if tests to improve line break
readability in ast_unreal_new_channels().
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-23 16:04:33 +00:00
Jonathan Rose e087ae0c02 Logger: Add manager command 'LoggerRotate' to rotate logger
Part of a series of AMI command equivalents to existing CLI
commands

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416848 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-20 20:29:45 +00:00
Richard Mudgett 86e8ab5ed4 voicemail API callbacks: Extract the sayname API call to its own registerd callback.
* Extract the sayname API call to its own registerd callback.  This allows
the app_directory and app_chanspy applications to say a mailbox owner's
name using an alternate provider when app_voicemail is not available
because you are using res_mwi_external.  app_directory still uses the
voicemail.conf file.

AFS-64 #close
Reported by: Mark Michelson


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-20 17:06:42 +00:00
George Joseph 577632dec9 astobj2: Additional refactoring to push impl specific code down into the impls.
Move some implementation specific code from astobj2_container.c into
astobj2_hash.c and astobj2_rbtree.c.  This completely removes the need for
astobj2_container to switch on RTTI and it no longer has any knowledge of
the implementation details.

Also adds AO2_DEBUG as a new compile option in menuselect which controls
astobj2 debugging independently of AST_DEVMODE and REF_DEBUG.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-20 15:27:43 +00:00
George Joseph d87f8c429e pjsip cli: Change Identify to show CIDR notation instead of netmasks.
* Added ast_sockaddr_cidr_bits() to count the 1 bits in an ast_sockaddr.
* Added ast_ha_join_cidr() which uses ast_sockaddr_cidr_bits() for the netmask
  instead of ast_sockaddr_stringify_addr.
* Changed res_pjsip_endpoint_identifier_ip to call ast_ha_join_cidr() instead
  of ast_ha_join() for the CLI output.

This is a CLI change only.  AMI was not affected.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416738 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-19 20:13:20 +00:00
Kinsey Moore bd36288efa Fix build warnings with TEST_FRAMEWORK enabled
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416736 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-19 19:40:45 +00:00
Matthew Jordan a965613cf7 stasis_channels: Update the stasis cache if manager variables are needed
In r416211, the publishing of variable changes was modified such that a
cached channel snapshot was used if manager variables were not requested
with each AMI event. This was done to reduce the amount of channel snapshots
created.

However, an assumption was made that generating a channel snapshot and
publishing the snapshot to the channel topic was sufficient to ensure that
the cache would be updated; this is not the case. The channel snapshot type
must be used to force a snapshot update.

This patch updates the publication of channel variables such that the cache
is updated prior to publication of the channel variable message if manager
variables are in use. This ensures that all AMI events receive the variable
update when they are supposed to.

Note that this issue was caught by the Asterisk Test Suite (go go testing)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416561 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-18 04:22:05 +00:00
Igor Goncharovskiy a1e0a5e4b0 We have faced situation when using CDR and CEL by sqlite3 modules. With system having high load (~100 concurrent calls created by sipp) we found many cdr and cel records missed. There is special finction in sqlite3, that make able to fix this situation - sqlite3_wait_timeout, that also can replace awful code cdr_sqlite3 ad cel_sqlite3 modules. Also this function can be used for aastdb and res_config_sqlite3 to avoid missed writes to sqlite db.
#ASTERISK-23766 #close
Reported by: Igor Goncharovsky

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416339 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-16 09:04:05 +00:00
Matthew Jordan 072b61bbed channel_internal_api: Publish a snapshot change when linkedids change
Snapshots are now not published *quite* as much as they used to. One instance
where they are not published any longer is during bridge enter and exit - the
state of the channel doesn't change, the bridge does. However, channels are
changed when a linkedid is propagated; previously, the channel's state would
be updated and published during the bridge enter event. Now this must be
explicitly done.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416301 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-15 22:12:49 +00:00
Matthew Jordan 9cc1a8e893 stasis: Reduce creation of channel snapshots to improve performance
During some performance testing of Asterisk with AGI, ARI, and lots of Local
channels, we noticed that there's quite a hit in performance during channel
creation and releasing to the dialplan (ARI continue). After investigating
the performance spike that occurs during channel creation, we discovered
that we create a lot of channel snapshots that are technically unnecessary.
This includes creating snapshots during:
 * AGI execution
 * Returning objects for ARI commands
 * During some Local channel operations
 * During some dialling operations
 * During variable setting
 * During some bridging operations
And more.

This patch does the following:
 - It removes a number of fields from channel snapshots. These fields were
   rarely used, were expensive to have on the snapshot, and hurt performance.
   This included formats, translation paths, Log Call ID, callgroup, pickup
   group, and all channel variables. As a result, AMI Status,
   "core show channel", "core show channelvar", and "pjsip show channel" were
   modified to either hit the live channel or not show certain pieces of data.
   While this is unfortunate, the performance gain from this patch is worth
   the loss in behaviour.
 - It adds a mechanism to publish a cached snapshot + blob. A large number of
   publications were changed to use this, including:
   - During Dial begin
   - During Variable assignment (if no AMI variables are emitted - if AMI
     variables are set, we have to make snapshots when a variable is changed)
   - During channel pickup
   - When a channel is put on hold/unhold
   - When a DTMF digit is begun/ended
   - When creating a bridge snapshot
   - When an AOC event is raised
   - During Local channel optimization/Local bridging
   - When endpoint snapshots are generated
   - All AGI events
   - All ARI responses that return a channel
   - Events in the AgentPool, MeetMe, and some in Queue
 - Additionally, some extraneous channel snapshots were being made that were
   unnecessary. These were removed.
 - The result of ast_hashtab_hash_string is now cached in stasis_cache. This
   reduces a large number of calls to ast_hashtab_hash_string, which reduced
   the amount of time spent in this function in gprof by around 50%.

#ASTERISK-23811 #close
Reported by: Matt Jordan

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-13 18:24:49 +00:00
Kinsey Moore b2012ccb0a CEL: Expose parking retreiver in extra field
This exposes the retreiver of a parked call under the "retreiver" key
of the extra field when this information is available.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416149 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-13 12:56:06 +00:00
Richard Mudgett 13e697f8c0 AST-2014-007: Fix of fix to allow AMI and SIP TCP to send messages.
ASTERISK-23673 #close
Reported by: Richard Mudgett

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416071 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-13 05:16:34 +00:00
Rusty Newton 9ec5064383 main/pbx - documentation - enhance 'core show hints' and 'core show hint' help text
Adds descriptive help text to 'core show hints' and 'core show hint'. The text describes the various columns for the sake of clarity. It takes into account recent changes to the content displayed by the commands https://reviewboard.asterisk.org/r/3604/ and https://reviewboard.asterisk.org/r/3611/.

ASTERISK-23764
Review: https://reviewboard.asterisk.org/r/3610/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416024 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-12 21:27:02 +00:00
Richard Mudgett 4ca5745dbe AST-2014-007: Fix DOS by consuming the number of allowed HTTP connections.
Simply establishing a TCP connection and never sending anything to the
configured HTTP port in http.conf will tie up a HTTP connection.  Since
there is a maximum number of open HTTP sessions allowed at a time you can
block legitimate connections.

A similar problem exists if a HTTP request is started but never finished.

* Added http.conf session_inactivity timer option to close HTTP
connections that aren't doing anything.  Defaults to 30000 ms.

* Removed the undocumented manager.conf block-sockets option.  It
interferes with TCP/TLS inactivity timeouts.

* AMI and SIP TLS connections now have better authentication timeout
protection.  Though I didn't remove the bizzare TLS timeout polling code
from chan_sip.

* chan_sip can now handle SSL certificate renegotiations in the middle of
a session.  It couldn't do that before because the socket was non-blocking
and the SSL calls were not restarted as documented by the OpenSSL
documentation.

* Fixed an off nominal leak of the ssl struct in
handle_tcptls_connection() if the FILE stream failed to open and the SSL
certificate negotiations failed.

The patch creates a custom FILE stream handler to give the created FILE
streams inactivity timeout and timeout after a specific moment in time
capability.  This approach eliminates the need for code using the FILE
stream to be redesigned to deal with the timeouts.

This patch indirectly fixes most of ASTERISK-18345 by fixing the usage of
the SSL_read/SSL_write operations.

ASTERISK-23673 #close
Reported by: Richard Mudgett
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415907 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-12 17:00:08 +00:00
Richard Mudgett 71b3c9a749 format.c: Fix misuse of hash container function.
The supplied hash function to a container must be idempotent given the
object's key value to figure out which container bucket the object belongs
in.  Returning a random number or the current container count is not
idempotent.  The "computed hash" value doesn't help find the object later
in those cases.

* Fixed the format_list container to actually be a list since that is how
the container is used.  Conceptually, if more than 283 formats were added
to the format_list then odd things may have happened before the fix.
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415730 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-11 23:01:19 +00:00
Scott Griepentrog d5298f2a1b CLI: correct presence information on core show hints
Adds presence to core show hint and changes presence
string conversion to use the correct function.

ASTERISK-23858 #close
Review: https://reviewboard.asterisk.org/r/3611/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415715 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-11 20:22:23 +00:00
Scott Griepentrog d7ed0a1ece CLI: add presence information to core show hints
Adds presence state value to output of core show
hints.  Also reformats the output slightly so it
doesn't use as much space as it would otherwise.

Was:
                   1000@demo                : SIP/1000              State:Unavailable     Watchers  0

Now: 
1000@demo           : SIP/1000              State:Unavailable     Presence:Idle            Watchers  0

AFS-53 #close
Review: https://reviewboard.asterisk.org/r/3604/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415698 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-10 22:31:04 +00:00
Kinsey Moore 2bd6a010a6 Fix build in dev mode due to signed/unsigned mismatch
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415679 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-10 18:32:12 +00:00
Jonathan Rose a0adb8a26b PJSIP: PJSIPNotify - Strip content-length headers and add documentation
Documentation for how to add custom headers/content to notifies created
with the PJSIPNotify manager action was a little sparse and it also
wasn't vetting application of Content-length headers like its chan_sip
equivalent was (so two Content-length headers could be applied... and
PJSIP determines the content length anyway, so it just opens people up
for error). This patch also flips the variable order so that the
variables are interpreted in the same order as they are put in the AMI
action.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415659 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-10 16:06:12 +00:00
Corey Farrell 8da7f0248f autoservice: stop thread on graceful shutdown
This change adds thread shutdown to autoservice for graceful shutdowns only.
ast_register_cleanup is backported to 1.8 to allow this.  The logger callid
is also released on shutdown in 11+.

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415466 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-09 03:50:45 +00:00
Matthew Jordan 20a14e568f bridges/bridge_native_rtp: Reconfigure bridge on removal of framehook
This patch is a re-do of r414122.

When r414122 was merged, a major problem with it was uncovered. UNBRIDGE soft
hangup flags have a catastrophic effect on the pbx core if they leak out from
the bridge layer: the channel gets hung up. With the number of threads
involved in a blind transfer, and with the initial patch, it was likely that
this would occur. This caused a large number of test failures

This patch is nearly identical with the one proposed in r414122, save for the
following changes:
 - We explicitly clear the UNBRIDGE flag when setting an after goto on a
   channel in a bridge
 - Defensively, if we encounter an UNBRIDGE flag in the pbx core, we handle it

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415444 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-08 18:12:53 +00:00
Jonathan Rose 5ca495ed2f chan_sip: Fix order of variables specified in SIPNotify action
Prior to this patch, sequential variables would be ordered in reverse
from the order specified in the manager action.

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415411 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-06 21:44:16 +00:00
Kevin Harwell 4308aa5648 core uri: Custom uri parsing error when no query parameters
If using the custom URI parsing code (not external uriparser lib) and there
was no query parameters the resulting pointer would be NULL and then an
attempt was made to subtract from it.  The pointer is now set to a valid
value if there is no query parameter(s).

Also, in the 'ast_uri_make_host_with_port' function when setting the terminator
on the resulting string it was writing it one past the end of allocated memory.
It now writes the string terminator appropriately.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415358 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-06 20:45:05 +00:00
George Joseph 077c4187d9 Split astobj2.c into more maintainable components.
Split astobj2.c into the following files to improve maintainability.

astobj2.c - object primitives, object primitive misc and initialization code.
astobj2_private.h - internal object declarations needed by the containers.
astobj2_container.c - generic conainer and container misc code.
astobj2_container_hash.c - hash container specific code.
astobj2_container_rbtree.c - rbtree container specific code.
astobj2_container_private.h - generic container definitions and rtti prototypes.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415319 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-06 14:12:57 +00:00
Richard Mudgett b0abea6028 config: Fix indentation and missing curlies in config_text_file_load().
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415288 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-05 19:04:02 +00:00
Richard Mudgett 61b0be0600 config: Fix config files not reloading when only an included file changes.
The twisted logic determining if a config file should be reloaded was
mostly broken and disabled.  The incorrect test that ASTERISK-23383 fixed
actually reenabled the broken logic.  The incorrect test was causing the
timestamp to always be cleared which caused config files with includes to
always be reloaded.

* Made wildcard includes always cause a reload.  Determining if a file was
deleted cannot be determined without restructuring the cache to determine
if any files are missing from the last files actually loaded.  Also
without refactoring config_text_file_load(), the glob loop couldn't check
more than one file for changes anyway.

* Made remove the cache entry if the file no longer exists when trying to
get its timestamp or it is no longer a regular file.  This fixes the
corner case where the file was loaded, then deleted, then the config
reloaded, then the file restored with the same timestamp, and then the
config reloaded again.

* Made remove the cache entry include list when actually loading the file.
This gets rid of any stale includes the file had from the last time the
file was loaded.

ASTERISK-23683 #close
Reported by: tootai

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415231 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-05 18:02:08 +00:00
Kevin Harwell e763d70470 res_http_websocket: Create a websocket client
Added a websocket server client in Asterisk. Asterisk has a websocket server,
but not a client. The ability to have Asterisk be able to connect to a websocket
server can potentially be useful for future work (for instance this could allow
ARI to connect back to some external system, although more work would be needed
in order to incorporate that).

Also a couple of things to note - proxy connection support has not been
implemented and there is limited http response code handling (basically, it is
connect or not).

Also added an initial new URI handling mechanism to core.  Internet type URI's
are parsed into a data structure that contains pointers to the various parts of
the URI.

(closes issue ASTERISK-23742)
Reported by: Kevin Harwell
Review: https://reviewboard.asterisk.org/r/3541/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-05 17:22:35 +00:00
Matthew Jordan 53968c00b3 TALK_DETECT: A channel function that raises events when talking is detected
This patch adds a new channel function TALK_DETECT that, when set on a
channel, causes events indicating the start/stop of talking on a channel to be
emitted to both AMI and ARI clients. 

The function allows setting both the silence threshold (the length of silence
after which we decide no one is talking) as well as the talking threshold (the
amount of energy that counts as talking). Parameters can be updated on a channel
after talk detection has been enabled, and talk detection can be removed at
any time.

The events raised by the function use a nomenclature similar to existing AMI/ARI
events.
For AMI: ChannelTalkingStart/ChannelTalkingStop
For ARI: ChannelTalkingStarted/ChannelTalkingFinished

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414935 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-30 12:42:57 +00:00
Matthew Jordan e9f09ab2bc main/config.c: AMI action UpdateConfig EmptyCat clears all categories
When invoking UpdateConfig AMI action with Action set to EmptyCat, Asterisk
will make all categories empty in the config but the one requested with a
Cat variable. This is due to a bug in ast_category_empty (main/config.c)
that makes an incorrect comparison for a category name.

This patch corrects the comparison such that only the requested category
is cleared.

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

#ASTERISK-23803 #close
Reported by: zvision
patches:
  manager.c.diff uploaded by zvision (License 5755)
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414883 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-30 12:05:33 +00:00
Kinsey Moore e039996571 PBX: Prevent incorrect hint parsing
Dynamic and pattern matching hints should not be checked for their last
known state until they are instantiated by subscribers.

(closes issue AFS-56)
Reported by: John Hardin
Patch AFS-56-pbx.diff submitted by Matt Jordan (license 6283)
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414861 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-29 18:51:41 +00:00
Matthew Jordan fb5690ce4b Logger/CLI/etc.: Fix some aesthetic issues; reduce chatty verbose messages
This patch addresses some aesthetic issues in Asterisk. These are all just
minor tweaks to improve the look of the CLI when used in a variety of
settings. Specifically:
 * A number of chatty verbose messages were removed or demoted to DEBUG
   messages. Verbose messages with a verbosity level of 5 or higher were -
   if kept as verbose messages - demoted to level 4. Several messages
   that were emitted at verbose level 3 were demoted to 4, as announcement
   of dialplan applications being executed occur at level 3 (and so the
   effects of those applications should generally be less).
 * Some verbose messages that only appear when their respective 'debug'
   options are enabled were bumped up to always be displayed.
 * Prefix/timestamping of verbose messages were moved to the verboser
   handlers. This was done to prevent duplication of prefixes when the
   timestamp option (-T) is used with the CLI.
 * Verbose magic is removed from messages before being emitted to
   non-verboser handlers. This prevents the magic in multi-line verbose
   messages (such as SIP debug traces or the output of DumpChan) from
   being written to files.
 * _Slightly_ better support for the "light background" option (-W) was
   added. This includes using ast_term_quit in the output of XML
   documentation help, as well as changing the "Asterisk Ready" prompt to
   bright green on the default background (which stands a better chance of
   being displayed properly than bright white).

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414798 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-28 22:54:12 +00:00
Matthew Jordan 09bbfa76ab core_unreal: Prevent double free of core_unreal pvt
When a channel is destroyed (such as via ast_channel_release in off nominal
paths in core_unreal), it will attempt to free (via ast_free) the channel tech
pvt. This is problematic for a few reasons:
1. The channel tech pvt is an ao2 object in core_unreal. Free'ing the pvt
   directly is no good.
2. The channel tech pvt's reference count is dropped just prior to calling
   ast_channel_release, resulting in the pvt's destruction. Hence, the
   channel destructor is free'ing an invalid pointer.

This patch keeps the dropping of the reference count, but sets the pvt to
NULL on the channel prior to releasing it. This models what would occur if the
channel was hung up directly.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414543 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-25 02:37:03 +00:00
Kinsey Moore 6b14886dc7 Fix signed/unsigned build warnings
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414475 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-23 14:36:40 +00:00
Scott Griepentrog cf21644d6a ARI: Add ability to raise arbitrary User Events
User events can now be generated from ARI.  Events can be signalled with
arbitrary json variables, and include one or more of channel, bridge, or
endpoint snapshots.  An application must be specified which will receive
the event message (other applications can subscribe to it).  The message
will also be delivered via AMI provided a channel is attached.  Dialplan
generated user event messages are still transmitted via the channel, and
will only be received by a stasis application they are attached to or if
the channel is subscribed to.

This change also introduces the multi object blob mechanism used to send
multiple snapshot types in a single message.  The dialplan app UserEvent
was also changed to use multi object blob, and a new stasis message type
created to handle them.

ASTERISK-22697 #close
Review: https://reviewboard.asterisk.org/r/3494/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414406 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-22 16:09:51 +00:00
Jonathan Rose d00882108f res_pjsip_refer: Fix bugs involving Parking/PJSIP/transfers
PJSIP would never send the final 200 Notify for a blind transfer
when transferring to parking. This patch fixes that. In addition,
it fixes a reference leak when performing blind transfers to
non-bridging extensions.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414403 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-22 15:52:30 +00:00
Matthew Jordan 9cee08f502 res_corosync: Update module to work with Stasis (and compile)
This patch fixes res_corosync such that it works with Asterisk 12. This
restores the functionality that was present in previous versions of
Asterisk, and ensures compatibility with those versions by restoring the
binary message format needed to pass information from/to them.

The following changes were made in the core to support this:
 * The event system has been partially restored. All event definition and
   event types in this patch were pulled from Asterisk 11. Previously, we had
   hoped that this information would live in res_corosync; however, the
   approach in this patch seems to be better for a few reasons:
   (1) Theoretically, ast_events can be used by any module as a binary
       representation of a Stasis message. Given the structure of an ast_event
       object, that information has to live in the core to be used universally.
       For example, defining the payload of a device state ast_event in
       res_corosync could result in an incompatible device state representation
       in another module.
   (2) Much of this representation already lived in the core, and was not
       easily extensible.
   (3) The code already existed. :-)
 * Stasis message types now have a message formatter that converts their
   payload to an ast_event object.
 * Stasis message forwarders now handle forwarding to themselves. Previously
   this would result in an infinite recursive call. Now, this simply creates a
   new forwarding object with no forwards set up (as it is the thing it is
   forwarding to). This is advantageous for res_corosync, as returning NULL
   would also imply an unrecoverable error. Returning a subscription in this
   case allows for easier handling of message types that are published directly
   to an aggregate topic that has forwarders.

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

ASTERISK-22912 #close
ASTERISK-22372 #close
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-22 12:01:37 +00:00
Richard Mudgett 3bac303dc9 core_unreal: Only block media frames when a generator is on both ends of an unreal channel.
The fix for ASTERISK-12292 was a bit too aggressive.  You could have
generators pointed at each other on local channels but need to get other
kinds of frames such as DTMF or CONNECTED_LINE frames accross.
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414297 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-21 22:24:40 +00:00
Matthew Jordan 42a1dee02d Undo r414123
The Test Suite caught a few problems, undoing until those are resolved


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414138 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-19 01:10:23 +00:00
Matthew Jordan 17ff4d9282 bridge_native_rtp/bridge_channel: Fix direct media issues due to frame hook
This patch fixes issues with direct media bridges that occur after a blind
transfer. These issues were caught by the (currently failing)
pjsip/transfers/blind_transfer/caller_direct_media test.

The test currently fails primarily for two reasons:
(1) When Bob and Charlie (the transfer target and the transfer destination)
    enter a bridge together, the framehook remains on the transfer target
    channel until both channels are in the bridge. As it consumes voice frames,
    the initial bridge type is a simple bridge. The framehook is removed when
    both channels are in the bridge; however, this does not currently cause the
    bridging framework to re-evaluate the bridge. This patch adds a
    AST_SOFTHANGUP_UNBRIDGE poke to the transfer target channel when a
    framehook is removed so the bridge can re-evaluate itself.

(2) When a channel leaves a native RTP bridge, it may be leaving due to being
    hung up. Sending a re-INVITE to a channel that is about to be hung up is
    not nice - in fact, there's a good chance we'll send the BYE request before
    the channel has had a chance to send back a 200 OK. To be somewhat nicer,
    this patch adds a function to channel.h that allows the bridging framework
    to query for exactly why a channel is leaving a bridge via the channel's
    soft hangup flags. This allows it to only send the re-INVITE if there's a
    chance the channel will survive the native bridging experience.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414123 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-18 20:38:02 +00:00
Jonathan Rose e81b873fa2 chan_sip: Add TLS and SRTP status to CLI command 'sip show channel'
ASTERISK-23564 #close
Reported by: Patrick Laimbock
Review: https://reviewboard.asterisk.org/r/3474/
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413878 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-13 18:09:13 +00:00
Walter Doekes f66e9d6c9e rtp: Fix case typo in H263+ mime.
http://tools.ietf.org/html/rfc3555#section-4.2.6 says the canonical
mime subtype is "H263-1998", not "h263-1998". Original code was added
in r183101 on 2009-03-19 02:26:50 +0100.

This fixes issues with Polycom phones.

ASTERISK-23665 #close
ASTERISK-23665 #comment Patch r3529.patch uploaded by Guillaume Maudoux, backported by me.
Review: https://reviewboard.asterisk.org/r/3529/
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413790 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-13 13:39:21 +00:00
Joshua Colp d134150be2 framehooks: Add callback for determining if a hook is consuming frames of a specific type.
In the past framehooks have had no capability to determine what frame types a hook
is actually interested in consuming. This has meant that code has had to assume they
want all frames, thus preventing native bridging.

This change adds a callback which allows a framehook to be queried for whether it
is consuming a frame of a specific type. The native RTP bridging module has also
been updated to take advantange of this, allowing native bridging to occur when
previously it would not.

ASTERISK-23497 #comment Reported by: Etienne Lessard
ASTERISK-23497 #close

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413682 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-11 02:09:10 +00:00
Joshua Colp e2ed86e4ca Undoing framehook support. Issues were uncovered by Bamboo.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413668 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-11 01:09:06 +00:00
Joshua Colp 3b3e4b9b95 framehooks: Add callback for determining if a hook is consuming frames of a specific type.
In the past framehooks have had no capability to determine what frame types a hook
is actually interested in consuming. This has meant that code has had to assume they
want all frames, thus preventing native bridging.

This change adds a callback which allows a framehook to be queried for whether it
is consuming a frame of a specific type. The native RTP bridging module has also
been updated to take advantange of this, allowing native bridging to occur when
previously it would not.

ASTERISK-23497 #comment Reported by: Etienne Lessard
ASTERISK-23497 #close

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413651 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-10 18:50:17 +00:00
Kinsey Moore abd3e4040b Allow Asterisk to compile under GCC 4.10
This resolves a large number of compiler warnings from GCC 4.10 which
cause the build to fail under dev mode. The vast majority are
signed/unsigned mismatches in printf-style format strings.
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09 22:49:26 +00:00
Richard Mudgett f3b55da1b8 http.c: Remove dead code.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413572 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09 18:15:34 +00:00
Joshua Colp f2ca3438e7 app_queue: Extend documentation for various Manager actions and events.
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413488 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-08 00:36:38 +00:00
Richard Mudgett 20750e261b chan_sip.c: Fixed off-nominal message iterator ref count and alloc fail issues.
* Fixed early exit in sip_msg_send() not destroying the message iterator.

* Made ast_msg_var_iterator_next() and ast_msg_var_iterator_destroy()
tolerant of a NULL iter parameter in case ast_msg_var_iterator_init()
fails.

* Made ast_msg_var_iterator_destroy() clean up any current message data
ref.

* Made struct ast_msg_var_iterator, ast_msg_var_iterator_init(),
ast_msg_var_iterator_next(), ast_msg_var_unref_current(), and
ast_msg_var_iterator_destroy() use iter instead of i.

* Eliminated RAII_VAR usage in res_pjsip_messaging.c:vars_to_headers().
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413144 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-30 21:03:29 +00:00
Kinsey Moore f7caf4e249 Bridging: Don't lock NULL bridges
When bridge locking was added for bridge snapshot creation, some
locations where bridge locking was added were not guaranteed to
actually have a bridge and locking NULL AO2 objects tends to cause
segfaults. This ensures that NULL bridges aren't locked.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413074 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-28 20:07:37 +00:00
Mark Michelson 7dd64ff993 Add DeviceStateChanged and PresenceStateChanged AMI events.
These events are controlled by two new modules, res_manager_devicestate
and res_manager_presencestate.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413060 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-28 14:40:21 +00:00
Olle Johansson 7c276f9fef tcptls.c : Log errors as ERROR, not warning or something else.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413036 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-27 19:29:27 +00:00
Richard Mudgett e6c4b97521 http: Fix spurious ERROR message in responses with no content.
Backport -r411687 and fix the fix because content_length is the length of
out plus the length of the file controlled by fd.

When a response has an out content length of 0, fwrite would be called to
write a buffer with no data in it.  This resulted in the following classic
error message:

  [Apr  3 11:49:17] ERROR[26421] http.c: fwrite() failed: Success

This patch makes it so that we only attempt to write the content of out if
the out string is non-zero.
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412925 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-23 18:03:41 +00:00
Russell Bryant 4b9b4790d9 Fix error loading res_monitor.
For some odd reason, loading app_mixmonitor was fine, but res_monitor was not.
This patch fixes a set of issues related to func_periodic_hook exporting the
beep functions that gets res_monitor working again.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412910 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-23 15:02:39 +00:00
Kinsey Moore dcb2ea657c HTTP: Add TCP_NODELAY to accepted connections
This adds the TCP_NODELAY option to accepted connections on the HTTP
server built into Asterisk. This option disables the Nagle algorithm
which controls queueing of outbound data and in some cases can cause
delays on receipt of response by the client due to how the Nagle
algorithm interacts with TCP delayed ACK. This option is already set on
all non-HTTP AMI connections and this change would cover standard HTTP
requests, manager HTTP connections, and ARI HTTP requests and
websockets in Asterisk 12+ along with any future use of the HTTP
server.

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412750 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-21 16:16:37 +00:00
Matthew Jordan 9653c6d357 main/asterisk: Fix startup sequence for realtime features
When ASTERISK-23265/ASTERISK-23320 was fixed, it inadvertently led to realtime
features breaking. This was due to features loading prior to realtime. This
patch fixes this by loading features after loading dynamic modules.

ASTERISK-23487 #close
Reported by: Denis
Tested by: Denis
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412699 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-19 02:14:12 +00:00
Richard Mudgett 51b6c49681 Originated calls: Fix several originate call problems.
* Restore the reason value set by pbx_outgoing_attempt() to use
AST_CONTROL_xxx values as all the consumers were expecting rather than
cause codes.

* Fixed the dial routines to set cause codes for more than just
ast_request() so pbx_outgoing_attempt() reason codes will function.

* Fix inconsistent locked_channel return status in pbx_outgoing_attempt().
The chanel may not have been locked or the channel may have been a stale
pointer.

* Fixed the OutgoingSpoolFailed channel to run dialplan whenever the
dialing fails for an originate exten and 1 < synchronous.

* Fix incorrect ast_cond_wait() usage in pbx_outgoing_attempt().
Indroduced by issue ASTERISK-22212 patch.

* Made struct pbx_outgoing use the ao2 lock instead of its own lock for
the cond wait mutex.  No sense in having two locks associated with the
same struct when only one is needed.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412583 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-18 16:44:48 +00:00
Richard Mudgett cbe7f65674 app_dial and app_queue: Make lock the forwarding channel while taking the channel snapshot.
* Fixed ast_channel_publish_dial_forward() not locking the forwarded
channel when taking the channel snapshot.

* Fixed app_dial.c:do_forward() using the wrong channel to get the
original call forwarding string.

* Removed unnecessary locking when calling ast_channel_publish_dial() and
ast_channel_publish_dial_forward() in app_dial and app_queue.  Holding
channel locks when calling ast_channel_publish_dial_forward() with a
forwarded channel could result in pausing the system while the stasis bus
completes processsing a forwarded channel subscription.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-18 16:27:31 +00:00
Kinsey Moore 9a85fc0aa0 ARI: Add debug logging for events and responses
This adds DEBUG level logging for ARI websocket events and HTTP
responses similar to what is available for AMI. Logging for ARI HTTP
requests is already adequate for debugging purposes.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412566 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-18 14:25:47 +00:00
Jonathan Rose c76608f24b Fix a silly shadowed variable mistake that was missed from play tones patch
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412550 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-17 22:42:57 +00:00
Jonathan Rose a8742e327f ARI: Add tones playback resource
Adds a tones URI type to the playback resource. The tone can be specified by
name (from indications.conf) or by a tone pattern. In addition, tonezone can
be specified in the URI (by appending ;tonezone=<zone>). Tones must be
stopped manually in order for a stasis control to move on from playback of
the tone. Tones may be paused, resumed, restarted, and stopped. They may
not be rewound or fast forwarded (tones can't be controlled in a way that
lets you skip around from note to note and pausing and resuming will also
restart the tone from the beginning). Tests are currently in development
for this feature (https://reviewboard.asterisk.org/r/3428/).

(closes issue ASTERISK-23433)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3427/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412536 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-17 21:57:36 +00:00
Matthew Jordan c3497aa2bb main/Makefile: Fix build failure on SmartOS/Illumos/SunOS
This patch fixes two issues when building on SmartOS:

- channels/chan_oss.c: it makes sure soundcard.h is found
- main/Makefile: only use "-Wl,--version-script" when GNU LD is used as the Sun
  Linker doesn't support that. Similar checks are already used elswhere in the
  Makefile

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

ASTERISK-23576 #close
Reported by: Sebastian Wiedenroth
patches:
  fix-sunos.diff uploaded by Sebastian Wiedenroth (License 6597)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412484 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-17 20:25:16 +00:00
Richard Mudgett ba1db5d8f5 Eliminate some more unnecessary RAII_VAR() uses.
RAII_VAR() is not a hammer appropriate to pound all nails.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-15 18:30:24 +00:00
Richard Mudgett 45ade68cb4 Remove unused RAII_VAR() declarations.
* Remove unused RAII_VAR() declarations.  The compiler cannot catch these
because the cleanup function "references" the unused variable.  Some
actually allocated and released resources that were never used.

* Fixed some whitespace issues in stasis_bridges.c.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-15 18:01:47 +00:00
Richard Mudgett d28af99e65 chan_sip.c: Fix channel staging assertion failure.
The failing assertion ensures that the final snapshot gets generated so
CDR records can get finalized.  The only place where a channel staging
snapshot flag could be left set is in chan_sip.c:handle_request_bye().
The function could return before clearing the flag because the channel
could dissappear while the function had to have the channel unlocked.

* Fixed handle_request_bye() channel snapshot staging coverage area to not
have a return in the middle of it and be unable to clear the staging flag.

* Pushed the channel snapshot staging coverage area into
ast_rtp_instance_set_stats_vars() to ensure that the staging is not
interrutped.

* Made callers of ast_rtp_instance_set_stats_vars() not call it with any
channels or channel driver private locks held to eliminate the deadlock
potential.  The callers must hold references to the passed in channel and
rtp objects.

* Eliminated sip_hangup() trying to get the bridge peer.  It is futile at
this point because the channel could never be in a bridge.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412386 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-15 17:07:20 +00:00
Corey Farrell c87f8a599b autoservice: fix reference leak of logger callid.
autoservice acquires a local reference to the logger callid of each channel
in a loop.  This local reference was not released, causing the callid of
every channel in autoservice to leak.  This change moves the callid unref
inside the loop.

ASTERISK-23616 #close
Reported by: ibercom
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-14 15:54:50 +00:00
Kinsey Moore d6e2c50058 bridging: Ensure locking during snapshot creation
While the vast majority of bridge snapshot creation is locked properly,
there are currently some instances that are not. This adds the missing
locking to ensure bridge state is not malleable during snapshot
creation.

(closes issue ASTERISK-22904)
Review: https://reviewboard.asterisk.org/r/3415/
Reported by: Matt Jordan
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412194 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-11 12:43:34 +00:00
Olle Johansson f65dd23bf4 Formatting: Remove invisible characters
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412180 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-11 08:28:14 +00:00
Olle Johansson 2a4205df2c Formatting only.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412168 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-11 07:07:36 +00:00
Matthew Jordan 4f30c7e91f main/astobj2: Make REF_DEBUG a menuselect item; improve REF_DEBUG output
This patch does the following:
(1) It makes REF_DEBUG a meneselect item. Enabling REF_DEBUG now enables
    REF_DEBUG globally throughout Asterisk.
(2) The ref debug log file is now created in the AST_LOG_DIR directory.
    Every run will now blow away the previous run (as large ref files
    sometimes caused issues). We now also no longer open/close the file
    on each write, instead relying on fflush to make sure data gets written
    to the file (in case the ao2 call being performed is about to cause a
    crash)
(3) It goes with a comma delineated format for the ref debug file. This
    makes parsing much easier. This also now includes the thread ID of the
    thread that caused ref change.
(4) A new python script instead for refcounting has been added in the
    contrib/scripts folder.
(5) The old refcounter implementation in utils/ has been removed.

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412154 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-11 02:59:19 +00:00
Richard Mudgett 5ca5d42646 Internal timing: Add notice that the -I and internal_timing option are no longer needed.
Add notice messages during execution that the -I command line option and
the astersik.conf internal_timing option are no longer needed.  The
internal timing functionality is now always enabled if there is a timing
module loaded.

NOTE: Since the command line options and the asterisk.conf config file are
processed before the logging system is initialized, the messages are
output to stderr.

Change requested as a result of asterisk-dev list comments about the
commit for ASTERISK-22846 that removed the -I and internal_timing options.

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411990 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-08 21:25:15 +00:00
Richard Mudgett 551b2d1183 config: Fix CB_ADD_LEN() to work as originally intended.
Fix a long standing bug in CB_ADD_LEN() behaving like CB_ADD().

ASTERISK-23546 #close
Reported by: Walter Doekes
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411963 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-08 20:53:33 +00:00
Jonathan Rose c0a812e143 AGI/Manager: Prevent multiple NewExten events during AGI application changes
AGI applications would trigger NewExten events every time the state of the AGI
application changed. This has historically not been the behavior and this
behavior was introduced with a CDR patch. This patch corrects that.

(closes issue ASTERISK-23390)
Reported by: Benjamin Keith Ford
Review: https://reviewboard.asterisk.org/r/3406/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411870 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-07 16:15:34 +00:00
Richard Mudgett 03beadb6e9 internal_timing: Remove the option and always make it enabled if a timing module is loaded.
The masquerade supertest frequently fails because either the local channel
chain doesn't completely optimize out or the DTMF handshake doesn't
completely get accross.  Local channel optimization requires frames
flowing to trigger when optimization can happen.  When optimization
happens the media frame that triggered the optimization is dropped.
Sending DTMF requires frames to flow in the other direction for timing
purposes while sending nothing.  If internal timing is not enabled when
MOH is playing, Asterisk switches to received timing when an audio frame
is received.  With optimization dropping media frames and MOH not sending
frames unless it receives frames, occasionaly there are no more frames
being passed and the test fails.

* The asterisk command line -I option and the asterisk.conf
internal_timing option are removed.  Asterisk now always uses internal
timing when needed if any timing module is loaded.  The issue
ASTERISK-14861 did this quite awhile ago in v1.4 but effectively is broken
if other internal timing modules besides DAHDI are used.  The
ast_read_generator_actions() now only does received timing if it has no
choice for frame generators like MOH, silence, and playback streaming.

* Cleaned up some code dealing with frame generators in
ast_deactivate_generator(), generator_write_format_change(),
ast_activate_generator(), and ast_channel_stop_silence_generator().

* Removed ast_internal_timing_enabled(), AST_OPT_FLAG_INTERNAL_TIMING, and
ast_opt_internal_timing.

ASTERISK-22846 #close
Reported by: Matt Jordan

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411724 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-04 19:19:55 +00:00
Richard Mudgett 9be438299d Add some asserts that were handy when looking for a stasis cache problem.
* Assert if a channel is destroyed but has the snapshot staging flag set.
In this case the final channel destruction snapshot would never get taken.

* Assert if what we just got out of the stasis cache is not what we were
looking for.  This assert would have saved several days searching for a
bug and a lot of my hair.

* Assert if the music on hold message posts could not find the associated
channel.  A crash will happen later when manager tries to send the MOH AMI
message.  This assert catches the problem when the stasis message is
posted instead of by the thread processing the defective message.

* Always generate a backtrace when an ast_assert() fails.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411702 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-04 17:57:46 +00:00
Matthew Jordan 73f337d97b http: Fix spurious ERROR message in responses with no content
When a response has a content length of 0, fwrite would be called to write a
buffer with no data in it. This resulted in the following classic error
message:

  [Apr  3 11:49:17] ERROR[26421] http.c: fwrite() failed: Success

This patch makes it so that we only attempt to write out the content if the
calculated content_length is non-zero.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411688 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-04 15:13:55 +00:00
Mark Michelson eefcb79bfb Prevent duplicate sorcery wizards from being applied to sorcery object types.
This commit contains several changes to sorcery:

1) Application of sorcery configuration based on module name is automatically performed
when sorcery is opened for a module.
2) Sorcery will not attempt to apply the same wizard to an object type more than once.
3) Sorcery gives more exact results when attempting to apply a wizard, whether as the
default or based on configuration.

Sorcery unit tests still pass for me after making these changes.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411656 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-02 18:57:29 +00:00
Richard Mudgett 7542361f4a stasis_channels.c: Eliminate another overuse of RAII_VAR().
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-01 22:34:30 +00:00
Scott Griepentrog 0d057e6791 http: response body often missing after specific request
This patch works around a problem with the HTTP body
being dropped from the response to a specific client
and under specific circumstances:

a) Client request comes from node.js user agent
   "Shred" via use of swagger-client library.

b) Asterisk and Client are *not* on the same
   host or TCP/IP stack

In testing this problem, it has been determined that
the write of the HTTP body is lost, even if the data
is written using low level write function.  The only
solution found is to instruct the TCP stack with the
shutdown function to flush the last write and finish
the transmission.  See review for more details.


ASTERISK-23548 #close
(closes issue ASTERISK-23548)
Reported by: Sam Galarneau
Review: https://reviewboard.asterisk.org/r/3402/
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411469 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-28 16:18:56 +00:00
Corey Farrell fbe0dfaf44 Fix dialplan function NULL channel safety issues
(closes issue ASTERISK-23391)
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/3386/
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411328 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-27 19:21:44 +00:00
Corey Farrell 44409401ec main/formats: Fix crash in ast_format_cmp during non-clean shutdown.
* Update asterisk.h to reflect availability of ast_register_cleanup in 11.9.
* Use ast_register_cleanup for format_attr_shutdown.

(closes issue ASTERISK-23103)
Reported by: JoshE
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411312 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-27 18:26:12 +00:00
Mark Michelson a8629e53c1 Give sorcery instances a reference to their wizards.
On graceful shutdown, sorcery wizards are all killed off, but it is
possible for sorcery instances to still have dangling pointers after
this, possibly causing a crash. Giving the sorcery instances a reference
to their wizards ensures that the wizard reference will remain valid for
the lifetime of the sorcery instance.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411296 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-27 14:21:15 +00:00
Joshua Colp 7dddd694cb say: Fix a bug where SayNumber in Polish tries to play incorrect sound.
This change fixes a bug where calling SayNumber with a number divisible by
100 using the Polish language would cause the code to attempt to play a
sound file with an empty name.

(closes issue ASTERISK-23509)
Reported by: zvision

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411246 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-26 22:45:10 +00:00
Richard Mudgett c8ebf3e3c7 Revert -r411073. It didn't help and blew up the system.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411087 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-25 15:47:17 +00:00
Richard Mudgett 89e12de79d locking: Add temporary sanity checks.
Add some temporary sanity checks to hunt for locking problems with the
masquerade supertest.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411073 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-24 23:36:36 +00:00
Sean Bright df2d959d7d Remove a LOG_NOTICE from ast_config_engine_register.
There is enough indication from the CLI that we are loading a realtime engine
as it is.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410982 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-21 15:16:50 +00:00
Richard Mudgett 1ba13718fc assigned-uniqueids: Miscellaneous cleanup and fixes.
* Fix memory leak in ast_unreal_new_channels().  Made it generate the ;2
uniqueid on a stack variable instead of mallocing it.

* Made send error response to ARI and AMI requests instead of just logging
excessive uniqueid length and allowing truncation.  action_originate() and
ari_channels_handle_originate_with_id().

* Fixed minor truncating uniqueid hole when generating the ;2 uniqueid
string length.  Created public and internal lengths of uniqueid.  The
internal length can handle a max public uniqueid plus an appended ;2.

* free() and ast_free() are NULL tolerant so they don't need a NULL test
before calling.

* Made use better struct initialization format instead of the position
dependent initialization format.  Also anything not explicitly initialized
in the struct is initialized to zero by the compiler.

* Made ast_channel_internal_set_fake_ids() use the safer
ast_copy_string() instead of strncpy().

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410950 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-20 16:35:57 +00:00
Scott Griepentrog eecb74a9a7 ARI: allow json content type with zero length body
When a request was received with a Content-type of json,
the body was sent for json parsing - even if it was zero
length.  This resulted in ARI requests failing that were
valid, such as a channel DELETE with no parameters.  The
code has now been changed to skip json parsing with zero
content length.

(closes issue SWP-6748)
Reported by: Samuel Galarneau
Review: https://reviewboard.asterisk.org/r/3360/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410863 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-18 15:45:04 +00:00
Matthew Jordan 77db94a25a cdr: Add asserts for when we don't know about a CDR for a channel
In the CDR core, every channel should either be filtered out (due to being an
'internal' channel used as an implementation detail, such as playing media
back into a bridge) or it should get a CDR. Even if that CDR ends up being
discarded, we still give the channel a CDR in case we end up needing it. If we
hit a situation where a channel does not have a CDR, we should blow up in
-dev-mode. Asserts are appropriate for that.

This patch adds those asserts, as they would have quickly caught the error
fixed by r410814.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410862 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-18 15:28:45 +00:00
Richard Mudgett 614b6abc38 stasis_cache: Use the right variable in the cache entry ao2 cmp function.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410814 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-18 02:09:25 +00:00
Joshua Colp cc40bf5317 res_pjsip: Enable PJSIP DNS client support.
This change enables DNS client support within PJSIP. System
nameservers are automatically discovered using res_init or
res_ninit. If this fails then PJSIP will resort to using
gethostbyname for resolution.

By enabling this support we gain SRV support, failover, and
weight support.

(closes issue ASTERISK-23435)
Reported by: Matt Jordan

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410796 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-17 22:54:32 +00:00
Russ Meyerriecks ed50ef4dc8 callerid: Logic error in checksum processing
Callerid checksum-ing was being handled incorrectly here. When the checksum is
calculated to be 0x00, it will perform 0x100-0x00 which results in 0x100. This
value will then fail the otherwise correct callerid message.

This patch changes the logic to simply add the calculated checksum to the
transmitted 2's compliment checksum.  

Review: https://reviewboard.asterisk.org/r/3356/
(closes issue ASTERISK-23488)

........
This is a merge of merged revisions 410750 410747 from http://svn.asterisk.org/svn/asterisk/branches/12
I didn't want a broken patch to be comitted to trunk so I pre-merge merged them.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410775 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-17 22:24:03 +00:00
Mark Michelson eba91d2a98 Revert changes to sorcery that accidentally got committed.
These changes were still up for review and have not been approved
yet. I must have had the changes in my working copy when making
a different change.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410699 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-17 19:35:17 +00:00
Mark Michelson d44aefeef4 Fix stuck channel in ARI through the introduction of synchronous bridge actions.
Playing back a file to a channel in an ARI bridge would attempt to wait until
the playback concluded before returning. The method used involved signaling the
waiting thread in the ARI custom playback function.

The problem with this is that there were some corner cases that were not accounted for:
* If a bridge channel could not be found, then we never would attempt the playback but
  would still attempt to wait for the playback to complete.
* If the bridge playfile action failed to queue, we would still attempt to wait for the
  playback to complete.
* If the bridge playfile action were queued but some circumstance caused the playback
  not to occur (the bridge dies, the channel is removed from the bridge), then we would
  never be notified.

The solution to this is to move the waiting logic into the bridge code. A new bridge
API function is added to queue a synchronous action on a bridge. The waiting thread
is notified when the queued frame has been freed, either due to an error occurring
or due to successful playback. As a failsafe, the waiting thread has a 10 minute
timeout just in case there is a frame leak somewhere.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410684 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-17 17:22:12 +00:00
Jonathan Rose 3a565767d7 manager: fix memory leak in manager_add_filter function
(closes issue ASTERISK-23420)
Reported by: Etienne Lessard
Patches:
    manager_eventfilter_leak uploaded by Etienne Lessard (license 6394)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410624 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-14 21:36:55 +00:00
Mark Michelson 510a6e6e64 Remove an extra ast_cond_wait() that slipped through the patch.
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410608 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-14 20:55:06 +00:00
Mark Michelson 9665c2d3eb Handle the return values of realtime updates and stores more accurately.
Realtime backends' update and store callbacks return the number of rows affected,
or -1 if there was a failure. There were a couple of issues:

* The config API was treating 0 as a successful return, and positive values as
  a failure. Now the config API treats anything >= 0 as a success.

* res_sorcery_realtime was treating 0 as a successful return from the store
  procedure, and any positive values as a failure. Now sorcery treats anything
  > 0 as a success. It still considers 0 a "failure" since there is no change
  to report to observers.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410593 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-14 18:11:55 +00:00
Jonathan Rose ff63012c4e PJSIP: TOS values should be represented as decimals in sorcery objects
(closes issue ASTERISK-23235)
Reported by: George Joseph
Review: https://reviewboard.asterisk.org/r/3324/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410575 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-14 16:42:54 +00:00
Mark Michelson c1e9d2f177 Prevent delayed astdb syncs.
The syncing thread sleeps for a second before waiting to be
told to attempt to sync again. If a signal were sent during this
sleeping period, we would end up having to wait until the next
sync signal occurred in order to sync up the astdb.

This code rearrangement also ensures that any pending transactions
will be synced prior to Asterisk shutting down.

Patches: db_sync.patch by John Hardin (License #6512)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410567 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-14 16:19:21 +00:00
Richard Mudgett 66718a06f7 res_mwi_external: Clear the stasis cache entry when the external MWI is deleted.
One of the things missing when external MWI support was added was the
ability to clear the stasis cache entry of deleted external MWI mailboxes.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-14 16:01:13 +00:00
Richard Mudgett 251868dc57 cdr.c: Add missing aow_unlock(cdr) in off nominal path of handle_dial_message().
* Trivial common code hoisting in handle_bridge_leave_message().

* Some whitespace fixing.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-13 21:27:15 +00:00
Richard Mudgett f627a0aca0 res_musiconhold.c: Generate MOH start/stop events whenever the MOH stream is started/stopped.
* Made res_musiconhold.c always post the MusicOnHoldStart/MusicOnHoldStop
events when it actually starts/stops the music streams.  This allows the
events to always happen when MOH starts/stops.  The event posting code was
moved to the MOH alloc/release routines.

* Made channel_do_masquerade() stop any MOH on the original channel before
masquerading so the original channel will get a stop event with correct
information.

* Cleaned up a couple odd codings in moh_files_alloc() and moh_alloc()
dealing with the music state variable.

(issue ASTERISK-23311)
Reported by: Benjamin Keith Ford

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410494 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-12 19:06:52 +00:00
Richard Mudgett 7c854d65af AST-2014-001: Stack overflow in HTTP processing of Cookie headers.
Sending a HTTP request that is handled by Asterisk with a large number of
Cookie headers could overflow the stack.

Another vulnerability along similar lines is any HTTP request with a
ridiculous number of headers in the request could exhaust system memory.

(closes issue ASTERISK-23340)
Reported by: Lucas Molas, researcher at Programa STIC, Fundacion; and Dr. Manuel Sadosky, Buenos Aires, Argentina
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410395 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-10 17:21:01 +00:00
Scott Griepentrog ef69b5176d unqiueid: correct max uniqueid length test
This patch adds null string test prior to checking for
a max uniqueid value that was added in r410157.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410369 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-10 16:33:10 +00:00
George Joseph 3ff60b75b1 pjsip_cli: Create pjsip show channel and contact, and general cli code cleanup.
Created the 'pjsip show channel' and 'pjsip show contact' commands.
Refactored out the hated ast_hashtab.  Replaced with ao2_container.
Cleaned up function naming.  Internal only, no public name changes.
Cleaned up whitespace and brace formatting in cli code.
Changed some NULL checking from "if"s to ast_asserts.
Fixed some register/unregister ordering to reduce deadlock potential.
Fixed ast_sip_location_add_contact where the 'name' buffer was too short.
Fixed some self-assignment issues in res_pjsip_outbound_registration.

(closes issue ASTERISK-23276)
Review: http://reviewboard.asterisk.org/r/3283/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410288 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-08 16:50:36 +00:00
Matthew Jordan b2c4eaf06a config_options: Display the see-also information for CLI config option help
The config option help information has always parsed the <see-also> tags in the
XML documentation. Unfortunately, it just never bothered displaying them on
the CLI. With this patch, when you execute 'config show help [module] [obj]
[option]', it will display what other options are useful to you.

(closes issue ASTERISK-22008)
Reported by: Richard Mudgett
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410210 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 21:54:01 +00:00
Mark Michelson c162101d69 Make res_sorcery_realtime filter unknown retrieved results.
When retrieving data from a database or other realtime backend, it's quite
possible to retrieve variables that Asterisk does not care about but that
are legitimate to exist. Asterisk does not need to throw a hissy fit when
these variables are encountered but rather just filter them out.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410207 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 21:23:39 +00:00
Scott Griepentrog feae552139 pjsip: allow and disallow show same codecs
In order to prevent confusion over the allow and disallow
list of codecs being the same an option for registering a
field as an alias is added.  The alias field will be read
from the configuration file, but afterwards is not listed
as a known field.  With disallow set as an alias, the CLI
command pjsip show endpoint # will list the allow= field,
but not the disallow field.

(closes issue ASTERISK-23092)
Review: https://reviewboard.asterisk.org/r/3193/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410191 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 21:11:49 +00:00
Richard Mudgett 4ad1245cb5 stasis cache: Enhance to keep track of an item from different entities.
A stasis cache entry now contains more than a single message/snapshot.  It
contains messages/snapshots for the local entity as well as any remote
entities that post to the cached item.  In addition callbacks can be
supplied when the cache is created to compute and post the aggregate
message/snapshot representing all entities stored in the cache entry.

* All stasis messages now have an eid to indicate what entity posted it.

* The stasis cache enhancements allow device state to cache and aggregate
the device states from local and remote entities in a single operation.
The cached aggregate device state is available immediately after it is
posted to the stasis bus.  This improves performance by eliminating a
cache dump and associated ao2 container traversals to calculate the
aggregate state.

(closes issue ASTERISK-23204)
Reported by: Mark Michelson

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410185 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 20:41:13 +00:00
Scott Griepentrog 80ef9a21b9 uniqueid: channel linkedid, ami, ari object creation with id's
Much needed was a way to assign id to objects on creation, and
much change was necessary to accomplish it.  Channel uniqueids
and linkedids are split into separate string and creation time
components without breaking linkedid propgation.  This allowed
the uniqueid to be specified by the user interface - and those
values are now carried through to channel creation, adding the
assignedids value to every function in the chain including the
channel drivers. For local channels, the second channel can be
specified or left to default to a ;2 suffix of first.  In ARI,
bridge, playback, and snoop objects can also be created with a
specified uniqueid.

Along the way, the args order to allocating channels was fixed
in chan_mgcp and chan_gtalk, and linkedid is no longer lost as
masquerade occurs.

(closes issue ASTERISK-23120)
Review: https://reviewboard.asterisk.org/r/3191/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 15:47:55 +00:00
Richard Mudgett 4fd50a9d81 sorcery.c: Fix off-nominal path ref and memory leak in ast_sorcery_objectset_json_create().
* Made exit a loop early on error in ast_sorcery_objectset_json_create().

* Removed some dead code in ast_sorcery_objectset_create2().
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410092 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-06 23:47:16 +00:00
George Joseph a4906e9f86 sorcery: Create AST_SORCERY dialplan function.
This patch creates the AST_SORCERY dialplan function which allows someone to
retrieve any value from a sorcery-based config file.  It's similar to 
AST_CONFIG.

The creation of the function itself was fairly straightforward but it required
changes to the underlying sorcery infrastructure that rippled into individual
sorcery objects.  The changes stemmed from inconsistencies in how sorcery
created ast_variable objectsets from sorcery objects and the inconsistency
in how individual objects used that feature especially when it came to
parameters that can be specified multiple times like contact in aor and match
in identify.  You can read more here...
http://lists.digium.com/pipermail/asterisk-dev/2014-February/065202.html

So, what this patch does, besides actually creating the AST_SORCERY function,
is the following...

* Creates ast_variable_list_append which is a helper to append one ast_variable
  list to another.
* Modifies the ast_sorcery_object_field_register functions to accept the
  already-defined sorcery_fields_handler callback.
* Modifies ast_sorcery_objectset_create to accept a parameter indicating return
  type preference...a single ast_variable with all values concatenated or an
  ast_variable list with multiple entries.  Also fixed a few bugs.
* Modifies individual sorcery object implementations to use the new function
  definition of the ast_sorcery_object_field_register functions.
* Modifies location.c and res_pjsip_endpoint_identifier_ip.c to implement
  sorcery_fields_handler handlers so they return multiple occurrences as an
  ast_variable_list.
* Added a whole bunch of tests to test_sorcery.

(closes issue ASTERISK-22537)
Review: http://reviewboard.asterisk.org/r/3254/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-06 22:39:54 +00:00
Jonathan Rose f0b8590c14 pjsip configuration: Make transport TOS values consistent with endpoints
Transport TOS values were interpreted as DSCP values without being documented
as such. Endpoint TOS values (tos_audio/tos_video) behaved normally as TOS
values have historically. This patch makes the transport TOS values behave as
TOS values and makes all TOS values readable as string values (e.g. AF11).
In addition, alembic scripts have been updated to use the proper field types
for all TOS/COS values.

(issue ASTERISK-23235)
Reported by: George Joseph
Review: https://reviewboard.asterisk.org/r/3304/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-06 19:04:58 +00:00
Kinsey Moore b98c2b0e82 config: Fix inverted test
The test of the result of the stat() call was inverted such that its
output was only used if the call failed. This inverts the test so that
the output of stat() is used correctly. This was causing full reloads
on unchanged files.

(closes issue ASTERISK-23383)
Reported by: David Woolley
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409919 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-05 20:41:37 +00:00
David M. Lee 38a619af97 Corrected cross-platform stat nanosecond code
When nanosecond time resolution was added for identifying config file
changes, it didn't cover all of the myriad of ways that one might obtain
nanosecond time resolution off of struct stat.

Rather than complicate the #if even further figuring out one system from
the next, this patch directly tests for the three struct members I know
about today, and #ifdef's accordingly.

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409836 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-05 16:58:21 +00:00
Kinsey Moore 6204ea6c1a AO2: Add an assert for bad objects
This adds an assert that will only be active if Asterisk is compiled
with DO_CRASH and allows the testsuite to fail tests that would
otherwise require log file parsing.
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409569 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-04 16:55:43 +00:00
Matthew Jordan 43858c24ab doxygen: Tweak the link back to ye olde Digium website
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-03 02:08:58 +00:00
Richard Mudgett c95146269c devicestate.c: Simplified some logic in _ast_device_state().
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409275 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-01 00:05:38 +00:00
Richard Mudgett 77625956dd stasis_cache.c: Remove some unnecessary RAII_VAR() usage.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409273 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-01 00:02:02 +00:00
Richard Mudgett f9c031ec39 stasis.c: Misc code cleanups.
* Remove some unnecessary RAII_VAR() usage.

* Made the struct stasis_subscription ao2 object use the ao2 lock instead
of a redundant join_lock in the struct for ast_cond_wait().

* Removed locks on some ao2 objects that don't need the lock.

* Made the topic pool entries container use the ao2 template functions.

* Add some missing allocation failure checks.

* Add missing cleanup in off nominal path of dispatch_message().
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409271 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-28 23:31:58 +00:00
Matthew Jordan 31707b1d69 main: Initialize dialplan providing core components prior to module pre-load
It is possible to pre-load pbx_config. As a result, pbx_config - which will
load and parse the dialplan - will attempt to use various dialplan components,
such as device state providers and presence state providers, prior to them
being initialized by the core. This would lead to a crash, as the components
had not created their Stasis cache entries.

This patch moves a number of core component initializations before the module
pre-load. This guarantees that if someone does pre-load pbx_config - or other
pbx modules - that the Stasis caches for the various core components are
created.

(closes issue ASTERISK-23320)
Reported by: xrobau

(closes issue ASTERISK-23265)
Reported by: Andrew Nagy
Tested by: Andrew Nagy, Rusty Newton
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408859 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-22 23:31:10 +00:00
Corey Farrell e468e73b9e Remove extra defines of AST_PBX_MAX_STACK.
* Ensure AST_PBX_MAX_STACK is only defined in extconf.h and pbx.h.
* Fix incorrect function parameters in utils/extconf.c.

(closes issue ASTERISK-23141)
Reported by: Maxim
Review: https://reviewboard.asterisk.org/r/3241/
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408788 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-22 02:31:04 +00:00
Kevin Harwell 73709e22ef rtp_engine: Dynamic payload change in rtp mapping not supported
Asterisk didn't support the dynamic payload change in rtp mapping in the 200
OK response.

Scenario:
Asterisk sends the INVITE proposing alaw and telephone-event, it proposes
rtpmap:101 for telephone-event.  Peer responds with 2xx, it answers with
alaw and telephone-event also, but it proposes a different rtpmap number
(rtpmap:103) for telephone-event.

Expected Behaviour:
Asterisk should honour the rtpmapping in the response and send DTMF packets
using 103 as payload type for DTMF.

Actual Behaviour: Asterisk sends DTMF packets using payload type 101.

With this patch asterisk now supports changes that can occur in the rtp mapping
in the response.

(closes issue ASTERISK-23279)
Reported by: NITESH BANSAL
Review: https://reviewboard.asterisk.org/r/3225/
Patches:
     dynamic_payload_change.patch uploaded by nbansal (license 6418)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408731 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-21 18:37:24 +00:00
Richard Mudgett 9e6407c07b manager: Fix AMI Status action of a single channel.
Fixed use of uninitialized ao2 container iterator in an off-nominal
condition.  Either a memory allocation error or the requested channel is
an internal channel not exposed to the outside.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408723 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-21 18:19:31 +00:00
Richard Mudgett d277f3ec3e json: Fix off-nominal json ref counting issues.
* Fixed off-nominal json ref counting issue with using the following API
calls: ast_json_object_set() and ast_json_array_append().

* Fixed off-nominal error reporting in ast_ari_endpoints_list().

* Fixed some miscellaneous off-nominal json ref counting issues in
report_receive_fax_status() and dial_to_json().
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408714 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-21 18:04:54 +00:00
Richard Mudgett eec8ccc10b json: Fix json API wrapper code for json library versions earlier than 2.3.0.
* Fixed json ref counting issue with json API wrapper code for
ast_json_object_update_existing() and ast_json_object_update_missing()
when the json library is earlier than version 2.3.0.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408712 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-21 17:47:58 +00:00
Kevin Harwell b88c818153 rtp_engine: Output mixup in ${CHANNEL(rtpqos,audio,all)}
Fixed the output of CHANNEL(rtpqos,audio,all) to use txjitter instead
of rxjitter.

(closes issue ASTERISK-23261)
Reported by: rsw686
Patches:
     rtpqos.patch uploaded by rsw686 (license 5887)
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-21 16:27:55 +00:00
Kevin Harwell 41a80d6a9f channel.c: MOH is not working for transferee after attended transfer
Updated the code to check to see if MOH is playing on the transferor and if
so then start it on the channel that replaces it during a masquerade.

Example scenario of the problem:
Alice calls Bob and then Bob begins the attended transfer process into a queue.
Upon going on hold Alice hears music and so does Bob once he is in the queue.
Bob then transfers Alice into the queue and then music for Alice stops even
though she should be hearing it since has now replaced Bob in the queue.

The problem that was occurring is that once the channel was masqueraded the app
(queues, confbridge, etc...) had no way of knowing that the channel had just
been swapped out thus it did not start music for the present channel.

Credit to Olle Johansson for pointing me in the right direction on this issue.

(closes issue ASTERISK-19499)
Reported by: Timo Teräs
Review: https://reviewboard.asterisk.org/r/3226/
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408645 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-21 15:46:20 +00:00
George Joseph 31a18c14b8 pjsip_cli: Fix memory leak in ast_sip_cli_print_sorcery_objectset.
Fixed memory leaks in ast_sip_cli_print_sorcery_objectset and
ast_variable_list_sort.  

(closes issue ASTERISK-23266)
Review: http://reviewboard.asterisk.org/r/3200/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408521 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-20 21:04:28 +00:00
George Joseph a94c8562fd sorcery: Create sorcery instance registry.
In order to retrieve an arbitrary sorcery instance from a dialplan function
(or any place else) there needs to be a registry of sorcery instances.

ast_sorcery_init now creates a hashtab as a registry.

ast_sorcery_open now checks the hashtab for an existing sorcery instance
matching the caller's module name.  If it finds one, it bumps the 
refcount and returns it.  If not, it creates a new sorcery instance,
adds it to the hashtab, then returns it.

ast_sorcery_retrieve_by_module_name is a new function that does a hashtab 
lookup by module name.  It can be called by the future dialplan function.

res_pjsip/config_system needed a small change to share the main res_pjsip 
sorcery instance.

tests/test_sorcery was updated to include a test for the registry.

(closes issue ASTERISK-22537)
Review: http://reviewboard.asterisk.org/r/3184/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-20 20:45:30 +00:00
Richard Mudgett 75067daac7 config: Add file size and nanosecond resolution fields to the cached modified config file information.
Repeatedly modifying config files and reloading too fast sometimes fails
to reload the configuration because the cached modification timestamp has
one second resolution.

* Added file size and nanosecond resolution fields to the cached config
file modification timestamp information.  Now if the file size changes or
the file system supports nanosecond resolution the modified file has a
better chance of being detected for reload.

* Added a missing unlock in an off-nominal code path.

(closes issue AST-1303)

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408390 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-19 19:09:07 +00:00
Matthew Jordan 438a7abc27 pbx: Handle a completely empty dialplan during a context merge
It is highly unlikely, but - at least in Asterisk 12 - theoretically possible
to load Asterisk with no dialplan whatsoever. If that occurs, and some other
module (that is not a pbx module) attempts to merge its contexts into the
dialplan, the existing merge routine will crash. This is because it is not
insane, and rightly believes that you provided some sort of dialplan,
somewhere.

This patch will gracefully merge the contexts in such a case. Note that this
is highly unlikely to occur in 1.8/11, as features will most likely provide
some dialplan via parking. However, in Asterisk 12, parking is now provided
by res_parking, and hence may create its dialplan later.

(closes issue ASTERISK-23297)
Reported by: CJ Oster

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408227 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-16 03:25:15 +00:00
Scott Griepentrog 04fe3bccc0 ARI: correct upper/lower case URI discrepancies
URI's are supposed to be case sensitive and all
lower case.  In practice some portions of URI's
in ARI are case insensitive and others are not,
such as TECH, which in one instance would match
a lower case name and in another would not.  In
this patch, the ast_endpoint_lastest_snapshot()
function is modified to change the TECH portion
to full upper case before lookup. This resolves
the discrepancy noted by the reporter.  However
I chose to avoid forcing the /ari prefix of the
URI's to be lower case for now.  Except for the
two cases here, all URI's should be lower case,
unless they are part of a resource name or id.

Review: https://reviewboard.asterisk.org/r/3211/
Reported by: Zane Conkle
(closes issue ASTERISK-23125)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408141 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-14 21:44:57 +00:00
Scott Griepentrog c41040fd4b format.c: correct possible null pointer dereference
In ast_format_sdp_parse and ast_format_sdp_generate
the check checks for a valid interface and function
were potentially confusing, and hid an error in the
test of the presence of the function that is called
later.  This patch clears up and corrects the test.

Review: https://reviewboard.asterisk.org/r/3208/
(closes issue ASTERISK-23098)
Reported by: marcelloceschia
Patches:
     main_format.patch uploaded by marcelloceschia (license 6036)
	 ASTERISK-23098.patch uploaded by coreyfarrell (license 5909)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@408139 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-14 21:29:31 +00:00
Kinsey Moore fe1e8e55a1 Logger: Add dynamic logger channels
This adds the ability to dynamically add and remove logger channels
from Asterisk via the CLI.

(closes issue AST-1150)
Review: https://reviewboard.asterisk.org/r/3185/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407989 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-13 15:51:22 +00:00
Walter Doekes 55ee292d45 realtime: Fix ast_update2_realtime() on raspberry pi.
The old code depended on undefined va_arg behaviour: calling a function
twice with the same va_list parameter and expecting it to continue where
it left off. The changed code behaves like the manpage says it should.

Also added a bunch of early returns to trap errors (e.g. OOM) instead of
crashing.

The problem was found by Julian Lyndon-Smith. The deviant behaviour on
the raspberry PI also uncovered another bug (fixed in r407875) in the
res_config_pgsql.so driver.

Reported by: jmls
Tested by: jmls
Review: https://reviewboard.asterisk.org/r/3201/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407970 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-12 08:25:02 +00:00
Joshua Colp 6bdf2c4eab scheduler: Remove hashtab usage.
This is a first stab at tweaking the performance profile of the scheduler. Removing
the hashtab usage removes an extra memory allocation when scheduling something and
makes it so rescheduling does not incur any memory allocation at all.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407958 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-11 20:17:42 +00:00
Matthew Jordan 8b295a2792 security_events: Fix assertion failure in dev-mode on optional IE parsing
When formatting an optional IE, the value is, of course, optional. As such, it
is entirely appropriate for ast_json_object_get to return NULL. If that occurs,
we now simply skip the IE that was requested, as it was not provided by the
entity that raised the event.

Thanks to George Joseph (gtjoseph) for catching this and reporting it in
#asterisk-dev
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407752 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-07 20:17:50 +00:00
Joshua Colp e8e2f91bba timing: Improve performance for most timing implementations.
This change allows timing implementation data to be stored directly
on the timer itself thus removing the requirement for many
implementations to do a container lookup for the same information.

This means that API calls into timing implementations can directly
access the information they need instead of having to find it.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-07 20:01:45 +00:00
Matthew Jordan 42d3fe8772 security_events: Fix error caused by DTD validation error
The appdocsxml.dtd specifies that a "required" attribute in a parameter may
have a value of yes, no, true, or false. On some systems, specifying "False"
instead of "false" would cause a validation error. This patch fixes the casing
to explicitly match the DTD.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407677 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-07 16:47:56 +00:00
Matthew Jordan cbaa27142c security_events: Add AMI documentation; output optional fields
This patch adds documentation for the Security Events that are emited over
AMI. It also notes these events in the UPGRADE/CHANGES file.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407602 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-06 21:24:32 +00:00
Kinsey Moore 6f4a834870 Logger: Fix handling of absolute paths
This fixes path handling for log files so that an extra / is not
appended to the file path when the path is absolute (begins with /).
This would previously result in different but functionally equivalent
paths in the output of 'logger show channels'.
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407459 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-05 20:43:50 +00:00
Richard Mudgett dd0c6e9cc1 devicestate: Make ast_devstate_changed_literal() return value and doxygen consistent.
Nothing actually cares about the value anyway.

(closes issue ASTERISK-23178)
Reported by: Jonathan Rose
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407340 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-04 20:15:22 +00:00
Richard Mudgett 12668b6659 tcptls.c: Made TLS handle a certificate chain file.
Thanks to Guillaume Martres for doing the necessary research to validate
the change.

(closes issue ASTERISK-17727)
Reported by: LN
Patches:
      use_certificate_chain.patch (license #5864) patch uploaded by st
      documente_certificate_chain.patch (license #6576) patch uploaded by Guillaume Martres
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407275 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-04 18:16:09 +00:00
Matthew Jordan 01af8d6e12 cdrs: Check for applications to lock onto during dial begin handling
This patch brings CDR processing further in line with r407085. During some dial
operations, the application would not be locked to the Dial application and
would instead continue to show the previously known application. In particular,
this would occur when a Parked call would time out. This was due to a previous
snapshot already locking the application to Park - processing this in a Dial
Begin allows the Dial application to reassert its rightful place.

(CDRs. Ugh.)

But hooray for the Parked Call tests for catching this in the Asterisk Test
Suite.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407169 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-03 01:31:53 +00:00
Joshua Colp e5899852cc res_stasis: Enable transfers and provide events when they occur.
This change enables transfers within ARI created bridges and adds events
for when they occur. Unlike other events these will be received if *any*
subscribed object is involved in the transfer.

(closes issue ASTERISK-22984)
Reported by: David M. Lee

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407154 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-01 16:26:57 +00:00
Matthew Jordan 66c46fba24 CDRs: fix a variety of dial status problems, h/hangup handler creating CDRs
This patch fixes a number of small-ish problems that were noticed when
witnessing the records that the FreePBX dialplan produces:
(1) Mid-call events (as well as privacy options) have the ability to change the
    overall state of the Dial operation after the called party answers. This
    means that publishing the DialEnd event when the called party is premature;
    we have to wait for the execution of these subroutines to complete before
    we can signal the overall status of the DialEnd. This patch moves that
    publication and adds handlers for the mid-call events.
(2) The AST_FLAG_OUTGOING channel flag is cleared if an after bridge goto
    datastore is detected. This flag was preventing CDRs from being recorded
    for all outbound channels that had a 'continue' option enabled on them by
    the Dial application.
(3) The CDR engine now locks the 'Dial' application as being the CDR
    application if it detects that the current CDR has entered that app. This
    is similar to the logic that is done for Parking. In general, if we entered
    into Dial, then we want that CDR to record the application as such - this
    prevents pre-dial handlers, mid-call handlers, and other shenaniganry
    from changing the application value.
(4) The CDR engine now checks for the AST_SOFTHANGUP_HANGUP_EXEC in more places
    to determine if the channel is in hangup logic or dead. In either case, we
    don't want to record changes in the channel.
(5) The default option for "endbeforehexten" has been changed to "yes". In
    general, you don't want to see CDRs in the 'h' exten or in hangup logic.
    Since the semantics of that option changed in 12, it made sense to update
    the default value as well.
(6) Finally, because we now have the ability to synchronize on the messages
    published to the CDR topic, on shutdown the CDR engine will now synchronize
    to the messages currently in flight. This helps to ensure that all
    in-flight CDRs are written before shutting down.

(closes issue ASTERISK-23164)
Reported by: Matt Jordan

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407085 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-31 23:40:51 +00:00
Corey Farrell c35d07950f res_rtp_asterisk & udptl: fix port selection to work with SELinux restrictions
ast_bind to a port reserved for another program by SELinux causes
errno == EACCES.  This caused random failures when binding rtp or
udptl sockets.  Treat EACCES as a non-fatal error, try next port.

(closes issue ASTERISK-23134)
Reported by: Corey Farrell
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406936 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-30 20:36:21 +00:00
Sean Bright 98de7719dd Make a NOTICE about an invalid channel name more useful.
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406920 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-30 17:35:49 +00:00
Scott Griepentrog 601692a7e4 rtp_engine: improved handling of get_rtp_info failure
In ast_rtp_instance_make_compatible(), after a failure of
channel tech call get_rtp_info() to return peer_instance,
the null pointer would be passed to ao2_ref, producing an
error that looked like a refernce counting problem but is
not.  This patch corrects that and adds helpful LOG_ERROR
messages to indicate which failure path occurred.

(issue AST-1276)
Review: https://reviewboard.asterisk.org/r/3156/
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406724 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-28 16:43:25 +00:00
Kevin Harwell f9479fbcbd manager: ExtensionStatus event status human readable
When an 'ExtensionStatus' event was raised it included the status as a
numerical value, but did not include a text description of the status.
Added a 'StatusText' field to the event which is a string representation
of the extension status.  Also added this to the 'Extension State' command
response.

(closes issue ASTERISK-23154)
Reported by: Jonathan Rose


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406647 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-27 21:09:33 +00:00
Russell Bryant 8a762efb35 Allow nested #includes in extconfig.conf
extconfig.conf was hard-coded to not allow nested includes for some reason.
The code has been this way since a patch was merged for ASTERISK-3333 (revision
4889), which was a significant update to this code ("Merge config updates").

I can't figure out any good reason why this should be limited.  This patch just
removes the limit and uses the default nesting depth limit.

Closes issue ASTERISK-17837

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406646 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-27 20:38:03 +00:00
Walter Doekes cc42229f26 manager: The eventfilter= option now takes an extended regex.
In pre-trunk versions (...12) it accepts a basic regex, which is
confusing because all other regexes in asterisk are of the
extended kind.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406618 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-27 08:17:22 +00:00
Russell Bryant 33071d636c Protect ast_filestream object when on a channel
The ast_filestream object gets tacked on to a channel via
chan->timingdata.  It's a reference counted object, but the reference
count isn't used when putting it on a channel.  It's theoretically
possible for another thread to interfere with the channel while it's
unlocked and cause the filestream to get destroyed.

Use the astobj2 reference count to make sure that as long as this code
path is holding on the ast_filestream and passing it into the file.c
playback code, that it knows it's valid.

Bug reported by Leif Madsen.

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406595 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-27 01:25:23 +00:00
Richard Mudgett 45261449ec tcptls.c: Add missing cleanup on off nominal path.
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406517 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-26 23:04:46 +00:00
Richard Mudgett 42c15dfa6e CEL: Protect data structures during reload and shutdown.
The CEL data structures need to be protected during a configuration reload
and shutdown.  Asterisk crashed during a shutdown because CEL events were
still in flight and the CEL data structures were already destroyed.

* Protected the cel_backends, cel_dialstatus_store, and cel_linkedids ao2
containers with a global ao2 object wrapper.

* Added NULL checks before use of the cel_backends, cel_dialstatus_store,
and cel_linkedids ao2 containers in case the CEL module is already
shutdown.

* Fixed overloading of the cel_linkedids held objects reference count.
During shutdown any held objects would be leaked.

* Fixed memory leak of cel_linkedids held objects if the LINKEDID_END is
not being tracked.  The objects in the cel_linkedids container were not
removed if the LINKEDID_END event is not used.

* Added access protection to the cel_backends container during the CLI
"cel show status" command.

* Made cel_backends, cel_dialstatus_store, and cel_linkedids use the
standard ao2 callback templates for the hash and cmp functions.

* Eliminated unnecessary uses of RAII_VAR().

* Made ast_cel_engine_init() cleanup alocated resources on failure.

(closes issue AST-1253)
Reported by: Guenther Kelleter

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

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406466 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-24 23:33:26 +00:00
Jonathan Rose 2a9d15b400 Thread Debugging: Add LWP to core show locks output
This patch adds the LWP to core show locks output if it is available.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406416 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-24 22:34:23 +00:00
Richard Mudgett a9911f027e manager: Register atexit shutdown routine only once.
* Made register atexit shutdown routine only once in __init_manager().

* Fixed some initial load failure conditions in __init_manager().

* Made reset options to defaults on reload when the reload will actually
happen.

* Removed unnecessary container traversals of the white/black filters
during manager_free_user().

* ast_free() does not need a NULL check before calling.
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406407 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-24 22:18:52 +00:00
Richard Mudgett 82cce81737 manager: Protect data structures during shutdown.
Occasionally, the manager module would get an "INTERNAL_OBJ: bad magic
number" error on a "core restart gracefully" command if an AMI connection
is established.

* Added ao2_global_obj protection to the sessions global container.

* Fixed the order of unreferencing a session object in session_destroy().

* Removed unnecessary container traversals of the white/black filters
during session_destructor().

(closes issue AST-1242)
Reported by: Guenther Kelleter

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406343 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-24 18:13:31 +00:00
Scott Griepentrog 64e2e1d5d8 pbx.c: Pre-initialize timezone to avoid crash on destroy
In ast_build_timing, initialize the timezone value to NULL
in order to avoid deferencing an uninitialized value later
when calling ast_destroy_timing.  The timezone value could
be uninitialized if ast_build_timing were to fail due to a
zero length time string.

(closes issue ASTERISK-22861)
Reported by: Sebastian Murray-Roberts
Review: https://reviewboard.asterisk.org/r/3134/
Patches:
     ast_build_timing-initialize-timezone.patch uploaded by coreyfarrell (license 5909)
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406269 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-22 22:24:39 +00:00
Walter Doekes 9a88cc33f8 manager: Clarify eventfilter documentation. Textual changes only.
Review: https://reviewboard.asterisk.org/r/3133/
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@406082 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-21 21:08:00 +00:00
Scott Griepentrog 2b14601bdc pjsip: fix support for allow=all
This change adds improvements to support for allow=all in
pjsip.conf so that it functions as intended.  Previously,
the allow/disallow socery configuration would set & clear
codecs from the media.codecs and media.prefs list, but if
all was specified the prefs list was not updated.  Then a
call would fail when create_outgoing_sdp_stream() created
an SDP with no audio codecs.

A new function ast_codec_pref_append_all() is provided to
add all codecs to the prefs list - only those not already
on the list.  This enables the configuration to specify a
codec preference, but still add all codecs, and even then
remove some codecs, as shown in this example:

allow = ulaw, alaw, all, !g729, !g723

Also, the display order of allow in cli output is updated
to match the configuration by using prefs instead of caps
when generating a human readable string.

Finally, a change to create_outgoing_sdp_stream() skips a
codec when it does not have a payload code instead of the
call failing.

(closes issue ASTERISK-23018)
Reported by: xrobau
Review: https://reviewboard.asterisk.org/r/3131/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405876 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-17 21:33:26 +00:00
Scott Griepentrog 2704b49c1b http: supported chunked Transfer-Encoding
This change implements support for HTTP Transfer-Encoding
chunked in both JSON and Form (post vars) body content. A
new function ast_http_get_contents() handles both regular
and chunked mode body, returning after the entire body is
received.

(closes issue ASTERISK-23068)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3125/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405862 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-17 20:51:19 +00:00
Rusty Newton f6647d2362 Documentation: doc fixes across various parts of the code for ASTERISK issues 23061,23028,23046,23027
Fixes typos of "transfered" instead of "transferred" in various code. Fixes incorrect gosub param help text for app_queue.
Fixes Asterisk man pages containing unquoted minus signs. Adds note about the "textsupport" option in sip.conf.sample.

(issue ASTERISK-23061)
(issue ASTERISK-23028)
(issue ASTERISK-23046)
(issue ASTERISK-23027)
(closes issue ASTERISK-23061)
(closes issue ASTERISK-23028)
(closes issue ASTERISK-23046)
(closes issue ASTERISK-23027)
Reported by: Eugene, Jeremy Laine, Denis Pantsyrev
Patches:
 transferred.patch uploaded by Jeremy Laine (license 6561)
 hyphen.patch uploaded by Jeremy Laine (license 6561)
 sip.conf.sample.patch uploaded by Eugene (license 6360)
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-17 17:16:14 +00:00
Kevin Harwell 7054e12ef2 manager: Originate doesn't abort on failed format_cap allocation
action_originate responds to the remote system with an error when cap==NULL,
but doesn't return (abort the originate).  Patched to return.

(closes issue ASTERISK-23034)
Reported by: Corey Farrell
Patches:
     ASTERISK-23034.patch uploaded by coreyfarrell (license 5909)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405747 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-16 19:54:04 +00:00
Richard Mudgett ed0d083596 string container: Remove unnecessary RAII_VAR usage and string object lock.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-14 21:46:50 +00:00
Richard Mudgett 828f339a9c verbosity: Fix performance of console verbose messages.
The per console verbose level feature as previously implemented caused a
large performance penalty.  The fix required some minor incompatibilities
if the new rasterisk is used to connect to an earlier version.  If the new
rasterisk connects to an older Asterisk version then the root console
verbose level is always affected by the "core set verbose" command of the
remote console even though it may appear to only affect the current
console.  If an older version of rasterisk connects to the new version
then the "core set verbose" command will have no effect.

* Fixed the verbose performance by not generating a verbose message if
nothing is going to use it and then filtered any generated verbose
messages before actually sending them to the remote consoles.

* Split the "core set debug" and "core set verbose" CLI commands to remove
the per module verbose support that cannot work with the per console
verbose level.

* Added a silent option to the "core set verbose" command.

* Fixed "core set debug off" tab completion.

* Made "core show settings" list the current console verbosity in addition
to the root console verbosity.

* Changed the default verbose level of the 'verbose' setting in the
logger.conf [logfiles] section.  The default is now to once again follow
the current root console level.  As a result, using the AMI Command action
with "core set verbose" could again set the root console verbose level and
affect the verbose level logged.

(closes issue AST-1252)
Reported by: Guenther Kelleter

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405436 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-14 18:14:02 +00:00
Matthew Jordan 373965dbff CDRs: Synchronize dialplan applications that manipulate CDRs with the engine
In https://reviewboard.asterisk.org/r/3057/, applications and functions that
manipulate CDRs were made to interact over Stasis. This was done to
synchronize manipulations of CDRs from the dialplan with the updates the
engine itself receives over the message bus.

This change rested on a faulty premise: that messages published to the CDR
topic or to a topic that forwards to the CDR topic are synchronized with the
messages handled by the CDR topic subscription in the CDR engine. This is not
the case. There is no ordering guaranteed for two messages published to the
same topic; ordering is only guaranteed if a message is published to the same
subscriber.

Stasis was modified in r405311 to allow a publisher to synchronize on the
subscriber. This patch uses that API to synchronize the CDR publishers with
the CDR engine message router, which maintains the overall topic subscription.

(closes issue ASTERISK-22884)
Reported by: Matt Jordan

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-12 22:13:12 +00:00
Matthew Jordan f8aaf585a3 stasis: Add methods to allow for synchronous publishing to subscriber
This patch adds an API call to Stasis that allows a publisher to publish a
stasis message that will not return until a specific subscriber handles the
message. Since a subscriber can have their own forwarding topic which orders
messages from many topics, this allows a publisher who knows of that subscriber
to synchronize to that subscriber regardless of the forwarding relationships
between topics.

This is of particular use for dialplan applications that need to synchronize
on a particular subscriber's handling of a message.

(issue ASTERISK-22884)
Reported by: Matt Jordan

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405313 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-12 22:07:01 +00:00
Richard Mudgett 4bde62eb40 Logging callid: Fix some sizeof() references per coding guidelines.
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405284 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-10 18:17:48 +00:00
Kinsey Moore 51901aa2ed astobj2: Correct ao2_iterator opacity violations
This corrects the ao2_iterator opacity violations in
res_pjsip_session.c by adding a global function to get the number of
elements inside the container hidden behind the iterator.

(closes issue ASTERISK-23053)
Review: https://reviewboard.asterisk.org/r/3111/
Reported by: Richard Mudgett
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405254 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-09 20:34:19 +00:00
Tzafrir Cohen 3eee3f21ad asterisk.c: suppress live_dangerously warning on rasterisk
Even since the fixes of AST-2013-007, Asterisk prints the following
warning on startup if the user decided to live dangerously:

  Privilege escalation protection disabled!
  See https://wiki.asterisk.org/wiki/x/1gKfAQ for more details.

This message is intended for the logs and interactive startup. No need
for it to appear on a remote console. This commit removes it from there.

(closes issue ASTERISK-23084)
Review: https://reviewboard.asterisk.org/r/3101/
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404912 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-04 10:52:43 +00:00
Kevin Harwell bd4be333fb manager: UserEvent including action on output
AMI action UserEvent event response would include the action header in its
keyvalue pairs list. Adjusted the start of the header loop to skip over the
action part.

(closes issue ASTERISK-22899)
Reported by: outtolunc
Patches:
     svn_manager.c.skip_action.diff.txt uploaded by outtolunc (license 5198)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404832 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-03 20:02:03 +00:00
Kevin Harwell 20d02c1288 channels.c: core show channeltypes slicing
'core show channeltypes' type column is being sliced, resulting in incomplete
type names.

(closes issue ASTERISK-22919)
Reported by: outtolunc
Patches:
     svn_channel.c.format_15.diff.txt uploaded by outtolunc (license 5198)
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-30 23:25:53 +00:00
David M. Lee a952abb9da http: Properly reject requests with Transfer-Encoding set
Asterisk does not support any of the transfer encodings specified in
HTTP/1.1, other than the default "identity" encoding.

According to RFC 2616:

   A server which receives an entity-body with a transfer-coding it does
   not understand SHOULD return 501 (Unimplemented), and close the
   connection. A server MUST NOT send transfer-codings to an HTTP/1.0
   client.

This patch adds the 501 Unimplemented response, instead of the hard work
of actually implementing other recordings.

This behavior is especially problematic for Node.js clients, which use
chunked encoding by default.

(closes issue ASTERISK-22486)
Review: https://reviewboard.asterisk.org/r/3092/
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404567 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-24 16:50:48 +00:00
Matthew Jordan b172d369c4 res_pjsip: Add PJSIP CLI commands
Implements the following cli commands:
pjsip list aors
pjsip list auths
pjsip list channels
pjsip list contacts
pjsip list endpoints
pjsip show aor(s)
pjsip show auth(s)
pjsip show channels
pjsip show endpoint(s)

Also...
Minor modifications made to the AMI command implementations to facilitate
reuse.

New function ast_variable_list_sort added to config.c and config.h to implement
variable list sorting.

(issue ASTERISK-22610)
patches:
  pjsip_cli_v2.patch uploaded by george.joseph (License 6322)
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404507 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-20 21:32:13 +00:00
Scott Griepentrog a0c288bb23 say.c: correct time for polish
In ast_say_date_with_format_pl(), change ast_say_number() to
use tm_sec instead of tm_mn.

(closes issue ASTERISK-22856)
Reported by: Robert Mordec
Review: https://reviewboard.asterisk.org/r/3082/
Patches:
     say.c.patch uploaded by veilen (license 6555)
........

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

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404461 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-20 21:18:00 +00:00
Richard Mudgett 9e4f80a4f6 Whitespace fixes.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404420 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-20 19:06:57 +00:00
Scott Griepentrog efd7c40712 security_events: log events with descriptive names
This patch updates the log messages to include descriptive
names for event types.  This is an improvement over having
only cryptic type numbers.

(closes issue ASTERISK-22909)
Reported by: outtolunc
Review: https://reviewboard.asterisk.org/r/3081/
Patches:
     svn_security_events.c.names.diff.txt uploaded by outtolunc (license 5198)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404387 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-19 20:48:19 +00:00
Mark Michelson 1b91ee6c4b Fix a deadlock that occurred due to a conflict of masquerades.
For the explanation, here is a copy-paste of the review board explanation:

Initially, it was discovered that performing an attended transfer of a
multiparty bridge with a PJSIP channel would cause a deadlock. A PBX thread
started a masquerade and reached the point where it was calling the fixup()
callback on the "original" channel. For chan_pjsip, this involves pushing a
synchronous task to the session's serializer. The problem was that a task ahead
of the fixup task was also attempting to perform a channel masquerade. However,
since masquerades are designed in a way to only allow for one to occur at a
time, the task ahead of the fixup could not continue until the masquerade
already in progress had completed. And of course, the masquerade in progress
could not complete until the task ahead of the fixup task had completed.
Deadlock.

The initial fix was to change the fixup task to be asynchronous. While this
prevented the deadlock from occurring, it had the frightful side effect of
potentially allowing for tasks in the session's serializer to operate on a
zombie channel.

Taking a step back from this particular deadlock, it became clear that the
problem was not really this one particular issue but that masquerades
themselves needed to be addressed. A PJSIP attended transfer operation calls
ast_channel_move(), which attempts to both set up and execute a masquerade. The
problem was that after it had set up the masquerade, the PBX thread had swooped
in and tried to actually perform the masquerade. Looking at changes that had
been made to Asterisk 12, it became clear that there never is any time now that
anyone ever wants to set up a masquerade and allow for the channel thread to
actually perform the masquerade. Everyone always is calling ast_channel_move(),
performs the masquerade itself before returning.

In this patch, I have removed all blocks of code from channel.c that will
attempt to perform a masquerade if ast_channel_masq() returns true. Now, there
is no distinction between setting up a masquerade and performing the
masquerade. It is one operation. The only remaining checks for
ast_channel_masq() and ast_channel_masqr() are in ast_hangup() since we do not
want to interrupt a masquerade by hanging up the channel. Instead, now
ast_hangup() will wait for a masquerade to complete before moving forward with
its operation.

The ast_channel_move() function has been modified to basically in-line the
logic that used to be in ast_channel_masquerade(). ast_channel_masquerade() has
been killed off for real. ast_channel_move() now has a lock associated with it
that is used to prevent any simultaneous moves from occurring at once. This
means there is no need to make sure that ast_channel_masq() or
ast_channel_masqr() are already set on a channel when ast_channel_move() is
called. It also means the channel container lock is not pulling double duty by
both keeping the container locked and preventing multiple masquerades from
occurring simultaneously.

The ast_do_masquerade() function has been renamed to do_channel_masquerade()
and is now internal to channel.c. The function now takes explicit arguments of
which channels are involved in the masquerade instead of a single channel.
While it probably is possible to do some further refactoring of this method, I
feel that I would be treading dangerously. Instead, all I did was change some
comments that no longer are true after this changeset.

The other more minor change introduced in this patch is to res_pjsip.c to make
ast_sip_push_task_synchronous() run the task in-place if we are already a SIP
servant thread. This is related to this patch because even when we isolate the
channel masquerade to only running in the SIP servant thread, we would still
deadlock when the fixup() callback is reached since we would essentially be
waiting forever for ourselves to finish before actually running the fixup. This
makes it so the fixup is run without having to push a task into a serializer at
all.

(closes issue ASTERISK-22936)
Reported by Jonathan Rose

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404368 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-19 17:45:21 +00:00
Richard Mudgett 3ccd5dee18 udptl: Dead code elimination. ast_udptl_bridge was not used.
Removing dead code starting with ast_udptl_bridge() eliminated the code in
this change.

Note: This code has actually been dead since Asterisk v1.4 when it was
first put in.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404355 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-19 17:13:53 +00:00
Richard Mudgett e4803bbd9e Voicemail: Remove mailbox identifier format (box@context) assumptions in the system.
This change is in preparation for external MWI support.

Removed code from the system for normal mailbox handling that appends
@default to the mailbox identifier if it does not have a context.  The
only exception is the legacy hasvoicemail users.conf option.  The legacy
option will only work for app_voicemail mailboxes.  The system cannot make
any assumptions about the format of the mailbox identifer used by
app_voicemail.

chan_sip and chan_dahdi/sig_pri had the most changes because they both
tried to interpret the mailbox identifier.  chan_sip just stored and
compared the two components.  chan_dahdi actually used the box
information.

The ISDN MWI support configuration options had to be reworked because
chan_dahdi was parsing the box@context format to get the box number.  As a
result the mwi_vm_boxes chan_dahdi.conf option was added and is documented
in the chan_dahdi.conf.sample file.

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-19 16:52:43 +00:00
Scott Griepentrog 2882c5f9f1 astdb: crash in sqlite3 during shutdown
When Asterisk is shut down, the astdb_atexit() function releases
(finalize) the previously initiated (prepared) SQL statements in
sqlite3.  Another thread making a subsequent request can cause a
crash in sqlite3.  This patch eliminates that issue by resetting
the statement pointer after it is released/cleared.  The sqlite3
code detects the null pointer, and aborts the operation cleanly.

(closes issue AST-1265)
Reported by: Alexander Hömig
(closes issue ASTERISK-22350)
Reported by: Birger "WIMPy" Harzenetter
Review: https://reviewboard.asterisk.org/r/3078/
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404346 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-19 16:33:09 +00:00
Joshua Colp eb235ad05f channel: Add a missing ast_channel_unlock when allocating a Surrogate channel.
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404333 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-19 12:18:52 +00:00
Matthew Jordan 7e9febbf86 app_cdr,app_forkcdr,func_cdr: Synchronize with engine when manipulating state
When doing the rework of the CDR engine that pushed all of the logic into cdr.c
and made it respond to changes in channel state over Stasis, we knew that
accessing the CDR engine from the dialplan would be "slightly"
non-deterministic. Dialplan threads would be accessing CDRs while Stasis
threads would be updating the state of said CDRs - whereas in the past,
everything happened on the dialplan threads. Tests have shown that "slightly"
is in reality "very".

This patch synchronizes things by making the dialplan applications/functions
that manipulate CDRs do so over Stasis. ForkCDR, NoCDR, ResetCDR, CDR, and
CDR_PROP now all use Stasis to send their requests over to the CDR engine,
and synchronize on the channel Stasis topic via a subscription so that they
return their values/control to the dialplan at the appropriate time.

While going through this, the following changes were also made:
 * DISA, which can reset the CDR when a user successfully authenticates, now
   just uses the ResetCDR app to do this. This prevents having to duplicate
   the same Stasis synchronization logic in that application.
 * Answer no longer disables CDRs. It actually didn't work anyway - calling
   DISABLE on the channel's CDR doesn't stop the CDR from getting the Answer
   time - it just kills all CDRs on that channel, which isn't what the caller
   would intend.

(closes issue ASTERISK-22884)
(closes issue ASTERISK-22886)

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404295 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-19 00:50:01 +00:00