]> git.ipfire.org Git - thirdparty/asterisk.git/log
thirdparty/asterisk.git
10 years agofuncs/func_holdintercept: Actually add the HOLD_INTERCEPT function 53/1453/2
Matt Jordan [Tue, 20 Oct 2015 17:06:52 +0000 (12:06 -0500)] 
funcs/func_holdintercept: Actually add the HOLD_INTERCEPT function

When ab803ec342 was committed, it accidentally forgot to actually *add* the
HOLD_INTERCEPT function. This highlights two interesting points:
* Gerrit forces you to put the patch as it is going to into the repo up for
  review, which Review Board did not. Yay Gerrit.
* No one apparently bothered to use this feature, or else they don't know about
  it. I'm going to go with the latter explanation.

ASTERISK-24922

Change-Id: Ida38278f259dd07c334a36f9b7d5475b5db72396

10 years agoMerge "contrib/scripts/autosupport: Update for Asterisk 13" into 13
Joshua Colp [Tue, 20 Oct 2015 16:21:40 +0000 (11:21 -0500)] 
Merge "contrib/scripts/autosupport: Update for Asterisk 13" into 13

10 years agocontrib/scripts/autosupport: Update for Asterisk 13 49/1449/2
Matt Jordan [Tue, 20 Oct 2015 00:59:50 +0000 (19:59 -0500)] 
contrib/scripts/autosupport: Update for Asterisk 13

This patch adds some minor tweaks for autosupport to update it for Asterisk 13.
This includes:
* Finally removing most references to Zaptel
* Adding support for some additional 'core' commands, and fixing nomenclature
  that generally hasn't been used for some time
* Adding some PJSIP/SIP commands to gather endpoints/peers and active channels

Change-Id: Ic997b418cbd9313588b6608e50f47b0ce6f4f1f1

10 years agoMerge topic 'ASTERISK-25461' into 13
Matt Jordan [Fri, 16 Oct 2015 15:35:59 +0000 (10:35 -0500)] 
Merge topic 'ASTERISK-25461' into 13

* changes:
  config.c: Fix off-nominal memory leak.
  config.c: Fix potential memory corruption after [section](+).
  config.c: Fix #include after [section](+).

10 years agoMerge "res_config_pgsql.c: Fix deadlock loading realtime configuration." into 13
Joshua Colp [Thu, 15 Oct 2015 19:41:30 +0000 (14:41 -0500)] 
Merge "res_config_pgsql.c: Fix deadlock loading realtime configuration." into 13

10 years agoMerge "Build: Add menuselect options for using compiler sanitizers" into 13
Joshua Colp [Thu, 15 Oct 2015 19:40:51 +0000 (14:40 -0500)] 
Merge "Build: Add menuselect options for using compiler sanitizers" into 13

10 years agores_config_pgsql.c: Fix deadlock loading realtime configuration. 40/1440/1
Richard Mudgett [Wed, 14 Oct 2015 19:15:53 +0000 (14:15 -0500)] 
res_config_pgsql.c: Fix deadlock loading realtime configuration.

On v13, loading several thousand PJSIP endpoints on Asterisk start causes
a deadlock most of the time.

Thanks to mdu113 for discovering that there was a call to pgsql_exec() not
protected by the pgsql_lock reentrancy lock.

{quote}
I believe a code path exists that attempts to use pgsql connection without
locking pgsql_lock.  I believe what happens during that deadlock that I
see is two concurrent threads are both attempting to send query to pgsql,
one of the thread is using a code path without locking pgsql_lock.  If
they managed to send queries at the same time, it seems postgres ignores
one of the queries and replies only to the one of them.  If it happens so
that the thread holding the lock didn't receive the reply it will wait for
it (and hold the lock) forever (or at least for very long time), thus
completely blocking all access to db.
{quote}

* Added missing reentrancy locking around pgsql_exec() in find_table().

* Moved unlock of pgsql_lock in unload_module() to avoid locking inversion
between the psql_tables list lock and the pgsql_lock.

ASTERISK-25455 #close
Reported by:  mdu113
Patches:
      res_config_pgsql.c-connlock2.diff (license #5543) patch uploaded by mdu113

Change-Id: Id9e7cdf8a3b65ff19964b0cf942ace567938c4e2

10 years agochannels/chan_sip: Set cause code to 44 on RTP timeout 33/1433/1
Matt Jordan [Tue, 13 Oct 2015 19:13:54 +0000 (14:13 -0500)] 
channels/chan_sip: Set cause code to 44 on RTP timeout

To quote Olle:

"When issuing a hangup due to RTP timeouts the cause code is not set. I have
selected 44 based on Cisco's implementation..."

ASTERISK-25135 #close
Reported by: Olle Johansson
patches:
  rtp-timeout-cause-1.8.diff uploaded by Olle Johansson (License 5267)

Change-Id: Ia62100c55077d77901caee0bcae299f8dc7375fc

10 years agoBuild: Add menuselect options for using compiler sanitizers 18/1418/1
Ivan Poddubny [Sat, 10 Oct 2015 20:20:55 +0000 (23:20 +0300)] 
Build: Add menuselect options for using compiler sanitizers

This patch adds menuselect options for building Asterisk with
various sanitizers provided by gcc and clang.

When one of *SANITIZER flags is set in menuselect, the appropriate
option is added to CFLAGS ad LDFLAGS for the build.

Information on sanitizers in the project wiki:
https://github.com/google/sanitizers/wiki

GCC Manual:
https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html

Clang Compiler User's Manual:
http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation

ASTERISK-24718 #close
Reported by: Badalian Vyacheslav

Change-Id: Iafa51b792b7bcb20e848b99d16cf362d08590fa0

10 years agoconfig.c: Fix off-nominal memory leak. 24/1424/1
Richard Mudgett [Mon, 12 Oct 2015 16:21:39 +0000 (11:21 -0500)] 
config.c: Fix off-nominal memory leak.

Change-Id: I06e346e9a5c63cc5071e7eda537310c4b43bffe0

10 years agoconfig.c: Fix potential memory corruption after [section](+). 23/1423/1
Richard Mudgett [Mon, 12 Oct 2015 16:20:29 +0000 (11:20 -0500)] 
config.c: Fix potential memory corruption after [section](+).

The memory corruption could happen if the [section](+) is the last section
in the file with trailing comments.  In this case process_text_line() has
left *last_cat is set to newcat and newcat is destroyed.

Change-Id: I0d1d999f553986f591becd000e7cc6ddfb978d93

10 years agoconfig.c: Fix #include after [section](+). 22/1422/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

10 years agoMerge "chan_pjsip: Fix crash on reINVITE before initial INVITE completes." into 13
Joshua Colp [Thu, 8 Oct 2015 18:48:14 +0000 (13:48 -0500)] 
Merge "chan_pjsip: Fix crash on reINVITE before initial INVITE completes." into 13

10 years agores_pjsip: Fix deadlock when sending out-of-dialog requests. 12/1412/1
Richard Mudgett [Tue, 6 Oct 2015 23:01:37 +0000 (18:01 -0500)] 
res_pjsip: Fix deadlock when sending out-of-dialog requests.

The struct send_request_wrapper has a pjsip lock associated with it that
is created non-recursive.  There is a code path for the struct
send_request_wrapper lock that will attempt to lock it recursively.  The
reporter's deadlock showed that the thread calling endpt_send_request()
deadlocked itself right after the wrapper object got created.

Out-of-dialog requests such as MESSAGE, qualify OPTIONS, and unsolicited
MWI NOTIFY messages can hit this deadlock.

* Replaced the struct send_request_wrapper pjsip lock with the mutex lock
that can come with an ao2 object since all of Asterisk's mutexes are
recursive.  Benefits include removal of code maintaining the pjsip
non-recursive lock since ao2 objects already know how to maintain their
own lock and the lock will show up in the CLI "core show locks" output.

ASTERISK-25435 #close
Reported by: Dmitriy Serov

Change-Id: I458e131dd1b9816f9e963f796c54136e9e84322d

10 years agores/res_rtp_asterisk.c: Fix incorrect assignment of frame->subclass.frame_ending 11/1411/1
StefanEng86 [Tue, 6 Oct 2015 16:05:00 +0000 (18:05 +0200)] 
res/res_rtp_asterisk.c: Fix incorrect assignment of frame->subclass.frame_ending

In ast_rtp_read, the value of the variable 'mark' which we try to assign to a
frame->subclass.frame_ending may be 0, 1 or (1<<23), but we should translate
it to 0 or 1.

ASTERISK-25451 #close
Change-Id: I53bdf5c026041730184a6a809009c028549ce626

10 years agofunc_presencestate: Return "not_set" when no data is set in AstDB 09/1409/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

10 years agores/res_rtp_asterisk: Fix assignment after ao2 decrement 03/1403/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

10 years agochan_sip: Fix port parsing for IPv6 addresses in SIP Via headers. 99/1399/1
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

10 years agochan_pjsip: Fix crash on reINVITE before initial INVITE completes. 94/1394/1
Richard Mudgett [Mon, 5 Oct 2015 21:53:44 +0000 (16:53 -0500)] 
chan_pjsip: Fix crash on reINVITE before initial INVITE completes.

Apparently some endpoints attempt to send a reINVITE before completing the
initial INVITE transaction.  In this case PJSIP responds appropriately to
the reINVITE with a 491 INVITE request pending.  Unfortunately chan_pjsip
is using the initial INVITE transaction state to determine if an INVITE is
the initial INVITE or a reINVITE.  Since the initial INVITE transaction
has not been confirmed yet chan_pjsip thinks the reINVITE is an initial
INVITE and starts another PBX thread on the channel.  The extra PBX thread
ensures that hilarity ensues.

* Fix checks for a reINVITE on incoming requests to look for the presence
of a to-tag instead of the initial INVITE transaction state.

* Made caller_id_incoming_request() determine what to do if there is a
channel on the session or not.  After a channel is created it is too late
to just store the new party id on the session because the session's party
id has already been copied to the channel's caller id.

ASTERISK-25404 #close
Reported by: Chet Stevens

Change-Id: Ie78201c304a2b13226f3a4ce59908beecc2c68be

10 years agoMerge "Fix improper usage of scheduler exposed by 5c713fdf18f" into 13
Matt Jordan [Tue, 6 Oct 2015 13:30:02 +0000 (08:30 -0500)] 
Merge "Fix improper usage of scheduler exposed by 5c713fdf18f" into 13

10 years agoFix improper usage of scheduler exposed by 5c713fdf18f 79/1379/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

10 years agochan_pjsip: Add Referred-By header to the PJSIP REFER packet. 77/1377/2
Debian Amtelco [Wed, 26 Aug 2015 21:58:04 +0000 (21:58 +0000)] 
chan_pjsip: Add Referred-By header to the PJSIP REFER packet.

Some systems require the REFER packet to include a Referred-By header.
If the channel variable SIPREFERREDBYHDR is set, it passes that value as the
Referred-By header value.  Otherwise, it adds the current dialog’s local info.

Reported by: Dan Cropp
Tested by: Dan Cropp

Change-Id: I3d17912ce548667edf53cb549e88a25475eda245

10 years agomanager: Fix GetConfigJSON returning invalid JSON 71/1371/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 [].

Also, the keys "istemplate" and "tempates" that are used to
indicate templates and their inherited categories are now wrapped in
quotes.

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

Change-Id: Ibbe93c6a227dff14d4a54b0d152341857bcf6ad8

10 years agoMerge "res_sorcery_memory_cache.c: Fix deadlock with scheduler." into 13
Joshua Colp [Fri, 2 Oct 2015 21:28:39 +0000 (16:28 -0500)] 
Merge "res_sorcery_memory_cache.c: Fix deadlock with scheduler." into 13

10 years agoMerge "res_sorcery_memory_cache.c: Replace inline code with function." into 13
Joshua Colp [Fri, 2 Oct 2015 21:28:34 +0000 (16:28 -0500)] 
Merge "res_sorcery_memory_cache.c: Replace inline code with function." into 13

10 years agoMerge "res_sorcery_memory_cache.c: Shutdown in a less crash potential order." into 13
Joshua Colp [Fri, 2 Oct 2015 21:28:28 +0000 (16:28 -0500)] 
Merge "res_sorcery_memory_cache.c: Shutdown in a less crash potential order." into 13

10 years agoMerge "res_sorcery_memory_cache.c: Misc tweaks." into 13
Joshua Colp [Fri, 2 Oct 2015 21:28:22 +0000 (16:28 -0500)] 
Merge "res_sorcery_memory_cache.c: Misc tweaks." into 13

10 years agoMerge "res_sorcery_memory_cache.c: Made use OBJ_SEARCH_MASK." into 13
Joshua Colp [Fri, 2 Oct 2015 21:28:15 +0000 (16:28 -0500)] 
Merge "res_sorcery_memory_cache.c: Made use OBJ_SEARCH_MASK." into 13

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

10 years agores_sorcery_memory_cache.c: Fix deadlock with scheduler. 55/1355/1
Richard Mudgett [Wed, 30 Sep 2015 22:28:19 +0000 (17:28 -0500)] 
res_sorcery_memory_cache.c: Fix deadlock with scheduler.

A deadlock can happen when a sorcery object is being expired from the
memory cache when at the same time another object is being placed into the
memory cache.  There are a couple other variations on this theme that
could cause the deadlock.  Basically if an object is being expired from
the sorcery memory cache at the same time as another thread tries to
update the next object expiration timer the deadlock can happen.

* Add a deadlock avoidance loop in expire_objects_from_cache() to check if
someone is trying to remove the scheduler callback from the scheduler.

ASTERISK-25441 #close

Change-Id: Iec7b0bdb81a72b39477727b1535b2539ad0cf4dc

10 years agores_sorcery_memory_cache.c: Replace inline code with function. 54/1354/1
Richard Mudgett [Thu, 1 Oct 2015 19:30:06 +0000 (14:30 -0500)] 
res_sorcery_memory_cache.c: Replace inline code with function.

Make sorcery_memory_cache_close() call remove_all_from_cache() instead of
partially inlining it.

ASTERISK-25441

Change-Id: I1aa6cb425b1a4307096f3f914d17af8ec179a74c

10 years agores_sorcery_memory_cache.c: Shutdown in a less crash potential order. 53/1353/1
Richard Mudgett [Thu, 1 Oct 2015 19:27:34 +0000 (14:27 -0500)] 
res_sorcery_memory_cache.c: Shutdown in a less crash potential order.

Basically you should shutdown in the opposite order of how you setup since
later setup pieces likely depend on earlier setup pieces.  e.g.,
Registering your external API with the rest of the system should be the
last thing setup and the first thing unregistered during shutdown.

Change-Id: I5715765b723100c8d3c2642e9e72cc7ad5ad115e

10 years agores_sorcery_memory_cache.c: Misc tweaks. 52/1352/1
Richard Mudgett [Wed, 30 Sep 2015 22:27:54 +0000 (17:27 -0500)] 
res_sorcery_memory_cache.c: Misc tweaks.

Change-Id: I8cd32dffbb4f33bb0c39518d6e4c991e73573160

10 years agores_sorcery_memory_cache.c: Made use OBJ_SEARCH_MASK. 51/1351/1
Richard Mudgett [Wed, 30 Sep 2015 22:27:23 +0000 (17:27 -0500)] 
res_sorcery_memory_cache.c: Made use OBJ_SEARCH_MASK.

Change-Id: Ibca6574dc3c213b29cc93486e01ccd51f5caa46c

10 years agores_rtp_asterisk: Move "Set role" warning to be debug. 47/1347/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

10 years agosched.c: Add warning about negative time interval request. 44/1344/2
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

10 years agoMerge "res/ari/config.c: Fix user sort compare function." into 13
Matt Jordan [Tue, 29 Sep 2015 20:58:12 +0000 (15:58 -0500)] 
Merge "res/ari/config.c: Fix user sort compare function." into 13

10 years agoMerge "res/ari/config.c: Optimize conf_alloc() object init." into 13
Matt Jordan [Tue, 29 Sep 2015 20:58:06 +0000 (15:58 -0500)] 
Merge "res/ari/config.c: Optimize conf_alloc() object init." into 13

10 years agoARI: Changed version from 1.8.0 to 1.9.0 43/1343/1
Kevin Harwell [Tue, 29 Sep 2015 19:53:58 +0000 (14:53 -0500)] 
ARI: Changed version from 1.8.0 to 1.9.0

Change-Id: I510991c60d28d171f47c4b58bba4947f7fc71b13

10 years agores/ari/config.c: Fix user sort compare function. 39/1339/1
Richard Mudgett [Fri, 25 Sep 2015 23:37:04 +0000 (18:37 -0500)] 
res/ari/config.c: Fix user sort compare function.

Made use the ao2 sort compare template function and OBJ_SEARCH_xxx
identifiers.

Change-Id: Ic53005dc5aafa7a36c72300dd89b75fb63c92f4c

10 years agores/ari/config.c: Optimize conf_alloc() object init. 38/1338/1
Richard Mudgett [Fri, 25 Sep 2015 22:26:08 +0000 (17:26 -0500)] 
res/ari/config.c: Optimize conf_alloc() object init.

* Now conf_alloc() has more off nominal error checking.

* Eliminated RAII_VAR() use in conf_alloc().

* Eliminated a dubius shortcut when destroying cfg->general in
conf_destructor() that would cause a crash if cfg->general failed to get
allocated.

* Add some ACO registration section comments.

Change-Id: Ia40c2b1b2d0777d641605118ae019c5a73865e1a

10 years agores/ari/config.c: Fix conf_alloc() object init. 37/1337/1
Richard Mudgett [Fri, 25 Sep 2015 21:48:10 +0000 (16:48 -0500)] 
res/ari/config.c: Fix conf_alloc() object init.

Need to finish initializing the string fields in the ao2 object before
putting any default strings into them.

ASTERISK-25383 #close
Reported by:  yaron nahum

Change-Id: I9f7f3a03f0c4991a01593abf8697b9a587c0ea84

10 years agoMerge "app_queue.c: Force COLP update if outgoing channel name changed." into 13
Matt Jordan [Tue, 29 Sep 2015 12:27:45 +0000 (07:27 -0500)] 
Merge "app_queue.c: Force COLP update if outgoing channel name changed." into 13

10 years agoMerge "app_queue.c: Factor out a connected line update routine." into 13
Matt Jordan [Tue, 29 Sep 2015 12:27:22 +0000 (07:27 -0500)] 
Merge "app_queue.c: Factor out a connected line update routine." into 13

10 years agoMerge "app_dial.c: Make 'A' option pass COLP updates." into 13
Matt Jordan [Tue, 29 Sep 2015 12:26:58 +0000 (07:26 -0500)] 
Merge "app_dial.c: Make 'A' option pass COLP updates." into 13

10 years agoMerge "app_dial.c: Force COLP update if outgoing channel name changed." into 13
Matt Jordan [Tue, 29 Sep 2015 12:26:08 +0000 (07:26 -0500)] 
Merge "app_dial.c: Force COLP update if outgoing channel name changed." into 13

10 years agoMerge "translate: Fix transcoding while different in frame size." into 13
Joshua Colp [Mon, 28 Sep 2015 19:12:57 +0000 (14:12 -0500)] 
Merge "translate: Fix transcoding while different in frame size." into 13

10 years agoMerge "app_dial.c: Factor out a connected line update routine." into 13
Joshua Colp [Mon, 28 Sep 2015 19:06:55 +0000 (14:06 -0500)] 
Merge "app_dial.c: Factor out a connected line update routine." into 13

10 years agoMerge "res/res_stasis: Fix accidental subscription to 'all' bridge topic" into 13
Matt Jordan [Mon, 28 Sep 2015 13:36:04 +0000 (08:36 -0500)] 
Merge "res/res_stasis: Fix accidental subscription to 'all' bridge topic" into 13

10 years agoMerge "app_dial.c: Remove some no-op code." into 13
Joshua Colp [Mon, 28 Sep 2015 11:49:41 +0000 (06:49 -0500)] 
Merge "app_dial.c: Remove some no-op code." into 13

10 years agores/res_stasis: Fix accidental subscription to 'all' bridge topic 32/1332/1
Matt Jordan [Mon, 28 Sep 2015 01:45:50 +0000 (20:45 -0500)] 
res/res_stasis: Fix accidental subscription to 'all' bridge topic

When b99a7052621700a1aa641a1c24308f5873275fc8 was merged, subscribing to a
NULL bridge will now cause app_subscribe_bridge to implicitly subscribe to
all bridges. Unfortunately, the res_stasis control loop did not check that
a bridge changing on a channel's control object was actually also non-NULL.
As a result, app_subscribe_bridge will be called with a NULL bridge when a
channel leaves a bridge. This causes a new subscription to be made to the
bridge. If an application has also subscribed to the bridge, the application
will now have two subscriptions:
(1) The explicit one created by the app
(2) The implicit one accidentally created by the control structure

As a result, the 'BridgeDestroyed' event can be sent multiple times. This
patch corrects the control loop such that it only subscribes an application
to a new bridge if the bridge pointer is non-NULL.

ASTERISK-24870

Change-Id: I3510e55f6bc36517c10597ead857b964463c9f4f

10 years agoScripts: check file versions of Asterisk and dependencies 97/1197/7
Scott Griepentrog [Fri, 4 Sep 2015 18:51:46 +0000 (13:51 -0500)] 
Scripts: check file versions of Asterisk and dependencies

To help in diagnosing mismatched modules and libraries, this
script scans for version, repository, and source information
and reports what is found.

ASTERISK-25376 #close
Reported by: Ashley Sanders

Change-Id: Ib0642d0fb96712476f59760d6d137a24633fe2d6

10 years agoapp_queue.c: Force COLP update if outgoing channel name changed. 19/1319/1
Richard Mudgett [Thu, 24 Sep 2015 19:56:24 +0000 (14:56 -0500)] 
app_queue.c: Force COLP update if outgoing channel name changed.

* When a call is answered and the outgoing channel name has changed then
force a connected line update because the channel is no longer the same.
The channel was masqueraded into by another channel.  This is usually
because of a call pickup.

Note: Forwarded calls are handled in a controlled manner so the original
channel name is replaced with the forwarded channel.

ASTERISK-25423 #close
Reported by: John Hardin

Change-Id: Ie275ea9e99c092ad369db23e0feb08c44498c172

10 years agoapp_queue.c: Factor out a connected line update routine. 18/1318/1
Richard Mudgett [Thu, 24 Sep 2015 19:20:24 +0000 (14:20 -0500)] 
app_queue.c: Factor out a connected line update routine.

Replace inlined code with update_connected_line_from_peer().

ASTERISK-25423
Reported by: John Hardin

Change-Id: I33bbd033596fcb0208d41d8970369b4e87b806f3

10 years agoapp_dial.c: Make 'A' option pass COLP updates. 17/1317/1
Richard Mudgett [Thu, 24 Sep 2015 18:27:44 +0000 (13:27 -0500)] 
app_dial.c: Make 'A' option pass COLP updates.

While the 'A' option is playing the announcement file allow the caller and
peer to exchange COLP update frames.

ASTERISK-25423
Reported by: John Hardin

Change-Id: Iac6cf89b56d26452c6bb88e9363622bbf23895f9

10 years agoapp_dial.c: Force COLP update if outgoing channel name changed. 16/1316/1
Richard Mudgett [Thu, 24 Sep 2015 17:59:08 +0000 (12:59 -0500)] 
app_dial.c: Force COLP update if outgoing channel name changed.

* When a call is answered and the outgoing channel name has changed then
force a connected line update because the channel is no longer the same.
The channel was masqueraded into by another channel.  This is usually
because of a call pickup.

Note: Forwarded calls are handled in a controlled manner so the original
channel name is replaced with the forwarded channel.

ASTERISK-25423
Reported by: John Hardin

Change-Id: I2e01f7a698fbbc8c26344a59c2be40c6cd98b00c

10 years agoapp_dial.c: Factor out a connected line update routine. 15/1315/1
Richard Mudgett [Thu, 24 Sep 2015 17:37:07 +0000 (12:37 -0500)] 
app_dial.c: Factor out a connected line update routine.

Replace inlined code with update_connected_line_from_peer().

ASTERISK-25423
Reported by: John Hardin

Change-Id: Ia14f18def417645cd7fb453e1bdac682630a5091

10 years agoapp_dial.c: Remove some no-op code. 11/1311/1
Richard Mudgett [Wed, 23 Sep 2015 22:41:35 +0000 (17:41 -0500)] 
app_dial.c: Remove some no-op code.

Change-Id: Ice1884a94315d3cb7e3bbd47a9fba76a27276c54

10 years agoMerge "logger: Prevent duplicate dynamic channels from being added." into 13
Joshua Colp [Fri, 25 Sep 2015 15:57:33 +0000 (10:57 -0500)] 
Merge "logger: Prevent duplicate dynamic channels from being added." into 13

10 years agologger: Prevent duplicate dynamic channels from being added. 03/1303/2
Mark Michelson [Wed, 23 Sep 2015 19:02:15 +0000 (14:02 -0500)] 
logger: Prevent duplicate dynamic channels from being added.

There was a problem observed where the "logger add channel" CLI command
would allow for a channel with the same name to be added multiple times.
This would result in each message being written out to the same file
multiple times.

The problem was due to the difference in how logger channel filenames
are stored versus the format they are allowed to be presented when they
are added. For instance, if adding the logger channel "foo" through the
CLI, the result would be a logger channel with the file name
/var/log/asterisk/foo being stored. So when trying to add another "foo"
channel, "foo" would not match "/var/log/asterisk/foo" so we'd happily
add the duplicate channel.

The fix presented here is to introduce two new methods in the logger
code:
 * make_filename(): given a logger channel name, this creates the
   filename for that logger channel.
 * find_logchannel(): given a logger channel name, this calls
   make_filename() and then traverses the list of logchannels in order
   to find a match.

This change has made use of make_filename() and find_logchannel()
throughout to more consistently behave.

ASTERISK-25305 #close
Reported by Mark Michelson

Change-Id: I892d52954d6007d8bc453c3cbdd9235dec9c4a36

10 years agoDo not swallow frames on channels leaving bridges. 05/1305/1
Mark Michelson [Thu, 24 Sep 2015 19:49:46 +0000 (14:49 -0500)] 
Do not swallow frames on channels leaving bridges.

When leaving a bridge, indications on a channel could be swallowed by
the internal indication logic because it appears that the channel is on
its way to be hung up anyway. One such situation where this is
detrimental is when channels on hold are redirected out of a bridge. The
AST_CONTROL_UNHOLD indication from the bridging code is swallowed,
leaving the channel in question to still appear to be on hold.

The fix here is to modify the logic inside ast_indicate_data() to not
drop the indication if the channel is simply leaving a bridge. This way,
channels on hold redirected out of a bridge revert to their expected "in
use" state after the redirection.

ASTERISK-25418 #close
Reported by Mark Michelson

Change-Id: If6115204dfa0551c050974ee138fabd15f978949

10 years agoMerge "ARI: Add events for Contact and Peer Status changes" into 13
Matt Jordan [Wed, 23 Sep 2015 17:56:07 +0000 (12:56 -0500)] 
Merge "ARI: Add events for Contact and Peer Status changes" into 13

10 years agoapp_page.c: Fix crash when forwarding with a predial handler. 99/1299/1
Richard Mudgett [Tue, 22 Sep 2015 22:08:49 +0000 (17:08 -0500)] 
app_page.c: Fix crash when forwarding with a predial handler.

Page uses the async method of dialing with the dial API.  When a call gets
forwarded there is no calling channel available.  If the predial handler
was set then the calling channel could not be put into auto-service
for the forwarded call because it doesn't exist.  A crash is the result.

* Moved the callee predial parameter string processing to before the
string is passed to the dial API rather than having the dial API do it.
There are a few benefits do doing this.  The first is the predial
parameter string processing doesn't need to be done for each channel
called by the dial API.  The second is in async mode and the forwarded
channel is to have the predial handler executed on it then the
non-existent calling channel does not need to be present to process the
predial parameter string.

* Don't start auto-service on a non-existent calling channel to execute
the predial handler when the dial API is in async mode and forwarding a
call.

ASTERISK-25384 #close
Reported by: Chet Stevens

Change-Id: If53892b286d29f6cf955e2545b03dcffa2610981

10 years agoARI: Add events for Contact and Peer Status changes 95/1195/5
Matt Jordan [Fri, 4 Sep 2015 02:19:21 +0000 (21:19 -0500)] 
ARI: Add events for Contact and Peer Status changes

This patch adds support for receiving events regarding Peer status changes
and Contact status changes. This is particularly useful in scenarios where
we are subscribed to all endpoints and channels, where we often want to know
more about the state of channel technology specific items than a single
endpoint's state.

ASTERISK-24870

Change-Id: I6137459cdc25ce27efc134ad58abf065653da4e9

10 years agores/res_stasis_device_state: Allow for subscribing to 'all' device state 94/1194/4
Matt Jordan [Fri, 4 Sep 2015 17:24:57 +0000 (12:24 -0500)] 
res/res_stasis_device_state: Allow for subscribing to 'all' device state

This patch adds support for subscribing to all device state changes. This is
done either by subscribing to an empty device, e.g., 'eventSource=deviceState:',
or by the WebSocket connection specifying that it wants all state in the
system.

ASTERISK-24870

Change-Id: I9cfeca1c9e2231bd7ea73e45919111d44d2eda32

10 years agoARI: Add the ability to subscribe to all events 93/1193/4
Matt Jordan [Fri, 4 Sep 2015 17:25:07 +0000 (12:25 -0500)] 
ARI: Add the ability to subscribe to all events

This patch adds the ability to subscribe to all events. There are two possible
ways to accomplish this:
(1) On initial WebSocket connection. This patch adds a new query parameter,
    'subscribeAll'. If present and True, Asterisk will subscribe the
    applications to all ARI events.
(2) Via the applications resource. When subscribing in this manner, an ARI
    client should merely specify a blank resource name, i.e., 'channels:'
    instead of 'channels:12354'. This will subscribe the application to all
    resources of the 'channels' type.

ASTERISK-24870 #close

Change-Id: I4a943b4db24442cf28bc64b24bfd541249790ad6

10 years agocore/logging: Fix logging to more than one syslog channel 94/1294/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

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

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

10 years agoapp_record: RECORDED_FILE variable not being populated 89/1289/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

10 years agoMerge "main/config_options: Check for existance of internal object before derefing...
Matt Jordan [Mon, 21 Sep 2015 13:08:28 +0000 (08:08 -0500)] 
Merge "main/config_options: Check for existance of internal object before derefing" into 13

10 years agoMerge "app_queue: AgentComplete event has wrong reason" into 13
Matt Jordan [Sat, 19 Sep 2015 21:26:27 +0000 (16:26 -0500)] 
Merge "app_queue: AgentComplete event has wrong reason" into 13

10 years agoMerge "app_queue: Crash when transferring" into 13
Matt Jordan [Sat, 19 Sep 2015 14:15:33 +0000 (09:15 -0500)] 
Merge "app_queue: Crash when transferring" into 13

10 years agoMerge "CHAOS: res_pjsip_diversion avoid crash if allocation fails" into 13
Matt Jordan [Sat, 19 Sep 2015 14:15:17 +0000 (09:15 -0500)] 
Merge "CHAOS: res_pjsip_diversion avoid crash if allocation fails" into 13

10 years agoMerge "chan_sip: Fix From header truncation for extremely long CALLERID(name)." into 13
Joshua Colp [Sat, 19 Sep 2015 13:31:46 +0000 (08:31 -0500)] 
Merge "chan_sip: Fix From header truncation for extremely long CALLERID(name)." into 13

10 years agoMerge "CHAOS: avoid crash if string create fails" into 13
Joshua Colp [Sat, 19 Sep 2015 13:22:51 +0000 (08:22 -0500)] 
Merge "CHAOS: avoid crash if string create fails" into 13

10 years agopbx: Update device and presence state when changing a hint extension. 63/1263/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

10 years agoCHAOS: avoid crash if string create fails 79/1279/4
Scott Griepentrog [Thu, 17 Sep 2015 21:34:41 +0000 (16:34 -0500)] 
CHAOS: avoid crash if string create fails

Validate string buffer allocation before using them.

ASTERISK-25323

Change-Id: Ib9c338bdc1e53fb8b81366f0b39482b83ef56ce0

10 years agochan_sip: Fix From header truncation for extremely long CALLERID(name). 70/1270/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

10 years agoCHAOS: res_pjsip_diversion avoid crash if allocation fails 82/1282/1
Richard Mudgett [Thu, 17 Sep 2015 21:59:18 +0000 (16:59 -0500)] 
CHAOS: res_pjsip_diversion avoid crash if allocation fails

Validate ast_malloc buffer returned before using it in
set_redirecting_value().

ASTERISK-25323

Change-Id: I15d2ed7cb0546818264c0bf251aa40adeae83253

10 years agoapp_queue: AgentComplete event has wrong reason 80/1280/1
Kevin Harwell [Thu, 17 Sep 2015 21:47:33 +0000 (16:47 -0500)] 
app_queue: AgentComplete event has wrong reason

When a queued caller transfers an agent to another extension sometimes the
raised AgentComplete event has a reason of "caller" and sometimes "transfer".
Since a transfer has taken place this should always be transfer. This occurs
because sometimes the stasis hangup event arrives before the transfer event
thus writing a different reason out.

With this patch, when a hangup event is received during a transfer it will
check to see if the channel that is hanging up is part of a transfer. If so
it will return and let the subsequently received transfer event handler take
care of the cleanup.

ASTERISK-25399 #close

Change-Id: Ic63c49bd9a5ed463ea7a032fd2ea3d63bc81a50d

10 years agoPJSIP: avoid crash when getting rtp peer 76/1276/1
Scott Griepentrog [Thu, 17 Sep 2015 18:09:56 +0000 (13:09 -0500)] 
PJSIP: avoid crash when getting rtp peer

Although unlikely, if the tech private is returned as
a NULL, chan_pjsip_get_rtp_peer() would crash.

ASTERISK-25323

Change-Id: Ie231369bfa7da926fb2b9fdaac228261a3152e6a

10 years agoMerge "res_pjsip_pubsub: Eliminate race during initial NOTIFY." into 13
Joshua Colp [Thu, 17 Sep 2015 17:16:00 +0000 (12:16 -0500)] 
Merge "res_pjsip_pubsub: Eliminate race during initial NOTIFY." into 13

10 years agoapp_queue: Crash when transferring 72/1272/1
Kevin Harwell [Thu, 17 Sep 2015 16:31:15 +0000 (11:31 -0500)] 
app_queue: Crash when transferring

During some transfer scenarios involving queues Asterisk would sometimes
crash when trying to obtain a channel snapshot (could happen on caller or
member channels). This occurred because the underlying channel had already
disappeared when trying to obtain the latest snapshot.

This patch adds a reference to both the member and caller channels that
extends to the lifetime of the queue'd call, thus making sure the channels
will always exist when retrieving the latest snapshots.

ASTERISK-25185 #close
Reported by: Etienne Lessard

Change-Id: Ic397fa68fb4ff35fbc378e745da9246a7b552128

10 years agores_pjsip_pubsub: Eliminate race during initial NOTIFY. 66/1266/2
Mark Michelson [Wed, 16 Sep 2015 22:36:32 +0000 (17:36 -0500)] 
res_pjsip_pubsub: Eliminate race during initial NOTIFY.

There is a slim chance of a race condition occurring where two threads
can both attempt to manipulate the same area.

Thread A can be handling an incoming initial SUBSCRIBE request. Thread A
lets the specific subscription handler know that the subscription has
been established.

At this point, Thread B may detect a state change on the subscribed
resource and queue up a notification task on Thread C, the subscription
serializer thread.

Now Thread A attempts to generate the initial NOTIFY request to send to
the subscriber at the same time that Thread C attempts to generate a
state change NOTIFY request to send to the subscriber.

The result is that Threads A and C can step on the same memory area,
resulting in a crash. The crash has been observed as happening when
attempting to allocate more space to hold the body for the NOTIFY.

The solution presented here is to queue the subscription establishment
and initial NOTIFY generation onto the subscription serializer thread
(Thread C in the above scenario). This way, there is no way that a state
change notification can occur before the initial NOTIFY is sent, and if
there is a quick succession of NOTIFYs, we can guarantee that the two
NOTIFY requests will be sent in succession.

Change-Id: I5a89a77b5f2717928c54d6efb9955e5f6f5cf815

10 years agotranslate: Fix transcoding while different in frame size. 55/1155/7
Alexander Traud [Fri, 28 Aug 2015 20:42:23 +0000 (22:42 +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: I2e229569d73191d66a4e43fef35432db24000212

10 years agoscheduler: Use queue for allocating sched IDs. 54/1254/5
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

10 years agoMerge "res/res_pjsip_nat: Ignore REGISTER requests when looking for a Record-Route...
Matt Jordan [Fri, 11 Sep 2015 21:13:49 +0000 (16:13 -0500)] 
Merge "res/res_pjsip_nat: Ignore REGISTER requests when looking for a Record-Route" into 13

10 years agochan_sip.c: Validation on module reload 55/1255/1
Rodrigo Ramírez Norambuena [Sat, 22 Aug 2015 02:50:31 +0000 (22:50 -0400)] 
chan_sip.c: Validation on module reload

Change validation on reload module because now used the cli function for
reload. The sip_reload() function never fail and ever return NULL for this
reason on reload() now use the call the sip_reload() and return
AST_MODULE_LOAD_SUCCESS.

This problem is dectected on reload by PUT method on ARI, getting always
404 http code when the module is reloaded.

ASTERISK-25325 #close
Reporte by: Rodrigo Ramírez Norambuena

Change-Id: I41215877fb2cfc589e0d4d464000cf6825f4d7fb

10 years agores_pjsip_pubsub.c: Mark ast_sip_create_subscription() as not used. 45/1245/1
Richard Mudgett [Fri, 21 Aug 2015 22:39:01 +0000 (17:39 -0500)] 
res_pjsip_pubsub.c: Mark ast_sip_create_subscription() as not used.

Change-Id: I2b8db18eac36c01a5c7eb9467699124e203fd093

10 years agores_pjsip_pubsub.c: Add some notification comments. 44/1244/1
Richard Mudgett [Wed, 9 Sep 2015 17:24:31 +0000 (12:24 -0500)] 
res_pjsip_pubsub.c: Add some notification comments.

Change-Id: Ie62ff1f4b7adc1a12fa0303f53926af249b25e20

10 years agores_pjsip_pubsub.c: Set dlg_status code instead of sending SIP response. 43/1243/1
Richard Mudgett [Fri, 21 Aug 2015 23:01:59 +0000 (18:01 -0500)] 
res_pjsip_pubsub.c: Set dlg_status code instead of sending SIP response.

We should not try to send a SIP response message because we may be
restoring a persistent subscription where we are not responding to a SIP
request.

Change-Id: Id89167ef90320c5563f37e632db0dda6cb9e7dec

10 years agores_pjsip_pubsub.c: Fix off-nominal memory leak. 42/1242/1
Richard Mudgett [Fri, 21 Aug 2015 22:40:39 +0000 (17:40 -0500)] 
res_pjsip_pubsub.c: Fix off-nominal memory leak.

Fix off-nominal visited vector leak in build_resource_tree().

Change-Id: If0399c7941c9c0b1038bcfb7b9a371760977831c

10 years agores_pjsip_pubsub.c: Fix one byte buffer overrun error. 41/1241/1
Richard Mudgett [Fri, 21 Aug 2015 20:26:30 +0000 (15:26 -0500)] 
res_pjsip_pubsub.c: Fix one byte buffer overrun error.

ast_sip_pubsub_register_body_generator() did not account for the null
terminator set by sprintf() in the allocated output buffer.

Change-Id: I388688a132e479bca6ad1c19275eae0070969ae2

10 years agores_pjsip_pubsub.c: Use ast_alloca() instead of alloca(). 40/1240/1
Richard Mudgett [Fri, 21 Aug 2015 20:25:11 +0000 (15:25 -0500)] 
res_pjsip_pubsub.c: Use ast_alloca() instead of alloca().

Change-Id: Ia396096b4fedc2874649ca11137612c3f55e83e3

10 years agores_pjsip_pubsub.c: Add missing error return in load_module(). 39/1239/1
Richard Mudgett [Fri, 21 Aug 2015 16:04:08 +0000 (11:04 -0500)] 
res_pjsip_pubsub.c: Add missing error return in load_module().

Change-Id: I15debd0f717f16ee2f78e7f56151c3b3b97b72fc

10 years agores_pjsip/location.c: Use the builtin ao2_callback() match function instead. 38/1238/1
Richard Mudgett [Fri, 21 Aug 2015 16:03:02 +0000 (11:03 -0500)] 
res_pjsip/location.c: Use the builtin ao2_callback() match function instead.

Change-Id: I364906d6d2bad3472929986704a0286b9a2cbe3f

10 years agores_pjsip: Copy default_from_user to avoid crash. 35/1235/1
Mark Michelson [Thu, 10 Sep 2015 14:49:45 +0000 (09:49 -0500)] 
res_pjsip: Copy default_from_user to avoid crash.

The default_from_user retrieval function was pulling the
default_from_user from the global configuration struct in an unsafe way.
If using a database as a backend configuration store, the global
configuration struct is short-lived, so grabbing a pointer from it
results in referencing freed memory.

The fix here is to copy the default_from_user value out of the global
configuration struct.

Thanks go to John Hardin for discovering this problem and proposing the
patch on which this fix is based.

ASTERISK-25390 #close
Reported by Mark Michelson

Change-Id: I6b96067a495c1259da768f4012d44e03e7c6148c

10 years agores/res_pjsip_nat: Ignore REGISTER requests when looking for a Record-Route 33/1233/1
Matt Jordan [Thu, 10 Sep 2015 13:39:21 +0000 (08:39 -0500)] 
res/res_pjsip_nat: Ignore REGISTER requests when looking for a Record-Route

We will only rewrite the Contact header if there is no Record-Route header in
the received request. If a malfunctioning proxy places a Record-Route header
into a REGISTER request, we will decide that we shouldn't update the IP/port
in the Contact header, and we will end up storing a contact with an AoR that
contains the NAT'd IP address.

While it is nice to have the proxy *not* send a Record-Route in a REGISTER
request, it's also a good idea to not process the header in a non-dialog
message. This patch updates the code to explicitly ignore the Record-Route
header in REGISTER requests.

ASTERISK-25387 #close

Change-Id: I4bd3bcccc4003d460cc354d986b0dea2e433ef3f

10 years agoMerge "ParkAndAnnounce: Add variable inheritance" into 13
Joshua Colp [Thu, 10 Sep 2015 12:25:22 +0000 (07:25 -0500)] 
Merge "ParkAndAnnounce: Add variable inheritance" into 13