]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
9 years agoconfig.c: Fix #include after [section](+). 19/1419/1
Richard Mudgett [Mon, 12 Oct 2015 16:21:55 +0000 (11:21 -0500)] 
config.c: Fix #include after [section](+).

An #include right after a [section](+) would associate any variable
assignments before a new section in the #include with the wrong section.

* Fix section association by setting the current section to the appended
section.

* Fix '+' and '!' section flag interaction corner case depending upon
which flag came first.  If the '!' came first then it would be ignored.
If the '!' came after then it would affect the appended section.  The '!'
will now no longer be ignored.

ASTERISK-25461 #close
Reported by: Sean Pimental

Change-Id: Ic9d3191c8758048e2cbce6432f854b32531731c3

9 years agofunc_presencestate: Return "not_set" when no data is set in AstDB 10/1410/1
Ivan Poddubny [Wed, 7 Oct 2015 06:24:31 +0000 (09:24 +0300)] 
func_presencestate: Return "not_set" when no data is set in AstDB

Return AST_PRESENCE_NOT_SET when CustomPresence AstDB key does not
exist, i.e. when a new CustomPresence is added in the dialplan.

ASTERISK-25400 #close
Reported by: Andrew Nagy

Change-Id: I6fb17b16591b5a55fbffe96f3994ec26b1b1723a

9 years agores/res_rtp_asterisk: Fix assignment after ao2 decrement 01/1401/1
Matt Jordan [Wed, 7 Oct 2015 01:43:58 +0000 (20:43 -0500)] 
res/res_rtp_asterisk: Fix assignment after ao2 decrement

When we decide we will no longer schedule an RTCP write, we remove the
reference to the RTP instance, then assign -1 to the stored scheduler ID
in case something else comes along and wants to see if anything is scheduled.

That scheduler ID is on the RTP instance. After 60a9172d7ef2 was merged to
fix the regression introduced by 3cf0f29310, this improper assignment on a
potentially destroyed object started getting tripped on the build agents.

Frankly, this should have been crashing a lot more often earlier. I can only
assume that the timing was changed just enough by both changes to start
actually hitting this problem.

As it is, simply moving the assignment prior to the ao2 deference is sufficient
to keep the RTP instance from being referenced when it is very, truly,
aboslutely dead.

(Note that it is still good practice to assign -1 to the scheduler ID when we
know we won't be scheduling it again, as the ao2 deref *may* not always destroy
the ao2 object.)

ASTERISK-25449

Change-Id: Ie6d3cb4adc7b1a6c078b1c38c19fc84cf787cda7

9 years agochan_sip: Fix port parsing for IPv6 addresses in SIP Via headers. 91/1391/2
Florian Sauerteig [Tue, 6 Oct 2015 17:40:22 +0000 (19:40 +0200)] 
chan_sip: Fix port parsing for IPv6 addresses in SIP Via headers.

If a Via header containes an IPv6 address and a port number is ommitted,
as it is the standard port, we now leave the port empty and to not set it
to the value after the first colon of the IPv6 address.

ASTERISK-25443 #close

Change-Id: Ie3c2f05471cd006bf04ed15598589c09577b1e70

9 years agoFix improper usage of scheduler exposed by 5c713fdf18f 84/1384/2
Matt Jordan [Tue, 6 Oct 2015 02:34:41 +0000 (21:34 -0500)] 
Fix improper usage of scheduler exposed by 5c713fdf18f

When 5c713fdf18f was merged, it allowed for scheduled items to have an ID of
'0' returned. While this was valid per the documentation for the API, it was
apparently never returned previously. As a result, several users of the
scheduler API viewed the result as being invalid, causing them to reschedule
already scheduled items or otherwise fail in interesting ways.

This patch corrects the users such that they view '0' as valid, and a returned
ID of -1 as being invalid.

Note that the failing HEP RTCP tests now pass with this patch. These tests
failed due to a duplicate scheduling of the RTCP transmissions.

ASTERISK-25449 #close

Change-Id: I019a9aa8b6997584f66876331675981ac9e07e39

9 years agomanager: Fix GetConfigJSON returning invalid JSON 72/1372/1
Ivan Poddubny [Sat, 3 Oct 2015 11:27:27 +0000 (14:27 +0300)] 
manager: Fix GetConfigJSON returning invalid JSON

When GetConfigJSON was introduced back in 1.6, it returned each
section as an array of strings: ["key=value", "key2=value2"].
Afterwards, it was changed a few times and became
["key": "value", "key2": "value2"], which is not a correct JSON.
This patch fixes that by constructing a JSON object {} instead of
an array [].

ASTERISK-25391 #close
Reported by: Bojan Nemčić

Change-Id: Ibbe93c6a227dff14d4a54b0d152341857bcf6ad8

9 years agoMerge "sched.c: Add warning about negative time interval request." into 11
Joshua Colp [Fri, 2 Oct 2015 21:27:02 +0000 (16:27 -0500)] 
Merge "sched.c: Add warning about negative time interval request." into 11

9 years agosched.c: Add warning about negative time interval request. 49/1349/1
Richard Mudgett [Mon, 28 Sep 2015 20:31:38 +0000 (15:31 -0500)] 
sched.c: Add warning about negative time interval request.

Change-Id: Ib91435fb45b7f5f7c0fc83d0eec20b88098707bc

9 years agores_rtp_asterisk: Move "Set role" warning to be debug. 46/1346/1
Joshua Colp [Wed, 30 Sep 2015 18:42:40 +0000 (15:42 -0300)] 
res_rtp_asterisk: Move "Set role" warning to be debug.

In practice the set_role API callback can be invoked even
when no ICE is present on an RTP instance. This can occur
if ICE has not been enabled on it.

ASTERISK-25438 #close

Change-Id: I0e17e4316f0f0d7f095c78c3d4fd73a913b6ba69

9 years agoMerge "channel.c: Fix NewCallerid AMI event not been sent on Caller ID change" into 11
Matt Jordan [Tue, 29 Sep 2015 02:05:18 +0000 (21:05 -0500)] 
Merge "channel.c: Fix NewCallerid AMI event not been sent on Caller ID change" into 11

9 years agochannel.c: Fix NewCallerid AMI event not been sent on Caller ID change 34/1334/3
Ivan Poddubny [Mon, 28 Sep 2015 06:36:30 +0000 (09:36 +0300)] 
channel.c: Fix NewCallerid AMI event not been sent on Caller ID change

Currently, NewCallerid is sent only when pointers to number or name
strings change, which is not always the case. The newly allocated string
may use the same memory, so pointers match, while the content
is different. As a result, Caller ID updates are often not reported.

With this patch, actual strings are compared, not the pointers.

ASTERISK-25427 #close
Reported by: Ivan Poddubny

Change-Id: I2a1ac3a842f0e092c6058d1cd3e35443bece1b36

9 years agoMerge "translate: Fix transcoding while different in frame size." into 11
Matt Jordan [Mon, 28 Sep 2015 16:20:38 +0000 (11:20 -0500)] 
Merge "translate: Fix transcoding while different in frame size." into 11

9 years agocore/logging: Fix logging to more than one syslog channel 93/1293/1
Elazar Broad [Mon, 21 Sep 2015 13:16:46 +0000 (09:16 -0400)] 
core/logging: Fix logging to more than one syslog channel

Currently, Asterisk will log to the last configured syslog
channel in logger.conf. This is due to the fact that the
final call to openlog() supersedes all of the previous calls.
This commit removes the call to openlog() and passes the
facility to ast_log_vsyslog(), along with utilizing the
LOG_MAKEPRI macro to ensure that the message is routed to
the correct facility and with the correct priority.

ASTERISK-25407 #close
Reported by: Elazar Broad
Tested by: Elazar Broad

Change-Id: Ie2a2416bc00cce1b04e99ef40917c2011953ddd2

9 years agoMerge "app_record: RECORDED_FILE variable not being populated" into 11
Matt Jordan [Tue, 22 Sep 2015 12:40:29 +0000 (07:40 -0500)] 
Merge "app_record: RECORDED_FILE variable not being populated" into 11

9 years agoMerge "pbx: Update device and presence state when changing a hint extension." into 11
Joshua Colp [Tue, 22 Sep 2015 10:29:42 +0000 (05:29 -0500)] 
Merge "pbx: Update device and presence state when changing a hint extension." into 11

9 years agoapp_record: RECORDED_FILE variable not being populated 91/1291/1
Kevin Harwell [Mon, 21 Sep 2015 23:06:15 +0000 (18:06 -0500)] 
app_record: RECORDED_FILE variable not being populated

The RECORDED_FILE variable is empty unless a '%d' is specified in the filename.
This patch makes it so the variable is always set to the filename.

ASTERISK-25410 #close

Change-Id: I4ec826d8eb582ae2ad184e717be8668b74d37653

9 years agopbx: Update device and presence state when changing a hint extension. 62/1262/3
Joshua Colp [Wed, 16 Sep 2015 13:22:35 +0000 (10:22 -0300)] 
pbx: Update device and presence state when changing a hint extension.

When changing a hint extension without removing the hint first the
device state and presence state is not updated. This causes the state
of the hint to be that of the previous extension and not the current
one. This state is kept until a state change occurs as a result of
something (presence state change, device state change).

This change updates the hint with the current device and presence
state of the new extension when it is changed. Any state callbacks
which may have been added before the hint extension is changed are
also informed of the new device and presence state if either have
changed.

ASTERISK-25394 #close

Change-Id: If268f1110290e502c73dd289c9e7e7b27bc8432f

9 years agochan_sip: Fix From header truncation for extremely long CALLERID(name). 69/1269/2
Walter Doekes [Thu, 17 Sep 2015 09:52:09 +0000 (11:52 +0200)] 
chan_sip: Fix From header truncation for extremely long CALLERID(name).

The CALLERID(num) and CALLERID(name) and other info are placed into the
`char from[256]` in initreqprep. If the name was too long, the addr-spec
and params wouldn't fit.

Code is moved around so the addr-spec with params is placed there first,
and then fitting in as much of the display-name as possible.

ASTERISK-25396 #close

Change-Id: I33632baf024f01b6a00f8c7f35c91e5f68c40260

9 years agotranslate: Fix transcoding while different in frame size. 56/1156/5
Alexander Traud [Fri, 28 Aug 2015 21:06:02 +0000 (23:06 +0200)] 
translate: Fix transcoding while different in frame size.

When Asterisk translates between codecs each with a different frame size (for
example between iLBC 30 and Speex-WB), too large frames were created by
ast_trans_frameout. Now, ast_trans_frameout is called with the correct frame
length, creating several frames when necessary. Affects all transcoding modules
which used ast_trans_frameout: GSM, iLBC, LPC10, and Speex.

ASTERISK-25353 #close

Change-Id: I84b59f7a745955820f10e20f5999eb69495a68b9

9 years agoscheduler: Use queue for allocating sched IDs. 58/1258/3
Mark Michelson [Thu, 10 Sep 2015 22:19:26 +0000 (17:19 -0500)] 
scheduler: Use queue for allocating sched IDs.

It has been observed that on long-running busy systems, a scheduler
context can eventually hit INT_MAX for its assigned IDs and end up
overflowing into a very low negative number. When this occurs, this can
result in odd behaviors, because a negative return is interpreted by
callers as being a failure. However, the item actually was successfully
scheduled. The result may be that a freed item remains in the scheduler,
resulting in a crash at some point in the future.

The scheduler can overflow because every time that an item is added to
the scheduler, a counter is bumped and that counter's current value is
assigned as the new item's ID.

This patch introduces a new method for assigning scheduler IDs. Instead
of assigning from a counter, a queue of available IDs is maintained.
When assigning a new ID, an ID is pulled from the queue. When a
scheduler item is released, its ID is pushed back onto the queue. This
way, IDs may be reused when they become available, and the growth of ID
numbers is directly related to concurrent activity within a scheduler
context rather than the uptime of the system.

Change-Id: I532708eef8f669d823457d7fefdad9a6078b99b2

9 years agoMerge "chan_ooh323: Add ProgressIndicator IE with inband info available" into 11
Matt Jordan [Thu, 10 Sep 2015 00:12:00 +0000 (19:12 -0500)] 
Merge "chan_ooh323: Add ProgressIndicator IE with inband info available" into 11

9 years agochan_ooh323: Add ProgressIndicator IE with inband info available 29/1229/2
Alexander Anikin [Wed, 9 Sep 2015 21:46:44 +0000 (01:46 +0400)] 
chan_ooh323: Add ProgressIndicator IE with inband info available

Add ProgressIndicator IE with inband info present to Progress and
Alerting Q.931 message

ASTERISK-25227 #close
Reported by: Alexandr Dranchuk

Change-Id: I326ad13cb1db9a72b3fd902bafed3c28a3684203

9 years agoMerge "res_rtp_asterisk: Add more ICE debugging" into 11
Matt Jordan [Tue, 8 Sep 2015 21:41:52 +0000 (16:41 -0500)] 
Merge "res_rtp_asterisk: Add more ICE debugging" into 11

9 years agores_rtp_asterisk: Add more ICE debugging 25/1225/1
David M. Lee [Fri, 4 Sep 2015 21:33:39 +0000 (16:33 -0500)] 
res_rtp_asterisk: Add more ICE debugging

In working through a recent ICE negotiation bug, I found the debug
logging in res_rtp_asterisk to be lacking. This patch adds a number of
debug and warning statements that were helpful.

Change-Id: I950c6d8f13a41f14b3d6334b4cafe7d4e997be80

9 years agoCore/General: Add #ifdef needed on FreeBSD. 24/1224/1
Guido Falsi [Tue, 1 Sep 2015 15:16:55 +0000 (17:16 +0200)] 
Core/General: Add #ifdef needed on FreeBSD.

pthread_attr_init() defaults to PTHREAD_EXPLICIT_SCHED on FreeBSD
too.

ASTERISK-25310 #close
Reported by: Guido Falsi

Change-Id: Iae6befac9028b5b9795f86986a4a08a1ae6ab7c4

9 years ago chan_ooh323: call ast_rtp_instance_stop on ooh323_destroy 09/1209/1
Alexander Anikin [Mon, 7 Sep 2015 18:19:41 +0000 (22:19 +0400)] 
chan_ooh323: call ast_rtp_instance_stop on ooh323_destroy

    Call ast_rtp_instance_stop on ooh323_destroy to free resources
    allocated by rtp instance

    ASTERISK-25299 #close
    Report by: Alexandr Dranchuk

Change-Id: I455096bd7da016b871afe90af86067c2c7c9f33f

9 years agoFix when remote candidates exceed PJ_ICE_MAX_CAND 01/1201/1
David M. Lee [Fri, 4 Sep 2015 21:06:39 +0000 (16:06 -0500)] 
Fix when remote candidates exceed PJ_ICE_MAX_CAND

We were passing the wrong count into pj_ice_sess_create_check_list(),
causing the create to fail if we ever received more than PJ_ICE_MAX_CAND
candidates.

Change-Id: I0303d8e1ecb20a8de9fe629a3209d216c4028378

9 years agochan_sip: Allow call pickup to set the hangup cause. 40/1140/1
Joshua Colp [Wed, 26 Aug 2015 10:40:32 +0000 (07:40 -0300)] 
chan_sip: Allow call pickup to set the hangup cause.

The call pickup implementation in chan_sip currently sets the channel
hangup cause to "normal clearing" if call pickup is successfully
performed. This action overwrites the "answered elsewhere" hangup cause
set by the call pickup code and can result in the SIP device in
question showing a missed call when it should not.

This change sets the hangup cause to "normal clearing" as a
default initially but allows the call pickup to change it as
needed.

ASTERISK-25346 #close

Change-Id: I00ac2c269cee9e29586ee2c65e83c70e52a02cff

9 years agoMerge "app_queue.c: Extract some functions for simpler code." into 11
Mark Michelson [Wed, 19 Aug 2015 22:03:19 +0000 (17:03 -0500)] 
Merge "app_queue.c: Extract some functions for simpler code." into 11

9 years agocontrib: script install_prereq should install sqlite3 21/1121/1
Scott Griepentrog [Wed, 19 Aug 2015 15:30:12 +0000 (10:30 -0500)] 
contrib: script install_prereq should install sqlite3

Asterisk needs the sqlite 3 library, which is package
sqlite-devel in CentOS. By adding this package to the
script, a problem with configure failing is resolved.

ASTERISK-25331 #close
Reported by: Kevin Harwell

Change-Id: I90efaf6a01914fea03f21e5cdbd91c348f44b0ec

9 years agoapp_queue.c: Extract some functions for simpler code. 04/1104/2
Richard Mudgett [Mon, 17 Aug 2015 21:41:19 +0000 (16:41 -0500)] 
app_queue.c: Extract some functions for simpler code.

* Extract set_queue_member_pause() from set_member_paused() for simpler
and more consistent code.

* Extract set_queue_member_ringinuse() from
set_member_ringinuse_help_members() for simpler code.

NOTE: This may fix a consistency issue with realtime ringinuse
because the ordering of things was backported from v13.  It is
similar to how set_member_paused() treats realtime for paused.

Change-Id: Iecc1f4119c63347341d7ea6b65f5fc4963706306

9 years agoapp_queue.c: Fix error checking in QUEUE_MEMBER() read. 03/1103/2
Richard Mudgett [Mon, 17 Aug 2015 18:34:15 +0000 (13:34 -0500)] 
app_queue.c: Fix error checking in QUEUE_MEMBER() read.

Change-Id: I7294e13d27875851c2f4ef6818adba507509d224

9 years agoapp_queue.c: Fix setting QUEUE_MEMBER 'paused' and 'ringinuse'. 02/1102/2
Richard Mudgett [Fri, 14 Aug 2015 17:55:28 +0000 (12:55 -0500)] 
app_queue.c: Fix setting QUEUE_MEMBER 'paused' and 'ringinuse'.

Setting the 'paused' and 'ringinuse' options on a queue member using the
dialplan function QUEUE_MEMBER did not behave the same way as the
equivalent dialplan applications or AMI actions.

* Made queue_function_mem_write() call the set_member_paused() and
set_member_value() for the 'paused' and 'ringinuse' options respectively.
A beneficial side effect is that the queue name is now optional and sets
the value in all queues the interface is a member.

NOTE: This may fix a consistency issue with the realtime paused setting
since how the value is set is controlled by set_member_paused() which
treats realtime a little better.

* Update QUEUE_MEMBER XML documentation.

* Fix error checking in QUEUE_MEMBER() write.

ASTERISK-25215 #close
Reported by: Lorne Gaetz

Change-Id: I3a016be8dc94d63a9cc155295ff9c9afa5f707cb

9 years agoMerge "chan_sip.c: wrong peer searched in sip_report_security_event" into 11
Mark Michelson [Thu, 13 Aug 2015 21:11:24 +0000 (16:11 -0500)] 
Merge "chan_sip.c: wrong peer searched in sip_report_security_event" into 11

9 years agochan_sip.c: wrong peer searched in sip_report_security_event 77/1077/3
Kevin Harwell [Wed, 12 Aug 2015 17:59:53 +0000 (12:59 -0500)] 
chan_sip.c: wrong peer searched in sip_report_security_event

In chan_sip, after handling an incoming invite a security event is raised
describing authorization (success, failure, etc...). However, it was doing
a lookup of the peer by extension. This is fine for register messages, but
in the case of an invite it may search and find the wrong peer, or a non
existent one (for instance, in the case of call pickup). Also, if the peers
are configured through realtime this may cause an unnecessary database lookup
when caching is enabled.

This patch makes it so that sip_report_security_event searches by IP address
when looking for a peer instead of by extension after an invite is processed.

ASTERISK-25320 #close

Change-Id: I9b3f11549efb475b6561c64f0e6da1a481d98bc4

9 years agoMerge "res_http_websocket: Forcefully terminate on write errors." into 11
Joshua Colp [Wed, 12 Aug 2015 18:43:11 +0000 (13:43 -0500)] 
Merge "res_http_websocket: Forcefully terminate on write errors." into 11

9 years agochan_dahdi.c: Flush the DAHDI write buffer after starting DTMF. 62/1062/1
Richard Mudgett [Mon, 10 Aug 2015 18:43:19 +0000 (13:43 -0500)] 
chan_dahdi.c: Flush the DAHDI write buffer after starting DTMF.

Pressing DTMF digits on a phone to go out on a DAHDI channel can result in
the digit not being recognized or even heard by the peer.

Phone -> Asterisk -> DAHDI/channel

Turns out the DAHDI behavior with DTMF generation (and any other generated
tones) is exposed by the "buffers=" setting in chan_dahdi.conf.  When
Asterisk requests to start sending DTMF then DAHDI waits until its write
buffer is empty before generating any samples for the DTMF tones.  When
Asterisk subsequently requests DAHDI to stop sending DTMF then DAHDI
immediately stops generating the DTMF samples.  As a result, the more
samples there are in the DAHDI write buffer the shorter the time DTMF
actually gets sent on the wire.  If there are more samples in the write
buffer than the time DTMF is supposed to be sent then no DTMF gets sent on
the wire.  With the "buffers=12,half" setting and each buffer representing
20 ms of samples then the DAHDI write buffer is going to contain around
120 ms of samples.  For DTMF to be recognized by the peer the actual sent
DTMF duration needs to be a minimum of 40 ms.  Therefore, the intended
duration needs to be a minimum of 160 ms for the peer to receive the
minimum DTMF digit duration to recognize it.

A simple and effective solution to work around the DAHDI behavior is for
Asterisk to flush the DAHDI write buffer when sending DTMF so the full
duration of DTMF is actually sent on the wire.  When someone is going to
send DTMF they are not likely to be talking before sending the tones so
the flushed write samples are expected to just contain silence.

* Made dahdi_digit_begin() flush the DAHDI write buffer after requesting
to send a DTMF digit.

ASTERISK-25315 #close
Reported by John Hardin

Change-Id: Ib56262c708cb7858082156bfc70ebd0a220efa6a

9 years agochan_dahdi.c: Lock private struct for ast_write(). 61/1061/1
Richard Mudgett [Wed, 5 Aug 2015 19:21:50 +0000 (14:21 -0500)] 
chan_dahdi.c: Lock private struct for ast_write().

There is a window of opportunity for DTMF to not go out if an audio frame
is in the process of being written to DAHDI while another thread starts
sending DTMF.  The thread sending the audio frame could be past the
currently dialing check before being preempted by another thread starting
a DTMF generation request.  When the thread sending the audio frame
resumes it will then cause DAHDI to stop the DTMF tone generation.  The
result is no DTMF goes out.

* Made dahdi_write() lock the private struct before writing to the DAHDI
file descriptor.

ASTERISK-25315
Reported by John Hardin

Change-Id: Ib4e0264cf63305ed5da701188447668e72ec9abb

9 years agores_http_websocket: Forcefully terminate on write errors. 72/1072/1
Joshua Colp [Tue, 11 Aug 2015 10:24:30 +0000 (07:24 -0300)] 
res_http_websocket: Forcefully terminate on write errors.

The res_http_websocket module will currently attempt to close
the WebSocket connection if fatal cases occur, such as when
attempting to write out data and being unable to. When the
fatal cases occur the code attempts to write a WebSocket close
frame out to have the remote side close the connection. If
writing this fails then the connection is not terminated.

This change forcefully terminates the connection if the
WebSocket is to be closed but is unable to send the close frame.

ASTERISK-25312 #close

Change-Id: I10973086671cc192a76424060d9ec8e688602845

9 years agoReplace htobe64 with htonll 50/1050/1
David M. Lee [Sat, 8 Aug 2015 03:11:03 +0000 (22:11 -0500)] 
Replace htobe64 with htonll

We don't have a compatability function to fill in a missing htobe64; but
we already have one for the identical htonll.

Change-Id: Ic0a95db1c5b0041e14e6b127432fb533b97e4cac

10 years agores_rtp_asterisk: Don't leak temporary key when enabling PFS. 35/1035/2
Joshua Colp [Wed, 5 Aug 2015 10:23:21 +0000 (07:23 -0300)] 
res_rtp_asterisk: Don't leak temporary key when enabling PFS.

A change recently went in which enabled perfect forward secrecy for
DTLS in res_rtp_asterisk. This was accomplished two different ways
depending on the availability of a feature in OpenSSL. The fallback
method created a temporary instance of a key but did not free it.
This change fixes that.

ASTERISK-25265

Change-Id: Iadc031b67a91410bbefb17ffb4218d615d051396

10 years agores/res_rtp_asterisk: Add ECDH support 29/1029/2
Mark Duncan [Tue, 28 Jul 2015 10:33:39 +0000 (19:33 +0900)] 
res/res_rtp_asterisk: Add ECDH support

This will add ECDH support to Asterisk. It will
detect auto ECDH support in OpenSSL
(1.0.2b and above) during ./configure. If this is
available, it will use it,
otherwise it will fall back to prime256v1 (this
behavior is consistent with
other projects such as Apache and nginx).

This fixes WebRTC being broken in Firefox 38+ due
to Firefox now only supporting
ciphers with perfect forward secrecy.

ASTERISK-25265 #close

Change-Id: I8c13b33a2a79c0bde2e69e4ba6afa5ab9351465b

10 years agochan_sip.c: Move NULL check to where it will do some good. 99/999/1
Richard Mudgett [Tue, 21 Jul 2015 20:41:29 +0000 (15:41 -0500)] 
chan_sip.c: Move NULL check to where it will do some good.

v11 only fix.

Change-Id: I340512f86cfd3a6f7703971fa8acfffc7d47132b

10 years agortp_engine.c: Fix off nominal ref leak and some minor tweaks. 98/998/1
Richard Mudgett [Fri, 17 Jul 2015 20:54:37 +0000 (15:54 -0500)] 
rtp_engine.c: Fix off nominal ref leak and some minor tweaks.

v11 only fix.

Change-Id: I97885946ebc7eda19f1c18d08698117cf6a7f14f

10 years agortp_engine.c: Tweak glue->update_peer() parameter nil value. 97/997/1
Richard Mudgett [Thu, 16 Jul 2015 22:40:18 +0000 (17:40 -0500)] 
rtp_engine.c: Tweak glue->update_peer() parameter nil value.

Change glue->update_peer() parameter from 0 to NULL to better indicate it
is a pointer.

Change-Id: Iefbf9d4a708f2b64b7ad2b4e6c33bfaa12ccfa9d

10 years agochan_sip.c: Tweak glue->update_peer() parameter nil value. 96/996/1
Richard Mudgett [Fri, 17 Jul 2015 21:23:53 +0000 (16:23 -0500)] 
chan_sip.c: Tweak glue->update_peer() parameter nil value.

Change glue->update_peer() parameter from 0 to NULL to better indicate it
is a pointer.

Change-Id: I8ff2e5087f0e19f6998e3488a712a2470cc823bd

10 years agores_http_websocket: Properly encode 64 bit payload 92/992/1
Mark Michelson [Wed, 29 Jul 2015 19:35:58 +0000 (14:35 -0500)] 
res_http_websocket: Properly encode 64 bit payload

A test agent was continuously failing all ARI tests when run against
Asterisk 13. As it turns out, the reason for this is that on those test
runs, for some reason we decided to use the super extended 64 bit
payload length for websocket text frames instead of the extended 16 bit
payload length. For 64-bit payloads, the expected byte order over the
network is

7, 6, 5, 4, 3, 2, 1, 0

However, we were sending the payload as

3, 2, 1, 0, 7, 6, 5, 4

This meant that we were saying to expect an absolutely MASSIVE payload
to arrive. Since we did not follow through on this expected payload
size, the client would sit patiently waiting for the rest of the payload
to arrive until the test would time out.

With this change, we use the htobe64() function instead of htonl() so
that a 64-bit byte-swap is performed instead of a 32 bit byte-swap.

Change-Id: Ibcd8552392845fbcdd017a8c8c1043b7fe35964a

10 years agoLocal channels: Alternate solution to ringback problem. 55/955/2
Mark Michelson [Thu, 23 Jul 2015 18:11:42 +0000 (13:11 -0500)] 
Local channels: Alternate solution to ringback problem.

Commit 54b25c80c8387aea9eb20f9f4f077486cbdf3e5d solved an issue where a
specific scenario involving local channels and a native local RTP bridge
could result in ringback still being heard on a calling channel even
after the call is bridged.

That commit caused many tests in the testsuite to fail with alarming
consequences, such as not sending DialBegin and DialEnd events, and
giving incorrect hangup causes during calls.

This commit reverts the previous commit and implements and alternate
solution. This new solution involves only passing AST_CONTROL_RINGING
frames across local channels if the local channel is in AST_STATE_RING.
Otherwise, the frame does not traverse the local channels. By doing
this, we can ensure that a playtones generator does not get started on
the calling channel but rather is started on the local channel on which
the ringing frame was initially indicated.

ASTERISK-25250 #close
Reported by Etienne Lessard

Change-Id: I3bc87a18a38eb2b68064f732d098edceb5c19f39

10 years agoMerge "audiohook: Read the correct number of samples based on audiohook format."...
Mark Michelson [Wed, 22 Jul 2015 18:19:14 +0000 (13:19 -0500)] 
Merge "audiohook: Read the correct number of samples based on audiohook format." into 11

10 years agoLocal channels: Do not block control -1 payloads. 49/949/1
Mark Michelson [Wed, 22 Jul 2015 14:46:29 +0000 (09:46 -0500)] 
Local channels: Do not block control -1 payloads.

Control frames with a -1 payload are used as a special signal to stop
playtones generators on channels. This indication is sent both by
app_dial as well as by ast_answer() when a call is answered in case any
tones were being generated on a calling channel.

This control frame type was made to stop traversing local channel pairs
as an optimization, because it was thought that it was unnecessary to
send these indications, and allowing such unnecessary control frames to
traverse the local channels would cause the local channels to optimize
away less quickly.

As it turns out, through some special magic dialplan code, it is
possible to have a tones being played on a non-local channel, and it is
important for the local channel to convey that the tones should be
stopped. The result of having tones continue to be played on the
non-local channel is that the tones play even once the channel has been
bridged. By not blocking the -1 control frame type, we can ensure that
this situation does not happen.

ASTERISK-25250 #close
Reported by Etienne Lessard

Change-Id: I40227e4249d6d61dc6a9b08bbe9ee3aa18be7e30

10 years agoaudiohook: Read the correct number of samples based on audiohook format. 44/944/1
Joshua Colp [Wed, 22 Jul 2015 10:16:40 +0000 (07:16 -0300)] 
audiohook: Read the correct number of samples based on audiohook format.

Due to changes in audiohooks to support different sample rates the
underlying storage of samples is in the format of the audiohook
itself and not of the format being requested. This means that if a
channel is using G722 the samples stored will be at 16kHz. If
something subsequently reads from the audiohook at a format which
is not the same sample rate as the audiohook the number of samples
needs to be adjusted.

Given the following example:
1. Channel writing into audiohook at 16kHz (as it is using G722).
2. Chanspy reading from audiohook at 8kHz.

The original code would read 160 samples from the audiohook for
each 20ms of audio. This is incorrect. Since the audio in the
audiohook is at 16kHz the actual number needing to be read is 320.
Failure to read this much would cause the audiohook to reset
itself constantly as the buffer became full.

This change adjusts the requested number of samples by determining
the duration of audio requested and then calculating how many
samples that would be in the audiohook format.

ASTERISK-25247 #close

Change-Id: Ia91ce516121882387a315fd8ee116b118b90653d

10 years agoDocumentation: chan_sip doesn't support WS or WSS in outbound register. 38/938/2
Rusty Newton [Mon, 20 Jul 2015 22:16:36 +0000 (17:16 -0500)] 
Documentation: chan_sip doesn't support WS or WSS in outbound register.

 * In sip.conf.sample fix sentence where we said that WS or WSS are supported
   transports for use in an outbound register definition. They are not
   supported in that case.

ASTERISK-24853 #close
Reported by: PSDK

Change-Id: I3d698bc6302b9d00a0a995b5c4ad9a42d69b48ca

10 years agores/res_musiconhold: Add a warning when MOH does not exist 33/933/1
Michael Cargile [Thu, 16 Jul 2015 14:13:10 +0000 (10:13 -0400)] 
res/res_musiconhold: Add a warning when MOH does not exist

Change-Id: Ifdfbd0b97cf31478d29923ec30aabce28d01740b

10 years agosig_pri.h: force_restart_unavailable_chans in wrong scope 23/923/2
Patric Marschall [Fri, 17 Jul 2015 09:59:19 +0000 (11:59 +0200)] 
sig_pri.h: force_restart_unavailable_chans in wrong scope

In channels/sig_pri.h, struct sig_pri_span, the field
force_restart_unavailable_chans is only defined if

#if defined(HAVE_PRI_MCID) is true.

All other occurences of force_restart_unavailable_chans are outside of the

#if defined(HAVE_PRI_MCID)
endif

scope.

ASTERISK-25257 #close
Reported by: Patric Marschall

Change-Id: I071de89cc2cd0d85927a013036e235851f672549

10 years agoapps/app_dictate: Fix typo in attribution 94/894/1
Matt Jordan [Wed, 15 Jul 2015 15:31:51 +0000 (10:31 -0500)] 
apps/app_dictate: Fix typo in attribution

Last time I checked, it's "Sangoma", not "Samgoma". Thanks to Brian
(GameGamer43) for pointing that out.

Change-Id: I43d7b196f6d7a2b2517b84915e3a8dfbc2894106

10 years agotests/test_devicestate: Add additional tests for the device state API 83/783/2
Matt Jordan [Sat, 27 Jun 2015 22:53:37 +0000 (17:53 -0500)] 
tests/test_devicestate: Add additional tests for the device state API

This patch adds more tests that exercise the device state API. This includes:

* Tests that cover adding a device state provider, as well as deleting a
  device state provider. This also verifies that you cannot add an
  already added device state provider, and cannot delete an already
  deleted device state provider.
* A test that covers changing device state and receiving said updates
  from a device state subscriber. This also covers hitting both the
  device state cache as well as a custom device state provider.
* A test that covers converting device state to channel state and device
  state values to a string representation and back.
* A test that covers obtaining device state from an active channel and a
  channel driver that provides its own device state.

Change-Id: I2adca67ffb405cd8625a5d6df1e3f9b3d945c08d

10 years agomain/devicestate: Prevent duplicate registration of device state providers 82/782/2
Matt Jordan [Sat, 27 Jun 2015 22:51:43 +0000 (17:51 -0500)] 
main/devicestate: Prevent duplicate registration of device state providers

Currently, the device state provider API will allow you to register a
device state provider with the same case insensitive name more than
once. This could cause strange issues, as the duplicate device state
providers will not be queried when a device's state has to be polled.
This patch updates the API such that a device state provider with the
same name as one that has already registered will be rejected.

Change-Id: I4a418a12280b7b6e4960bd44f302e27cd036ceb2

10 years agores_rtp_asterisk: Ensure DTLS timeout timer is -1 if DTLS is not used. 09/809/1
Joshua Colp [Wed, 8 Jul 2015 09:21:16 +0000 (06:21 -0300)] 
res_rtp_asterisk: Ensure DTLS timeout timer is -1 if DTLS is not used.

This change fixes a bug where the DTLS timeout timer would be
initialized to 0 if DTLS was not used for an RTP session.

ASTERISK-25103

Change-Id: If8d26bb054f1d300838850da5b8db9044c2fe2ac

10 years agores_rtp_asterisk: Prevent simultaneous access to DTLS SSL context. 86/786/3
Joshua Colp [Wed, 1 Jul 2015 12:55:47 +0000 (09:55 -0300)] 
res_rtp_asterisk: Prevent simultaneous access to DTLS SSL context.

This change moves logic for setting up the DTLS SSL contexts to
when the SDP is done being processed instead of when ICE negotiation
completes. It also stops handshakes from being initiated when we
are acting as a server.

Manipulating the SSL context when ICE negotiation has completed
is problematic as the SSL context is not protected and if acting
as a client the remote side may have started DTLS negotiation
already.

The retransmission timeout timer code has also been split up
and simplified some. Both RTP and RTCP now have their own timers
and the points at which the timer is stopped and started is now
more specific. When a packet is sent the timer is started. When
a response is received but before it is processed the timer is
stopped. This provides a guarantee that the timeout is not
occurring while the response is processed.

ASTERISK-22805 #close
ASTERISK-24550 #close
ASTERISK-24651 #close
ASTERISK-24832 #close
ASTERISK-25103 #close
ASTERISK-25127 #close

Change-Id: Ib75ea2546f29d6efc3d2d37c58df6986c7bd9b91

10 years agoMerge "chan_sip: Fix early call pickup caused deadlock." into 11
Joshua Colp [Sun, 5 Jul 2015 00:09:19 +0000 (19:09 -0500)] 
Merge "chan_sip: Fix early call pickup caused deadlock." into 11

10 years agoMerge "chan_vpb.cc: Fix compiler warning Jenkins found." into 11
Joshua Colp [Thu, 2 Jul 2015 14:47:44 +0000 (09:47 -0500)] 
Merge "chan_vpb.cc: Fix compiler warning Jenkins found." into 11

10 years agoMerge "res_timing: Don't close FD 0 when out of open files." into 11
Joshua Colp [Thu, 2 Jul 2015 12:53:28 +0000 (07:53 -0500)] 
Merge "res_timing: Don't close FD 0 when out of open files." into 11

10 years agoMerge "rtp_engine: Skip useless self-assignment in ast_rtp_engine_unload_format....
Joshua Colp [Thu, 2 Jul 2015 12:52:22 +0000 (07:52 -0500)] 
Merge "rtp_engine: Skip useless self-assignment in ast_rtp_engine_unload_format." into 11

10 years agoMerge "astfd: Fix buffer overflow in DEBUG_FD_LEAKS." into 11
Joshua Colp [Thu, 2 Jul 2015 12:51:36 +0000 (07:51 -0500)] 
Merge "astfd: Fix buffer overflow in DEBUG_FD_LEAKS." into 11

10 years agoMerge "chan_mgcp: Don't call close on fd -1." into 11
Joshua Colp [Thu, 2 Jul 2015 12:50:28 +0000 (07:50 -0500)] 
Merge "chan_mgcp: Don't call close on fd -1." into 11

10 years agochan_sip: Fix early call pickup caused deadlock. 71/771/2
Walter Doekes [Thu, 2 Jul 2015 11:25:36 +0000 (13:25 +0200)] 
chan_sip: Fix early call pickup caused deadlock.

If non-magic pickup (no "pickup-" in callid) is used, chan_sip locks the
channel it wants to pick up, and a bit further down, it locks the
channel list when allocating a new channel.

That causes a deadlock when another part of the code traverses over the
channel list, locking all the channels one by one.

This changeset fixes it by releasing the locks before calling sip_new
and reacquiring them afterwards.  Unfortunately this involves doing the
checks we already did again (because the channel may have changed).

While trying to avoid duplicate code, I did some refactoring for
readability:
- if refer_locked == 1, we guarantee there is a locked channel
- magic_callid holds a cached version of !ast_strlen_zero(pickup.exten)

This is for branch 11 only. It appears that the changed code in 13 does
not lock the components like it does in 11 and below. Reproducing the
deadlock on 13 has thusfar failed.

ASTERISK-25213 #close

Change-Id: Ie1d15bec7d634035f48892e1ed6227411d7de2c1

10 years agochan_mgcp: Don't call close on fd -1. 68/768/1
Walter Doekes [Thu, 2 Jul 2015 11:19:34 +0000 (13:19 +0200)] 
chan_mgcp: Don't call close on fd -1.

ASTERISK-25220 #close

Change-Id: Ic48f3a82f51ada87f2fb0e016c9efe0ad56f1ee3

10 years agortp_engine: Skip useless self-assignment in ast_rtp_engine_unload_format. 65/765/1
Walter Doekes [Thu, 2 Jul 2015 11:10:59 +0000 (13:10 +0200)] 
rtp_engine: Skip useless self-assignment in ast_rtp_engine_unload_format.

When running valgrind on Asterisk, it complained about:

    ==32423== Source and destination overlap in memcpy(0x85a920, 0x85a920, 304)
    ==32423==    at 0x4C2F71C: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/...)
    ==32423==    by 0x55BA91: ast_rtp_engine_unload_format (rtp_engine.c:2292)
    ==32423==    by 0x4EEFB7: ast_format_attr_unreg_interface (format.c:1437)

The code in question is a struct assignment, which may be performed by
memcpy as a compiler optimization. It is changed to only copy the struct
contents if source and destination are different.

ASTERISK-25219 #close

Change-Id: I6d3546c326b03378ca8e9b8cefd41c16e0088b9a

10 years agoastfd: Fix buffer overflow in DEBUG_FD_LEAKS. 62/762/1
Walter Doekes [Thu, 2 Jul 2015 10:16:26 +0000 (12:16 +0200)] 
astfd: Fix buffer overflow in DEBUG_FD_LEAKS.

If DEBUG_FD_LEAKS was used and more file descriptors than the default of
1024 were available, some DEBUG_FD_LEAKS-patched functions would
overwrite memory past the fixed-size (1024) fdleaks buffer.

This change:
- adds bounds checks to __ast_fdleak_fopen and __ast_fdleak_pipe
- consistently uses ARRAY_LEN() instead of sizeof() or 1023 or 1024
- stores pointers to constants instead of copying the contents
- reorders the fdleaks struct for possibly tighter packing
- adds a tiny bit of documentation

ASTERISK-25212 #close

Change-Id: Iacb69e7701c0f0a113786bd946cea5b6335a85e5

10 years agores_timing: Don't close FD 0 when out of open files. 59/759/1
Walter Doekes [Thu, 2 Jul 2015 09:57:44 +0000 (11:57 +0200)] 
res_timing: Don't close FD 0 when out of open files.

This fixes so a failure to get a timer file descriptor does not cascade
to closing FD 0.

On error, both res_timing_kqueue and res_timing_timerfd would call the
destructor before setting the file handle. The file handle had been
initialized to 0, causing FD 0 to be closed. This in turn, resulted in
floods of "CLI>" messages and an unusable terminal.

ASTERISK-19277 #close
Reported by: Barry Chern

Change-Id: I147d7e33726c6e5a2751928d56561494f5800350

10 years agochan_vpb.cc: Fix compiler warning Jenkins found. 58/758/1
Richard Mudgett [Wed, 1 Jul 2015 22:25:31 +0000 (17:25 -0500)] 
chan_vpb.cc: Fix compiler warning Jenkins found.

Change-Id: I0ec7fd10d56d90d5a60b12b5a7d6807f265ac5e0

10 years agoChannel alert pipe: improve diagnostic error return 55/755/1
Scott Griepentrog [Wed, 1 Jul 2015 18:34:46 +0000 (13:34 -0500)] 
Channel alert pipe: improve diagnostic error return

When a frame is queued on a channel, any failure in
ast_channel_alert_write is logged along with errno.

This change improves the diagnostic message through
aligning the errno value with actual failure cases.

ASTERISK-25224
Reported by: Andrey Biglari

Change-Id: I1bf7b3337ad392789a9f02c650589cd065d20b5b

10 years agoMakefile: Remove coverage files on 'make clean' 43/743/1
Matt Jordan [Sat, 27 Jun 2015 23:47:19 +0000 (18:47 -0500)] 
Makefile: Remove coverage files on 'make clean'

This patch updates a variety of Makefiles in Asterisk's build system to
remove .gcda and .gcno files when 'make clean' is executed. These files
are generated when '--enable-coverage' is passed to the Asterisk
configure script.

Change-Id: Ib70b41eea2ee2908885bff02e80faf9f40c84602

10 years agomain/pbx: Resolve case sensitivity regression in PBX hints 38/738/1
Matt Jordan [Sat, 27 Jun 2015 01:38:58 +0000 (20:38 -0500)] 
main/pbx: Resolve case sensitivity regression in PBX hints

When 8297136f was merged for ASTERISK-25040, a regression was introduced
surrounding the case sensitivity of device names within hints.
Previously, device names - such as 'sip/foo' - were compared in a case
insensitive fashion. Thus, 'sip/foo' was equivalent to 'SIP/foo'. After
that patch, only the case sensitive name would match, i.e., 'SIP/foo'.
As a result, some dialplan hints stopped working.

This patch re-introduces case insensitive matching for device names in
hints.

ASTERISK-25040

ASTERISK-25202 #close

Change-Id: If5046a7d14097e1e3c12b63092b9584bb1e9cb4c

10 years agoMerge "chan_sip: Prevent deadlock when performing BYE with Also transfer." into 11
Matt Jordan [Tue, 16 Jun 2015 14:59:31 +0000 (09:59 -0500)] 
Merge "chan_sip: Prevent deadlock when performing BYE with Also transfer." into 11

10 years agochan_sip.c: Update dialog fromtag after request with auth 32/632/6
Damian Ivereigh [Thu, 11 Jun 2015 13:18:48 +0000 (23:18 +1000)] 
chan_sip.c: Update dialog fromtag after request with auth

If a client sends and INVITE which is 401 rejected, then subsequently
sends a new INVITE with the auth info and uses a different fromtag
from the first INVITE, Asterisk will accept the new INVITE as part of
the original dialog - match_req_to_dialog() specifically ignores the
fromtag. However it does not update the stored dialog with the new
fromtag.

This results in Asterisk being unable to match future packets that are
part of this dialog (such as the ACK to the OK or the OK to the BYE),
and the call is dropped.

This problem was originally found when using an NEC-i SV8100-GE (NEC SIP
Card).

* After a successful match of a packet to the dialog, if the packet is
  not a SIP_RESPONSE, authentication is present and the fromtags are
  different, the stored fromtag is updated with the one from the recent
  INVITE.

ASTERISK-25154 #close
Reported by: Damian Ivereigh
Tested by: Damian Ivereigh

Change-Id: I5c16cf3b409e5ef9f2b2fe974b6bd2a45a6aa17e

10 years agochan_sip: Prevent deadlock when performing BYE with Also transfer. 44/644/2
Mark Michelson [Thu, 11 Jun 2015 21:44:19 +0000 (16:44 -0500)] 
chan_sip: Prevent deadlock when performing BYE with Also transfer.

When a BYE with an Also header is successfully processed, and the sender
of the BYE is bridged with another channel, chan_sip will unlock the
owner of the dialog on which the BYE was received, call ast_async_goto()
on the bridged channel, and then re-lock the owner. The reason for this
locking behavior is that ast_async_goto() can result in a masquerade,
which requires that the involved channels are unlocked.

The problem here is that this causes a locking inversion since the
dialog's lock is held when re-locking the owner channel after the async
goto. The lock order is supposed to be channel and then sip_pvt.

The fix proposed is simple. In addition to unlocking the owner channel
before the ast_async_goto() call, also unlock the sip_pvt. Then relock
both after ast_async_goto() returns, being sure to lock the channel and
then the sip_pvt.

ASTERISK-25139 #close
Reported by Gregory Massel

Change-Id: I72c4fc295ec8573bee599e8e9213c5350a3cd224

10 years agoMerge "weakref attribute detection broken with gcc 4.6 and higher" into 11
Joshua Colp [Wed, 10 Jun 2015 17:13:17 +0000 (12:13 -0500)] 
Merge "weakref attribute detection broken with gcc 4.6 and higher" into 11

10 years agoFix unsafe uses of ast_context pointers. 81/481/3
Corey Farrell [Sun, 17 May 2015 04:04:16 +0000 (00:04 -0400)] 
Fix unsafe uses of ast_context pointers.

Although ast_context_find, ast_context_find_or_create and
ast_context_destroy perform locking of the contexts table,
any context pointer can become invalid at any time that the
contexts table is unlocked. This change adds locking around
all complete operations involving these functions.

Places where ast_context_find was followed by ast_context_destroy
have been replaced with calls ast_context_destroy_by_name.

ASTERISK-25094 #close
Reported by: Corey Farrell

Change-Id: I1866b6787730c9c4f3f836b6133ffe9c820734fa

10 years agoCLI: Cosmetic issue - core show uptime 86/586/2
ibercom [Thu, 4 Jun 2015 12:14:13 +0000 (14:14 +0200)] 
CLI: Cosmetic issue - core show uptime

Show uptime information ends with an unnecessary space.

Now NEEDCOMMA is better defined.

Change-Id: I11b360504a0703309ff51772ff8f672287f3c5a1

10 years agoweakref attribute detection broken with gcc 4.6 and higher 74/574/4
ibercom [Wed, 3 Jun 2015 00:06:46 +0000 (02:06 +0200)] 
weakref attribute detection broken with gcc 4.6 and higher

GCC 4.7 Manual:
http://gcc.gnu.org/onlinedocs/gcc-4.7.4/gcc/Function-Attributes.html

weakref ("target")

A weak reference is an alias that does not by itself require a definition
to be given for the target symbol.

ASTERISK-22559 #close
Reported by: Ibercom

Change-Id: I36a136cae947b65187a697533416f9ff9a0b8cdf

10 years agoFix buffer overflow in slin sample frames generation. 56/556/1
Ivan Poddubny [Sun, 31 May 2015 16:33:37 +0000 (19:33 +0300)] 
Fix buffer overflow in slin sample frames generation.

The length of frames retured by sample functions was twice as large as
real, what caused global buffer overflow caught by AddressSanitizer.

ASTERISK-24717 #close
Reported by: Badalian Vyacheslav

Change-Id: Iec2fe682aef13e556684912f906bedf7c18229c6

10 years agoAstobj2: Correctly treat hash_fn returning INT_MIN 32/532/3
Ivan Poddubny [Sun, 24 May 2015 18:47:16 +0000 (21:47 +0300)] 
Astobj2: Correctly treat hash_fn returning INT_MIN

The code in astobj2_hash.c wrongly assumed that abs(int) is always > 0.
However, abs(INT_MIN) = INT_MIN and is still negative, as well as
abs(INT_MIN) % num_buckets, and as a result this led to a crash.

One way to trigger the bug is using host=::80 or 0.0.0.128 in peer
configuration section in chan_sip or chan_iax.

This patch takes the remainder before applying abs, so that bucket
number is always in range.

ASTERISK-25100 #close
Reported by: Mark Petersen

Change-Id: Id6981400ad526f47e10bcf7b847b62bd2785e899

10 years agoMerge "audiohook.c: Difference in read/write rates caused continuous buffer resets...
Matt Jordan [Thu, 21 May 2015 12:22:07 +0000 (07:22 -0500)] 
Merge "audiohook.c: Difference in read/write rates caused continuous buffer resets" into 11

10 years agoMerge "Logger: Reset defaults before processing config." into 11
Matt Jordan [Thu, 21 May 2015 12:21:50 +0000 (07:21 -0500)] 
Merge "Logger: Reset defaults before processing config." into 11

10 years agoLogger: Reset defaults before processing config. 02/502/1
Corey Farrell [Thu, 21 May 2015 01:53:46 +0000 (21:53 -0400)] 
Logger: Reset defaults before processing config.

Reset options to default values before reloading config.  This ensures
that if a setting is removed or commented out of the configuration file
it is unset on reload.

ASTERISK-25112 #close
Reported by: Corey Farrell

Change-Id: Id24bb1fb0885c2c14cf8bd6f69a0c2ee7cd6c5bd

10 years agochan_sip/sdp_crypto.c: allow SDP crypto tag to be up to 9 digits 97/497/2
Corey Edwards [Wed, 20 May 2015 19:45:37 +0000 (13:45 -0600)] 
chan_sip/sdp_crypto.c: allow SDP crypto tag to be up to 9 digits

ASTERISK-24887 #close
Reported by: Makoto Dei
Tested by: tensai

Change-Id: I6a96f572adb17f76b3acafe503a01c48eb5dd9bf

10 years agoaudiohook.c: Difference in read/write rates caused continuous buffer resets 62/462/6
Kevin Harwell [Thu, 14 May 2015 20:13:58 +0000 (15:13 -0500)] 
audiohook.c: Difference in read/write rates caused continuous buffer resets

Currently, everytime a sample rate change occurs (on read or write) the
associated factory buffers are reset. If the requested sample rate on a
read differed from that of a write then the buffers are continually reset
on every read and write. This has the side effect of emptying the buffer,
thus there being no data to read and then write to a file in the case of
call recording.

This patch fixes it so that an audiohook_list's rate always maintains the
maximum sample rate among hooks and formats. Audiohook sample rates are
only overwritten by this value when slin native compatibility is turned on.
Also, the audiohook sample rate can only overwrite the list's sample rate
when its rate is greater than that of the list or if compatibility is
turned off. This keeps the rate from constantly switching/resetting.

ASTERISK-24944 #close
Reported by: Ronald Raikes

Change-Id: Idab4dfef068a7922c09cc631dda27bc920a6c76f

10 years agoMessage.c: Clear message channel frames on cleanup 70/470/1
Jonathan Rose [Wed, 13 May 2015 20:41:07 +0000 (15:41 -0500)] 
Message.c: Clear message channel frames on cleanup

The message channel is a special channel that doesn't actually process frames.
However, certain actions can cause frames to be placed in the channel's read
queue including the Hangup application which is called on the channel after
each message is processed. Since the channel will continually be reused for
many messages, it's necessary to flush these frames at some point.

ASTERISK-25083 #close
Reported by: Jonathan Rose

Change-Id: Idf18df73ccd8c220be38743335b5c79c2a4c0d0f

10 years agoMerge "main/manager.c: Bugfix sort action_manager by alphabetically" into 11
Joshua Colp [Thu, 14 May 2015 10:03:16 +0000 (05:03 -0500)] 
Merge "main/manager.c: Bugfix sort action_manager by alphabetically" into 11

10 years agoMerge "General: Fix recent menuselect-related cross compile regression" into 11
Joshua Colp [Wed, 13 May 2015 19:21:51 +0000 (14:21 -0500)] 
Merge "General: Fix recent menuselect-related cross compile regression" into 11

10 years agoMerge "chan_dahdi/sig_pri: Fix crash on ISDN call hangup collision." into 11
Joshua Colp [Wed, 13 May 2015 17:55:08 +0000 (12:55 -0500)] 
Merge "chan_dahdi/sig_pri: Fix crash on ISDN call hangup collision." into 11

10 years agoMerge "res_config_mysql: Fix broken column type checking" into 11
Joshua Colp [Wed, 13 May 2015 17:26:19 +0000 (12:26 -0500)] 
Merge "res_config_mysql: Fix broken column type checking" into 11

10 years agomain/manager.c: Bugfix sort action_manager by alphabetically 58/458/1
Rodrigo Ramírez Norambuena [Tue, 5 May 2015 01:11:56 +0000 (21:11 -0400)] 
main/manager.c: Bugfix sort action_manager by alphabetically

Fix the alphabetic order added on ast_manager_register_struct. The order
for struct manager_action added is not working, this change fixes the
problem.

Change-Id: I149da0cd06c3c4445d7516cc303358e9f26f8b4b

10 years agores_config_mysql: Fix broken column type checking 55/455/1
Alexandre Fournier [Fri, 8 May 2015 23:01:26 +0000 (01:01 +0200)] 
res_config_mysql: Fix broken column type checking

MySQL configuration engine contains a bug in require_mysql(). This
function is used for column type checking in tables. This bug only
affects DATETIME, DATE and FLOAT types.

It came from mixing the first condition (switch-case-like
if/then/else), to check the expected column type, with the second
condition, to check the actual column type against the expected column
type. Both conditions must be checked separately in order to avoid the
execution of the wrong block.

ASTERISK-18252 #comment This patch might fix the issue
Reported by: Gareth Blades

ASTERISK-25041 #close
Reported by: Alexandre Fournier
Tested by: Alexandre Fournier

Change-Id: I0b8bf7e68ab938be8e6525a249260cb648cb0bfa

10 years agores_rtp_asterisk: Correction for the limit which detects that a packet is DTLS. 52/452/1
Yousf Ateya [Sun, 10 May 2015 12:37:54 +0000 (14:37 +0200)] 
res_rtp_asterisk: Correction for the limit which detects that a packet is DTLS.

First byte of DTLS packet shall be in range 20-63, not 20-64. Refer to RFC
https://tools.ietf.org/html/rfc5764#section-5.1.2 for correct values.

Change-Id: Iae6fa0d72b37c36a27fe40686e0ae6fba3afec31

10 years agoMerge "cdr_pgsql: Use PQescapeStringConn for escaping names." into 11
Joshua Colp [Wed, 13 May 2015 09:36:34 +0000 (04:36 -0500)] 
Merge "cdr_pgsql: Use PQescapeStringConn for escaping names." into 11

10 years agochan_dahdi/sig_pri: Fix crash on ISDN call hangup collision. 45/445/1
Richard Mudgett [Tue, 12 May 2015 22:34:45 +0000 (17:34 -0500)] 
chan_dahdi/sig_pri: Fix crash on ISDN call hangup collision.

If an ISDN call is hungup by both sides at the same time a crash could
happen.

* Added missing NULL checks for the owner channel after calling
pri_queue_pvt_cause_data() in two places.  Code after those calls need to
check the owner channel pointer for NULL before use because
pri_queue_pvt_cause_data() needs to do deadlock avoidance to lock the
owner and the owner may get hung up.

ASTERISK-21893 #close
Reported by:  Alexandr Gordeev

Change-Id: Ica3e266ebc7a894b41d762326f08653e1904bb9a

10 years agoGeneral: Fix recent menuselect-related cross compile regression 44/444/1
Sebastian Kemper [Sun, 10 May 2015 07:26:30 +0000 (09:26 +0200)] 
General: Fix recent menuselect-related cross compile regression

MAKE_MENUSELECT currently sets CC to CC, which is the compiler for the
target platform. But menuselect is to be run on the build system, so
BUILD_CC needs to be used instead - like it was in the past, before the
recent changes (https://reviewboard.asterisk.org/r/4370/). This is the
patch for ASTERISK-25074.

ASTERISK-25074 #close
Reported by: Sebastian Kemper
Tested by: Sebastian Kemper

Change-Id: I8a2b1fc5deb6ad2b80f49baca35b1b13d468ebf8

10 years agoMerge "Fix processing of asterisk.conf debug=yes." into 11
Joshua Colp [Tue, 12 May 2015 16:57:01 +0000 (11:57 -0500)] 
Merge "Fix processing of asterisk.conf debug=yes." into 11