Commit Graph

22463 Commits

Author SHA1 Message Date
Matthew Jordan
0897f95b39 Add announce-to-first-user option for app_queue
In r386792, the ability to play prompts to the first caller in a call queue was
added. While this is arguably a bug fix for those who expect the first caller
to continue receiving prompts while the agent is dialed, it has the side effect
of preventing the first caller from hearing the agent immediately upon
bridging. This may not be a problem for those who really want this option, but
for those who didn't care whether or not the first caller in queue heard their
position, it was an issue.

This patch disables the ability for the first caller in the queue to hear
prompts and adds a new option, announce-to-first-user, to queues.conf. Those
who the behavior can enable it by setting this value to True.

Note that if we ever implement the ability to have the prompts be stopped
upon bridging, this option can be removed.

(closes issue ASTERISK-21782)
Reported by: Remi Quezada



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@391215 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-10 14:15:19 +00:00
Alec L Davis
c2815b889e chan_iax2: nativebridge refactor, missed unlock bridgecallno
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@391143 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-10 09:30:11 +00:00
Alec L Davis
ae28bf6e40 fix bad edit after conflict resolution
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@391107 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-10 08:32:34 +00:00
Alec L Davis
71e2747cd8 IAX2: refactor nativebridge transfer
remove triple checking of iaxs[fr->callno]->transferring

reduce indentation.

Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@391065 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-10 07:56:49 +00:00
Alec L Davis
9144464185 IAX2: fix race condition with nativebridge transfers.
1). When touching the bridgecallno, we need to lock it.

2). stop_stuff() which calls iax2_destroy_helper()
    Assumes the lock on the pvt is already held, when iax2_destroy_helper() is called.
    Thus we need to lock the bridgecallno pvt before we call stop_stuff(iaxs[fr->callno]->bridgecallno);

3).   When evaluating the state of 'callno->transferring' of the current leg,
    we can't change it to READY unless the bridgecallno is locked.
      Why, if we are interrupted by the other call leg before 'transferring = TRANSFER_RELEASED',
    the interrupt will find that it is READY and that the bridgecallno is also READY so Releases the legs.

(closes issue ASTERISK-21409)

Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@391062 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-10 07:30:35 +00:00
Alexandr Anikin
a889d8768f reject call attempts when gatekeeper is configured but not registered
(closes issue ASTERISK-21800)
Reported by: Dmitry Melekhov
Patches:
        ASTERISK-21800-1.patch
Tested by: Dmitry Melekhov



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@390181 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-31 08:10:30 +00:00
Richard Mudgett
6683f94616 Fix segfault when dealing with chan_agent channels.
Check the returned bridged pointer for NULL to avoid a crash.  It looks
like chan_agent is returning a NULL pointer when it probably should be
returning a pointer to the channel the Agent channel is pretending to be.

(closes issue ASTERISK-21793)
Reported by: Rodrigo P. Telles
Patches:
      jira_asterisk_21793_v1.8.patch (license #5621) patch uploaded by rmudgett
Tested by: Rodrigo P. Telles


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@390044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-29 20:10:04 +00:00
Jonathan Rose
51a6491c30 Fix a memory copying bug in slinfactory which was causing mixmonitor issues.
Reported by: Michael Walton
Tested by: Jonathan Rose
Patches:
    slinfactory.c.ASTERISK-21799.patch uploaded by Michael Walton (license 6502)
(closes issue ASTERISK-21799)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@389895 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-28 17:35:12 +00:00
Matthew Jordan
f318fa2c50 Print all logger messages on shutdown
When Asterisk shuts down and shuts down the loggin gsubsystem, any
messages currently in flight will not get logged. This patch prevents the
loop writing messages from breaking out prematurely, such that all of the
messages are logged.

(closes issue ASTERISK-21716)
Reported by: Corey Farrell
patches:
  logger-process-all-messages.patch uploaded by Corey Farrell (license 5909)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@389676 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-24 11:42:38 +00:00
Jason Parker
c38badffda Add doxygen.log to svn:ignore property.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@389244 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-20 17:43:07 +00:00
Kevin Harwell
05d11a66ea Fix for segfault in __ast_rwlock_destroy with DEBUG_THREADS
If DEBUG_THREADS is enabled __ast_rwlock_destroy causes a segfault while trying
to access a possible NULL t->track object.  A NULL check has been added before
trying to access the memory.

(closes issue ASTERISK-21724)
Reported by: Corey Farrell
Fixed by: Corey Farrell
Patches:
	ast_rwlock_destroy-segv.patch uploaded by Corey Farrell (license 5909)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@388838 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-15 15:54:50 +00:00
Kinsey Moore
f0a8ba971b Use srtp_shutdown when available
This allows the SRTP library to be shut down properly when the
functionality is offered by libsrtp.

Review: https://reviewboard.asterisk.org/r/2538/
(closes issue ASTERISK-21719)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@388768 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-15 12:37:29 +00:00
Kinsey Moore
556e0a26ff Revert r388529 for now
Adding the cleanup function needs some deeper thought since it
apparently doesn't exist for all variants of libsrtp.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@388596 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-13 20:34:36 +00:00
Jonathan Rose
c8108a3503 pbx: Fix lack of cleanup on macrolock and context_table
(closes issue ASTERISK-21723)
Reported by: Corey Farrell
Patches:
    core-pbx-cleanup.patch uploaded by Correy Farrell (license 5909)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@388532 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-13 18:16:21 +00:00
Kinsey Moore
95ad8ea190 Close libsrtp properly
Ensure that libsrtp is shutdown properly when res_srtp is unloaded.

(closes issue ASTERISK-21719)
Reported by: Corey Farrell
Patches:
    res_srtp-library-shutdown.patch uploaded by Corey Farrell


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@388529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-13 18:05:11 +00:00
Richard Mudgett
b7da14ecf4 Fix SendText AMI action to never return non-zero.
AMI actions must never return non-zero unless they intend to close the AMI
connection.  (Which is almost never.)

(closes issue ASTERISK-21779)
Reported by: Paul Goldbaum


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@388477 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-13 14:24:47 +00:00
Richard Mudgett
af1711d17e Allow mISDN to send PROGRESS messsage.
* Made isdn_msg_parser.c build a progress message with the mandatory
progress indicator IE.  (The mISDNuser NT state machine rejected sending
the incomplete message.)

Note: The associated mISDN and mISDNuser patches respectively are viewable
here:
http://svnview.digium.com/svn/thirdparty?view=rev&rev=200
http://svnview.digium.com/svn/thirdparty?view=rev&rev=201

(closes issue AST-1153)
Reported by: Guenther Kelleter
Patches:
      progress-chan_misdn.diff (license #6372) patch uploaded by Guenther Kelleter
      progress-misdn.diff (license #6372) mISDN patch uploaded by Guenther Kelleter
      progress-misdnuser.diff (license #6372) mISDNuser patch uploaded by Guenther Kelleter


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@388425 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-10 22:09:32 +00:00
Richard Mudgett
777d526415 Add version.c to list of ignored files in the utils directory.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@388423 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-10 21:40:59 +00:00
Mark Michelson
6cbc641491 Fix memory leak in pbx_dundi
pbx_dundi added an io context without removing
it. This caused a memory leak when the module was
unloaded.

(closes ASTERISK-21718)
Reported by Corey Farrell
Patches:
	pbx_dundi-ast_io_remove.patch uploaded by Corey Farrell (License #5909)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@388376 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-10 20:28:29 +00:00
Michael L. Young
276c5e6d45 Fix The Payload Being Set On CN Packets And Do Not Set Marker Bit
When we send out a CN packet (for instance, in the case of using rtpkeepalives),
we are not setting the payload code properly.  Also, we are setting the marker
bit when we shouldn't be according to RFC 3389, section 4.

AST_RTP_CN is not defined by AST_FORMAT codes.  Therefore, we should be using
ast_rtp_codecs_payload_code() rather than ast_rtp_codecs_payload_lookup().

11 and trunk already use the appropriate function.

* In 1.8, use ast_rtp_codecs_payload_code()

* Remove the setting of the marker bit

* Fix the debug message by incrementing the seqno after the debug message is set
  in order to display the correct seqno that was sent out

(closes issue ASTERISK-21246)
Reported by: Peter Katzmann
Tested by: Peter Katzmann, Michael L. Young
Patches:
    asterisk-21246-rtp-cng-payload-error_1.8_v2.diff
                                     uploaded by Michael L. Young (license 5026)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@388111 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-09 03:58:42 +00:00
Alec L Davis
0d9cc94441 chan_sip: NOTIFYs for BLF start queuing up and fail to be sent out after retries fail
RFC6665 4.2.2: ... after a failed State NOTIFY transaction remove the subscription

The problem is that the State Notify requests rely on the 200OK reponse for pacing control
and to not confuse the notify susbsystem.
The issue is, the pendinginvite isn't cleared if a response isn't received,
thus further notify's are never sent.

The solution, follow RFC 6665 4.2.2's 'SHOULD' and remove the subscription after failure.
  
(closes issue ASTERISK-21677)

Reported by: Dan Martens
Tested by: Dan Martens, David Brillert, alecdavis
alecdavis (license 585)

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@387875 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-08 07:17:17 +00:00
Russell Bryant
7124314fb7 Make SLA reload more paranoid.
Reload support was originally not included for SLA.  It was added later,
but in a fairly non-traditional way.  It basically sets a flag
indicating that a reload is pending, and then waits for a time where it
thinks everything SLA related is idle and unused, and *then* executes
the reload.  It does this because the reload process is destructive.  It
starts by throwing everything away and starting over.

There are a number of problems with this approach.  One of them is that
the check to see if anything in use was incomplete.  This patch makes it
more complete and thus less likely for a crash to occur during reload
processing.  However, this approach still has problems so some much more
significant reworking of this code will need to come in as a next step.

Patch credit and testing by CoreDial, LLC.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@387688 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-06 15:52:16 +00:00
Matthew Jordan
cc950e6a80 Update utils Makefile to handle r387294
Alec's patch that added the Asterisk version to 'core show locks' angered the
items in utils, as they exist somewhat outside of the Asterisk build system.
Some day, this Makefile should get nuked from high orbit, but for now, include
version.c in its list of stuff to pile in.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@387421 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-02 17:11:20 +00:00
Alec L Davis
05fb483da6 chan_sip: Session-Expires: Set timer to correctly expire at (~2/3) of the interval when not the refresher
RFC 4028 Section 10
	if the side not performing refreshes does not receive a
	session refresh request before the session expiration, it SHOULD send
	a BYE to terminate the session, slightly before the session
	expiration.  The minimum of 32 seconds and one third of the session
	interval is RECOMMENDED.

Prior to this asterisk would refresh at 1/2 the Session-Expires interval,
or if the remote device was the refresher, asterisk would timeout at interval end.

Now, when not refresher, timeout as per RFC noted above.

(closes issue ASTERISK-21742)

Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@387344 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-02 07:53:55 +00:00
Alec L Davis
d6b88f6627 chan_sip: Honor Session-Expires in 200OK response when it's a RE-INVITE when asterisk is the refresher.
RFC 4028 Section 7.2
 "UACs MUST be prepared to receive a Session-Expires header field in a
 response, even if none were present in the request." 

What changed
  After ASTERISK-20787, inbound calls to asterisk with no Session-Expires in the INVITE are now are offered
  a Session-Expires (1800 asterisk default) in the response, with asterisk as the refresher.

Symptom:
  After 900 seconds (asterisk default refresher period 1800), asterisk RE-INVITEs the device, the device
   may respond with a much lower Session-Expires (180 in our case) value that it is now using.

  Asterisk ignores this response, as it's deemed both an INBOUND CALL, and a RE-INVITE.

  After 180 seconds the device times out and sends BYE (hangs up), asterisk is still working with the
  refresher period of 1800 as it ignored the 'Session Expires: 180' in the previous 200OK response.
 
Fix:
	handle_response_invite() when 200OK, remove check for outbound and reinvite.
  
(closes issue ASTERISK-21664)

Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@387312 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-02 07:20:54 +00:00
Alec L Davis
00c14d8c0d chan_dahdi: fix lower bound check with -ve integer conversion from a float
Lower bound of a 16bit signed int is -32768 not -32767

(closes issue ASTERISK-21744)

Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@387297 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-02 06:51:53 +00:00
Alec L Davis
af6d77f108 Add Asterisk Version to core show locks
Assist with reporting 'core show locks' when submitting bug reports.

Example below:

===========================
== SVN-branch-1.8-...
== Currently Held Locks
===========================


(closes issue ASTERISK-21743)

Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@387294 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-02 06:43:24 +00:00
Matthew Jordan
a7732dfa30 Clear the DTMF sending digit tracking on off nominal paths
In certain situations, when the RTP engine goes to send a DTMF end digit
it may be in a situation where the remote address is no longer available,
or the digit that was supposed to be sent is invalid. In such cases, we
need to clear the RTP counters appropriately. Otherwise, when the RTP
source is set again, we'll continue to think that we're in the middle of
sending a DTMF digit, which can confuse the remote party (signficantly).

(closes issue ASTERISK-21522)
Reported by: Corey Farrell
patches:
  rtp_dtmf_process_end.patch uploaded by Corey Farrell (License 5909)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@387213 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-01 21:15:46 +00:00
Matthew Jordan
e6c986dd33 Prevent crash in 'sip show peers' when the number of peers on a system is large
When you have lots of SIP peers (according to the issue reporter, around 3500),
the 'sip show peers' CLI command or AMI action can crash due to a poorly placed
string duplication that occurs on the stack. This patch refactors the command
to not allocate the string on the stack, and handles the formatting of a single
peer in a separate function call.

(closes issue ASTERISK-21466)
Reported by: Guillaume Knispel
patches:
  fix_sip_show_peers_stack_overflow_asterisk_11.3.0-v2.patch uploaded by gknispel (License 6492)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@387133 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-01 18:34:44 +00:00
Matthew Jordan
8d1f50d957 Fix CDR not being created during an externally initiated blind transfer
Way back when in the dark days of Asterisk 1.8.9, blind transferring a call
in a context that included the 'h' extension would inadvertently execute the
hangup code logic on the transferred channel. This was a "bad thing". The fix
was to properly check for the softhangup flags on the channel and only execute
the 'h' extension logic (and, in later versions, hangup handler logic) if the
channel was well and truly dead (Jim).

Unfortunately, CDRs are fickle. Setting the softhangup flag when we detected
that the channel was leaving the bridge (but not to die) caused some crucial
snippet of CDR code, lying in ambush in the middle of the bridging code, to
not get executed. This had the effect of blowing away one of the CDRs that is
typically created during a blind transfer.

While we live and die by the adage "don't touch CDRs in release branches", this
was our bad. The attached patch restores the CDR behavior, and still manages to
not run the 'h' extension during a blind transfer (at least not when it's
supposed to).

Thanks to Steve Davies for diagnosing this and providing a fix.

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

(closes issue ASTERISK-21394)
Reported by: Ishfaq Malik
Tested by: Ishfaq Malik, mjordan
patches:
  fix_missing_blindXfer_cdr2 uploaded by one47 (License 5012)





git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@387036 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-30 22:34:05 +00:00
Sean Bright
cf90e44d99 Use the proper lower bound when doing saturation arithmetic.
16 bit signed integers have a range of [-32768, 32768).  The existing code
was using the interval (-32768, 32768) instead.  This patch fixes that.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@386929 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-30 13:45:40 +00:00
Rusty Newton
eeaac15fe9 Modifying sounds/Makefile to pull down 1.4.24 core sounds
1.4.24 core sounds includes a full set of Italian prompts for core sounds and a fix for the missing voicemail prompts in the Russian language.

(closes issue ASTERISK-19431)
(closes issue ASTERISK-19721)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@386877 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-29 23:34:11 +00:00
Olle Johansson
fa0b6a2fb5 Play periodic prompst for first call in a call queue
Review: https://reviewboard.asterisk.org/r/2263/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@386792 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-29 08:36:15 +00:00
Matthew Jordan
8e5ffde816 Clean up memory leak in config file on off nominal paths when glob is allowed
If a system allows for its usage, Asterisk will use glob to help parse
Asterisk .conf files. The config file loading routine was leaking the memory
allocated by the glob() routine when the config file was in an unmodified
or invalid state.

This patch properly calls globfree in those off nominal paths.

(closes issue ASTERISK-21412)
Reported by: Corey Farrell
patches:
  config_glob_leak.patch uploaded by Corey Farrell (license 5909)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@386672 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-26 21:26:39 +00:00
Matthew Jordan
d3b56c6ad4 Clean up resources in features on exit
This patch cleans up two things features:
* It properly unregisters the CLI commands that features registered
* It cancels and performs a pthread_join on the created parking thread. This
  not only properly joins a non-detached thread, but also prevents disposing
  of the parking lots prior to the parking thread completely exiting.

(closes issue ASTERISK-21407)
Reported by: Corey Farrell
patches:
  features_shutdown-r2.patch uploaded by Corey Farrell (License 5909)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@386641 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-26 21:11:33 +00:00
Michael L. Young
edc8f9439a Change Case On Forcerport For Consistency
* Change "ForcerPort" to "Forcerport" to match everywhere else it is displayed


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@386483 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-25 02:43:03 +00:00
Richard Mudgett
b5c39ac861 Fix crash when AMI redirect action redirects two channels out of a bridge.
The two party bridging loops were changing the bridge peer pointers
without the channel locks held.  Thus when ast_channel_massquerade()
tested and used the pointer there is a small window of opportunity for the
pointers to become NULL even though the masquerade code has the channels
locked.

(closes issue ASTERISK-21356)
Reported by: William luke
Patches:
      jira_asterisk_21356_v11.patch (license #5621) patch uploaded by rmudgett
Tested by: William luke


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@386256 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-22 16:10:29 +00:00
Matthew Jordan
6f8468d863 Prevent res_timing_pthread from blocking callers
There were several reports of deadlock when using
res_timing_pthread. Backtraces indicated that one thread was blocked
waiting for the write to the pipe to complete and this thread held
the container lock for the timers.  Therefore any thread that wanted
to create a new timer or read an existing timer would block waiting
for either the timer lock or the container lock and deadlock ensued.

This patch changes the way the pipe is used to eliminate this source
of deadlocks:

1) The pipe is placed in non-blocking mode so that it would never
block even if the following changes someone fail...

2) Instead of writing bytes into the pipe for each "tick" that's
fired the pipe now has two states--signaled and unsignaled. If
signaled, the pipe is hot and any pollers of the read side
filedescriptor will be woken up. If unsigned the pipe is idle. This
eliminates even the chance of filling up the pipe and reduces the
potential overhead of calling unnecessary writes.

3) Since we're tracking the signaled / unsignaled state, we can
eliminate the exta poll system call for every firing because we know
that there is data to be read.

(closes issue ASTERISK-21389)
Reported by: Matt Jordan
Tested by: Shaun Ruffell, Matt Jordan, Tony Lewis
patches:
  0001-res_timing_pthread-Reduce-probability-of-deadlocking.patch uploaded by sruffell (License 5417)

(closes issue ASTERISK-19754)
Reported by: Nikola Ciprich

(closes issue ASTERISK-20577)
Reported by: Kien Kennedy

(closes issue ASTERISK-17436)
Reported by: Henry Fernandes

(closes issue ASTERISK-17467)
Reported by: isrl

(closes issue ASTERISK-17458)
Reported by: isrl

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@386109 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-19 15:59:25 +00:00
David M. Lee
46af845e4a cli.c: Properly initialize debug_modules and verbose_modules.
This avoids some lock errors on the core set {debug,verbose} commands.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@386049 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-19 05:18:13 +00:00
Alec L Davis
e4854dd1b2 Distributed Device State broken at sites using res_xmpp or res_jabber where Secuity Advisory AST-2012-015 is inplace
res_jabber/res_xmpp were not adding AST_EVENT_IE_CACHABLE to the event as each message came in,
then devstate_change_collector_cb() was unable to find AST_EVENT_IE_CACHABLE in the event,
so defaulted incorrectly to AST_DEVSTATE_NOT_CACHABLE.

(issue ASTERISK-20175)
(closes issue ASTERISK-21429)
(closes issue ASTERISK-21069)
(closes issue ASTERISK-21164)

Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@385916 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-16 23:11:46 +00:00
Jason Parker
c41e19fc90 Don't unnecessarily rebuild things on every run of 'make'.
Review: https://reviewboard.asterisk.org/r/2449/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@385745 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-15 17:07:45 +00:00
David M. Lee
a6d0dfc3d1 Fix the svn:keywords property on several files.
Normally I think keyword expansion is silly, but the one time it would have
been good, it didn't work because the property had quotes in it. This patch
fixes obviously busted svn:keywords properties.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@385683 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-15 14:38:24 +00:00
Matthew Jordan
5a756f15f8 Calculate the timestamp for outbound RTP if we don't have timing information
This patch calculates the timestamp for outbound RTP when we don't have timing
information. This uses the same approach in res_rtp_asterisk. Thanks to both
Pietro and Tzafrir for providing patches.

(closes issue ASTERISK-19883)
Reported by: Giacomo Trovato
Tested by: Pietro Bertera, Tzafrir Cohen
patches:
  rtp-timestamp-1.8.patch uploaded by tzafrir (License 5035)
  rtp-timestamp.patch uploaded by pbertera (License 5943)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@385636 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-14 02:58:57 +00:00
Matthew Jordan
a73ffd9d25 Don't attempt to create a voice frame on a read error
Prior to this patch, a read error in snd_pcm_readi would still be treated as a
nominal result when constructing a voice frame from the expected data. Since
the value returned is negative, as opposed to the number of samples read,
this could result in a crash. With this patch, we now return a null frame
when a read error is detected.

Note that the patch on ASTERISK-21329 was modified slightly for this commit,
in that we bail immediately on detecting the read error, rather than bypassing
the construction of the voice frame.

(closes issue ASTERISK-21329)
Reported by: Keiichiro Kawasaki
patches:
  chan_alsa.diff uploaded by kawasaki (License 6489)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@385633 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-14 02:21:30 +00:00
Michael L. Young
7ff1e29675 Fix Manager Segfault When app_queue Is Unloaded
When app_queue is unloaded, some manager commands are not being unregistered
which result in a segfault.  This patch corrects this.

(closes issue ASTERISK-21397)
Reported by: Peter Katzmann, Corey Farrell
Tested by: Corey Farrell
Patches:
    asterisk-21397-missing-unreg-manager-cmd_1.8.diff
                                                 Michael L. Young (license 5026)
    asterisk-21397-missing-unreg-manager-cmd_11.diff
                                                 Michael L. Young (license 5026)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@385593 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-12 22:34:46 +00:00
Michael L. Young
1f2145b7b4 Fix app_voicemail Segfault And A Few Memory Leaks
The original report was that app_voicemail would crash.  This was caused by
ast_config_load() returning CONFIG_STATUS_FILEINVALID but no checks being
performed for that return status.  After adding the initial patch to fix this
issue, Jaco Kroon (jkroon) added some fixes to memory leaks he had discovered.

During review, Walter Doekes (wdoekes) suggested adding a helper function in
order to determine if we had a valid configuration or not.

This patch does the following:

* Creates a helper function to check if the configuration is valid

* Adds calls to the new helper function where appropiate

* Fixes memory leaks where the code returned without running
  ast_config_destroy() on the configuration that was loaded

(closes issue ASTERISK-21302)
Reported by: Jaco Kroon
Tested by: Jaco Kroon, Michael L. Young
Patches:
    asterisk-11.3.0-app_voicemail-ast_config-fixes.patch
                                                       Jaco Kroon (license 5671)
    asterisk-21302-valid_cfg_and_mem_leaks_v3-1.8.diff
                                                 Michael L. Young (license 5026)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@385551 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-12 22:14:31 +00:00
Alec L Davis
1f89548d65 IAX2 defer_full_frames fail to get sent
Ensure iax2_process_thread is signalled when a deferred frame is queued to it.

(issue ASTERISK-18827)
Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@385429 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-12 08:46:19 +00:00
Alec L Davis
e28a50dbb5 IAX2, prevent network thread starting before all helper threads are ready
On startup, it's possible for a frame to arrive before the processing threads were ready.

In iax2_process_thread() the first pass through falls into ast_cond_wait, should a frame arrive
before we are at ast_cond_wait, the signal will be ignored.
The result iax2_process_thread stays at ast_cond_wait forever, with deferred frames being queued.  

Fix: When creating initial idle iax2_process_threads, wait for init_cond to be signalled
after each thread is started.
 
(issue ASTERISK-18827)
Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@385402 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-12 08:14:20 +00:00
Matthew Jordan
6166563bb3 Use LDAP memory management functions instead of Asterisk's
When MALLOC_DEBUG is enabled with res_config_ldap, issues (munmap_chunk:
invalid pointer errors) can occur as the memory is being allocated with
Asterisk's wrappers around malloc/calloc/free/strdup, as opposed to the
LDAP library's wrappers.

This patch uses the LDAP library's wrappers where appropriate, so that
compiling with MALLOC_DEBUG doesn't cause more problems than it solves.

Note that the patch listed below was modified slightly for this commit
to account for some additional memory allocation/deallocations.

(closes issue ASTERISK-17386)
Reported by: John Covert
Tested by: Andrew Latham
patches:
  issue18789-1.8-r316873.patch uploaded by seanbright (License 5060)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@385190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-10 14:22:45 +00:00
Matthew Jordan
f39c2a40f9 Fix crash in chan_sip when a core initiated op occurs at the same time as a BYE
When a BYE request is processed in chan_sip, the current SIP dialog is detached
from its associated Asterisk channel structure. The tech_pvt pointer in the
channel object is set to NULL, and the dialog persists for an RFC mandated
period of time to handle re-transmits.

While this process occurs, the channel is locked (which is good).
Unfortunately, operations that are initiated externally have no way of knowing
that the channel they've just obtained (which is still valid) and that they are
attempting to lock is about to have its tech_pvt pointer removed. By the time
they obtain the channel lock and call the channel technology callback, the
tech_pvt is NULL.

This patch adds a few checks to some channel callbacks that make sure the
tech_pvt isn't NULL before using it. Prime offenders were the DTMF digit
callbacks, which would crash if AMI initiated a DTMF on the channel at the
same time as a BYE was received from the UA. This patch also adds checks on
sip_transfer (as AMI can also cause a callback into this function), as well
as sip_indicate (as lots of things can queue an indication onto a channel).

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

(closes issue ASTERISK-20225)
Reported by: Jeff Hoppe



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@385170 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-04-10 14:03:05 +00:00