2018-06-11 21:09 +0000 Asterisk Development Team * asterisk certified/13.21-cert2 Released. 2018-04-30 17:38 +0000 [3cccb60321] Richard Mudgett * AST-2018-008: Fix enumeration of endpoints from ACL rejected addresses. When endpoint specific ACL rules block a SIP request they respond with a 403 forbidden. However, if an endpoint is not identified then a 401 unauthorized response is sent. This vulnerability just discloses which requests hit a defined endpoint. The ACL rules cannot be bypassed to gain access to the disclosed endpoints. * Made endpoint specific ACL rules now respond with a 401 unauthorized which is the same as if an endpoint were not identified. The fix is accomplished by replacing the found endpoint with the artificial endpoint which always fails authentication. ASTERISK-27818 Change-Id: Icb275a54ff8e2df6c671a6d9bda37b5d732b3b32 2018-06-05 12:47 +0000 Asterisk Development Team * asterisk certified/13.21-cert1 Released. 2018-06-04 09:50 +0000 [f5bc8aeb9a] George Joseph * app_sendtext: Allow content types other than text/plain There was no real reason to limit the conteny type to text/plain other than that's what it was limited to before. Now any text/* content type will be allowed for channel drivers that don't support enhanced messaging and any type will be allowed for channel drivers that do support enhanced messaging. Change-Id: I94a90cfee98b4bc8e22aa5c0b6afb7b862f979d9 2018-04-10 16:09 +0000 [8f5fc3870d] George Joseph * app_sendtext: Enhance SendText to support Enhanced Messaging SendText now accepts new channel variables that can be used to override the To and From display names and set the Content-Type of a message. Since you can now set Content-Type, other text/* content types are now valid. Change-Id: I648b4574478119f95de09d9f08e9595831b02830 2017-09-27 11:44 +0000 [c1deeb28c2] George Joseph * bridge_softmix: Forward TEXT frames Core bridging and, more specifically, bridge_softmix have been enhanced to relay received frames of type TEXT or TEXT_DATA to all participants in a softmix bridge. res_pjsip_messaging and chan_pjsip have been enhanced to take advantage of this so when res_pjsip_messaging receives an in-dialog MESSAGE message from a user in a conference call, it's relayed to all other participants in the call. res_pjsip_messaging already queues TEXT frames to the channel when it receives an in-dialog MESSAGE from an endpoint and chan_pjsip will send an MESSAGE when it gets a TEXT frame. On a normal point-to-point call, the frames are forwarded between the two correctly. bridge_softmix was not though so messages weren't getting forwarded to conference bridge participants. Even if they were, the bridging code had no way to tell the participants who sent the message so it would look like it came from the bridge itself. * The TEXT frame type doesn't allow storage of any meta data, such as sender, on the frame so a new TEXT_DATA frame type was added that uses the new ast_msg_data structure as its payload. A channel driver can queue a frame of that type when it receives a message from outside. A channel driver can use it for sending messages by implementing the new send_text_data channel tech callback and setting the new AST_CHAN_TP_SEND_TEXT_DATA flag in its tech properties. If set, the bridging/channel core will use it instead of the original send_text callback and it will get the ast_msg_data structure. Channel drivers aren't required to implement this. Even if a TEXT_DATA enabled driver uses it for incoming messages, an outgoing channel driver that doesn't will still have it's send_text callback called with only the message text just as before. * res_pjsip_messaging now creates a TEXT_DATA frame for incoming in-dialog messages and sets the "from" to the display name in the "From" header, or if that's empty, the caller id name from the channel. This allows the chat client user to set a friendly name for the chat. * bridge_softmix now forwards TEXT and TEXT_DATA frames to all participants (except the sender). * A new function "ast_sendtext_data" was added to channel which takes an ast_msg_data structure and calls a channel's send_text_data callback, or if that's not defined, the original send_text callback. * bridge_channel now calls ast_sendtext_data for TEXT_DATA frame types and ast_sendtext for TEXT frame types. * chan_pjsip now uses the "from" name in the ast_msg_data structure (if it exists) to set the "From" header display name on outgoing text messages. Change-Id: Idacf5900bfd5f22ab8cd235aa56dfad090d18489 (cherry picked from commit be7d4faed5fb3684e9d68454ae2a97167e1ebb51) 2017-09-27 11:44 +0000 [72fb285d9b] George Joseph * bridge_softmix: Forward TEXT frames Core bridging and, more specifically, bridge_softmix have been enhanced to relay received frames of type TEXT or TEXT_DATA to all participants in a softmix bridge. res_pjsip_messaging and chan_pjsip have been enhanced to take advantage of this so when res_pjsip_messaging receives an in-dialog MESSAGE message from a user in a conference call, it's relayed to all other participants in the call. res_pjsip_messaging already queues TEXT frames to the channel when it receives an in-dialog MESSAGE from an endpoint and chan_pjsip will send an MESSAGE when it gets a TEXT frame. On a normal point-to-point call, the frames are forwarded between the two correctly. bridge_softmix was not though so messages weren't getting forwarded to conference bridge participants. Even if they were, the bridging code had no way to tell the participants who sent the message so it would look like it came from the bridge itself. * The TEXT frame type doesn't allow storage of any meta data, such as sender, on the frame so a new TEXT_DATA frame type was added that uses the new ast_msg_data structure as its payload. A channel driver can queue a frame of that type when it receives a message from outside. A channel driver can use it for sending messages by implementing the new send_text_data channel tech callback and setting the new AST_CHAN_TP_SEND_TEXT_DATA flag in its tech properties. If set, the bridging/channel core will use it instead of the original send_text callback and it will get the ast_msg_data structure. Channel drivers aren't required to implement this. Even if a TEXT_DATA enabled driver uses it for incoming messages, an outgoing channel driver that doesn't will still have it's send_text callback called with only the message text just as before. * res_pjsip_messaging now creates a TEXT_DATA frame for incoming in-dialog messages and sets the "from" to the display name in the "From" header, or if that's empty, the caller id name from the channel. This allows the chat client user to set a friendly name for the chat. * bridge_softmix now forwards TEXT and TEXT_DATA frames to all participants (except the sender). * A new function "ast_sendtext_data" was added to channel which takes an ast_msg_data structure and calls a channel's send_text_data callback, or if that's not defined, the original send_text callback. * bridge_channel now calls ast_sendtext_data for TEXT_DATA frame types and ast_sendtext for TEXT frame types. * chan_pjsip now uses the "from" name in the ast_msg_data structure (if it exists) to set the "From" header display name on outgoing text messages. Change-Id: Idacf5900bfd5f22ab8cd235aa56dfad090d18489 (cherry picked from commit be7d4faed5fb3684e9d68454ae2a97167e1ebb51) 2018-05-17 01:58 +0000 [5de8b00f2c] Alexander Traud * res_pjsip_endpoint_identifier_ip: Unregister the module for headers. Asterisk uses Reference Counting to track whether a module can be unloaded. Every consumer who requires a module, increases the reference count. When the consumer goes, is unloaded itself, it has to decrease the reference count on all its used/required modules. That way core stop gracefully works on the command-line interface (CLI): One module after the other is unloaded. A recent change broke this for the module res_pjsip. ASTERISK-27861 Change-Id: I261abcb411d026bbb0691cc78f28300bfd3103a3 2018-05-17 00:34 +0000 [5aaf6d1605] Alexander Traud * res_pjsip: Register pjsip_transport_management not externally but internally. The module (res_)pjsip_transport_management got moved into res_pjsip. It is no longer an independent/external module with (un)load_module and therefore has to register just internally with res_pjsip. ASTERISK-27860 Change-Id: Icd0413be7d2e98b92f51e6d6c353f2570bb4be95 2017-10-30 15:24 +0000 [13a85290fe] Kevin Harwell * Initialize 13.21-cert branch A new branch was created for what will be Asterisk certified 13.21. A couple of things needed to be done to the branch in order to complete initialization: Modified the version file to reflect the certified version. Updated all extended modules to be disabled by default. Change-Id: Ie1dd3cb146391dea92c9e3ef906dde8d7241fee2 2018-04-19 13:29 +0000 [32f362c896] Chris Savinovich * Update for 13.21.0-rc1 2018-04-17 07:09 +0000 [92f88f164a] Alexander Traud * utils/pval: Add -lBlocksRuntime for compiler clang conditionally. ASTERISK-27809 Change-Id: I930b364a33d54cc08dedfcd5bb45f7e83242f134 2018-04-13 15:17 +0000 [39c51394c8] George Joseph * utils: Add ast_assert_return Similar to pjproject's PJ_ASSERT_RETURN macro, this one will do the following... If the assert passes... NoOp If the assert fails and AST_DEVMODE is defined, execute ast_assert() then, if DO_CRASH isn't set, return from the calling function with the supplied value. If the assert fails and AST_DEVMODE is not defined, return from the calling function with the supplied value. The macro will execute a return without a value if one isn't suppled. Change-Id: I0003844affeab550d5ff5bca7aa7cf8a559b873e 2018-04-13 14:32 +0000 [f2e140e8a7] Ben Ford * res_musiconhold: Don't restart MOH from beginning after announcement. This reverts a problem introduced by the fix for ASTERISK_24329. Now, when an announcement is played while waiting in a queue, music on hold will not restart from the beginning of the sound file and will instead pick up where it left off. However, the incorrect behavior in ASTERISK_24329 is now present again; if an announcement X seconds long is played when music on hold starts, music on hold will start X seconds into the file. ASTERISK-27774 #close Reported by: lvl Change-Id: I86b2885ee7063268f9b9747eddb788336ade989b 2018-03-28 15:13 +0000 [b92ebdba5f] Richard Mudgett * pjsip_scheduler.c: Add ability to trace scheduled tasks. When a scheduled task is created you can pass in the AST_SIP_SCHED_TASK_TRACK flag. This new flag causes scheduling events to be logged. Change-Id: I91967eb3d5a220915ce86881a28af772f9a7f56b 2018-03-27 11:04 +0000 [12aa25b2e1] Richard Mudgett * res_pjsip.c: Split ast_sip_push_task_synchronous() to fit expectations. ast_sip_push_task_synchronous() did not necessarily execute the passed in task under the specified serializer. If the current thread is any registered pjsip thread then it would execute the task immediately instead of under the specified serializer. Reentrancy issues could result if the task does not execute with the right serializer. The original reason ast_sip_push_task_synchronous() checked to see if the current thread was a registered pjsip thread was because of a deadlock with masquerades and the channel technology's fixup callback (ASTERISK_22936). A subsequent masquerade deadlock fix (ASTERISK_24356) involving call pickups avoided the original deadlock situation entirely. The PJSIP channel technology's fixup callback no longer needed to call ast_sip_push_task_synchronous(). However, there are a few places where this unexpected behavior is still required to avoid deadlocks. The pjsip monitor thread executes callbacks that do calls to ast_sip_push_task_synchronous() that would deadlock if the task were actually pushed to the specified serializer. I ran into one dealing with the pubsub subscriptions where an ao2 destructor called ast_sip_push_task_synchronous(). * Split ast_sip_push_task_synchronous() into ast_sip_push_task_wait_servant() and ast_sip_push_task_wait_serializer(). ast_sip_push_task_wait_servant() has the old behavior of ast_sip_push_task_synchronous(). ast_sip_push_task_wait_serializer() has the new behavior where the task is always executed by the specified serializer or a picked serializer if one is not passed in. Both functions behave the same if the current thread is not a SIP servant. * Redirected ast_sip_push_task_synchronous() to ast_sip_push_task_wait_servant() to preserve API for released branches. ASTERISK_26806 Change-Id: Id040fa42c0e5972f4c8deef380921461d213b9f3 2018-03-21 19:43 +0000 [dfdc9a2575] Richard Mudgett * pjsip_scheduler.c: Fix some corner cases. * Fix the periodic interval wander because it may take significant time between the sched thread queueing the task in the serializer and the serializer actually executing the task. The time it takes to actually execute the task was already taken into account. * Pass a schtd ref to the serializer when we queue a scheduled task on the serializer. We don't want it going away on us while it is in the serializer queue. * Skip the scheduled task if the task was canceled between queueing the task to the serializer and the serializer actually executing the task. * Reorder struct ast_sip_sched_task to avoid unnecessary padding. Removed task_id and added next_periodic. * Hold a ref to the passed in serializer so the serializer cannot go away on the scheduled task. ASTERISK_26806 Change-Id: I6c8046b75f6953792c8c30e55b836a4291143f24 2018-03-22 19:09 +0000 [af36823907] Richard Mudgett * pjsip_scheduler.c: Sort "pjsip show scheduled_tasks" output. * A side benefit is that the scheduled tasks are not completely blocked while the CLI command executes. * Adjusted the "Task Name" column width to have more room for longer names. Change-Id: Iec64aa463ee8b10eef90120e00c38b1fb444087e 2018-04-02 15:59 +0000 [7886354343] Evandro Cesar Arruda * cdr_mysql: Compile error because MYSQL_PORT definition is missing If it is not defined, it will add MYSQL_PORT definition. After some research on MySQL/MariaDB development tree, I couldn't find any reference to MYSQL_PORT definition in include files. ASTERISK-27782 #close Change-Id: Ieee56c836fc2e8bd021c456145bba04c6068bb77 2018-04-09 20:00 +0000 [724d926d46] Chris-Savinovich * res_pjsip_session: Rewrite o= with external_media_address. It now appends the external IP address on the o= line of the SDP packet. The decision was made to write the numeric IP address as opposed to the RFC that states the FQDN should be used if and when available. We believe the usage of literal IP address will help avoid potential problems. ASTERISK-27614 #close Change-Id: I84f3360f3606b8c4e8d161edb228799ec0b8a302 2018-02-22 12:18 +0000 [6a4afe09ce] Nathan Bruning * res_pjsip_notify.c: enable in-dialog NOTIFY This patch adds support to send in-dialog SIP NOTIFY commands on chan_pjsip channels, similar to the functionality recently added for chan_sip (ASTERISK_27461). This extends res_pjsip_notify to allow for in-dialog messages. ASTERISK-27697 Change-Id: If7f3151a6d633e414d5dc319d5efc1443c43dd29 2018-03-22 13:35 +0000 [c4f02c975b] Richard Mudgett * pjsip_scheduler.c: Fix ao2 usage errors. * Removed several invalid uses of OBJ_NOLOCK. These uses resulted in the 'tasks' container being accessed without a lock in a multi-threaded environment. A recipe for crashes. * Removed needlessly obtaining schtd object references. If the caller providing you a pointer to an object doesn't have a valid reference then you cannot safely get one from it. * Getting a ref to 'tasks' when you aren't copying the pointer into another location is useless. The 'tasks' container pointer is global. * Removed many unnecessary uses of RAII_VAR. * Make ast_sip_schedule_task() name parameter const. ASTERISK_26806 Change-Id: I5c62488e651314e2a1dbc01f5b078a15512d73db 2018-03-23 06:49 +0000 [7593359787] Corey Farrell * Build System: Enable python3 compatibility. * Consistently use spaces in rest-api-templates/asterisk_processor.py. * Exclude third-party from docs/full-en_US.xml. * Add docs/full-en_US.xml to .gitignore. * Use list() to convert python3 view. * Use python3 print function. * Replace cmp() with equivalent equation. * Replace reference to out of scope subtype variable with name parameter. * Use unescaping triple bracket notation in mustache templates where needed. This causes behavior of Python2 to be maintained when using Python3. * Fix references to has_websocket / is_websocket in res_ari_resource.c.mustache. * Update calculation of has_websocket to use any(). * Use unicode mode for writing output file in transform.py. * Replace 'from swagger_model import *' with explicit import of required symbols. * Add missing 'import os' * Fix invalid reference to swagger_version from exception handler. I have not tested voicemailpwcheck.py, only the print syntax has been fixed. Change-Id: If5c5b556a2800d41a3e2cfef080ac2e151178c33 2018-04-05 18:33 +0000 [72b16ee400] Richard Mudgett * res_pjsip_refer/chan_sip: Fix INVITE with replaces transfer to ConfBridge There is a problem when an INVITE-with-Replaces transfer targets a channel in a ConfBridge. The transfer will unconditionally swap out the ConfBridge channel. Unfortunately, the ConfBridge state will not be aware of this change. Unexpected behavior will happen as a result since ConfBridge channels currently can only be replaced by a masquerade and not normal bridge channel moves. * We just need to pretend that the channel isn't in a bridge (like other transfer methods already do) so the transfer channel will masquerade into the ConfBridge channel. Change-Id: I209beb0e748fa4f4b92a576f36afa8f495ba4c82 2018-04-05 17:40 +0000 [ea055386e0] Richard Mudgett * chan_sip.c: Fix INVITE with replaces channel ref leak. Given the below call scenario: A -> Ast1 -> B C <- Ast2 <- B 1) A calls B through Ast1 2) B calls C through Ast2 3) B transfers A to C When party B transfers A to C, B sends a REFER to Ast1 causing Ast1 to send an INVITE with replaces to Ast2. Ast2 then leaks a channel ref of the channel between Ast1 and Ast2. Channel ref leaks are easily seen in the CLI "core show channels" output. The leaked channels appear in the output but you can do nothing with them and they never go away unless you restart Asterisk. * Properly account for the channel refs when imparting a channel into a bridge when handling an INVITE with replaces in handle_invite_replaces(). The ast_bridge_impart() function steals a channel ref but the code didn't account for how many refs were held by the code at the time and which ref was stolen. * Eliminated RAII_VAR in handle_invite_replaces(). ASTERISK-27740 Change-Id: I7edbed774314b55acf0067b2762bfe984ecaa9a4 2018-03-21 19:40 +0000 [e94f8e4a24] Richard Mudgett * res_pjsip: Update authenticate_qualify documentation. Change-Id: I3811de0014b1ffe96d4a3b49cddd5d4ca02ee5d4 2018-04-02 16:49 +0000 [906db6a3ff] Richard Mudgett * app_agent_pool.c: Fix off nominal ref leak. Change-Id: Ib427ffc2c802620eaafb08b1c2a17dddd8fb8eb6 2018-04-04 10:02 +0000 [07e408e588] Corey Farrell * Build System: Strip '-std=c99' from CFLAGS provided by libraries. Asterisk requires GNU C extensions. On some systems certain libraries may incorrectly push -std=c99 into CFLAGS, thus breaking the build. This change causes that flag to be stripped so the Asterisk build is not broken by those libraries. This change is made for both pkgconfig and tool based libraries. ASTERISK-27629 #close Change-Id: I13389613b194abbac77becf90cd950dc168704db 2018-04-03 14:39 +0000 [01b3c435d8] Corey Farrell * Build System: Fixes for configure script. * Replace all 'else if' statements with 'elif'. * Use loop to detect versioned lua headers and libraries. The loop for detecting lua fixes a bug where LUA_INCLUDE would be appended with the directory of every lua version after the first one is found. Change-Id: I3276f9aee955014108345be6092f51c932b43a0f 2018-01-02 07:54 +0000 [cea1a22ef3] George Joseph * res_pjsip: Correct usages of pjproject's timer heap Fix some timer heap initializations and cancels to try and prevent crashes and timer heap issues. Change-Id: I64885d190fa22097d1b55987091375541e57a7ee 2018-03-25 13:35 +0000 [158c0efd4f] George Joseph * pjroject_bundled: Add already-destroyed check to tsx_timer_callback There have been cases that when the transaction timer callback is called the tsx is already destroyed. This causes a crash. We now check the tsx state and return if the tsx is already destroyed. Change-Id: If93acd5e48d9ca5bb553f2405d5afc836842fe1c 2018-03-25 13:25 +0000 [69c61237cd] George Joseph * pjproject_bundled: timer: Clean up usage of timer heap Added a new pj_timer_entry_reset function that resets a timer_entry for re-use. Changed direct settings of timer_entry fields to use pj_timer_entry_init and pj_timer_entry_reset. Fixed issues where timers were being rescheduled incorrectly. Change-Id: I5b624bfbc5c1429117484b9b24567293002148e6 2018-03-22 08:54 +0000 [83353997f4] Alexander Traud * BuildSystem: Add support for building RADIUS with radcli. Radcli is yet another RADIUS client library, generally compatible with freeradius and radiusclient-ng. This commit adds autoconf option for detecting it as well and changes cdr_radius and cel_radius to use its header file in that case. ASTERISK-26540 Reported by: Tzafrir Cohen Change-Id: Icc056d476b7acf481309219e9abdca416866c6ec 2018-03-29 17:07 +0000 [e1363283d7] Richard Mudgett * res_pjsip: Fix deadlock on reliable transport shutdown. A deadlock can happen when the PJSIP monitor thread is shutting down a connection oriented transport (TCP/TLS) used by a subscription at the same time as another thread tries to send something for that subscription. The deadlock is between the pjsip monitor thread attempting to get the dialog lock and another thread sending something for that dialog when it tries to get the transport manager lock. * res_pjsip_pubsub.c: Avoid the deadlock by pushing the subscription removal to the subscription serializer. * res_pjsip_registrar.c: Pushed off incoming registration contact removals to a default serializer as a precaution. Removing the contacts involves sorcery access which in this case will involve database access. Depending upon the setup, the database may not be on the same machine and could take awhile. We don't want to hold up the pjsip monitor thread with potentially long access times. ASTERISK-27706 Change-Id: I56b647aea565f24dba33e9e5ebeed4cd3f31f8c4 2018-03-25 13:12 +0000 [c63a2e28f1] George Joseph * pjproject_bundled: Add patch for pj_atomic crashes There have been some crashes in the past where something attempts to use a pj_atomic after it's already been destroyed. This patch tries to prevent it by making sure that pj_atomic_destroy sets its mutex to NULL when it's done. The pj_mutex functions already check for a NULL mutex and just return PJ_EINVAL. Teluu also added some checks to the win32 implementation as well. Change-Id: Id25f70b79fdedf44ead6e6e1763a4417d3b3f825 2018-03-28 08:18 +0000 [5908c6753b] Corey Farrell * core: Create main/options.c. This creates a separate source to 'own' symbols related to options.h and paths.h. This significantly reduces the number of exports created by main/asterisk.o. This change is required to eventually be able to link unmodified Asterisk sources to utilities and/or stand-alone tests. ASTERISK~26245 Change-Id: I5cf184f4757f9363b80c9e678bdc35c477122380 2018-03-23 13:15 +0000 [e8e4fc6202] Alexander Traud * install_prereq: Add Slackware (somehow). ASTERISK-27770 Change-Id: Ib87e0483c785542238cfe34c1e884d5a31edfaab 2018-03-23 09:18 +0000 [96a668e60b] Alexander Traud * install_prereq: Add Gentoo Linux. ASTERISK-27769 Change-Id: Ieb13293cd67481f3a33f58f6f7c8c3ee1e338e7a 2018-03-17 01:02 +0000 [6615469a05] Corey Farrell * main/indications: Use ast_cli_completion_add for all completions. Change-Id: I371be01f178fb542a9fbe8d97e7ae21aa4d82c36 2018-03-22 07:27 +0000 [de4e2c1de8] Alexander Traud * BuildSystem: pjsip_evsub_set_uas_timeout was not used (part 2). The previous change was not complete. ASTERISK-27435 Change-Id: I11082c14c0ef9c6af8c995084a6851337ea2a90f 2018-03-22 05:52 +0000 [79bb956b69] Alexander Traud * BuildSystem: With external editline, do not require libs for internal editline. ASTERISK-27761 Change-Id: Ib17a7415297a210cfcdbf149e4df9b6edadbfab6 2018-03-21 19:25 +0000 [3a4a441817] George Joseph * Revert "BuildSystem: In NetBSD, the Python Programming Language is python-X.Y." Something is causing a python2/python3 mismatch on Fedora27. PYTHON='/usr/bin/python2' PYTHONDEV_CFLAGS='-I/usr/include/python3.6m ' PYTHONDEV_INCLUDE='-I/usr/include/python3.6m ' PYTHONDEV_LIB='-lpython3.6m ' PYTHONDEV_LIBS='-lpython3.6m ' This reverts commit c0c537c1d3aab05358df697d8d259aa73f55a43c. Change-Id: I670a82aa7c872fa5facea1e3bc718e2d3124cc28 2018-03-20 15:28 +0000 [17cd687679] Kevin Harwell * bridge_softmix: Clear "talking" when a channel is put on hold This patch clears the talking flag from the channel (if already set), and notifies listeners when that channel is put on hold. Note however, if the endpoint continues to send audio frames and these are received by the bridge then that channel will be put back into a "talking" state even though they are on hold. ASTERISK-27755 #close Change-Id: I930e16c4662810f9f02043d69062f88173c5e2ef 2018-03-07 06:15 +0000 [5955cdf5ae] Ross Beer * pjsip_transport_events.c: Fix crash using stale transport pointer. Apparently it is possible for the transport to be destroyed without triggering the transport callback logic. As a result the transport gets destroyed and we have a stale pointer in the active_transports container. * Invoke the transport monitor callback checks when the transport is destroyed in addition to when it is disconnected and shutdown. ASTERISK-27688 Change-Id: Ia9b5469fea8f2b3f2d8476fae6b748a4d23e7261 2018-03-20 09:58 +0000 [69de659224] Ivan Poddubny * func_channel: Delete dead CHANNEL_TRACE code The functions behind the flag and the flag itself were removed from Asterisk 12 as incompatible with the new architecture. Change-Id: I058493ef7a53ee290fd225bbcbb07bf46b623ccf 2018-03-20 11:55 +0000 [7580d1e0bb] Alexander Traud * BuildSystem: For consistency, avoid extra libs to be empty. AST_EXT_LIB_CHECK has several optional parameters. When an optional parameter is left empty, [] is used to indicate this. However, this is done in the script ./configure only then, when a further parameter is not empty. For example, when no extra libraries are needed to test the checked library, parameter 5 is not mentioned. Except parameter 6 and higher are used, then parameter 5 must be empty. However, this general rule was broken * three times for parameter 5 (extra libs) and * three times for parameter 4 (header) as found via the Regular Expression \[\]\). In case of parameter 5, all cases were changed, because that happened for no reason. In case of parameter 4, an [] improves readability actually. Therefore for parameter 4, the only case which did not do it was changed. All this aims to create more consistency: Only do something different if there is a reason to do so. Change-Id: I037ef170cf1ad94497151a9ea5071a31c656cafe 2018-03-17 20:03 +0000 [6f304697b0] Corey Farrell * core: Remove dead symbols from asterisk.exports.in. * dahdi_chan_name * dahdi_chan_name_len * dahdi_chan_mode * __manager_event * dialed_interface_info Added comment about __progname and environ being needed for FreeBSD to prevent accidental removal in the future. Change-Id: I3ae026bc541cd9cb572be2ffa95fc359547642b5 2018-03-17 01:39 +0000 [8df4811cfa] Corey Farrell * named_acl: Use ast_cli_completion_add. Change-Id: I317a82de976bbdbfe4352c243e32a7bb8f66c377 2018-03-17 01:58 +0000 [a89323236f] Corey Farrell * main/sounds: Use ast_cli_completion_add. Change-Id: I140e1137906bbfcdb61c0c6304159be459ad873e 2018-03-17 01:09 +0000 [dc520b6d8f] Corey Farrell * manager: Use ast_cli_completion_add for completion generators. Change-Id: I658141c6ec490a3e866b02d2afea757928ceaabf 2018-03-17 02:16 +0000 [534fda0a59] Corey Farrell * main/test: Use ast_cli_completion_add. Change-Id: I5133ff2ba4e030f9733fb3d050c863d72a22ae6b 2018-03-16 10:19 +0000 [373e7e3fb0] George Joseph * channel.c: Allow generic plc then channel formats are equal If the two formats on a channel are equal, we don't transcode and since the generic plc needs slin to work, it doesn't get invoked. * A new configuration option "genericplc_on_equal_codecs" was added to the "plc" section of codecs.conf to allow generic packet loss concealment even if no transcoding was originally needed. Transcoding via SLIN is forced in this case. ASTERISK-27743 Change-Id: I0577026a179dea34232e63123254b4e0508378f4 2018-03-17 02:25 +0000 [bd926539b0] Corey Farrell * main/translate: Use ast_cli_completion_add. Change-Id: I0e2402660e54d91f74ab0804c62a5b1925577413 2018-03-17 02:00 +0000 [d202b56a74] Corey Farrell * main/taskprocessor: Use ast_cli_completion_add. Change-Id: Ie5f812a988ed811fd11967151932de62bc131b48 2018-03-17 00:51 +0000 [18cbfcf4f0] Corey Farrell * aco: Use ast_cli_completion_add for 'config show help'. In addition this removes: * RAII_VAR usage * Duplicate check of pos * Unneeded arguments. Change-Id: I2da8eac2670d1d8d6474c04037129804f55ebf39 2018-03-15 15:06 +0000 [d57b58f5e9] Corey Farrell * main/config: Use ast_cli_completion_add for reload completion. Change-Id: Ia3fa4c03f2285a1ec8814bbe7f4624ead9111ad1 2018-03-17 04:31 +0000 [34e16cbf3a] Corey Farrell * main/bridge: Use ast_cli_completion_add. Change-Id: I3775a696d6a57139fdf09651ecb786bcf1774509 2018-03-17 16:41 +0000 [98a3baca70] Corey Farrell * core: Minor cleanup of ast_el_read_char. * Define CHAR_T_LIBEDIT and CHAR_TO_LIBEDIT based on HAVE_LIBEDIT_IS_UNICODE. This avoids needing to repeatedly use conditional blocks, eliminates having multiple function prototypes. * Remove parenthesis from return values. * Add missing code block brackets {}. * Reduce use of 'else' conditional statements where possible. Change-Id: I4315328ebea2f62641faf6881de2ac20a9f9d08e 2018-03-17 10:54 +0000 [7b40605d8e] Alexander Traud * BuildSystem: Check for header file of OGG. Asterisk uses various symbols of the shared library libogg within the module format_ogg_vorbis. However, the source code of that module did not include the header file of libogg explicitly but implicitly. Because that header was not included before Asterisk 14, the script ./configure was told not to check for it. Anyway, even Asterisk 13 LTS uses symbols of libogg. Therefore, that header should be included explicitly. Therefore, ./configure should check for that header. Change-Id: I98c50d56311b68880d1084fcc62c35ab2f8692db 2018-03-09 06:26 +0000 [06ba605988] Alexander Traud * BuildSystem: When no download utility is available, display the explanation. ./configure --with-pjproject-bundled did not display an explanation, when no download utility like wget, curl, or fetch was installed beforehand, although an explanation existed in code. This happened because the code expected the variable DOWNLOAD_TO_STDOUT to be empty. However, the script ./configure set that variable always. Change-Id: I64c99b76a03525c69471e5055bf124b36a51bbd4 2018-03-17 05:00 +0000 [0f634c1446] Alexander Traud * BuildSystem: Remove unused dependency on libltdl. Asterisk does not need the development package of libltdl, because it does not use any symbol of -lltdl directly. Instead, it uses the runtime package via the shared library -lodbc. On the supported platforms, that shared library declares its dependency on -lltdl correctly, otherwise AST_EXT_LIB_CHECK would have failed. ASTERISK-27745 Change-Id: Icd315809b8e7978203431f3afb66240dd3a040ba 2018-03-05 06:50 +0000 [c0c537c1d3] Alexander Traud * BuildSystem: In NetBSD, the Python Programming Language is python-X.Y. ASTERISK-27717 Change-Id: If90ddf9c396c32e7402a894f42dce215c30049d1 2018-03-16 09:53 +0000 [afcd1dd8e5] Alexander Traud * BuildSystem: Avoid an extra case for OpenBSD. Nine years ago with Mantis 13639 (now ASTERISK-12841) an extra case for OpenBSD was introduced: Vorbis required Ogg to be specified manually, because the shared library libvorbis.so did not specify its required dependency on -logg itself. Today with OpenBSD 6.2, all libvorbis*.so declare their dependencies correctly. Therefore, an extra case is not required anymore. Change-Id: Ifd04e0994ce9f1e4ad29c3948a0398b91d1e97bc 2018-03-05 10:17 +0000 [5b80e97fff] Alexander Traud * BuildSystem: Enable Advanced Linux Sound Architecture (ALSA) in NetBSD. In the script ./configure, AST_EXT_LIB_CHECK checks for external libraries. Some libraries do not specify all their dependencies and require additional shared libraries. In AST_EXT_LIB_CHECK, this is the fifth parameter. However, if a library is specified there, it must exist on the platform, because ./configure tries to compile/link/execute a small app using those statements. For example, the library libdl.so is Linux specific and does not exist on BSD-like platforms. Furthermore, no supported platform/version was found, which still (ever?) requires those additional libraries. Therefore, they were simply removed. Finally, this change adds the error code ESTRPIPE to the channel driver chan_alsa for those platforms which lack it, again for example NetBSD. ASTERISK-27720 Change-Id: I3b21f2135f6cbfac7590ccdc2df753257f426e0b 2018-03-16 09:02 +0000 [d5af24bb14] George Joseph * app_voicemail: Fix json blob errors When app_voicemail calls ast_test_suite_notify with the results of a user keypress, it formats the keypress as '%c'. If the user hung up or some other error occurrs, the result of the keypress is a non printable character. This ultimately causes json_vpack_ex to think it's being passed a non utf-8 string and return an error. * Keypress results passed to ast_test_suite_notify are now checked with isprint() and a '?' is substituted if the check fails. Change-Id: I78ee188916bbac840f3d03f40201b692347ea865 2018-02-27 03:01 +0000 [69463c612d] Florian Floimair * app_dial: Enable early-media video Certain applications (e.g. door-phone) require that also video is transmitted before a call is accepted. Change-Id: I9842e1dc2f6e1c2c49dc33fe615255007d2f821e 2018-03-15 09:32 +0000 [a7ebb9409d] Corey Farrell * main/cdr: Use ast_cli_completion_add for CDR channel completion. Change-Id: Ie81830647a23aad61c1162583b6d50adbe6e7822 2018-03-15 08:19 +0000 [5ac64a4464] Corey Farrell * main/ccss: Use ast_cli_completion_add for core id. Change-Id: I44b25d6d24c7d9bc1bb38a50774b38883162f98f 2018-03-12 10:24 +0000 [e04be32fc5] Alexander Traud * install_prereq: Add Arch Linux. ASTERISK-27738 Change-Id: I7ca620e3c4dfb4b064a19382c4915aeb42a2a09f 2018-03-15 04:49 +0000 [eb699f3631] Corey Farrell * core: Backport compatible MALLOC_DEBUG changes. * Add support for MALLOC_DEBUG and DEBUG_CHAOS to be used together. * Add utils/astmm.c to .gitignore. * Fix MALLOC_DEBUG variant of __ast_vasprintf. This function called va_end(ap) upon allocation failure. This is incorrect since ap is passed as an argument. Change-Id: I9f27ced4ce3cbe4b39547a67f994fdff491978c0 2018-03-15 07:29 +0000 [7e0c56f800] Corey Farrell * astobj2_container: Use ast_cli_completion_add for container names. Change-Id: I4f0fc09e820eb8d8da2354a177dbcf503c56ddd1 2017-12-09 04:52 +0000 [7e041d6233] Corey Farrell * main/channel: Use ast_cli_completion_add for channeltypes. Change-Id: Ia845fae6a84801cc7d9996767b99efb2753cbb48 2018-03-14 12:38 +0000 [6539b89254] Corey Farrell * cli: Enable ast_cli_completion_add on public completion generators. * ast_cli_complete * ast_complete_channels * ast_complete_applications These generators will now use ast_cli_completion_add if state == -1. Change-Id: I7ff311f0873099be0e43a3dc5415c0cd06d15756 2018-03-14 11:17 +0000 [96eaabd920] Ross Beer * res_pjsip_rfc3326.c: Account for more than one 'Reason' header ASTERISK-27741 Change-Id: I0aa59a54735c6d20b95c54db1bd095dbf93e7adf 2018-03-12 08:10 +0000 [b237ef7f27] Alexander Traud * install_prereq: Add SUSE. ASTERISK-27736 Change-Id: I4cafc8973349d50a7cb7919ddf0bb1aaef4bfc3e 2018-03-13 16:37 +0000 [dc738b145f] Corey Farrell * core: Remove incorrect usage of attribute_malloc. GCC documentation states that when __attribute__((malloc)) is used it should not return storage which contains any valid pointers. It specifically mentions that realloc functions should not have the malloc attribute, but this also means that complex initializers which could contain initialized pointers should not use this attribute. Change-Id: If507f33ffb3ca3b83b702196eb0e8215d27fc7d2 2018-03-12 05:19 +0000 [7533d25e8d] Alexander Traud * BuildSystem: Enable IMAP storage on openSUSE and Arch Linux. ASTERISK-27734 Change-Id: I8d6e6a1c08c031649764f5277fbbb85e57c3a9d4 2018-03-12 04:22 +0000 [09c43fdc1a] Alexander Traud * res_srtp: Add support for libsrtp2.x on openSUSE. Since ASTERISK-26976, libSRTP 2.x can be used for sRTP. However, that change added a private header which is not available on openSUSE for example. To remain compatibility with very old libSRTP versions, the affected/missing symbols AES_128_ICM and HMAC_SHA1 are defined manually. ASTERISK-27733 Change-Id: I25c5cb8fa966043d1506ebef449e5a724412b4b6 2018-03-10 03:33 +0000 [c09a10bb1b] Corey Farrell * core: Remove non-critical cleanup from startup aborts. When built-in components of Asterisk fail to start they cause the Asterisk startup to abort. In these cases only the most critical cleanup should be performed - closing databases and terminating proceses. These cleanups are registered using ast_register_atexit, all other cleanups should not be run during startup abort. The main reason for this change is that these cleanup procedures are untestable from the partially initialized states, if they fail it could prevent us from ever running the critical cleanup with ast_run_atexits. Change-Id: Iecc2df98008b21509925ff16740bd5fa29527db3 2018-03-08 09:14 +0000 [bd6e0b1a72] Alexander Traud * BuildSystem: Add NetBSD. Headers, libraries, and rpath. ASTERISK-27728 ASTERISK-11015 Reported by: Curt Sampson Change-Id: I50aa5fcd095937df32a2e33307caac7e79a8b5b7 2018-03-09 03:23 +0000 [ba88af8a25] Alexander Traud * BuildSystem: For consistency, avoid double-checking via if clauses. In the script ./configure, AST_EXT_LIB_CHECK and AST_PKG_CONFIG_CHECK first test whether parameter 1 was already found. Consequently, an if-test on PBX_ just a line below is redundant, if exactly the same parameter 1 is used again. No performance gain is expected by this change. However, because this strategy is used all over in ./configure except for two places, this change aims to create more consistency: Only do something different if there is a reason to do so. Change-Id: I4a6f48127b7af3a48168c917e888be1f70625027 2018-03-09 02:44 +0000 [c227462370] Alexander Traud * BuildSystem: Enable dladdr on non-Linux platforms like FreeBSD. ASTERISK-27641 Change-Id: I587e8ba0123c70fc10cfd8b0ac3299551f61d84b 2018-03-07 13:50 +0000 [9ae427c7fd] Richard Mudgett * res_pjproject.c: Upgrade bundled PJPROJECT to 2.7.2 Update patches included in bundled PJPROJECT for the new version. ASTERISK-27730 Change-Id: Id3c8c8ad82126846bcd9768bc3d0a18d89be8944 2018-03-08 12:05 +0000 [57e8754a3a] Alexander Traud * install_prereq: Add NetBSD. ASTERISK-27729 Change-Id: I7a706d51375d54cf5e36d32397bfe09a48670804 2018-03-08 09:04 +0000 [0d70a9a006] Alexander Traud * BuildSystem: Re-check for another UUID library only when previous check failed. As a side-effect, this avoids the ambiguous output: checking for uuid_generate_random... no which was printed always previously. ASTERISK-25586 Reported by: John Nemeth Change-Id: I6d541dfcf453932a9856c5e251aa22e0e6c233c9 2018-03-08 05:32 +0000 [7b6b6b0a7e] Alexander Traud * BuildSystem: Instead of $PJPROJECT_LIBS with s, use $PJPROJECT_LIB everywhere. In the script ./configure, xyz_LIB is set by AST_PKG_CONFIG_CHECK and xyz_LIBS is set by PKG_CHECK_MODULES within AST_PKG_CONFIG_CHECK. Both are the same. In Asterisk normally the former and only three times the latter was used. Let us use xyz_LIB without s, for consistency with AST_EXT_LIB_CHECK. That eases understanding because now readers do not have to know that xyz_LIB equals xyz_LIBS. Change-Id: I7359860a5d730cdc784c2c48e501a082196434d3 2018-03-06 06:28 +0000 [54874eb44d] Alexander Traud * BuildSystem: Enable PortAudio in NetBSD. In NetBSD, PortAudio 1 is still the default version. PortAudio 2 can be installed side by side but gets placed in a 'portaudio2' subdirectory. To find PortAudio 2 even in a subdirectory, the tool pkg-config is queried via AST_PKG_CONFIG_CHECK. For those platforms, which do not list PowerAudio 2 via pkg-config, the previous check remains and is executed thereafter. ASTERISK-27721 Change-Id: I4175500126909ad1b181fff8e11bb4a3a6ae4fa9 2018-03-07 00:29 +0000 [b81eadcefc] Corey Farrell * Replace direct checks of option_debug with DEBUG_ATLEAST macro. Checking option_debug directly is incorrect as it ignores file/module specific debug settings. This system-wide change replaces nearly all direct checks for option_debug with the DEBUG_ATLEAST macro. Change-Id: Ic342d4799a945dbc40ac085ac142681094a4ebf0 2018-03-07 13:13 +0000 [342aec5980] Richard Mudgett * BuildSystem regression: Fix errors reported by clean targets. Doing a 'make clean', 'make distclean', or 'make dist-clean' gets errors about an invalid shell option: "/bin/sh: 0: Illegal option -". The clean targets do not include the makeopts file which defines GREP and LDCONFIG because the file may not exist and the distclean/dist-clean targets will delete it anyway. ASTERISK-27715 Change-Id: I33d40acdb03862bc89aeb6fb1ff497894a8ea7f5 2018-03-06 19:08 +0000 [0597e72e1d] Sungtae Kim * voicemail: Fixed wrong voicemail message count Fixed wrong voicemail mailbox reference for Action: VoicemailUsersList. ASTERISK-27703 Change-Id: I99bfec14bd4ae475b0fa1fac5a7992f3e2e8d64a 2018-02-14 07:33 +0000 [a35a654a52] Jean Aunis * chan_sip: Fix improper RTP framing on outgoing calls The "ptime" SDP parameter received in a SIP response was not honoured. Moreover, in the abscence of this "ptime" parameter, locally configured framing was lost during response processing. This patch systematically stores the framing information in the ast_rtp_codecs structure, taking it from the response or from the configuration as appropriate. ASTERISK-27674 Change-Id: I828a6a98d27a45a8afd07236a2bd0aa3cbd3fb2c 2018-03-06 13:31 +0000 [ecff05d51c] Ross Beer * res_pjsip_rfc3326: Order of 'Reason' headers break many endpoints ASTERISK-27554 Change-Id: If61c7faab7d2fa1031c056ed6268fe928e2391cf 2018-03-07 09:32 +0000 [725fd32428] Alexander Traud * utils: In Solaris, avoid a warning about an unused variable. When HAVE_GETHOSTBYNAME_R_5 was set by the script ./configure, GCC 7.3.0 found an unused variable. Actually, the variable was used (set to a dummy value) but the compiler optimization might have removed that. Instead, this change ensures that the variable 'res' is only used when it is really required. Change-Id: Ic3ea23ccf84ac4bc2d501b514985b989030abab5 2018-03-05 08:01 +0000 [93df498f4e] Alexander Traud * BuildSystem: Enable Lua in NetBSD. luaL_openlib got removed with Lua 5.2. luaL_newstate is available in all versions. ASTERISK-27718 Change-Id: I9c8c8880315ee36ab740d7c40153306c0bfd6f71 2018-03-06 07:33 +0000 [44dbb8251d] Alexander Traud * BuildSystem: Depend not implicitly but explicitly on external libraries. ASTERISK-27722 Change-Id: Ie7b8c30d86cb00a54d6ac4e09e6f28f42d2bd52c 2018-03-05 08:15 +0000 [2d63c185f0] Alexander Traud * res_http_post: Enable GMime in NetBSD. ASTERISK-27719 Change-Id: I230c5f9f316b2e9465c093c13580f72ebbaf67a7 2018-03-05 04:16 +0000 [0af1446d6e] Alexander Traud * BuildSystem: Enable autotools in NetBSD. ASTERISK-27716 Change-Id: I52525e35e1620341272219911d054a1e3d3ec01e 2018-03-05 03:42 +0000 [95ecbaa6b8] Alexander Traud * BuildSystem: AC_PATH_PROG sets to colon character when not found. ASTERISK-27715 Reported by: Corey Farrell Change-Id: I0d6d9572d1352dc7ad30c9917173f1e980d8c938 2018-03-03 09:06 +0000 [7b5e0960ef] Alexander Traud * chan_unistim: NetBSD has an incompatible struct in_pktinfo. ASTERISK-27714 Reported by: John Nemeth Change-Id: I1b84a89315a5f61222123d21bf35c59224da8990 2018-03-03 08:30 +0000 [6b899b2849] Alexander Traud * BuildSystem: Cast any intptr_t explicitly to its proposed type. ASTERISK-27713 Change-Id: I90c769e3c7f8c26de8a3af11335862cec15a1b22 2018-03-03 06:56 +0000 [98e8e849da] Alexander Traud * BuildSystem: Detect whether uselocale(.) is available. ASTERISK-27712 Reported by: Joerg Sonnenberger, D'Arcy Cain Change-Id: Idf1c9d43617a3e13028b95b313415903d80ef807 2018-03-03 03:53 +0000 [8348862103] Alexander Traud * BuildSystem: Avoid re-defining of pthread_* on NetBSD. ASTERISK-27711 Change-Id: Idc9194035b2958b99f6b01eb5b438d45a074565b 2018-03-02 07:05 +0000 [47d45ba025] Alexander Traud * BuildSystem: Install init scripts on openSUSE Tumbleweed. ASTERISK-27710 Change-Id: I4c777e41b31d4415bbe21cb435ad47b43ebb5467 2018-03-02 05:12 +0000 [4035582b64] Alexander Traud * BuildSystem: Avoid == for comparison in ./configure. ASTERISK-27709 Reported by: John Nemeth Change-Id: I11b1ae8fd404c04066f1458f5d71f9536359d58d 2018-02-27 15:40 +0000 [104468ad3a] Richard Mudgett * pjproject: Add cache_pools debugging option. The pool cache gets in the way of finding use after free errors of memory pool contents. Tools like valgrind and MALLOC_DEBUG don't know when a pool is released because it gets put into the cache instead of being freed. * Added the "cache_pools" option to pjproject.conf. Disabling the option helps track down pool content mismanagement when using valgrind or MALLOC_DEBUG. The cache gets in the way of determining if the pool contents are used after free and who freed it. To disable the pool caching simply disable the cache_pools option in pjproject.conf and restart Asterisk. Sample pjproject.conf setting: [startup] cache_pools=no * Made current users of the caching pool factory initialization and destruction calls call common routines to create and destroy cached pools. ASTERISK-27704 Change-Id: I64d5befbaeed2532f93aa027a51eb52347d2b828 2018-01-31 11:49 +0000 [41894965f2] Corey Farrell * gitreview: Reorder and add padding. Change-Id: I459dc320a8c9452a01eed6f403d786741587c890 2018-02-23 21:24 +0000 [bb973aeceb] Michael Cargile * apps/app_amd.c: Fixed total time and silence calculations Between Asterisk 11 and Asterisk 13 there was a significant increase in the number of AST_FRAME_NULL frames being processed by app_amd.c's main loop. Each AST_FRAME_NULL frame was being counted as 100ms towards the total time and silence. This may have been accurate when app_amd.c was orginally added, but it is not in Asterisk 13. As such the total analysis time and silence calculations were way off effectively breaking app_amd.c * Additional debug messages were added * AST_FRAME_NULL are now ignored ASTERISK-27610 Change-Id: I18aca01af98f87c1e168e6ae0d85c136d1df5ea9 2018-02-23 14:58 +0000 [68df9e609e] George Joseph * ast_coredumper: Minor fixes * Fix --tarball-config so the option doesn't cause an error. * Allow for missing /etc/os-release. * Add a sleep between tarballing the coredump and removing the output directory to allow the filesystem to settle. Change-Id: I73e03b13087978bcc7f6bc9f45753990f82d9d77 2018-02-23 10:09 +0000 [caad0c09cd] Corey Farrell * core: Fix handling of maximum length lines in config files. When a line is the maximum length "\n" is found at sizeof(buf) - 2 since the last character is actually the null terminator. In addition if a line was exactly 8190 plus a multiple of 8192 characters long the config parser would skip the following line. Additionally fix comment in voicemail.conf sample config. It previously stated that emailbody can only contain up to 512 characters which is always wrong. The buffer is normally 8192 characters unless LOW_MEMORY is enabled then it is 512 characters. The updated comment states that the line can be up to 8190 or 510 characters since the line feed and NULL terminator each use a character. ASTERISK-26688 #close Change-Id: I80864a0d40d2e2d8cd79d72af52a8f0a3a99c015 2018-02-22 13:53 +0000 [3e5864bcc8] Richard Mudgett * res_pjsip_refer.c: Fix attended transfer race condition crash. The transferrer's session channel was destroyed by the transferrer's serializer thread in a race condition with the transfer target's serializer thread during an attended transfer. The transfer target's serializer was attempting to clean up a deferred end status on behalf of the transferrer's channel when it should have passed the action to the transferrer's serializer. When the transfer target's serializer lost the race then both threads wind up trying to end the transferrer's session. * Push the ast_sip_session_end_if_deferred() call onto the transferrer's serializer to avoid a race condition that results in a crash. The session_end() function that could be called by ast_sip_session_end_if_deferred() really must be executed by the transferrer's serializer to avoid this kind of crash. ASTERISK-27568 Change-Id: Iacda724e7cb24d7520e49b2fd7e504aa398d7238 2018-02-22 11:11 +0000 [ffb15b2bc7] Kevin Harwell * AMI: Bumping AMI non-breaking number for Asterisk 13.20.0 release A few changes were made to AMI: * Fixed "(null):" header in AMI AsyncAGIEnd event * A mute header was added to the ConfbridgeJoin AMI event * ConfbridgeList action's ConfbridgeList events now output all the standard channel snapshot headers Change-Id: I94a82a44b02c91becae08d254e9a56abba5697cf 2018-02-17 03:28 +0000 [05fc37bbc2] Alexander Traud * install_prereq: Update FreeBSD libraries. deleted autoconf gcc libsamplerate sqlite changed binutils to libbfd freetds-devel to freetds gmime2 to gmime26 mysql55-client to mysql57-client added alsa-lib bison bzip2 cclient corosync doxygen libedit flex graphviz libhoard libical libilbc libltdl lua neon newt net-snmp openldap-client openssl patch pkgconf portaudio postgresql10-client python radcli speexdsp subversion uriparser xmlstarlet libzip ASTERISK-27686 Change-Id: Ibe88c9b26e59c30d26cdb313a3ef01c9f37ac80d 2018-02-22 10:46 +0000 [220accb461] Sean Bright * modules: Set deprecated modules to not build by default Change-Id: I09090f70224866aead6b3207fa784cfefea7d539 2018-01-31 13:37 +0000 [05af43b240] Kevin Harwell * AST-2018-003: Crash with an invalid SDP fmtp attribute pjproject's fmtp retrieval function failed to catch invalid fmtp attributes. Because of this Asterisk would crash if given an SDP with an invalid fmtp attribute. When retrieving the format this patch now makes sure the fmtp attribute is available. If not available it now returns an error status. ASTERISK-27583 #close Change-Id: I5cebe000ce2d846cae3af33b6d72c416e51caf2f 2018-01-31 13:33 +0000 [c5dc2fb4ab] Kevin Harwell * AST-2018-002: Crash with an invalid SDP media format description pjproject's media format parsing algorithm failed to catch invalid values. Because of this Asterisk would crash if given an SDP with a invalid media format description. When parsing the media format description this patch now properly parses the value and returns an error status if it can't successfully parse/convert the value. ASTERISK-27582 #close Change-Id: I883b3a4ef85b6972397f7b56bf46c5779c55fdd6 2018-02-06 12:07 +0000 [5947fd148b] George Joseph * AST-2018-005: res_pjsip_transport_management: Move to core Since res_pjsip_transport_management provides several attack mitigation features, its functionality moved to res_pjsip and this module has been removed. This way the features will always be available if res_pjsip is loaded. ASTERISK-27618 Reported By: Sandro Gauci Change-Id: I21a2d33d9dda001452ea040d350d7a075f9acf0d 2018-02-06 11:28 +0000 [a780386dbb] George Joseph * AST-2018-005: Fix tdata leaks when calling pjsip_endpt_send_response(2) pjsip_distributor: authenticate() creates a tdata and uses it to send a challenge or failure response. When pjsip_endpt_send_response2() succeeds, it automatically decrements the tdata ref count but when it fails, it doesn't. Since we weren't checking for a return status, we weren't decrementing the count ourselves on error and were therefore leaking tdatas. res_pjsip_session: session_reinvite_on_rx_request wasn't decrementing the ref count if an error happened while sending a 491 response. pre_session_setup wasn't decrementing the ref count if while sending an error after a pjsip_inv_verify_request failure. res_pjsip: ast_sip_send_response wasn't decrementing the ref count on error. ASTERISK-27618 Reported By: Sandro Gauci Change-Id: Iab33a6c7b6fba96148ed465b690ba8534ac961bf 2018-02-07 08:09 +0000 [de5df002a0] Joshua Colp * AST-2018-004: Restrict the number of Accept headers in a SUBSCRIBE. When receiving a SUBSCRIBE request the Accept headers from it are stored locally. This operation has a fixed limit of 32 Accept headers but this limit was not enforced. As a result it was possible for memory outside of the allocated space to get written to resulting in a crash. This change enforces the limit so only 32 Accept headers are processed. ASTERISK-27640 Reported By: Sandro Gauci Change-Id: I99a814b10b554b13a6021ccf41111e5bc95e7301 2018-02-20 10:33 +0000 [4da0e19b89] Joshua Colp * chan_sip: Emit a second ringing event to ensure channel is found. When constructing a dialog-info+xml NOTIFY message a ringing channel is found if the state is ringing and further information is placed into the message. Due to the migration to the Stasis message bus this did not always work as expected. This change raises a second ringing event in such a way to guarantee that the event is received by chan_sip and another lookup is done to find the ringing channel. ASTERISK-24488 Change-Id: I547a458fc59721c918cb48be060cbfc3c88bcf9c 2018-02-20 04:31 +0000 [cacb72f5ae] Corey Farrell * doc/lang/language-criteria.txt: Link to wiki. This document is out of date and is superseded by content on the Asterisk wiki. ASTERISK-24386 #close Change-Id: Idbf95b27b096c205251e1bbb560c79224ba81822 2018-02-18 10:27 +0000 [5ebc94da02] Sean Bright * res_http_websocket: Don't leak memory on read failure Change-Id: Ic449ea832bc81a1671c0e910c5fbe8c683e3da89 2018-02-19 04:21 +0000 [9325de11f8] Thomas Guebels * res_rtp_asterisk: Fix ICE candidate nomination If the ICE role is not set right away, we might have a role conflict that stays undetected and ICE finishing with successful tests and no candidate nominated. This was introduced by ASTERISK-27088. To avoid this, we set the role as soon as before but only if the ICE state permits it: still checking and not yet nominating candidates or completed. ASTERISK-27646 Change-Id: I5dbc69ad63cacbb067922850fbb113d479bd729c 2018-02-19 03:57 +0000 [e532b982b3] Corey Farrell * core: Rename sounds_index.c to sounds.c. This will make the source filename match the 'module reload sounds' command. This will allow conversion to a built-in module in Asterisk 16 without needing to redefine AST_MODULE. Change-Id: Ifb8e489575b27eb33d8c0b6a531f266670557f6e 2018-02-19 02:49 +0000 [9c8763e4d2] Corey Farrell * config: Fix locking for extconfig reload. Expand locking to include full reload process for extconfig to ensure nothing can read the config mappings between clearing and reloading. Change-Id: I378316bad04f1b599ea82d0fef62b8978a644b92 2018-02-15 14:09 +0000 [1a7ad4c9cf] Sean Bright * res_pjsip_header_funcs: Various cleanups * Prefer strcasecmp() over stricmp() * Use a list with no lock since we never actually lock * Minor cleanups to error messages Change-Id: I8446f44795ee8f3072e1c1f9193c6912dfc0c42b 2018-02-17 08:49 +0000 [6eb22964ba] Alexander Traud * rtp_engine: Load format name / mime type in uppercase again. This reverts a previous change partly. ASTERISK-27689 Change-Id: Ia3d2f282db6995be8c1c253b5d52f6038761e8af 2018-02-16 17:58 +0000 [27d28116d9] Corey Farrell * BuildSystem: Use single bootstrap.sh for Asterisk and menuselect. This causes the root bootstrap.sh script to generate configure scripts for both Asterisk and menuselect. This ensures that both configure scripts are generated with the same version of autotools and avoids situations where shared autoconf macros get modified without regenerating the menuselect script. Change-Id: I2bfd8537bbb63b3d46b11efabbb15eaaf9ef731a 2018-02-16 13:33 +0000 [9ad9433257] Sean Bright * res_pjsip: Endpoint destruction does not free DTLS configuration ASTERISK-27679 #close Reported by: Mak Dee Change-Id: I89a2783a11be0763bf123d1619ed176b6225cf42 2018-02-16 12:44 +0000 [c5e34f0794] Alexander Traud * install_prereq: Update OpenBSD libraries. deleted jack sqlite renamed freetds-0.63p1-msdblib to freetds mysql-client to mariadb-client added bison bzip2 c-client doxygen e2fsprogs graphviz gsm libical jansson libltdl lua neon net-snmp libsrtp portaudio-svn postgresql-client python speexdsp subversion uriparser xmlstarlet ASTERISK-27684 Change-Id: I26bdcb0a1d0e484a8dad1052da97f194aefd3370 2018-02-16 12:30 +0000 [88ec9be78a] Alexander Traud * BuildSystem: Allow newer autotools on OpenBSD. ASTERISK-27683 Change-Id: I5ec9dafbb0c16b6f2740c641980bc2eaaf995624 2018-02-16 07:52 +0000 [0ba6337d32] Alexander Traud * BuildSystem: Fix a typo related to ./configure --prefix= on OpenBSD. Reported by: Stuart Henderson Change-Id: Ieae8624f48b6ae78cf29930b9a45a3c842c7a764 2018-02-16 06:41 +0000 [58aa0d1014] Alexander Traud * BuildSystem: Enable IMAP storage on OpenBSD. ASTERISK-27681 Reported by: Stuart Henderson Change-Id: Ifb6b614acb251b695b9417d76510e73eb335b679 2018-02-16 05:58 +0000 [139dd38193] Alexander Traud * res_calendar: Specialized calendars depend on symbols of general calendar. ASTERISK-27680 Change-Id: Ifb77912e424fe3710a025c18526fada673ec0b79 2018-02-16 05:02 +0000 [94ff290361] Alexander Traud * BuildSystem: Enable system provided libedit on OpenBSD. ASTERISK-27677 Change-Id: I0854e3616d1361ae9b6907d3d3444a02784ac62b 2018-02-15 14:30 +0000 [48acd5cd26] Sean Bright * bridge_roles: Use a non-locking linked list where appropriate Also explicitly initialize with the AST_LIST_HEAD_NOLOCK_INIT macro for clarity. Change-Id: I4bc39ec33bc3ff77e1a971a01ace87deb965be3f 2018-02-15 13:29 +0000 [54efc0c637] Sean Bright * res_pjsip: Use pjsip_sip_uri.user_param instead of other_param There is a dedicated slot in the pjsip_sip_uri for the 'user' parameter, so use that instead of adding to the list of generic URI parameters. Change-Id: I0a0ce8a60ecee27489735bf56fd707719d8c2ed6 2018-02-12 07:48 +0000 [4a5221cd43] Alexander Traud * BuildSystem: Remove chan_h323 leftovers. ASTERISK-27670 Change-Id: I07a8ef8bbd6001e25711fa1bff152eb6c9efa729 2018-01-17 08:17 +0000 [eabe72a679] Alexander Traud * BuildSystem: Invoke ldconfig with previous path. On OpenBSD, gmake uninstall{-all} registered only libraries from /usr/lib and lost those from /usr/local/lib. Instead, invoke ldconfig on a path. ASTERISK-27595 Change-Id: I4aa2c0b5e07119d1a556f8ff6349eaf09e986888 2018-01-28 03:02 +0000 [c2283fca21] Alexander Traud * BuildSystem: Do not warn when bash is not installed. ASTERISK-27631 Change-Id: Iefdf268b0b98c3e7d8089ba87cf78136ac1d785b 2017-11-16 12:57 +0000 [4e5d5b2ce2] Corey Farrell * main/asterisk.c: Remove silly usage of RAII_VAR. Change-Id: I7e2996397fbd3c3a6a69dd805c38448ddfc34ae9 2018-02-11 15:27 +0000 [ba63dad12d] Richard Mudgett * chan_sip.c: Fix crash processing CANCEL. Check if initreq data string exists before using it when processing a CANCEL request. ASTERISK-27666 Change-Id: Id1d0f0fa4ec94e81b332b2973d93e5a14bb4cc97 2018-01-30 20:31 +0000 [6c72c22d51] Corey Farrell * json: Add conditionals to avoid locking if Jansson is thread safe. Jansson is thread safe for all read-only functions and reference counting starting v2.11. This allows simplification of our code and removal of locking around reference counting and dumping. Change-Id: Id985cb3ffa6681f9ac765642e20fcd187bd4aeee 2018-02-12 06:16 +0000 [0ab97e9774] Alexander Traud * pjproject_bundled: Disable G.729 from Belledonne Communications. When is installed, PJProject tries to link that. Support for this bcg729 was added with PJProject 2.7. The issue happens, because Teluu enabled that new feature on default. ASTERISK-27584 Reported by: Stuart Henderson Change-Id: I88b6b18ad777bcfe2d8201187b4b90eec0a172a6 2018-02-12 05:38 +0000 [81bec7c359] Alexander Traud * codecs: Add support for WebRTC iLBC 2.0. When the latest version of that library was installed, Asterisk did not build. ASTERISK-27669 Reported by: Николай Михо Change-Id: I27e09bb875fdd56423bd9fae1be85fddb428eb96 2018-01-30 09:58 +0000 [b1c6a644d3] Alexander Traud * backtrace: Avoid potential spurious output. clang 4.0 found this via -Wlogical-not-parentheses. ASTERISK-27642 Change-Id: I9ec3e144d425a976c02811bd23cd0c533d2eca4e 2018-02-10 05:39 +0000 [21bd7421ef] Alexander Traud * install_prereq: Update Debian/Ubuntu libraries. ASTERISK-27555 Change-Id: Idc36e91db30c0163c560d04c5a82bca5d6ce92a8 2018-02-09 12:06 +0000 [dcfcf310a1] Richard Mudgett * cdr.c: Fix runtime leak of CDR records. Need to remove all CDR's listed by a CDR object from the active_cdrs_all container including the root/master record. ASTERISK-27656 Change-Id: I48b4970663fea98baa262593d2204ef304aaf80e 2017-12-19 02:52 +0000 [0fc3e831a7] Oron Peled * chan_console: don't read and write at the same time It seems that the ALSA backend of PortAudio doesn't know how to both read and write at the same time by adding a per-device mutex. FIXME: currently only a draft version. Need to either auto-detect we work with the ALSA backend or add an extra configuration option to use this mutex. ASTERISK-27426 #close Change-Id: I635eacee45f5413faa18f5a3b606af03b926dacb 2018-02-02 17:20 +0000 [da987df122] Richard Mudgett * res_pjsip/config_domain_aliases.c: Add check for missing domain. What is the point of defining an alias and not saying what is being aliased? Change-Id: I98a892016ed61dcf5efeb6619fd748925103f0be 2018-01-31 17:48 +0000 [1ff580bb25] Richard Mudgett * app_confbridge: ConfbridgeList event has standard channel shapshot headers. * Made the AMI ConfbridgeList action's ConfbridgeList events output all the standard channel snapshot headers instead of a few hand-coded channel snapshot headers. The benefit is that the CallerIDName gets disruptive characters like CR, LF, Tab, and a few others escaped. However, an empty CallerIDName is now output as "" instead of "". ASTERISK-27651 Change-Id: Iaf7d54a9d40194c2db060bc9b4979fab6720d977 2018-01-31 15:45 +0000 [0cf7a9e0ca] Richard Mudgett * app_confbridge: Add the Muted header to ConfbridgeJoin AMI event. ASTERISK-27651 Change-Id: Idef2ca54d242d1b894efd3fc7b360bc6fd5bdc34 2018-02-02 17:35 +0000 [1adf90320d] Richard Mudgett * endpoint identifiers: Some code cleanup. res_pjsip_endpoint_identifier_user.c: * Fix copy/paste error in find_endpoint(). We were using a constant "anonymous" string instead of the passed in endpoint_name when checking the transport domain for an endpoint match. * Eliminate RAII_VAR in find_endpoint(). * Remove always true check in find_transport_state_in_use(). * Remove useless CMD_STOP in find_transport_state_in_use(). res_pjsip_endpoint_identifier_anonymous.c: * Eliminate RAII_VAR in anonymous_identify(). * Remove always true check in find_transport_state_in_use(). * Remove useless CMD_STOP in find_transport_state_in_use(). Change-Id: I86924c31db5bd225ca0c1219c761b668c6f91189 2018-02-02 15:11 +0000 [93a1ffc834] Richard Mudgett * res_pjsip.c: Fix documentation typos. Change-Id: I82ae0b92bfa2ece84a5c684efd9eefdc83ebd068 2018-02-02 15:43 +0000 [5d16cefd63] Richard Mudgett * res_sorcery_realtime.c: Fix ref leak if object failed to apply. Change-Id: I3c7106ff77009754725cee790eadf5da44154ab6 2018-01-24 19:58 +0000 [dd9690f68c] Sungtae Kim * manager.c: Fixed "(null):" header in AMI AsyncAGIEnd event * Changed to create ami_event string only when the given blob is not json_null(). * Fixed bad expression. ASTERISK-27621 Change-Id: Ice58c16361f9d9e8648261c9ed5d6c8245fb0d8f 2018-02-01 13:01 +0000 [8125b825d3] Joshua Elson * res_pjsip_mwi.c: Fix null pointer crash ASTERISK-27652 #close Change-Id: I78a0d38bfd8d0d82830f3d53da04872d6b67284d 2018-02-01 15:03 +0000 [09edcd93aa] Sean Bright * appdocsxml.xslt: Add Language to channel snapshot transformation Change-Id: I8f494b0c895a69b8bc94656d0c6ceebecb0394d8 2018-01-31 15:40 +0000 [665444b772] Richard Mudgett * manager.c: Fix potential memory leak and corruption. ast_str_append_event_header() could potentially leak and corrupt memory if the ast_str needed to expand to add the AMI event header. * Fixed to return error if the ast_str_append() failed. Change-Id: I92f36b855540743b208d76e274152ee2d758176d 2018-01-31 17:27 +0000 [ef1aeb9437] Richard Mudgett * manager_channels.c: Reordered ast_manager_build_channel_state_string_prefix() * Made not allocate memory if the channel snapshot is an internal channel. * Free memory earlier when no longer needed. Change-Id: Ia06e0c065f1bd095781aa3f4a626d58fa4d28b38 2018-01-28 10:10 +0000 [7debdd285c] George Joseph * res_pjsip_pubsub: Prune subs with reliable transports at startup In an earlier release, inbound registrations on a reliable transport were pruned on Asterisk restart since the TCP connection would have been torn down and become unusable when Asterisk stopped. This same process is now also applied to inbound subscriptions. Also fixed issues in res_pjsip_registrar where it wasn't handling the monitoring correctly when multiple registrations came in over the same transport. To accomplish this, the pjsip_transport_event feature needed to be refactored to allow multiple monitors (multiple subcriptions or registrations from the same endpoint) to exist on the same transport. Since this changed the API, any external modules that may have used the transport monitor feature (highly unlikey) will need to be changed. ASTERISK-27612 Reported by: Ross Beer Change-Id: Iee87cf4eb9b7b2b93d5739a72af52d6ca8fbbe36 2018-01-31 15:15 +0000 [698b28e9c7] Corey Farrell * res_pjsip_registrar_expire: Mark module deprecated. The functionality of this module was already moved to res_pjsip_registrar, mark it deprecated and add message to CHANGES. Change-Id: I90c7d52c7e15e85fde3389d5eaccb05b97848813 2018-01-30 19:22 +0000 [6520489952] Richard Mudgett * bridge_softmix.c: Report not talking immediately when muted. Currently in app_confbridge if someone mutes a channel while that channel is talking, the talk detection code is suspended while the channel is muted. As far an an external observer is concerned, the muted channel's talk status is still "talking" even though the channel is not contributing audio to the conference bridge. When the channel is later unmuted, it takes the usual 'dsp_silence_threshold' option time to clear the talking status even though the channel may have stopped talking while the channel was muted. * In bridge_softmix.c, clear the talking status and report talking stopped if the channel was talking when the channel is muted. When the channel is unmuted and the channel is still talking then report the channel as talking since it is contributing audio to the bridge again. ASTERISK-27647 Change-Id: Ie4fdbc05a0bc7343c2972bab012e2567917b3d4e 2018-01-30 15:00 +0000 [4a337b1a76] Richard Mudgett * app_confbridge: Update dsp_silence_threshold and dsp_talking_threshold docs. The dsp_talking_threshold does not represent time in milliseconds. It represents the average magnitude per sample in the audio packets. This is what the DSP uses to determine if a packet is silence or talking/noise. Change-Id: If6f939c100eb92a5ac6c21236559018eeaf58443 2018-01-31 11:00 +0000 [2c4dde0ed0] Richard Mudgett * res_pjsip_registrar.c: Fix compiler error. Need to include signal.h to define pthread_kill() and SIGURG. Change-Id: I10ae3aa4bf8e7386ac29ade78c0f2caed8e674fa 2018-01-30 23:05 +0000 [4c8c0e4c22] Corey Farrell * res_pjsip_session: Prevent crash during shutdown. pjproject does not have a function to reverse pjsip_inv_usage_init. This means we need to ignore any calls to the functions once shutdown is final. ASTERISK-27571 #close Change-Id: Ia550fcba563e2328f03162d79fb185f16b7c9b9d 2018-01-29 13:46 +0000 [5b699c812e] George Joseph * res_pjsip_registrar_expire: Refactor into res_pjsip_register res_pjsip_registrar_expire remains as an empty module for now. Change-Id: Ib93698938bae548d2199cb542f3692d1a171239f 2018-01-29 10:20 +0000 [967c70acb5] Alexander Traud * BuildSystem: Enable autotools in FreeBSD. In the current versions of FreeBSD, the apps of GNU autotools do not need to be called with a version anymore. The latest version can be invoked directly. Additionally, the script ./bootstrap.sh asked for autoconf 2.62 and automake 1.9, versions which are not available as port anymore. ASTERISK-27637 Change-Id: Id7b94b80e78cc943a40ba79b697e3f70019820a7 2018-01-29 10:00 +0000 [dd6b8cd0b2] Alexander Traud * app_voicemail: Avoid always true when using pointer address. clang 4.0 warned about this. ASTERISK-27635 Change-Id: I213f230607d7fbe97c0f5f2d60da9cbf5a2d8231 2018-01-19 05:16 +0000 [8daed642c7] Alexander Traud * install_prereq: Update RHEL/CentOS/Fedora libraries. deleted automake git ncurses-devel pjproject-devel sqlite2-devel libsqlite3x-devel renamed radiusclient-ng-devel to radcli-devel gmime22-devel to gmime-dev added alsa-lib-devel bash binutils-devel bison doxygen flex hoard make pkgconfig speexdsp-devel uriparser-devel uw-imap-devel wget xmlstarlet zlib-devel ASTERISK-27599 Reported by: Said Masoud Change-Id: I05bb0af98ae532b2d5f37478e38b8f0762b1c035 2018-01-28 05:20 +0000 [f59fb7fec8] Alexander Traud * BuildSystem: Remove unused variables. Because of a copy-and-paste from the script build_tools/download_externals, the script build_tools/list_valid_installed_externals got its local variables. However in the latter, three variables were not used actually. Change-Id: I252de5a98c17ea54459174875357c22c2eebe8d5 2018-01-25 12:06 +0000 [154bccf147] Corey Farrell * loader: Use ast_cli_completion_add for 'module load' completion. This addresses all performance issues with 'module load' completion. In addition to using ast_cli_completion_add we stop using libedit's filename_completion_function, instead using ast_file_read_dir. This ensures all results are produced from a single call to opendir. Change-Id: I8bf51ffaa7ef1606f3bd1b5bb13f1905d72c6134 2018-01-27 09:44 +0000 [4bb38022ea] Alexander Traud * core: Fix unused variable error in handle_show_sysinfo. The previous fix broke the case HAVE_SYSINFO = no HAVE_SYSCTL = yes HAVE_SWAPCTL = no which occurs on FreeBSD 11.1 for example. ASTERISK-26563 Change-Id: If77c39bc75f0b83a6c8a24ecb2fa69be8846160a 2018-01-27 08:54 +0000 [021168f06f] Alexander Traud * editline: Avoid shifting a negative signed value. clang 4.0 warned about this. ASTERISK-27630 Change-Id: Ie2725048c661c1792d8b1d498575144350b6e9ba 2018-01-27 03:25 +0000 [e998c906a7] Alexander Traud * headers: Consistent use of typeof and/or __typeof__. Because of a copy-and-paste error, the Asterisk project was using __typeof instead of typeof. It works because typeof, __typeof, and __typeof__ are supported by GCC, but here the escaped variant was not intended. Therefore, for consistence, we change this to typeof. Change-Id: I2a962c3e596e882f691a19345445b14571a5f07c 2018-01-24 18:25 +0000 [87f8459410] Richard Mudgett * Update sounds release to fix siren7 and siren14 files. ASTERISK-16172 Change-Id: I2fb564258cd4db0f35952ad48b8687355c2dcad3 2018-01-15 11:08 +0000 [6b771e346b] Alexander Traud * BuildSystem: Raise autoconf version requirement to 2.60a. AC_COMPUTE_INT requires at least autoconf 2.60a. This affects only those who contribute to Asterisk, only those who had to use the script ./bootstrap.sh. Furthermore, this change just makes sure nobody is using a too old autoconf. ASTERISK-16951 Change-Id: Ibca850e2fe0e77d935207bd959bacf7197d7f637 2018-01-26 06:48 +0000 [7ad6792011] Alexander Traud * install_prereq: Download latest Jansson. ASTERISK-27603 Change-Id: I65c587534c0ae364f063d68da1bed40bb3d5e8aa 2018-01-18 20:19 +0000 [85b384728c] Richard Mudgett * pbx_variables.c: Misc fixes in variable substitution. * Copy more than one character at a time when there is nothing to substitute. * Fix off by one error if a '}' or ']' is missing. * Eliminated the requirement that the "used" parameter had to point to a variable. The current callers were always declaring a variable to meet the requirement and discarding the value put into that variable. Now it can be NULL. * In ast_str_substitute_variables_full() fixed using the bogus channel to evaluate a function. We were not using the bogus channel we just created to help evaluate a subexpression. Change-Id: Ia83d99f4f16abe47f329eb39b6ff2013ae7c9854 2018-01-22 09:18 +0000 [420586beab] Alexander Traud * res_config_mysql: Avoid the header mysql_version.h. ASTERISK-27607 Change-Id: I23d00ded955c4afd5f2c3c9dc96dcb48b3f74eec 2018-01-05 14:46 +0000 [d5a24cfdf7] Alexander Traud * install_prereq: For PJProject, point users to configure script. The installation script and the new configure option --with-pjproject-bundled aimed to accomplish the same. However, the installation script was out of date. Users should go for the maintained configure option, or the Wiki. ASTERISK-24598 Change-Id: Icbf4b562f81f7c05bd24a3805bd46c0beb4ebd44 2018-01-20 12:58 +0000 [31e5008b47] Alexander Traud * BuildSystem: Remove AC_CONFIG_AUX_DIR. ASTERISK-27602 Change-Id: I9f4d3d2bc1481748e39ad1e2b0a364d38e38978b 2018-01-19 12:21 +0000 [ffb7b62019] Alexander Traud * BuildSystem: Remove orphaned .PHONY targets. Change-Id: Ic44d75141b9bf99e7d72fcc82ee111b5cf6989d2 2018-01-19 12:14 +0000 [3b566fc8ec] Alexander Traud * BuildSystem: Allow make clean all again. ASTERISK-27600 Reported by: Hamid R. Hashmi Change-Id: I683d14d024650be04074b037b6300464519409f4 2018-01-19 06:19 +0000 [f20a522d43] Alexander Traud * install_prereq: Update Debian/Ubuntu libraries. ASTERISK-27555 Change-Id: Ieb41b0cbf968af12882b39454b819ebb48b9ea46 2018-01-19 04:46 +0000 [1fbca9a40d] Alexander Traud * install_prereq: Support package manager DNF and yum option strict=1. This re-enables the script ./contrib/scripts/install_prereq on Fedora 22 and newer, and on RHEL/CentOS when the option strict=1 was set for yum install. ASTERISK-27598 Reported by: Hunter Stevens, Said Masoud Change-Id: I40f9517122aaa6906e8fc0962b4b8008dfddb368 2018-01-09 11:29 +0000 [d5bcbd460e] Benoît Dereck-Tricot * pbx: Reduce verbosity while loading extensions Each time the dial plan is reloaded, a lot of logs like these are generated: "Added extension 'XXXXX' priority 1 to YYYYYYYYYYY" This patch changes the log level for those logs. ASTERISK-27084 Change-Id: I5662902161c50890997ddc56835d4cafb456c529 2018-01-18 14:55 +0000 [b353c90627] Sean Bright * res_pjsip: Document tlsv1_1 and tlsv1_2 methods Change-Id: I67ed9039bf3f132fb20ee7a750e0aef0f704d7d3 2018-01-08 23:50 +0000 [1488efb3a8] Igor Goncharovsky * chan_unistim: Fix hold function ability to lock/crash asterisk This patch fix chan_unistim hold functions to correctly support hold function in different states possible in case of multiple lines established on the phone ASTERISK-26596 #close Change-Id: Ib1e04e482e7c8939607a42d7fddacc07e26e14d4 2017-12-27 17:44 +0000 [0b399013c6] Graham Mainwaring * app_followme: Add a prompt to be read when a call is connected This patch adds the ability to configure a prompt which will be read to the "winner" who pressed 1 (or the configured value) and received the call. ASTERISK-24372 #close Change-Id: I6ec1c6c883347f7d1e1f597189544993c8d65272 2018-01-17 00:28 +0000 [22edb10c44] Corey Farrell * loader: Miscellaneous fixes. * Remove comment about lazy load. * Improve message about module already being loaded and running. * Handle allocation error in add_to_load_order. * Dead code elimination from modules_shutdown. Change-Id: I22261599c46d0f416e568910ec9502f45143197f 2018-01-17 08:36 +0000 [9ffa1f4301] Alexander Traud * BuildSystem: Use the detected name for MD5 everywhere. Affacted the (automatic) download script for external modules: ./build_tools/download_externals ASTERISK-27596 Change-Id: If4c3176f7bf58df32fec6e02a659f1a78d57cf4b 2018-01-17 07:11 +0000 [de65fd11fe] Alexander Traud * BuildSystem: Invoke install not in GNU but POSIX style. ASTERISK-27594 Change-Id: Iaaa6a19d2fe031dffcba441d0502a7ea65c93cb3 2018-01-17 06:47 +0000 [72845d54f0] Alexander Traud * BuildSystem: In OpenBSD, xmlstarlet is xml. ASTERISK-27593 Change-Id: I1c7087f7f7582e40b3312c690d912c9a86466805 2018-01-17 02:51 +0000 [985834607b] Alexander Traud * BuildSystem: Detect external library Lua in version 5.3. On some platforms, you decide to go for one specific version of Lua, for example in OpenBSD. On other platforms, you are able to install several versions side-by-side, for example in Ubuntu and Fedora. Asterisk already works with Lua 5.3. Asterisk failed to detect Lua 5.3 on those platforms which allow several versions. ASTERISK-27592 Change-Id: If7a4b395d844a464e9a1f4f626c5bff4ee67eed8 2018-01-16 08:32 +0000 [1bbd9f4a47] Richard Mudgett * taskprocessor.c: Increase the number of tps_singletons container buckets. Since v12 the number of taskprocessors in the system has increased a lot. Small systems can easily have over a hundred and larger systems can have thousands. Most uses of the tps_singletons container deal with creating and destroying the taskprocessors. However, the pjsip distributor looks up taskprocessors/serializers by name frequently. It needs to find the serializer for incoming SIP responses to distribute them to the appropriate serializer. Change-Id: Ice0603606614ba49f7c0c316c524735c064e7e43 2018-01-16 08:20 +0000 [fbd0667c84] George Joseph * pjproject_bundled: Prevent crash on bad outgoing header We still need to figure out how a bad header is getting into the outgoing message but this patch to pjproject prevents attempting to print that header and causing a crash. For several users, this crash happens when sending 183 progress messages. ASTERISK-26832 Reported by: Ross Beer, Jan Rozhon Change-Id: Ie5c5a921c890c843587763e7f33f987dfe66bd16 2018-01-16 06:34 +0000 [637bd26575] Alexander Traud * BuildSystem: Avoid $EUID and use id -u instead. Makefile included a call to ${EUID} which requires the shell bash. To keep compatibility with other shells like dash or ksh, use id -u instead. ASTERISK-27589 Change-Id: Ia6e74f5bc9aab4e6dc62b7439f647b7964e6f657 2018-01-15 18:03 +0000 [b0a78bdc3e] Richard Mudgett * cel_odbc.c: Fix menuslect module description display. Asterisk's makefile for menuselect has a very simple source file parsing script that looks for AST_MODULE_INFO lines to extract the quoted string as a module description. If it does not find a quoted string it uses the whole line as the description. Change-Id: I80f13a63818e4e28d683639a94a4dfaea405c1d5 2018-01-15 01:41 +0000 [c0a4a939cc] Yasuhiko Kamata * chan_sip: 3PCC patch for AMI "SIPnotify" A patch for sending in-dialog SIP NOTIFY message with "SIPnotify" AMI action. ASTERISK-27461 (created patch for 13 branch manually due to merge conflict) Change-Id: I255067f02e2ce22c4b244f12134b9a48d210c22a 2018-01-13 13:49 +0000 [948b852f48] George Joseph * config_transport: Enable TCP_NODELAY on TLS transports We did this for TCP transports already but I'm not sure why we didn't do it for TLS transports. ASTERISK_27474 #not_final_fix Change-Id: I5b1ef4b882f7b859e718236686b7898751dbb262 2018-01-12 18:37 +0000 [f01bac230d] Corey Farrell * res_stasis_recording: Allow symbolic links in configured recordings dir. If any component of ast_config_AST_RECORDING_DIR is a symbolic link we would incorrectly assume the ARI user was trying to escape the recording path. Create additional check to check the recording directory's realpath, only deny access if both do not match. This is needed by the testsuite when run by 'run-local'. Change-Id: I9145e841865edadcb5f75cead3471ad06bbb56c0 2018-01-12 12:00 +0000 [97b574c927] Corey Farrell * menuselect: Remove unused dev-mode option TRACE_FRAMES. ASTERISK-27575 #close Change-Id: Ica3a522892afed7a96816a5ecf140e1671f46ad4 2018-01-12 03:50 +0000 [f07b0df627] Alexander Traud * res_config_pgsql: Avoid typecasting an int to unsigned char. clang 5.0 warned about this. ASTERISK-27576 Change-Id: If41f400a51973c06cdb9b75462e535b616bfe385 2018-01-12 03:17 +0000 [659c44f5fb] Alexander Traud * BuildSystem: Really do not pass unknown-warning options to the compiler. When an older GCC version is called with a too new warning option, GCC exited with an error and Asterisk was not built. Therefore, the configure script tests the installed compiler whether it supports that warning option. If not, Asterisk does not pass it to the installed compiler. However, some compilers (like clang) do not exit (error) but give just a warning in such a case. Because the compiler did not exit, Asterisk passed the unknown-warning option. ASTERISK-27560 Change-Id: Ia9d148e689c173df4e91699113605dab2de36038 2018-01-12 04:27 +0000 [45008c604d] Alexander Traud * app_osplookup.c: Avoid two format truncations. GCC 7 warned about this. ASTERISK-27578 Change-Id: I4a00458dbe9b575ef04338b6a7852272745e1552 2018-01-12 04:03 +0000 [d53a312a03] Alexander Traud * chan_ooh323: Avoid typecasting an int to unsigned short. clang 5.0 warned about this. ASTERISK-27577 Change-Id: I898fe4255023138a9e8b579fe4482fcf582f2b78 2018-01-05 15:17 +0000 [1d625a7428] Alexander Traud * install_prereq: Update Debian/Ubuntu libraries. ASTERISK-27555 Change-Id: I0818b6e42631be1b69237e2b41d3415275693e53 2017-12-22 19:50 +0000 [f35960d55b] Richard Mudgett * res_pjsip: Split type=identify to IP address and SIP header matching priorities The type=identify endpoint identification method can match by IP address and by SIP header. However, the SIP header matching has limited usefulness because you cannot specify the SIP header matching priority relative to the IP address matching. All the matching happens at the same priority and the order of evaluating the identify sections is indeterminate. e.g., If you had two type=identify sections where one matches by IP address for endpoint alice and the other matches by SIP header for endpoint bob then you couldn't predict which endpoint is matched when a request comes in that matches both. * Extract the SIP header matching criteria into its own "header" endpoint identification method so the user can specify the relative priority of the SIP header and the IP address matching criteria in the global endpoint_identifier_order option. The "ip" endpoint identification method now only matches by IP address. ASTERISK-27491 Change-Id: I9df142a575b7e1e3471b7cda5d3ea156cef08095 2018-01-11 08:09 +0000 [90b2dc1450] Tzafrir Cohen * Ignore quilt .pc directory, used in deb packaging Debian packaging uses quilt to manage patches. Book-keeping for them is done using quilt (either directly, or in a compatible format), and tracked in the directory .pc . Change-Id: I22c90f3d7ab8918e6216e7b686de6fa0e1fdaa7b Signed-off-by: Tzafrir Cohen 2018-01-09 11:23 +0000 [608112ced3] Corey Farrell * stasis: Remove silly usage of RAII_VAR. Change-Id: Ib11193531e797bcb16bba560a408eab155f706d1 2018-01-09 11:16 +0000 [b7c25740fa] Corey Farrell * stasis_bridges: Remove silly usage of RAII_VAR. Change-Id: I0fa7ab05454f183dc4ff10e26d18776d2b0fcf1f 2018-01-03 17:26 +0000 [2e09ed3b18] Richard Mudgett * res_pjsip.c: Update the endpoint identification documentation. * Endpoint identify_by documentation. * IP/Header endpoint identifier documentation. Change-Id: Id92f00b495acca7be945daf749d2abd7f76a0b5a 2018-01-03 15:20 +0000 [dd6dee7e50] Richard Mudgett * res_pjsip_endpoint_identifier_ip.c: Remove unnecessary requirement. The requirement that "ip" must be in the endpoint identify_by list to allow the type=identify method to identify the endpoint is not necessary. The "ip" identifier method can match one and only one endpoint. To even work, the "ip" identifier method configuration must explicitly specify the identified endpoint. Therefore, why bother configuring the type=identify identifier in the first place? The requirement only adds the potential for configuration errors for no benefit. Even worse, those configuration errors cannot be detected when the configuration loads. The requirement was introduced with the ASTERISK_27206 patch. * Remove the code change that enforces the requiremnt. Listing the "ip" method in the identify_by value is simply documentation. Change-Id: Ia057f92a33fb5d9f51dc5d5692e3d5ee1a6f2c11 2018-01-05 19:03 +0000 [96040fa6bb] Richard Mudgett * res_pjsip.c: Fix ident_to_str() and refactor ident_handler(). * Extracted sip_endpoint_identifier_type2str() and sip_endpoint_identifier_str2type() to simplify the calling functions. * Fixed pjsip_configuration.c:ident_to_str() building the endpoint's identify_by value string. Change-Id: Ide876768a8d5d828b12052e2a75008b0563fc509 2018-01-04 17:04 +0000 [a8a2f39f04] Richard Mudgett * res_pjsip_endpoint_identifier_ip.c: Allow multiple IdentifyDetail AMI events. The AMI PJSIPShowEndpoint action could only list one IdentifyDetail AMI event per endpoint. However, there is no reason that multiple type=identify sections cannot identify the same endpoint. * Reworked format_ami_endpoint_identify() to generate as many IdentifyDetail AMI events as there are matching identifiers. Change-Id: Ie146792aef72d78e05416ab5b27bc552a30399db 2018-01-09 11:10 +0000 [dedf0ff2bf] Corey Farrell * stasis_cache: Remove silly usage of RAII_VAR. Change-Id: Ifa95e5801c949df296c7e4376347730fb0ed52ef 2018-01-09 11:09 +0000 [8a6b3537b1] Corey Farrell * stasis_cache_pattern: Remove silly usage of RAII_VAR. Change-Id: Ic98a51f555062cd863b6db3f8d76065943a9dea3 2018-01-09 10:57 +0000 [909e642918] Corey Farrell * stasis_endpoints: Remove silly usage of RAII_VAR. Change-Id: Ic099dc552f36c353c89783a4bcfd09f010432733 2018-01-09 10:55 +0000 [bd11159dbc] Corey Farrell * stasis_message_router: Remove silly usage of RAII_VAR. Change-Id: I50d6ae230920e0b878ed9cc8f79eef746e06701d 2018-01-09 10:53 +0000 [975a38e524] Corey Farrell * stasis_system: Remove silly usage of RAII_VAR. Change-Id: Iedbe5656cee68cd3a96a953558764aa02d4a0c3b 2018-01-05 05:51 +0000 [b45fb3a6ec] Alexander Traud * translate: Avoid absolute value on unsigned substraction. ast_format_get_sample_rate(.) returns an unsigned type. The difference of a substraction between two unsigned types does not get implicitly converted to a signed type. Therefore, using abs(.) did not make sense. ASTERISK-27549 Change-Id: Ib904d9ee0d46b6fdd1476fbc464fbbf813304017 2018-01-09 08:22 +0000 [1da8846ca7] Sean Bright * Revert "codec_opus: Make libcurl a dependency in menuselect" This reverts commit 028f4320de60a204e457ad606ab0a3318493b431. Change-Id: Ieb91f825cb55202a937f5361c01d356e7662b70c 2018-01-08 18:47 +0000 [c67eb7031b] Corey Farrell * app_confbridge: Fix NULL check in action_kick_last. The check for last_user == NULL needs to happen before we dereference the variable, previously it was possible for us to check flags of a NULL last_user. Change-Id: I274f737aa8af9d2d53e4a78cdd7ad57561003945 2018-01-06 02:17 +0000 [17480f6ea4] Corey Farrell * res_stasis: Reduce RAII_VAR usage. In addition to being a micro-optimization (RAII_VAR has overhead), this change improves output of REF_DEBUG. Unfortunately when RAII_VAR calls ao2_cleanup it does so from a generated _dtor_varname function. For example this caused _dtor_app to release a reference instead of __stasis_app_unregister. Change-Id: I4ce67120583a446babf9adeec678b71d37fcd9e5 2018-01-07 20:21 +0000 [c1acc4f364] Corey Farrell * res_stasis: Fix app_is_subscribed_bridge_id. Instead of searching for bridge_id provided in an argument this function always searched for BRIDGE_ALL first. Rewrite this function to work like the similar functions for channel and endpoint functions. Change-Id: Ib5caca69e11727c5c8a7284a1d00621f40f1e60a 2018-01-05 07:58 +0000 [da1a9f392a] Alexander Traud * General: Silence modules on (un)load. Some (normally optional) modules created notices, warnings, and even errors in normal situations like (un)load. This cluttered the command-line interface (CLI) on start and while stopping gracefully. However, when an user went for the script './contrib/scripts/install_prereq', those modules get compiled-in because their prerequisites were met at compile time. Furthermore, because of ASTERISK_27475, the former talkative module 'res_curl' is built as side-effect. ASTERISK-27553 Change-Id: I9f105f46d72553994e820679bfde3478a551b281 2018-01-06 15:40 +0000 [aa52c52b21] Alexander Traud * BuildSystem: Really do not pass unknown-warning options to the compiler. When an older GCC version is called with a too new warning option, GCC exited with an error and Asterisk was not built. Therefore, the configure script tests the installed compiler whether it supports that warning option. If not, Asterisk does not pass it to the installed compiler. However, some compilers (like clang) do not exit (error) but give just a warning in such a case. Because the compiler did not exit, Asterisk passed the unknown-warning option. ASTERISK-27560 Change-Id: Ia9b7747f649b27ff5e9f75c3db3fee4fe7a29621 2018-01-06 01:42 +0000 [9865e689d2] Alexander Traud * General: Avoid implicit conversion to char when changes value to negative. clang 5.0 warned about this. ASTERISK-27557 Change-Id: I7cceaa88e147cbdf81a3a7beec5c1c20210fa41e 2018-01-06 06:45 +0000 [a68da30069] Alexander Traud * editline: Avoid comparison between pointer and zero character constant. gcc 7.2 warned about this. ASTERISK-27559 Change-Id: I48960dda9cf0a11b6a9426f775e632363f8caa74 2018-01-06 05:01 +0000 [e60135efd4] Alexander Traud * codec_gsm: Avoid shifting a negative signed value. clang 5.0 warned about this. ASTERISK-27558 Change-Id: Icc452ecb0d86bbeba78dae768cc472ec540699df 2018-01-04 12:23 +0000 [ba57c03740] Richard Mudgett * res_pjsip_endpoint_identifier_ip.c: Fix apply identify validation. The ip_identify_apply() did not validate the configuration for simple static configuration errors or deal well with address resolution errors. * Added missing configuration validation checks. * Fixed address resolution error handling. * Demoted an error message to a warning since it does not fail applying the identify object configuration. Change-Id: I8b519607263fe88e8ce964f526a45359fd362b6e 2018-01-04 17:42 +0000 [0feca9bc18] Richard Mudgett * res_pjsip.c: Fix endpoint identifier registration name search. If an endpoint identifier name in the endpoint_identifier_order list is a prefix to the identifier we are registering, we could install it in the wrong position of the list. Assuming endpoint_identifier_order=username,ip,anonymous then registering the "ip_only" identifier would put the identifier in the wrong position of the priority list. * Fix incorrect strncmp() string prefix matching. Change-Id: Ib8819ec4b811da8a27419fd93528c54d34f01484 2018-01-05 03:33 +0000 [440fb4d02b] Alexander Traud * BuildSystem: Find ptlib-config on Debian/Ubuntu. The current configure script requires that tool when libpt-dev is installed. libpt-dev was installed by libopenh323-dev, bacause you wanted to go for H.323 based channel drivers. ASTERISK-25329 Change-Id: I9c6ab78b7246c21536e1d252dcbffe682f63f83d 2018-01-05 06:42 +0000 [dda0ab236d] Alexander Traud * chan_ooh323: Limit outgoinglimit to positive values as intended. ASTERISK-27552 Change-Id: Ifbf9d51e7374ca2e8b27ec568f6770050fc1a854 2018-01-05 06:19 +0000 [c11999f140] Alexander Traud * ooh323cDriver: Fix typo in header guard. ASTERISK-27551 Change-Id: I39ff66031e3373e895e2bc47b23a5e860ea4e012 2018-01-05 03:36 +0000 [cee6de4e63] Alexander Traud * BuildSystem: Avoid obsolete warning with HELP_STRING on autoconf. ASTERISK-26046 Change-Id: I48f05698c235f709225b92bec5aa260fb57d69d1 2018-01-04 16:07 +0000 [0f141351f9] Corey Farrell * pbx: Prevent execution of NULL pointer. pbx_extension_helper has a check for q->swo.exec == NULL but it doesn't actually return so we would still run the function. Fix the return. Move the 'int res' variable into the only scope which uses it. Change-Id: I0693af921fdc7f56b6a72a21fb816ed08b960a69 2018-01-04 09:30 +0000 [d73a3a1764] Corey Farrell * res_pjsip_history: Add missing unlock to CLI command. Change-Id: I872060a30543776a176a316309602d924a23eb29 2018-01-04 09:27 +0000 [ec74570598] Corey Farrell * aco: Fix NULL dereference in error path. Change-Id: Id505167cf0f9414a3c144fa2c1e181a2cf288694 2018-01-03 19:07 +0000 [74b6fafbe6] Corey Farrell * func_odbc: Add missing unlock's to acf_odbc_read. Change-Id: I828329ecbd252ae8f27a369a046d2b03102b07c6 2018-01-03 10:41 +0000 [d25a9bc7d3] Kevin Harwell * res_pjsip_session: Check if sequence header is missing The pjsip_msg_find_hdr function can return NULL. This patch adds a check when searching for the sequence header to make sure a NULL pointer is never de-referenced. Change-Id: I19af23aeeded65be016be92360e8cb7ffe51fad2 2018-01-02 07:36 +0000 [00b0c67144] Tzafrir Cohen * cdr: submit: fix logic of test for batch mode ASTERISK-27539 #close Change-Id: I33cdf329d2bb4486dcae975c450f6aae94c515f7 2018-01-02 00:26 +0000 [dd528c53c0] Corey Farrell * aco: Add missing aco_option_type_string for OPT_TIMELEN_T. ASTERISK-27117 Change-Id: I8f6c34bb30830be9f7a40823723eb4dcaaa91c61 2017-12-29 22:59 +0000 [5b395a7b97] Corey Farrell * core: Use macros to generate ao2_container callbacks where possible. This uses AO2_STRING_FIELD_HASH_FN and AO2_STRING_FIELD_CMP_FN where possible in the Asterisk core. This removes CMP_STOP from the result of CMP_FN callbacks for the following structure types: * ast_bucket_metadata * ast_bucket_scheme * generic_monitor_instance_list (ccss.c) * named_acl Change-Id: Ide4c1449a894bce70dea1fef664dade9b57578f1 2017-12-31 10:26 +0000 [d2c836d24a] Sean Bright * ice: Increase foundation buffer size Per RFC 5245, the foundation specified with an ICE candidate can be up to 32 characters but we are only allowing for 31. ASTERISK-27498 #close Reported by: Michele Prà Change-Id: I05ce7a5952721a76a2b4c90366168022558dc7cf 2017-12-29 22:03 +0000 [b275b0a84f] Corey Farrell * astobj2: Create case-insensitive variants of container function macros. * AO2_STRING_FIELD_CASE_HASH_FN * AO2_STRING_FIELD_CASE_CMP_FN * AO2_STRING_FIELD_CASE_SORT_FN Change-Id: I11af8c6a0c43380a42732553f519c667abb842cf 2017-12-28 13:27 +0000 [751fd9b628] Richard Mudgett * stasis_channels.c: Misc cleanup. * Use current OBJ_SEARCH_xxx defines instead of the deprecated versions. * Fix hash_cb and cmp_cb container functions to correctly use the OBJ_SEARCH_xxx values. * Remove incorrect usage of CMP_STOP. Most uses in the system have no effect. This allows the collapse of channel_role_single_cmp_cb() and channel_role_multi_cmp_cb() into channel_role_cmp_cb(). * Remove unnecessary usage of RAII_VAR(). Change-Id: I02c405518cab22aa2a082b61e2353bf7cd629a70 2017-12-13 15:43 +0000 [bae301c18c] Sean Bright * cdr_mysql: Make sure connection charset is always set When the MYSQL_OPT_RECONNECT option is enabled, the MySQL client API will transparently reconnect when it needs to. Ideally this simplifies our code, but when this reconnection occurs all connection state is lost. Because we are not notified that this has happened, we don't know to set our character set again (with "SET NAMES 'xyz'"). Rather than calling SET NAMES, we instead set the MYSQL_SET_CHARSET_NAME option which will do it for us under the hood on each connect. This option has been present in the MySQL C API for at least 15 years, so it should be safe for most installations. I also snuck a few other changes into this patch: * Default the MySQL port to MYSQL_PORT (3306) instead of 0 if it's not defined. * Fix some erroneous and/or silly checks on the contents of the configuration ast_str values. ASTERISK-27366 #close Reported by: Halil İbrahim YILDIZ Change-Id: I36bf8dc5d5f83584e803b3b1a151dea9396ab8f5 2017-12-27 20:48 +0000 [5de8f49294] Richard Mudgett * manager.c: Update AMI Status event documentation The AMI Status event had linkedid listed twice and was missing the effective connected line name and number headers. NOTE: The linkedid and other standard channel snapshot fields in the XML documentation are part of the XML template defined in doc/appdocsxml.xslt. * Cached the effective connected line party id so it doesn't get calculated four times. Change-Id: I004c4c4f9e7b40ef55035c831702721bec82496c 2017-12-27 22:36 +0000 [9f1cfbafca] Richard Mudgett * bridge_native_rtp.c: Fix reentrancy framehook crash. If two channels enter different native rtp bridges at the same time it is possible that the framehook interface data pointer can be corrupted because the struct variable was declared static. * Fixed the reentrancy corruption by changing the framehook interface struct static variable to a stack local variable. * Moved the hook.data assignment outside of the channel lock. It did not need the lock's protection. It probably was giving a false sense of security. The testsuite channels/pjsip/basic_calls/two_parties/nominal/alice_initiated/bob_hangs_up test caught this with MALLOC_DEBUG and DO_CRASH enabled. Change-Id: If9e35b97d19209b0f984941c1d8eb5f7c55eea91 2017-12-27 20:22 +0000 [eead5d0c30] Richard Mudgett * func_channel.c: Update MASTER_CHANNEL documentation Be more explicit in what is meant by the master channel to eliminate misunderstanding. ASTERISK-23133 Change-Id: I453bcaf4b99404a5a3e345dbf093ac6c1afcfc72 2017-12-27 19:27 +0000 [0bdddbe526] Corey Farrell * menuselect: Fix check for running configure. menuselect/Makefile checks that autoconfig.h and makeopts were newer than the '.in' files. Unfortunately running ./configure does not touch autoconfig.h unless the contents will change. Instead of looking at autoconfig.h we just need to ensure that makeopts is newer than configure. Also make change to configure.ac so bootstrap.sh doesn't re-add the extra trailing line-feed. Change-Id: Ief1f831d6717007f9cebb668c14e92782cd2b794 2017-12-25 20:39 +0000 [d62c87bb8d] Corey Farrell * cdr: Missing NULL check and unlock. * handle_dial_message: Missing a check for NULL peer. * ast_cdr_register: Missing unlock on allocation failure. ast_cdr_register is fixed by reordering so the new structure is allocated and initialized before locking the list. Change-Id: I5799b99270d1a7a716a555c31ac85f4b00ce8686 2017-12-23 22:51 +0000 [92fb393cab] Corey Farrell * loader: Add volatile to resource_being_loaded. Some compiler optimizers seem to assume that dlopen will not use __attribute__((constructor)) functions to call back to the program. This was causing resource_being_loaded to be optimized away completely. ASTERISK-27531 #close Tested By: abelbeck Change-Id: If17a3b889e06811a0e7119f0539d052494d6ece9 2017-12-20 16:17 +0000 [53799318bc] Kevin Harwell * AST-2017-014: res_pjsip - Missing contact header can cause crash Those SIP messages that create dialogs require a contact header to be present. If the contact header was missing from the message it could cause Asterisk to crash. This patch checks to make sure SIP messages that create a dialog contain the contact header. If the message does not and it is required Asterisk now returns a "400 Missing Contact header" response. Also added NULL checks when retrieving the contact header that were missing as a "just in case". ASTERISK-27480 #close Change-Id: I1810db87683fc637a9e3e1384a746037fec20afe 2017-12-22 08:14 +0000 [ce3d56920b] Sean Bright * Remove as much trailing whitespace as possible. Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0 2017-12-21 09:51 +0000 [b4ae112e3a] Sean Bright * Fix some invalid Unicode characters configs/samples/minivm.conf.sample contains invalid UTF-8, but that appears to be intentional. Change-Id: I7b1e0d332f3380fd0425962a3c9c55f9b200c8cc 2017-12-20 21:11 +0000 [719e8eee03] Corey Farrell * app_voicemail: Fix file copy error handling. Fix error where input/output file descriptors would be closed multiple times. Change-Id: Iba5140b60cb7de79e3d5d92be3c256947aa99da9 2017-12-20 14:54 +0000 [6892c13a2c] Sean Bright * docs: Remove old API changes documentation Change-Id: I1bc7957121cc7ae27dca04acc3613f4e1858476a 2017-12-20 11:14 +0000 [82b6ba976f] Corey Farrell * Fix Common Typo's. Fix instances of: * Retreive * Recieve * other then * different then * Repeated words ("the the", "an an", "and and", etc). * othterwise, teh ASTERISK-24198 #close Change-Id: I3809a9c113b92fd9d0d9f9bac98e9c66dc8b2d31 2017-12-20 11:30 +0000 [4f45748f52] Richard Mudgett * manager.h: Bump AMI version Change-Id: I62e6ddeb261ef012687e1fb6734c554e2499b6bf 2017-12-20 00:53 +0000 [6b3188fb8c] Corey Farrell * app_festival: Fix fd leak on connection failure. Change-Id: If5efaddcf735ff7d17e55c36cc1388946cee9e0f 2017-12-20 10:23 +0000 [be3800c49d] Corey Farrell * bridge: Old channel video source not set to NULL after unref. The bridge holds onto the old channel video source after it's been released. This can lead to use after free errors. ASTERISK-27229 #close Change-Id: Ib2dab61677dd8a21f7ad53cdc9b8ca93297838b3 2017-12-20 10:13 +0000 [d05ec48145] Corey Farrell * core: Fix unused variable error in handle_show_sysinfo. Apparently in OSX it's possible for OSX to HAVE_SYSCTL but not HAVE_SYSINFO or HAVE_SWAPCTL. In this case freeswap caused an unused variable error. ASTERISK-26563 #close Change-Id: I8ec5b1897b786cc1abaf62264aa75039eea05510 2017-12-18 20:12 +0000 [9adffca9c7] Corey Farrell * CLI: Address multiple issues. * listen uses the variable `s` for the result from ast_poll() then overwrites it with the result of accept(). Create a separate variable poll_result to avoid confusion since ast_poll does not return a file descriptor. * Resolve fd leak that would occur if setsockopt failed in listen. * Reserve an extra byte while processing completion results from remote daemon. This fixes a bug where completion processing used strstr() on a string that was not '\0' terminated. This was no risk to the Asterisk daemon, the bug was only reachable the remote console process. * Resolve leak in handle_showchan when the channel is not found. * Multiple leaks and a deadlock in pbx_config CLI completion. * Fix leaks in "manager show command". Change-Id: I8f633ceb1714867ae30ef4e421858f77c14485a9 2017-12-19 14:15 +0000 [c38b750810] Aaron An * res_rtp_asterisk: Avoid close the rtp/rtcp fd twice. When RTCP-MUX enabled. rtp->s is the same as rtcp->s, check this before close the file descriptor. Close the FD twice will hangs the asterisk under heavy load. ASTERISK-27299 #close Reported-by: Aaron An Tested-by: AaronAn Change-Id: I870a072d73fd207463ac116ef97100addbc0820a 2017-12-16 07:51 +0000 [fef23297b7] Ivan Poddubny * bridge: Stop music on hold on adding an arbitrary channel to a bridge When a channel that is on hold gets added to a bridge by the Bridge AMI action or the dialplan application of the same name, music continues to play, causing "robotic sound". This commit adds a call to ast_moh_stop to stop the music. Also, it makes the AMI Park action use the right MOH class when the channel gets parked. Reported by: Zane Conkle ASTERISK-25079 #close Change-Id: I4b129c5a20c15e63968842460ac5a1a85903cf9f 2017-12-18 18:59 +0000 [0e5d8ad09b] Corey Farrell * chan_sip: Fix memory leaks. In change_redirecting_information variables we use ast_strlen_zero to see if a value should be saved. In the case where the value is not NULL but is a zero length string we leaked. handle_response_subscribe leaked a reference to the ccss monitor instance. Change-Id: Ib11444de69c3d5b2360a88ba2feb54d2c2e9f05f 2017-12-19 02:50 +0000 [fc86e58a5a] Oron Peled * chan_console: Use correct parameter for 'set active' chan_console supports multiple devices but the CLI only works on a single device. 'console set active' selects this device. Sadly that CLI picks the wrong command-line parameter and will only work for a device called 'active'. ASTERISK-27490 #close Change-Id: I2f0e5fe63db19845bee862575b739360797dc73d 2017-12-18 15:36 +0000 [d6b2f457d9] Corey Farrell * Remove constant conditionals (dead-code). Some variables are set and never changed, making them constant. This means that code in the 'false' block of the conditional is unreachable. In chan_skinny and res_config_ldap I used preprocessor directive `#if 0` as I'm unsure if the unreachable code could be enabled in the future. Change-Id: I62e2aac353d739fb3c983cf768933120f5fba059 2017-12-18 23:17 +0000 [381ed4f1cc] Corey Farrell * core: Fix multiple trivial issues in the core. * Fix small leaks in from error condition in translate.c. * Check new file descriptor is less than 0, not less than or equal. Change-Id: Id7782775486175c739e0c4bf3ea5e17e3f452a99 2017-12-18 19:47 +0000 [67b5a4e616] Corey Farrell * main/app: Fix leaks. * ast_linear_stream would leak a file descriptor if it failed to allocate lin. * ast_control_tone leaked zone and ts if ast_playtones_start failed. Additionally added whitespace to ast_linear_stream, pulled assignments out of conditionals for improved readability. Change-Id: I6d1a10cf9161b1529d939b9b2d63ea36d395b657 2017-12-18 19:19 +0000 [3782230e00] Corey Farrell * func_callerid: Initialize app argument structures. This module uses AST_DEFINE_APP_ARGS_TYPE to define struct's instead of directly using AST_DECLARE_APP_ARGS. Initialize the variables declared in this way. Change-Id: If97fbdd8d63a204e2efd498a192effc14e90fb31 2017-12-18 18:04 +0000 [1d636f4afa] Corey Farrell * app_voicemail: Fix memory management issues. * mwi_sub_event_cb: mwist leaked on separate_mailbox failure. * add_email_attachment: A reference to sox_gain_tmpdir was used after the storage was out of scope. Change-Id: I6282c542ff7b82fa091177a912d11234a8b00a30 2015-11-11 17:20 +0000 [5801917a75] Richard Mudgett * ast_json_pack(): Use safer json ref mechanism. Change-Id: I49204db2e57ae96eee43909c18ed007c09ac817e 2015-11-11 16:52 +0000 [46ed7afdd9] Richard Mudgett * rtp_engine.c: Eliminate rtcp_report_to_json() RAII_VAR usage. Change-Id: I58a22c2ca82e91d7537409b7b3af2d735827a54d 2017-12-18 12:23 +0000 [5cdc65cf1e] Corey Farrell * CLI: Fix 'core set debug channel' completion bug. The completion generator is missing a return so typing "core set debug all off " causes the command to actually execute. Change-Id: Ibf6462088a74eee66967732b50445783ebefc20b 2017-12-18 08:25 +0000 [7f2df9e277] Joshua Colp * confbridge: Clarify mute sound documentation. The mute/unmute sounds are only played when the action is initiated using the DTMF menu. ASTERISK-24756 Change-Id: I55b3dd5bc166096bf5e2f547ddd0ce355f36e3dc 2017-12-18 06:36 +0000 [4cda942ebd] Joshua Colp * app_transfer: Remove LOCAL from documentation. The Local channel has never supported app_transfer from what I can see so remove it from the documentation. ASTERISK-25649 Change-Id: Icbcfe297f6f866285a26b3e9fd5c6d00fa22e0e9 2017-12-15 19:01 +0000 [a368ad9229] Richard Mudgett * chan_pjsip.c: Improve ast_request() diagnostic msgs. Attempting to dial PJSIP/endpoint when the endpoint doesn't exist and disable_multi_domain=no results in a misleading empty endpoint name message. The message should say the endpoint was not found. * Added missing endpoint not found message. * Added more information to the empty endpoint name msgs if available. * Eliminated RAII_VAR in request(). Change-Id: I21da85ebd62dcc32115b2ffcb5157416ebae51e4 2017-12-15 10:26 +0000 [b3b7367e6b] Corey Farrell * cdr: Minor optimizations. * bridge_candidate_process: remove SCOPED_AO2LOCK and return value. * handle_standard_bridge_enter_message: replace recursive call with goto statement. ASTERISK-24297 Change-Id: Id2eaa0822fb8dc799f63422bb3aa89de9d4ee2a2 2017-12-11 17:07 +0000 [8921b2581d] Corey Farrell * loader: Use vector to build apha sorted module lists. Change-Id: I9c519f4dec3cda98b2f34d314255a31d49a6a467 2017-11-21 00:28 +0000 [d5a7a98528] Corey Farrell * loader: Replace priority heap with vector. This is needed for future changes which will require being able to process the load priority out of order. Change-Id: Ia23421197f09789940510b03ebbbf3bf24d51bea 2017-11-20 23:10 +0000 [5e9d70ae5d] Corey Farrell * loader: Rework of load_dynamic_module. * Split off load_dlopen to perform actual dlopen, check results and log warnings when needed. * Use flags which minimize number of calls to dlopen required. First attempt always uses RTLD_GLOBAL when global_symbols_only is enabled, RTLD_LOCAL when it is not. This patch significantly reduces the number of dlopen's performed. With 299 modules my system ran dlopen 857 times before this patch, 655 times after this patch. Change-Id: Ib2c9903cfddcc01aed3e01c1e7fe4a3fb9af0f8b 2017-11-21 20:34 +0000 [4de95d4bf0] Corey Farrell * loader: Minor fix to module registration. This protects the module loader itself against crashing if dlopen is called on a module from outside loader.c. * Expand scope of lock inside ast_module_register to include reading of resource_being_loaded. * NULL check resource_being_loaded. * Set resource_being_loaded NULL as soon as dlopen returns. This fixes some error paths where it was not NULL'ed. * Create module_destroy function to deduplicate code from ast_module_unregister and modules_shutdown. * Resolve leak that occured if a module did not successfully register. * Simplify checking for successful registration. Change-Id: I40f07a315e55b92df4fc7faf525ed6d4f396e7d2 2016-10-06 01:29 +0000 [e3bd95f55c] Corey Farrell * chan_sip: Add security event for calls to invalid extension. Log a message to security events when an INVITE is received to an invalid extension. ASTERISK-25869 #close Change-Id: I0da40cd7c2206c825c2f0d4e172275df331fcc8f 2017-12-12 12:55 +0000 [501f4dcdd8] Corey Farrell * aco: Minimize use of regex. Remove nearly all use of regex from ACO users. Still remaining: * app_confbridge has a legitamate use of option name regex. * ast_sorcery_object_fields_register is implemented with regex, all callers use simple prefix based regex. I haven't decided the best way to fix this in both 13/15 and master. Change-Id: Ib5ed478218d8a661ace4d2eaaea98b59a897974b 2017-12-12 12:36 +0000 [7413bcbeb5] Corey Farrell * aco: Create ways to minimize use of regex. ACO uses regex in many situations where it is completely unneeded. In some cases this doubles the total processing performed by aco_process_config. * Create ACO_IGNORE category type for use in place of skip_category regex source string. * Create additional aco_category_op values to allow specifying category filter using either a single plain string or a NULL terminated array of plain strings. * Create ACO_PREFIX to allow matching option names to case insensitive prefixes. Change-Id: I66a920dcd8e2b0301f73f968016440a985e72821 2017-12-15 07:56 +0000 [8165115faa] Corey Farrell * res_smdi: Fix shutdown ref. When adding shutdown refs for OPTIONAL_API components I accidentally added it to the unload_module function in res_smdi. Move it to load_module. Change-Id: I2b9da38fbc11ef78ea23dbb2df92b684be7f647c 2017-12-14 18:55 +0000 [8338f3ec14] Sean Bright * res_hep: hepv3_is_loaded() should check if we are enabled res_hep_pjsip.so and res_hep_rtcp.so will still load and do a lot of unnecessary work even if 'enabled' is set to 'no' in hep.conf. Change-Id: I3eddfeea09c6b5bc7c641952ee0ae487fd09b64b 2017-12-14 15:27 +0000 [85dec2ae4f] Corey Farrell * res_clialiases: Fix completion pass-through. Never ignore contents of line when generating completion options. Change-Id: I74389efdfea154019d3b56a9f381610614c044c8 2017-12-11 18:20 +0000 [61e81338d9] Richard Mudgett * res_rtp_asterisk.c: Disable packet flood detection for video streams. We should not do flood detection on video RTP streams. Video RTP streams are very bursty by nature. They send out a burst of packets to update the video frame then wait for the next video frame update. Really only audio streams can be checked for flooding. The others are either bursty or don't have a set rate. * Added code to selectively disable packet flood detection for video RTP streams. ASTERISK-27440 Change-Id: I78031491a6e75c2d4b1e9c2462dc498fe9880a70 2017-12-14 12:14 +0000 [62e743e6a7] Sean Bright * res_musiconhold: Start playlist after initial announcement Reset the samples counter to zero when we are done playing an announcement so that we don't skip into the middle of the first file in the playlist. Also add the selected annoucement to the output of 'moh show classes.' ASTERISK-24329 #close Reported by: Thomas Frederiksen Change-Id: I2a5f986a31279c981592f49391409ebf38d6f6d0 2017-12-14 10:51 +0000 [74073c395b] Sean Bright * coverity: Fix warnings in res_smdi ASTERISK-19657 #close Reported by: Matt Jordan III, Esq. Change-Id: I59a5e6ef3e7d9e848bec1f4b40cb73321bc7956a 2017-12-14 10:22 +0000 [a1fcb7b5a6] Sean Bright * configs: Comment out and change IP of iax.conf [demo] This no longer appears to exist, so no sense in causing confusion. ASTERISK-27175 #close Reported by: Tzafrir Cohen Change-Id: Idde967924c69f6a741dc9a5ab7dacb44d22cf100 2017-12-13 14:26 +0000 [6d290f1880] George Joseph * README: Remove outdated references to tex docs Added links to the wiki to replace references to outdated tex docs. ASTERISK-27430 Reported by: Corey Farrell Change-Id: I5007e732b30bc7b63d124c530ae8857c89991209 2017-12-13 09:50 +0000 [dd72844e4d] Corey Farrell * CLI: Remove special handling of 'core set verbose' from rasterisk. rasterisk does not need to handle setting verbose levels locally, it should just tell the daemon what it wants and print what it is given. Just max out the verbose level on the local client so all filtering happens on the daemon. ASTERISK-20281 #close Change-Id: Ia305f75f1fc424a9169bfa30ef70d626ace2c8a8 2017-11-30 10:12 +0000 [5705e8ae0e] Joshua Colp * AST-2017-012: Place single RTCP report block at beginning of report. When the RTCP code was transitioned over to Stasis a code change was made to keep track of how many reports are present. This count controlled where report blocks were placed in the RTCP report. If a compound RTCP packet was received this logic would incorrectly place a report block in the wrong location resulting in a write to an invalid location. This change removes this counting logic and always places the report block at the first position. If in the future multiple reports are supported the logic can be extended but for now keeping a count serves no purpose. ASTERISK-27382 ASTERISK-27429 Change-Id: Iad6c8a9985c4b608ef493e19c421211615485116 2017-12-06 08:24 +0000 [7a68faeb1d] Joshua Colp * pjsip: Ignore state changes from old transactions. When we fail over to a new target we create a new transaction and it becomes the current INVITE transaction. This does not prevent the previous transaction from raising state changes and causing the session to be prematurely disconnected if a transport error occurs immediately. This change backports a fix from PJSIP that eliminates the incorrect state change and reduces when they would be raised in the first place. ASTERISK-27408 Change-Id: Id22d087591782eee31311753d11e7eca4b95ef34 2017-12-12 15:38 +0000 [7ffc41d19f] Ivan Poddubny * app_queue: Fix extension state subscriptions removed on dialplan reload The approach with having a single global subscription to all extension state changes has one issue: dynamically created hints don't have any watchers and are therefore garbage collected on the first dialplan reload. This change creates a state subscription for every queue member with a hint as state_interface, thus increasing the count of watches for hints, so they are not destroyed prematurely anymore. There are 2 side effects: 1. The state change callback in app_queue is not executed when there are no members referring to the extension. 2. The callback is called multiple times for the same hint if it's associated with more than one queue member. Reported by: Steven T. Wheeler ASTERISK-18411 #close Change-Id: I4956af2136ea2a7f110ac9272eae5f6e676d8f89 2017-12-12 15:28 +0000 [e1a358a6e4] Sean Bright * chan_sip: Don't send trailing \0 on keep alive packets This is a partial fix for ASTERISK~25817 but does not address the comments regarding RFC 5626. Change-Id: I227e2d10c0035bbfa1c6e46ae2318fd1122d8420 2017-12-12 15:19 +0000 [ce2c89ce68] Dwayne Hubbard * chan_sip: Don't crash in Dial on invalid destination Stripping the DNID in a SIP dial string can result in attempting to call the argument parsing macros on an empty string, causing a crash. ASTERISK-26131 #close Reported by: Dwayne Hubbard Patches: dw-asterisk-master-dnid-crash.patch (license #6257) patch uploaded by Dwayne Hubbard Change-Id: Ib84c1f740a9ec0539d582b09d847fc85ddca1c5e 2017-12-12 15:16 +0000 [6632f61153] Corey Farrell * menuselect: Tweak check for recently run configure. Recently menuselect has randomly produced an error stating that configure was just run and make had to be restarted. I believe this is due to an incorrect menuselect/Makefile rule. The original rule produced an error if makeopts or autoconfig.h were older than makeopts.in or autoconfig.h.in. I believe this can create an issue if makeopts is older than autoconfig.h.in or if autoconfig.h is older than makeopts.in. The new rules compare files independently. Change-Id: Ibca155035fa1392c95e33cbf25f257902abba17b 2017-12-07 17:51 +0000 [73b3390dbe] Richard Mudgett * chan_pjsip/res_pjsip: Add CHANNEL(pjsip,request_uri) This patch does three things associated with the initial incoming INVITE request URI. 1) Add access to the full initial incoming INVITE request URI. 2) We were not setting DNID on incoming PJSIP channels. The DNID is the user portion of the initial incoming INVITE Request-URI. The value is accessed by reading CALLERID(dnid). 3) Fix CHANNEL(pjsip,target_uri) documentation. * The initial incoming INVITE request URI is now available using CHANNEL(pjsip,request_uri). * Set the DNID on PJSIP channel creation so CALLERID(dnid) can return the initial incoming INVITE request URI user portion. * CHANNEL(pjsip,target_uri) now correctly documents that the target URI is the contact URI. * Refactored print_escaped_uri() out of channel_read_pjsip() to handle pjsip_uri_print() error condition when the buffer is too small. ASTERISK-27478 Change-Id: I512e60d1f162395c946451becb37af3333337b33 2017-12-12 09:28 +0000 [ca448bf150] Sean Bright * res_pjsip: Add TLSv1.1 and TLSv1.2 support Support for these protocols was added in the same commit as the 'proto' field, so we can safely use the same ./configure check. For reference: https://trac.pjsip.org/repos/changeset/4968 Change-Id: Icf4975d785d6bfb8f30ac7ffa695a0adf9382dac 2017-12-12 08:06 +0000 [d9b932a455] Sean Bright * res_pjsip: Assign support levels to a few modules Change-Id: I51f6945c4023cb93fc7b87be5ab4c50e9e6ee27d 2017-12-09 00:35 +0000 [4decf4e492] Corey Farrell * CLI: Fix 'core show sysinfo' function ordering. Handle CLI initialization before any processing occurs. Change-Id: I598b911d2e409214bbdfd0ba0882be1d602d221c 2017-12-08 12:04 +0000 [28eddc7ea6] Richard Mudgett * stasis_channels.c: Don't set channel snapshot caller_dnid twice. Change-Id: Ib8d45bbdfbda81e65045f6dff874d189b74e5471 2017-12-11 09:45 +0000 [028f4320de] Sean Bright * codec_opus: Make libcurl a dependency in menuselect ASTERISK-27475 #close Change-Id: If7384bc6ed002ef140dec69798d14c52b7cfd800 2017-12-08 12:48 +0000 [4838557132] Sean Bright * pjsip: Improve CLI completion performance Use the new ast_cli_completion_add() function to improve completion performance for commands like 'pjsip show endpoint.' Change-Id: I76d802294d2ac1766110dc75f7d117c8541ce348 2017-12-07 14:19 +0000 [a4b291029f] Sean Bright * astdb: Improve prefix searches in astdb Using the LIKE operator requires a full table scan of 'astdb', whereas a comparison operation is able to use the primary key index. This patch adds a new function to the AstDB API for quick prefix matches and updates res_sorcery_astdb to utilize it. This showed substantial performance improvement in my test environment. Related to ASTERISK~26806, but does not completely resolve it. Change-Id: I7d37f9ba2aea139dabf2ca72d31fbe34bd9b2fa1 2017-12-08 18:19 +0000 [9fc4f10e0e] Corey Farrell * loader: Refactor resource_name_match. Optimize resource_name_match. This change eliminates use of ast_strdupa, instead verifying that both basename's are the same length, then using strncasecmp. Change-Id: I477275c0e954c99d74be5abfc8bb6545b04e5a3d 2017-12-08 14:58 +0000 [c3bc44fa1b] Sean Bright * pjsip_configuration: Add correct file header Change-Id: I25348c386a222bb704aff07f54375108a6402906 2017-12-07 09:52 +0000 [f726f11974] Sean Bright * utils: Add convenience function for setting fd flags There are many places in the code base where we ignore the return value of fcntl() when getting/setting file descriptior flags. This patch introduces a convenience function that allows setting or clearing file descriptor flags and will also log an error on failure for later analysis. Change-Id: I8b81901e1b1bd537ca632567cdb408931c6eded7 2017-12-07 19:41 +0000 [3d79c34350] Corey Farrell * res_stasis and res_speech: Fix load order. res_stasis was missing AST_MODFLAG_LOAD_ORDER. Set res_stasis and res_speech to start at (AST_MODPRI_APP_DEPEND - 1) so they are ready for dependent modules. Change-Id: I27f4f3810a95b6be8a5bfbf62be2ace6bfab6ff3 2017-12-07 18:22 +0000 [ecdccb8071] Kevin Harwell * pjsip_options: contacts sometimes not being updated on reload For both dynamic and static contacts it was possible that potential AOR changes were not being applied to all contacts. This was because the qualify and schedule code was only retrieving AOR's, and contacts with frequencies greater than zero. For instance the following could happen: and AOR/contact has a frequency of 5, it then gets set to 0, and then a reload occurs. All scheduled OPTIONS are stopped, a list of AOR's is retrieved with frequency > 0, but none are selected since in this scenario all are 0. The contact for the one previously set to 5 though does not get updated, so it's status remains "AVAILABLE". This patch makes it so all contacts (static and dynamic) are selected, and appropriately updated if need be. ASTERISK-27467 #close Change-Id: I7a920170f89c683af9505d4723a44fc6841decdb 2017-12-07 18:18 +0000 [f20ab2b65f] Kevin Harwell * pjsip_options: dynamic contact's fields not updated on reload Dynamic contacts were not being properly updated on reload. As a matter of fact any changes to the AOR that a dynamic contact was associated with were not being applied. On reload, this patch makes it so for each dynamic contact, the associated AOR is now retrieved and the AOR's fields are applied to the contact. ASTERISK-27467 Change-Id: I8e3165dc6a745218c1c9db837f77fafa0516985d 2017-12-07 10:35 +0000 [5a0dcd9275] Corey Farrell * CLI: Fix remote console completion. Duplicate checking was done incorrectly when parsing completion options from a remote console causing all options to be ignored as duplicates. Once fixed I had to separate processing of the best match to ensure it was not identified as a duplicate when it is the only match. ASTERISK-27465 Change-Id: Ibbdb29f88211742071836c9b3f4d2aa1221cd0f9 2017-12-06 23:35 +0000 [2691ee68ce] Corey Farrell * translate: Skip matrix_rebuild during shutdown. Change-Id: I1e5eef4029cba56e33d786c5a5ade8091e531a1e 2017-12-06 14:49 +0000 [db6602f6f7] Corey Farrell * sounds_index: Avoid repeatedly reindexing. The sounds index is rebuilt each time a format is registered or unregistered. This causes the index to be repeatedly rebuilt during startup and shutdown. This patch significantly reduces the work done by delaying sound index initialization until after modules are loaded. This way a reindex only occurs if a format module is loaded after startup. We also skip reindexing when format modules are unloaded during shutdown. Change-Id: I585fd6ee04200612ab1490dc804f76805f89cf0a 2017-12-06 12:42 +0000 [289549d659] Corey Farrell * media_index: Improve startup. This eliminates some wasteful operations in media_index startup. * Replace statically set string-fields with char[0]. * Eliminate pointless RAII_VAR's. * alloc_variant: Avoid pointless ao2_find on new info->variant. * Stop trying find_variant before alloc_variant. * process_media_file: replace ast_str with ast_asprintf. This avoids reallocation of file_id_str. Overall sounds_index.c is about 27% of Asterisk startup time when using sample configs. This patch reduces it to 20%. This is a half-fix. The real problem is that the media_index is regenerated repeatedly - 68 times in my test. Change-Id: Ia50b752f8efb356f852b05c4be495a6631af8652 2017-12-05 18:04 +0000 [f59a75c6fa] Richard Mudgett * CDR: Fix deadlock setting some CDR values. Setting channel variables with the AMI Originate action caused a deadlock when you set CDR(amaflags) or CDR(accountcode). This path has the channel locked when the CDR function is called. The CDR function then synchronously passes the job to a stasis thread. The stasis handling function then attempts to lock the channel. Deadlock results. * Avoid deadlock by making the CDR function handle setting amaflags and accountcode directly on the channel rather than passing it off to the CDR processing code under a stasis thread to do it. * Made the CHANNEL function and the CDR function process amaflags the same way. * Fixed referencing the wrong message type in cdr_prop_write(). ASTERISK-27460 Change-Id: I5eacb47586bc0b8f8ff76a19bd92d1dc38b75e8f 2017-12-06 07:36 +0000 [93859f9aca] Richard Mudgett * bridge_basic.c: Update transfer diagnostic messages addendum. * Added start DTMF transfer verbose messages. * Made associated transfer messages use a similar message format. * Adjusted message verbose level as requested by initial reporter. ASTERISK-27449 Change-Id: I2045714586414b3c5ef1f3cc56c1c4af4b31f551 2017-11-29 06:21 +0000 [aacdbdcfd2] Niklas Larsson * bridge_basic.c: Update transfer diagnostic messages. * Add the channel name to diagnostic messages so you will know which channel failed to transfer. * Promoted some debug messages to verbose 4 messages. ASTERISK-27449 #close Change-Id: Idac66b7628c99379cc9269158377fd87dc97a880 2017-12-01 13:54 +0000 [594faa192d] Richard Mudgett * security-events: Fix SuccessfulAuth using_password declaration. The SuccessfulAuth using_password field was declared as a pointer to a uint32_t when the field was later read as a uint32_t value. This resulted in unnecessary casts and a non-portable field value reinterpret in main/security_events.c:add_json_object(). i.e., It would work on a 32 bit architecture but not on a 64 bit big endian architecture. Change-Id: Ia08bc797613a62f07e5473425f9ccd8d77c80935 2017-12-04 03:40 +0000 [e7201c93cc] Sungtae Kim * Add new object for VoicemailUserEntry Currently, when the app_voicemail sending VoicemailUserEntry AMI event, there's no OldMessageCount info for default. To check the OldMessageCount info, it required IMAP_STORAGE define, but this is not correct. Added OldMessageCount item as a default. ASTERISK-27456 Change-Id: I5c71521c2d1daf8b7b161e31c34d28cca6aea4c7 2017-11-30 12:50 +0000 [9330eacc50] Richard Mudgett * res_rtp_asterisk.c: Increase strictrtp learning timeout time. More complicated direct media reinvite negotiations can result in longer delays before direct media flows. The strictrtp learning timeout time was too short. One log showed that the first RTP packet came in just after three seconds. * Increase the strictrtp learning timeout time from 1.5 to 5 seconds. ASTERISK-27453 Change-Id: Ic5e711164cbb91b4d1c1e40c83697755640f138c 2017-12-04 08:33 +0000 [e819cf7826] Alexander Traud * res_rtp_asterisk: Correct default in sample configuration file. With Asterisk 12 (commit 866d968), the default of "icesupport" changed to - "yes" in the module "res_rtp_asterisk" and - "no" in the module "chan_sip". The latter was reflected in the sample configuration file for "sip.conf". The former did not make it into "rtp.conf.sample". ASTERISK-20643 Change-Id: I2a2e0a900455d0767a99ea576e30adc6d7608a36 2017-12-04 05:27 +0000 [64942276d1] Alexander Traud * chan_sip: Peers with distinct source ports don't match, regardless of transport. Previously, peers connected via TCP (or TLS) were matched by ignoring their source port. One cannot say anything when protocol:IP:port match, yes (see ). However, when the ports do not match, the peers do not match as well. This change allows two peers connected to an Asterisk server via TCP (or TLS) behind a NAT (= same source IP address) to be differentiated via their port as well. ASTERISK-27457 Reported by: Stephane Chazelas Change-Id: Id190428bf1d931f2dbfd4b293f53ff8f20d98efa 2017-12-03 18:49 +0000 [41c14fd807] Joshua Colp * pjproject: Clean up disabling of WebRTC support. The definition in config_site.h and the argument to the configure script are not necessary to disable WebRTC support. The correct argument, --disable-libwebrtc, is already passed. ASTERISK-26980 Change-Id: I27da2c894f87914956a72710222e17462d8a44bc 2017-12-02 15:55 +0000 [f5cfd87c4a] Corey Farrell * autoconf: Remove use of m4_ifblank. The m4_ifblank macro is not available on CentOS 6, reverse conditionals to allow use of m4_ifval instead. ./bootstrap.sh was run but this patch does not result in any difference to the generated configure script. Change-Id: I280785deb872ed8d3339d99cce63a2b54d5f1438 2017-12-01 16:18 +0000 [ef25628b10] Corey Farrell * README-SERIOUSLY.bestpractices.txt: Convert to markdown Follow-up to conversion of README.md. Change-Id: I17ee7cf25bc027ece844efa2c1dfe613aff1e35b 2017-11-30 14:38 +0000 [0cdd31ee10] George Joseph * AST-2017-013: chan_skinny: Call pthread_detach when sess threads end chan_skinny creates a new thread for each new session. In trying to be a good cleanup citizen, the threads are joinable and the unload_module function does a pthread_cancel() and a pthread_join() on any sessions that are active at that time. This has an unintended side effect though. Since you can call pthread_join on a thread that's already terminated, pthreads keeps the thread's storage around until you explicitly call pthread_join (or pthread_detach()). Since only the module_unload function was calling pthread_join, and even then only on the ones active at the tme, the storage for every thread/session ever created sticks around until asterisk exits. * A thread can detach itself so the session_destroy() function now calls pthread_detach() just before it frees the session memory allocation. The module_unload function still takes care of the ones that are still active should the module be unloaded. ASTERISK-27452 Reported by: Juan Sacco Change-Id: I9af7268eba14bf76960566f891320f97b974e6dd 2017-12-01 10:01 +0000 [6635ddc819] Sean Bright * config: Speed up config template lookup ast_category_get() has an (undocumented) implementation detail where it tries to match the category name first by an explicit pointer comparison and if that fails falls back to a normal match. When initially building an ast_config during ast_config_load, this pointer comparison can never succeed, but we will end up iterating all categories twice. As the number of categories using a template increases, this dual looping becomes quite expensive. So we pass a flag to category_get_sep() indicating if a pointer match is even possible before trying to do so, saving us a full pass over the list of current categories. In my tests, loading a file with 3 template categories and 12000 additional categories that use those 3 templates (this file configures 4000 PJSIP endpoints with AOR & Auth) takes 1.2 seconds. After this change, that drops to 22ms. Change-Id: I59b95f288e11eb6bb34f31ce4cc772136b275e4a 2017-12-01 08:29 +0000 [077ceacd48] Sean Bright * config: Speed up ACO & sorcery initialization When starting Asterisk in the foreground, there is a perceptible delay when loading modules that use the ACO and sorcery config frameworks. For example, a lightly configured res_pjsip took 853ms to load on my VM. I tracked down the slowness to the XPath queries used to associate the relevant documentation with the config options. One improvement was adding a call to xmlXPathOrderDocElems after loading an XML document. From the libxml2 docs: Call this routine to speed up XPath computation on static documents. The second change was to remove recursive descent and wildcard operators from the XPath queries. After these changes, res_pjsip takes 85ms to load on my VM and there is no longer a perceptible delay when starting Asterisk in the foreground. Change-Id: I45d457f1580e26bf5a2b0dab16e8e9ae46dcbd82 2017-12-01 06:07 +0000 [dac70daf1b] Joshua Colp * res_http_post: Not all versions of gmime have GMIME_MAJOR_VERSION. This change makes the presence of the GMIME_MAJOR_VERSION definition optional, as not all versions of gmime actually define it. ASTERISK-27454 Change-Id: I01d99590045971ed6787899147170a5954077238 2017-11-17 10:38 +0000 [6274e58a25] Corey Farrell * autoconf: Use m4 conditionals where possible. Change-Id: I530c0a72f965437acef6a9a4fbfe5c487f078b65 2017-11-17 09:15 +0000 [635fe8ec87] Corey Farrell * autoconf: Fix call to AC_CONFIG_AUX_DIR. The `pwd` parameter to AC_CONFIG_AUX_DIR is unnecessary, the default value is $srcdir. Additionally remove the AC_REVISION call. It only added a comment and is pointless without SVN tag replacements. Change-Id: I99299a3217f095bddcb2edefb3b9af0ab147bc29 2017-11-26 11:47 +0000 [c46cab49a3] Alexander Traud * translate: Transcode siren14, speex32, silk24, and silk12 via slin16. When a format has no pre-recorded sound files, Asterisk has to transcode between formats. For this, Asterisk has a fixed translation table. If the pre-recorded sound files are not available in the same sample rate, Asterisk has not only to transcode but also to resample. Asterisk has pre-recorded files for SLN (8000 kHz) and SLN16 (16000 kHz). However before this change, Asterisk did not take the sample rate into account, because the translation paths to SLN and SLN16 got the same score/weight in the table. Consequently, you might have got narrow-band audio with siren14, speex32, silk24, and silk12 although those are (ultra) wide-band audio codecs. With this change, the distance in sample-rates is taken into account. Now on the Command-Line interface (CLI) 'core show channels', you should see: (slin@16000)->(slin@32000)->(speex@32000). ASTERISK-23735 Reported by: Richard Kenner Change-Id: I9448295c1978be26f8633b6066395e7bbbe2e213 2017-11-26 09:44 +0000 [81e2d8aa9a] Richard Mudgett * res_ari: Fix inverted test giving wrong error message. The patch for ASTERISK_24560 inverted a test checking if the bridge name is being updated to a different name. * Fix the test to return "Changing bridge name is not implemented" when someone attempts to change the bridge name. ASTERISK-27445 Change-Id: I4b70bf08b0e02e016108b077ff75b345dec12fc9 2017-11-25 04:09 +0000 [0f719aa051] Alexander Traud * translate: Show sample rate for silk, speex, and slin in translation table. ASTERISK-24662 Change-Id: I3822956984292c99c48bca8e97807e498ccc0e88 2017-11-23 13:27 +0000 [8dd9a79e6e] Richard Mudgett * features.conf.sample: Clarify ActivatedBy documentation wording. Change-Id: Id2899331fe05d1909a862ea879742879d086bc64 2017-11-22 18:37 +0000 [a78d747ee8] Corey Farrell * Add defaultbranch to .gitreview. This will cause `git review` to post changes to the branch it is based on instead of always using master. The defaultbranch setting should be updated when new major branches are created. Change-Id: I3db009217c5ae399fb84bee95076f4dbb7fa52d2 2017-11-22 18:43 +0000 [d6568aa72a] Alexander Anikin * add cmd connection creation on creation ooh323 call data structure ASTERISK-27353 #close Reported by: Marco Giordani Change-Id: I455096bd7da016b871afe09af86067c2c7c9f33f 2017-11-22 10:42 +0000 [5abab0a34c] Kevin Harwell * pjsip: 183 without To tag does not negotiate media If a 183 with sdp response is receive without a To tag the sdp is not negotiated. According to RFC 3261 section 12.1.2 while a To tag is required, the client needs to still be able to handle the missing tag case for backwards compatibility. This patch, accepted by and applied to pjproject, makes it so if an incoming 180/183 with SDP comes in without a To tag it gets appropriately handled. ASTERISK-27442 #close Change-Id: Ic9d6b01e05e8f4874eebbd7adfe05d932025d203 2017-11-21 06:39 +0000 [6ebe03d4b3] Alexander Traud * res_rtp_asterisk: ICE server-reflexive candidates (srflx) with Dual-Stack. Previously, Asterisk sent srflx only when configured exclusively for IPv4. Now, srflx is gathered and sent via SDP, even when Asterisk is enabled for Dual Stack (IPv4+IPv6) and an IPv4 interface is available/used. ASTERISK-27437 Change-Id: Ie07d8e2bfa7b6fe06fcdc73d390a7a9a4d8c0bc1 2017-11-20 13:05 +0000 [2bff38b8a8] Corey Farrell * res_parking: Make load_pri explicit. res_parking has an implicit load_pri of 0 meaining it's one of the very first modules loaded after modules with global symbols. Set it explicitly in the AST_MODULE_INFO block. Change-Id: I297b6fb3ff6993ec004e667b22a74f5925906259 2017-11-21 09:16 +0000 [c6e1e6e968] Corey Farrell * README: Convert to README.md. Convert the README file to markdown format, remove the old README. This causes websites like github to display the README in a much nicer format with live links. The raw file is still very readable from plain text editors and terminals. Change-Id: I7d13131764a9a9026e5f8a6ddb245a01bbd788e7 2017-11-20 16:48 +0000 [e9ba6a6b88] Corey Farrell * CLI: Finish conversion of completion handling to vectors. Change-Id: Ib81318f4ee52a5e73b003316e13fe9be1dd897a1 2017-11-07 15:34 +0000 [26a400c67a] Corey Farrell * CLI: Refactor cli_complete. * Stop using "_COMMAND NUMMATCHES" on remote consoles. Using this command had doubled the amount of work needed from the Asterisk daemon for each completion request. * Fix code formatting. * Remove static buffer used to send the command, use the same buffer that will receive the results. * Move sort from ast_cli_display_match_list. Change-Id: Ie2211b519a3d4bec45bf46e0095bdd01d384cb69 2017-11-07 14:13 +0000 [e723331f4f] Corey Farrell * CLI: Rewrite ast_el_strtoarr to use vector's internally. This rewrites ast_el_strtoarr to use vector's internally, but still return the original NULL terminated array of strings. Change-Id: Ibfe776cbe14f750effa9ca360930acaccc02e957 2017-11-07 14:47 +0000 [e07d94111d] Corey Farrell * CLI: Refactor ast_cli_display_match_list. * Stop estimating line count, just print until we run out of matches. * Stop freeing entries, the caller does that anyways. * Stop calculating / returning numoutput, it was ignored. Change-Id: I7f92afa8bea92241a95227587367424c8c32a5cb 2017-11-08 23:42 +0000 [8a63f4e709] Corey Farrell * CLI: Create ast_cli_completion_add function. Some completion generators are very inefficent due to the way CLI requests matches one at a time. ast_cli_completion_add can be called multiple times during one invokation of a CLI generator to add all results without having to reinitialize the search state for each match. Change-Id: I73d26d270bbbe1e3e6390799cfc1b639e39cceec 2017-11-09 00:39 +0000 [115f53a0fb] Corey Farrell * CLI: Remove calls to ast_cli_generator. The ability to add to localized storage cannot be supported by ast_cli_generator. The only calls to ast_cli_generator should be by functions that need to proxy the CLI generator, for example 'cli check permissions' or 'core show help'. * ast_cli_generatornummatches now retrieves the vector of matches and reports the number of elements (not including 'best' match). * test_substitution retrieves and iterates the vector. Change-Id: I8cd6b93905363cf7a33a2d2b0e2a8f8446d9f248 2017-11-20 09:13 +0000 [41498dcb5d] Alexander Traud * chan_sip: ICE contained square brackets around IPv6 addresses. ASTERISK-27434 Change-Id: Iaeed89b4fa05d94c5f0ec2d3b7cd6e93d2d5a8f7 2017-11-19 21:23 +0000 [84fd41729e] Corey Farrell * loader: Fix comments in struct ast_module. Make the comments follow doxygen format, move comments to the line before each field they describe. Change-Id: Ic445468398b5e88f13910f7c2f70bd15aad33a27 2017-11-16 17:25 +0000 [df6161b70e] Corey Farrell * cli: Remove silly usage of RAII_VAR. Change-Id: I81aacfee7cd26e4fc5eef07bca582700c2975bd7 2017-11-16 13:19 +0000 [1e2b38adf5] Corey Farrell * ccss: Remove silly usage of RAII_VAR. Change-Id: I5ce40035e0a940e4e56f6322c1dcd47fbd509b98 2017-11-16 12:51 +0000 [ddc86ec664] Corey Farrell * app: Remove silly usage of RAII_VAR. Change-Id: Ideb594f7aae134974fb78d5477ba0853b97b8625 2017-11-16 12:19 +0000 [0e90d74604] Corey Farrell * aoc: Remove silly usage of RAII_VAR. Change-Id: I07907f833b81aeb0128bc9442a2abb52679c7511 2017-11-16 12:55 +0000 [746dd80eab] Corey Farrell * abstract_jb: Remove silly usage of RAII_VAR. Change-Id: I9d56175369363d1dc735504cf78a3a5577069f49 2017-11-20 12:54 +0000 [8971a7ff3c] Corey Farrell * Loader: Remove unneeded load_pri declarations. Instead of specifying AST_MODFLAG_LOAD_ORDER with load_pri AST_MODPRI_DEFAULT just use AST_MODFLAG_DEFAULT. Change-Id: I0123258eafce324249433a69df15a85cc16e509f 2017-11-20 13:08 +0000 [9d688cf12c] Corey Farrell * res_mwi_external_ami: Remove incorrect load priority. res_mwi_external_ami specified AST_MODFLAG_LOAD_ORDER but didn't set load_pri, resulting in an actual load priority of 0. This module only provides AMI actions so it has no reason to load early. Change-Id: I82987fcf10d3ea42716b2f9df915b16687fd5839 2017-11-20 09:49 +0000 [50cb5199c1] Alexander Traud * BuildSystem: pjsip_evsub_set_uas_timeout was not used. ASTERISK-27435 Change-Id: Id318a7ae6d7d69b53f911d30bf3eece64852f15c 2017-11-19 13:52 +0000 [6a5ab65c88] Corey Farrell * Build: Fix issues building without SSL. * Fix conditional in libasteriskssl. * Use variables produced by configure to link the SSL and uuid libraries into libasteriskpj.so instead of hard-coding them. ASTERISK-27431 Change-Id: I3977931fd3ef8c4e4376349ccddb354eb839b58d 2017-11-19 13:28 +0000 [366cc259bc] Corey Farrell * res_pjsip: Fix warning by deferring implicit type cast. Mac doesn't like the comparison of -1 to an enum, so store the result of ast_sip_str_to_dtmf to an int so we can check for the negative return value. ast_sip_str_to_dtmf returns an int so this is only delaying the implicit type cast. Change-Id: I0c262c1719ee951aae1f437d733a301cf5f8ad29 2017-11-19 09:57 +0000 [69113388e9] Corey Farrell * Build: Fix OSX build issues. OSX does not support 'readlink -f' or 'sed -r'. Replace readlink with the GNU make macro 'realpath'. Replace sed with grep in one place, cut in the other. ASTERISK-27332 Change-Id: I5d34ecca905384decb22ead45c913ae5e8aff748 2017-11-18 21:13 +0000 [5fe2e7bfdc] Corey Farrell * tests: Fix warnings found on Mac. test_pbx used raise without explicitly including signal.h. On Mac for some reason nothing else includes it. test_logger checked if an unsigned int was negative. Switch the variable to 'int' so that error check can be effective. Change-Id: Ie1db5dd1818ac25cc2ae41b644f848b5865b1362 2017-11-18 20:25 +0000 [d68e54b7ab] Corey Farrell * res_snmp: Declare RONLY if net-snmp headers do not. Some net-snmp builds do not provide the RONLY declare, only NETSNMP_OLDAPI_RONLY. Map RONLY to NETSNMP_OLDAPI_RONLY to get around this error. Change-Id: Ida5c7ad9406515825485c4d3b4a34fd6ad0da577 2017-11-18 20:02 +0000 [0f270cbe9e] Corey Farrell * res_fax: Remove checks for unsigned values being >= 0. It's impossible for gwtimeout or fdtimeout to be less than 0 because they are unsigned int's. Remove checks and unreachable branches. Change-Id: Ib2286960621e6ee245e40013c84986143302bc78 2017-11-18 19:29 +0000 [3dca4c7742] Corey Farrell * app_minivm: Fix possible uninitialized return value. Declare 'res' initialized to -1 to deal with earlier error paths that could cause 'res' to be returned uninitialized. Change-Id: I8ac2a5755bf4174d89ef893e924c940f702b104e 2017-11-17 19:36 +0000 [5f0b4a1645] Corey Farrell * README: Send people to secure websites where available. We should be sending people to secure web URL's where available. Update README's and docs. Change-Id: Id5b1e049b0b18b49a784f1254605aefa244ce19a 2017-11-17 19:54 +0000 [a369bfc4b2] Corey Farrell * doxygen: Remove obsolete contents. Remove doxygen contents that have nothing to do with the current state of Asterisk. Change-Id: Ic072cc8641f9533a202990ccf275ce87e3efd95c 2017-11-16 02:47 +0000 [6b0963c42a] Pirmin Walthert * res_rtp_asterisk.c: Fix rtp source address learning for broken clients Some clients do not send rtp packets every ptime ms. This can lead to situations in which the rtp source learning algorithm will never learn the address of the client. This has been discovered on a Mac mini with a pjsip based softphone after updating to Sierra: as soon as USB headsets are involved, the softphone will send the second packet 30ms after the first, the third 30ms after the second and the fourth 1ms after the third. So in the old implmentation the rtp source learning algorithm was repeatedly reset on the fourth packet. The patch changes the algorithm in a way that doesn't take the arrival time between two consecutive packets into account but the time between the first and the last packet of a learning sequence. The patch also fixes a second problem: when a user was using a wrong value for the probation setting there was a LOG_WARNING output stating that the value had been set to the default value instead. However the code for setting the value back to defaults was missing. ASTERISK-27421 #close Change-Id: If778fe07678a6fd2041eaca7cd78267d0ef4fc6c 2017-11-17 09:57 +0000 [3c72064d3f] Sean Bright * res_pjsip: Use reasonable buffer lengths for endpoint identification Domains themselves can be up to 255 characters long (per RFC 1035), so our current buffer sizes are wholly inadequate for many use cases. Change-Id: If3f30a68307f1365a1fe06bc4b854c62842c9292 2017-11-11 10:09 +0000 [455b1bdeb0] Corey Farrell * menuselect: Remove ineffective weak attribute detection. menuselect detects compiler support for multiple styles of weak functions. This is a remnant from 2013 when OPTIONAL_API required weak functions. It is no longer correct for menuselect to switch dependencies from optional to required based on lack of weak function support. Note an issue remains - dependencies should switch from optional to required based on OPTIONAL_API being enabled or disabled. I don't think this is possible. menuselect needs to know at startup if OPTIONAL_API is enabled or disabled, so the only way to fix this is to remove OPTIONAL_API from menuselect and create a configure option. I've left the code that switches in place but it's preprocessed out. Additionally removed: - WEAKREF variable from Asterisk makeopts.in. - Related disabled code from test_utils. - Pointless AC_REVISION call from menuselect/configure.ac. Change-Id: Ifa702e5f98eb45f338b2f131a93354632a8fb389 2017-11-16 09:48 +0000 [549542e50e] Corey Farrell * acl: Fix allocation related issues. Add checks for allocation errors, cleanup and report failure when they occur. * ast_duplicate_acl_list: Replace log warnings with errors, add missing line-feed. * ast_append_acl: Add missing line-feed to logger message. * ast_append_ha: Avoid ast_strdupa in loop by moving debug message to separate function. * ast_ha_join: Use two separate calls to ast_str_append to avoid using ast_strdupa in a loop. Change-Id: Ia19eaaeb0b139ff7ce7b971c7550e85c8b78ab76 2017-11-16 11:02 +0000 [2852dac480] Corey Farrell * acl: Update logger message to match 15+. This patch causes a logger message to be the same as it is in 15+. This will allow a follow-up patch to be cherry-picked to all 3 branches. Change-Id: Ic0665a3d49987e4eb6df28dcd9e90b1c3ca191e0 2017-11-07 17:07 +0000 [0b8b153d3c] Corey Farrell * CLI: Create ast_cli_completion_vector. This is a rewrite of ast_cli_completion_matches using a vector to build the list. The original function calls the vector version, NULL terminates the vector and extracts the elements array. One change in behavior the results are now sorted and deduplicated. This will solve bugs where some duplicate checking was done before the list was sorted. Change-Id: Iede20c5b4d965fa5ec71fda136ce9425eeb69519 2017-11-16 09:04 +0000 [0a7bbb068b] Joshua Colp * bridge_basic: Ignore answer from transfer target when they've timed out. This is a fun one. Given the following attended transfer scenario: 1. Transfer target is called 2. Transferer hangs up 3. Transfer target call attempt reaches timeout 4. Transfer target is told to hang up 5. Transfer target answers before channel is hung up 6. Transferer recall target is called A crash would occur. This is because the transfer target call attempt, despite being told to hang up, would raise a recall target answer before the recall target had been answered. As it had not answered there would be no recall target channel and it would implode. This change makes it so that if the transfer target has been hung up we don't tell the attended transfer code that it has answered. We also clear out the stimulus that the recall target has been answered after telling the transfer target to hang up, in case it was able to raise the information before we told it to hangup. ASTERISK-27361 Change-Id: Ifb8b255a9c4d2c5c1b8ad77bf54f659ed286df99 2017-11-16 19:39 +0000 [69055724ce] Corey Farrell * aoc: Fix memory management issues. aoc_publish_blob failed to check for msg allocation error and never released msg. Change-Id: Ib31a9ffb81056a0d496a49d7eec795005a44bcd5 2017-11-16 16:18 +0000 [60cfe00c4e] Sean Bright * res_pjsip_transport_websocket: Give transport a meaningful description We were not \0 terminating this string, so any attempt to print it would in the best case show an empty string and in the worst case potentially crash. Change-Id: I63d96ef8f7516ac02a0f91e22dfa8acdc615042c 2017-11-16 15:00 +0000 [db2677133c] Sean Bright * res_pjsip: Use sorcery prefix operation for contact lookup This improves performance for registrations assuming that res_config_astdb is not in use. Change-Id: I86f37aa9ef07a4fe63448cb881bbadd996834bb1 2017-11-09 19:58 +0000 [8a7dd5cc44] Richard Mudgett * chan_pjsip.c: Improve answer failure log messages. * Balanced the session->inv_session refs on answer failure. Change-Id: I33542d639d37e692cb46550b972a5fcfc3b804b8 2017-11-14 18:00 +0000 [7f916d621a] Richard Mudgett * audiohook.c: Fix freeing a frame and still using it. Memory corruption happened to the media frame caches when an audio hook freed a frame when it shouldn't. I think the freed frame was because a jitter buffer interpolated a missing frame and the audio hook unconditionally freed it. * Made audiohook.c:audio_audiohook_write_list() not free an interpolated frame if it is the same frame as what was passed into the routine. * Made plc.c:normalise_history() use memmove() instead of memcpy() on a memory block that could overlap. Found by valgrind investigating this issue. ASTERISK-27238 ASTERISK-27412 Change-Id: I548d86894281fc4529aefeb9f161f2131ecc6fde 2017-11-15 12:10 +0000 [7e874eae7a] George Joseph * app_record: Don't set RECORD_STATUS chan var until file is closed We've been calling pbx_builtin_setvar_helper to set the RECORD_STATUS variable before actually closing the recorded file. If a client is watching VarSet events and tries to do something with the file when a RECORD_STATUS event is seen, they might attempt to do so while the file it's still open. We now delay calling pbx_builtin_setvar_helper until after we close the file. ASTERISK-27423 Change-Id: I7fe9de99953e46b4bafa2b38cf151fe8f6488254 2017-11-07 08:25 +0000 [062a4390ac] George Joseph * ast_coredumper: Add ability to use directory other than /tmp The OUTPUTDIR environment variable can now be set either in the environment itself or in ast_debug_tools.conf. If set, it's used for all work products instead of /tmp. Also added the --tarball-config option that includes the contents of /etc/asterisk when either --tarball-coredumps or --tarball-results are used. Change-Id: I66b2553319df61caea5b313d084f51978f730b4c 2017-10-16 07:36 +0000 [e7f8302d30] Torrey Searle * contrib/script/sip_to_pjsip: add support for realtime Add a new script that can read from legacy realtime peers & generate an sql file for populating pjsip endpoints, identify, and aor records. ASTERISK-27348 #close Change-Id: Idd3d7968a3c9c3ee7936d21acbdaf001b429bf65 2017-11-13 07:14 +0000 [c2dddb001a] Joshua Colp * pjsip / hep: Provide correct local address for Websockets. Previously for PJSIP the local address of WebSocket connections was set to the remote address. For logging purposes this is not particularly useful. The WebSocket API has been extended to allow the local address to be queried and this is used in PJSIP to set the local address to the correct value. The PJSIP HEP support has also been tweaked so that reliable transports always use the local address on the transport and do not try to (wrongly) guess. As they are connection based it is impossible for the source to be anything else. ASTERISK-26758 ASTERISK-27363 Change-Id: Icd305fd038ad755e2682ab2786e381f6bf29e8ca 2017-11-13 17:47 +0000 [b8209a1273] Corey Farrell * alertpipe: Correct documented return of ast_alertpipe_write. Change-Id: I4ea49c441890a81384144479dc93ab5a3989486d 2017-11-13 16:20 +0000 [9c6d4ec022] Corey Farrell * core: Fix configuration of remote console socket path. The remote console socket path is the combination of asterisk.conf settings astrundir from [directories] and astctl from [files]. Unconditionally combine the two strings after processing all values to ensure we end up with the correct socket path. ASTERISK-27415 Change-Id: Ib1e2805d55d6b0955c6430a1a2a93acbf9b091e8 2017-11-10 10:37 +0000 [b5f2779a23] George Joseph * bundled_pjproject: sip_parser: Fix return code in pjsip_find_msg The default return code for pjsip_find_msg was PJ_SUCCESS so if a Content-Length header wasn't found at all, pjsip_find_msg was returning PJ_SUCCESS instead of PJSIP_EMISSINGHDR. Also added the volatile keyword to a few variables that are used both inside and outside the PJ_TRY/PJ_CATCH block. Partial fix for ASTERISK_27408 Change-Id: If82ba9de921e3d57df9c68cf96ee45ccc1491f7a 2017-11-13 14:35 +0000 [e6ada55430] Ben Ford * bundled_pjproject: Update to 2.7.1 Update from 2.7 to 2.7.1 for bundled pjproject. Changed version and removed patch files included in the update. Change-Id: I55cea8e734b318c2df9daf86aa0802c559ec8357 2017-11-09 08:21 +0000 [cf062303e3] Sean Bright * sorcery: Add ast_sorcery_retrieve_by_prefix() Some consumers of the sorcery API use ast_sorcery_retrieve_by_regex only so that they can anchor the potential match as a prefix and not because they truly need regular expressions. Rather than using regular expressions for simple prefix lookups, add a new operation - ast_sorcery_retrieve_by_prefix - that does them. Patches against 13 and 15 have a compatibility layer needed to maintain ABI that is not needed in master. Change-Id: I56f4e20ba1154bd52281f995c27a429a854f6a79 2017-11-07 14:00 +0000 [2ad6210dd7] Corey Farrell * vectors: Add new macro and a string vector definition. * AST_VECTOR_STEAL_ELEMENTS - steal the array of elements for use with non-vector code. * struct ast_vector_string - a vector of 'char *'. Change-Id: I104d1b204be03fccf67e02a195596adcb5ab1e42 2017-10-30 22:09 +0000 [76e640bd53] Corey Farrell * Build: Make function constructor/destructor attributes mandatory. This change causes the configure script to fail if the C compiler does not support both function attributes constructor and destructor. These were already required as modules cannot function without these attributes and Asterisk requires modules. This also has AST_GCC_ATTRIBUTE set a variable ax_cv_have_func_attribute_$1. This is the same variable name used by autoconf-archive's AX_GCC_FUNC_ATTRIBUTE, used for the same purpose. Change-Id: Id68e8a1447f2a6d707c54b56350e7bfdb33fb663 2017-11-10 22:04 +0000 [b03d389bec] Corey Farrell * menuselect: Delete and ignore aclocal.m4. This file is temporary output from the bootstrap.sh command, it does not need to be committed. Change-Id: Ie0fd113aff6eac44924c0bd0c900833c6c86a6d9 2017-11-11 13:01 +0000 [507d9b5f9e] Richard Mudgett * core: Add cache_media_frames debugging option. The media frame cache gets in the way of finding use after free errors of media frames. Tools like valgrind and MALLOC_DEBUG don't know when a frame is released because it gets put into the cache instead of being freed. * Added the "cache_media_frames" option to asterisk.conf. Disabling the option helps track down media frame mismanagement when using valgrind or MALLOC_DEBUG. The cache gets in the way of determining if the frame is used after free and who freed it. NOTE: This option has no effect when Asterisk is compiled with the LOW_MEMORY compile time option enabled because the cache code does not exist. To disable the media frame cache simply disable the cache_media_frames option in asterisk.conf and restart Asterisk. Sample asterisk.conf setting: [options] cache_media_frames=no ASTERISK-27413 Change-Id: I0ab2ce0f4547cccf2eb214901835c2d951b78c00 2017-11-11 09:42 +0000 [bb2173275a] Richard Mudgett * frame.c: Make ast_frame_free()/ast_frfree() NULL tolerant Change-Id: Ic49d821ef88ada38a31bdd835b9531443c55d793 2017-11-10 07:06 +0000 [360d50d74c] Joshua Colp * pjsip: Add patch to allow all transports to be destroyed. If a transport is created with the same transport type, source IP address, and source port as one that already exists the old transport is moved into a linked list called "tp_list". If this old transport is later shutdown it will not be destroyed as the process checks whether the transport is valid or not. This check does not look at the "tp_list" when making the determination causing the transport to not be destroyed. This change updates the logic to query not just the main storage method for transports but also the "tp_list". Upstream issue https://trac.pjsip.org/repos/ticket/2061 ASTERISK-27411 Change-Id: Ic5c2bb60226df0ef1c8851359ed8d4cd64469429 2017-11-09 20:34 +0000 [211f5d8dd4] Corey Farrell * core: Remove disabled code. handle_quit has been disabled since 2003, remove it. Change-Id: Idc3aaa6c81676160547078f9b71e8aa43de2db18 2017-11-09 13:24 +0000 [d12be40750] Corey Farrell * Build System: Disable parallel make in the root Makefile. This ensures that the root Makefile runs only a single target at a time. SUBMAKE will still honor requested parallelism, so 'make -j8' will build one directory at a time but allow 8 jobs at once when building a sub directory. This will fix some display glitches related to rebuild of XML documentation. It will also prevent some edge case errors where bundled pjproject needs to be rebuild before other parts of Asterisk. Change-Id: I4f2ec6fbbec1ada0ccb1109a28ea303524239b1e 2017-03-29 20:46 +0000 [32042c6c3c] Richard Mudgett * chan_pjsip.c: Fix uninitialized cause value on failure. Change-Id: I3f9dd3c31bd582e54a30381500077de2319d8cc3 2017-10-19 13:35 +0000 [4b3e03ae87] Kevin Harwell * AST-2017-011 - res_pjsip_session: session leak when a call is rejected A previous commit made it so when an invite session transitioned into a disconnected state destruction of the Asterisk pjsip session object was postponed until either a transport error occurred or the event timer expired. However, if a call was rejected (for instance a 488) before the session was fully established the event timer may not have been initiated, or it was canceled without triggering either of the session finalizing states mentioned above. Really the only time destruction of the session should be delayed is when a BYE is being transacted. This is because it's possible in some cases for the session to be disconnected, but the BYE is still transacting. This patch makes it so the session object always gets released (no more memory leak) when the pjsip session is in a disconnected state. Except when the method is a BYE. Then it waits until a transport error occurs or an event timeout. ASTERISK-27345 #close Reported by: Corey Farrell Change-Id: I1e724737b758c20ac76d19d3611e3d2876ae10ed 2017-10-03 16:19 +0000 [2b85799512] Richard Mudgett * AST-2017-010: Fix cdr_object_update_party_b_userfield_cb() buf overrun cdr_object_update_party_b_userfield_cb() could overrun the fixed buffer if the supplied string is too long. The long string could be supplied by external means using the CDR(userfield) function. This may seem reminiscent to AST-2017-001 (ASTERISK_26897) and it is. The earlier patch fixed the buffer overrun for Party A's userfield while this patch fixes the same thing for Party B's userfield. ASTERISK-27337 Change-Id: I0fa767f65ecec7e676ca465306ff9e0edbf3b652 2017-10-19 13:53 +0000 [2faa3e3bab] George Joseph * AST-2017-009: pjproject: Add validation of numeric header values Parsing the numeric header fields like cseq, ttl, port, etc. all had the potential to overflow, either causing unintended values to be captured or, if the values were subsequently converted back to strings, a buffer overrun. To address this, new "strto" functions have been created that do range checking and those functions are used wherever possible in the parser. * Created pjlib/include/limits.h and pjlib/include/compat/limits.h to either include the system limits.h or define common numeric limits if there is no system limits.h. * Created strto*_validate functions in sip_parser that take bounds and on failure call the on_str_parse_error function which prints an error message and calls PJ_THROW. * Updated sip_parser to validate the numeric fields. * Fixed an issue in sip_transport that prevented error messages from being properly displayed. * Added "volatile" to some variables referenced in PJ_CATCH blocks as the optimizer was sometimes optimizing them away. * Fixed length calculation in sip_transaction/create_tsx_key_2543 to account for signed ints being 11 characters, not 9. ASTERISK-27319 Reported by: Youngsung Kim at LINE Corporation Change-Id: I48de2e4ccf196990906304e8d7061f4ffdd772ff 2017-11-06 17:58 +0000 [16df0e9786] Corey Farrell * res_pjsip_pubsub: Fix multiple leaks on failure to append vectors. Change-Id: I68ece0073ea79667ca41eb10405f516f1d30d482 2017-11-06 18:12 +0000 [cf91dde509] Corey Farrell * res_pjsip_history: Fix multiple leaks on vector append failure. Change-Id: I41e8d5183ace284095cc721f3b1fb32ade3f940f 2017-11-06 16:37 +0000 [7ad4c19b20] Richard Mudgett * res_pjsip_registrar.c: Fix named AOR and pjproject group deadlock. One of the patches for ASTERISK_27147 introduced a deadlock regression. When the connection oriented transport shut down, the code attempted to remove the associated contact. However, that same transport had just requested a registration that we hadn't responded to yet. Depending upon timing we could deadlock. * Made send the REGISTER response after we completed processing the request contacts and released the named AOR lock to avoid the deadlock. ASTERISK-27391 Change-Id: I89a90f87cb7a02facbafb44c75d8845f93417364 2017-11-06 17:21 +0000 [c1a608f862] Corey Farrell * res_stasis: Fix multiple leaks. * res/stasis/app.c JSON passed to app_send needs to be released. * res/stasis_message.c: objects leak if vector append fails. Change-Id: I8dd5385b9f50a5cadf2b1d16efecffd6ddb4db4a 2017-11-05 22:06 +0000 [d95bfcd013] Aaron An * res_pjsip: Avoid crash when contact uri is empty string Asterisk will crash if contact uri is invalid, so contact_apply_handler should check if the uri is NULL or empty. ASTERISK-27393 #close Reported-by: Aaron An Tested-by: AaronAn Change-Id: Ia0309bdc6b697c73c9c736e1caec910b77ca69f5 2017-11-07 06:56 +0000 [ec58521a48] Richard Mudgett * res_pjproject.c: Fix ast_strdup() alloc failure. Change-Id: I74688038e7afe3a279359cce53aadb28ade51ead 2017-11-06 17:55 +0000 [69af7eb663] Corey Farrell * res_pjsip_outbound_registration: Fix leak on vector add failure. Change-Id: I774b88b3c9da41edd4dc8d78f095481f52f2bd46 2017-11-06 17:44 +0000 [4f75655cb6] Corey Farrell * res_pjsip_config_wizard: Fix leaks and add check for malloc failure. wizard_apply_handler(): - Free host if we fail to add it to the vector. wizard_mapped_observer(): - Check for otw allocation failure. - Free otw if we fail to add it to the vector. Change-Id: Ib5d3bcabbd9c24dd8a3c9cc692a794a5f60243ad 2017-11-06 17:33 +0000 [8cdc0ef385] Corey Farrell * test_sorcery_memory_cache_thrash: Handle error from vector append. Cleanup resources when we fail to append the vector and report test failure. Change-Id: I6eb41586fd11dee8c0dfe35e91cb465a4cab7298 2017-11-06 17:28 +0000 [e4fba95022] Corey Farrell * res_pjsip: Fix leak on error in ast_sip_auth_vector_init. Change-Id: Ib0fc7a18f3135ca8990c3984c9e15f6d26e556e8 2017-11-06 17:17 +0000 [b96dd55add] Corey Farrell * res_pjproject: Handle error from adding to the buildopts vector. Change-Id: I076c7bd207c7989a23005395ce1735392657be65 2017-11-06 15:33 +0000 [3dc600ef84] Corey Farrell * stasis: Release object if vector append fails. Change-Id: I3e5cc669169aab6175ddfaf7486edeaeb4fdcfb1 2017-11-06 15:30 +0000 [fc041554c3] Corey Farrell * RTP Engine: Deal with errors returned from AST_VECTOR_REPLACE. Check for errors from AST_VECTOR_REPLACE and clean memory if needed. Change-Id: I124d15cc1d645f85a72a1279f623c1993b304b0b 2017-11-06 15:10 +0000 [75539dbf2c] Corey Farrell * Messaging: Report error on failure to register tech or handler. Message tech and handler registrations use a vector which could fail to expand. If it does log and error and return error. Change-Id: I593a8de81a07fb0452e9b0efd5d4018b77bca6f4 2017-11-06 15:07 +0000 [b4240bea6c] Corey Farrell * format_cap: Fix leak on AST_VECTOR_APPEND error. format_cap_framed_init can fail on AST_VECTOR_APPEND. This should report failure to the caller and clean the newly allocated frame. Change-Id: Ica0661235bf09497bf23d844ceb01f21b41a55b0 2017-11-06 14:23 +0000 [803dc3dee5] Corey Farrell * stasis: Remove silly use of RAII_VAR in stasis_forward_all. Change-Id: I46de4c968d40144d5b049966304ff66c1469fb65 2017-11-06 12:51 +0000 [0a0e2c4253] Corey Farrell * CLI: Remove unused internal command. The internal CLI command "_command complete" was last used by Asterisk 0.2.0. Since then we've been using "_command nummatches" and "_command matchesarray". Change-Id: I682fe1e21a24a3bb5bd04146e639f1c5866bcfce 2017-11-03 18:08 +0000 [593f789563] Richard Mudgett * stasis_bridges.c: Fix off-nominal json memory leaks. Change-Id: Ib1181a36b317c86bff1ef2e44a17a0b1c73cfdc8 2017-11-06 10:29 +0000 [56e32ca355] Joshua Colp * res_pjsip_pubsub: Ensure remote URI contains URI only. This change makes it so that any user of the pubsub API that requests the remote URI receives only the URI. Previously the entire string was returned, which could contain a display name. ASTERISK-27290 Change-Id: If1d0cd6630f0a264856d31d2a67933109187a017 2017-11-03 17:43 +0000 [6bc8af2433] Richard Mudgett * stasis_channels.c: Remove a very silly RAII_VAR(). Change-Id: I28b458b3c1a442c4ef0be7b4986a95ea4149e14f 2017-11-03 16:14 +0000 [33d02f5090] Richard Mudgett * stasis/app.c: Optimize stasis_app_get_debug_by_name() * Eliminate RAII_VAR() * Short circuit application name lookup if global debug enabled. Change-Id: I5f78b7bd6ca7fd2c3b07cbbe036c6a93b4681123 2017-11-02 18:40 +0000 [9013415593] Richard Mudgett * Fix ast_(v)asprintf() malloc failure usage conditions. When (v)asprintf() fails, the state of the allocated buffer is undefined. The library had better not leave an allocated buffer as a result or no one will know to free it. The most likely way it can return failure is for an allocation failure. If the printf conversion fails then you actually have a threading problem which is much worse because another thread modified the parameter values. * Made __ast_asprintf()/__ast_vasprintf() set the returned buffer to NULL on failure. That is much more useful than either an uninitialized pointer or a pointer that has already been freed. Many uses won't have to check for failure to ensure that the buffer won't be double freed or prevent an attempt to free an uninitialized pointer. * stasis.c: Fixed memory leak in multi_object_blob_to_ami() allocated by ast_asprintf(). * ari/resource_bridges.c:ari_bridges_play_helper(): Remove assignment to the wrong thing which is now not needed even if assigning to the right thing. Change-Id: Ib5252fb8850ecf0f78ed0ee2ca0796bda7e91c23 2017-11-06 08:05 +0000 [250c173cfb] Sean Bright * res_pjsip: Ignore empty TLS configuration When using realtime, fields that are not explicitly set by an administrator are still presented to sorcery as empty strings. Handle this case explicitly. In this particular case, if any of these fields are required for TLS support, their existence should be validated in the 'apply' handler once we have a complete transport definition. ASTERISK-27032 #close Reported by: seanchann.zhou Change-Id: Ie3b5fb421977ccdb33e415d4ec52c3fd192601b7 2017-11-06 03:18 +0000 [7dd2b18e32] Alexander Traud * tcptls: Print notice when TLS is enabled but not configured. Asterisk can be compiled without a SSL/TLS library, without the Development Headers of OpenSSL. However, if TLS (SIP) or Secure-WebSockets (WebRTC) was enabled in a configuration file, Asterisk did not notice the user. Asterisk failed silently, only the corresponding TCP ports were not open. ASTERISK-27394 Reported-by: mossley74 Change-Id: Ib8b7539a5b2af8154c22e5f7a40fc68f95d95b93 2017-11-06 03:21 +0000 [b5331af53b] Corey Farrell * configure: Add autoconf check for libopusfile. This check is being added to make it easier for end-users of third party open source Opus modules. This was removed by ASTERISK-26426 but only the module needed to be removed. Change-Id: I62b9cd0c4fa8a77596ab0e042948a643a1152677 2017-11-04 06:05 +0000 [5f4197735d] Alexander Traud * install_prereq: Checkout of libSRTP 2.x. Since Asterisk 13.17, libSRTP 2.x is supported. Therefore, its latest version is installed again via the script install_prereq. ASTERISK-27356 Change-Id: I13125839a79052356469e41edacbebff0a937d39 2017-11-01 17:47 +0000 [3bce5a9dfa] Richard Mudgett * Stasis/ARI: Fix off-nominal path json memory leaks. Change-Id: Id569c624c426e3b22a99936473c730592d8b83fb 2017-11-02 11:38 +0000 [675e50b903] Richard Mudgett * AOC: Fix AOC-S json memory leak. Change-Id: I3a1d40a41a8a7d00fa4a187de6a343a79155d3ef 2017-11-01 18:04 +0000 [4ea61eef94] Richard Mudgett * res_stasis_device_state.c: Optimize stasis_app_device_states_to_json() * Eliminate RAII_VAR() * Replace looped alloca with a char[] since that is how it is used anyway. Change-Id: Ia27e64a884afa0f50b9ffdb1cf23da6bfa51ffdf 2017-11-01 18:58 +0000 [8ec2db7084] Richard Mudgett * res_stasis_mailbox.c: Fix leak of mailbox container. Change-Id: I7d33c1635713047e7d1597c9d882f7dc006d94b4 2017-11-03 10:35 +0000 [d3cfcc0da6] Corey Farrell * Build System: Fix build failure caused by recent CLI improvements. We use the editline library to help with filename completion in our CLI interface. Some systems failed to find the header when included from loader.c. This is fixed by setting the proper CFLAGS for the build of loader.o. ASTERISK-27378 Change-Id: Ib7fd496f1d7ed48141a2eadd5dd61cab2f2308be 2017-11-01 11:12 +0000 [ffcb7e2a25] Ben Ford * res_pjsip: Add to list of valid characters for from_user. Fixes a regression where some characters were unable to be used in the from_user field of an endpoint. Additionally, the backtick was removed from the list of valid characters, since it is not valid, and it was replaced with a single quote, which is a valid character. ASTERISK-27387 Change-Id: Id80c10a644508365c87b3182e99ea49da11b0281 2017-10-30 17:30 +0000 [bfb0f27c87] Corey Farrell * Modules: Additional improvements to CLI completion. Replace 'needsreload' argument with a 'type' argument to specify which type of modules you want completion. This provides more accurate CLI completion for load and unload commands. * 'module unload' now excludes modules that have active references or are not running. * 'module load' now excludes modules that are already running. * 'core set debug [atleast] [module]' shows running modules only. ASTERISK-27378 Change-Id: Iea3e00054461484196c46f688f02635cc886bad1 2017-11-02 02:11 +0000 [7c35740ba1] Corey Farrell * Add missing menuselect dependencies. This adds menuselect dependencies for modules that use symbols of other modules. ASTERISK-27390 Change-Id: Ia2d2849f5b87a72af7324a82edc3f283eafb5385 2017-11-01 19:46 +0000 [73a5e9f0e9] Corey Farrell * Prevent unload of modules which implement an Optional API. Once an Optional API module is loaded it should stay loaded. Unloading an optional API module runs the risk of a crash if something else is using it. This patch causes all optional API providers to tell the module loader not to unload except at shutdown. ASTERISK-27389 Change-Id: Ia07786fe655681aec49cc8d3d96e06483b11f5e6 2017-11-01 13:58 +0000 [d524ad523d] Sean Bright * pjsip_message_filter: Only do interface lookup for wildcard addresses. Change-Id: Ie083987e69dc43b6861671c218cacacc11b2072f 2017-10-31 15:08 +0000 [a7c00707a5] Kevin Harwell * features: Bridge application's BRIDGERESULT not appropriately set The dialplan application "Bridge" was not setting the BRIDGERESULT to failure when a failure did occur. Even worse if it did fail to join the bridge it would still report success. This patch now sets the BRIDGERESULT variable to an appropriate value for a given condition state. Also, removed the value INCOMPATIBLE as a valid result type since it is no longer used. ASTERISK-27369 #close Change-Id: I22588e7125a765edf35cff28c98ca143e9927554 2017-10-30 09:20 +0000 [1b535d8457] Tzafrir Cohen * ast_coredumper: allow setting asterisk binary explicitly Adds an extra option, --asterisk-bin= to ast_coredumper. If provided, the binary given to gdb will be the parameter, rather than asterisk from the PATH. ASTERISK-27380 #close Change-Id: I25f5b91eb75059b0fb2f142e468c26b283b0a9f3 2017-10-30 00:32 +0000 [cee81b3c8b] Corey Farrell * Modules: Fix issues with CLI completion. * Stop using ast_module_helper to check if a module is loaded, use ast_module_check instead (app_confbridge and app_meetme). * Stop ast_module_helper from listing reload classes when needsreload was not requested. ASTERISK-27378 Change-Id: Iaed8c1e4fcbeb242921dbac7929a0fe75ff4b239 2017-10-28 19:18 +0000 [8436f1d35a] Igor Goncharovskiy * app_agent_spool: Fix typo in dtmf features usage desctiption Fix typo, that specify usage wrong option 'dtmf-features' for CHANNEL() function instead of correct 'dtmf_features' ASTERISK-27377 #close Change-Id: I15ecc829c1035b359584673e12cdb5c9291ac930 2017-10-27 13:41 +0000 [987b16e8f9] Corey Farrell * res_pjsip_pubsub: Resolve potential crash in allocate_subscription. When allocate_subscription fails to initialize fields of the new sub it calls destroy_subscription. Change-Id: I5b79c915ec216dc00c13c1e4172137864a4bec85 2017-10-26 12:18 +0000 [2db97ee219] Richard Mudgett * app_voicemail.c: Fix compiler warning with IMAP build. ASTERISK-27181 Change-Id: Ic4468b49860bd7f67e922baf4c9e96828c184d17 2017-10-25 14:38 +0000 [ca7f3d297b] Richard Mudgett * codec.c: Defensively check the returned samples. Earlier versions of the codec_opus samples_count callback can return negative error values on undecodable frames. This resulted in a divide by zero exception. * Added a defensive check in ast_codec_samples_count() for a "negative" samples count return value. Log the event and set the count to zero. ASTERISK-27194 Change-Id: Icf69350307ecbbc80a3d74de46af9bd80ea17819 2017-10-24 10:33 +0000 [7385d1e017] Joshua Colp * res_pjsip: Add 'ip' as a valid option to 'identify_by' on endpoint. When the identify_by option on an endpoint is set to ip it will only be identified using the res_pjsip_endpoint_identifier_ip module. This ensures that it is not mistakenly matched using the username of the From header. To ensure behavior has not changed the default has been changed to "username,ip" for the identify_by option. ASTERISK-27206 Change-Id: I2170b86a7f7e221b4f00bf14aa1ef1ac5b050bbd 2017-10-25 12:26 +0000 [3f7ad66245] George Joseph * ast_coredumper: Add gzipping of binaries and display of signal info The --tarball-coredump option now creates a gzipped tarball of coredumps processed, their results txt files and copies of /etc/os-release, /usr/sbin/asterisk, /usr/lib(64)/libasterisk* and /usr/lib(64)/asterisk as those files are needed to properly examine the coredump. The file will be named /tmp/asterisk..coredumps.tar.gz or /tmp/asterisk-.coredumps.tar.gz if --tarball-uniqueid was specified. Added dumps of *_siginfo to the top of the txt files so you can tell what signal was invoked. Change-Id: Ib9ee6d83592d4b1bc90cb3419a05376a88d1ded9 2017-03-30 09:51 +0000 [4772849016] Corey Farrell * Build System: Fix --disable-xmldoc option. The configure option to disable XML documentation does not currently work. This patch makes it effective, but also causes an ABI change by removing the ast_xmldoc_* symbols. Disabling xmldoc also prevents docs from being automatically generated, but they can still be manually generated with 'make doc/core-en_US.xml'. ASTERISK-26639 Change-Id: Ifac562340c09f80c83e0203de098fcac93bf8c44 2017-10-23 13:42 +0000 [dfe00b80e7] Ben Ford * http.c: Fix http header send content. Currently ast_http_send barricades a portion of the content that needs to be sent in order to establish a connection for things like the ARI client. The conditional and contents have been changed to ensure that everything that needs to be sent, will be sent. ASTERISK-27372 Change-Id: I8816d2d8f80f4fefc6dcae4b5fdfc97f1e46496d 2017-10-07 12:14 +0000 [23d05ebc49] Corey Farrell * hashtab: Use ast_free. A few places in hashtab use free instead of ast_free. Change-Id: I2ff089bad71640c03c3ce97f1b00fc962ef79427 2017-10-24 09:43 +0000 [c95ab4c1ce] Corey Farrell * chan_sip: Fix SUBSCRIBE with missing "Expires" header. When chan_sip receives a SUBSCRIBE request with no "Expires" header it processes the request as an unsubscribe. This is incorrect, per RFC3264 when the "Expires" header is missing a default expiry should be used. ASTERISK-18140 Change-Id: Ibf6dcd4fdd07a32c2bc38be1dd557981f08188b5 2017-10-24 07:24 +0000 [5351e862ee] Alexander Traud * lpc10: Avoid compiler warning when DONT_OPTIMIZE/COMPILE_DOUBLE. ASTERISK-23556 Reported by: Marcello Ceschia Change-Id: Ic27e88e0336a0d83877dc857938659dc5560b93c 2017-10-23 13:44 +0000 [ec278955a3] Corey Farrell * main/Makefile: Remove rule for non-existant testexpr2. Change-Id: Ibb3e47f27a395d74d8c5263db015b05434f5969b 2017-10-23 12:42 +0000 [6cec3149be] Corey Farrell * test_config: Fix failure and segfault when config_hook is run twice. On second run the config_hook test was unexpectedly failing to load test_config.conf because it was still unmodified since the last load. This is fixed by not passing CONFIG_FLAG_FILEUNCHANGED for the initial loads, only using it when we are tested that a reload of unmodified files do not initiate the hook. ASTERISK-25960 Change-Id: Ifd679509a23ed163e5cc647490bf7df4ae3cd856 2017-10-23 12:23 +0000 [4a2575a107] George Joseph * res_pjsip_sdp_rtp: Fix setting of address type for rtp_ipv6 create_outgoing_sdp_stream was setting "addr_type = STR_IP6" only when an ipv6 media_address was specified on the endpoint. If rtp_ipv6 was set and ast_sip_get_host_ip_string returned an ipv6 address, we were leaving the addr_type set at the default of STR_IP4. This caused the address type to be set incorrectly on the "o" and "c" SDP attributes even though the address was set correctly. Some clients don't like the mismatch. * Removed the test for endpoint/media_address and now check all addresses for ipv6. ASTERISK-27198 Reported by: Martin Cisárik Change-Id: I5214fc31b728117842243807e7927a319cf77592 2017-10-23 07:53 +0000 [b4cb0050bd] Richard Mudgett * app_agent_pool.c: Fix online documentation typo. Change-Id: Ib0bc95fd0ec288c78c313823254d7a84ebfc4429 2017-10-22 17:32 +0000 [07e17fd04f] Joshua Colp * res_xmpp: Ensure the connection filter is available. Users of the API that res_xmpp provides expect that a filter be available on the client at all times. When OAuth authentication support was added this requirement was not maintained. This change merely moves the OAuth authentication to after the filter is created, ensuring users of res_xmpp can add things to the filter as needed. ASTERISK-27346 Change-Id: I4ac474afe220e833288ff574e32e2b9a23394886 2017-10-21 03:44 +0000 [c7a9a6ef0c] Alexander Traud * chan_sip: Crypto attribute not last but first on SDP media level. This matches the behavior of the other SIP channel driver, chan_pjsip. ASTERISK-27365 Change-Id: I8f23a51290a58b75816da2999ed1965441dfc5d6 2017-10-17 10:53 +0000 [b57dcc8d9c] Richard Mudgett * res_pjproject.c: Upgrade bundled PJPROJECT to 2.7 Update patches included in bundled PJPROJECT for the new version. ASTERISK-27355 Change-Id: I9ac5dbbffaadca25ad24fac8b9ab615e5ace6083 2017-10-18 13:41 +0000 [fb4ed70e62] Corey Farrell * res_pjsip_pubsub: Prevent unload except during shutdown. Prevent unload of the module as certain pjsip initialization functions cannot be reversed. This required a reorder of the module_load so that the non-reversable pjsip functions are not called until all potential errors have been ruled out. ASTERISK-24483 Change-Id: Iee900f20bdd6ee1bfe23efdec0d87765eadce8a7 2017-10-18 13:37 +0000 [216251abcb] Corey Farrell * res_pjsip_refer: Prevent unload except during shutdown. Prevent unload of the module as certain pjsip initialization functions cannot be reversed. ASTERISK-24483 Change-Id: I94597ec8b8491f5af9c57bf66dbc3b078fe2d49d 2017-10-18 12:04 +0000 [7dd7ca2858] Corey Farrell * chan_sip: Fix output of 'sip set debug off'. When sip.conf contains 'sipdebug=yes' it is impossible to disable it using CLI 'sip set debug off'. This corrects the output of that CLI command to instruct the user to turn sipdebug off in the configuration file. ASTERISK-23462 #close Change-Id: I1cceade9caa9578e1b060feb832e3495ef5ad318 2017-10-06 10:51 +0000 [0a11097a22] Matt Jordan * res_corosync: Fix linking issue with Corosync 2.x At some point in time in the history of Corosync (certainly within the 2.x branch), the corosync_cfg_state_track function was removed. Unfortunately, the cfg library is only linked if this function is present. Without the cfg library being linked to res_corosync, loading of res_corosync will fail. This patch makes it so that detecting corosync's core libraries, determined by the COROSYNC external library checks, links both the cpg and cfg libraries with res_corosync. Change-Id: I674e9e1c8fea11c3bf81154aaa7c1fd43f945465 2017-10-06 15:55 +0000 [7f8c212e75] Richard Mudgett * cdr.c: Rename the Party A CDR container. * Rename the Party A CDR container from active_cdrs_by_channel to active_cdrs_master. * Renamed the support functions associated with active_cdrs_master appropriately. ASTERISK-27335 Change-Id: I6104bb3edc3a0b7243ce502e45e8832b0cff14f7 2017-10-02 17:42 +0000 [85723a9e50] Richard Mudgett * cdr.c: Add container to key off of Party B channel names. The CDR performance gets worse the further it gets behind in processing stasis messages. One of the reasons is because of a n*m loop used when processing Party B information. * Added a new CDR container that is keyed to Party B so we don't need such a large loop when processing Party B information. NOTE: To reduce the size of the patch I deferred to another patch the renaming of the Party A active_cdrs_by_channel container to active_cdrs_master and renaming the container's hash and cmp functions appropriately. ASTERISK-27335 Change-Id: I0bf66e8868f8adaa4b5dcf9e682e34951c350249 2017-10-10 07:42 +0000 [944e500e95] Tzafrir Cohen * declare optional openssl dependencies in moduleinfo Declare optional openssl dependencies in: * res_rtp_asterisk.c * tcptls.c ASTERISK-27328 #close Change-Id: I2636f1c05b8104b4fe6f36cce0ebd9a98b9c78ab 2017-10-13 09:43 +0000 [dcbf61a31e] Alexander Traud * res_pjsip_session: Rewrite o= with external_media_address. PJSIP allows a domain name as external_media_address. This allows chan_pjsip to be used behind a NAT with changing IP addresses. The IP address of that domain is resolved to the c= line already. This change sets also the o= line to that domain. ASTERISK-27341 #close Change-Id: I690163b6e762042ec38b3995aa5c9bea909d8ec4 2017-10-14 04:11 +0000 [85cada85d6] Guido Falsi * chan_dahdi: wrap include file which is not present on BSD systems in #ifdef The sys/sysmacros.h include file does not exist in BSD systems and is not required to build this module there. Since an "#if defined(__NetBSD__) || defined(__FreeBSD__)" section already exist I moved that include line inside it's #else branch. ASTERISK-27343 #close Change-Id: Ibfb64f4e9a0ce8b6eda7a7695cfe57916f175dc1 2017-10-13 08:51 +0000 [89f11364f6] Corey Farrell * ast_bt_get_symbols: Prevent double-free. It's possible for bfdobj to be created but syms not created. If syms was not allocated in the current loop iteration but was allocated in the previous iteration it would crash. ASTERISK-27340 Change-Id: I5b110c609f6dfe91339f782a99a431bca5837363 2017-10-13 08:12 +0000 [114ed320ea] Alexander Traud * tcptls: NULL-check the parameter of ast_ssl_teardown before accessing it. This avoids a crash on stopping a chan_sip which failed to start its TLS server. ASTERISK-27339 #close Change-Id: I327fc70db68eaaca5b50a15c7fd687fde79263d5 2017-09-29 14:26 +0000 [a8c6c3bd7d] Richard Mudgett * cdr.c: Eliminated many calls to ao2_global_obj_ref(). The CDR performance gets worse the further it gets behind in processing stasis messages. One of the reasons is we were getting the global config to determine if we needed to log a debugging message. * Many calls to ao2_global_obj_ref() were just so we could determine if debug mode is enabled. Made a global flag to check instead. * Eliminated many RAII_VAR() usages associated with the remaining ao2_global_obj_ref() calls. * Added missing NULL checks for the returned ao2_global_obj_ref() value. ASTERISK-27335 Change-Id: Iceaad93172862f610cad0188956634187bfcc7cd 2017-10-06 13:45 +0000 [b56fa63db8] Richard Mudgett * cdr.c: Defer getting ao2_global_obj_ref() until needed. The CDR performance gets worse the further it gets behind in processing stasis messages. One of the reasons is we were getting the global config even if we didn't need it. * Most uses of the global config were only needed on off nominal code paths so it makes sense to not get it until absolutely needed. ASTERISK-27335 Change-Id: I00c63b7ec233e5bfffd5d976f05568613d3c2365 2017-10-05 18:08 +0000 [92c5cf3920] Richard Mudgett * cdr.c: Set stringfields only if they are different. The CDR performance gets worse the further it gets behind in processing stasis messages. One of the reasons is we were repeatedly setting string fields to potentially the same string in base_process_party_a(). Setting a string field involves allocating room for the new string out of a memory pool which may have to allocate even more memory. * Check to see if the string field is already set to the desired string. ASTERISK-27335 Change-Id: I3ccb7e23f1488417e08cafe477755033eed65a7c 2017-10-05 18:03 +0000 [6393c106ca] Richard Mudgett * cdr.c: Fix setting dnid, callingsubaddr, and calledsubaddr The string comparisons for setting these CDR variables was inverted. We were repeatedly setting these CDR variables only if the channel snapshots had the same value. ASTERISK-27335 Change-Id: I9482073524411e7ea6c03805b16de200cb1669ea 2017-10-11 06:04 +0000 [407b78504d] Torrey Searle * contrib/script/sip_to_pjsip: implement 'all' for allow/disallow when 'all' is specified in an allow or disallow section, it should erase all values from the inverse section in the default config. E.G. allow=all should erase any deny values from default config & vice-versa ASTERISK-27333 #close Change-Id: I99219478fb98f08751d769daaee0b7795118a5a6 2018-02-21 19:00 +0000 Asterisk Development Team * asterisk certified/13.18-cert3 Released. 2018-01-31 13:37 +0000 [b8f704a1c5] Kevin Harwell * AST-2018-003: Crash with an invalid SDP fmtp attribute pjproject's fmtp retrieval function failed to catch invalid fmtp attributes. Because of this Asterisk would crash if given an SDP with an invalid fmtp attribute. When retrieving the format this patch now makes sure the fmtp attribute is available. If not available it now returns an error status. ASTERISK-27583 #close Change-Id: I5cebe000ce2d846cae3af33b6d72c416e51caf2f 2018-01-31 13:33 +0000 [ad93b6a031] Kevin Harwell * AST-2018-002: Crash with an invalid SDP media format description pjproject's media format parsing algorithm failed to catch invalid values. Because of this Asterisk would crash if given an SDP with a invalid media format description. When parsing the media format description this patch now properly parses the value and returns an error status if it can't successfully parse/convert the value. ASTERISK-27582 #close Change-Id: I883b3a4ef85b6972397f7b56bf46c5779c55fdd6 2018-02-06 12:07 +0000 [06acb4405e] George Joseph * AST-2018-005: res_pjsip_transport_management: Move to core Since res_pjsip_transport_management provides several attack mitigation features, its functionality moved to res_pjsip and this module has been removed. This way the features will always be available if res_pjsip is loaded. ASTERISK-27618 Reported By: Sandro Gauci Change-Id: I21a2d33d9dda001452ea040d350d7a075f9acf0d 2018-02-06 11:28 +0000 [bfa7b20040] George Joseph * AST-2018-005: Fix tdata leaks when calling pjsip_endpt_send_response(2) pjsip_distributor: authenticate() creates a tdata and uses it to send a challenge or failure response. When pjsip_endpt_send_response2() succeeds, it automatically decrements the tdata ref count but when it fails, it doesn't. Since we weren't checking for a return status, we weren't decrementing the count ourselves on error and were therefore leaking tdatas. res_pjsip_session: session_reinvite_on_rx_request wasn't decrementing the ref count if an error happened while sending a 491 response. pre_session_setup wasn't decrementing the ref count if while sending an error after a pjsip_inv_verify_request failure. res_pjsip: ast_sip_send_response wasn't decrementing the ref count on error. ASTERISK-27618 Reported By: Sandro Gauci Change-Id: Iab33a6c7b6fba96148ed465b690ba8534ac961bf 2018-02-07 08:09 +0000 [6267846fab] Joshua Colp * AST-2018-004: Restrict the number of Accept headers in a SUBSCRIBE. When receiving a SUBSCRIBE request the Accept headers from it are stored locally. This operation has a fixed limit of 32 Accept headers but this limit was not enforced. As a result it was possible for memory outside of the allocated space to get written to resulting in a crash. This change enforces the limit so only 32 Accept headers are processed. ASTERISK-27640 Reported By: Sandro Gauci Change-Id: I99a814b10b554b13a6021ccf41111e5bc95e7301 2018-01-31 17:48 +0000 [8e170f5f18] Richard Mudgett * app_confbridge: ConfbridgeList event has standard channel shapshot headers. * Made the AMI ConfbridgeList action's ConfbridgeList events output all the standard channel snapshot headers instead of a few hand-coded channel snapshot headers. The benefit is that the CallerIDName gets disruptive characters like CR, LF, Tab, and a few others escaped. However, an empty CallerIDName is now output as "" instead of "". ASTERISK-27651 Change-Id: Iaf7d54a9d40194c2db060bc9b4979fab6720d977 2018-01-31 15:45 +0000 [37445bc69e] Richard Mudgett * app_confbridge: Add the Muted header to ConfbridgeJoin AMI event. ASTERISK-27651 Change-Id: Idef2ca54d242d1b894efd3fc7b360bc6fd5bdc34 2018-01-30 19:22 +0000 [4560752184] Richard Mudgett * bridge_softmix.c: Report not talking immediately when muted. Currently in app_confbridge if someone mutes a channel while that channel is talking, the talk detection code is suspended while the channel is muted. As far an an external observer is concerned, the muted channel's talk status is still "talking" even though the channel is not contributing audio to the conference bridge. When the channel is later unmuted, it takes the usual 'dsp_silence_threshold' option time to clear the talking status even though the channel may have stopped talking while the channel was muted. * In bridge_softmix.c, clear the talking status and report talking stopped if the channel was talking when the channel is muted. When the channel is unmuted and the channel is still talking then report the channel as talking since it is contributing audio to the bridge again. ASTERISK-27647 Change-Id: Ie4fdbc05a0bc7343c2972bab012e2567917b3d4e 2017-12-22 08:14 +0000 [6f65ebe76c] Sean Bright * Remove as much trailing whitespace as possible. Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0 2017-12-22 22:30 +0000 Asterisk Development Team * asterisk certified/13.18-cert2 Released. 2017-12-20 16:17 +0000 [e99d0fe16b] Kevin Harwell * AST-2017-014: res_pjsip - Missing contact header can cause crash Those SIP messages that create dialogs require a contact header to be present. If the contact header was missing from the message it could cause Asterisk to crash. This patch checks to make sure SIP messages that create a dialog contain the contact header. If the message does not and it is required Asterisk now returns a "400 Missing Contact header" response. Also added NULL checks when retrieving the contact header that were missing as a "just in case". ASTERISK-27480 #close Change-Id: I1810db87683fc637a9e3e1384a746037fec20afe 2017-12-21 18:38 +0000 Asterisk Development Team * asterisk certified/13.18-cert1 Released. 2017-12-13 14:26 +0000 [9571a75842] George Joseph * README: Remove outdated references to tex docs Added links to the wiki to replace references to outdated tex docs. ASTERISK-27430 Reported by: Corey Farrell Change-Id: I5007e732b30bc7b63d124c530ae8857c89991209 2017-12-01 16:18 +0000 [ffc2b0eb91] Corey Farrell * README-SERIOUSLY.bestpractices.txt: Convert to markdown Follow-up to conversion of README.md. Change-Id: I17ee7cf25bc027ece844efa2c1dfe613aff1e35b 2017-11-21 09:16 +0000 [3948e9d616] Corey Farrell * README: Convert to README.md. Convert the README file to markdown format, remove the old README. This causes websites like github to display the README in a much nicer format with live links. The raw file is still very readable from plain text editors and terminals. Change-Id: I7d13131764a9a9026e5f8a6ddb245a01bbd788e7 2017-11-17 19:36 +0000 [5a204aac04] Corey Farrell * README: Send people to secure websites where available. We should be sending people to secure web URL's where available. Update README's and docs. Change-Id: Id5b1e049b0b18b49a784f1254605aefa244ce19a 2017-12-13 13:23 +0000 [673d7d081e] George Joseph * Update for certified/13.18-cert1-rc3 2017-11-30 10:12 +0000 [10b3d4cea8] Joshua Colp * AST-2017-012: Place single RTCP report block at beginning of report. When the RTCP code was transitioned over to Stasis a code change was made to keep track of how many reports are present. This count controlled where report blocks were placed in the RTCP report. If a compound RTCP packet was received this logic would incorrectly place a report block in the wrong location resulting in a write to an invalid location. This change removes this counting logic and always places the report block at the first position. If in the future multiple reports are supported the logic can be extended but for now keeping a count serves no purpose. ASTERISK-27382 ASTERISK-27429 Change-Id: Iad6c8a9985c4b608ef493e19c421211615485116 2017-12-07 17:51 +0000 [f493631fc6] Richard Mudgett * chan_pjsip/res_pjsip: Add CHANNEL(pjsip,request_uri) This patch does three things associated with the initial incoming INVITE request URI. 1) Add access to the full initial incoming INVITE request URI. 2) We were not setting DNID on incoming PJSIP channels. The DNID is the user portion of the initial incoming INVITE Request-URI. The value is accessed by reading CALLERID(dnid). 3) Fix CHANNEL(pjsip,target_uri) documentation. * The initial incoming INVITE request URI is now available using CHANNEL(pjsip,request_uri). * Set the DNID on PJSIP channel creation so CALLERID(dnid) can return the initial incoming INVITE request URI user portion. * CHANNEL(pjsip,target_uri) now correctly documents that the target URI is the contact URI. * Refactored print_escaped_uri() out of channel_read_pjsip() to handle pjsip_uri_print() error condition when the buffer is too small. ASTERISK-27478 Change-Id: I512e60d1f162395c946451becb37af3333337b33 2017-12-07 18:22 +0000 [733231905f] Kevin Harwell * pjsip_options: contacts sometimes not being updated on reload For both dynamic and static contacts it was possible that potential AOR changes were not being applied to all contacts. This was because the qualify and schedule code was only retrieving AOR's, and contacts with frequencies greater than zero. For instance the following could happen: and AOR/contact has a frequency of 5, it then gets set to 0, and then a reload occurs. All scheduled OPTIONS are stopped, a list of AOR's is retrieved with frequency > 0, but none are selected since in this scenario all are 0. The contact for the one previously set to 5 though does not get updated, so it's status remains "AVAILABLE". This patch makes it so all contacts (static and dynamic) are selected, and appropriately updated if need be. ASTERISK-27467 #close Change-Id: I7a920170f89c683af9505d4723a44fc6841decdb 2017-12-07 18:18 +0000 [3585b56792] Kevin Harwell * pjsip_options: dynamic contact's fields not updated on reload Dynamic contacts were not being properly updated on reload. As a matter of fact any changes to the AOR that a dynamic contact was associated with were not being applied. On reload, this patch makes it so for each dynamic contact, the associated AOR is now retrieved and the AOR's fields are applied to the contact. ASTERISK-27467 Change-Id: I8e3165dc6a745218c1c9db837f77fafa0516985d 2017-12-05 18:04 +0000 [8640e5d819] Richard Mudgett * CDR: Fix deadlock setting some CDR values. Setting channel variables with the AMI Originate action caused a deadlock when you set CDR(amaflags) or CDR(accountcode). This path has the channel locked when the CDR function is called. The CDR function then synchronously passes the job to a stasis thread. The stasis handling function then attempts to lock the channel. Deadlock results. * Avoid deadlock by making the CDR function handle setting amaflags and accountcode directly on the channel rather than passing it off to the CDR processing code under a stasis thread to do it. * Made the CHANNEL function and the CDR function process amaflags the same way. * Fixed referencing the wrong message type in cdr_prop_write(). ASTERISK-27460 Change-Id: I5eacb47586bc0b8f8ff76a19bd92d1dc38b75e8f 2017-11-16 02:47 +0000 [aa967e1eda] Pirmin Walthert * res_rtp_asterisk.c: Fix rtp source address learning for broken clients Some clients do not send rtp packets every ptime ms. This can lead to situations in which the rtp source learning algorithm will never learn the address of the client. This has been discovered on a Mac mini with a pjsip based softphone after updating to Sierra: as soon as USB headsets are involved, the softphone will send the second packet 30ms after the first, the third 30ms after the second and the fourth 1ms after the third. So in the old implmentation the rtp source learning algorithm was repeatedly reset on the fourth packet. The patch changes the algorithm in a way that doesn't take the arrival time between two consecutive packets into account but the time between the first and the last packet of a learning sequence. The patch also fixes a second problem: when a user was using a wrong value for the probation setting there was a LOG_WARNING output stating that the value had been set to the default value instead. However the code for setting the value back to defaults was missing. ASTERISK-27421 #close Change-Id: If778fe07678a6fd2041eaca7cd78267d0ef4fc6c 2017-11-30 12:50 +0000 [23fae9b147] Richard Mudgett * res_rtp_asterisk.c: Increase strictrtp learning timeout time. More complicated direct media reinvite negotiations can result in longer delays before direct media flows. The strictrtp learning timeout time was too short. One log showed that the first RTP packet came in just after three seconds. * Increase the strictrtp learning timeout time from 1.5 to 5 seconds. ASTERISK-27453 Change-Id: Ic5e711164cbb91b4d1c1e40c83697755640f138c 2017-11-30 14:38 +0000 [b205f05585] George Joseph * AST-2017-013: chan_skinny: Call pthread_detach when sess threads end chan_skinny creates a new thread for each new session. In trying to be a good cleanup citizen, the threads are joinable and the unload_module function does a pthread_cancel() and a pthread_join() on any sessions that are active at that time. This has an unintended side effect though. Since you can call pthread_join on a thread that's already terminated, pthreads keeps the thread's storage around until you explicitly call pthread_join (or pthread_detach()). Since only the module_unload function was calling pthread_join, and even then only on the ones active at the tme, the storage for every thread/session ever created sticks around until asterisk exits. * A thread can detach itself so the session_destroy() function now calls pthread_detach() just before it frees the session memory allocation. The module_unload function still takes care of the ones that are still active should the module be unloaded. ASTERISK-27452 Reported by: Juan Sacco Change-Id: I9af7268eba14bf76960566f891320f97b974e6dd 2017-12-01 06:07 +0000 [4d4c76c189] Joshua Colp * res_http_post: Not all versions of gmime have GMIME_MAJOR_VERSION. This change makes the presence of the GMIME_MAJOR_VERSION definition optional, as not all versions of gmime actually define it. ASTERISK-27454 Change-Id: I01d99590045971ed6787899147170a5954077238 2017-11-18 21:13 +0000 [86e12d7f37] Corey Farrell * tests: Fix warnings found on Mac. test_pbx used raise without explicitly including signal.h. On Mac for some reason nothing else includes it. test_logger checked if an unsigned int was negative. Switch the variable to 'int' so that error check can be effective. Change-Id: Ie1db5dd1818ac25cc2ae41b644f848b5865b1362 (cherry picked from commit 5fe2e7bfdcd06935594823faba67c71ead7ebcf5) 2017-11-15 11:02 +0000 [b64d924e1c] George Joseph * Update for certified/13.18-cert1-rc2 2017-11-13 14:35 +0000 [705dbd0468] Ben Ford * bundled_pjproject: Update to 2.7.1 Update from 2.7 to 2.7.1 for bundled pjproject. Changed version and removed patch files included in the update. Change-Id: I55cea8e734b318c2df9daf86aa0802c559ec8357 (cherry picked from commit e6ada55430c3df603f12cb20a56149dac61ce450) 2017-11-10 10:37 +0000 [0a62d69937] George Joseph * bundled_pjproject: sip_parser: Fix return code in pjsip_find_msg The default return code for pjsip_find_msg was PJ_SUCCESS so if a Content-Length header wasn't found at all, pjsip_find_msg was returning PJ_SUCCESS instead of PJSIP_EMISSINGHDR. Also added the volatile keyword to a few variables that are used both inside and outside the PJ_TRY/PJ_CATCH block. Partial fix for ASTERISK_27408 Change-Id: If82ba9de921e3d57df9c68cf96ee45ccc1491f7a (cherry picked from commit b5f2779a23aa6042893c2bdf6bebfcc5150b5300) 2017-11-10 07:06 +0000 [7e535a294e] Joshua Colp * pjsip: Add patch to allow all transports to be destroyed. If a transport is created with the same transport type, source IP address, and source port as one that already exists the old transport is moved into a linked list called "tp_list". If this old transport is later shutdown it will not be destroyed as the process checks whether the transport is valid or not. This check does not look at the "tp_list" when making the determination causing the transport to not be destroyed. This change updates the logic to query not just the main storage method for transports but also the "tp_list". Upstream issue https://trac.pjsip.org/repos/ticket/2061 ASTERISK-27411 Change-Id: Ic5c2bb60226df0ef1c8851359ed8d4cd64469429 2017-11-08 15:18 +0000 [3984942b13] Kevin Harwell * Update for certified/13.18-cert1-rc1 2017-10-19 13:35 +0000 [13508b8a16] Kevin Harwell * AST-2017-011 - res_pjsip_session: session leak when a call is rejected A previous commit made it so when an invite session transitioned into a disconnected state destruction of the Asterisk pjsip session object was postponed until either a transport error occurred or the event timer expired. However, if a call was rejected (for instance a 488) before the session was fully established the event timer may not have been initiated, or it was canceled without triggering either of the session finalizing states mentioned above. Really the only time destruction of the session should be delayed is when a BYE is being transacted. This is because it's possible in some cases for the session to be disconnected, but the BYE is still transacting. This patch makes it so the session object always gets released (no more memory leak) when the pjsip session is in a disconnected state. Except when the method is a BYE. Then it waits until a transport error occurs or an event timeout. ASTERISK-27345 #close Reported by: Corey Farrell Change-Id: I1e724737b758c20ac76d19d3611e3d2876ae10ed 2017-10-03 16:19 +0000 [be9ec689cf] Richard Mudgett * AST-2017-010: Fix cdr_object_update_party_b_userfield_cb() buf overrun cdr_object_update_party_b_userfield_cb() could overrun the fixed buffer if the supplied string is too long. The long string could be supplied by external means using the CDR(userfield) function. This may seem reminiscent to AST-2017-001 (ASTERISK_26897) and it is. The earlier patch fixed the buffer overrun for Party A's userfield while this patch fixes the same thing for Party B's userfield. ASTERISK-27337 Change-Id: I0fa767f65ecec7e676ca465306ff9e0edbf3b652 2017-10-19 13:53 +0000 [0e1a4d8c84] George Joseph * AST-2017-009: pjproject: Add validation of numeric header values Parsing the numeric header fields like cseq, ttl, port, etc. all had the potential to overflow, either causing unintended values to be captured or, if the values were subsequently converted back to strings, a buffer overrun. To address this, new "strto" functions have been created that do range checking and those functions are used wherever possible in the parser. * Created pjlib/include/limits.h and pjlib/include/compat/limits.h to either include the system limits.h or define common numeric limits if there is no system limits.h. * Created strto*_validate functions in sip_parser that take bounds and on failure call the on_str_parse_error function which prints an error message and calls PJ_THROW. * Updated sip_parser to validate the numeric fields. * Fixed an issue in sip_transport that prevented error messages from being properly displayed. * Added "volatile" to some variables referenced in PJ_CATCH blocks as the optimizer was sometimes optimizing them away. * Fixed length calculation in sip_transaction/create_tsx_key_2543 to account for signed ints being 11 characters, not 9. ASTERISK-27319 Reported by: Youngsung Kim at LINE Corporation Change-Id: I48de2e4ccf196990906304e8d7061f4ffdd772ff 2017-11-06 16:37 +0000 [7b4b17c843] Richard Mudgett * res_pjsip_registrar.c: Fix named AOR and pjproject group deadlock. One of the patches for ASTERISK_27147 introduced a deadlock regression. When the connection oriented transport shut down, the code attempted to remove the associated contact. However, that same transport had just requested a registration that we hadn't responded to yet. Depending upon timing we could deadlock. * Made send the REGISTER response after we completed processing the request contacts and released the named AOR lock to avoid the deadlock. ASTERISK-27391 Change-Id: I89a90f87cb7a02facbafb44c75d8845f93417364 2017-11-01 11:12 +0000 [18b0be292d] Ben Ford * res_pjsip: Add to list of valid characters for from_user. Fixes a regression where some characters were unable to be used in the from_user field of an endpoint. Additionally, the backtick was removed from the list of valid characters, since it is not valid, and it was replaced with a single quote, which is a valid character. ASTERISK-27387 Change-Id: Id80c10a644508365c87b3182e99ea49da11b0281 (cherry picked from commit ffcb7e2a2540181ea41062ca0e1bc3e4fed9b3a5) 2017-10-17 10:53 +0000 [d4b80e35a9] Richard Mudgett * res_pjproject.c: Upgrade bundled PJPROJECT to 2.7 Update patches included in bundled PJPROJECT for the new version. ASTERISK-27355 Change-Id: I9ac5dbbffaadca25ad24fac8b9ab615e5ace6083 2017-10-30 15:24 +0000 [d797270f4e] Kevin Harwell * Initialize 13.18-cert branch A new branch was created for what will be Asterisk certified 13.18. A couple of things needed to be done to the branch in order to complete initialization: Modified the version file to reflect the certified version. Updated all extended modules to be disabled by default. Change-Id: Ie1dd3cb146391dea92c9e3ef906dde8d7241fee2 2017-10-30 10:33 +0000 [719ac573a6] Kevin Harwell * Update for 13.18.0 2017-10-25 15:01 +0000 [82cedfbcb3] Kevin Harwell * Update for 13.18.0-rc2 2017-10-22 17:32 +0000 [db233704f4] Joshua Colp * res_xmpp: Ensure the connection filter is available. Users of the API that res_xmpp provides expect that a filter be available on the client at all times. When OAuth authentication support was added this requirement was not maintained. This change merely moves the OAuth authentication to after the filter is created, ensuring users of res_xmpp can add things to the filter as needed. ASTERISK-27346 Change-Id: I4ac474afe220e833288ff574e32e2b9a23394886 (cherry picked from commit 07e17fd04ffcf204400898660a4c118666596d5d) 2017-10-23 13:42 +0000 [72bf65f44f] Ben Ford * http.c: Fix http header send content. Currently ast_http_send barricades a portion of the content that needs to be sent in order to establish a connection for things like the ARI client. The conditional and contents have been changed to ensure that everything that needs to be sent, will be sent. ASTERISK-27372 Change-Id: I8816d2d8f80f4fefc6dcae4b5fdfc97f1e46496d 2017-10-13 12:46 +0000 [d5d1e98fa4] Kevin Harwell * Update for 13.18.0-rc1 2017-10-13 12:09 +0000 [4bc2aca9b7] Kevin Harwell * AMI: Increase version number Bump the AMI patch number since the following new addition was made: * Added a new CancelAtxfer action that cancels an attended transfer. Change-Id: I9bac528791bd62ef0e99243903b6bc7a6c7ab182 2017-08-25 08:19 +0000 [6d3ee9fb93] Thomas Sevestre * features, manager : Add CancelAtxfer AMI action Add action to cancel feature attended transfer with AMI interface ASTERISK-27215 #close Change-Id: Iab8a81362b5a1757e2608f70b014ef863200cb42 2017-10-06 04:55 +0000 [21d502818f] Daniel Tryba * res_pjsip_session: Prevent user=phone being added to anonimized URIs. Move ast_sip_add_usereqphone to be called after anonymization of URIs, to prevent the user_eq_phone adding "user=phone" to URIs containing a username that is not a phonenumber (RFC3261 19.1.1). An extra call to ast_sip_add_usereqphone on the saved version before anonymization is added to add user=phone" to the PAI. ASTERISK-27047 #close Change-Id: Ie5644bc66341b86dc08b1f7442210de2e6acdec6 2017-10-06 05:14 +0000 [af09996178] Daniel Tryba * res_pjsip: Prevent "user=phone" being added multiple times to header ast_sip_add_usereqphone adds "user=phone" to the header every time is is called without checking whether the param already exists. Preventing this by searching to string representation of header for "user=phone". ASTERISK-26988 #close Change-Id: Ib84383b07254de357dc6a98d91fc1d2c2c3719e6 2017-10-10 09:49 +0000 [8e05796e81] Tzafrir Cohen * cdr_mysql: avoid releasing a config string Fixes a memory corruption issue after a reload of cdr_mysql. Issue was accidentally included in 747beb1ed159f89a3b58742e4257740b3d6d6bba . ASTERISK-27270 #close Change-Id: I90b6a9d18710c0f9009466370bd5f4bac5d5d12e 2017-10-05 18:12 +0000 [5f6bad6733] Richard Mudgett * cdr.c: Defer misc checks. Try to defer some checks until needed in case there is an early exit. Change-Id: Ibc6b34c38a4f60ad4f9b67984b7d070a07257064 2017-10-11 07:03 +0000 [f3f141781c] George Joseph * chan_vpb: Fix a gcc 7 out-of-bounds complaint chan_vpb was trying to use sizeof(*p->play_dtmf), where p->play_dtmf is defined as char[16], to get the length of the array but since p->play_dtmf is an actual array, sizeof(*p->play_dtmf) returns the size of the first array element, which is 1. gcc7 validly complains because the context in which it's used could cause an out-of-bounds condition. Change-Id: If9c4bfdb6b02fa72d39e0c09bf88900663c000ba 2017-10-06 02:39 +0000 [416e35589e] Nathan Bruning * app_queue.c: clear moh field in init_queue ASTERISK-27301 #close Change-Id: Ic31361f34e2de3b6470e68fc37205a7711082eba 2017-10-10 12:01 +0000 [e71a65a358] Sean Bright * app_originate: Set ORIGINATE_STATUS correctly on failure We were ignoring the return value from ast_pbx_outgoing_exten() and ast_pbx_outgoing_app() which could fail before setting the reason code. This resulted in failures being reported as success. ASTERISK-25266 #close Reported by: Allen Ford Change-Id: Idf16237b7e41b527d2c69c865829128686beeb3b 2017-10-02 16:46 +0000 [42fdfffefc] Richard Mudgett * cdr.c: Eliminated simple RAII_VAR usages. Change-Id: I150505db307249a962987e7b941bdd369bb91f35 2017-10-09 22:51 +0000 [48971e4d43] Corey Farrell * res_pjproject: Fix cleanup of buildopts vector. ASTERISK-27306 Change-Id: I3bed0edf3f55b1d4adcbabb25ec14f11dc766c72 2017-10-03 16:09 +0000 [128f7ffaa2] Richard Mudgett * cdr.c: Replace redundant check with an ast_assert() The only caller of cdr_object_fn_table.process_party_b() explicitly does the check before calling. Change-Id: Ib0c53cdf5048227842846e0df9d2c19117c45618 2017-10-02 17:41 +0000 [3525081a7c] Richard Mudgett * cdr.c: Replace inlined code with ao2_t_replace() Change-Id: I9f424f5282ca7d833592f958d95f1b2bafb549b0 2017-09-29 12:07 +0000 [7366657a9a] Richard Mudgett * cdr.c: Use current ao2 flag names Change-Id: Ib59d7d2f2a4a822754628f2c48a308d6791a6e6e 2017-09-29 12:31 +0000 [34d55352a5] Richard Mudgett * cdr.h: Fix doxygen comments. * Also some misc formatting in cdr.c. Change-Id: Ied89a28802a662c37c43326a1aafdce596e0df4a 2017-09-20 18:36 +0000 [d388c18abf] Richard Mudgett * res_pjsip_registrar.c: Update remove_existing AOR contact handling. When "rewrite_contact" is enabled, the "max_contacts" count option can block re-registrations because the source port from the endpoint can be random. When the re-registration is blocked, the endpoint may give up re-registering and require manual intervention. * The "remove_existing" option now allows a registration to succeed by displacing any existing contacts that now exceed the "max_contacts" count. Any removed contacts are the next to expire. The behaviour change is beneficial when "rewrite_contact" is enabled and "max_contacts" is greater than one. The removed contact is likely the old contact created by "rewrite_contact" that the device is refreshing. ASTERISK-27192 Change-Id: I64c107a10b70db1697d17136051ae6bf22b5314b 2017-10-04 10:46 +0000 [82592c3673] Corey Farrell * res_pjsip: Fix issues that prevented shutdown of modules. res_pjsip and res_pjsip_session had circular references, preventing both modules from shutting down. * Move session supplement registration to res_pjsip. * Use create internal functions for use by pjsip_message_filter.c. ASTERISK-27306 Change-Id: Ifbd5c19ec848010111afeab2436f9699da06ba6b 2017-10-09 08:15 +0000 [6b16fa12c8] Sean Bright * res_config_sqlite: Don't enable SQLite CDRs when running 'make samples' Change-Id: I65a5190b2732b2246d67472db70dd37db64ddad4 2017-10-08 14:05 +0000 [39b68a41f7] David Hajek * res/res_ari.c Fix: Memory leaks in ARI when using Content-Type: application/json ASTERISK-27305 Reported by: David Hajek Tested by: David Hajek Change-Id: Ife3e289062e6cf7d0e7d342dbf79ed96feff441e 2017-10-08 09:11 +0000 [209916981a] Alexander Traud * tcptls: Do not re-bind to wildcard on client creation. Since ASTERISK-26922, this issue affected only those chan_sip which were * enabled for dual-stack (bindaddr=::), and * enabled for TCP (tcpenable=yes) and/or TLS (tlsenable=yes), and * tried to register and/or invite a IPv4-only service, * via TCP and/or TLS. Now, ast_tcptls_client_create does not re-bind to [::] anymore. ASTERISK-27324 #close Change-Id: I4b242837bdeb1ec7130dc82505c6180a946fd9b5 2017-10-05 16:26 +0000 [f1163c0f6f] Corey Farrell * res_pjsip: Fix leak of persistent endpoint references. Do not manually call sip_endpoint_apply_handler from load_all_endpoints. This is not necessary and causes memory leaks. Additionally reinitialize persistent->aors when we reuse a persistent object with a new endpoint. ASTERISK-27306 Change-Id: I59bbfc8da8a14d5f4af8c5bb1e71f8592ae823eb 2017-10-05 17:59 +0000 [8bf4be1048] Corey Farrell * vector: multiple evaluation of elem in AST_VECTOR_ADD_SORTED. Use temporary variable to prevent multiple evaluations of elem argument. This resolves a memory leak in res_pjproject startup. ASTERISK-27317 #close Change-Id: Ib960d7f5576f9e1a3c478ecb48995582a574e06d 2017-10-05 15:54 +0000 [5110600f1e] Corey Farrell * res_pjsip: Fix leak of fake_auth references. pjsip_distributor leaks references to fake_auth when the default realm has not changed. ASTERISK-27306 Change-Id: I3fcf103b3680ad2d1d4610dcd6738eeaebf4d202 2017-10-05 20:23 +0000 [462dd7c2de] Corey Farrell * main/strings: Fix uninitialized value. ast_strings_match uses sscanf and checks for non-zero return to verify a token was parsed. This is incorrect as sscanf returns EOF (-1) for errors. ASTERISK-27318 #close Change-Id: Ifcece92605f58116eff24c5a0a3b0ee08b3c87b1 2017-09-28 02:56 +0000 [29c442b587] Benoît Dereck-Tricot * res_calendar_icalendar: Filter out occurrences superceded by another VEVENT When we are loading the calendars, we call libical's icalcomponent_foreach_recurrence method for each VEVENT component that we have in our calendar. That method has no knowledge concerning the existence of the other VEVENT components and will feed our callback with all ocurrences matching the requested time span. The occurrences generated by icalcomponent_foreach_recurrence while expanding a recurring VEVENT's RRULE and RDATE properties can be superceded by an other VEVENT sharing the same UID. I use an external iterator (in libical terminology) to avoid messing with the internal ones from the calling function, and search for VEVENTS which could supersede the current occurrence. The event which can invalidate this occurence needs to have: - the same UID as our recurrent component (comp) - a RECURRENCE-ID property, which represents the start time of this occurrence If one component is found, just clean and return. ASTERISK-27296 #close Reported by: Benoît Dereck-Tricot Change-Id: I8587ae3eaa765af7cb21eda3b6bf84e8a1c87af8 2017-10-03 15:16 +0000 [6c30f4a2d1] Torrey Searle * contrib/thirdparty/sip_to_pjsip: add additional flag mappings add mappings for udptl redundancy, rtptimeout, and debug flags Change-Id: Ie73cf5c83c05dee01eb9624ede76c1a30225d73a 2017-10-02 07:48 +0000 [6dfe5b29b6] Daniel Tryba * res_pjsip_caller_id chan_sip: Comply to RFC 3323 values for privacy Currently privacy requests are only granted if the Privacy header value is exactly "id" (defined in RFC 3325). It ignores any other possible value (or a combination there of). This patch reverses the logic from testing for "id" to grant privacy, to testing for "none" and granting privacy for any other value. "none" must not be used in combination with any other value (RFC 3323 section 4.2). ASTERISK-27284 #close Change-Id: If438a21f31a962da32d7a33ff33bdeb1e776fe56 2017-09-28 17:37 +0000 [0945f10d3b] Richard Mudgett * app_queue.c: Fix announcements when announce-to-first-user not enabled. The previous patch for ASTERISK-27216 made it so you wouldn't get any position or periodic announcements unless you had announce-to-first-user enabled. The announce-to-first-user feature was added by ASTERISK_21782 as a result of the patch which introduced the redundant announcements that ASTERISK-27216 removes. * By noting that the makeannouncement variable is used to suppresses the first user announcement, we set its initial value to the announce-to-first-user enable setting. ASTERISK-27216 Change-Id: Ieaeb7dbea8ae7073086b775fbafe0625b000b10a 2017-09-21 14:43 +0000 [a433bb38b5] Richard Mudgett * heap.c: No need to calloc heap pointer array. Change-Id: I5ae2f316229f336eb90d99c7af7ed07a33097e68 2017-09-27 13:45 +0000 [47620ea862] George Joseph * logger: Bring back ability to turn debug on by source file Somewhere along the way we lost the ability to debug individual source files. For modules, this wasn't a big deal but all the source files in ./main are in the one "core" module so debugging individual core capabilities was almost impossible. * Added a test to DEBUG_ATLEAST that also checks __FILE__ instead of just module name. Any source file will work even if it's in a module subdirectory. Change-Id: Icc0af41837f3b1679dec7af21fa32cd1f7469f6e 2017-09-26 11:01 +0000 [d70d7b2f5d] George Joseph * pjsip_message_filter: Fix regression causing bad contact address The "res_pjsip: Filter out non SIP(S) requests" commit moved the filtering of messages to pjproject's PJSIP_MOD_PRIORITY_TRANSPORT_LAYER in order to filter out incoming bad uri schemes as early as possible. Since the change affected outgoing messages as well and the TRANSPORT layer is the last to be run on outgoing messages, we were overwriting the setting of external_signaling_address (which is set earlier by res_pjsip_nat) with an internal address. * pjsip_message_filter now registers itself as a pjproject module twice. Once in the TSX layer for the outgoing messages (as it was originally), then a second time in the TRANSPORT layer for the incoming messages to catch the invalid uri schemes. ASTERISK-27295 Reported by: Sean Bright Change-Id: I2c90190c43370f8a9d1c4693a19fd65840689c8c 2017-09-13 21:31 +0000 [221d8a5c24] Richard Mudgett * res_rtp_asterisk.c: Fix bridge_p2p_rtp_write() reentrancy potential. The bridge_p2p_rtp_write() has potential reentrancy problems. * Accessing the bridged RTP members must be done with the instance1 lock held. The DTMF and asymmetric codec checks must be split to be done with the correct RTP instance struct locked. i.e., They must be done when working on the appropriate side of the point to point bridge. * Forcing the RTP mark bit was referencing the wrong side of the point to point bridge. The set mark bit is used everywhere else to set the mark bit when sending not receiving. The patches for ASTERISK_26745 and ASTERISK_27158 did not take into account that not everything carried by RTP uses a codec. The telephony DTMF events are not exchanged with a codec. As a result when RFC2833/RFC4733 sent digits you would crash if "core set debug 1" is enabled, the DTMF digits would always get passed to the core even though the local native RTP bridge is active, and the DTMF digits would go out using the wrong SSRC id. * Add protection for non-format payload types like DTMF when updating the lastrxformat and lasttxformat. Also protect against non-format payload types when checking for asymmetric codecs. ASTERISK-27292 Change-Id: I6344ab7de21e26f84503c4d1fca1a41579364186 2017-09-25 13:09 +0000 [f3b1b64d21] Sean Bright * pjproject: Patch to correct STUN FINGERPRINT usage Change-Id: I0e453253dff1388b0186b36c754457c1d0d12db6 2017-09-25 10:59 +0000 [8d2c3effc2] Richard Mudgett * channel.c: Fix invalid reference in conditionaled out code. ASTERISK-27289 Change-Id: I7a415948116493050614d9f4fa91ffbe0c21ec4c 2017-09-25 07:25 +0000 [690f7f7c76] George Joseph * build: A few gcc 7 error fixes Change-Id: I7b5300fbf1af7d88d47129db13ad6dbdc9b553ec 2017-09-22 10:02 +0000 [f39af4d36d] Sean Bright * res_pjsip: Use ast_sip_is_content_type() where appropriate Change-Id: If3ab0d73d79ac4623308bd48508af2bfd554937d 2017-09-19 05:22 +0000 [c98e980fff] Rodrigo Ramírez Norambuena * res_config_pgsql: Fix removed support to previous for versions PostgreSQL 9.1 In PostgreSQL 9.1 the backslash are string literals and not the escape of characters. In previous issue ASTERISK_26057 was fixed the use of escape LIKE but the support for old version of Postgresql than 9.1 was dropped. The sentence before make was "ESCAPE '\'" but in version before than 9.1 need it to be as follow "ESCAPE '\\'". ASTERISK-27283 Change-Id: I96d9ee1ed7693ab17503cb36a9cd72847165f949 2017-09-15 02:59 +0000 [0adf6f3bd9] Stefan Engström * app_queue: Only do announcement logic between ringing cycles This patch reverts the change by patch 2263 from old reviewboard. Note that reverting that 2263-patch still preserves the behaviour that the commit log of the 2263-patch claimed to add. The reason for this is: The function wait_for_answer is only called from try_calling which in turn is only called from the main for loop in queue_exec, and earlier in that loop we already check the things that's removed by this patch. There's no need to check those things twice each loop iteration, and I think the proper place to check it is before each ringing cycle. By checking it in wait_for_answer, you allow the issue explained in the jira - that the head caller hears announcements while the agents' sip phones are actively ringing. Reported-by: Stefan Engström Tested-by: Stefan Engström ASTERISK-27216 #close Change-Id: Ic4290dc75256f9743900c6762ee1bb915f672db0 2017-09-07 04:41 +0000 [da40976987] Jean Aunis * bridge : Fix one-way direct-media when early bridging with native_rtp When two channels were early bridged in a native_rtp bridge, the RTP description on one side was not updated when the other side answered. This patch forbids non-answered channels to enter a native_rtp bridge, and triggers a bridge reconfiguration when an ANSWER frame is received. ASTERISK-27257 Change-Id: If1aaee1b4ed9658a1aa91ab715ee0a6413b878df 2017-09-19 10:38 +0000 [828a0611bc] George Joseph * res_pjsip_pubsub: Check for Content-Type header in rx_notify_request pubsub_on_rx_notify_request wasn't checking for a null Content-Type header before checking that it was application/simple-message-summary. ASTERISK-27279 Reported by: Ross Beer Change-Id: Iec2a6c4d2e74af37ff779ecc9fd35644c5c4ea52 2017-09-19 09:34 +0000 [94f616e5e2] David J. Pryke * chan_sip: Expose read-only access to the full SIP INVITE Request-URI Provide a way to get the contents of the the Request URI from the initial SIP INVITE in dial plan function call. (In this case "${CHANNEL(ruri)}") ASTERISK-27278 Reported by: David J. Pryke Tested by: David J. Pryke Change-Id: I1dd4d6988eed1b6c98a9701e0e833a15ef0dac3e 2017-09-18 10:27 +0000 [cfc0ca1fb5] Alexander Traud * tcptls: Fixed a white space error. ASTERISK-26606 Change-Id: I81a7268ef7ba012d4d80d44c70b6276d48e397fa 2017-09-18 10:00 +0000 [99a08eb7ab] Alexander Traud * res_srtp: lower log level of auth failures Previously, sRTP authentication failures were reported on log level WARNING. When such failures happen, each RT(C)P packet is affected, spamming the log. Now, those failures are reported at log level VERBOSE 2. Furthermore, the amount is further reduced (previously all two seconds, now all three seconds). Additionally, the new log entry informs whether media (RTP) or statistics (RTCP) are affected. ASTERISK-16898 #close Change-Id: I6c98d46b711f56e08655abeb01c951ab8e8d7fa0 2017-09-13 03:46 +0000 [f1eb36ea51] alex * cdr_mysql.c: Apply cdrzone to start and answer Change-Id: I7de0a5adc89824a5f2b696fc22c80fc22dff36b0 2017-08-25 17:01 +0000 [6d4b801c83] Richard Mudgett * AST-2017-008: Improve RTP and RTCP packet processing. Validate RTCP packets before processing them. * Validate that the received packet is of a minimum length and apply the RFC3550 RTCP packet validation checks. * Fixed potentially reading garbage beyond the received RTCP record data. * Fixed rtp->themssrc only being set once when the remote could change the SSRC. We would effectively stop handling the RTCP statistic records. * Fixed rtp->themssrc to not treat a zero value as special by adding rtp->themssrc_valid to indicate if rtp->themssrc is available. ASTERISK-27274 Make strict RTP learning more flexible. Direct media can cause strict RTP to attempt to learn a remote address again before it has had a chance to learn the remote address the first time. Because of the rapid relearn requests, strict RTP could latch onto the first remote address and fail to latch onto the direct media remote address. As a result, you have one way audio until the call is placed on and off hold. The new algorithm learns remote addresses for a set time (1.5 seconds) before locking the remote address. In addition, we must see a configured number of remote packets from the same address in a row before switching. * Fixed strict RTP learning from always accepting the first new address packet as the new stream. * Fixed strict RTP to initialize the expected sequence number with the last received sequence number instead of the last transmitted sequence number. * Fixed the predicted next sequence number calculation in rtp_learning_rtp_seq_update() to handle overflow. ASTERISK-27252 Change-Id: Ia2d3aa6e0f22906c25971e74f10027d96525f31c 2017-09-13 14:14 +0000 [5075cc8eed] Sean Bright * res_calendar: On reload, update all configuration This changes the behavior of res_calendar to drop all existing calendars and re-create them whenever a reload is done. The Calendar API provides no way for configuration information to be pushed down to calendar 'techs' so updated settings would not take affect until a module unload/load was done or Asterisk was restarted. Asterisk 15+ already has a configuration option 'fetch_again_at_reload' that performs a similar function. Also fix a tiny memory leak in res_calendar_caldav while we're at it. ASTERISK-25524 #close Reported by: Jesper Change-Id: Ib0f8057642e9d471960f1a79fd42e5a3ce587d3b 2017-09-13 16:23 +0000 [63900374fa] George Joseph * res_pjsip: Filter out non SIP(S) requests Incoming requests with non sip(s) URIs in the Request, To, From or Contact URIs are now rejected with PJSIP_SC_UNSUPPORTED_URI_SCHEME (416). This is performed in pjsip_message_filter (formerly pjsip_message_ip_updater) and is done at pjproject's "TRANSPORT" layer before a request can even reach the distributor. URIs read by res_pjsip_outbound_publish from pjsip.conf are now also checked for both length and sip(s) scheme. Those URIs read by outbound registration and aor were already being checked for scheme but their error messages needed to be updated to include scheme failure as well as length failure. Change-Id: Ibb2f9f1d2dc7549da562af4cbd9156c44ffdd460 2017-09-13 14:08 +0000 [db785ddb92] Sean Bright * res_calendar: Various fixes * The way that we were looking at XML elements for CalDAV was extremely fragile, so use SAX2 for increased robustness. * Don't complain about a 'channel' not be specified if autoreminder is not set. Assume that if 'channel' is not set, we don't want to be notified. * Fix some truncated CLI output in 'calendar show calendar' and make the 'Autoreminder' description a bit more clear ASTERISK-24588 #close Reported by: Stefan Gofferje ASTERISK-25523 #close Reported by: Jesper Change-Id: I200d11afca6a47e7d97888f286977e2e69874b2c 2017-09-13 09:38 +0000 [0688f61a01] Sean Bright * chan_rtp: Use μ-law by default instead of signed linear Multicast/Unicast RTP do not use SDP so we need to use a format that cleanly maps to one of the static RTP payload types. Without this change, an Originate to a Multicast or Unicast channel without a format specified would produce no audio on the receiving device. ASTERISK-21399 #close Reported by: Tzafrir Cohen Change-Id: I97e332b566e85da04b0004b9b0daae746cfca0e3 2017-09-11 05:46 +0000 [ed2a4ee81e] George Joseph * res_pjsip: Add handling for incoming unsolicited MWI NOTIFY A new endpoint parameter "incoming_mwi_mailbox" allows Asterisk to receive unsolicited MWI NOTIFY requests and make them available to other modules via the stasis message bus. res_pjsip_pubsub has a new handler "pubsub_on_rx_mwi_notify_request" that parses a simple-message-summary body and, if endpoint->incoming_mwi_account is set, calls ast_publish_mwi_state with the voice-message counts from the message. Change-Id: I08bae3d16e77af48fcccc2c936acce8fc0ef0f3c 2017-09-08 21:41 +0000 [044674c0cd] Richard Mudgett * res_rtp_asterisk.c: Add doxygen to RTCP payload types. Change-Id: I3f20ce428777cc4ce9c13b2f808d29ff8c873998 2017-09-11 05:52 +0000 [5ff2d06aa6] George Joseph * alembic: Fix typo in add_auto_info_to_endpoint_dtmf_mode The downgrade function was missing "_v2" at the end of the alter column type. Change-Id: Iaa9bcef48d6f3590ce07a61342d8e66f00263d8e 2017-09-10 06:17 +0000 [babb617f20] Walter Doekes * res/res_pjsip: Fix localnet checks in pjsip, part 2. In 45744fc53, I mistakenly broke SDP media address rewriting by misinterpreting which address was checked in the localnet comparison. Instead of checking the remote peer address to decide whether we need media address rewriting, we check our local media address: if it's local, then we rewrite. This feels awkward, but works and even made directmedia work properly if you set local_net. (For the record: for local peers, the SDP media rewrite code is not called, so the comparison does no harm there.) ASTERISK-27248 #close Change-Id: I566be1c33f4d0a689567d451ed46bab9c3861d4f 2017-09-05 11:13 +0000 [ad606844be] Florian Floimair * alembic: Add support for MS-SQL MS-SQL has no native Enum-type support and therefore needs to work with constraints. Since these constraints need unique names the suggested approach referenced in the following alembic documentation has been applied: http://bit.ly/2x9r8pb ASTERISK-27255 #close Change-Id: I4a399ba3eed41a33ce8cb294968ad340221580ee 2017-09-05 07:31 +0000 [2aefc6e5fe] Jacek Konieczny * func_cdr: honour 'u' flag on dummy channel Fixes ${CDR(...,u)} when used in cdr_custom.conf ASTERISK-27165 #close Change-Id: Ia4e0b6ba93e03d27886354c279737790e2cd6a83 2017-09-06 16:05 +0000 [c0d4f1880e] Scott Griepentrog * chan_sip: when getting sip pvt return failure if not found In handle_request_invite, when processing a pickup, a call is made to get_sip_pvt_from_replaces to locate the pvt for the subscription. The pvt is assumed to be valid when zero is returned indicating no error, and is dereferenced which can cause a crash if it was not found. This change checks the not found case and returns -1 which allows the calling code to fail appropriately. ASTERISK-27217 #close Reported-by: Bryan Walters Change-Id: I6bee92b8b8b85fcac3fd66f8c00ab18bc1765612 2017-09-06 10:50 +0000 [e4797b2cbd] Sean Bright * app_waitforsilence: Cleanup & don't treat missing frames as 'noise' * WaitForSilence completes successfully if it receives no media in the specified timeout, but when acting as WaitForNoise that logic needs to be reversed. * Use standard argument parsing macros and add some error checking for invalid values. * The documentation indicated that the first argument to both WaitForSilence and WaitForNoise was required when it was not. Update the documentation to reflect that. * Wrap up some behavior in structs to avoid boolean checks all over the place. ASTERISK-24066 #close Reported by: M vd S Change-Id: I01d40adc5b63342bb5018a1bea2081a0aa191ef9 2017-09-01 05:17 +0000 [186ef1a657] George Joseph * stasis/control: Fix possible deadlock with swap channel If an error occurs during a bridge impart it's possible that the "bridge_after" callback might try to run before control_swap_channel_in_bridge has been signalled to continue. Since control_swap_channel_in_bridge is holding the control lock and the callback needs it, a deadlock will occur. * control_swap_channel_in_bridge now only holds the control lock while it's actually modifying the control structure and releases it while the bridge impart is running. * bridge_after_cb is now tolerant of impart failures. Change-Id: Ifd239aa93955b3eb475521f61e284fcb0da2c3b3 2017-09-06 05:23 +0000 [597d1f8951] Vitezslav Novy * chan_sip: Do not change IP address in SDP origin line (o=) in SIP reINVITE If directmedia=yes is configured, when call is answered, Asterisk sends reINVITE to both parties to set up media path directly between the endpoints. In this reINVITE msg SDP origin line (o=) contains IP address of endpoint instead of IP of asterisk. This behavior violates RFC3264, sec 8: "When issuing an offer that modifies the session, the "o=" line of the new SDP MUST be identical to that in the previous SDP, except that the version in the origin field MUST increment by one from the previous SDP." This patch assures IP address of Asterisk is always sent in SDP origin line. ASTERISK-17540 Reported by: saghul Change-Id: I533a047490c43dcff32eeca8378b2ba02345b64e 2017-09-06 07:54 +0000 [15ddc9acb3] George Joseph * alembic: Fix enum creation for dtls_fingerprint Change-Id: Ic061c5066a146616a68376881c7e4cf6d6e7e7db 2017-09-05 11:08 +0000 [2370469645] Florian Floimair * alembic: fix erroneous commit for add_prune_on_boot Added include for postgresql ENUM type and redefined values in the same way as in the other migration scripts. ASTERISK-27254 #close Change-Id: Id667304cdf3891b1c2f7d35fab3e2a84026159fa 2017-09-06 03:15 +0000 [13aa1241c3] Alexander Traud * res_srtp: Add support for libsrtp2.1. Asterisk is able to use libSRTP 2.0.x. However since libSRTP 2.1.x, the macro SRTP_AES_ICM got renamed to SRTP_AES_ICM_128. Beside to still compile with previous versions of libSRTP, this change allows libSRTP 2.1.x as well. ASTERISK-27253 #close Change-Id: I2e6eb3c3bc844fee8a624060a2eb6f182dc70315 2017-09-05 09:35 +0000 [598a18ffee] Ben Ford * chan_pjsip: Suppress frame warnings. When rtp_keepalive is on for a PJSIP endpoint dialing to another Asterisk instance also using PJSIP, Asterisk will continue to print warning messages about not being able to send frames of a certain type. This suppresses that warning message. Change-Id: I0332a05519d7bda9cacfa26d433909ff1909be67 2017-08-25 17:05 +0000 [6c922b3157] Richard Mudgett * res_rtp_asterisk.c: Check RTP packet version earlier. Change-Id: Ic6493a7d79683f3e5845dff1cee49445fd5a0adf 2017-09-05 10:05 +0000 [3f7d0b63fc] Sean Bright * formats: Restore previous fread() behavior Some formats are able to handle short reads while others are not, so restore the previous behavior for the format modules so that we don't have spurious errors when playing back files. ASTERISK-27232 #close Reported by: Jens T. Change-Id: Iab7f52b25a394f277566c8a2a4b15a692280a300 2017-09-05 09:16 +0000 [45744fc53d] Walter Doekes * res/res_pjsip: Standardize/fix localnet checks across pjsip. In 2dee95cc (ASTERISK-27024) and 776ffd77 (ASTERISK-26879) there was confusion about whether the transport_state->localnet ACL has ALLOW or DENY semantics. For the record: the localnet has DENY semantics, meaning that "not in the list" means ALLOW, and the local nets are in the list. Therefore, checks like this look wrong, but are right: /* See if where we are sending this request is local or not, and if not that we can get a Contact URI to modify */ if (ast_apply_ha(transport_state->localnet, &addr) != AST_SENSE_ALLOW) { ast_debug(5, "Request is being sent to local address, " "skipping NAT manipulation\n"); (In the list == localnet == DENY == skip NAT manipulation.) And conversely, other checks that looked right, were wrong. This change adds two macro's to reduce the confusion and uses those instead: ast_sip_transport_is_nonlocal(transport_state, addr) ast_sip_transport_is_local(transport_state, addr) ASTERISK-27248 #close Change-Id: Ie7767519eb5a822c4848e531a53c0fd054fae934 2017-09-05 05:23 +0000 [786c4791f9] George Joseph * res_pjsip_t38: Make t38_reinvite_response_cb tolerant of NULL channel t38_reinvite_response_cb can get called by res_pjsip_session's session_inv_on_tsx_state_changed in situations where session->channel is NULL. If it is, the ast_log warning segfaults because it tries to get the channel name from a NULL channel. * Check session->channel and print "unknown channel" when it's NULL. ASTERISK-27236 Reported by: Ross Beer Change-Id: I4326e288d36327f6c79ab52226d54905cdc87dc7 2017-09-01 16:17 +0000 [55f30c29fd] Sean Bright * rtp_engine: Prevent possible double free with DTLS config ASTERISK-27225 #close Reported by: Richard Kenner Change-Id: I097b81734ef730f8603c0b972909d212a3a5cf89 2017-09-01 13:15 +0000 [f36db2dbdc] Sean Bright * chan_ooh323: Fix confusing indentation warning ASTERISK-27177 #close Reported by: Tzafrir Cohen Change-Id: I40311c404edb2302a7543ad5ca7a06b2a38f2d97 2017-09-01 09:51 +0000 [5f4863d4f9] Sean Bright * app_directory: Handle a NULL mailbox without crashing ASTERISK-27241 #close Reported by: David Moore Change-Id: Ibbbca85517b04c315406ebfe3b6f7e0763daedc6 2017-07-24 10:48 +0000 [990b017668] George Joseph * pjsip_message_ip_updater: Fix issue handling "tel" URIs sanitize_tdata was assuming all URIs were SIP URIs so when a non SIP uri was in the From, To or Contact headers, the unconditional cast of a non-pjsip_sip_uri structure to pjsip_sip_uri caused a segfault when trying to access uri->other_param. * Added PJSIP_URI_SCHEME_IS_SIP(uri) || PJSIP_URI_SCHEME_IS_SIPS(uri) checks before attempting to cast or use the returned uri. ASTERISK-27152 Reported-by: Ross Beer Change-Id: Id380df790e6622c8058a96035f8b8f4aa0b8551f 2017-07-01 19:24 +0000 [04ee3eb774] Corey Farrell * AST-2017-006: Fix app_minivm application MinivmNotify command injection An admin can configure app_minivm with an externnotify program to be run when a voicemail is received. The app_minivm application MinivmNotify uses ast_safe_system() for this purpose which is vulnerable to command injection since the Caller-ID name and number values given to externnotify can come from an external untrusted source. * Add ast_safe_execvp() function. This gives modules the ability to run external commands with greater safety compared to ast_safe_system(). Specifically when some parameters are filled by untrusted sources the new function does not allow malicious input to break argument encoding. This may be of particular concern where CALLERID(name) or CALLERID(num) may be used as a parameter to a script run by ast_safe_system() which could potentially allow arbitrary command execution. * Changed app_minivm.c:run_externnotify() to use the new ast_safe_execvp() instead of ast_safe_system() to avoid command injection. * Document code injection potential from untrusted data sources for other shell commands that are under user control. ASTERISK-27103 Change-Id: I7552472247a84cde24e1358aaf64af160107aef1 2017-05-22 10:36 +0000 [1a022285dd] Joshua Colp * res_rtp_asterisk: Only learn a new source in learn state. This change moves the logic which learns a new source address for RTP so it only occurs in the learning state. The learning state is entered on initial allocation of RTP or if we are told that the remote address for the media has changed. While in the learning state if we continue to receive media from the original source we restart the learning process. It is only once we receive a sufficient number of RTP packets from the new source that we will switch to it. Once this is done the closed state is entered where all packets that do not originate from the expected source are dropped. The learning process has also been improved to take into account the time between received packets so a flood of them while in the learning state does not cause media to be switched. Finally RTCP now drops packets which are not for the learned SSRC if strict RTP is enabled. ASTERISK-27013 Change-Id: I56a96e993700906355e79bc880ad9d4ad3ab129c 2017-08-29 14:22 +0000 [4aaccb7795] Richard Mudgett * bridge_native_rtp.c: Fixup native_rtp_framehook() * Fix framehook to test frame type for control frame. * Made framehook exit early if frame type is not a control frame. * Eliminated RAII_VAR in framehook. * Use switch instead of else-if ladder for control frame handling. Change-Id: Ia555fc3600bd85470e3c0141147dbe3ad07c1d18 2017-08-29 09:26 +0000 [d2ace23248] Sean Bright * confbridge: Handle user hangup during name recording This prevents orphaned CBAnn channels from getting stuck in the bridge. ASTERISK-26994 #close Reported by: James Terhune Change-Id: I5e43e832a9507ec3f2c59752cd900b41dab80457 2017-08-25 21:06 +0000 [a45af32983] Andre Nazario * chan_pjsip: Add tag info in CHANNEL function Create local_tag and remote_tag in CHANNEL info to get tag from From and To headers of a SIP dialog. ASTERISK-27220 Change-Id: I59b16c4b928896fcbde02ad88f0e98922b15d524 2017-08-25 13:44 +0000 [9e6efcace5] Sean Bright * voicemail: Fix various abuses of mkstemp mkstemp() returns a unique filename, but appending an extension to that filename does not guarantee uniqueness. Instead, use mkdtemp() and we can put whatever extension we want on the files that we create inside the directory. In the case of app_minivm, we also now properly clean up any temporary files that we create. ASTERISK-20858 #close Reported by: Walter Doekes Change-Id: I30ad04f0e115f0b11693ff678ba5184d8b938e43 2017-08-25 12:20 +0000 [01b5913ce0] Sean Bright * app_record: Resolve some absolute vs. relative filename bugs If the Record() application is called with a relative filename that includes directories, we were not properly creating the intermediate directories and Record() would fail. Secondarily, updated the documentation for RECORDED_FILE to mention that it does not include a filename extension. Finally, rewrote the '%d' functionality to be a bit more straight forward and less noisy. ASTERISK-16777 #close Reported by: klaus3000 Change-Id: Ibc2640cba3a8c7f17d97b02f76b7608b1e7ffde2 2017-08-23 10:01 +0000 [bf178a0f4f] Florian Floimair * alembic: Add dtls_fingerprint column in ps_endpoints table The ps_endpoints table was missing the dtls_fingerprint column introduced with commit adba2a8d7fd. ASTERISK-27168 #close Change-Id: I9cb5006f7f50718b5239919562773adabb334cfd 2016-02-28 19:05 +0000 [fff2f68616] Matt Jordan * main/app: Only look to end of file if ':end' is specified, and not just ':' There is a little known feature in app_controlplayback that will cause the specified offset to be used relative to the end of a file if a ':end' is detected within the filename. This feature is pretty bad, but okay. However, a bug exists in this code where a ':' detected in the filename will cause the end pointer to be non-NULL, even if the full ':end' isn't specified. This causes us to treat an unspecified offset (0) as being "start playing from the end of the file", resulting in no file playback occurring. This patch fixes this bug by resetting the end pointer if ':end' is not found in the filename. ASTERISK-23608 #close Reported by: Jonathan White Change-Id: Ib4c7b1b45283e4effd622a970055c51146892f35 (cherry picked from commit 13efea24f7ce6ccc01d1a5a0603be2636d83a408) 2017-08-24 09:42 +0000 [579d4593ac] Sean Bright * app_queue: Evaluate realtime queues when running dialplan functions ASTERISK-19103 #close Reported by: Jim Van Meggelen Change-Id: I4bd32a9d1fcebb8ac56bff0e084d4f53e31b692b 2017-08-23 09:19 +0000 [0af145de2d] Sean Bright * app_voicemail: Honor escape digits in "greeting only" mode ASTERISK-21241 #close Reported by: Eelco Brolman Patches: Patch uploaded by Eelco Brolman (License 6442) Change-Id: Icbe39b5c82a49b46cf1d168dc17766f3d84f54fe 2017-08-24 08:35 +0000 [d251a961ac] Sean Bright * res_smdi: Clean up memory leak Change-Id: I1e33290929e1aa7c5b9cb513f8254f2884974de8 2017-08-11 11:40 +0000 [3f22b53349] Richard Mudgett * bridge_softmix.c: Remove always true test. Change-Id: I26238df2ff0d0f6dfe95c3aa35da588f1ee71727 2017-08-17 16:46 +0000 [b88c3a4209] Sungtae Kim * app_queue: Fix initial hold time queue statistic Fixed to use correct initial value and fixed to use the correct queue info to check the first value. ASTERISK-27204 Change-Id: Ia9e36c828e566e1cc25c66f73307566e4acb8e73 2017-08-21 04:28 +0000 [8e99969000] Torrey Searle * res/res_pjsip_session: allow SDP answer to be regenerated If an SDP answer hasn't been sent yet, it's legal to change it. This is required for PJSIP_DTMF_MODE to work correctly, and can also have use in the future for updating codecs too. ASTERISK-27209 #close Change-Id: Idbbfb7cb3f72fbd96c94d10d93540f69bd51e7a1 2017-08-20 08:15 +0000 [4faf77feec] Michael Kuron * res_xmpp: fix inverted return code check in OAuth fetch_access_token calls func_curl via ast_func_read. The latter returns 0 upon success and -1 if the function is not available. This commit inverts the return code check so that an error is printed if the module is not loaded and not if it is loaded. ASTERISK-27207 #close Change-Id: I9ef903f80702d1218e8701f65a4e5e918e6548fb 2017-08-17 12:00 +0000 [a6251ec373] Sean Bright * res_calendar_icalendar: Properly handle recurring events When looking for recurring events, use the correct end time based on the configured 'timeframe.' ASTERISK-27174 #close Reported by: Mark Thompson Change-Id: Id90c3cfc79d561a5521d79be176683e225f2edef 2017-08-16 15:43 +0000 [572b5307e0] George Joseph * Fix downloader not working with curl The codec/dpma downloader wasn't handling curl correctly. The logic that transforms makeopts into a bash-sourceable file wasn't handling the make 'or' command in DOWNLOAD_TIMEOUT so bash was looking for an 'or' command. That logic has been eliminated. Instead of trying to transform and source makeopts, the downloader now calls a make scriptlet to print the value of a specific variable. This way, make handles the ors (or any other make construct that happens to creep into that file). ASTERISK-27202 Reported by: Sean McCord Change-Id: Iadfb6693528e4d4da7b8bb201fa66da2c71c7f99 2017-08-15 15:15 +0000 [8594f73a81] Richard Mudgett * configure: Check cache for valid pjproject tarball before downloading. On a fresh Asterisk source directory, the bundled pjproject tarball is unconditionally downloaded even if the tarball is already in a specified cache directory. * Made check if the pjproject tarball is valid in the cache directory before downloading the tarball on a fresh source directory. Change-Id: Ic7ec842d3c97ecd8dafbad6f056b7fdbce41cae5 2017-08-15 11:14 +0000 [d08342b0cb] Richard Mudgett * res_pjsip: Fix prune_on_boot to remove only contacts for the host. * Check that the contact's reg_server matches the host's name before deleting any prune_on_boot contacts. We don't want to delete reliable transport contacts made with other servers if the ps_contacts database table is shared with other servers. Thanks to Ross Beer for pointing out that the original prune logic would delete reliable transport contacts from other servers. ASTERISK-27147 Change-Id: I8e439d0d1c266ffdfd7b73d1e5e466180a689bd0 2017-08-04 09:25 +0000 [54e3ac402f] Andrey Egorov * res_xmpp: Google OAuth 2.0 protocol support for XMPP / Motif Add ability to use tokens instead of passwords according to Google OAuth 2.0 protocol. ASTERISK-27169 Reported by: Andrey Egorov Tested by: Andrey Egorov Change-Id: I07f7052a502457ab55010a4d3686653b60f4c8db 2017-08-10 14:18 +0000 [bac3e8c08b] Richard Mudgett * STUN/netsock2: Fix some valgrind uninitialized memory findings. * netsock2.c: Test the addr->len member first as it may be the only member initialized in the struct. * stun.c:ast_stun_handle_packet(): The combinded[] local array could get used uninitialized by ast_stun_request(). The uninitialized string gets copied to another location and could overflow the destination memory buffer. These valgrind findings were found for ASTERISK_27150 but are not necessarily a fix for the issue. Change-Id: I55f8687ba4ffc0f69578fd850af006a56cbc9a57 2017-08-02 18:44 +0000 [1cf2c79f37] Richard Mudgett * res_pjsip_outbound_registration.c: Re-REGISTER on transport shutdown. The fix for the issue is broken up into three parts. This is part three which handles the client side of REGISTER requests. The registered contact may no longer be valid on the server when the transport used is reliable and the connection is broken. * Re-REGISTER our contact if the reliable transport is broken after registration completes. We attempt to re-REGISTER immediately to minimize the time we are unreachable. Time may have already passed between the connection being broken and the loss being detected. * Reorder sip_outbound_registration_state_alloc() so the STATSD_GUAGE's are still correct if an allocation failure happens. ASTERISK-27147 Change-Id: I3668405b1ee75dfefb07c0d637826176f741ce83 2017-07-31 14:21 +0000 [07d026b4cd] Richard Mudgett * res_pjsip: Remove ephemeral registered contacts on transport shutdown. The fix for the issue is broken up into three parts. This is part two which handles the server side of REGISTER requests when rewrite_contact is enabled. Any registered reliable transport contact becomes invalid when the transport connection becomes disconnected. * Monitor the rewrite_contact's reliable transport REGISTER contact for shutdown. If it is shutdown then the contact must be removed because it is no longer valid. Otherwise, when the client attempts to re-REGISTER it may be blocked because the invalid contact is there. Also if we try to send a call to the endpoint using the invalid contact then the endpoint is not likely to see the request. The endpoint either won't be listening on that port for new connections or a NAT/firewall will block it. * Prune any rewrite_contact's registered reliable transport contacts on boot. The reliable transport no longer exists so the contact is invalid. * Websockets always rewrite the REGISTER contact address and the transport needs to be monitored for shutdown. * Made the websocket transport set a unique name since that is what we use as the ao2 container key. Otherwise, we would not know which transport we find when one of them shuts down. The names are also used for PJPROJECT debug logging. * Made the websocket transport post the PJSIP_TP_STATE_CONNECTED state event. Now the global keep_alive_interval option, initially idle shutdown timer, and the server REGISTER contact monitor can work on wetsocket transports. * Made the websocket transport set the PJSIP_TP_DIR_INCOMING direction. Now initially idle websockets will automatically shutdown. ASTERISK-27147 Change-Id: I397a5e7d18476830f7ffe1726adf9ee6c15964f4 2017-07-28 18:26 +0000 [ca261d4b70] Richard Mudgett * res_pjsip: PJSIP Transport state monitor refactor. The fix for the issue is broken up into three parts. This is part one which refactors the transport state monitor code to allow more modules to be able to monitor transports. * Pull the management of PJPROJECT's transport state callback code from res_pjsip_transport_management.c into res_pjsip. Now other modules can dynamically add and remove themselves from transport monitoring without worrying about breaking PJPROJECT's callback chain. * Add the ability for other modules to get a callback whenever a specific transport is shutdown. ASTERISK-27147 Change-Id: I7d9a31371eb1487c9b7050cf82a9af5180a57912 2017-07-27 15:36 +0000 [162f6ab845] Richard Mudgett * res_pjsip_transport_management.c: Rename some variables. * Use monitored instead of the misleading keepalive name. Change-Id: I9e5bcbb4ab2b82d49bcd0f06dfe85d15e0b552b6 2017-08-10 09:09 +0000 [22575b6342] Scott Griepentrog * res_pjsip_messaging: IPv6 receive address needs brackets When handling an incoming SIP MESSAGE, PJSIP attaches the IP address that the message was received from to the message in the variable PJSIP_RECVADDR. When the IP address is IPv6 the :PORT appended results in an unparseable mess. By using an additional bit flag on the pj_sockaddr_print call, the conventional use of brackets around the address is achieved. ASTERISK-27193 #close Change-Id: I12342521f2ce87a5b6e4883d480a3fd957aa9fd9 2017-08-09 08:01 +0000 [363d61ef58] George Joseph * configure: Add --with-download-cache option To make building without an internet connection easier, a new ./configure option '--with-download-cache' was added that sets the cache for externals (like pjproject, the codecs and the DPMA), AND the sounds files. It can also be specified as an environment variable named "AST_DOWNLOAD_CACHE". The existing '--with-sounds-cache' option / SOUNDS_CACHE_DIR env variable and '--with-externals-cache' option / EXTERNALS_CACHE_DIR env variable remain and if specified, will override '--with-downloads-cache'. Change-Id: I5c3cf15ee61e8fe191b52732303e969854f8d861 2017-07-26 09:17 +0000 [3608f96ea3] Torrey Searle * res_rtp_asterisk: enable rtcp & QOS stats on native bridge Asterisk wasn't generating or forwarding RTCP packets when native bridge was activated. Also the stats weren't available via CHANNEL(qos). Now the RTCP stats are always calculated. ASTERISK-27158 #close Change-Id: I46fb8f61c95e836b9d2dda6054b0cf205c16037b 2017-07-26 11:39 +0000 [0de7312fac] Joshua Colp * res_pjsip_session: Release media resources on session end quicker. A change was made long ago where the session was kept around until the underlying INVITE session had been destroyed. This had the side effect of also keeping the underlying media resources around for this time as well. This change ensures that when we know the session is ending we release the media resources immediately. ASTERISK-27110 Change-Id: I643e431d5c3bf05cda220c1d39e824a505a29b82 2017-08-02 16:08 +0000 [905c4ca3dc] Corey Farrell * app_privacy: remove unused header asterisk/image.h Change-Id: I56ed530633a642633b18383821069e806c92ae82 2017-08-03 13:13 +0000 [38dbc708e7] Tzafrir Cohen * Support GMIME 3.0 Support building the Asterisk httpd with version 3.0 of gmime as well as earlier versions of that library. ASTERISK-27173 Change-Id: I7e13dd05a3083ccb0df2dabf83110223f6a9fa8f 2017-07-28 07:53 +0000 [c4f201cd73] Torrey Searle * res_rtp_asterisk: Make P2P bridge Asymmetric codec aware Introduce a new property to rtp-engine to make it aware of the desire for assymetric codecs or not. If asymmetric codecs is not allowed, the bridge will compare read/write formats and shut down the p2p bridge if needed ASTERISK-26745 #close Change-Id: I0d9c83e5356df81661e58d40a8db565833501a6f 2017-08-03 21:30 +0000 [84b6a5efd7] Corey Farrell * Correct some leaks in unit tests. * chan_sip: channel in test_sip_rtpqos_1. * test_config: config hook, config info and global config holder. * test_core_format: format in format_attribute_set_without_interface. * test_stream: unneeded frame duplication. * test_taskprocessor: task_data. Change-Id: I94d364d195cf3b3b5de2bf3ad565343275c7ad31 2017-07-26 17:49 +0000 [f9a823e9dc] Richard Mudgett * res_pjsip_transport_websocket.c: Fix serializer ref leak. Change-Id: Ib5a19bfd597f63d9021baeb645fc11153b3afa57 2017-08-02 18:41 +0000 [631180a0c3] Richard Mudgett * res_pjsip_outbound_registration.c: Misc fixes. * Remove unnecessary CMP_STOP. * In handle_client_registration() use DEBUG_ATLEAST() to only do work needed for the debug log message when the debug log message is needed. * In sip_outbound_registration_state_destroy() check state->registration for NULL. Change-Id: I656d0fa11dda0b00048103efb1558e67a426fd80 2017-07-31 20:20 +0000 [7b84c6693e] Richard Mudgett * res_pjsip_nat.c: Remove unnecessary CMP_STOP. Change-Id: I6279b0d723bc3b75b8d65e81e02da9ea9bc0c3da 2017-07-31 14:20 +0000 [a32614a2a8] Richard Mudgett * res_pjsip_registrar.c: Remove unnecessary CMP_STOP. Most uses of CMP_STOP are superfluous and are only respected when OBJ_MULTIPLE is used to search the container. Change-Id: I20571a202ec0aa1098bb2749eeba18de7ca110b8 2017-08-03 11:30 +0000 [d066758a4c] Corey Farrell * Fix compile error for old versions of GCC. Use -Wno-format-truncation only if supported by compiler. ASTERISK-27171 #close Change-Id: Iac0aed7a5bcaa16c21b7d62c4e4678d244c4ccb6 2017-08-01 15:57 +0000 [ed1bce956e] George Joseph * Revert "res_pjsip_session: Release media resources on session end quicker." This reverts commit 98709642d640b490f327d220fdcdea6d45fd65d7. See the 15 branch review. Change-Id: I8476b3cdacaad5157fa36b6247d0e4cdf1e8d5c6 2017-06-29 03:47 +0000 [9a09f7dd5d] Niklas Larsson * app_queue: Add priority to AMI QueueStatus Add priority to callers in AMI QueueStatus response ASTERISK-27092 #close Change-Id: I8d1f737a72c7c38f4cfe1a4ee3ecc0a4f85bd199 2017-07-26 11:39 +0000 [3418d8d145] Joshua Colp * res_pjsip_session: Release media resources on session end quicker. A change was made long ago where the session was kept around until the underlying INVITE session had been destroyed. This had the side effect of also keeping the underlying media resources around for this time as well. This change ensures that when we know the session is ending we release the media resources immediately. ASTERISK-27110 Change-Id: I3c6a82fe7d2c50b9dc9197cb12ef22f20d337501 2017-07-26 08:48 +0000 [4d318cac68] Sean Bright * res_pjsip_pidf_eyebeam_body_supplement: Correct status presentation This change fixes PIDF content generation when the underlying device state is considered in use. Previously it was incorrectly marked as closed meaning they were offline/unavailable. The code now correctly marks them as open. Additionally: * Generate an XML element for our activity instead of a using a text node. * Consider every extension state other than "unavailable" to be 'open' status. * Update the XML namespaces and structure to reflect those documented in RFC 4480 * Use 'on-the-phone' (defined in RFC 4880) instead of 'busy' as the "in use" activity. This change results in eyeBeam using the appropriate icon for the watched user. This was tested on eyeBeam 1.5.20.2 build 59030 on Windows. ASTERISK-26659 #close Reported by: Abraham Liebsch patches: ASTERISK-26659.diff submitted by snuffy (license 5024) Change-Id: I6e5ad450f91106029fb30517b8c0ea0c2058c810 2017-07-23 18:34 +0000 [114602f434] Joshua Colp * res_pjsip: Add support for dnsmgr to external_media_address. The "external_media_address" option on transports is now resolved using dnsmgr. This allows it to be automatically refreshed regularly if refreshes are enabled in dnsmgr. If the system is using a dynamic IP address a dynamic DNS hostname can be provided to keep the IP address up to date. Change-Id: Ia54771720dff0105bde55d5bbb81a3ba437e05b2 2017-07-27 20:58 +0000 [0f49e6ee2e] Corey Farrell * Fix compiler warnings on Fedora 26 / GCC 7. GCC 7 has added capability to produce warnings, this fixes most of those warnings. The specific warnings are disabled in a few places: * app_voicemail.c: truncation of paths more than 4096 chars in many places. * chan_mgcp.c: callid truncated to 80 chars. * cdr.c: two userfields are combined to cdr copy, fix would break ABI. * tcptls.c: ignore use of deprecated method SSLv3_client_method(). ASTERISK-27156 #close Change-Id: I65f280e7d3cfad279d16f41823a4d6fddcbc4c88 2017-07-27 06:35 +0000 [0d58fefa30] George Joseph * bundled_pjproject: Improve SSL/TLS error handling OpenSSL has 2 levels or error processing. It's possible for the top layer to return SSL_ERROR_SYSCALL but the lower layer return no error, in which case processing should continue. Only the top layer was being examined though so connections were being torn down when they didn't need to be. This patch adds the examination of the lower level codes, and if they return no errors, allows processing to continue. ASTERISK-27001 Reported-by: Ian Gilmour patches: pjproject-2.6.patch submitted by Ian Gilmour (license 6889) Updated-by: George Joseph and Sauw Ming (Teluu) Merged to upstream pjproject on 7/27/2017 (commit 5631) Change-Id: I23844ca0c68ef1ee550f14d46f6dae57d33b7bd2 2017-06-26 07:52 +0000 [423d01cf16] Torrey Searle * chan_pjsip: add a new function PJSIP_DTMF_MODE This function is a replica of SIPDtmfMode, allowing the DTMF mode of a PJSIP call to be modified on a per-call basis ASTERISK-27085 #close Change-Id: I20eef5da3e5d1d3e58b304416bc79683f87e7612 2017-07-25 15:17 +0000 [c16000f201] Sean Bright * res_rtp_asterisk: Fix mapping of pjsip's ICE roles to ours Change-Id: Ia578ede1a55b21014581793992a429441903278b 2017-07-20 08:08 +0000 [708cdc0b8e] Sergej Kasumovic * res_stasis_device_state: Unsubscribe should remove old subscriptions Case scenario with Applications ARI: * Once you subscribe to deviceState with Applications REST API, it will be added into subscription pool. * When you unsubscribe it will remove from the device_state_subscription hash table but not from the subscription pool. * When you subscribe again, it will add it to pool again. * Now you will have two subscriptions and you will receive same event twice. This fix should now remove deviceState subscription from pool and it should fix unsubscribe on deviceState. ASTERISK-27130 #close Change-Id: I718b70d770a086e39b4ddba4f69a3c616d4476c4 2017-07-24 13:30 +0000 [24bb5a8908] Joshua Colp * core: Add VP9 passthrough support. This change adds VP9 as a known codec and creates a cached "vp9" media format for use. Change-Id: I025a93ed05cf96153d66f36db1839109cc24c5cc 2017-07-21 15:57 +0000 [07f8e45a90] Matthew Fredrickson * format.h: Fix a few minor errors in comments. A few minor problems were found in comments in format.h. This patch fixes them. Change-Id: I07f0bdb47b93359b361c4c3d8ecc87cd3199dd94 2017-07-21 17:04 +0000 [7e9aa74daa] Rusty Newton * say.c: Fix file locations for second, seconds, minute, minutes files The seconds and minutes files have always existed in the base language directory of the Core package. So say.c has always been calling the wrong location (under digits/) for those two files and in the case of second and minute they didn't exist in the Core packages at all. The 1.6 sounds release moves the second and minute files into Core from Extra for the languages that already had them. A future release will include the second and minute files for languages that didn't already have them. This patch just changes all the target locations for second, seconds, minute, and minutes that were under the digits subdir to be under the root of sounds instead. Which is where the sounds will be for some languages after 1.6 sounds and for all languages after a future release. ASTERISK-25810 #close Change-Id: I05d9d4bee6a7237030530a46e7eb3df15f13f702 Reported-by: Nicolas Riendeau 2017-07-19 18:11 +0000 [7ff9d8785d] Richard Mudgett * app_voicemail.c: Allow mailbox entry on authentication retry prompt. The following testsuite voicemail tests were failing to re-enter the mailbox after the first login attempt. tests/apps/voicemail/authenticate_invalid_mailbox tests/apps/voicemail/authenticate_invalid_password The tests were noting the start of the vm-incorrect-mailbox prompt and immediately sending the mailbox for the next login attempt. Since the invalid message playback had to complete before the digits were recognized, the test passed for the wrong reason and added approximately 20 seconds to the test times. * Allow the vm-incorrect-mailbox prompt to get interrupted by the mailbox digits like the initial vm-login prompt so the tests are able to enter the intended mailbox. Change-Id: I1dc53fe917bfe03a4587b2c4cd24c94696a69df8 2017-07-21 14:20 +0000 [4f93f75e7e] Rusty Newton * Sounds: Update Makefile for Extra sounds 1.5.1 release Incrementing version for the Extra sounds release. 1.5.1 Extra sounds removes two prompts that were moved into the Core packages in the 1.6 Core sounds release. ASTERISK-27142 #close Change-Id: I82f017812b0ea9599e19dd4635afd55611f13ee7 2017-07-20 09:57 +0000 [cea4ce246d] Sean Bright * corosync: Fix corosync library name in configure.ac Also add new corosync packages to install_prereq. Reported by Travis Ryan in #asterisk-dev Change-Id: Ib861c95ba630fed62dc54e56784ad8446ed9d2db 2017-07-18 15:04 +0000 [9a47dd7113] Benjamin Keith Ford * pjsip: Increase maximum packet size. The maximum packet size for PJSIP has been increased to handle the multiple streams being added for WebRTC. Change-Id: I9ea1e8d02668c544acadcb1c6200e1cc1bd588b3 2017-07-11 04:48 +0000 [1c3e7df26e] Holger Hans Peter Freyther * app_playback.c: Use the timezonename parameter In say_date_generic the timezonename parameter is passed but never used. Fix it by passing it to the ast_localtime function. ASTERISK-27124 Change-Id: I6afa98f9163190043244b9f3ba91eb1874d1b586 2017-07-16 12:18 +0000 [51761b759d] Joshua Colp * res_rtp_asterisk: Use RTP component for ICE if RTCP-MUX is in use. This change makes it so that if an RTCP packet is being sent the RTP ICE component is used for sending if RTCP-MUX is in use. ASTERISK-27133 Change-Id: I6200f611ede709602ee9b89501720c29545ed68b 2017-07-11 09:55 +0000 [a4c85309f0] Torrey Searle * res/res_stasis_snoop: generate silence when audiohook returns null Currently when rtp is paused, no packets are written to the recorded audio file, causing the silence to be skipped and recording not properly time aligned. The read handler as been adapted to return a silence frame of the correct size. ASTERISK-27128 #close Change-Id: I2d7f60650457860b9c70907b14426756b058a844 2017-07-14 01:25 +0000 [3858d99b73] Sergej Kasumovic * app_confbridge: Make sure name recordings are always removed from the filesystem This commit fixes two possible scenarios: * When recording name and if during recording you hangup, file is never removed. This is due to the fact file location is nulled. * When recording name and if you hangup during thank-you prompt, file is never removed. ASTERISK-27123 #close Change-Id: I39b7271408b4b54ce880c5111a886aa8f28c2625 2017-07-14 01:11 +0000 [cdd6ca488a] Sergej Kasumovic * chan_iax2: On reload make sure to check for existing MWI subscription On every reload of chan_iax2 module, MWI subscription was added, which results in additional taskprocessors being accumulated over time. This commit fixes it by making sure we check for existing subscription first. This was verified with 'core show taskprocessors' CLI command. ASTERISK-27122 #close Change-Id: Ie2ef528fd5ca01b933eeb88188cc10967899cfb9 2017-07-13 15:43 +0000 [9f66fb7901] Rusty Newton * Sounds: Update for core sounds 1.6 release Added necessary lines to make the en_NZ language set selectable and to get core sounds 1.6 pulled down. ASTERISK-26807 #close ASTERISK-25816 #close ASTERISK-26274 #close Change-Id: I84e4dd4696568cc1ba318d12ac4b075461d6eed4 2017-07-10 14:04 +0000 [df49ad2528] Corey Farrell * core: Add PARSE_TIMELEN support to ast_parse_arg and ACO. This adds support for parsing timelen values from config files. This includes support for all flags which apply to PARSE_INT32. Support for this parser is added to ACO via the OPT_TIMELEN_T option type. Fixes an issue where extra characters provided to ast_app_parse_timelen were ignored, they now cause an error. Testing is included. ASTERISK-27117 #close Change-Id: I6b333feca7e3f83b4ef5bf2636fc0fd613742554 2017-07-12 15:07 +0000 [6d0ff310c6] Sean Bright * basic-pbx: Remove res_pjsip_multihomed from sample config ASTERISK-27127 #close Reported by: HZMI8gkCvPpom0tM Change-Id: I2b0c54570d58156e37166ac536728af3b6c01789 2017-07-11 07:26 +0000 [4e555437dc] George Joseph * res_musiconhold: Add kill_escalation_delay, kill_method to class By default, when res_musiconhold reloads or unloads, it sends a HUP signal to custom applications (and all descendants), waits 100ms, then sends a TERM signal, waits 100ms, then finally sends a KILL signal. An application which is interacting with an external device and/or spawns children of its own may not be able to exit cleanly in the default times, expecially if sent a KILL signal, or if it's children are getting signals directly from res_musiconhoild. * To allow extra time, the 'kill_escalation_delay' class option can be used to set the number of milliseconds res_musiconhold waits before escalating kill signals, with the default being the current 100ms. * To control to whom the signals are sent, the "kill_method" class option can be set to "process_group" (the default, existing behavior), which sends signals to the application and its descendants directly, or "process" which sends signals only to the application itself. Change-Id: Iff70a1a9405685a9021a68416830c0db5158603b 2017-07-03 07:30 +0000 [4f2f3bfebf] Tzafrir Cohen * Avoid setting maxfiles for a remote asterisk Setting maxfiles (maximum number of open files) has no practical effect on a remote asterisk (rasterisk, rasterisk -x). It has an ill effect of printing an extra message, which may be annoying in case of -x. ASTERISK-27105 #close Change-Id: Iaf9eb344e4b4b517df91b736b27ec55f6a6921a2 2017-07-05 15:31 +0000 [32b98ad956] George Joseph * http.c: Reduce log spam Messages like "fwrite() failed: Connection reset by peer" are no help whatsoever, especially since they can be caused simply by a client disconnecting. * Make those WARNINGs DEBUGs. * Check the return of the headers fprintf. Change-Id: I17bd5f3621514152a7b2b263c801324c5e96568b 2017-07-07 11:19 +0000 [25e18bf514] Benjamin Keith Ford * res_pjsip: Fix crash with from_user containing invalid characters. If the from_user field contains certain characters (like @, {, ^, etc.), PJSIP will return a null value for the URI when attempting to parse it. This causes a crash when trying to dial out through a trunk that contains these invalid characters in its from_user field. This change checks the configuration and ensures that an endpoint will not be created if the from_user contains an invalid character. It also adds a null check to the PJSIP URI parsing as a backup. ASTERISK-27036 #close Reported by: Maxim Vasilev Change-Id: I0396fdb5080604e0bdf1277464d5c8a85db913d0 2017-06-27 19:27 +0000 [8a803f75a0] Richard Mudgett * json.c: Add backtrace log to find 'Invalid UTF-8 string' errors Change-Id: I9020ff9f2b3749904317c0c173f47a1bbed6f929 2017-07-05 13:39 +0000 [aa514f420b] Richard Mudgett * res_rtp_asterisk.c: Fix TURN deadlock by using ICE session group lock. When a message is received on the TURN socket, the code processing the message needs to call into the ICE/STUN session for further processing. This code path locks the TURN group lock then the ICE/STUN group lock. In another thread an ICE/STUN timer can fire off to send a keep alive message over the TURN socket. In this code path, the ICE/STUN group lock is obtained then the TURN group lock is obtained to send the packet. A classic deadlock case if the group locks are not the same. * Made TURN get created using the ICE/STUN session's group lock. NOTE: I was originally concerned that the ICE/STUN session can get recreated by ice_reset_session() for an event like RTCP multiplexing causing a change during SDP negotiation. In this case the TURN group lock would become different. However, TURN is also recreated as part of the ICE/STUN recreation in ice_create() when all known ICE candidates are added to the new ICE session. While the ICE/STUN and TURN sessions are being recreated there is a period where the group locks could be different. ASTERISK-27023 #close Patches: res_rtp_asterisk-turn-deadlock-fix.patch (license #6502) patch uploaded by Michael Walton (modified) Change-Id: Ic870edb99ce4988a8c8eb6e678ca7f19da1432b9 2017-07-06 05:55 +0000 [379fe65831] George Joseph * Fix alembic branches Change-Id: I04f607f084bda9b1b7f626e8e9735c37dc751187 2017-06-23 11:17 +0000 [22c4c1a0ba] Richard Mudgett * bridge_native_rtp.c: Fix direct media video RTP instance ACL check. The video stream was using the audio stream RTP instance addresses to check if the video RTP gets directed to an allowed direct media Access Control List (ACL) address. There is no guarantee that the video RTP instance uses the same addresses as the audio RTP instance. This looks like it has been a bug since v11 when direct media ACL was first added to chan_sip and then faithfully reproduced through a couple code refactorings into the new bridging architecture. Change-Id: I8ddd56320e0eea769f3ceed3fa5b6bdfb51d681a 2017-07-05 07:42 +0000 [6258de458b] Sean Bright * core: Fix segfault when invoking 'data get' CLI command Invoking 'data get /asterisk/core/channeltypes' caused a crash because of an assumption of a tech's capabilities to be non-NULL. The 'Surrogate' tech, however, does have a NULL capabilities member, resulting in a crash. ASTERISK-27108 #close Change-Id: I2fbe7715681f43d5565d1e1599269468c26b0e0a 2017-07-03 10:59 +0000 [39d2ebbf56] Alexander Traud * chan_sip: Only when different, add TCP|TLS in autodomain (SIP Domain Support). When sip.conf contained tcpenable=yes and autodomain=yes, the TCP domain was added in any case, because of a local Boolean-negation error of the return value of ast_sockaddr_cmp. After fixing this error for TCP and TLS, the TLS domain was still always added with tlsenable=yes, because the domains were not compared just on the address but also on the port – and TLS is always on a different port than UDP/TCP. ASTERISK-27106 Change-Id: I14fe9e319e238320b094016980445ef3a5b3337c 2017-07-03 10:38 +0000 [9f4b3b966e] Alexander Traud * chan_sip: Fix a typo for tlsbindaddr in autodomain (SIP Domain Support). Because of a copy-and-paste error when the struct ast_sockaddr changed, tlsbindaddr was not added, when sip.conf contained autodomain=yes; see "show sip domains" on the command-line interface (CLI) of Asterisk. ASTERISK-27106 Change-Id: I3d0957150017c223136968ef1266f275d0d6695e 2017-06-29 13:58 +0000 [194625c1de] Sean Bright * app_voicemail: Cleanup ODBC connection handling The primary focus of this patch is adding a missing call to ast_odbc_release_obj(), but is also a general cleanup of the ODBC related code in app_voicemail. ASTERISK-27093 #close Change-Id: I8e285142eaeb3146b4287a928276b70db76c902b 2017-06-30 23:57 +0000 [73520e9f58] Corey Farrell * channel: Clear channel flag in error branch. Clear channel flag AST_FLAG_END_DTMF_ONLY in ast_waitfordigit_full when ast_read returns NULL. ASTERISK-27100 #close Change-Id: Id3039e9a4e74e0cb359f636c9fd0c9740ebf7d9d 2017-06-29 18:27 +0000 [0d64cbde57] Richard Mudgett * pjsip_distributor.c: Fix deadlock with TCP type transports. When a SIP message comes in on a transport, pjproject obtains the lock on the transport and pulls the data out of the socket. Unlike UDP, the TCP transport does not allow concurrent access. Without concurrency the transport lock is not released when the transport's message complete callback is called. The processing continues and eventually Asterisk starts processing the SIP message. The first thing Asterisk tries to do is determine the associated dialog of the message to determine the associated serializer. To get the associated serializer safely requires us to get the dialog lock. To send a request or response message for a dialog, pjproject obtains the dialog lock and then obtains the transport lock. Deadlock can result because of the opposite order the locks are obtained. * Fix the deadlock by obtaining the serializer associated with the dialog another way that doesn't involve obtaining the dialog lock. In this case, we use an ao2 container to hold the associated endpoint and serializer. The new locks are held a brief time and won't overlap other existing lock times. ASTERISK-27090 #close Change-Id: I9ed63f4da9649e9db6ed4be29c360968917a89bd 2017-06-29 18:22 +0000 [905d18e8bf] Richard Mudgett * pjsip_distributor.c: Fix unidentified_requests hash functions. The OBJ_SEARCH_xxx defines should not be used as if they were individual bits. They represent a multi-bit enumeration value field. Change-Id: I32abc9a475396dab02402a7014357dd94284e17b 2017-06-30 08:31 +0000 [bbe68f139d] George Joseph * pjproject_bundled: Allow passing configure options to bundled There wasn't any good way to pass options like --host or --build down to the pjproject configure which makes cross-compiling difficult. * Added a new PJPROJECT_CONFIGURE_OPTS environment variable which can be used to pass arbitrary options to pjproject configure. * Automatically set the pjproject configure --host and --build options to match those supplied for the asterisk configure. ASTERISK-27097 #close Reported-by: Kinsey Moore Change-Id: I5fa776e110262851173002a26ffe1172e4c35b2e 2017-06-29 14:50 +0000 [6bd7c0f37c] George Joseph * chan_pjsip: Fix ability to send UPDATE on COLP When connected_line_method is "invite", we're supposed to determine if the client can support UPDATE and if it can, send UPDATE instead of INVITE to avoid the SDP renegotiation. Not only was pjproject not setting the PJSIP_INV_SUPPORT_UPDATE flag, we were testing that invite_tsx wasn't NULL which isn't always the case. * Updated chan_pjsip/update_connected_line_information to drop the requirement that invite_tsx isn't NULL. * Submitted patch to pjproject sip_inv.c that sets the PJSIP_INV_SUPPORT_UPDATE flag correctly. * Updated pjsip.conf.sample to clarify what happens when "invite" is specified. ASTERISK-27095 Change-Id: Ic2381b3567b8052c616d96fbe79564c530e81560 2017-06-27 04:37 +0000 [2c43ca0ac5] Ivan Poddubny * app_queue: Fix returning to dialplan when a queue is empty The fix for ASTERISK-25665 introduced a regression. The return value of queue_exec used to be 0 in case of leavewhenempty but it was changed to -1 (returned from wait_our_turn and passed transparently by queue_exec), thus leading to hangup instead of returning back to dialplan. This commit resets the value back to 0 in this case, restoring original behavior. ASTERISK-27065 #close Reported by: Marek Cervenka Change-Id: Id9c83b75aeda463250155e88c5004be52bbca5ac 2017-06-28 09:03 +0000 [0426b1d88a] Joshua Colp * res_rtp_asterisk: Fix issues with ICE renegotiation. When re-inviting to add more streams it is possible for the role of existing ICE sessions to be changed to the incorrect value. This results in subsequent refreshes within the sessions getting a role conflict and the ICE session breaking down. This change only sets the role to be the new value if an ICE renegotiation is actually going to happen, otherwise the existing role is preserved. As well if we encounter a situation where a unidirectional ICE negotiation happens and the other side does not send us candidates we will not store any information for sending traffic, even though we know where they are reachable. This change fixes this by using the source of the ICE traffic itself as the target if no candidates are known and we receive some ICE traffic. ASTERISK-27088 Change-Id: I71228181e358917fcefc3100fad21b2fc02a59a9 2017-06-08 22:50 +0000 [eb48e99bd4] George Joseph * bridge_native_rtp: Keep rtp instance refs on bridge_channel There have been reports of deadlocks caused by an attempt to send a frame to a channel's rtp instance after the channel has left the native bridge and been destroyed. This patch effectively causes the bridge channel to keep a reference to the glue and both the audio and video rtp instances so what gets started will get stopped. ASTERISK-26978 #close Reported-by: Ross Beer Change-Id: I9e1ac49fa4af68d64826ccccd152593cf8cdb21a 2017-06-27 10:46 +0000 [1f59d08924] Torrey Searle * res/res_pjsip_t38: fix incorrect increment of media_count The T38 sdp callback incorrectly has a side effect of incrementing the media_count. This can lead to core dumps. Change-Id: I7bb2f4987de4046ec52cfc34e5ea0662dae32af8 2017-06-15 03:12 +0000 [9fbc34d2bd] Torrey Searle * res_pjsip: Add DTMF INFO Failback mode The existing auto dtmf mode reverts to inband if 4733 fails to be negotiated. This patch adds a new mode auto_info which will switch to INFO instead of inband if 4733 is not available. ASTERISK-27066 #close Change-Id: Id185b11e84afd9191a2f269e8443019047765e91 2017-06-22 07:47 +0000 [154d2914fa] Torrey Searle * res/res_pjsip_t38 ensure t38 requests get rejected quickly arm the t38 webhook always, so we can correctly reject a T38 negotiation request when t38 is disabled on a channel Change-Id: Ib1ffe35aee145d4e0fe61dd012580be11aae079d 2017-06-21 17:57 +0000 [764d04fa87] Richard Mudgett * res_pjsip_mwi.c: Eliminate RAII_VAR in contact delete observer Change-Id: I0bc97c6608de1d1a4228826b3b3be43f162f05f3 2017-06-16 18:08 +0000 [0f6a9617eb] Alexei Gradinari * res_pjsip_mwi: update unsolicited MWI subscriptions on updating contact Do not need to unsubscribe/subscribe on creating the ednpoint's contact. The modified function create_mwi_subscriptions_for_endpoint adds the subscription only if it does not exist. The subscriptions aren't added for active contacts which are retrieved on startup from realtime if mwi_disable_initial_unsolicited=yes. Because the mwi_contact_added is not called. So the subscriptions also should be created on updating contact. ASTERISK-26230 #close Change-Id: I47e265af9296ca09aa42a316fdacac104148cee4 2017-06-20 15:41 +0000 [1f9913f272] Kevin Harwell * core_local: local channel data not being properly unref'ed and unlocked In an earlier version of Asterisk a local channel [un]lock all functions were added in order to keep a crash from occurring when a channel hung up too early during an attended transfer. Unfortunately, when a transfer failure occurs and depending on the timing, the local channels sometime do not get properly unlocked and deref'ed after being locked and ref'ed. This happens because the underlying local channel structure gets NULLed out before unlocking. This patch reworks those [un]lock functions and makes sure the values that get locked and ref'ed later get unlocked and deref'ed. ASTERISK-27074 #close Change-Id: Ice96653e29bd9d6674ed5f95feb6b448ab148b09 2017-06-20 16:01 +0000 [67664fbf95] Kevin Harwell * bridge: stuck channel(s) after failed attended transfer If an attended transfer failed it was possible for some of the channels involved to get "stuck" because Asterisk was not hanging up the transfer target. This patch ensures Asterisk hangs up the transfer target when an attended transfer failure occurs. ASTERISK-27075 #close Change-Id: I98a6ecd92d3461ab98c36f0d9451d23adaf3e5f9 2017-06-19 11:28 +0000 [cecf6540dc] Rodrigo Ramírez Norambuena * cdr: fix mistake spelling of a word for Unanswered. Change-Id: I7a610bef369924523a445c7e849ee88cc45dc5df 2017-06-19 17:21 +0000 [8f356192d1] Alexei Gradinari * app_voicemail: IMAP connection control A new global option "imap_poll_logout" was added to specify whether need to disconnect from the IMAP server after polling of mailboxes. ASTERISK-27068 #close Closing IMAP connection after loading mailbox from voicemail.conf ASTERISK-24052 #close Change-Id: Ib7558ba04516240a32b65f42e9be64372a0ae12a 2017-06-12 16:17 +0000 [8e749c8f51] Alexei Gradinari * res_pjsip_mwi: unsubscribe unsolicited MWI on deleting endpoint last contact If the endpoint's last contact is deleted unsolicited MWI has to be unsubscribed. ASTERISK-27051 #close Change-Id: I33e174e0b9dba0998927d16d6d100fda5c7254e0 2017-06-16 09:31 +0000 [edfdb4dff5] George Joseph * res_stasis: Plug reference leak on stolen channels When a stasis channel is stolen by another app, the control structure is unreffed but never unlinked from the app_controls container. This causes the channel reference to leak. Added OBJ_UNLINK to the callback in channel_stolen_cb. Also added some additional channel lifecycle debug messages to channel.c. ASTERISK-27059 #close Repoorted-by: George Joseph Change-Id: Ib820936cd49453f20156971785e7f4f182c56e14 2017-06-16 14:56 +0000 [0a40073750] Matthew Fredrickson * formats/format_g729: Fix typo in comment There was a typo in a comment. This commit is to fix the typo. ASTERISK-27060 #close Change-Id: Ic2699f8dbeaacd58ccb6ec3203e853e1babe3235 2017-06-12 09:23 +0000 [a6e4899612] Alexei Gradinari * res_pjsip: New endpoint option "notify_early_inuse_ringing" This option was added to control whether to notify dialog-info state 'early' or 'confirmed' on Ringing when already INUSE. The value "yes" is useful for some SIP phones (Cisco SPA) to be able to indicate and pick up ringing devices. ASTERISK-26919 #close Change-Id: Ie050bc30023543c7dfb4365c5be3ce58c738c711 2017-03-30 09:33 +0000 [005a4afa6b] Jan Friesse * res_corosync: Change thread stack size In Corosync 2.x libraries were changed to use LibQB IPC. Sadly LibQB IPC doesn't support copy-free access to received buffer, so Corosync libraries were rewritten to use stack as buffer. Mostly the needed stack size is quite small, but for all *_dispatch functions, 1MiB is needed. Asterisk function ast_pthread_create_background set stack size for new thread to much smaller AST_BACKGROUND_STACKSIZE (~500KiB). This results in Asterisk crash when running with Corosync 2.x. Patch solves this issue by creating it's own version of ast_pthread_create_background which sets stack size to much higher value (actually it's AST_BACKGROUND_STACKSIZE + 3MiB). Another problem may appear when "corosync show members" netconsole command is executed. It is also executed in thread and also has only 500KiB stack size. Sadly it calls corosync_cfg_get_node_addrs which again needs at least 1MiB stack. Solution is to use HAVE_COROSYNC_CFG_STATE_TRACK as a discriminator between Corosync 1.x and 2.x. If 1.x is found, nothing changes. If 2.x is found, NodeID is displayed instead of IP address. ASTERISK-25370 #close Reported by: mdu113 Change-Id: Id95b0d21ab6e708e7d74ad8786c587211676fa08 2017-06-13 11:33 +0000 [7901b9853e] George Joseph * res_ari: Add "module loaded" check to ari stubs The recent change to make the use of LOAD_DECLINE more consistent caused res_ari to unload itself before declining if the ari.conf file wasn't found. The ari stubs though still tried to use the configuration resulting in segfaults. This patch creates a new CHECK_ARI_MODULE_LOADED macro which tests to see if res_ari is actually loaded and causes the stubs to also decline if it isn't. The macro was then added to the mustache template's "load_module" function. ASTERISK-27026 #close Reported-by: Ronald Raikes Change-Id: I263d56efa628ee3c411bdcd16d49af6260c6c91d 2017-06-15 13:48 +0000 [3b6c327c51] Alexei Gradinari * app_voicemail: IMAP logout on reload/unload Closing IMAP connection on module reload or unload. ASTERISK-24052 #close Change-Id: I2a40182aa9ef249fa6865d33570430e9ada68525 2017-06-15 12:33 +0000 [b9a4ab8c8c] Richard Mudgett * chan_pjsip: Fix PJSIP_MEDIA_OFFER dialplan function read. The construction of the returned string assumed incorrectly that the supplied buffer would always be initialized as an empty string. If it is not an empty string we could overrun the supplied buffer by the length of the non-empty buffer string plus one. It is also theoreticaly possible for the supplied buffer to be overrun by a string terminator during a read operation even if the supplied buffer is an empty string. * Fix the assumption that the supplied buffer would already be an empty string. The buffer is not guaranteed to contain an empty string by all possible callers. * Fix string terminator buffer overrun potential. Change-Id: If6a0806806527678c8554b1dcb34fd7808aa95c9 2017-06-15 07:32 +0000 [4910a3bf40] Joshua Colp * channel: Fix reference counting in ast_channel_suppress. The ast_channel_suppress function wrongly decremented the reference count of the underlying structure used to keep track of what should be suppressed on a channel if the function was called multiple times on the same channel. This change cleans up the reference counting a bit so this no longer occurs. ASTERISK-27016 Change-Id: I2eed4077cb4916e6626f9f120b63b963acc5c136 2017-06-14 12:34 +0000 [f1a209d5ac] Richard Mudgett * app_voicemail.c: Fix compile error when IMAP enabled. Change-Id: I2703f15b4099b4210c68eccf293105d1975c1fc1 2017-06-08 12:28 +0000 [dc307af7f2] Frederic LE FOLL * Core/PBX: Deadlock between dialplan execution and application unregistration. Not easy to reproduce, but we have noticed deadlocks when unloading a module while dialplan is handling a request. The deadlock is between : 1) Dialplan execution: pbx_extension_helper() first taking conlock, then pbx_findapp() [when called] asking for lock on apps list. 2) Application unregistration: ast_unregister_application() first taking lock on apps list, then unreference_cached_app() [when called] asking for conlock. As a protection, I suggest to modify ast_unregister_application(), so that it anticipates the need of conlock, before taking the lock on apps list. The side effect is a longer unavailability of conlock when unregistering an application. ASTERISK-27041 Change-Id: I0db0f1eb320da6a5758cce3a47d765be1face8e2 2017-06-14 11:12 +0000 [c2eea791e4] George Joseph * res_pjsip_pubsub: Fix reference to released endpoint destroy_subscription was attempting to get the id of the subscription tree's endpoint after we'd already called ao2_cleanup on it causing a segfault. Moved the cleanup until after the debug statement and since endpoint could also be NULL at this point, check for that as well. ASTERISK-27057 #close Reported-by: Ryan Smith Change-Id: Ice0a7727f560cf204d870a774c6df71e159b1678 2017-06-14 08:29 +0000 [2dee95cc7a] George Joseph * res_pjsip_session: Correct inverted test in session_outgoing_nat_hook There was a typo introduced in commit 776ffd77 which was preventing the transport's external media address from being used. ASTERISK-27024 #close Reported-by: Christopher van de Sande patches: patch.diff submitted by Florian Floimair (license 6892) Change-Id: I7ec617171eaa2d86d2680b00cf37d5088adafc27 2017-06-08 17:31 +0000 [e16a669c70] Jørgen H * res_pjsip_transport_websocket: Add NULL check in get_write_timeout Added check for NULL return value when calling ast_sorcery_retrieve_by_id in function get_write_timeout ASTERISK-27046 Change-Id: I9357717278da631c3a1cb502c412693929b0cb41 2017-06-14 08:54 +0000 [7dafe82751] George Joseph * res_rtp_asterisk: Fix ssrc change for rtcp srtp It looks like there was a copy/paste error in ast_rtp_change_source where if there was a rtcp srtp instance, instead of updating its ssrc we were updating the srtp instance ssrc twice. ASTERISK-27022 #close Reported-by: Michael Walton Change-Id: Ic88f3aee7227b401c58745ac265ff92c19620095 2017-06-08 14:38 +0000 [e414833f6e] Joshua Colp * bridge: Add a deferred queue. This change adds a deferred queue to bridging. If a bridge technology determines that a frame can not be written and should be deferred it can indicate back to bridging to do so. Bridging will then requeue any deferred frames upon a new channel joining the bridge. This change has been leveraged for T.38 request negotiate control frames. Without the deferred queue there is a race condition between the bridge receiving the T.38 request negotiate and the second channel joining and being in the bridge. If the channel is not yet in the bridge then the T.38 negotiation fails. A unit test has also been added that confirms that a T.38 request negotiate control frame is deferred when no other channel is in the bridge and that it is requeued when a new channel joins the bridge. ASTERISK-26923 Change-Id: Ie05b08523f399eae579130f4a5f562a344d2e415 2017-06-13 14:17 +0000 [6cdf3191d3] Kevin Harwell * res_pjsip_refer/session: Calls dropped during transfer When doing an attended transfer it's possible for the transferer, after receiving an accepted response from Asterisk, to send a BYE to Asterisk, which can then be processed before Asterisk has time to start and/or complete the transfer process. This of course causes the transfer to not complete successfully, thus dropping the call. This patch makes it so any BYEs received from the transferer, after the REFER, that initiate a session end are deferred until the transfer is complete. This allows the channel that would have otherwise been hung up by Asterisk to remain available throughout the transfer process. ASTERISK-27053 #close Change-Id: I43586db79079457d92d71f1fd993be9a3b409d5a 2017-06-13 10:47 +0000 [0bde568669] George Joseph * pjproject_bundled: Use the asterisk github mirror for download We now mirror the pjproject tarball and md5 at https://github.com/asterisk/third-party/tree/master/pjproject To improve download reliability, we now get the tarball from our mirror instead of from pjsip.org. ASTERISK-27052 #close Reported-by: 'alex' Change-Id: I60236587a8935bfa71fcc391f4e2ecb31918c08a 2017-06-12 17:55 +0000 [08be5e01e8] Alexei Gradinari * app_voicemail: IMAP logout on MWI unsubscribe Closing IMAP connection on MWI unsubscribe. ASTERISK-24052 #close Change-Id: I4ff964026002b2817b48c20fb4239f0a880228fd 2017-06-12 09:57 +0000 [59c9bbe696] Alexei Gradinari * res_pjsip_mwi: don't create mwi subscriptions if initial unsolicited disabled If sending unsolicited mwi to all endpoints on startup is disabled (mwi_disable_initial_unsolicited=yes) do not need to create subscriptions. If there are many (thousands) realtime endpoints configured with unsolicited mwi and Vociemail Storage configured as ODBC or IMAP there will be huge number of DB/IMAP requests on startup. ASTERISK-26230 #close Change-Id: I50ae909639e3ee298b931a54def4b2b9e0fb86c5 2017-06-06 14:54 +0000 [68de35a6a0] David M. Lee * CFLAGS for BIND8 support Some systems (like macOS) require BIND_8_COMPAT to be defined so that the nameser libraries are, well, BIND8 compatible. Change-Id: If79fc27a64f90de1835b5aa3aadfa9be22bd16b0 2017-06-11 12:06 +0000 [da3312457e] Sean Bright * codecs.conf.sample: Fix max_bandwidth speling error Reported by Sylvain Boily via asterisk-dev mailing list. Change-Id: Idc7623f335aea3e144dd369ba383b9a757480a9d 2017-06-08 10:54 +0000 [6a64f65fe6] Guido Falsi * BuildSystem: Add patches to allow building with recent LibreSSL Add some #if defined checks which allow building against LibreSSL. These patchess come from OpenBSD ports: https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/telephony/asterisk/patches/ ASTERISK-27043 #close Reported by: OpenBSD ports Change-Id: I2f6c08a5840b85ad4d2b75370b947ddde7a9a572 2017-06-08 10:36 +0000 [44cee2f4a1] Guido Falsi * BuildSystem: Fix build on FreeBSD due to missing crypt.h FreeBSD does not include a crypt.h include file. Definitions for crypt() and crypt_r() are in unistd.h ASTERISK-27042 #close Change-Id: Ib307ee5e384870c6af50efa89fb73722dd0c3a7e 2017-06-07 15:19 +0000 [1f10c6b3b0] Joshua Colp * chan_pjsip: Update device state when in early media. The chan_pjsip module uses a calculation approach for determining device state. This means that in situations where we would expect device state to change we need to tell the core to query. A scenario that was missed is when early media was signaled. This change adds the notification for the core to query device state when we are told that early media is being provided. ASTERISK-27039 Change-Id: Iafebfd152894966344ff2e950a3cee9f59a3eb6f 2017-06-07 14:32 +0000 [590ffcaf0b] Sean Bright * eventfd: Disable during cross compilation Reported by Lonnie Abelbeck via private e-mail. Change-Id: Icc80f12b8d8d591e14a8e0ed9f1c02cbd193a89b 2017-06-07 11:21 +0000 [5520b6c201] Alexei Gradinari * CHANGES: correct version for a new option 'refer_blind_progress' Change-Id: If4817d26a8974610827624fb8a4e56d681d6bf97 2017-06-06 07:04 +0000 [996a4791ff] Joshua Colp * pjsip: Extend 'asymmetric_rtp_codec' option to include us changing. PJSIP support in Asterisk differs from chan_sip in that it allows media to be sent as-is without transcoding provided the codecs were negotiated in the SDP. This is allowed according to the RFC. Support for this differs quite a lot though and some endpoints do not handle it well. This change extends the 'asymmetric_rtp_codec' option to also cover this case. When set to no (the default) the code behaves as chan_sip does - the best codec is selected and we will only ever send that, unless we change what we are sending if the remote side changes. When set to yes we will send media as-is without transcoding if the codec has been negotiated in the SDP. ASTERISK-26996 Change-Id: Ib1647f6902a0843e8c435946f831c2159e8d1d51 2017-06-06 10:04 +0000 [c093bf8072] Sean Bright * res_rtp_multicast: Use consistent timestamps when possible When a frame destined for a MulticastRTP channel does not have timing information (such as when an 'originate' is done), we generate the RTP timestamps ourselves without regard to the number of samples we are about to send. Instead, use the same method as res_rtp_asterisk and 'predict' a timestamp given the number of samples. If the difference between the timestamp that we generate and the one we predict is within a specific threshold, use the predicted timestamp so that we end up with timestamps that are consistent with the number of samples we are actually sending. Change-Id: I2bf0db3541b1573043330421cbb114ff0f22ec1f 2017-05-31 10:41 +0000 [746c2c5745] Joshua Colp * res_pjsip: Add support for returning only reachable contacts and use it. This introduces the ability for PJSIP code to specify filtering flags when retrieving PJSIP contacts. The first flag for use causes the query code to only retrieve contacts that are not unreachable. This change has been leveraged by both the Dial() process and the PJSIP_DIAL_CONTACTS dialplan function so they will now only attempt calls to contacts which are not unreachable. ASTERISK-26281 Change-Id: I8233b4faa21ba3db114f5a42e946e4b191446f6c 2017-06-05 10:45 +0000 [adfb28882b] Kevin Harwell * channel: ast_write frame wrongly freed after call to audiohooks ASTERISK-26419 introduced a bug when calling ast_audiohook_write_list in ast_write. It would free the frame given to ast_write if the frame returned by ast_audiohook_write_list was different than the given one. The frame give to ast_write should never be freed within that function. It is the caller's resposibility to free the frame after writing (or when it its done with it). By freeing it within ast_write this of course led to some memory corruption problems. This patch makes it so the frame given to ast_write is no longer freed within the function. The frame returned by ast_audiohook_write_list is now subsequently used in ast_write and is freed later. It is freed either after translate if the frame returned by translate is different, or near the end of ast_write prior to function exit. ASTERISK-26973 #close Change-Id: I463d4ac3b736ced95de986ee74a489c7c7ab103b 2017-05-31 11:45 +0000 [283cc59af7] Sean Bright * pbx_builtin: Properly handle hangup during Background Before this patch, when a user hung up during a Background, we would stuff 0xff into a char and attempt a dialplan lookup of it. This caused problems for some realtime engines which interpreted the value as the beginning of an invalid UTF-8 sequence. ASTERISK-19291 #close Reported by: Andrew Nowrot Change-Id: I8ca6da93252d61c76ebdb46a4aa65e73ca985358 2017-05-31 04:25 +0000 [dc05183f4b] Joshua Colp * channel / app_meetme: Fix parentheses. ASTERISK-27025 Change-Id: Id736b0aa4ec6b6b0f04663d64fa8d151f81fdbed 2017-05-30 16:07 +0000 [cf6cf59646] Sean Bright * stasis_recording: Correct ast_asprintf error checking ASTERISK-27021 #close Reported by: Tim Morgan Change-Id: I0ac061f040093e806c3b1f4e2340864f3ce4dd75 2017-05-28 15:43 +0000 [70e5887906] Sean Bright * format: Reintroduce smoother flags In review 4843 (ASTERISK-24858), we added a hack that forced a smoother creation when sending signed linear so that the byte order was adjusted during transmission. This was needed because smoother flags were lost during the new format work that was done in Asterisk 13. Rather than rolling that same hack into res_rtp_multicast, re-introduce smoother flags so that formats can dictate their own options. Change-Id: I77b835fba0e539c6ce50014a984766f63cab2c16 2017-05-30 09:34 +0000 [97b003f5e2] Sean Bright * format_mp3: Re-work menuselect/build issues Rather than removing format_mp3 from ALL_C_MODS (which caused format_mp3 to not show up in menuselect), use .PHONY targets when the necessary source files are not present. ASTERISK-23951 Reported by: Tzafrir Cohen Change-Id: I0a7512c51acc9e86043671795020b0de725bd9e8 2017-05-30 09:43 +0000 [c10341646d] George Joseph * test_json: Fix test names with reserved words Some of the test names were actually reserved words (true, false, int, null, string, bool). When the jenkins test results analyzer does its thing it tries to create a map using the test names as keys and fails because they're reserved words. Added "type_" to those test names. Change-Id: I90d809f46969c78a1c605b736ff0635196a2cf1b 2017-05-26 11:41 +0000 [b07b216235] Joshua Colp * manager: Clear the flag on the other channel. During the channel flag audit an incorrect change was done. The flag should be cleared on the second channel. ASTERISK-26469 Change-Id: I770c5a389550a2fb5a6ade942fccbb2e1d9199c8 2017-05-26 11:06 +0000 [5e9cd1f20d] Sean Bright * res_srtp: Add support for libsrtp2 ASTERISK-25294 #close Reported by: Tzafrir Cohen ASTERISK-26976 #close Reported by: Alex Change-Id: I789b1c3d1ed31365bbd9339fa58ef36f48833c40 2017-05-25 11:10 +0000 [72213c98e3] Sean Bright * format_mp3: Don't try to build format_mp3 if we don't have sources ASTERISK-23951 #close Reported by: Tzafrir Cohen Change-Id: Iebf181d44bb735787fde4b5be863c4d7e2478a30 2017-05-24 15:50 +0000 [65898c3af8] George Joseph * unittests: Add a unit test that causes a SEGV and... ...that can only be run by explicitly calling it with 'test execute category /DO_NOT_RUN/ name RAISE_SEGV' This allows us to more easily test CI and debugging tools that should do certain things when asterisk coredumps. To allow this a new member was added to the ast_test_info structure named 'explicit_only'. If set by a test, the test will be skipped during a 'test execute all' or 'test execute category ...'. Change-Id: Ia3a11856aae4887df9a02b6b081cc777b36eb6ed 2017-05-23 15:42 +0000 [90237dca11] Sean Bright * res_agi: Allow configuration of audio format of EAGI pipe This change allows the format of the EAGI audio pipe to be changed by setting the dialplan variable 'EAGI_AUDIO_FORMAT' to the name of one of the loaded formats. ASTERISK-26124 #close Change-Id: I7a10fad401ad2a21c68c2e7246fa357d5cee5bbd 2017-05-23 13:33 +0000 [3eb7fbba72] Sean Bright * res_agi: Clarify 'RECORD FILE' documentation Documented the 'beep' option in both the parameters list and the command description. ASTERISK-23839 #close Change-Id: I4970395c922dbdce3f7cf0f56d5b065ec9aa53ea 2017-05-23 13:06 +0000 [f306e451f6] Sean Bright * res_agi: Prevent crash when SET VARIABLE called without arguments Explicitly check that the appropriate number of arguments were passed to SET VARIABLE before attempting to reference them. Also initialize the arguments array to zeroes before populating it. ASTERISK-22432 #close Change-Id: I5143607d80a2724f749c1674f3126b04ed32ea97 2017-05-23 12:35 +0000 [a007e438c3] Sean Bright * res_agi: Fix malformed AGI usage response If the generated XML documentation for a command does not end with a \n, the postamble of the usage message does not appear on its own line. ASTERISK-25662 #close Change-Id: If190f1e9e37fe215fed95897d78d4a6e142b0020 2017-05-23 12:00 +0000 [971a401ce9] Sean Bright * sip.conf.sample: Clarify where DTLS settings are permitted ASTERISK-25101 #close Change-Id: I09a97793e5577b4422d0ae883fadb3f0d86725cc 2017-05-23 10:06 +0000 [700ef6861a] Sean Bright * res_format_attr_h26x: Trim blanks in fmtp attributes Some devices separate format attributes with a semicolon followed by a space, so trim blanks before trying to match them. ASTERISK-27008 #close Change-Id: Ia44cb2e4fef5c73dc541a29da79cb0e19c22d9cc 2017-05-15 15:03 +0000 [6bfcb1acc7] Joshua Colp * app_queue: Fix members showing as being in call when not. A change was done which added an 'in_call' flag to queue members that was set to true while talking to an agent. Unfortunately in practice this does not accurately reflect whether they are talking to an agent or not. If a Local channel is involved and a transfer is performed then the app_queue application would incorrectly think the agent was still in a call with the caller. This was done to fix a race condition between an agent becoming available by device state and the checking of the last call information for the wrapup time. There was a small window where the last call information would be the previous value instead of the new one. This change goes about fixing the original issue in a different way by considering the call completed if device state is received which would make the agent available and if they are currently in a call. If this occurs the last call information is updated before the agent becomes available ensuring that old information is not present when checking if the member should be called. This also improves the transfer situation by actually updating and enforcing the wrapup time. ASTERISK-26399 ASTERISK-26400 ASTERISK-26715 ASTERISK-26975 Change-Id: Ife1cb686e3173b3a6d368601adef9aff69d4beea 2017-05-23 05:45 +0000 [f1b32de2c5] Robert Mordec * app_confbridge: Race between removing and playing name recording while leaving When user leaves a conference, its channel calls async_play_sound_file() in order to play the name announcement and then unlinks the sound file. The async_play_sound_file() function adds a task to conference playback queue, which then runs playback_common() function in a different thread. It leads to a race condition when, in some cases, channel thread may unlink the sound file before playback_common() had a chance to open it. This patch creates a file deletion task, that is queued after playback. ASTERISK-27012 #close Change-Id: I412f7922d412004b80917d4e892546c15bd70dd3 2017-05-22 13:51 +0000 [e91efef2bb] Kevin Harwell * res_rtp_asterisk: rtcp mux using the wrong srtp unprotecting algorithm When using rtcp mux if an rtcp payload came in it would still use the srtp unprotect algorithm instead of the srtp unprotect rtcp method. Since rtcp data was being passed to the rtp unprotect method this would result in an error. This patch ensures that the correct unprotect method is chosen by making sure the passed in rtcp flag is appropriately set when rtcp mux is enabled and an rtcp payload is received. ASTERISK-26979 #close Change-Id: Ic5409f9d1a267f1d4785fc5aed867daaecca6241 2017-05-19 10:05 +0000 [4479038073] Sean Bright * chan_sip: Better ICE handling for RTCP-MUX If we are offered or are offering RTCP-MUX, don't consider RTCP ICE candidates. This confuses certain browsers (current Firefox for example) and causes intial audio setup delays. ASTERISK-26982 #close Change-Id: Ifeaf47e83972fe8dbe58b7fb3d6d1823400cfb91 2017-04-26 09:22 +0000 [36628cc9c4] Yasin CANER * res_pjsip_session : fixed wrong From Header number On Re-invite ASTERISK-26964 #close Change-Id: I55a9caa7dc90e6c4c219cb09b5c2ec08af84a302 2017-04-13 17:16 +0000 [919ccdb9ac] Mark Michelson * AST-2017-002: Ensure transaction key buffer is large enough. ASTERISK-26938 #close Change-Id: I266490792fd8896a23be7cb92f316b7e69356413 2017-04-13 17:17 +0000 [49c032abef] Mark Michelson * AST-2017-003: Handle zero-length body parts correctly. ASTERISK-26939 #close Change-Id: I7ea235ab39833a187db4e078f0788bd0af0a24fd 2017-04-13 11:14 +0000 [1cc18d4025] George Joseph * AST-2017-004: chan_skinny: Add EOF check in skinny_session The while(1) loop in skinny_session wasn't checking for EOF so a packet that was longer than a header but still truncated would spin the while loop infinitely. Not only does this permanently tie up a thread and drive a core to 100% utilization, the call of ast_log() in such a tight loop eats all available process memory. Added poll with timeout to top of read loop ASTERISK-26940 #close Reported-by: Sandro Gauci Change-Id: I2ce65f3c5cb24b4943a9f75b64d545a1e2cd2898 2017-05-18 16:35 +0000 [c107ab4c04] Sean Bright * res_hep_rtcp: Add support level to module info Change-Id: I5661478f9cf12d431f730e42be79323b62831e92 2017-05-11 00:25 +0000 [cfeae52c0f] Ivan Poddubny * app_queue: Fix duplicate queue_log entries for EXITEMPTY and ABANDON There are 2 places in app_queue.c that log EXITEMPTY event: one in wait_our_turn, and another one in queue_exec in the loop trying to call an agent after wait_our_turn. In most cases it leads to logging EXITEMPTY twice. ABANDON is also logged on two places, and in the rare case when an agent and caller hang up simultaneously it's also possible to get duplicates in queue_log. This commit changes wait_our_turn to return -1 ("the caller should exit the queue") instead of 0 ("the caller's turn has arrived") in case of leaving when empty, so queue_exec skips the agent calling loop. Also, leave_queue is now executed only once in this case, because 2nd time is just a noop when the queue entry has already been removed. Also, it sets qe->handled to -1 to indicate that the call was not answered by an agent, but the necessary handling has already been done in order to avoid logging an extra ABANDON entry. ASTERISK-25665 #close Reported by: Ove Aursand Change-Id: I4578dd383bf2ac41589cf167865e8aaebcd4c11e 2017-05-14 00:37 +0000 [5da91c65be] Rodrigo Ramírez Norambuena * Fix spelling queues.conf.sample file Change-Id: Ie1c2d83af66f27a449da09a68d987e0992627fee 2017-05-13 11:40 +0000 [1618203964] Joshua Colp * asterisk: Audit locking of channel when manipulating flags. When manipulating flags on a channel the channel has to be locked to guarantee that nothing else is also manipulating the flags. This change introduces locking where necessary to guarantee this. It also adds helper functions that manipulate channel flags and lock to reduce repeated code. ASTERISK-26789 Change-Id: I489280662dba0f4c50981bfc5b5a7073fef2db10 2017-05-12 21:04 +0000 [b67363006f] Richard Mudgett * res_pjsip_session.c: Process initial INVITE sooner. (key exists) Retransmissions of an initial INVITE could be queued in the serializer before we have processed the first INVITE message. If the first INVITE message doesn't get completely processed before the retransmissions are seen then we could try to setup the same call from the retransmissions. A symptom of this is seeing a (key exists) message associated with an INVITE. An earlier change attempted to address this kind of problem by calculating a distributor serializer to use for unassociated messages. Part of that change also made incoming calls keep using that distributor serializer. (ASTERISK-26088) However, some leftover code was still deferring the INVITE processing to the session's serializer even though we were already in that serializer. This not only is unnecessary but would cause the same call resetup problem. * Removed the code to defer processing the initial INVITE to the session's serializer because we are already running in that serializer. ASTERISK-26998 #close Change-Id: I1e822d82dcc650e508bc2d40d545d5de4f3421f6 2017-05-08 15:56 +0000 [6af2dd34af] Alexei Gradinari * res_pjsip: New endpoint option "refer_blind_progress" This option was added to turn off notifying the progress details on Blind Transfer. If this option is not set then the chan_pjsip will send NOTIFY "200 OK" immediately after "202 Accepted". Some SIP phones like Mitel/Aastra or Snom keep the line busy until receive "200 OK". ASTERISK-26333 #close Change-Id: Id606fbff2e02e967c02138457badc399144720f2 2017-05-09 10:34 +0000 [6fba0a41f0] Joshua Colp * tcptls: Improve error messages for TLS connections. This change uses the functions provided by OpenSSL to query and better construct error messages for situations where the connection encounters a problem. ASTERISK-26606 Change-Id: I7ae40ce88c0dc4e185c4df1ceb3a6ccc198f075b 2017-05-04 17:28 +0000 [8ec6e19c86] Joshua Elson * Prevent Undefined Capath Crash It is possible to initialize a valid config without a capath or cafile definition. This will cause a crash on a reload. This fix ensures capath is always allocated. ASTERISK-26983 #close Change-Id: I63ff715d9d9023427543a5b8a4ba7b0d82533c12 2017-05-05 11:33 +0000 [d6325373ac] George Joseph * cel_odbc: Fix timestamp processing for microseconds When a column is of type timestamp, the fraction part of the event field's seconds was frequently parsed incorrectly especially if there were leading zeros. For instance "2017-05-23 23:55:03.023" would be parsed into an int as "23" then when the timestamp was formatted again to be inserted into the database column it'd be "2017-05-23 23:55:03.23" which is now 230 milliseconds instead of 23 milliseconds. "03.000001" would be transformed to "03.1", etc. * If the event field is 'eventtime' and the db column is timestamp, then existing processing has already correctly formatted the timestamp so now we simply use it rather than parsing it and re-printing it. This is the most common use case anyway. * If the event field is other than 'eventtime' and the db column is timestamp, we now parse the seconds, including the fractional part into a double rather than 2 ints. This preserves the magnitude and precision of the fractional part. When we print it, we now print it as a "%09.6lf" which correctly represents the input. To be honest, why we parse the string timestamp into components, test the components, then print the components back into a string timestamp is beyond me. We should use parse it, test it, then if it passes, use the original string representation in the database call. Maybe someone thought that some implementations wouldn't take a partial timestamp string like "2017-05-06" and decided to always produce a full timestamp string even if an abbreviated one was supplied. Anyway, I'm leaving it as it is. ASTERISK-25032 #close Reported-by: Etienne Lessard Change-Id: Id407e6221f79a5c1120e1a70bc7e893bbcaf1938 2017-05-09 05:25 +0000 [10a49ab362] Joshua Colp * res_hep_rtcp: Provide chan_sip Call-ID for RTCP messages. This change adds the required logic to allow the SIP Call-ID to be placed into the HEP RTCP traffic if the chan_sip module is used. In cases where the option is enabled but the channel is not either SIP or PJSIP then the code will fallback to the channel name as done previously. Based on the change on Nir's branch at: team/nirs/hep-chan-sip-support ASTERISK-26427 Change-Id: I09ffa5f6e2fdfd99ee999650ba4e0a7aad6dc40d 2017-05-08 16:11 +0000 [7d4a22bf2e] George Joseph * logger: Added logger_queue_limit to the configuration options. All log messages go to a queue serviced by a single thread which does all the IO. This setting controls how big that queue can get (and therefore how much memory is allocated) before new messages are discarded. The default is 1000. Should something go bezerk and log tons of messages in a tight loop, this will prevent memory escalation. When the limit is reached, a WARNING is logged to that effect and messages are discarded until the queue is empty again. At that time another WARNING will be logged with the count of discarded messages. There's no "low water mark" for this queue because the logger thread empties the entire queue and processes it in 1 batch before going back and waiting on the queue again. Implementing a low water mark would mean additional locking as the thread processes each message and it's not worth it. A "test" was added to test_logger.c but since the outcome is non-deterministic, it's really just a cli command, not a unit test. Change-Id: Ib4520c95e1ca5325dbf584c7989ce391649836d1 2017-05-08 13:40 +0000 [1bcce442d0] Vitezslav Novy * chan_sip: Change sip_get_codec() to return correct codec list Return cahnnel nativeformats to fix bridge technology selection process. Same approach as in pjsip module. ASTERISK-26143 Reported-by: Henning Holtschneider Change-Id: I64e863753954d6ad67a9e722df2ebc328705ad48 2017-05-04 17:32 +0000 [614eda785d] Richard Mudgett * netsock2.c: Made get/set addr port avoid potential uninitialized memory. Change-Id: I532052bd7cd95a4b3565485fc01e2a1ea07ee647 2017-05-05 08:48 +0000 [c3ed63cb2c] Joshua Colp * func_cdr: Allow empty value for CDR dialplan function. A regression was introduced in 12 where passing an empty value to the CDR dialplan function was not longer allowed. This change returns to the behavior of 11 where it is permitted. ASTERISK-26173 Change-Id: I3f148203b54ec088007e29e30005a5de122e51c5 2017-05-04 16:04 +0000 [bed6c0d04b] George Joseph * app_confbridge: Fix reference to cfg in menu_template_handler menu_template_handler wasn't properly accounting for the fact that it might be called both during a load/reload (which isn't really valid but not prevented) and by a dialplan function. In both cases it was attempting to use the "pending" config which wasn't valid in the latter case. aco_process_config is also partly to blame because it wasn't properly cleaning "pending" up when a reload was done and no changes were made. Both of these contributed to a crash if CONFBRIDGE(menu,template) was called in a dialplan after a reload. * aco_process_config now sets info->internal->pending to NULL after it unrefs it although this isn't strictly necessary in the context of this fix. * menu_template_handler now uses the "current" config and silently ignores any attempt to be called as a result of someone uses the "template" parameter in the conf file. Luckily there's no other place in the codebase where aco_pending_config is used outside of aco_process_config. ASTERISK-25506 #close Reported-by: Frederic LE FOLL Change-Id: Ib349a17d3d088f092480b19addd7122fcaac21a7 2017-04-30 16:40 +0000 [7ffd80cc04] Joshua Colp * bridge: Fix returning to dialplan when executing Bridge() from AMI. When using the Bridge AMI action on the same channel multiple times it was possible for the channel to return to the wrong location in the dialplan if the other party hung up. This happened because the priority of the channel was not preserved across each action invocation and it would fail to move on to the next priority in other cases. This change makes it so that the priority of a channel is preserved when taking control of it from another thread and it is incremented as appropriate such that the priority reflects where the channel should next be executed in the dialplan, not where it may or may not currently be. The Bridge AMI action was also changed to ensure that it too starts the channels at the next location in the dialplan. ASTERISK-24529 Change-Id: I52406669cf64208aef7252a65b63ade31fbf7a5a 2017-05-01 13:04 +0000 [bbe90d6aed] Kevin Harwell * res_rtp_asterisk: Clearing the remote RTCP address causes RTCP failures When a call gets put on hold RTP is temporarily stopped and Asterisk was setting the remote RTCP address to NULL. Then when RTCP data was received from the remote endpoint, Asterisk would be missing this information when publishing the rtcp_message stasis event. Consequently, message subscribers (in this case res_hep_rtcp) trying to parse the "from" field output the following error: "ast_sockaddr_split_hostport: Port missing in (null)" This patch makes it so the remote RTCP address is no longer set to NULL when stopping RTP. There was only one place that appeared to check if the remote RTCP address was NULL as a way to tell if RTCP was running. This patch added an additional check on the RTCP schedid for that case to make sure RTCP was truly not running. ASTERISK-26860 #close Change-Id: I6be200fb20db647e48b5138ea4b81dfa7962974b 2017-05-02 11:34 +0000 [526a0081a0] Sean Bright * cleanup: Change severity of fread short-read warning Many sound files don't have a full frame's worth of data at EOF, so the warning messages were a bit too noisy. So we demote them to debug messages. Change-Id: I6b617467d687658adca39170a81797a11cc766f6 2017-04-26 07:58 +0000 [23db04ed93] Thierry Magnien * channels/chan_sip.c: use binding IP address for outgoing TCP SIP connections For outgoing TCP connections, Asterisk uses the first IP address of the interface instead of the IP address we asked him to bind to. ASTERISK-26922 #close Reported-by: Ksenia Change-Id: I43c71ca89211dbf1838e5bcdb9be8d06d98e54eb 2017-04-29 16:18 +0000 [02234e920c] Richard Mudgett * rtp_engine.c: Fix deadlock potential copying RTP payload maps. There is a theoretical potential to deadlock in ast_rtp_codecs_payloads_copy() because it locks two different ast_rtp_codecs locks. It is theoretical because the callers of the function are either copying between a local ast_rtp_codecs struct and a RTP instance of the ast_rtp_codecs struct. Or they are copying between the caller and callee channel RTP instances before initiating the call to the callee. Neither of these situations could actually result in a deadlock because there cannot be another thread involved at the time. * Add deadlock avoidance code to ast_rtp_codecs_payloads_copy() since it locks two ast_rtp_codecs locks to perform a copy. This only affects v13 since this deadlock avoidance code is already in newer branches. Change-Id: I1aa0b168f94049bd59bbd74a85bd1e78718f09e5 2017-04-29 16:11 +0000 [9d5df48968] Richard Mudgett * res_pjsip_t38.c: Fix deadlock in T.38 framehook. A deadlock can happen between a channel lock and a pjsip session media container lock. One thread is processing a reINVITE's SDP and walking through the session's media container when it waits for the channel lock to put the determined format capabilities onto the channel. The other thread is writing a frame to the channel and processing the T.38 frame hook. The T.38 frame hook then waits for the pjsip session's media container lock. The two threads are now deadlocked. * Made the T.38 frame hook release the channel lock before searching the session's media container. This fix has been done to several other frame hooks to fix deadlocks. ASTERISK-26974 #close Change-Id: Ie984a76ce00bef6ec9aa239010e51e8dd74c8186 2017-04-28 10:56 +0000 [623832b94e] George Joseph * res_pjsip_outbound_authenticator_digest: Add context to log messages There was no context info in this module's log messages so it was impossible to toubleshoot. Added endpoint or host to all messages and added the realms in the challenge for the "No auth credentials for any realm" message. Change-Id: Ifeed2786f35fbea7d141237ae15625e472acff9b 2017-04-27 08:02 +0000 [c5b9ed20fd] George Joseph * res_pjsip_session: Add cleanup to ast_sip_session_terminate If you use ast_request to create a PJSIP channel but then hang it up without causing a transaction to be sent, the session will never be destroyed. This is due ot the fact that it's pjproject that triggers the session cleanup when the transaction ends. app_chanisavail was doing this to get more granular channel state and it's also possible for this to happen via ARI. * ast_sip_session_terminate was modified to explicitly call the cleanup tasks and unreference session if the invite state is NULL AND invite_tsx is NULL (meaning we never sent a transaction). * chan_pjsip/hangup was modified to bump session before it calls ast_sip_session_terminate to insure that session stays valid while it does its own cleanup. * Added test events to session_destructor for a future testsuite test. ASTERISK-26908 #close Reported-by: Richard Mudgett Change-Id: I52daf6f757184e5544c261f64f6fe9602c4680a9 2017-04-26 14:20 +0000 [c853cfdc7c] Kevin Harwell * res_pjsip/res_pjsip_callerid: NULL check on caller id name string It's possible for a name in a party id structure to be marked as valid, but the name string itself be NULL (for instance this is possible to do by using the dialplan CALLERID function). There were a couple of places where the name was validated, but the string itself was not checked before passing it to functions like 'strlen'. This of course caused a crashed. This patch adds in a NULL check before attempting to pass it into a function that is not NULL tolerant. ASTERISK-25823 #close Change-Id: Iaa6ffe9d92f598fe9e3c8ae373fadbe3dfbf1d4a 2017-04-25 11:43 +0000 [4d3b4fbf22] Kevin Harwell * vector: defaults and indexes Added an pre-defined integer vector declaration. This makes integer vectors easier to declare and pass around. Also, added the ability to default a vector up to a given size with a default value. Lastly, added functionality that returns the "nth" index of a matching value. Also, updated a unit test to test these changes. Change-Id: Iaf4b51b2540eda57cb43f67aa59cf1d96cdbcaa5 2017-04-20 02:13 +0000 [566ad7c35d] Jean Aunis * chan_sip: Trigger reinvite if the SDP answer is included in the SIP ACK Some equipments may send a re-INVITE containing an SDP in the final ACK request. If this happens in the context of direct media, the remote end should be updated with a re-INVITE. This patch queues an "update RTP peer" frame to trigger the re-INVITE, instead of the "source change" frame wich was used previously. ASTERISK-26951 Change-Id: I3644d2025f20e086ea9f8f62b486172c52b5b2e6 2017-04-26 08:45 +0000 [001dc2ade6] George Joseph * pjproject_bundled: Add --disable-libwebrtc to configure Without the disable, pjproject tries to build it's internal webrtc implementation which requires sse2. This fails on platforms without sse2. ASTERISK-26930 #close Reported-by: abelbeck Change-Id: I07231f9160c35cfa42b194d3aad4e7d51fd9a410 2017-04-26 05:38 +0000 [ae696132a2] Joshua Colp * frame: Better handle interpolated frames. Interpolated frames are frames which contain a number of samples but have no actual data. Audiohooks did not handle this case when translating an incoming frame into signed linear. It assumed that a frame would always contain media when it may not. If this occurs audiohooks will now immediately return and not act on the frame. As well for users of ast_trans_frameout the function has been changed to be a bit more sane and ensure that the data pointer on a frame is set to NULL if no data is actually on the frame. This allows the various spots in Asterisk that check for an interpolated frame based on the presence of a data pointer to work as expected. ASTERISK-26926 Change-Id: I7fa22f631fa28d540722ed789ce28e84c7f8662b 2017-04-21 12:04 +0000 [1b50df78d0] Sean Bright * cleanup: Fix fread() and fwrite() error handling Cleaned up some of the incorrect uses of fread() and fwrite(), mostly in the format modules. Neither of these functions will ever return a value less than 0, which we were checking for in some cases. I've introduced a fair amount of duplication in the format modules, but I plan to change how format modules work internally in a subsequent patch set, so this is simply a stop-gap. Change-Id: I8ca1cd47c20b2c0b72088bd13b9046f6977aa872 2017-04-25 07:52 +0000 [c09b9dba90] Joshua Colp * alembic: Add table for 'resource_list' PJSIP RLS type. This change adds an Alembic migration which adds a ps_resource_list table that can contain resource_list RLS configuration objects. ASTERISK-26929 Change-Id: I7c888fafc67b3e87012de974f71ca7a5b8b1ec05 2017-04-24 13:16 +0000 [1b88a3a4cf] Sean Bright * res_hep: Add additional config initialization and validation * Initialize hepv3_runtime_data.sockfd to -1 so that our ao2 destructor does not close fd 0 * Add logging output when the required option - capture_address - is not specified. * Remove a no longer relevant #define and correct related documentation * Pass appropriate flags to aco_option_register so that capture_address cannot be the empty string. ASTERISK-26953 #close Change-Id: Ief08441bc6596d6f1718fa810e54a5048124f076 2017-04-17 19:06 +0000 [cea3742c54] Sean Bright * core: Use eventfd for alert pipes on Linux when possible The primary win of switching to eventfd when possible is that it only uses a single file descriptor while pipe() will use two. This means for each bridge channel we're reducing the number of required file descriptors by 1, and - if you're using timerfd - we also now have 1 less file descriptor per Asterisk channel. The API is not ideal (passing int arrays), but this is the cleanest approach I could come up with to maintain API/ABI. I've also removed what I believe to be an erroneous code block that checked the non-blocking flag on the pipe ends for each read. If the file descriptor is 'losing' its non-blocking mode, it is because of a bug somewhere else in our code. In my testing I haven't seen any measurable difference in performance. Change-Id: Iff0fb1573e7f7a187d5211ddc60aa8f3da3edb1d 2017-04-21 12:33 +0000 [1213ac1ac5] Richard Mudgett * res_pjsip_session.c: Send 100 Trying out earlier to prevent retransmissions. If ICE is enabled and a STUN server does not respond then we will block until we give up on the STUN response. This will take nine seconds. In the mean time the peer that sent the INVITE will send retransmissions. * Restructure res_pjsip_session.c:new_invite() to send a 100 Trying out earlier to prevent these retransmissions. ASTERISK-26890 Change-Id: Ie3fc611e53a0eff6586ad55e4aacad81cf6319a8 2017-04-21 12:07 +0000 [80fd7fd908] Richard Mudgett * res_pjsip_session.c: Restructure ast_sip_session_alloc() * Restructure ast_sip_session_alloc() to need less cleanup on off nominal error paths. * Made ast_sip_session_alloc() and ast_sip_session_create_outgoing() avoid unnecessary ref manipulation to return a session. This is faster than calling a function. That function may do logging of the ref changes with REF_DEBUG enabled. Change-Id: I2a0affc4be51013d3f0485782c96b8fee3ddb00a 2017-04-19 15:08 +0000 [98e38daf82] Sean Bright * pbx: Use same thread if AST_OUTGOING_WAIT_COMPLETE specified Both ast_pbx_outgoing_app() and ast_pbx_outgoing_exten() cause the core to spawn a new thread to perform the dial. When AST_OUTGOING_WAIT_COMPLETE is passed to these functions, the calling thread will be blocked until the newly created channel has been hung up. After this patch, we run the dial on the current thread rather than spawning a new one. The only in-tree code that passes AST_OUTGOING_WAIT_COMPLETE is pbx_spool, so you should see reduced thread usage if you are using .call files. Change-Id: I512735d243f0a9da2bcc128f7a96dece71f2d913 2017-04-19 13:23 +0000 [55f452884f] Richard Mudgett * res_rtp_asterisk.c: Fix crash in RTCP DTLS operation. Occasionally a crash happens when processing the RTCP DTLS timeout handler. The RTCP DTLS timeout timer could be left running if we have not completed the DTLS handshake before we place the call on hold or we attempt direct media. * Made ast_rtp_prop_set() stop the RTCP DTLS timer when disabling RTCP. * Made some sanity tweaks to ast_rtp_prop_set() when switching from standard RTCP mode to RTCP multiplexed mode. ASTERISK-26692 #close Change-Id: If6c64c79129961acfa4b3d63a864e8f6b664acc0 2017-03-22 16:05 +0000 [f856cfbb51] Richard Mudgett * rtp_engine/res_rtp_asterisk: Fix RTP struct reentrancy crashes. The struct ast_rtp_instance has historically been indirectly protected from reentrancy issues by the channel lock because early channel drivers held the lock for really long times. Holding the channel lock for such a long time has caused many deadlock problems in the past. Along comes chan_pjsip/res_pjsip which doesn't necessarily hold the channel lock because sometimes there may not be an associated channel created yet or the channel pointer isn't available. In the case of ASTERISK-26835 a pjsip serializer thread was processing a message's SDP body while another thread was reading a RTP packet from the socket. Both threads wound up changing the rtp->rtcp->local_addr_str string and interfering with each other. The classic reentrancy problem resulted in a crash. In the case of ASTERISK-26853 a pjsip serializer thread was processing a message's SDP body while another thread was reading a RTP packet from the socket. Both threads wound up processing ICE candidates in PJPROJECT and interfering with each other. The classic reentrancy problem resulted in a crash. * rtp_engine.c: Make the ast_rtp_instance_xxx() calls lock the RTP instance struct. * rtp_engine.c: Make ICE and DTLS wrapper functions to lock the RTP instance struct for the API call. * res_rtp_asterisk.c: Lock the RTP instance to prevent a reentrancy problem with rtp->rtcp->local_addr_str in the scheduler thread running ast_rtcp_write(). * res_rtp_asterisk.c: Avoid deadlock when local RTP bridging in bridge_p2p_rtp_write() because there are two RTP instance structs involved. * res_rtp_asterisk.c: Avoid deadlock when trying to stop scheduler callbacks. We cannot hold the instance lock when trying to stop a scheduler callback. * res_rtp_asterisk.c: Remove the lock in struct dtls_details and use the struct ast_rtp_instance ao2 object lock instead. The lock was used to synchronize two threads to prevent a race condition between starting and stopping a timeout timer. The race condition is no longer present between dtls_perform_handshake() and __rtp_recvfrom() because the instance lock prevents these functions from overlapping each other with regards to the timeout timer. * res_rtp_asterisk.c: Remove the lock in struct ast_rtp and use the struct ast_rtp_instance ao2 object lock instead. The lock was used to synchronize two threads using a condition signal to know when TURN negotiations complete. * res_rtp_asterisk.c: Avoid deadlock when trying to stop the TURN ioqueue_worker_thread(). We cannot hold the instance lock when trying to create or shut down the worker thread without a risk of deadlock. This patch exposed a race condition between a PJSIP serializer thread setting up an ICE session in ice_create() and another thread reading RTP packets. * res_rtp_asterisk.c:ice_create(): Set the new rtp->ice pointer after we have re-locked the RTP instance to prevent the other thread from trying to process ICE packets on an incomplete ICE session setup. A similar race condition is between a PJSIP serializer thread resetting up an ICE session in ice_create() and the timer_worker_thread() processing the completion of the previous ICE session. * res_rtp_asterisk.c:ast_rtp_on_ice_complete(): Protect against an uninitialized/null remote_address after calling update_address_with_ice_candidate(). * res_rtp_asterisk.c: Eliminate the chance of ice_reset_session() destroying and setting the rtp->ice pointer to NULL while other threads are using it by adding an ao2 wrapper around the PJPROJECT ice pointer. Now when we have to unlock the RTP instance object to call a PJPROJECT ICE function we will hold a ref to the wrapper. Also added some rtp->ice NULL checks after we relock the RTP instance and have to do something with the ICE structure. ASTERISK-26835 #close ASTERISK-26853 #close Change-Id: I780b39ec935dcefcce880d50c1a7261744f1d1b4 2017-04-19 08:39 +0000 [dafcd97a77] Sean Bright * build: Update config.guess and config.sub Change-Id: Id078a1df07a771808775e1053cdfe1d99c8fb172 2017-04-14 13:52 +0000 [9bbfa6fda1] Sean Bright * format_wav: Read 16khz wav samples properly When opening a PCM wave file for reading, we aren't tracking the frequency of the opened file, so we treat 16khz files as 8khz and do half reads. This patch also cleans up some of the data types and an unnecessarily complex `if` expression. ASTERISK-26613 #close Reported by: Vitaly K Change-Id: I05f8b263058dc573ea8ffe0c62e7964506e11815 2017-04-16 19:54 +0000 [4ccaffe644] George Joseph * make ari-stubs so doc periodic jobs can run The periodic doc job does a make ari-stubs and checks that there are no changes before generating the docs. Since I changed the mustache template (and the generated code directly) recently and forgot to regenerate the stubs, the doc job thinks they're out of date. Change-Id: Ibd4bc649556615ff714d44534c45b6c2f6aa449d 2017-04-14 12:51 +0000 [90c630aaa1] Sean Bright * format_ogg_vorbis: Clear ogg/vorbis data structures on close On filestream close, we need to clear out the ogg & vorbis data structures to prevent a memory leak. ASTERISK-26169 #close Reported by: Ivan Myalkin Change-Id: Iee94c5a5d5bdafbf8b181c5c064d15d90ace8274 2017-04-14 17:31 +0000 [9084c85cb1] Richard Mudgett * Revert "bridging: Ensure successful T.38 negotation" This reverts commit 3e7c396a51b240088c475dd53e7bac9869376129. Change-Id: I61d49d563babff788bb557345729b200d116bd88 2017-04-14 16:50 +0000 [357d1fbdcc] Sean Bright * res_stun_monitor: Don't fail to load if DNS resolution fails res_stun_monitor will fail to load if DNS resolution of the STUN server fails. Instead, we continue without the STUN server being resolved and we will re-attempt the resolution on the STUN refresh interval. ASTERISK-21856 #close Reported by: Jeremy Kister Change-Id: I6334c54a1cc798f8a836b4b47948e0bb4ef59254 2017-04-14 14:36 +0000 [ac15ebc379] Sean Bright * format_pcm: Track actual header size of .au files Sun's Au file format has a minimum data offset 24 bytes, but this offset is encoded in each .au file. Instead of assuming the minimum, read the actual value and store it for later use. ASTERISK-20984 #close Reported by: Roman S. Patches: asterisk-1.8.20.0-au-clicks-2.diff (license #6474) patch uploaded by Roman S. Change-Id: I524022fb19ff2fd5af2cc2d669d27a780ab2057c 2017-04-11 11:07 +0000 [f882ca2572] George Joseph * modules: change module LOAD_FAILUREs to LOAD_DECLINES In all non-pbx modules, AST_MODULE_LOAD_FAILURE has been changed to AST_MODULE_LOAD_DECLINE. This prevents asterisk from exiting if a module can't be loaded. If the user wishes to retain the FAILURE behavior for a specific module, they can use the "require" or "preload-require" keyword in modules.conf. A new API was added to logger: ast_is_logger_initialized(). This allows asterisk.c/check_init() to print to the error log once the logger subsystem is ready instead of just to stdout. If something does fail before the logger is initialized, we now print to stderr instead of stdout. Change-Id: I5f4b50623d9b5a6cb7c5624a8c5c1274c13b2b25 2017-04-07 16:14 +0000 [cd80af508e] Richard Mudgett * res_rtp_asterisk.c: Add stun_blacklist option Added the stun_blacklist option to rtp.conf. Some multihomed servers have IP interfaces that cannot reach the STUN server specified by stunaddr. Blacklist those interface subnets from trying to send a STUN packet to find the external IP address. Attempting to send the STUN packet needlessly delays processing incoming and outgoing SIP INVITEs because we will wait for a response that can never come until we give up on the response. Multiple subnets may be listed. ASTERISK-26890 #close Change-Id: I3ff4f729e787f00c3e6e670fe6435acce38be342 2017-04-06 17:31 +0000 [f8219a2e12] Richard Mudgett * stun.c: Fix ast_stun_request() erratic timeout. If ast_stun_request() receives packets other than a STUN response then we could conceivably never exit if we continue to receive packets with less than three seconds between them. * Fix poll timeout to keep track of the time when we sent the STUN request. We will now send a STUN request every three seconds regardless of how many other packets we receive while waiting for a response until we have completed three STUN request transmission cycles. Change-Id: Ib606cb08585e06eb50877f67b8d3bd385a85c266 2017-04-06 18:30 +0000 [19b82a8644] Richard Mudgett * sorcery.c: Speed up ast_sorcery_retrieve_by_id() Return early if ast_sorcery_retrieve_by_id() is not passed an id to find. Also eliminated the RAII_VAR() usage in the function. Change-Id: I871dbe162a301b5ced8b4393cec27180c7c6b218 2017-04-10 11:30 +0000 [aecf19e7d2] Richard Mudgett * res_pjsip: Fix pointer use after unref. Change-Id: I4b6e1b0070563eeaee223cb58326f1b962ed5bc1 2017-04-06 18:18 +0000 [304f652cda] Richard Mudgett * res_pjsip_sdp_rtp.c: Don't use deprecated transport struct member. * create_rtp(): Eliminate use of deprecated transport struct member. That member and several others in the transport structure were deprecated because of an infinite loop created when using realtime configuration. See 2451d4e4550336197ee2e482750cc53f30afa352 ASTERISK-26851 Change-Id: I0533aa13c9ce3c6cc394e0fd2b5bf1cd1b2ef3bc 2017-04-10 17:45 +0000 [bb8cd2add7] Richard Mudgett * tcptls.c: Cleanup TCP/TLS listener thread on abnormal exit. Temporarily running out of file descriptors should not terminate the listener thread. Otherwise, when there becomes more file descriptors available, nothing is listening. * Added EMFILE exception to abnormal thread exit. * Added an abnormal TCP/TLS listener exit error message. * Closed the TCP/TLS listener socket on abnormal exit so Asterisk does not appear dead if something tries to connect to the socket. ASTERISK-26903 #close Change-Id: I10f2f784065136277f271159f0925927194581b5 2017-04-07 08:58 +0000 [d8967ff2c0] Torrey Searle * strings.h: Avoid overflows in the string hash functions On 2's compliment machines abs(INT_MIN) behavior is undefined and results in a negative value still being returnd. This results in negative hash codes that can result in crashes. ASTERISK-26528 #close Change-Id: Idff550145ca2133792a61a2e212b4a3e82c6517b 2017-04-08 03:05 +0000 [bbbd262ec0] Walter Doekes * samples: Undo removal of include from canonicalize-app-names commit. This include was accidentally removed in changeset Ia79aea64de89531362e993e34230c2044a70aa93. My bad. Change-Id: I1d716c7f9590b4e97909fb8bca1f2ed9bd0e4082 2017-04-07 08:35 +0000 [b3f4a6365e] Joshua Colp * pjsip: Add Alembic for PUBLISH support. This change adds database tables for the PUBLISH support so it can be configured using realtime. A minor fix to the res_pjsip_publish_asterisk module was done so that it read the sorcery configuration from the correct section. Finally the sample configuration files have been updated. ASTERISK-26928 Change-Id: I81991ae5c75af98d247f7eacd1c0b0a763675952 2017-04-07 08:06 +0000 [e0e5a337fd] Alexander Traud * pjproject_bundled: Crash on pj_ssl_get_info() while ioqueue_on_read_complete(). When the Asterisk channel driver res_pjsip offers SIP-over-TLS, sometimes, not reproducible, Asterisk crashed in pj_ssl_sock_get_info() because a NULL pointer was read. This change avoids this crash. ASTERISK-26927 #close Change-Id: I24a6011b44d1426d159742ff4421cf806a52938b 2017-04-05 06:41 +0000 [3e7c396a51] Torrey Searle * bridging: Ensure successful T.38 negotation When a T.38 happens immediatly after call establishment, the control frame can be lost because the other leg is not yet in the bridge. This patch detects this case an makes sure T.38 negotation happens when the 2nd leg is being made compatible with the negotating first leg ASTERISK-26923 #close Change-Id: If334125ee61ed63550d242fc9efe7987e37e1d94 2017-04-04 16:20 +0000 [4e6e069491] George Joseph * pjproject_bundled: Add 3 upstream patches 0035-r5572-svn-backport-dialog-transaction-deadlock.patch 0036-r5573-svn-backport-ua-pjsua-transaction-deadlock.patch 0037-r5576-svn-backport-session-timer-crash.patch Also removed the progress bar from wget download to stdout. ASTERISK-26905 #close Reported-by: Ross Beer Change-Id: I268fb3cf71a3bb24283ff0d24bd8b03239d81256 2017-04-05 14:50 +0000 [d2a33cdedc] George Joseph * sample_config: Add samples for pubsub to pjsip.conf.sample Added: * outbound-publish * resource_list * inbound-publication * asterisk-publication Change-Id: I65043a896c35483f30a92d30b5b118359af7ba5a 2017-04-05 09:10 +0000 [ab9d2fc86d] Walter Doekes * samples: Canonicalize app names in extensions.conf.sample. This takes care of warnings by ossobv/asterisklint. Change-Id: Ia79aea64de89531362e993e34230c2044a70aa93 2017-04-03 15:38 +0000 [6906765381] Richard Mudgett * res_pjsip_sdp_rtp.c: Don't alter global addr variable. * create_rtp(): Fix unexpected alteration of global address_rtp if a transport is bound to an address. * create_rtp(): Fix use of uninitialized memory if the endpoint RTP media address is invalid or the transport has an invalid address. ASTERISK-26851 Change-Id: Icde42e65164a88913cb5c2601b285eebcff397b7 2017-03-27 09:03 +0000 [68bde0f07d] Corey Farrell * CDR: Protect from data overflow in ast_cdr_setuserfield. ast_cdr_setuserfield wrote to a fixed length field using strcpy. This could result in a buffer overrun when called from chan_sip or func_cdr. This patch adds a maximum bytes written to the field by using ast_copy_string instead. ASTERISK-26897 #close patches: 0001-CDR-Protect-from-data-overflow-in-ast_cdr_setuserfie.patch submitted by Corey Farrell (license #5909) Change-Id: Ib23ca77e9b9e2803a450e1206af45df2d2fdf65c 2017-03-25 19:01 +0000 [70e5a2655d] Daniel Journo * Unused realtime MOH classes not purged on 'moh reload' Purge Realtime MOH classes on 'moh reload' even when musiconhold.conf hasn't changed. ASTERISK-25974 #close Change-Id: I42c78ea76528473a656f204595956c9eedcf3246 2017-04-03 13:56 +0000 [27b556778d] Richard Mudgett * res_pjsip: Fix transport ref leak. We were leaking a transport ref in multihomed_on_rx_message() which resulted in the FRACK about excessive ref counts. ASTERISK-26916 #close Change-Id: I7a96658a9614a060565bb9ad51cb1c9c11ee145f 2017-04-03 02:30 +0000 [94bd529f9e] Alexander Traud * chan_sip: Session Timers required but refused wrongly. SIP user-agents indicate which protocol extensions are allowed in headers like Supported and Required. Such protocol extensions are Session Timers (RFC 4028) for example. Session Timers are supported since Mantis-10665. Since ASTERISK-21721, not only the first but multiple Supported/Required headers in a message are parsed. In that change, an existing variable was re-used within a newly added do-loop. Currently, at the end of that loop, that variable is an empty string always. Previously, that variable was used within log output. However, the log output was not changed. ASTERISK-26915 #close Change-Id: I09315f31b4d78fb214bb2a9fb6c0f5e143eae990 2017-03-31 16:31 +0000 [bca9685d39] Joshua Colp * res_pjsip_session: Allow BYE to be sent on disconnected session. It is perfectly acceptable for a BYE to be sent on a disconnected session. This occurs when we respond to a challenge to the BYE for authentication credentials. ASTERISK-26363 Change-Id: I6ef0ddece812fea6665a1dd2549ef44fb9d90045 2017-03-30 18:28 +0000 [c701550803] Corey Farrell * Forward declare 'struct ast_json' in asterisk.h The ast_json structure is used in many Asterisk headers and is often the only part of json.h used. This adds a forward declaration to asterisk.h and removes the include of json.h from many headers. The declaration has been left in endpoints.h and stasis.h to avoid problems with source files that use ast_json functions without directly including json.h. ari.h continues to include json.h as it uses enum ast_json_encoding_format. Change-Id: Id766aabce6bed56626d27e8d29f559b5e687b769 2017-03-30 08:11 +0000 [754e99d517] Sean Bright * cdr_pgsql: Fix buffer overflow calling libpq Implement the same buffer size checking done in cel_pgsql. ASTERISK-26896 #close Reported by: twisted Change-Id: Iaacfa1f1de7cb1e9414d121850d2d8c2888f3f48 2017-03-28 13:01 +0000 [7954b39a50] Walter Doekes * build: Fix deb build issues with fakeroot If DESTDIR is set, don't call ldconfig. Assume that DESTDIR is used to create a binary archive. The ldconfig call should be delegated to the archive postinst script. This fixes the case where fakeroot wraps 'make install' causing $EUID to be 0 even though it doesn't have permission to call ldconfig. The previous logic in configure.ac to detect and correct libdir has been removed as it was not completely accurate. CentOS 64-bit users should again specifiy --libdir=/usr/lib64 when configuring to prevent install to /usr/lib. Updated Makefile:check-old-libdir to check for orphans in lib64 when installing to lib as well as orphans in lib when installing to lib64. Updated Makefile and main/Makefile uninstall targets to remove the orphans using the new logic. ASTERISK-26705 Change-Id: I51739d4a03e60bff38be719b8d2ead0007afdd51 2017-03-29 10:11 +0000 [c9648f4690] Sean Bright * astobj2: Prevent potential deadlocks with ao2_global_obj_release The ao2_global_obj_release() function holds an exclusive lock on the global object while it is being dereferenced. Any destructors that run during this time that call ao2_global_obj_ref() will deadlock because a read lock is required. Instead, we make the global object inaccessible inside of the write lock and only dereference it once we have released the lock. This allows the affected destructors to fail gracefully. While this doesn't completely solve the referenced issue (the error message about not being able to create an IQ continues to be shown) it does solve the backtrace spew that accompanied it. ASTERISK-21009 #close Reported by: Marcello Ceschia Change-Id: Idf40ae136b5070dba22cb576ea8414fbc9939385 2017-03-30 11:57 +0000 [1d1309b1ed] Joshua Colp * Revert "Update for 13.15.0-rc1" This reverts commit 552cf009c0939c8b6597708135412bdc596df4bb. Change-Id: Ie345bea481261b761c44079e9472622040fda302 2017-03-30 10:18 +0000 [3c23ebdef4] Corey Farrell * CEL: Remove header declarations of non-existant functions. ast_cel_alloc and ast_cel_destroy do not exist in code, remove them from the headers. Change-Id: I99ce848e2e109e7d61771559f559b9e57973e45c 2017-03-29 08:27 +0000 [ef19db9261] Alexander Traud * srtp: Allow zero as tag value for a sRTP Crypto Suite. ASTERISK-25490 #close Change-Id: I1c5fc0942c33c96d62b24203aad0f1e1a1a0131f 2017-03-28 13:10 +0000 [a827892ff7] George Joseph * res_pjsip_config_wizard: Add 2 new parameters to help with proxy config Two new parameters have been added to the pjsip config wizard. * Setting 'sends_line_with_registrations' to true will cause the wizard to skip the creation of an identify object to match incoming request to the endpoint and instead add the line and endpoint parameters to the outbound registration object. * Setting 'outbound_proxy' is a shortcut for adding individual endpoint/outbound_proxy, aor/outbound_proxy and registration/outbound_proxy parameters. Change-Id: I678e5f80765734c056620528a6d40d82736ceeb0 2017-03-28 09:29 +0000 [864dda07f3] Sean Bright * alembic: Turn off execute bit on non-executable python scripts Change-Id: I744c986da4a38aeff8c00837eb89de7841fbc86c 2017-03-27 12:37 +0000 [a9529cbb21] Richard Mudgett * Add DTLS sanity check. Change-Id: Ib32612cf6c7ce9213a11b9cba82f630f8cd3564b 2017-03-27 11:49 +0000 [bb68f57a03] Josh Roberson * cel_pgsql.c: Fix buffer overflow calling libpq PQEscapeStringConn() expects the buffer passed in to be an adequitely sized buffer to write out the escaped SQL value string into. It is possible, for large values (such as large values to Dial with a lot of devices) to have more than our 512+1 byte allocation and thus cause libpq to create a buffer overrun. glibc will nicely ABRT asterisk for you, citing a stack smash. Let's only allocate it to be as large as needed: If we have a value, then (strlen(value) * 2) + 1 (as recommended by libpq), and if we have none, just one byte to hold our null will do. ASTERISK-26896 #close Change-Id: If611c734292618ed68dde17816d09dd16667dea2 2017-03-24 07:43 +0000 [79a2c26c03] Sean Bright * core: Remove embedded module support This has not worked for some time and is no longer actively maintained. Change-Id: I5110b0db69c152761b58fa025cb0a53b0e544d99 2017-03-27 09:35 +0000 [2c28f7a922] Sean Bright * res_musiconhold: Document the 'format' option ASTERISK-26086 #close Reported by: Jens Bürger Change-Id: I6aab666c0bf01fd0c64d7a5bcb22fa7f5d41335e 2017-03-27 08:58 +0000 [61fd70c250] Sean Bright * res_musiconhold: Don't chdir() when scanning MoH files There doesn't appear to be any reason that we are chdir'ing in moh_scan_files, and in the event of an Asterisk crash, the core files may not get written because we have changed into a read-only directory. ASTERISK-23996 #close Reported by: Walter Doekes Change-Id: Iac806dce01b3335963fbd62d4b4da9a65c614354 2017-03-23 09:48 +0000 [73bb08fd6a] Sean Bright * res_xmpp: Use incremental backoff when a read error occurs If a read error occurs, we immediately attempt a reconnect without any delay. Instead, let's sleep and backoff up to 60 seconds before we try again. ASTERISK-24712 #close Reported by: Matthias Urlichs Change-Id: I6fe10ef4734837727437beab715e336777f13f48 2017-03-23 05:19 +0000 [55693383e2] Sean Bright * res_xmpp: Fix ref counting issue The only remaining reference to the endpoint is in the endpoints container, and because it is unlinked in ast_endpoint_shutdown, we don't have to explicitly cleanup the endpoint ourselves. Change-Id: I912a2692e52d3e2ed445b32d8ae3f9004bc2f2e8 2017-03-23 09:45 +0000 [1966265562] Sean Bright * res_xmpp: Try to provide useful errors messages from OpenSSL If any errors occur during the TLS connection setup, we currently dump a fairly generic error message. So instead we try to pull in something useful from OpenSSL to report instead. ASTERISK-24712 Reported by: Matthias Urlichs Change-Id: I288500991a9681f447d92913b11fedaf426087f4 2017-03-23 09:30 +0000 [03b99ae3d2] Sean Bright * res_xmpp: Correctly check return value of SSL_connect SSL_connect returns non-zero for both success and some error conditions so simply negating is inadequate. Change-Id: Ifbf882896e598703b6c615407fa456d3199f95b1 2017-03-24 11:29 +0000 [d9d2beba1c] Sean Bright * res_pjsip_sdp_rtp: Set hangup cause for RTP timeouts chan_sip sets the hangup cause code to AST_CAUSE_REQUESTED_CHAN_UNAVAIL (44) when a channel is hung up due to an RTP timeout. So do the same when it happens with PJSIP for parity. Change-Id: I3546ebbde6460c22a27c9da1bf321711b5961ab8 2017-03-23 15:33 +0000 [552cf009c0] Kevin Harwell * Update for 13.15.0-rc1 2017-03-23 14:03 +0000 [f1b34e6eb4] Kevin Harwell * AMI: Updated version Updated the AMI version for the following reason (see CHANGES for more details): The 'PJSIPShowEndpoint' command's response event of 'IdentifyDetail' now contains a new optional parameter, 'MatchHeader'. Change-Id: I9aeac4decc89f9b464b3f026e97c7ef1acc79242 2017-03-23 12:07 +0000 [e6aeeabddf] Kevin Harwell * pjproject_bundled: raise timeout value used when downloading After configuring Asterisk with '--with-pjproject-bundled' the configure/build process attempts to download pjproject from its download site. Currently, a timeout of 10 seconds is used that will stop the download process if pjproject has not been fully downloaded in that time. For some systems this was not enough time and the process was timing out too early. This patch raises the download timeout value to '60'. Also, this patch fixes another bug where the DOWNLOAD_TIMEOUT variable was not being properly exported due to a naming error. DOWNLOAD_MAX_TIMEOUT is now properly renamed to DOWNLOAD_TIMEOUT. ASTERISK-26814 #close Change-Id: Ia56e4e8a3d39db76bc8a1852b2cf07ec10b39842 2017-03-22 20:33 +0000 [0939a19cff] Sean Bright * res_xmpp: Correct implementation of JABBER_STATUS & JabberStatus The documentation for JABBER_STATUS (and the deprecated JabberStatus app) indicate that a return value of 7 indicates that the specified buddy was not in the roster. It also indicates that you can specify a "bare" JID (one without a resource). Unfortunately the actual behavior does not match the documented behavior. Assuming that our roster includes the buddy online and available "valid@example.org/Valid" and does *not* include the buddy "invalid@example.org", the JABBER_STATUS() function returns the following before this patch: +------------------------------+------------+--------------------------+ | Buddy | Status | Result | +------------------------------+------------+--------------------------+ | valid@example.org | Online | 7 (Not in roster) | | valid@example.org/Valid | Online | 1 (Online) | | valid@example.org/Invalid | N/A | 7 (Not in roster) | | invalid@example.org | N/A | Error logged, no return | | invalid@example.org/Valid | N/A | Error logged, no return | +------------------------------+------------+--------------------------+ And after this patch: +------------------------------+------------+--------------------------+ | Buddy | Status | Result | +------------------------------+------------+--------------------------+ | valid@example.org | Online | 1 (Online) | | valid@example.org/Valid | Online | 1 (Online) | | valid@example.org/Invalid | N/A | 6 (Offline) | | invalid@example.org | N/A | 7 (Not in roster) | | invalid@example.org/Valid | N/A | 7 (Not in roster) | +------------------------------+------------+--------------------------+ This brings the behavior in line with the documentation. ASTERISK-23510 #close Reported by: Anthony Critelli Change-Id: I9c3241035363ef4a6bdc21fabfd8ffcd9ec657bf 2017-03-22 17:32 +0000 [a487f6fb97] Sean Bright * res_xmpp: Don't crash when trying to send a message without a connection If we never establish a connection to our Jabber server, iksemel never sets up its internal transport pointer, so attempting to send a message dereferences a NULL pointer and causes a crash. ASTERISK-21855 #close Reported by: Jeremy Kister Change-Id: I204a568894e4a53ab929783ecc594a000f04d79c 2017-03-22 15:40 +0000 [90fb1fca41] Sean Bright * res_xmpp: Include client name in connection related error messages ASTERISK-25622 #close Reported by: Sean Darcy Change-Id: I8472cb7bfb58d411a3cfbd482da98cae2d94d1e9 2017-03-21 12:32 +0000 [e196190f11] Sebastian Gutierrez * cdr: Allow setting of user field from 'h' extension The CDR code previously did not allow the user field to be set from the 'h' extension in the dialplan. This change removes that limitation and allows it to be set. ASTERISK-26818 Change-Id: I0fed8a79b5e408bac4e30542b8f33a61c5ed9aa6 2017-03-14 16:45 +0000 [398e5ec16c] Richard Begg * res_pjsip_session: Enable RFC3578 overlap dialing support. Support for RFC3578 overlap dialling (i.e. 484 Response to partially matched destinations) as currently provided by chan_sip is missing from res_pjsip. This patch adds a new endpoint attribute (allow_overlap) [defaults to yes] which when set to yes enables 484 responses to partial destination matches rather than the current 404. ASTERISK-26864 Change-Id: Iea444da3ee7c7d4f1fde1d01d138a3d7b0fe40f6 2017-03-21 06:59 +0000 [218f618095] Sean Bright * res_hep: Capture actual transport type in use Rather than hard-coding UDP, allow consumers of the HEP API to specify which protocol is in use. Update the PJSIP provider to pass in the current protocol type. ASTERISK-26850 #close Change-Id: I54bbb0a001cfe4c6a87ad4b6f2014af233349978 2017-03-21 09:57 +0000 [1c8b81a2a4] Sean Bright * Revert "app_queue: Handle the caller being redirected out of a queue bridge" This reverts commit 163e9e53dc7d84dd42721e733b7706c8147bdd27. Change-Id: Ief28479c77a298879dfe2c56be7ee92dc465da4b 2017-03-21 08:26 +0000 [b3cc20799b] Sean Bright * res_pjsip_messaging: Check URI type before dereferencing We aren't validating that the URI we just parsed is a SIP/SIPS one before trying to access the user, host, and port members of a possibly uninitialized structure. Also update the MessageSend documentation to indicate what 'from' formats are accepted. ASTERISK-26484 #close Reported by: Vinod Dharashive Change-Id: I476b5cc5f18a7713d0ee945374f2a1c164857d30 2017-03-13 15:21 +0000 [91c97b5da5] Joshua Elson * pjsip: prevent memory corruption on creation of xml bodies ASTERISK-26776 #close Change-Id: I884b6f4e8233a355d0be687ec78d41bc0e4d3fd2 2017-03-20 16:27 +0000 [7f34c11b6a] Sean Bright * bridge_softmix: Ignore non-voice frames from translator Some codecs - codec_speex specifically - take voice frames and return other types of frames, like CNG. If we subsequently treat those as voice frames, we'll run into trouble when destroying the frame because of the requirement that each voice frame have an associated format. ASTERISK-26880 #close Reported by: Kirsty Tyerman Change-Id: I43f8450c48fb276ad8b99db8512be82949c1ca7c 2017-03-14 23:49 +0000 [d5b480afca] Aaron An * audiohook.c: Lost RTP packets lead to out-of-sync MixMonitor. Fixed a bug in function "ast_audiohook_write_frame" that checked the variable other_factory_samples and only flushed the factories, so they would be in sync, when other_factory_samples > 0. When there is not any rtp incoming the variable other_factory_samples will be 0, and although the result of "our_factory_ms - other_factory_ms" may be very large, this led to the record file not syncing. ASTERISK-26875 #close Reported-by: Aaron An Tested-by: Aaron An Change-Id: Ia4d890fb8fc1636a7188502bab35f555685aea22 2017-03-18 12:30 +0000 [38cebc73a3] Sean Bright * thread safety: Don't use getprotobyname() POSIX does not require getprotobyname() to be thread safe and some implementations use static memory which causes issues when multiple threads are used. Further, our usage of it today is just to ultimately get IPPROTO_TCP for calls to setsockopt(). So instead we just use IPPROTO_TCP directly. Change-Id: I2e14e58674808f7ce99b2f5e900d0f90d0d8da48 2017-03-19 13:26 +0000 [265455bc2d] Sean Bright * res_rtp_asterisk: Pass correct data length to ast_rtcp_interpret We are currently passing in the capacity of the read buffer instead of the number of bytes that we actually read off the wire. Change-Id: I60465049727d955c7f9a5e529e6f2aaff04cda36 2017-03-14 09:27 +0000 [76afb9e18a] Robert Mordec * app_queue: Member stuck as pending after forwarding previous call from queue Queue member will get stuck in pending_members if queue calls a device that is different from the one observed for state changes. This patch removes members from pending_members as a result of channel stasis events such as blind or attended transfers and hangup. ASTERISK-26862 #close Change-Id: I8bf6df487b9bb35726c08049ff25cdad5e357727 2017-02-22 23:26 +0000 [60b372a883] Richard Mudgett * CHANNEL(callid): Give dialplan access to the callid. * Added CHANNEL(callid) to retrieve the call identifier log tag associated with the channel. Dialplan now has access to the call log search key associated with the channel so it can be saved in case there is a problem with the call. ASTERISK-26878 Change-Id: I2c97ebd928b6f3c5bc80c5729e4d3c07f453049f 2017-03-16 08:42 +0000 [9a57b24e17] Sean Bright * app_queue: Fix locking behavior in stasis message handlers The queue_stasis_data structure contains various mutable fields that require appropriate locking. Specifically, the 'dying,' 'member_uniqueid,' and 'caller_uniqueid' fields need to be locked when read from or written to. Change-Id: I246b7dbff8447acc957a1299f6ad0ebd0fd39088 2017-03-07 19:28 +0000 [8721d0bf1b] Sean Bright * chan_sip: Add rtcp-mux support ASTERISK-26846 #close Change-Id: I541a1602ff55ab73684e9f8002edb9e0e745d639 2017-03-16 16:50 +0000 [792171ea9e] Richard Mudgett * app_confbridge: Fix ConfbridgeTalking AMI event description. Thanks to Chris Howard for pointing this out on the wiki. Change-Id: I18e56de09a70e736b5d04719d45ef29cf0636705 2017-03-16 16:37 +0000 [047fb7f11e] Richard Mudgett * res_pjsip_asterisk.c: Fix compile error if libsrtp is not installed. struct ast_rtcp does not define the dtls member if SRTP is not enabled. ASTERISK-26732 Change-Id: Id15ea212e04490e012f2cf4a56818b4dd948875e 2017-03-16 15:45 +0000 [a75f02c089] Richard Mudgett * res_pjsip_sdp_rtp.c: Fix cut-n-paste error We were inadvertenly referencing the cos_video option to determine if we should set the tos_audio and cos_audio value on the RTP instance. Change-Id: Ia7964f486801d39dc6f5dae570baff079e1595b0 2017-03-16 10:39 +0000 [776ffd7724] Matt Jordan * res/res_pjsip_session: Only check localnet if it is defined If local_net is not defined on a transport, transport_state->localnet will be NULL. ast_apply_ha will, be default, return AST_SENSE_ALLOW in this case, causing the external_media_address, if set, to be skipped. This patch causes us to only check if we are sending within a network if local_net is defined. ASTERISK-26879 #close Change-Id: Ib661c31a954cabc9c99f1f25c9c9a5c5b82cbbfb 2017-03-14 16:22 +0000 [139bc3495f] Richard Begg * res_pjsip_sdp_rtp: RTP instance does not use same IP as explicit transport Currently a wildcard address is used for the local RTP socket, which will not always result in the same address as used by the SIP socket (e.g. if explicit transport addresses are configured). Use the transport's host address when binding new local RTP sockets if available. ASTERISK-26851 Change-Id: I098c29c9d1f79a4f970d72ba894874ac75954f1a 2017-03-16 09:07 +0000 [7ea7797e12] Joshua Colp * res_rtp_asterisk: Fix crash when RTCP is not present when DTLS is stopped. This change removes an assumption that when DTLS is stopped an RTCP session will be present on the RTP session. This is not always the case. ASTERISK-26732 Change-Id: Ib9f7c09ce0b005efe362dbcc8795202b18f94611 2017-03-07 08:33 +0000 [9b756662a8] George Joseph * res_pjsip: Symmetric transports A new transport parameter 'symmetric_transport' has been added. When a request from a dynamic contact comes in on a transport with this option set to 'yes', the transport name will be saved and used for subsequent outgoing requests like OPTIONS, NOTIFY and INVITE. It's saved as a contact uri parameter named 'x-ast-txp' and will display with the contact uri in CLI, AMI, and ARI output. On the outgoing request, if a transport wasn't explicitly set on the endpoint AND the request URI is not a hostname, the saved transport will be used and the 'x-ast-txp' parameter stripped from the outgoing packet. * config_transport was modified to accept and store the new parameter. * config_transport/transport_apply was updated to store the transport name in the pjsip_transport->info field using the pjsip_transport->pool on UDP transports. * A 'multihomed_on_rx_message' function was added to pjsip_message_ip_updater that, for incoming requests, retrieves the transport name from pjsip_transport->info and retrieves the transport. If transport->symmetric_transport is set, an 'x-ast-txp' uri parameter containing the transport name is added to the incoming Contact header. * An 'ast_sip_get_transport_name' function was added to res_pjsip. It takes an ast_sip_endpoint and a pjsip_sip_uri and returns a transport name if endpoint->transport is set or if there's an 'x-ast-txp' parameter on the uri and the uri host is an ipv4 or ipv6 address. Otherwise it returns NULL. * An 'ast_sip_dlg_set_transport' function was added to res_pjsip which takes an ast_sip_endpoint, a pjsip_dialog, and an optional pjsip_tpselector. It calls ast_sip_get_transport_name() and if a non-NULL is returned, sets the selector and sets the transport on the dialog. If a selector was passed in, it's updated. * res_pjsip/ast_sip_create_dialog_uac and ast_sip_create_dialog_uas were modified to call ast_sip_dlg_set_transport() instead of their original logic. * res_pjsip/create_out_of_dialog_request was modified to call ast_sip_get_transport_name() and pjsip_tx_data_set_transport() instead of its original logic. * Existing transport logic was removed from endpt_send_request since that can only be called after a create_out_of_dialog_request. * res_pjsip/ast_sip_create_rdata was converted to a wrapper around a new 'ast_sip_create_rdata_with_contact' function which allows a contact_uri to be specified in addition to the existing parameters. (See below) * res_pjsip_pubsub/internal_pjsip_evsub_send_request was eliminated since all it did was transport selection and that is now done in ast_sip_create_dialog_uac and ast_sip_create_dialog_uas. * 'contact_uri' was added to subscription_persistence. This was necessary because although the parsed rdata contact header has the x-ast-txp parameter added (if appropriate), subscription_persistence_update stores the raw packet which doesn't have it. subscription_persistence_recreate was then updated to call ast_sip_create_rdata_with_contact with the persisted contact_uri so the recreated subscription has the correct transport info to send the NOTIFYs. * res_pjsip_session/internal_pjsip_inv_send_msg was eliminated since all it did was transport selection and that is now done in ast_sip_create_dialog_uac. * pjsip_message_ip_updater/multihomed_on_tx_message was updated to remove all traces of the x-ast-txp parameter from the outgoing headers. NOTE: This change does NOT modify the behavior of permanent contacts specified on an aor. To do so would require that the permanent contact's contact uri be updated with the x-ast-txp parameter and the aor sorcery object updated. If we need to persue this, we need to think about cloning permanent contacts into the same store as the dynamic ones on an aor load so they can be updated without disturbing the originally configured value. You CAN add the x-ast-txp parameter to a permanent contact's uri but it would be much simpler to just set endpoint->transport. Change-Id: I4ee1f51473da32ca54b877cd158523efcef9655f 2017-03-15 13:24 +0000 [adad6020be] Richard Mudgett * autochan/mixmonitor/chanspy: Fix unsafe channel locking and references. Dereferencing struct ast_autochan.chan without first calling ast_autochan_channel_lock() is unsafe because the pointer could change at any time due to a masquerade. Unfortunately, ast_autochan_channel_lock() itself uses struct ast_autochan.chan unsafely and can result in a deadlock if the original channel happens to get destroyed after a masquerade in addition to the pointer getting changed. The problem is more likely to happen with v11 and earlier because masquerades are used to optimize out local channels on those versions. However, it could still happen on newer versions if the channel is executing a dialplan application when the channel is transferred or redirected. In this situation a masquerade still must be used. * Added a lock to struct ast_autochan to safely be able to use ast_autochan.chan while trying to get the channel lock in ast_autochan_channel_lock(). The locking order is the channel lock then the autochan lock. Locking in the other direction requires deadlock avoidance. * Fix unsafe ast_autochan.chan usages in app_mixmonitor.c. * Fix unsafe ast_autochan.chan usages in app_chanspy.c. * app_chanspy.c: Removed unused autochan parameter from next_channel(). ASTERISK-26867 Change-Id: Id29dd22bc0f369b44e23ca423d2f3657187cc592 2017-03-07 14:13 +0000 [7bc69753bc] Mark Michelson * Add rtcp-mux support This commit adds support for RFC 5761: Multiplexing RTP Data and Control Packets on a Single Port. Specifically, it enables the feature when using chan_pjsip. A new option, "rtcp_mux" has been added to endpoint configuration in pjsip.conf. If set, then Asterisk will attempt to use rtcp-mux with whatever it communicates with. Asterisk follows the rules set forth in RFC 5761 with regards to falling back to standard RTCP behavior if the far end does not indicate support for rtcp-mux. The lion's share of the changes in this commit are in res_rtp_asterisk.c. This is because it was pretty much hard wired to have an RTP and an RTCP transport. The strategy used here is that when rtcp-mux is enabled, the current RTCP transport and its trappings (such as DTLS SSL session) are freed, and the RTCP session instead just mooches off the RTP session. This leads to a lot of specialized if statements throughout. ASTERISK-26732 #close Reported by Dan Jenkins Change-Id: If46a93ba1282418d2803e3fd7869374da8b77ab5 2017-03-09 11:05 +0000 [163e9e53dc] Sean Bright * app_queue: Handle the caller being redirected out of a queue bridge A caller can leave the Queue() application after being bridged with a member in a few ways: * Caller or member hangup * Caller is transferred somewhere else (blind or atx) * Caller is externally redirected elsewhere The first 2 scenarios are currently handled by subscribing to stasis messages, but the 3rd is not explicitly covered. If a caller is redirected away from the Queue() application, the member who was last bridged with that caller will remain in an "In use" state until the caller hangs up. This patch adds handling of the caller leaving the queue via redirection. We monitor the caller-member bridge, and if the caller is the one that leaves, we treat it the same as we would a caller hangup. ASTERISK-26400 #close Reported by: Etienne Lessard Change-Id: Iba160907770de5a6c9efeffc9df5a13e9ea75334 2017-03-15 08:44 +0000 [7612601964] Joshua Colp * res_pjsip_endpoint_identifier_ip: Don't output error if no header_match. This change ensures that if no header_match option is set on an identify an error message is not output stating the option is set to an invalid value. ASTERISK-26863 Change-Id: I239bc6d2319dd3da24ba96a38d4d6e9b5526d62a 2017-03-14 08:49 +0000 [48447313b6] Torrey Searle * res/res_pjsip_refer: call xfer w/o extension When transfering to a URI without an extension, ensure that the s extension of the dialplan is entered ASTERISK-26869 #close Change-Id: I07403df66cf93f09e00a40ab5b41bfc6f72b1525 2017-03-14 16:16 +0000 [9fd9b39e8b] Richard Mudgett * pbx.c: Fix crash from malformed exten pattern. Forgetting to indicate an exten is a pattern can cause a crash if the "pattern" has a character set range. e.g., "9999[3-5]" The crash is due to a buffer overwrite because the '-' exten eye-candy wasn't removed as expected and overran the allocated space. The buffer overwrite is fixed two ways in this patch. 1) Fix ext_strncpy() to distinguish between pattern and non-pattern extens. Now '-' characters are removed when they are eye-candy and not when they are part of a pattern character set. Since the function is private to pbx.c, the return value now returns the number of bytes written to the destination buffer instead of the strlen() of the final buffer so the callers that care don't need to add one. 2) Fix callers to ext_strncpy() to supply the correct available buffer size of the destination buffer. ASTERISK-26668 Change-Id: I555d97411140e47e0522684062d174fbe32aa84a 2017-03-14 16:51 +0000 [5389666d6f] Richard Begg * chan_iax2: Reload of iax peer results in loss of host address/port When using a non-dynamic peer address, build_peer() invalidates the peer address structure by setting the address family to unspecified. However, if dnsmgr is enabled, the subsequent call to ast_dnsmgr_lookup() will not amend the peer address if the cache is still valid, resulting in peer connectivity failures. To fix this, we call ast_dnsmgr_refresh() instead. ASTERISK-26865 Change-Id: Id8a89a2f771ebbaf32255a35fe596a6dcb97a082 2017-03-14 15:12 +0000 [658d59c683] Matt Jordan * configure: Don't use the progress bar with curl when downloading to stdout In some scenarios, such as when there may not be a terminal (such as inside a Docker container), curl will apparently direct the progress bar to stdout. This can cause extra data to be appended to a file curl'd down to stdout, resulting in md5 verification failures. This patch removes the progress bar, and tells curl to download the file silently. ASTERISK-26872 #close Change-Id: Ie860b020f627d4372b3e7ce9453de5faafeebe6c 2017-03-14 07:50 +0000 [b3c2c996f1] Matt Jordan * res_pjsip_endpoint_identifier_ip: Add an option to match requests by header This patch adds a new features to the endpoint identifier module, 'match_header'. When set, inbound requests are matched by a provided SIP header: value pair. This option works in conjunction with the existing 'match' configuration option, such that if any 'match*' attribute matches an inbound request, the request is associated with the specified endpoint. Since this module now identifies by more than just IP address, appropriate renaming of the module and/or variables can be done in a non-release branch. ASTERISK-26863 #close Change-Id: Icfc14835c962f92e35e67bbdb235cf0589de5453 (cherry picked from commit 30f52d79d7fc9ab0b628bef2b61ea515413795a2) 2017-03-14 09:55 +0000 [51985565ef] Matt Jordan * configs/samples/hep.conf.sample: Clarify how the HEP stack works This patch updates the documenation in hep.conf.sample to better specify how the various HEP modules interact. ASTERISK-26717 #close Change-Id: I337fb742a89e3ec5edc7fc7a7a0295218d841124 2017-03-14 09:59 +0000 [f9b791debe] Matt Jordan * funcs/func_devstate: Remove new line in Device field of during module load During module loading of func_devstate, Asterisk emits the current device state of all Custom device states currently stored in the AstDB. This was erroneously including a new line character ('\n') to the end of the device state, causing two new lines to be emitted in DeviceStateChange AMI events. Note that this only happened for those device state changes that occurred during startup. Regular device state changes for Custom device states are handled elsewhere, and did not have the newline. ASTERISK-26643 #close Reported by: Roman Bedros Tested by: Matt Jordan patches: ami_devstate.diff uploaded by Roman Bedros (License 6842) Change-Id: I1f4c02fc79c448d43bf725f5039c83d9611d7d93 2017-03-14 09:37 +0000 [216e28aa95] Matt Jordan * main/stasis_cache: Demote the ERROR message when removing a nonexistent item This patch demotes the ERROR message that is displayed when a nonexistent item is removed from the Stasis cache. The genesis of this demotion is due to chan_sip's realtime peers and their interaction with Asterisk's core ast_endpoint code, but ostensibly it could happen from other channel drivers as well. Since Mark Michelson already did an excellent job of explaining on this issue, it is quoted here for posterity: "Internally, when a realtime peer is retrieved, Asterisk creates an ast_endpoint structure. When that peer is destroyed, the ast_endpoint is destroyed as well. Part of the destruction of the ast_endpoint involves clearing the Stasis cache of all information about that endpoint. The problem here is that the act of creating the ast_endpoint is not enough to actually put any information in the Stasis cache. Instead, something has to happen, such as a state change, in order for the Stasis cache to have any information about that endpoint. When a device registers, chan_sip creates an ast_endpoint structure, processes the REGISTER, and then destroys the ast_endpoint. When the ast_endpoint is destroyed, there is nothing to destroy in the Stasis cache, so an error message is emitted. When you use rtcachefriends, ast_endpoint structures persist for the lifetime of the module and so you do not see this error message." ASTERISK-25237 #close Change-Id: I53cebc6b4a897a1ab9564182b75c177780feff70 2017-03-12 09:21 +0000 [c8d1b915d7] Joshua Colp * chan_pjsip: Don't assume a session will have a channel. When querying for PJSIP specific information using the dialplan function CHANNEL() it is possible that the underlying session will no longer have a channel associated with it. This is most likely to occur when the RTCP HEP module attempts to get the channel name. If this happens then a crash will occur. This change just adds a check that the channel exists on the session before querying it. ASTERISK-26857 Change-Id: I113479cffff6ae64cf8ed089e9e1565223426f01 2017-03-13 10:45 +0000 [6d1eb880c2] George Joseph * menuselect: Add a new 'options' support type The Binaural Rendering patches in the master branch required menuselect to be updated with a new support type called 'option'. This allows binaural rendering to be turned on or off when bridge_softmix is built. This patch backports the 'option' functionality to the 13 and 14 branches. Here's what it looks like in menuselect: [*] bridge_simple [*] bridge_softmix --- Module Options --- [ ] binaural_rendering_in_bridge_softmix To create an option for a module, you can create (or update) the menuselect-tree xml snippet in the directory where the module resides and add a member element with an 'option' support_level. Example (abbreviated) from bridges/bridges.xml: option bridge_softmix fftw3 no The 'name' will be added or removed from the MENUSELECT_ make variable following the standard module "missing means yes" rules. Example (abbreviated) from bridges/Makefile: ifeq ($(findstring binaural_rendering,$(MENUSELECT_BRIDGES)),) bridge_softmix.o: _ASTCFLAGS+=-DBINAURAL_RENDERING bridge_softmix.so: LIBS+=$(FFTW3_LIB) endif Change-Id: I66d23755ed6e81f8d439cad410f2ffa7c30f25ad 2017-03-10 20:29 +0000 [523de8eb8e] George Joseph * pjproject_bundled: Reduce the need for rebuilds Bundled pjproject should now only rebuild if one of the menuselect "Compiler Flags" options changes. Change-Id: If114a2e16b9e77af371a600d6a5e197bbf28fe43 2017-03-07 08:12 +0000 [d3ef833b3b] Jean Aunis * chan_sip: Call not cancelled after receiving a 422 response When receiving a 422 response, the invitestate variable must be reset to INV_CALLING. ASTERISK-26841 Change-Id: Ia0502d6b02192664cefa4e75bafdd2645ce56099 2017-03-05 15:26 +0000 [67c989ce78] Daniel Journo * pjsip/cli_commands: pjsip show channelstats shows wrong codec * cli_commands.c Fixed CLI output ASTERISK-26822 #close Change-Id: I3889ef6a8f6738fc312fab42db5efacd6e452b01 2017-03-07 07:37 +0000 [2a85888262] Joshua Colp * res_pjsip_transport_websocket: Add support for IPv6. This change adds a PJSIP patch (which has been contributed upstream) to allow the registration of IPv6 transport types. Using this the res_pjsip_transport_websocket module now registers an IPv6 Websocket transport and uses it for the corresponding traffic. ASTERISK-26685 Change-Id: Id1f9126f995b31dc38db8fdb58afd289b4ad1647 2017-03-08 08:16 +0000 [bc6eeab822] Daniel Journo * app_voicemail: Cannot set fromstring on a per-mailbox basis * apps/app_voicemail.c fromstring field added to mailbox which will override the global fromstring if set. ASTERISK-24562 #close Change-Id: I5e90e3a1ec2b2d5340b49a0db825e4bbb158b2fe 2017-03-06 15:54 +0000 [d9972423d1] Daniel Journo * Saynumber is trying to get "and" from "digits/" subfolder * say.c Changed 'digits/and' to 'vm-and' for en_GB ASTERISK-26598 #close Change-Id: If1b713e5daea6f952b339f139178d292a6c4fcfe 2017-03-06 13:15 +0000 [77901a58ca] Sean Bright * pbx_spool: Gracefully handle long lines in call files Per the linked issue, we aren't checking the buffer filled by fgets() to determine if it contains a newline, so we will fail to correctly parse the trailing portion of a long line. This patch increases the buffer size from 256 to 1024, and skips any line that exceeds that length, logging a warning in the process. ASTERISK-17067 #close Reported by: Dave Olszewski Change-Id: I51bcf270c1b4347ba05b43f18dc2094c76f5d7b0 2017-03-02 21:27 +0000 [4271c700f7] Richard Mudgett * core: Cleanup ast_get_hint() usage. * manager.c:manager_state_cb() Fix potential use of uninitialized hint[] if a hint does not exist for the requested extension. Ran into this when developing a testsuite test. The AMI event ExtensionStatus came out with the hint header value containing garbage. The AMI event PresenceStatus also had the same issue. * manager.c:action_extensionstate() no need to completely initialize the hint[]. Only initialize the first element. * pbx.c:ast_add_hint() Remove unnecessary assignment. * chan_sip.c: Eliminate an unneeded hint[] local variable. We only care about the return value of ast_get_hint() there. Change-Id: Ia9a8786f01f93f1f917200f0a50bead0319af97b 2017-02-16 04:22 +0000 [e510595c86] Jørgen H * res_pjsip WebRTC/websockets: Fix usage of WS vs WSS. According to the RFC[1] WSS should only be used in the Via header for secure Websockets. * Use WSS in Via for secure transport. * Only register one transport with the WS name because it would be ambiguous. Outgoing requests may try to find the transport by name and pjproject only finds the first one registered. This may mess up unsecure websockets but the impact should be minimal. Firefox and Chrome do not support anything other than secure websockets anymore. * Added and updated some debug messages concerning websockets. * security_events.c: Relax case restriction when determining security transport type. * The res_pjsip_nat module has been updated to not touch the transport on Websocket originating messages. [1] https://tools.ietf.org/html/rfc7118 ASTERISK-26796 #close Change-Id: Ie3a0fb1a41101a4c1e49d875a8aa87b189e7ab12 2017-03-01 07:23 +0000 [76971d4c4a] Sean Bright * res_config_pgsql: Make 'require' return consistent with other backends res_config_pgsql should match the behavior of other realtime backend drivers so that queue_log can disable adaptive logging. ASTERISK-25628 #close Reported by: Dmitry Wagin Change-Id: Ic1fb1600c7ce10fdfb1bcdc43c5576b7e0014372 2017-02-28 09:41 +0000 [fa8f6c2fc4] Sean Bright * res_config_pgsql: Release table locks where appropriate The find_table() functions NULL or a locked table pointer. We are not consistently calling release_table() in failure paths. Change-Id: I6f665b455799c84b036e5b34904b82b05eab9544 2017-02-28 05:41 +0000 [5b34b751a0] Tzafrir Cohen * pjsip.conf.sample: user_agent: not a specific version Use the description of useragent from sip.conf here. ASTERISK-26825 #close Change-Id: I5b33a4aaa0ae1d793289d05e3bc09521affbf755 2017-02-27 20:07 +0000 [8e6ecdade2] George Joseph * res_pjsip_pubsub: Remove unneeded endpoint unref When a subscription was being recreated and the endpoint wasn't found, we were trying to unref the endpoint. This was causing FRACKs. Removed the unref. ASTERISK-26823 #close Change-Id: If86d2aecff8fe853c7f38a1bfde721fcef3cd164 2017-02-16 04:16 +0000 [0595c31da7] Jørgen H * res_pjsip: Fix crash when contact has no status This change fixes an assumption in res_pjsip that a contact will always have a status. There is a race condition where this is not true and would crash. The status will now be unknown when this situation occurs. ASTERISK-26623 #close Change-Id: Id52d3ca4d788562d236da49990a319118f8d22b5 2017-02-21 18:06 +0000 [c07bcca87e] George Joseph * res_pjsip_outbound_registration: Subscribe to network change events Outbound registration now subscribes to network change events published by res_stun_monitor and refreshes all registrations when an event happens. The 'pjsip send (un)register' CLI commands were updated to accept '*all' as an argument to operate on all registrations. The 'PJSIP(Un)Register' AMI commands were also updated to accept '*all'. ASTERISK-26808 #close Change-Id: Iad58a9e0aa5d340477fca200bf293187a6ca5a25 2017-02-26 10:09 +0000 [d91f61f0b5] Vitezslav Novy * chan_sip: Allow DTLS to be disabled when reloading. This change fixes a problem where removing the DTLS configuration options and reloading would not disable DTLS. This occurred because the DTLS configuration was not reset to an unconfigured state on reload. ASTERISK-26313 Change-Id: I10952709cc4a7727fb50534b042bce9d64894b39 2017-02-27 12:25 +0000 [3d2c119778] George Joseph * build: Warn if asterisk is installed in both 32 and 64 bit sys dirs ... and clean them both up on uninstall. We've fixed the issue where 'make install' was installing to /usr/lib on 64-bit systems that use /usr/lib64. Now we need to clean up the remnants in /usr/lib. * 'make install' now prints a warning if DESTDIR/ASTLIBDIR contains 'lib64' and libasterisk* shared libraries or modules are also found in DESTDIR/ASTLIBDIR with 'lib64' transformed to 'lib'. * 'make uninstall' ALWAYS cleans up both DESTDIR/ASTLIBDIR and DESTDIR/ASTLIBDIR with 'lib64' transformed to 'lib'. ASTERISK-26705 Change-Id: I6edddeb3c07a51e7c7ba7cac3c05e4bf3ec3f01f 2017-02-27 07:02 +0000 [eac818801b] Joshua Colp * bridge_native_rtp: Handle case where channel joins already suspended. The bridge_native_rtp module did not properly handle the case where a smart bridge operation occurs while a channel is suspended. In this scenario the module would incorrectly set up local or remote RTP bridging despite the media having to flow through Asterisk. The remote endpoint would see two media streams and experience wonky audio. The module has been changed so that it ensures both channels are not suspended when performing the native RTP bridging and this requirement has been documented in the bridge technology. ASTERISK-26781 Change-Id: Id4022d73ace837d4a293106445e3ade10dbc7c7c 2017-02-24 11:49 +0000 [d49af061bc] Joshua Colp * config: Improve documentation and behavior of outbound_proxy option. This change updates the documentation for the outbound_proxy option to ensure it is consistently stated that a full SIP URI must be provided for the option. The res_pjsip_outbound_registration module has also been changed so that the provided outbound_proxy value is checked to ensure it is a URI and if not an error is output stating so. ASTERISK-26782 Change-Id: I6c239a32274846fd44e65b44ad9bf6373479b593 2017-02-09 18:05 +0000 [9c05ddbddd] George Joseph * pjproject_bundled: Update for pjproject 2.6 * Removed all 2.5.5 functional patches. * Updated usages of pj_release_pool to be "safe". * Updated configure options to disable webrtc. * Updated config_site.h to disable webrtc in pjmedia. * Added Richard Mudgett's recent resolver patches. Change-Id: Ib400cc4dfca68b3d07ce14d314e829bfddc252c7 2017-02-23 15:49 +0000 [bee55aaf2c] George Joseph * build: Execute ldconfig to build cache. (take two) On some platforms a multiarch approach is used for libraries. The build system does not take this into account and still places libraries into the lib directory if no --libdir is specified to configure. On initial startup this results in libasteriskssl.so not being found, as it is not in the multiarch lib directory. To make matters worse, options were being passed to ldconfig on both Linux and FreeBSD that actually prevented the rebuild of the cache. * Fedora has a /usr/share/config.site that automatically tells autoconf to use /usr/lib64 but CentOS does not. This logic was copied to configure.ac and modified so systems like Ubuntu, which still use /usr/lib for 64-bit systems, aren't affected. Now that we have them in the correct directory... In order for the system loader to find libasteriskssl and libasteriskpj, one of 3 things has to happen... - The linker cache must be rebuilt including the directory where the libasterisk* libraries were installed. Only root can rebuild the cache. This was busted. - We have to link the asterisk binary with an rpath pointing to the directrory where the libasterisk* libraries were installed. This makes things very complicated and will happen over the collective dead bodies of everyone who's had to package a distribution with an rpath. - Finally, you can start asterisk with LD_LIBRARY_PATH set to the directrory where the libasterisk* libraries were installed. There are no other options. So... * The invokation of ldconfig has been moved from main/Makefile to ASTTOPDIR/Makefile, the options have been removed, and DESTDIR/ASTLIBDIR appended. If you aren't root, you will be warned after the "Asterisk Installation Compete" banner that you must re-run 'make install' as root, manually run 'ldconfig DESTDIR/ASTLIBDIR' as root, or run asterisk with LD_LIBRARY_PATH. ASTERISK-26705 Change-Id: I2a64b7c33a7d3e9bde20f47e3d3ab771977af982 2017-02-23 14:48 +0000 [da0cadd100] Sean Bright * res_config_pgsql: Fix thread safety problems * A missing AST_LIST_UNLOCK() in find_table() * The ESCAPE_STRING() macro uses pgsqlConn under the hood and we were not consistently locking before calling it. * There were a handful of other places where pgsqlConn was accessed directly without appropriate locking. Change-Id: Iea63f0728f76985a01e95b9912c3c5c6065836ed 2017-02-22 08:53 +0000 [f1963c5b8d] Sean Bright * res_config_ldap: Various code improvements The initial motivation for this patch was to properly handle memory allocation failures - we weren't checking the return values from the various LDAP library allocation functions. In the process, because update_ldap() and update2_ldap() were substantially the same code, they've been consolidated. Change-Id: Iebcfe404177cc6860ee5087976fe97812221b822 2017-02-22 13:08 +0000 [1ec796ce18] Michael L. Young * build_tools: Fix download_externals to allow the use of curl or wget Not sure if this is really a bug versus an improvement. I can see it being viewed as a bug though by some. The current build_tools/download_externals file depends on wget in order to download external modules. The current build system is able to discover which tool to use for fetching remote files - either wget or curl. This patch takes advantage of this capability by modifying the two calls to the wget binary to instead use what was discovered by the build system. ASTERISK-26812 #close Change-Id: If9411a2554f009274d377445613ae91192d948a1 2017-02-22 11:13 +0000 [5c9c097d17] Joshua Colp * Revert "build: Execute ldconfig to build cache." This reverts commit d90430953c508670a67de68de400fef44f5e9fba. Change-Id: I758fe7ea0408f83a6df8e1774310d69f482700f6 2017-02-21 10:47 +0000 [ca6d001144] Sean Bright * pbx_realtime: Prevent premature extension matching The patterns provided by pbx_realtime were checked in the order in which they were returned from the realtime backend. If there was overlap between multiple patterns, the first one to correctly match was chosen even though it may not have been the best match. We now sort the patterns descending by their length and compare in that order. There may be cases where this still results in a sub-optimal match, but this patch should improve the overall behavior. ASTERISK-18271 #close Reported by: Charlie Smurthwaite Change-Id: I56d9ac15810eb1775966b669c3028e32cc7bd809 2017-02-21 15:09 +0000 [0654bf637c] Sean Bright * pbx_dundi: DUNDi weight parameter not processed correctly The DUNDi weight field is not always converted from network byte order to host byte order. This can result in incorrect weight values and incorrect selection of DUNDi destinations. ASTERISK-18731 #close Reported by: Peter Racz Patches: dundi_weight.patch (license #6290) patch uploaded by Peter Racz Change-Id: Iba3e1a700ff539db57211a7bbc26f7b22ea9a1be 2017-02-21 10:47 +0000 [d5522de597] Sean Bright * realtime: Fix ast_load_realtime_multientry handling ast_load_realtime_multientry() returns an ast_config structure whose ast_categorys are keyed with the empty strings. Several modules were giving semantic meaning to the category names causing problems at runtime. * app_directory: Treated the category name as the mailbox name, and would fail to direct calls to the appropriate extension after an entry was chosen. * app_queue: Queues, queue members, and queue rules were all affected and needed to be updated. * pbx_realtime: Pattern matching would never succeed because the extension entered by the user was always compared to the empty string. Change-Id: Ie7e44986344b0b76ea8f6ddb5879f5040c6ca8a7 2017-02-21 08:56 +0000 [5eb7875243] Sean Bright * realtime: Centralize some common realtime backend code All of the realtime backends create artificial ast_categorys to pass back into the core as query results. These categories have no filename or line number information associated with them and the backends differ slightly on how they create them. So create a couple helper macros to help make things more consistent. Also updated the call sites to remove redundant error messages about memory allocation failure. Note that res_config_ldap sets the category filename to the 'table name' but that is not read by anything in the core, so I've dropped it. Change-Id: I3a1fd91e0c807dea1ce3b643b0a6fe5be9002897 2017-02-16 10:30 +0000 [d90430953c] Joshua Colp * build: Execute ldconfig to build cache. On some platforms a multiarch approach is used for libraries. The build system does not take this into account and still places libraries into the lib directory if no --libdir is specified to configure. On initial startup this results in libasteriskssl.so not being found, as it is not in the multiarch lib directory. This change does the minimally invasive thing and executes ldconfig so that the libraries in the lib directory are found and their location cached. By doing so Asterisk starts up fine. If DESTDIR is specified, however, the old logic is executed as the install process may not have permission to alter the ldconfig cache. ASTERISK-26705 Change-Id: If4eca46ac510c6fea5568256280ffdb3888d7bb4 2017-01-08 20:32 +0000 [3b606093d3] Richard Mudgett * res_pjsip_authenticator_digest.c: Fix sorcery's immutable contract violation. The inbound authentication object is supposed to be immutable when it is stored in sorcery. However, the immutable property is violated if the authentication object does not have a realm set. The immutable contract violation has a different effect depending upon what sorcery back end is used. If it is the config file back end you would get the same object back until res_pjsip is reloaded. If it is the real-time or AstDB back end you would get a new object on each query. If it is cached you would get the same object back until it is refreshed from the database. Once an inbound authentication object has its realm set it may or may not get updated again if the default_realm changes. If the same authentication object is used for inbound and outbound authentication then the immutable violation can make it very hard to determine why the outbound authentication now fails. The only diagnostic message is a complaint about no realms matching when it had worked earlier. It fails because of the difference in behaviour for an empty realm setting between inbound and outbound authentication objects. * Fixed the sorcery object immutable violation by creating a new object and setting the default_realm on it instead. The new object is a shallow copy for speed. * The auth_store thread storage no longer holds an auth ref. It interferes with the shallow copy and never needed a ref anyway. ASTERISK-26799 #close Change-Id: I2328a52f61b78ed5fbba38180b7f183ee7e08956 2017-02-04 20:17 +0000 [6208962b00] Richard Mudgett * res_pjsip: Update artificial auth whenever default_realm changes. There was code attempting to update the artificial authentication object whenever the default_realm changed. However, once the artificial authentication object was created it would never get updated. The artificial authentication object would require a system restart for a change to the default_realm to take effect. ASTERISK-26799 Change-Id: Id59036e9529c2d3ed728af2ed904dc36e7094802 2017-01-01 08:02 +0000 [9f11da85a2] Richard Mudgett * res_pjsip: Update authentication realm documentation. Using the same auth section for inbound and outbound authentication is not recommended. There is a difference in meaning for an empty realm setting between inbound and outbound authentication uses. An empty inbound auth realm represents the global section's default_realm value when the authentication object is used to challenge an incoming request. An empty outgoing auth realm is treated as a don't care wildcard when the authentication object is used to respond to an incoming authentication challenge. ASTERISK-26799 Change-Id: Id3952f7cfa1b6683b9954f2c5d2352d2f11059ce 2017-02-13 17:11 +0000 [473813311b] Richard Mudgett * pjproject: Fixes to resolve DNS SRV crashes. * Re #1945 (misc): Don't trigger SRV complete callback when there is a parse error. * srv_resolver.c: Don't try to send query if already considered resolved. ** In resolve_hostnames() don't try to resolve a query that is already considered resolved. ** In resolve_hostnames() fix DNS typo in comments. ** In build_server_entries() move a common expression assigning to cnt earlier. * sip_transport.c: Fix tdata object name to actually contain the pointer. It helps if the logs referencing a tdata object buffer actually have a name that includes the correct pointer as part of the name. Also since the tdata has its own pool it helps if any logs referencing the pool have the same name as the tdata object. This change brings tdata logging in line with how tsx objects are named. ASTERISK-26669 #close ASTERISK-26738 #close Change-Id: I56af2ded25476b3e870ca586ee69ed6954ef75af 2017-02-06 14:26 +0000 [d58fdae811] Richard Mudgett * pjsip_distributor.c: Update some debug messages to get transaction name. * Removed overloaded unmatched response ignore. We obviously sent the request so we shouldn't ignore it because it isn't new work. ASTERISK-26669 ASTERISK-26738 Change-Id: I55fb5cadc83a8e6699b347c6dc7fa32c5a617d37 2017-02-04 16:00 +0000 [eb9ae4f7cb] Richard Mudgett * res_pjsip: Record the serializer earlier on the tdata. When PJPROJECT needs to do a DNS resolution and there is not a cached entry available, the SIP request message goes out on the PJSIP monitor thread instead of the original serializer thread. Thus when the response comes back it does not get processed by the original sending serializer. This patch records the serializer on tdata before passing a request message to PJPROJECT where it can in Asterisk code. There are several places in PJPROJECT for outbound registration and publishing support that would need to record the serializer. Unfortunately, without replacing the PJPROJECT DNS resolver as was done in v14 we cannot fix those without modifying PJPROJECT. Even if we backported the DNS resolver from v14, the outbound registration refresh timer does not go out on a serializer thread but the PJSIP monitor thread. Fortunately, Asterisk's outbound publish support doesn't use the auto refresh timer that would also not go out under the serializer thread. This patch is v13 only. ASTERISK-26669 ASTERISK-26738 Change-Id: I9997b9ed6dbcebd2c37d6a67dc6dcee9c78914a4 2017-02-20 13:38 +0000 [57f19d6efb] Richard Mudgett * pjproject: Increase SENDER_WIDTH column size for 64-bit system logs. ASTERISK-26669 ASTERISK-26738 Change-Id: Ibae6fc8cae69a1f04df0c577c4c11200499d6fe0 2017-02-20 06:28 +0000 [47daca8a2b] Sean Bright * app_voicemail: vm_authenticate accesses uninitialized memory vm_authenticate doesn't always set the passed ast_vm_user argument, so we initialize to 0 before passing it in. ASTERISK-25893 #close Reported by: Filip Jenicek Change-Id: Ia3cc0128f93d352ed9add8d5c2f0f7232c2cbe4a 2017-02-20 11:19 +0000 [06214173a9] Joshua Colp * Revert "build: Execute ldconfig to build cache." This reverts commit e910dbab90ef3d628955c49f441b2c9dda1f222c. Change-Id: I242aa0a965a79738dc898299959c6d2e020c86bd 2017-02-20 08:04 +0000 [c9ea98f9bf] George Joseph * pjproject cli: Add object count after object lists When listing a container, we now print the number of objects in the container at the end of the list. Change-Id: I791cbc3ee9da9a2af9adc655164b5d32953df812 2017-02-20 05:53 +0000 [d8972f50f4] Sean Bright * res_config_ldap: Don't try to delete non-existent attributes OpenLDAP will raise an error when we try to delete an LDAP attribute that doesn't exist. We need to filter out LDAP_MOD_DELETE requests based on which attributes the current LDAP entry actually has. There is of course a small window of opportunity for this to still fail, but it is much less likely now. Change-Id: I3fe1b04472733e43151563aaf9f8b49980273e6b 2017-02-20 05:49 +0000 [b980cae1f7] Sean Bright * res_config_ldap: Remove extraneous line numbers from log messages Extraneous line numbers were being output in many log messages. These have been removed. Change-Id: Ice9efa3d252ee87f37fa8f5ea852fda482675431 2017-02-20 05:45 +0000 [011b7be62a] Sean Bright * res_config_ldap: Make memory allocation more consistent The code in update_ldap() and update2_ldap() was using both Asterisk's memory allocation routines as well as OpenLDAP's. I've changed it so that everything that is passed to OpenLDAP's functions are allocated with their routines. Change-Id: Iafec9c1fd8ea49ccc496d6316769a6a426daa804 2017-02-20 05:30 +0000 [b2836dde7e] Sean Bright * res_config_ldap: Fix configuration inheritance from _general The "_general" configuration section allows administrators to provide both general configuration options (host, port, url, etc.) as well as a global realtime-to-LDAP-attribute mapping that is a fallback if one of the later sections do not override it. This neglected to exclude the general configuration options from the mapping. As an example, during my testing, chan_sip requested 'port' from realtime, and because I did not have it defined, it pulled in the 'port' configuration option from "_general." We now filter those out explicitly. Change-Id: I1fc61560bf96b8ba623063cfb7e0a49c4690d778 2017-02-20 05:27 +0000 [6d5e9993b2] Sean Bright * res_config_ldap: Fix erroneous LDAP_MOD_REPLACE in LDAP modify We always treat the first change of our modification batch as a replacement when it sometimes is actually a delete. So we have to pass the correct arguments to the OpenLDAP library. ASTERISK-26580 #close Reported by: Nicholas John Koch Patches: res_config_ldap.c-11.24.1.patch (license #6833) patch uploaded by Nicholas John Koch Change-Id: I0741d25de07c9539f1edc6eff3696165dfb64fbe 2017-02-15 11:55 +0000 [5b7c6678ae] Sean Bright * res_config_sqlite3: Fix crash when loading with invalid config When ast_config_load() fails with CONFIG_STATUS_FILEINVALID, it has already destroyed the ast_config struct for us. Trying to do it again results in a crash. Change-Id: If6a5c0ca718ad428e01a1fb25beb209a9ac18bc6 2017-02-17 16:57 +0000 [096496e13e] Richard Mudgett * tcptls.c: Add some missing allocation failure checks. Change-Id: I0ddf01cd3c10d3b6666d7bf68d4e206a37f4fbdb 2017-02-17 17:06 +0000 [047a1e7dcc] Sean Bright * pjproject-bundled: Fix checksum verification when using cURL ASTERISK-26802 #close Reported by: Michael L. Young Change-Id: Iad293080f55d4d69ab615717a15211d916eed613 2017-02-16 08:38 +0000 [2cd75fe311] Sean Bright * realtime: Fix LIKE escaping in SQL backends The realtime framework allows for components to look up values using a LIKE clause with similar syntax to SQL's. pbx_realtime uses this functionality to search for pattern matching extensions that start with an underscore (_). When passing an underscore to SQL's LIKE clause, it will be interpreted as a wildcard matching a single character and therefore needs to be escaped. It is (for better or for worse) the responsibility of the component that is querying realtime to escape it with a backslash before passing it in. Some RDBMs support escape characters by default, but the SQL92 standard explicitly says that there are no escape characters unless they are specified with an ESCAPE clause, e.g. SELECT * FROM table WHERE column LIKE '\_%' ESCAPE '\' This patch instructs 3 backends - res_config_mysql, res_config_pgsql, and res_config_sqlite3 - to use the ESCAPE clause where appropriate. Looking through documentation and source tarballs, I was able to determine that the ESCAPE clause is supported in: MySQL 5.0.15 (released 2005-10-22 - earliest version available from archives) PostgreSQL 7.1 (released 2001-04-13) SQLite 3.1.0 (released 2005-01-21) The versions of the relevant libraries that we depend on to access MySQL and PostgreSQL will not work on versions that old, and I've added an explicit check in res_config_sqlite3 to only use the ESCAPE clause when we have a sufficiently new version of SQLite3. res_config_odbc already handles the escape characters appropriately, so no changes were required there. ASTERISK-15858 #close Reported by: Humberto Figuera ASTERISK-26057 #close Reported by: Stepan Change-Id: I93117fbb874189ae819f4a31222df7c82cd20efa 2017-02-16 10:30 +0000 [e910dbab90] Joshua Colp * build: Execute ldconfig to build cache. On some platforms a multiarch approach is used for libraries. The build system does not take this into account and still places libraries into the lib directory if no --libdir is specified to configure. On initial startup this results in libasteriskssl.so not being found, as it is not in the multiarch lib directory. This change does the minimally invasive thing and executes ldconfig so that the libraries in the lib directory are found and their location cached. By doing so Asterisk starts up fine. ASTERISK-26705 Change-Id: I6d30b6427e9d5e69470e11327c7ff203fa7da519 2017-02-16 05:46 +0000 [9b02bbfa88] Sean Bright * res_config_sqlite3: Properly create missing columns when necessary There were two specific issues resolved here: 1) The code that iterated over the required fields (via ast_realtime_require) was broken for the RQ_INTEGER1 field type. Iteration would stop when the first RQ_INTEGER1 (0) field was encountered. 2) sqlite3_changes() was used to try and count the number of rows returned by a SELECT statement. sqlite3_changes() only counts affected rows, so this was always returning the value from the most recent data modification statement. We now separate read-only queries from data modification queries and count rows appropriately in both cases. ASTERISK-23457 #close Reported by: Scott Griepentrog Change-Id: I91ed20494efc3fcfbc2a96ac7646999a49814884 2017-02-15 14:44 +0000 [0fc27fa364] Joshua Elson * http: Ensure capath is defined on all http creations ASTERISK-26794 #close Change-Id: I9cbc3b6b6a8aab590f5ccde9c262a98e4d5253a1 2017-02-15 23:09 +0000 [7aa731c1c7] Igor Goncharovsky * chan_unistim: fix char type to have consistent behavior on ARM There is difference exists in behaviour of char type on x86 and ARM. On x86 by default char variable type means signed char, but in ARM unsigned char used. This make binary calculations and negative values works wrong on ARM. This patch change type of char variables used for store negative values and binary calculations to signed char. ASTERISK-26714 Change-Id: Id78716dee9568a58419d4ef63c038affc3dfc7ab 2017-02-07 13:17 +0000 [be77b845d9] George Joseph * res_pjsip_pubsub: Correctly implement persisted subscriptions This patch fixes 2 original issues and more that those 2 exposed. * When we send a NOTIFY, and the client either doesn't respond or responds with a non OK, pjproject only calls our pubsub_on_evsub_state callback, no others. Since pubsub_on_evsub_state (which does the sub_tree cleanup) does not expect to be called back without the other callbacks being called first, it just returns leaving the sub_tree orphaned. Now pubsub_on_evsub_state checks the event for PJSIP_EVENT_TSX_STATE which is what pjproject will set to tell us that it was the transaction that timed out or failed and not the subscription itself timing our or being terminated by the client. If is TSX_STATE, pubsub_on_evsub_state now does the proper cleanup regardless of the state of the subscription. * When a client renews a subscription, we don't update the persisted subscription with the new expires timestamp. This causes subscription_persistence_recreate to prune the subscription if/when asterisk restarts. Now, pubsub_on_rx_refresh calls subscription_persistence_update to apply the new expires timestamp. This exposed other issues however... * When creating a dialog from rdata (which sub_persistence_recreate does from the packet buffer) there must NOT be a tag on the To header (which there will be when a client refreshes a subscription). If there is one, pjsip_dlg_create_uas will fail. To address this, subscription_persistence_update now accepts a flag that indicates that the original packet buffer must not be updated. New subscribes don't set the flag and renews do. This makes sure that when the rdata is recreated on asterisk startup, it's done from the original subscribe packet which won't have the tag on To. * When creating a dialog from rdata, we were setting the dialog's remote (SUBSCRIBE) cseq to be the same as the local (NOTIFY) cseq. When the client tried to resubscribe after a restart with the correct cseq, we'd reject the request with an Invalid CSeq error. * The acts of creating a dialog and evsub by themselves when recreating a subscription does NOT restart pjproject's subscription timer. The result was that even if we did correctly recreate the subscription, we never removed it if the client happened to go away or send a non-OK response to a NOTIFY. However, there is no pjproject function exposed to just set the timer on an evsub that wasn't created by an incoming subscribe request. To address this, we create our own timer using ast_sip_schedule_task. This timer is used only for re-establishing subscriptions after a restart. An earlier approach was to add support for setting pjproject's timer (via a pjproject patch) and while that patch is still included here, we don't use that call at the moment. While addressing these issues, additional debugging was added and some existing messages made more useful. A few formatting changes were also made to 'pjsip show scheduled tasks' to make displaying the subscription timers a little more friendly. ASTERISK-26696 ASTERISK-26756 Change-Id: I8c605fc1e3923f466a74db087d5ab6f90abce68e 2017-02-15 11:03 +0000 [73133d5354] Sean Bright * res_rtp_asterisk: Use PJ_ICE_MAX_CAND instead of hard-coding 16 pjsip limits the total number of ICE candidates to PJ_ICE_MAX_CAND, which is a compile-time constant. Instead of hard-coding 16 when we enumerate local interfaces, use PJ_ICE_MAX_CAND so that we can potentially collect more interfaces if the compile time options are changed. Tangentially related to ASTERISK~24464 Change-Id: I1b85509e39e33b1fed63c86261fc229ba14bbabd 2017-02-03 02:25 +0000 [99b40e72ae] Tzafrir Cohen * libasteriskssl: do nothing with OpenSSL >= 1.1 OpenSSL 1.1 requires no explicit initialization. The hacks in the library are not needed. They also happen to fail running Asterisk. ASTERISK-26109 #close Change-Id: I3b3efd5d80234a4c45a8ee58dcfe25b15d9ad100 2017-02-13 16:50 +0000 [4c31e03e80] Sean Bright * app_voicemail: Allow 'Comedian Mail' branding to be overriden Original patch by John Covert, slight modifications by me. ASTERISK-17428 #close Reported by: John Covert Patches: app_voicemail.c.patch (license #5512) patch uploaded by John Covert Change-Id: Ic3361b0782e5a5397a19ab18eb8550923a9bd6a6 2017-01-20 23:59 +0000 [e97e50b68b] Tzafrir Cohen * tcptls: use TLS_client_method with OpenSSL 1.1 OpenSSL 1.1 introduced TLS_client_method() and deprecated the previous version-specific methods (such as TLSv1_client_method(). Other than being simpler to use and more correct (gain support for TLS newer that TLS1, in our case), the older ones produce a deprecation warning that fails the build in dev-mode. ASTERISK-26109 #close Change-Id: I257b1c8afd09dcb0d96cda3a41cb9f7a15d0ba07 2017-01-20 23:57 +0000 [0d555f0d81] Tzafrir Cohen * openssl 1.1 support: use OPENSSL_VERSION_NUMBER Use OPENSSL_VERSION_NUMBER instead of OPENSSL_API_COMPAT to detect the openssl 1.1 API. ASTERISK-26109 #close Change-Id: I4e448f55ef516aedf6ad154037c35577a421a458 2017-01-25 16:25 +0000 [9d34df9a5e] Ryan Rittgarn * app_voicemail: VoiceMailPlayMsg did not play database stored messages When attempting to use VoiceMailPlayMsg with a realtime data backend the message is located, but never retrieved. This patch adds the required RETRIEVE and DISPOSE calls that will fetch the message from the database (and IMAP storage as well for that matter). Also, removed extraneous make_file call. ASTERISK-26723 #close Change-Id: I1e122dd53c0f3d7faa10f3c2b7e7e76a47d51b8c 2017-02-14 08:12 +0000 [f99e5f4de4] Sean Bright * app_record: Add option to prevent silence from being truncated When using Record() with the silence detection feature, the stream is written out to the given file. However, if only 'silence' is detected, this file is then truncated to the first second of the recording. This patch adds the 'u' option to Record() to override that behavior. ASTERISK-18286 #close Reported by: var Patches: app_record-1.8.7.1.diff (license #6184) patch uploaded by var Change-Id: Ia1cd163483235efe2db05e52f39054288553b957 2017-02-11 09:57 +0000 [ea8a610776] Sean Bright * cli: Fix various CLI documentation and completion issues * app_minivm: Use built-in completion facilities to complete optional arguments. * app_voicemail: Use built-in completion facilities to complete optional arguments. * app_confbridge: Add missing colons after 'Usage' text. * chan_alsa: Use built-in completion facilities to complete optional arguments. * chan_sip: Use built-in completion facilities to complete optional arguments. Add completions for 'load' for 'sip show user', 'sip show peer', and 'sip qualify peer.' * chan_skinny: Correct and extend completions for 'skinny reset' and 'skinny show line.' * func_odbc: Correct completions for 'odbc read' and 'odbc write' * main/asterisk: Correct and extend completions for 'core show file version.' * main/astmm: Use built-in completion facilities to complete arguments for 'memory' commands. * main/bridge: Correct completions for 'bridge kick.' * main/ccss: Use built-in completion facilities to complete arguments for 'cc cancel' command. * main/cli: Add 'all' completion for 'channel request hangup.' Correct completions for 'core set debug channel.' Correct completions for 'core show calls.' * main/pbx_app: Remove redundant completions for 'core show applications.' * main/pbx_hangup_handler: Remove unused completions for 'core show hanguphandlers all.' * res_sorcery_memory_cache: Add completion for 'reload' argument of 'sorcery memory cache stale' and properly implement. Change-Id: Iee58c7392f6fec34ad9d596109117af87697bbca 2017-01-13 11:21 +0000 [17030100ca] Norbert Varga * chan_pjsip: Multidomain endpoint finding on call When PJSIP tries to call an endpoint with a domain (e.g. 1000@test.com), the user part is stripped down as it would be a trunk with a specified user, and only the host part is called as a PJSIP endpoint and can't be found. This is not correct in the case of a multidomain SIP account, so the stripping after the @ sign is done only if the whole endpoint (in multidomain case 1000@test.com) can't be found. ASTERISK-26248 Change-Id: I3a2dd6f57f3bd042df46b961eccd81d31ab202e6 2017-02-13 05:05 +0000 [18f1b52601] Joshua Colp * channel: Protect flags in ast_waitfor_nandfds operation. The ast_waitfor_nandfds operation will manipulate the flags of channels passed in. This was previously done without the channel lock being held. This could result in incorrect values existing for the flags if another thread manipulated the flags at the same time. This change locks the channel during flag manipulation. ASTERISK-26788 Change-Id: I2c5c8edec17c9bdad4a93291576838cb552ca5ed 2017-02-11 11:25 +0000 [a46a21642e] Richard Mudgett * res_pjsip.c: Fix inconsistency between warning and action. The original return value corresponded to AST_SIP_AUTHENTICATION_CHALLENGE but we have no authenticator registered to create the challenge. Change-Id: I62368180d774b497411b80fbaabd0c80841f8512 2017-02-11 11:26 +0000 [67b21dc63a] Richard Mudgett * pjsip_distributor.c: Fix off-nominal tdata ref leak. Change-Id: I571f371d0956a8039b197b4dbd8af6b18843598d 2017-02-09 10:01 +0000 [8936568515] Sean Bright * manager: Restore Originate failure behavior from Asterisk 11 In Asterisk 11, if the 'Originate' AMI command failed to connect the provided Channel while in extension mode, a 'failed' extension would be looked up and run. This was, I believe, unintentionally removed in 51b6c49. This patch restores that behavior. This also adds an enum for the various 'synchronous' modes in an attempt to make them meaningful. ASTERISK-26115 #close Reported by: Nasir Iqbal Change-Id: I8afbd06725e99610e02adb529137d4800c05345d 2017-02-08 14:27 +0000 [2817f87d27] Richard Mudgett * core: Cleanup some channel snapshot staging anomalies. We shouldn't unlock the channel after starting a snapshot staging because another thread may interfere and do its own snapshot staging. * app_dial.c:dial_exec_full() made hold the channel lock while setting up the outgoing channel staging. Made hold the channel lock after the called party answers while updating the caller channel staging. * chan_sip.c:sip_new() completed the channel staging on off-nominal exit. Also we need to use ast_hangup() instead of ast_channel_unref() at that location. * channel.c:__ast_channel_alloc_ap() added a comment about not needing to complete the channel snapshot staging on off-nominal exit paths. * rtp_engine.c:ast_rtp_instance_set_stats_vars() made hold the channel locks while staging the channels for the stats channel variables. Change-Id: Iefb6336893163f6447bad65568722ad5d5d8212a 2017-02-10 09:35 +0000 [c7fcc4468f] George Joseph * configs/samples: Fix placement of 'identify' entry in sorcery.conf The entry for 'identify' was incorrectly placed in the res_pjsip section when it should be in res_pjsip_endpoint_identifier_ip. ASTERISK-26785 #close Change-Id: Ia1372b12a952bfe2df6b1b1e0e725ca306a5d41a 2017-02-08 11:50 +0000 [cbc23c31cf] Mark Michelson * Revert "Update qualifies when AOR configuration changes." This reverts commit 6492e91392b8fd394193e411c6eb64b45486093f. The change in question was intended to prevent the need to reload in order to update qualifies on contacts when an AOR changes. However, this ended up causing a deadlock instead. Change-Id: I1a835c90a5bb65b6dc3a1e94cddc12a4afc3d71e 2017-02-07 12:01 +0000 [7e14e086cf] Joshua Colp * srv: Fix crash when ast_srv_lookup is used and 0 records are returned. When performing an SRV lookup using the ast_srv_lookup function it did not properly handle the situation where 0 records are returned. If this happened it would wrongly assume that at least one record was present. This change fixes the code so it will exit early if an error occurs or if 0 records are returned. ASTERISK-26772 patches: srv_lookup.patch submitted by nappsoft (license 6822) Change-Id: I09b19081c74e0ad11c12bf54a257243b1bcb2351 2017-02-06 11:40 +0000 [7b39d6901a] Joshua Colp * res_stasis_device_state: Protect the adding/removing of subscriptions. The adding and removing of device state subscriptions did not protect fully against simultaneous manipulation. In particular the subscribe case allowed a small window where two subscriptions could be added for the same device state instead of just one. This change makes the code hold the subscriptions lock for the entirety of each operation to ensure that two are not occurring at the same time. ASTERISK-26770 Change-Id: I3e7f8eb9d09de440c9024d2dd52029f6f20e725b 2017-02-01 17:56 +0000 [c384dfd6b0] Richard Mudgett * res_pjsip: Fix some off nominal tdata leaks. Change-Id: I243a4be5e7fbfe604923764969c4ee04eee89b9d 2017-02-02 11:26 +0000 [70aff89e5d] Sean Bright * res_odbc: Remove deprecated settings from sample configuration file ASTERISK-26704 #close Reported by: Anthony Messina Change-Id: I976a1f94cf79c5f31e76174c61f5c6a65fd6354f 2017-02-01 15:56 +0000 [3aee199913] Sean Bright * audiohooks: Muting a hook can mute underlying frames If an audiohook is placed on a channel that does not require transcoding, muting that hook will cause the underlying frames to be muted as well. The original patch is from David Woolley but I have modified slightly. ASTERISK-21094 #close Reported by: David Woolley Patches: ASTERISK-21094-Patch-1.8-1.txt (license #5737) patch uploaded by David Woolley Change-Id: Ib2b68c6283e227cbeb5fa478b2d0f625dae338ed 2017-02-01 13:54 +0000 [6492e91392] Mark Michelson * Update qualifies when AOR configuration changes. Prior to this change, qualifies would only update in the following cases: * A reload of res_pjsip.so was issued. * A dynamic contact was re-registered after its AOR's qualify_frequency had been changed This does not work well if you are using realtime for your AORs. You can update your database to have a new qualify_frequency, but the permanent contacts on that AOR will not have their qualifies updated. And the dynamic contacts on that AOR will not have their qualifies updated until the next registration, which could be a long time. This change seeks to fix this problem by making it so that whenever AOR configuration is applied, the contacts pertaining to that AOR have their qualifies updated. Additions from this patch: * AOR sorcery objects now have an apply handler that calls into a newly added function in the OPTIONS code. This causes all contacts associated with that AOR to re-schedule qualifies. * When it is time to qualify a contact, the OPTIONS code checks to see if the AOR can still be retrieved. If not, then qualification is canceled on the contact. Alterations from this patch: * The registrar code no longer updates contact's qualify_frequence and qualify_timeout. There is no point to this since those values already get updated when the AOR changes. * Reloading res_pjsip.so no longer calls the OPTIONS initialization function. Reloading res_pjsip.so results in re-loading AORs, which results in re-scheduling qualifies. Change-Id: I2e7c3316da28f389c45954f24c4e9389abac1121 2017-01-31 18:28 +0000 [43f0ff4b69] Richard Mudgett * channel.c: Fix unbalanced read queue deadlocking local channels. Using the timerfd timing module can cause channel freezing, lingering, or deadlock issues. The problem is because this is the only timing module that uses an associated alert-pipe. When the alert-pipe becomes unbalanced with respect to the number of frames in the read queue bad things can happen. If the alert-pipe has fewer alerts queued than the read queue then nothing might wake up the thread to handle received frames from the channel driver. For local channels this is the only way to wake up the thread to handle received frames. Being unbalanced in the other direction is less of an issue as it will cause unnecessary reads into the channel driver. ASTERISK-26716 is an example of this deadlock which was indirectly fixed by the change that found the need for this patch. * In channel.c:__ast_queue_frame(): Adding frame lists to the read queue did not add the same number of alerts to the alert-pipe. Correspondingly, when there is an exceptionally long queue event, any removed frames did not also remove the corresponding number of alerts from the alert-pipe. ASTERISK-26632 #close Change-Id: Ia98137c5bf6e9d6d202ce0eb36441851875863f6 2017-01-31 16:38 +0000 [a199f94908] Richard Mudgett * res_agi: Prevent an AGI from eating frames it should not. (Re-do) A dialplan intercept routine is equivalent to an interrupt routine. As such, the routine must be done quickly and you do not have access to the media stream. These restrictions are necessary because the media stream is the responsibility of some other code and interfering with or delaying that processing is bad. A possible future dialplan processing architecture change may allow the interception routine to run in a different thread from the main thread handling the media and remove the execution time restriction. * Made res_agi.c:run_agi() running an AGI in an interception routine run in DeadAGI mode. No touchy channel frames. ASTERISK-25951 ASTERISK-26343 ASTERISK-26716 Change-Id: I638f147ca7a7f2590d7194a8ef4090eb191e4e43 2017-01-31 16:32 +0000 [6bed318a66] Richard Mudgett * Frame deferral: Revert API refactoring. There are several issues with deferring frames that are caused by the refactoring. 1) The code deferring frames mishandles adding a deferred frame to the deferred queue. As a result the deferred queue can only be one frame long. 2) Deferrable frames can come directly from the channel driver as well as the read queue. These frames need to be added to the deferred queue. 3) Whoever is deferring frames is really only doing the __ast_read() to collect deferred frames and doesn't care about the returned frames except to detect a hangup event. When frame deferral is completed we must make the normal frame processing see the hangup as a frame anyway. As such, there is no need to have varying hangup frame deferral methods. We also need to be aware of the AST_SOFTHANGUP_ASYNCGOTO hangup that isn't real. That fake hangup is to cause the PBX thread to break out of loops to go execute a new dialplan location. 4) To properly deal with deferrable frames from the channel driver as pointed out by (2) above, means that it is possible to process a dialplan interception routine while frames are deferred because of the AST_CONTROL_READ_ACTION control frame. Deferring frames is not implemented as a re-entrant operation so you could have the unsupported case of two sections of code thinking they have control of the media stream. A worse problem is because of the bad implementation of the AMI PlayDTMF action. It can cause two threads to be deferring frames on the same channel at the same time. (ASTERISK_25940) * Rather than fix all these problems simply revert the API refactoring as there is going to be only autoservice and safe_sleep deferring frames anyway. ASTERISK-26343 ASTERISK-26716 #close Change-Id: I45069c779aa3a35b6c863f65245a6df2c7865496 2017-01-31 11:17 +0000 [e371e13b9e] Joshua Colp * res_pjsip: Handle invocation of callback on outgoing request when error occurs. There are some error cases in PJSIP when sending a request that will result in the callback for the request being invoked. The code did not handle this case and assumed on every error case that the callback was not invoked. The code has been changed to check whether the callback has been invoked and if so to absorb the error and treat it as a success. ASTERISK-26679 ASTERISK-26699 Change-Id: I563982ba204da5aa1428989a11c06dd9087fea91 2017-01-30 09:02 +0000 [339c30f2b6] Sean Bright * res_rtp_asterisk: Swap byte-order when sending signed linear Before Asterisk 13, signed linear was converted into network byte order by a smoother before being sent over the network. We restore this behavior by forcing the creation of a smoother when slinear is in use and setting the appropriate flags so that the byte order conversion is always done. ASTERISK-24858 #close Reported-by: Frankie Chin Change-Id: I868449617d1a7819578f218c8c6b2111ad84f5a9 2017-01-31 12:46 +0000 [7fd28cefdb] George Joseph * debug_utilities: Install ast_logescalator to /var/lib/asterisk/scripts Forgot to install it with the original patch Change-Id: I8bdb540a6694971ae5fe21f48d532332c6482e4c 2017-01-25 06:50 +0000 [456bc3c704] George Joseph * debug_utilities: Add ast_logescalator The escalator works by creating a set of startup commands in cli.conf that set up logger channels and issue the debug commands for the subsystems specified. If asterisk is running when it is executed, the same commands will be issued to the running instance. The original cli.conf is saved before any changes are made and can be restored by executing '$prog --reset'. The log output will be stored in... $astlogdir/message.$uniqueid $astlogdir/debug.$uniqueid $astlogdir/dtmf.$uniqueid $astlogdir/fax.$uniqueid $astlogdir/security.$uniqueid $astlogdir/pjsip_history.$uniqueid $astlogdir/sip_history.$uniqueid Some minor tweaks were made to chan_sip, and res_pjsip_history so their history output could be send to a log channel as packets are captured. A minor tweak was also made to manager so events are output to verbose when "manager set debug on" is issued. Change-Id: I799f8e5013b86dc5282961b27383d134bf09e543 2017-01-23 09:35 +0000 [54b027916a] Torrey Searle * libastssl/pj: libastssl/pj should have an so_version Issue introduced in b59956a87. In the non-darwin case libastssl/pj should be versioned. This causes the symbol file for this lib to not be generated. Change-Id: Ib07ae8c40252813c488e2c1ac6204fd42816dd4c 2017-01-24 19:51 +0000 [3c8f84786e] Kirill Katsnelson * make_build_h: handle backslashes in external strings LikewiseOpen creates user names with a backslash in them. A gentle massage with sed(1) allows such strings to be inserted into build.h properly quoted. I am also adding the same for host name and other strings used in the script that are more or less user-controlled. ASTERISK-26754 Change-Id: Iac5ef2b67a68ee58f35ddbf86bb818ba6eabecae 2017-01-17 20:46 +0000 [555e8cd2ba] Kirill Katsnelson * ast_careful_fwrite to support EPIPE gracefully When a reading end of the network socket is closed by an AMI manager, the EPIPE is signaled when writing to our end, resulting in the spurious log error message ast_careful_fwrite: fwrite() returned error: Broken pipe Previously EPIPE was handled in ast_carefulwrite() a few lines above, but not in this function. ASTERISK-26753 Change-Id: I6a67335cd6526608bb9b78f796c626b1677664b8 2017-01-24 22:31 +0000 [be92f10a16] Kirill Katsnelson * app_queue: Fix queues randomly disappearing on reload With 500+ queues and a reload every minute, a random queue disappears upon reload. The cause is mususe of the 'dead' flag. Namely, all queues were marked dead up front, and then "resurrected" by dropping this flag for those found in the configuration. But a queue marked dead can be removed also when control leaves the app entry point on a PBX thread. With this change, the queue is marked only not found, and at the end of reload only the queues that are still not found are actually marked as dead, so the dead flag is never reset, and set only on positively dead queues. ASTERISK-26755 Change-Id: I3a4537aec9eb8d8aeeaa0193407e3523feb004bf 2017-01-26 07:57 +0000 [aae9df0643] Joshua Colp * res_pjsip_endpoint_identifier_ip: Fix memory leak of hosts when resolving. This change adds a missing unreference of the hostname when resolving and also cleans up the iterator. ASTERISK-26735 Change-Id: Ic012ebaf3d89e714eec340b7b0c5e63c66af857a 2017-01-25 15:26 +0000 [9e3150b98d] Mark Michelson * Add reload options to CLI/AMI stale object commands. Marking an object as stale in a memory cache is supposed to prime the cache so that the next time the item is retrieved, the stale item is deleted from the cache and a background task is run to re-populate the cache with a fresh version of the object. The problem is, there are some object types out there for which there is no natural reason that they would be retrieved from the backend with any regularity. Outbound PJSIP registrations are a good example of this. At startup, they are read, and an object-specific state is created that refers to the initially-retrieved object for all time. Adding the "reload" option to the CLI/AMI commands gives the cache the opportunity to manually re-retrieve the object from the backend, both storing the new object in the cache and applying the new object's configuration to the module that uses that object. Change-Id: Ieb1fe7270ceed491f057ec5cbf0e097bde96c5c8 2017-01-10 17:39 +0000 [c54f9d2bf0] Richard Mudgett * T.140: Fix format ref and memory leaks. * channel.c:ast_sendtext(): Fix T.140 SendText memory leak. * format_compatibility.c: T.140 RED and T.140 were swapped. * res_rtp_asterisk.c:rtp_red_init(): Fix ast_format_t140_red ref leak. * res_rtp_asterisk.c:rtp_red_init(): Fix data race after starting periodic scheduled red_write(). * res_rtp_asterisk.c: Some other minor misc tweaks. Change-Id: Ifa27a2e0f8a966b1cf628607c86fc4374b0b88cb 2017-01-24 15:39 +0000 [a2f0adccbd] Joshua Colp * res_pjsip_endpoint_identifier_ip: Ensure error defaults to 0. When configuring a match using a netmask the error variable was not defaulting to 0. For some people this would cause the code to think an error occurred when adding the match when in reality it added perfectly fine. ASTERISK-26693 Change-Id: I850c250813742bddde65c84e739093c9e01dfe56 2017-01-10 17:37 +0000 [607b3ac736] Richard Mudgett * astobj2.c: Add excessive ref count trap. Change-Id: I32e6a589cf9009450e4ff7cb85c07c9d9ef7fe4a 2017-01-10 13:11 +0000 [ab8cb5a7ce] Richard Mudgett * main/app.c: Memory corruption from early format destruction. * make_silence() created a malloced silence slin frame without adding a slin format ref. When the frame is destroyed it will unref the slin format that never had a ref added. Memory corruption is expected to follow. * Simplified and fixed counting the number of samples in a frame list for make_silence(). * Eliminated an unnecessary RAII_VAR associated with the make_silence() frame. Change-Id: I47de3f9b92635b7f8b4d72309444d6c0aee6f747 2017-01-11 14:59 +0000 [dcd8e4b1a0] Richard Mudgett * frame.c: Fix off-nominal format ref leaks. * ast_frisolate() could leak frame format refs on allocation failures. * Similified code in ast_frisolate() and code used by ast_frisolate(). Change-Id: I79566d4d36b3d7801bf0c8294fcd3e9a86a2ed6d 2017-01-13 19:08 +0000 [00a227e93d] Richard Mudgett * stasis_bridge.c: Fix off-nominal stasis control ref leak. Change-Id: Ib17218343a6596832060180e19386da9df150ac8 2017-01-10 12:30 +0000 [38a2021c68] Richard Mudgett * res_musiconhold.c: Fix format ref leak when parsing MOH config class. Change-Id: Ica8e8e2ce7604c2c61ec55bef07dc675361d2ea5 2017-01-10 14:03 +0000 [ab7a9fc5b2] Richard Mudgett * chan_oss.c: Fix format ref leak in oss_read(). Change-Id: I0a5d56c7dcf327d60f86a4c25a23571733709fd0 2017-01-10 17:48 +0000 [1484a991e1] Richard Mudgett * Add notes about embedded ast_frame structs holding a format ref. mod_format.h: Note ast_filestream.fr holds a format ref. translate.h: Note ast_trans_pvt.f holds a format ref. Change-Id: I86bda354d725207b41e08920355d7c31b2d7f749 2017-01-19 09:05 +0000 [17f4989d49] George Joseph * ari: Implement 'debug all' and request/response logging The 'ari set debug' command has been enhanced to accept 'all' as an application name. This allows dumping of all apps even if an app hasn't registered yet. To accomplish this, a new global_debug global variable was added to res/stasis/app.c and new APIs were added to set and query the value. 'ari set debug' now displays requests and responses as well as events. This required refactoring the existing debug code. * The implementation for 'ari set debug' was moved from stasis/cli.{c,h} to ari/cli.{c,h}, and stasis/cli.{c,h} were deleted. * In order to print the body of incoming requests even if a request failed, the consumption of the body was moved from the ari stubs to ast_ari_callback in res_ari.c and the moustache templates were then regenerated. The body is now passed to ast_ari_invoke and then on to the handlers. This results in code savings since that template was inserted multiple times into all the stubs. An additional change was made to the ao2_str_container implementation to add partial key searching and a sort function. The existing cli code assumed it was already there when it wasn't so the tab completion was never working. Change-Id: Ief936f747ce47f1fb14035fbe61152cf766406bf 2017-01-20 21:13 +0000 [30cb4eb57f] Richard Mudgett * PJPROJECT logging: Fix detection of max supported log level. The mechanism used for detecting the maximum log level compiled into the linked pjproject did not work. The API call simply stores the requested level into an integer and does no range checking. Asterisk was assuming that there was range checking and limited the new value to the allowable range. To get the actual maximum log level compiled into the linked pjproject we need to get and save off the initial set log level from pjproject. This is the maximum log level supported. * Get and save off the initial log level setting before altering it to the desired level on startup. This has to be done by a macro rather than calling a core function to avoid incorrectly linking pjproject. * Split the initial log level warning messages to warn if the linked pjproject cannot support the requested startup level and if it is too low to get the pjproject buildopts for "pjproject show buildopts". * Adjust the CLI "pjproject set log level" to check the saved max log level and to generate normal output messages instead of a warning message. ASTERISK-26743 #close Change-Id: I40aa76653e2a1dece66c3f8734594b4f0471cfb4 2017-01-21 14:43 +0000 [cd2677f966] Tzafrir Cohen * tests: use datadir for sound files Some (voicemail-related) tests API symlinks beep.gsm and other files from ast_config_AST_VAR_DIR. It should use ast_config_AST_DATA_DIR. ASTERISK-26740 #close Change-Id: Id49c56fb9e16df64b1a2b829693ca7601252df89 2017-01-20 23:41 +0000 [b62f84bfb1] Tzafrir Cohen * test_voicemail_api: order of params to VERIFY macros Fix order of parameters in calls to VM_API_INT_VERIFY and VM_API_STRING_VERIFY ASTERISK-26739 #close Change-Id: I30dc6b36893aadad6012be3f16f93aa5720870d6 Note: status: builds. Not tested any further. 2017-01-05 13:21 +0000 [e3dcb9ddd9] Richard Mudgett * res_pjsip_pubsub.c: Implement "pjsip show subscriptions" commands. ASTERISK-23828 #close Change-Id: Ifb8a3b61f447aedc58a8e6b36a810f7566018567 2017-01-23 16:18 +0000 [75497c33ea] Mark Michelson * Free endpoint ACLs when destroying PJSIP endpoints. If endpoint ACLs were specified, they were not being freed when endpoints were destroyed. On systems with realtime endpoints, this could add up quickly since each DB lookup would allocate the ACL without freeing it. ASTERISK-26731 #close Reported by Ustinov Artem Change-Id: Ie1f8bf5b7a0de628c975beba01e69c56893331ad 2017-01-23 09:10 +0000 [177e81ee47] George Joseph * pjproject_bundled: Fix setting max log level An earlier attempt to prevent pjsua from spitting out an extra 6795 lines of debug output every time the testsuite called it was also turning off the ability for asterisk to output debug info when it needed to. This patch reverts the earlier fix and instead adds a pjproject patch that sets the startup log level to 1 for pjsua pjsystest and the pjsua python binding. This is an asterisk-only patch that does not affect pjproject functionality and will not be submitted upstream. Change-Id: I347a8b58b2626f2906ccfc1d339e907627a0c9e8 2017-01-23 10:08 +0000 [6d23b2e360] Joshua Colp * res_pjsip_endpoint_identifier_ip: Read settings before resolving. An option has been added, srv_lookups, which controls whether SRV lookups are performed on the provided match hosts or not. It was possible for this option to be applied after resolution had already happened. This change makes it so hosts are stored away, settings are read and applied, and then resolution is done. This ensures that no matter the ordering the srv_lookups option is in effect. ASTERISK-26735 Change-Id: I750378cb277be0140f8c5539450270afbfc43388 2017-01-22 17:25 +0000 [a969bf3577] Richard Mudgett * LISTFILTER: Remove outdated ERROR message. Feeding LISTFILTER an empty variable results in an invalid ERROR message. Earlier changes made the message useless because we can no longer tell if the variable is empty or does not exist. It is valid to try to remove a value from an empty list just as it is valid to try to remove a value that is not in a non-empty list. * Removed the outdated ERROR message. * Added more test cases to the LISTFILTER unit test. Change-Id: Ided9040e6359c44a335ef54e02ef5950a1863134 2017-01-05 15:11 +0000 [3890337e7a] Richard Mudgett * res_pjsip_pubsub.c: Fix AMI event list counts. Fix the AMI PJSIPShowSubscriptionsInbound, PJSIPShowSubscriptionsOutbound, and PJSIPShowResourceLists actions event counts. The reported counts may not necessarily be accurate depending on what happens. The subscriptions count would be wrong if Asterisk ever has outbound subscriptions. The resource list count could be wrong if a list were added or removed during the AMI action being processed. Change-Id: I4344301827523fa174960a42c413fd19abe4aed5 2017-01-05 13:02 +0000 [fe4801c4f9] Richard Mudgett * res_pjsip_pubsub.c: Fix incorrect message string wrapping. Change-Id: Id771e6fe56d89ce365ddcbb423f820af97211120 2017-01-05 13:01 +0000 [46484b8730] Richard Mudgett * res_pjsip_pubsub.c: Eliminate trivial SCOPED_LOCK usage. Change-Id: Ie0b69a830385452042fa19e7d267c6790ec6b6be 2017-01-05 12:58 +0000 [8160474d7d] Richard Mudgett * res_pjsip: alloca can never fail. Change-Id: Ia2a6158e5fdf311bc2a1c0c43417978de504b1f1 2017-01-13 11:03 +0000 [c628a7acac] George Joseph * debug_utilities: Create ast_loggrabber ast_loggrabber gathers log files from customizable search patterns, optionally converts POSIX timestamps to a readable format and tarballs the results. Also a few tweaks were made to ast_coredumper. Change-Id: I8bfe1468ada24c1344ce4abab7b002a59a659495 (cherry picked from commit 5fa1c56d7e76999aa14f133a33f6b168e7c3b99c) 2017-01-01 03:47 +0000 [e335b706ee] Richard Mudgett * res_pjsip_outbound_authenticator_digest.c: Fix spacing in warning messages. Change-Id: I573f0343c0c63a785cd4da60d57cc9f8b9ce7f49 2017-01-12 15:58 +0000 [883e7fde31] Kevin Harwell * abstract/fixed/adpative jitter buffer: disallow frame re-inserts It was possible for a frame to be re-inserted into a jitter buffer after it had been removed from it. A case when this happened was if a frame was read out of the jitterbuffer, passed to the translation core, and then multiple frames were returned from said translation core. Upon multiple frames being returned the first is passed on, but sebsequently "chained" frames are put back into the read queue. Thus it was possible for a frame to go back into the jitter buffer where this would cause problems. This patch adds a flag to frames that are inserted into the channel's read queue after translation. The abstract jitter buffer code then checks for this flag and ignores any frames marked as such. Change-Id: I276c44edc9dcff61e606242f71274265c7779587 2017-01-13 21:23 +0000 [473330983b] Richard Mudgett * taskprocessor.c: Change when high water warning logged. The task processor queue reached X scheduled tasks message was originally intended to get logged only once per task processor to prevent spamming the log. This is no longer necessary since high and low water thresholds can better control when the message is logged. It is beneficial to generate the warning each time a task processor reaches the high water level because PJSIP stops processing new requests while any high water alert is active. Without this change you would have to enable at least debug level 3 logging to know about a repeated alert trigger. * Made generate the warning message whenever a task is pushed into the task processor that triggers the high water alert. * Appended 'again' to the warning for a repeated high water alert trigger. Change-Id: Iabf75a004f7edaf1e5e8c323099418e667cac999 2017-01-10 05:54 +0000 [0047b1bc49] Aaron An * res_rtp_asterisk: Fix bug in function CHANNEL(rtcp, all_rtt) Function CHANNEL(rtcp,all_rtt) CHANNEL(rtcp,all_loss) CHANNEL(rtcp,all_jitter) always return 0.0 due to wrong define of macro "AST_RTP_SATA_SET" and "AST_RTP_STAT_STRCPY". It should compare "combined" with "stat" not "current_stat". ASTERISK-26710 #close Reported-by: Aaron An Tested-by: AaronAn Change-Id: Id4140fafbf92e2db689dac5b17d9caa009028a15 2017-01-10 18:10 +0000 [47474cfd54] George Joseph * debug_utilities: Create the ast_coredumper utility This utility allows easy manipulation of asterisk coredumps. * Configurable search paths and patterns for existing coredumps * Can generate a consistent coredump from the running instance * Can dump the lock_infos table from a coredump * Dumps backtraces to separate files... - thread apply 1 bt full -> .thread1.txt - thread apply all bt -> .brief.txt - thread apply all bt full -> .full.txt - lock_infos table -> .locks.txt * Can tarball corefiles and optionally delete them after processing * Can tarball results files and optionally delete them after processing * Converts ':' in coredump and results file names '-' to facilitate uploading. Jira for instance, won't accept file names with colons in them. Tested on Fedora24+, Ubuntu14+, Debian6+, CentOS6+ and FreeBSD9+[1]. [1] For *BSDs, the "devel/gdb" package might have to be installed to get a recent gdb. The utility will check all instances of gdb it finds in $PATH and if one isn't found that can run python, it prints a friendly error. Change-Id: I935d37ab9db85ef923f32b05579897f0893d33cd 2017-01-08 10:29 +0000 [f8cd73ec3c] George Joseph * pjproject_bundled: Fix compilation with MALLOC_DEBUG When MALLOC_DEBUG was specified, make was failing. Immediately remaking would work. The issues was in the ordering of the make dependencies. Change-Id: If6030b54fc693f3179f32bfd20c6b5d5f1b3f7cd 2017-01-05 06:11 +0000 [37aaaa2da2] Joshua Colp * res_pjsip_endpoint_identifier_ip: Add support for SRV lookups. This change implements SRV support for the IP based endpoint identifier module. All possible addresses through SRV are looked up and added as matches. If no SRV records are available a fallback to normal host resolution is done. If an IP address is provided then no SRV lookup occurs. This is configured using the "srv_lookups" option on the identify section and defaults to "yes". ASTERISK-26693 Change-Id: I6b641e275bf96629320efa8b479737062aed82ac 2016-12-22 09:13 +0000 [569dac8e50] Alexander Traud * res_pjsip_session: Access SIPDOMAIN via Dialplan. This feature was available in the SIP channel driver chan_sip. For example, Asterisk is the outbound proxy and has to handle all SIP-URIs, even domains not local to Asterisk. In that case, SIPDOMAIN is used in the Dialplan, to detect and dial remote SIP-URIs. This change here sets the SIP destination domain of an inbound call (SIPDOMAIN) in the SIP channel driver res_pjsip as well. ASTERISK-26670 #close Change-Id: I27c880dc404a3c1c6792e1ba3545475339577243 2017-01-04 05:50 +0000 [367128e70b] Alexander Traud * chan_sip: Remember SDP negotiation on SIP_CODEC_INBOUND. After a SIP_CODEC_INBOUND in the dialplan, do not continue with cached formats but remember the joint format. Cached formats contain default parameters, often create an empty fmtp line. However, a joint format might have passed format_get_joint(.) in a res_format_attr_* module (like Opus Codec) and contain the resulting format parameters from a SDP negotiation. ASTERISK-26691 #close Change-Id: I35712d98a793d4c3efdd156cec57deab9014b1dc 2017-01-03 15:14 +0000 [d7e5a747c3] George Joseph * pjproject_bundled: Compile pjsua with max log level = 2 A while back, we changed config_site.h to set PJ_LOG_MAX_LEVEL = 6. This allowed us to control the log level better from inside Asterisk. An unfortunate side effect of this was that the pjsua binary and python bindings were also compiled with log level set to 6 so whenever a testsuite test that uses pjsua runs, it spits out 6795 lines of debug in an instant even before the test starts. I believe this overruns the Jenkins capture buffer and prevents the test from properly terminating. In turn, this results in the testsuite just hanging until the job is killed. It's more frequent on the higher end agents because they can spit out the messages faster. Unfortunately, the messages are all spit out before we have control of the python pj.Lib instance where we can set logging levels so the only alternative was to actually compile pjsua and _pjsua.so with an overridden PJ_LOG_MAX_LEVEL. Although defining a lower max level was done in the Makefile, the define in config_site.h had to be wrapped with "#ifndef" so the change would take effect. Change-Id: I2af9e7d48dde1927279c586c9c725d868fe6f3ff 2016-12-22 16:00 +0000 [34e728cfb9] Joshua Colp * chan_pjsip: Use session for retrieving CHANNEL() information. The CHANNEL() dialplan function implementation for PJSIP allows querying of PJSIP specific information. This used the channel passed in to get the PJSIP session and associated information. It is possible for this channel to be masqueraded and end up as a different channel type by the time the information request is actually acted upon. This change retrieves the PJSIP session safely and accesses data from it (including channel). This provides a guarantee that the session and channel will not be altered when the request is being acted upon. ASTERISK-26673 Change-Id: I335e12b89e1820cafdd92b3e7526b8ba649eb7e6 2016-12-31 19:56 +0000 [a398f98b08] Joshua Elson * res_pjsip: Fix known compact header issues ASTERISK-26684 #close Change-Id: Ifd7e401c45015119dd5e8421dbfe3afa6381744a 2016-12-30 09:10 +0000 [0ab9d103f6] George Joseph * res_pjsip_refer: Handle compact Refer-To header. refer_incoming_refer_request needed to look for the "r" header as well as the "Refer-To" header. ASTERISK-26655 #close patches: refer_compact_fix.diff submitted by JoshE (license 6075) Change-Id: I610410a99b02427ea5db887aeb454d5f12c2259f 2016-12-23 12:11 +0000 [21151408f7] Richard Mudgett * bridge_native_rtp.c: Minor code cleanups. In native_rtp_bridge_compatible_check() * Made one variable declaration per line. * Extracted if test assignment to make the test easier to see. * Made long if tests easier to see the combinatorial logic. * Added bridge id to a couple debug messages. Change-Id: I65bc5732aa7c9a2537f062f106fbea711cf2daad 2016-12-23 12:10 +0000 [9dcf9e9cea] Richard Mudgett * bridge_native_rtp.c: Fix native rtp bridge data race. native_rtp_bridge_compatible() didn't lock the bridge channels before checking the channels for native bridging ability. As a result, one of the channel's native format capabilities structure got replaced out from under the native bridge check. Use of a stale pointer to freed memory causes bad things to happen. MALLOC_DEBUG, DO_CRASH, and the tests/channels/pjsip/transfers/blind_transfer/caller_direct_media testsuite test caught this. * Add missing channel locking in native_rtp_bridge_compatible(). Change-Id: If25fdb3ac8e85563c4857fb8216b3d9dc3d0fa53 2016-12-21 16:28 +0000 [a9e459f8ac] Richard Mudgett * res_rtp_asterisk.c: Fix uninitialized memory crash. ast_rtp_remote_address_set() could pass an uninitialized 'us' parameter to ast_ouraddrfor(). If ast_ouraddrfor() returns an error then the 'us' parameter may not get initialized. Thus when the code tries to save the 'us' parameter to the local address we could try to copy a ridiculous sized memory buffer and segfault. * Made pass an initialized 'us' parameter to ast_ouraddrfor(). * Optimized out the 'us' struct variable. ASTERISK-26672 #close Change-Id: I4acea5dcdf0813da2c7d3e11c2d6067d160d17dc 2016-12-21 17:55 +0000 [bcdd282ada] Richard Mudgett * res_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip(). We access uninitialized memory when the 'ourip' parameter does not have an initial guess to our IP address. ASTERISK-26672 Change-Id: I35507ea1ad7455d2be188f6ccdd4add7bd150e15 2016-12-21 16:25 +0000 [ac31233dbe] Richard Mudgett * acl.c: Improve ast_ouraddrfor() diagnostic messages. * Made not generate strings unless they will actually be used. ASTERISK-26672 Change-Id: I155fbe7fdff5ce47dfe5326f3baf5446849702c3 2016-12-21 17:54 +0000 [0aa5db4b38] Richard Mudgett * chan_rtp.c: Fix uninitialized memory crash. unicast_rtp_request() could pass an uninitialized 'us' parameter to ast_ouraddrfor(). If ast_ouraddrfor() returns an error then the 'us' parameter may not get initialized. Thus when the code tries to save the 'us' parameter to the local address we could try to copy a ridiculous sized memory buffer and segfault. * Made pass an initialized 'us' parameter to ast_ouraddrfor() and abort the UnicastRTP channel request if it fails. ASTERISK-26672 Change-Id: I1ef7a7c09f4da4f15dcb6de660d2bcac5f2a95c0 2016-12-07 15:23 +0000 [e2fa3c7eda] Richard Mudgett * res_rtp_asterisk.c: Fix off nominal memory leak. Change-Id: I95b1088d11244a2edae6607c12fbf33b38658a75 2016-12-09 12:23 +0000 [d13be4eff6] Martin Tomec * app_queue: Ensure member is removed from pending when hanging up. In some cases member is added to pending_members, and the channel is hung up before any extension state change. So the member would stay in pending_members forever. So when we call do_hang, we should also remove member from pending. ASTERISK-26621 #close Change-Id: Iae476b5c06481db18ebe0fa594b3e80fdc9a7d54 2016-12-18 15:23 +0000 [815f755155] George Joseph * pjproject_bundled: Make build single threaded There were just too many issues in various environments with multi threaded building of pjproject. It doesn't really speed things up anyway since asterisk is already being compiled in parallel. Change-Id: Ie5648fb91bb89b4224b6bf43a0daa1af793c4ce1 2016-12-08 20:00 +0000 [493849dcd7] Corey Farrell * chan_sip: Reorder unload_module to deal with stuck TCP threads. In some situations TCP threads may become frozen. This creates the possibility that Asterisk could segfault if they become unfrozen after chan_sip has been dlclose'd. This reorders the unload_module process to allow abort if threads do not exit within 5 seconds. High level order as follows: 1) Unregister from the core to stop new requests. 2) Signal threads to stop 3) Clear config based tables (but do not free the table itself). 4) Verify that threads have shutdown, cancel unload if not. 5) Clean all remaining resources. ASTERISK-26586 Change-Id: Ie23692041d838fbd35ece61868f4c640960ff882 2016-12-16 01:32 +0000 [ab447f8a6a] David M. Lee * configure: fix with-pjproject-bundled The AC_ARG_WITH macro's shell variable is withval; not enableval. Purely coincidentally, the option would work when --enable-dev-mode is given. Also fixed a portability problem with bootstrap.sh, since -printf is not a portable option for find. Change-Id: I0f0e5b1a934b5af5737713834361e9c95b96b376 2016-12-15 13:25 +0000 [35736d419a] Richard Mudgett * autosupport: Add 'pjproject show buildopts' Change-Id: I8aa55a7c3fb175235ddc7f85e9457d5102d06fa7 2016-12-14 14:21 +0000 [4b285d226d] Richard Mudgett * chan_dahdi.c: Fix bounds check regression. Caused by ASTERISK-25494 Change-Id: I1fc408c1a083745ff59da5c4113041bbfce54bcb 2016-12-13 14:34 +0000 [9114574188] Richard Mudgett * res_pjsip: Add/update ERROR msg if invalid URI. ASTERISK-24499 Change-Id: Ie305153e47e922233b2ff24715e0e326e5fa3a6c 2016-12-12 18:38 +0000 [75a6afbec5] Richard Mudgett * MESSAGE: Flush Message/ast_msg_queue channel alert pipe. ASTERISK-25083 Change-Id: Id54baa57a8dbca84e29f28bcd2ffc0a5ac12d8b2 2016-12-13 14:06 +0000 [91485734a4] George Joseph * res_sorcery_memory_cache: Change an error to a debug message When a sorcery user calls ast_sorcery_delete on an object that may have already expired from the cache, res_sorcery_memory_cache spits out an ERROR. Since this can happen frequently and validly when an inbound registration expires after the cache entry expired, the errors are unnecessary and misleading. Changed to a debug/1. Change-Id: Idf3a67038c16e3da814cf612ff4d6d18ad29ecd7 2016-12-09 08:14 +0000 [cd46e86491] George Joseph * pjproject_bundled: Retry download if previously saved tarball is bad If a tarball is corrupted during download, the makefile will attempt to download it again. If the tarball somehow gets corrupted after it's downloaded however, the makefile was just failing. We now retry the download. ASTERISK-26653 #close Change-Id: I1b24d454852d80186f60c5a65dc4624ea8a1c359 2016-12-08 12:54 +0000 [22820e10fe] Badalyan Vyacheslav * chan_sip: Delete unneeded check P is always true. We check it before Change-Id: Iee61cda002a9f61aee26b9f66c5f9b59e3389efb 2016-12-08 12:58 +0000 [6aa2c5e5f9] Badalyan Vyacheslav * Small code cleanup in chan_sip The conditional expressions of the 'if' operators situated alongside each other are identical. Change-Id: I2cf7c317b106ec14440c7f1b5dcfbf03639f748a 2016-12-08 12:43 +0000 [b596fac838] Badalyan Vyacheslav * Fix typo in chan_sip The conditional expressions of the 'if' operators situated alongside each other are identical. Change-Id: I652b6dcddb3be007e669a6aa8107edb31a1ddafb 2016-12-08 12:30 +0000 [483ed9f1aa] Badalyan Vyacheslav * res_pjsip: Fix 'A = B != C' kind. Consider reviewing the expression of the 'A = B != C' kind. The expression is calculated as following: 'A = (B != C)' Change-Id: Ibaa637dfda47d51a20e26069d3103e05ce80003d 2016-11-30 09:31 +0000 [41c6319c4e] Walter Doekes * chan_sip: Do not allow non-SP/HTAB between header key and colon. RFC says SIP headers look like: HCOLON = *( SP / HTAB ) ":" SWS SWS = [LWS] ; sep whitespace LWS = [*WSP CRLF] 1*WSP ; linear whitespace WSP = SP / HTAB ; from rfc2234 chan_sip implemented this: HCOLON = *( LOWCTL / SP ) ":" SWS LOWCTL = %x00-1F ; CTL without DEL This discrepancy meant that SIP proxies in front of Asterisk with chan_sip could pass on unknown headers with \x00-\x1F in them, which would be treated by Asterisk as a different (known) header. For example, the "To\x01:" header would gladly be forwarded by some proxies as irrelevant, but chan_sip would treat it as the relevant "To:" header. Those relying on a SIP proxy to scrub certain headers could mistakenly get unexpected and unvalidated data fed to Asterisk. This change fixes so chan_sip only considers SP/HTAB as valid tokens before the colon, making it agree on the headers with other speakers of SIP. ASTERISK-26433 #close AST-2016-009 Change-Id: I78086fbc524ac733b8f7f78cb423c91075fd489b 2016-11-14 18:18 +0000 [888142e891] Joshua Colp * res_format_attr_opus: Fix crash when fmtp contains spaces. When an opus offer or answer was received that contained an fmtp line with spaces between the attributes the module would fail to properly parse it and crash due to recursion. This change makes the module handle the space properly and also removes the recursion requirement. ASTERISK-26579 Change-Id: I01f53e5d9fa9f1925a7365f8d25071b5b3ac2dc3 2016-12-06 14:54 +0000 [ebc67d3053] George Joseph * res_pjsip_registrar: AMI Add RegistrationInboundContactStatuses command The PJSIPShowRegistrationsInbound AMI command was just dumping out all AORs which was pretty useless and resource heavy since it had to get all endpoints, then all aors for each endpoint, then all contacts for each aor. PJSIPShowRegistrationInboundContactStatuses sends ContactStatusDetail events which meets the intended purpose of the other command and has significantly less overhead. Also, some additional fields that were added to Contact since the original creation of the ContactStatusDetail event have been added to the end of the event. For compatibility purposes, PJSIPShowRegistrationsInbound is left intact. ASTERISK-26644 #close Change-Id: I326f12c9ecb52bf37ba03f0748749de4da01490a 2016-12-06 16:45 +0000 [d506874477] Richard Mudgett * Bundled pjproject: Fix finding SIP transactions. Occasionally SIP message transactions are not found when they should be. In the particular case an incoming INVITE transaction is CANCELed but the INVITE transaction cannot be found so a 481 response is returned for the CANCEL. The problematic calls have a '_' character in the Via branch parameter. The problem is in the pjproject PJ_HASH_USE_OWN_TOLOWER feature's code. The problem with the "own tolower" code is that it does not calculate the same hash value as when the pj_tolower() function is used. The "own tolower" code will erroneously modify the ASCII characters '@', '[', '\\', ']', '^', and '_'. Calls to pj_hash_calc_tolower() can use the PJ_HASH_USE_OWN_TOLOWER substitute algorithm when enabled. Calls to pj_hash_get_lower(), pj_hash_set_lower(), and pj_hash_set_np_lower() call find_entry() which never uses the PJ_HASH_USE_OWN_TOLOWER algorithm. As a result you may not be able to find a hash tabled entry because the calculated hash values would differ. * Simply disable PJ_HASH_USE_OWN_TOLOWER. ASTERISK-26490 #close Change-Id: If89bfdb5f301b8b685881a9a2a6e0c3c5af32253 2016-12-06 12:06 +0000 [4b233675d8] George Joseph * pjproject_bundled: Fix missing inclusion of symbols Added back in a -g3, and an -O3 when DONT_OPTIMIZE is not set, to the CFLAGS. Not sure how they went missing. Also fixed an uninstall problem where we weren't removing the symlink from libasteriskpj.so.2 to libasteriskpj.so. While I was there, I fixed it for libasteriskssl as well. Change-Id: I9e00873b1e9082d05b5549d974534b48a2142556 2016-12-02 12:04 +0000 [580f83dac7] Richard Mudgett * Remove files that got merged in error somehow to the 13 branch. Change-Id: Id79e2226c31084f9252d5aede9050d3cf13322c8 2016-11-30 18:25 +0000 [61ba2a014a] Richard Mudgett * res_pjsip_outbound_registration.c: Filter redundant statsd reporting. Increasing the testsuite shutdown timeout before forcibly killing Asterisk allowed more events to be sent out. Some tests failed as a result. The tests/channels/pjsip/statsd/registrations failed because we now get the statsd events that a comment in the test configuration stated couldn't be intercepted. Unfortunately, we get a variable number of events because of internal status state transition races generating redundant statsd events. We were reporting redundant statsd PJSIP.registrations.state changes for internal state changes that equated to the same thing publicly. * Made update_client_state_status() filter out redundant statsd updates. ASTERISK-26527 Change-Id: If851c7d514bb530d9226e4941ba97dcf52000646 2016-11-22 11:20 +0000 [2ceb609edb] Guido Falsi * res_rtp: Fix regression when IPv6 is not available. The latest Release candidate fails to create RTP streams when IPv6 is not available. Due to the changes made in September the ast_sockaddr structure passed around to create these streams is always of AF_INET6 type, causing failure when used for IPv4. This patch adds a utility function to check for availability of IPv6 and applies such check at startup to determine how to create the ast_sockaddr structures. ASTERISK-26617 #close Change-Id: I627a4e91795e821111e1cda523f083a40d0e0c3e 2016-11-28 19:43 +0000 [53459cdaa9] Eduardo S. Libardi * res_calendar_caldav: Add support reading gmail calendar The response from gmail calendar includes the string name "caldav:calendar-data". res_calendar_caldav implements the example included in RFC 4791: string "C:calendar-data". When reading the calendar, res_calendar_caldav compare the string and if does not match just discards the event. This commit compares the response to both strings, successfully loading gmail calendar events. Writing to gmail calendar is working prior to this fix. ASTERISK-26624 Reported by: Eduardo S. Libardi Change-Id: Ia1eef10552ae616efb645d390f5ffe81260d7d4a 2016-11-23 18:27 +0000 [44fe4a5769] Richard Mudgett * PJPROJECT logging: Made easier to get available logging levels. Use of the new logging is as simple as issuing the new CLI command or setting the new pjproject.conf option. Other options that can affect the logging are how you have the pjproject log levels mapped to Asterisk log types in pjproject.conf and if you have configured Asterisk to log the DEBUG type messages. Altering the pjproject.conf level mapping shouldn't be necessary for most installations as the default mapping is sensible. Configuring Asterisk to log the DEBUG message type is standard practice for collecting debug information. * Added CLI "pjproject set log level" command to dynamically adjust the maximum pjproject log message level. * Added CLI "pjproject show log level" command to see the currently set maximum pjproject log message level. * Added pjproject.conf startup section "log_level" option to set the initial maximum pjproject log message level so all messages could be captured from initialization. * Set PJ_LOG_MAX_LEVEL to 6 to compile in all defined logging levels into bundled pjproject. Pjproject will use the currently set run time log level to determine if a log message is generated just like Asterisk verbose and debug logging levels. * In log_forwarder(), made always log enabled and mapped pjproject log messages. DEBUG mapped log messages are no longer gated by the current Asterisk debug logging level. * Removed RAII_VAR() from res_pjproject.c:get_log_level(). ASTERISK-26630 #close Change-Id: I6dca12979f482ffb0450aaf58db0fe0f6d2e5389 2016-11-30 10:48 +0000 [17b0b91afa] Mark Michelson * Frame deferral: Re-queue deferred frames one-at-a-time. The recent change that made frame deferral into an API had a behavior change to it. When frame deferral was completed, we would take all of the deferred frames and queue them all onto the channel in one call to ast_queue_frame_head(). Before frame deferral was API-ized, places that performed manual frame deferral would actually take each deferred frame and queue them onto the channel. This change in behavior caused the confbridge_recording test to start failing consistently. Without going too crazily deep into the details, a channel was getting "stuck" in an ast_safe_sleep(). An AMI redirect was attempting to break it out of the sleep, but because there were more frames in the channel read queue than expected, the channel ended up being unable to break from its sleep loop. By restoring the behavior of individual frame queuing after deferral, the test starts passing again. Note, this points to a potential underlying issue pointing to an "unbalance" that can occur when queuing multiple frames at once, and so a follow-up issue is being created to investigate that possibility. Change-Id: Ied5dacacda06d343dea751ed5814a03364fe5a7d 2016-06-28 16:26 +0000 [b0c9f07f04] Tzafrir Cohen * OpenSSL 1.1.0 support OpenSSL 1.1.0 includes some major changes in the interface. See https://wiki.openssl.org/index.php/1.1_API_Changes . Status: Right now there are still a few deprecation notes with OpenSSL 1.1.0. But it's a start. Changes: * CRYPTO_LOCK is no longer available. Replace it with its value for now. I don't completely understand what it is used for there. * Remove several functions from libasteriskssl that seem to no longer be needed. * Structures have become opaque and are accesses with accessors. * ERR_remove_thread_state() no longer needed. * SSLv2 code now could no longer be used in 1.1. ASTERISK-26109 #close Change-Id: I5e29d477d486ca29b6aae0dc2f5dff960c1cb82b 2016-11-28 15:12 +0000 [a33ed3327a] Matt Jordan * res/res_pjsip: Fix documentation whitespace issues Tabs > Spaces. Change-Id: If1e43a71822615a898e958e0f8b2e882606f0bd0 2016-11-22 10:27 +0000 [09c36a6535] Matt Jordan * res_pjsip/chan_sip: Advertise 'ws' in the SIP URI transport parameter Per RFC 7118 5.2, the SIP URI 'transport' parameter should advertise 'ws' when WebSockets are to be used as the transport. This applies to both secure and insecure WebSockets. There were two bugs in Asterisk with respect to this: (1) The most egregious occurs in res_pjsip. There, we advertise 'ws' for insecure websockets and 'wss' for secure websockets. While this would seem to make sense - since 'WS' and 'WSS' are used for the Via Transport parameter - this is not the case for the SIP URI. This patch corrects that by registering the secure websockets with pjproject using the shorthand 'WS', and by returning 'ws' when asked for the transport parameter. Note that in pjproject, it is perfectly valid to have multiple transports use the same shorthand. (2) In chan_sip, we return an upper-case version of the transport 'WS' instead of 'ws'. Since we should be strict in what we send and liberal in what we accept (within reason), this patch lower-cases the transport before appending it to the parameter. ASTERISK-24330 #close Reported by: cervajs, Inaki Baz Castillo Change-Id: Iff77b645f8cc3b7cd35168a6676c26b147f22f42 2016-11-28 11:03 +0000 [29e887e9e1] George Joseph * build_tools: Fix download_externals to handle certified branches download_externals wasn't handling the "certified/13.x" version correctly. Change-Id: I124d195bb117ca36fd7bf1150c630f3b474a9d9a 2016-11-02 05:05 +0000 [bfb8c962c4] Tzafrir Cohen * autoconf: more variants for OSARCH linux-gnu There are quite a few odd GNU/Linux platforms. Just call all of them linux-gnu. Specifically this fixes building the Debian platforms mips64el and x32. And maybe also others. ASTERISK-26546 #close Change-Id: I06ec4bd7f0ee1c84b6b24d81538223b07c4174b1 2016-11-17 08:25 +0000 [a1fa909033] Timo Teräs * codec_dahdi: Fix poll.h include. POSIX defines poll.h. sys/poll.h should not be used as it is c-library internal header which may or may not exist. Notably in musl including sys/poll.h generates warning of being incorrect. Change-Id: Ib318c1c7142a737bcf3caa4d8d72560bebe39252 2016-11-26 10:57 +0000 [0cc8351484] Michael Kuron * chan_sip: Fix segfault during module unload If a TCP/TLS connection was pending (not accepted and not timed out) during unload of chan_sip, Asterisk would segfault when trying to send a signal to a thread whose thread ID hadn't been recorded yet. This commit fixes that by recording the thread ID before calling the blocking connect() syscall. This was a regression introduced by 776a14386a55b5425c7e9617eff8af8b45427144. The above wasn't enough to fix the segfault, which was now delayed to the point where connect() timed out. Therefore, it was necessary to also remove the SA_RESTART flag from the SIGURG sigaction so that pthread_kill() could be used to interruput the connect() syscall. This was a regression introduced by 5d313f51b982a18f7321adcf7c7a4e822d8b2714. ASTERISK-26586 #close Change-Id: I76fd9d47d56e4264e2629bce8ec15fecba673e7b 2016-11-11 08:16 +0000 [8756ce64b7] gestoip2 * res_rtp_asterisk: RTT miscalculation in RTCP When retrieving RTCP stats for PJSIP channels, RTT values are unreliable. RTT calculation is correct, but the data representation isn't. RTT is represented by a 32-bit fixed-point number with the integer part in the first 16 bits and the fractional part in the last 16 bits. In order to get the RTT value, the fractional part is miscalculated, there is an unnecessary 16 bit shift that causes overflow. Besides this there is another mistake, when transforming the integer value to the fixed point fractional part via bitwise operation, that loses precision. * RTT fractional part is no longer shifted, avoiding overflow. * RTT fractional part is transformed to its fixed-point value more precisely. * Fixed timeval2ntp() and ntp2timeval() second fraction conversions. * Fixed NTP timestamp report logging. The usec was inexplicably multiplied by 4096. ASTERISK-26566 #close Reported by Hector Royo Concepcion Change-Id: Ie09bdabfee75afb3f1b8ddfd963e5219ada3b96f 2016-11-15 13:44 +0000 [8e77d6f520] Michael Kuron * tcptls: Use new certificate upon sip reload Previously, a TLS server socket would only be restarted upon sip reload if the bind address had changed. This commit adds checking for changes to TLS parameters like certificate, ciphers, etc. so they get picked up without requiring a reload of the entire chan_sip module. This does not affect open connections in any way, but new connections will use the new TLS parameters. The changes also apply to HTTP and Manager. ASTERISK-26604 #close Change-Id: I169e86cefc6dcd627c915134015a6a1ab1aadbe6 2016-11-11 00:29 +0000 [86d824b7ff] Timo Teräs * addons/chan_mobile: do not use strerror_r The two reasons why it might be used are that some systems do not implement strerror in thread safe manner, and that strerror_r returns the error code in the string in case there's no error message. However, all of asterisk elsewhere uses strerror() and assumes it to be thread safe. And in chan_mobile the errno is also explicitly printed so neither of the above reasons are valid. The reasoning to remove usage is that there are actually two versions of strerror_r: XSI and GNU. They are incompatible in their return value, and there's no easy way to figure out which one is being used. glibc gives you the GNU version if _GNU_SOURCE is defined, but the same feature test macro is needed for other symbols. On all other systems you assumedly get XSI symbol, and compilation warnings as well as non-working error printing. Thus the easiest solution is to just remove strerror_r and use strerror as rest of the code. Alternative is to introduce ast_strerror in separate translation unit so it can request the XSI symbol in glibc case, and replace all usage of strerror. Change-Id: I84d35225b5642d85d48bc35fdf399afbae28a91d 2016-11-21 09:40 +0000 [425da14927] George Joseph * build: Backport addition of librt check to configure.ac A while back, a master-only change was made to check for librt which should probably have been cherry-picked to 13 at that time. Sometime between then and now, part of that change did make it into 13 but it was incomplete and non-functional. This patch backports the rest of the librt check and allows the link of libasteriskpj to use the results. Change-Id: I1424008fd8c90f389dda53162ec4a340b253a3c1 2016-11-16 12:05 +0000 [2a40c3a867] George Joseph * pjproject_bundled: Improve reliability of pjproject download The download process now has a timeout which will cause wget to retry if it stops retrieving data for 5 seconds and fetch and curl to timeout if the whole retrieval take smore than 30 seconds. If the tarball retrieval works, the MD5SUM file is retrieved from the downloads site and the md5 checksum is verified. If either the tarball retrieval or MD5SUM retrieval fails, or the checksums don't match, the entire process is retried once. If it fails again, any incomplete tarball is deleted. .DELETE_ON_ERROR: was also added to the Makefile. Not only does this delete the tarball on failure, it till also delete corrupted library files from the pjproject source directory should they fail to build correctly. Tested all the way back to FreeBSD 9, CentOS 6, Debian 6 and Ubuntu 14. Change-Id: Iea7d33b96a31622ab1b6e54baebaf271959514e1 2016-11-11 07:13 +0000 [12c4e664bc] Mikheili Dautashvili * main/app.c: Transmit Silence on ControlPlayback pause ASTERISK-26562 #close Change-Id: Ie6cb0ffc2b8c775639ce7784fe96f4ea00cfa2f8 2016-11-15 15:01 +0000 [cf6d13180e] Alexei Gradinari * chan_pjsip: fix switching sending codec when asymmetric_rtp_codec=no The sending codec is switched to the receiving codec and then is switched back to the best native codec on EVERY receiving RTP packets. This is because after call of ast_channel_set_rawwriteformat there is call of ast_set_write_format which calls set_format which sets rawwriteformat to the best native format. This patch adds a new function ast_set_write_format_path which set specific write path on channel and uses this function to switch the sending codec. ASTERISK-26603 #close Change-Id: I5b7d098f8b254ce8f45546e6c36e5d324737f71d 2016-11-10 13:34 +0000 [ee73af1d88] George Joseph * Update for 13.12.2 2016-11-04 10:57 +0000 [a3614d75f6] Kevin Harwell * Revert "chan_sip: Fix lastrtprx always updated" This reverts commit 93332cb1d0eea18021ea6538237297e627d6e2fc. Unfortunately, the aforementioned commit caused a regression (incoming calls would eventually disconnect). Thus it is being removed. ASTERISK-26523 #close ASTERISK-25270 Change-Id: Ibf5586adc303073a8eac667a4cbfdb6be184a64d 2016-10-27 13:48 +0000 [7d7b52c434] Mark Michelson * Update for 13.12.1 2016-10-26 07:51 +0000 [9c761b8f45] Joshua Colp * app_voicemail: Clear voice mailbox in MailboxExists and MAILBOX_EXISTS. When executing the MailboxExists dialplan application and MAILBOX_EXISTS dialplan function the passed in temporary voice mailbox was not cleared, causing it to try to free garbage. ASTERISK-26503 #close Change-Id: Ie21ccfa1b80b9c59318e596f6b8e17da2b5a7cb3 2016-10-25 14:13 +0000 [226a7e36c5] Mark Michelson * Update for 13.12.0 2016-10-17 14:08 +0000 [df75b647da] Mark Michelson * Update for 13.12.0-rc1 2017-12-13 14:34 +0000 Asterisk Development Team * asterisk certified/13.13-cert9 Released. 2017-11-30 10:12 +0000 [3eea735a39] Joshua Colp * AST-2017-012: Place single RTCP report block at beginning of report. When the RTCP code was transitioned over to Stasis a code change was made to keep track of how many reports are present. This count controlled where report blocks were placed in the RTCP report. If a compound RTCP packet was received this logic would incorrectly place a report block in the wrong location resulting in a write to an invalid location. This change removes this counting logic and always places the report block at the first position. If in the future multiple reports are supported the logic can be extended but for now keeping a count serves no purpose. ASTERISK-27382 ASTERISK-27429 Change-Id: Iad6c8a9985c4b608ef493e19c421211615485116 2017-12-05 18:04 +0000 [7c0bc72972] Richard Mudgett * CDR: Fix deadlock setting some CDR values. Setting channel variables with the AMI Originate action caused a deadlock when you set CDR(amaflags) or CDR(accountcode). This path has the channel locked when the CDR function is called. The CDR function then synchronously passes the job to a stasis thread. The stasis handling function then attempts to lock the channel. Deadlock results. * Avoid deadlock by making the CDR function handle setting amaflags and accountcode directly on the channel rather than passing it off to the CDR processing code under a stasis thread to do it. * Made the CHANNEL function and the CDR function process amaflags the same way. * Fixed referencing the wrong message type in cdr_prop_write(). ASTERISK-27460 Change-Id: I5eacb47586bc0b8f8ff76a19bd92d1dc38b75e8f 2017-12-01 19:42 +0000 Asterisk Development Team * asterisk certified/13.13-cert8 Released. 2017-11-30 14:38 +0000 [efeb9da0e7] George Joseph * AST-2017-013: chan_skinny: Call pthread_detach when sess threads end chan_skinny creates a new thread for each new session. In trying to be a good cleanup citizen, the threads are joinable and the unload_module function does a pthread_cancel() and a pthread_join() on any sessions that are active at that time. This has an unintended side effect though. Since you can call pthread_join on a thread that's already terminated, pthreads keeps the thread's storage around until you explicitly call pthread_join (or pthread_detach()). Since only the module_unload function was calling pthread_join, and even then only on the ones active at the tme, the storage for every thread/session ever created sticks around until asterisk exits. * A thread can detach itself so the session_destroy() function now calls pthread_detach() just before it frees the session memory allocation. The module_unload function still takes care of the ones that are still active should the module be unloaded. ASTERISK-27452 Reported by: Juan Sacco Change-Id: I9af7268eba14bf76960566f891320f97b974e6dd 2017-11-10 07:06 +0000 [191190a982] Joshua Colp * pjsip: Add patch to allow all transports to be destroyed. If a transport is created with the same transport type, source IP address, and source port as one that already exists the old transport is moved into a linked list called "tp_list". If this old transport is later shutdown it will not be destroyed as the process checks whether the transport is valid or not. This check does not look at the "tp_list" when making the determination causing the transport to not be destroyed. This change updates the logic to query not just the main storage method for transports but also the "tp_list". Upstream issue https://trac.pjsip.org/repos/ticket/2061 ASTERISK-27411 Change-Id: Ic5c2bb60226df0ef1c8851359ed8d4cd64469429 2017-11-08 16:59 +0000 Asterisk Development Team * asterisk certified/13.13-cert7 Released. 2017-10-19 13:53 +0000 [44f3d85cde] George Joseph * AST-2017-009: pjproject: Add validation of numeric header values Parsing the numeric header fields like cseq, ttl, port, etc. all had the potential to overflow, either causing unintended values to be captured or, if the values were subsequently converted back to strings, a buffer overrun. To address this, new "strto" functions have been created that do range checking and those functions are used wherever possible in the parser. * Created pjlib/include/limits.h and pjlib/include/compat/limits.h to either include the system limits.h or define common numeric limits if there is no system limits.h. * Created strto*_validate functions in sip_parser that take bounds and on failure call the on_str_parse_error function which prints an error message and calls PJ_THROW. * Updated sip_parser to validate the numeric fields. * Fixed an issue in sip_transport that prevented error messages from being properly displayed. * Added "volatile" to some variables referenced in PJ_CATCH blocks as the optimizer was sometimes optimizing them away. * Fixed length calculation in sip_transaction/create_tsx_key_2543 to account for signed ints being 11 characters, not 9. ASTERISK-27319 Reported by: Youngsung Kim at LINE Corporation Change-Id: I48de2e4ccf196990906304e8d7061f4ffdd772ff 2017-10-19 13:35 +0000 [1b31e3c3bd] Kevin Harwell * AST-2017-011 - res_pjsip_session: session leak when a call is rejected A previous commit made it so when an invite session transitioned into a disconnected state destruction of the Asterisk pjsip session object was postponed until either a transport error occurred or the event timer expired. However, if a call was rejected (for instance a 488) before the session was fully established the event timer may not have been initiated, or it was canceled without triggering either of the session finalizing states mentioned above. Really the only time destruction of the session should be delayed is when a BYE is being transacted. This is because it's possible in some cases for the session to be disconnected, but the BYE is still transacting. This patch makes it so the session object always gets released (no more memory leak) when the pjsip session is in a disconnected state. Except when the method is a BYE. Then it waits until a transport error occurs or an event timeout. ASTERISK-27345 #close Reported by: Corey Farrell Change-Id: I1e724737b758c20ac76d19d3611e3d2876ae10ed 2017-10-03 16:19 +0000 [178b372019] Richard Mudgett * AST-2017-010: Fix cdr_object_update_party_b_userfield_cb() buf overrun cdr_object_update_party_b_userfield_cb() could overrun the fixed buffer if the supplied string is too long. The long string could be supplied by external means using the CDR(userfield) function. This may seem reminiscent to AST-2017-001 (ASTERISK_26897) and it is. The earlier patch fixed the buffer overrun for Party A's userfield while this patch fixes the same thing for Party B's userfield. ASTERISK-27337 Change-Id: I0fa767f65ecec7e676ca465306ff9e0edbf3b652 2017-09-19 16:09 +0000 Asterisk Development Team * asterisk certified/13.13-cert6 Released. 2017-08-25 17:05 +0000 [88c8e8a11c] Richard Mudgett * AST-2017-008: Improve RTP and RTCP packet processing. Validate RTCP packets before processing them. * Validate that the received packet is of a minimum length and apply the RFC3550 RTCP packet validation checks. * Fixed potentially reading garbage beyond the received RTCP record data. * Fixed rtp->themssrc only being set once when the remote could change the SSRC. We would effectively stop handling the RTCP statistic records. * Fixed rtp->themssrc to not treat a zero value as special by adding rtp->themssrc_valid to indicate if rtp->themssrc is available. ASTERISK-27274 Make strict RTP learning more flexible. Direct media can cause strict RTP to attempt to learn a remote address again before it has had a chance to learn the remote address the first time. Because of the rapid relearn requests, strict RTP could latch onto the first remote address and fail to latch onto the direct media remote address. As a result, you have one way audio until the call is placed on and off hold. The new algorithm learns remote addresses for a set time (1.5 seconds) before locking the remote address. In addition, we must see a configured number of remote packets from the same address in a row before switching. * Fixed strict RTP learning from always accepting the first new address packet as the new stream. * Fixed strict RTP to initialize the expected sequence number with the last received sequence number instead of the last transmitted sequence number. * Fixed the predicted next sequence number calculation in rtp_learning_rtp_seq_update() to handle overflow. ASTERISK-27252 Change-Id: Ia2d3aa6e0f22906c25971e74f10027d96525f31c 2017-09-01 05:17 +0000 [67b1b028a1] George Joseph * stasis/control: Fix possible deadlock with swap channel If an error occurs during a bridge impart it's possible that the "bridge_after" callback might try to run before control_swap_channel_in_bridge has been signalled to continue. Since control_swap_channel_in_bridge is holding the control lock and the callback needs it, a deadlock will occur. * control_swap_channel_in_bridge now only holds the control lock while it's actually modifying the control structure and releases it while the bridge impart is running. * bridge_after_cb is now tolerant of impart failures. Change-Id: Ifd239aa93955b3eb475521f61e284fcb0da2c3b3 2017-08-31 15:48 +0000 Asterisk Development Team * asterisk certified/13.13-cert5 Released. 2017-07-01 19:24 +0000 [7ca7306012] Corey Farrell * AST-2017-006: Fix app_minivm application MinivmNotify command injection An admin can configure app_minivm with an externnotify program to be run when a voicemail is received. The app_minivm application MinivmNotify uses ast_safe_system() for this purpose which is vulnerable to command injection since the Caller-ID name and number values given to externnotify can come from an external untrusted source. * Add ast_safe_execvp() function. This gives modules the ability to run external commands with greater safety compared to ast_safe_system(). Specifically when some parameters are filled by untrusted sources the new function does not allow malicious input to break argument encoding. This may be of particular concern where CALLERID(name) or CALLERID(num) may be used as a parameter to a script run by ast_safe_system() which could potentially allow arbitrary command execution. * Changed app_minivm.c:run_externnotify() to use the new ast_safe_execvp() instead of ast_safe_system() to avoid command injection. * Document code injection potential from untrusted data sources for other shell commands that are under user control. ASTERISK-27103 Change-Id: I7552472247a84cde24e1358aaf64af160107aef1 2017-05-22 10:36 +0000 [1724a8c98f] Joshua Colp * res_rtp_asterisk: Only learn a new source in learn state. This change moves the logic which learns a new source address for RTP so it only occurs in the learning state. The learning state is entered on initial allocation of RTP or if we are told that the remote address for the media has changed. While in the learning state if we continue to receive media from the original source we restart the learning process. It is only once we receive a sufficient number of RTP packets from the new source that we will switch to it. Once this is done the closed state is entered where all packets that do not originate from the expected source are dropped. The learning process has also been improved to take into account the time between received packets so a flood of them while in the learning state does not cause media to be switched. Finally RTCP now drops packets which are not for the learned SSRC if strict RTP is enabled. ASTERISK-27013 Change-Id: I56a96e993700906355e79bc880ad9d4ad3ab129c 2017-07-11 07:26 +0000 [b189f8c5cf] George Joseph * res_musiconhold: Add kill_escalation_delay, kill_method to class By default, when res_musiconhold reloads or unloads, it sends a HUP signal to custom applications (and all descendants), waits 100ms, then sends a TERM signal, waits 100ms, then finally sends a KILL signal. An application which is interacting with an external device and/or spawns children of its own may not be able to exit cleanly in the default times, expecially if sent a KILL signal, or if it's children are getting signals directly from res_musiconhoild. * To allow extra time, the 'kill_escalation_delay' class option can be used to set the number of milliseconds res_musiconhold waits before escalating kill signals, with the default being the current 100ms. * To control to whom the signals are sent, the "kill_method" class option can be set to "process_group" (the default, existing behavior), which sends signals to the application and its descendants directly, or "process" which sends signals only to the application itself. Change-Id: Iff70a1a9405685a9021a68416830c0db5158603b 2017-06-29 18:27 +0000 [aa10dd31d0] Richard Mudgett * pjsip_distributor.c: Fix deadlock with TCP type transports. When a SIP message comes in on a transport, pjproject obtains the lock on the transport and pulls the data out of the socket. Unlike UDP, the TCP transport does not allow concurrent access. Without concurrency the transport lock is not released when the transport's message complete callback is called. The processing continues and eventually Asterisk starts processing the SIP message. The first thing Asterisk tries to do is determine the associated dialog of the message to determine the associated serializer. To get the associated serializer safely requires us to get the dialog lock. To send a request or response message for a dialog, pjproject obtains the dialog lock and then obtains the transport lock. Deadlock can result because of the opposite order the locks are obtained. * Fix the deadlock by obtaining the serializer associated with the dialog another way that doesn't involve obtaining the dialog lock. In this case, we use an ao2 container to hold the associated endpoint and serializer. The new locks are held a brief time and won't overlap other existing lock times. ASTERISK-27090 #close Change-Id: I9ed63f4da9649e9db6ed4be29c360968917a89bd 2017-06-29 14:50 +0000 [ef4a035371] George Joseph * chan_pjsip: Fix ability to send UPDATE on COLP When connected_line_method is "invite", we're supposed to determine if the client can support UPDATE and if it can, send UPDATE instead of INVITE to avoid the SDP renegotiation. Not only was pjproject not setting the PJSIP_INV_SUPPORT_UPDATE flag, we were testing that invite_tsx wasn't NULL which isn't always the case. * Updated chan_pjsip/update_connected_line_information to drop the requirement that invite_tsx isn't NULL. * Submitted patch to pjproject sip_inv.c that sets the PJSIP_INV_SUPPORT_UPDATE flag correctly. * Updated pjsip.conf.sample to clarify what happens when "invite" is specified. ASTERISK-27095 Change-Id: Ic2381b3567b8052c616d96fbe79564c530e81560 2017-06-20 15:41 +0000 [89aabfe10b] Kevin Harwell * core_local: local channel data not being properly unref'ed and unlocked In an earlier version of Asterisk a local channel [un]lock all functions were added in order to keep a crash from occurring when a channel hung up too early during an attended transfer. Unfortunately, when a transfer failure occurs and depending on the timing, the local channels sometime do not get properly unlocked and deref'ed after being locked and ref'ed. This happens because the underlying local channel structure gets NULLed out before unlocking. This patch reworks those [un]lock functions and makes sure the values that get locked and ref'ed later get unlocked and deref'ed. ASTERISK-27074 #close Change-Id: Ice96653e29bd9d6674ed5f95feb6b448ab148b09 2017-06-20 16:01 +0000 [9dcac3b7e3] Kevin Harwell * bridge: stuck channel(s) after failed attended transfer If an attended transfer failed it was possible for some of the channels involved to get "stuck" because Asterisk was not hanging up the transfer target. This patch ensures Asterisk hangs up the transfer target when an attended transfer failure occurs. ASTERISK-27075 #close Change-Id: I98a6ecd92d3461ab98c36f0d9451d23adaf3e5f9 2017-06-13 14:17 +0000 [adfdfdee61] Kevin Harwell * res_pjsip_refer/session: Calls dropped during transfer When doing an attended transfer it's possible for the transferer, after receiving an accepted response from Asterisk, to send a BYE to Asterisk, which can then be processed before Asterisk has time to start and/or complete the transfer process. This of course causes the transfer to not complete successfully, thus dropping the call. This patch makes it so any BYEs received from the transferer, after the REFER, that initiate a session end are deferred until the transfer is complete. This allows the channel that would have otherwise been hung up by Asterisk to remain available throughout the transfer process. ASTERISK-27053 #close Change-Id: I43586db79079457d92d71f1fd993be9a3b409d5a 2017-05-19 20:45 +0000 Asterisk Development Team * asterisk certified/13.13-cert4 Released. 2017-04-13 11:14 +0000 [7e8b57db67] gtjoseph * AST-2017-004: chan_skinny: Add EOF check in skinny_session The while(1) loop in skinny_session wasn't checking for EOF so a packet that was longer than a header but still truncated would spin the while loop infinitely. Not only does this permanently tie up a thread and drive a core to 100% utilization, the call of ast_log() in such a tight loop eats all available process memory. Added poll with timeout to top of read loop ASTERISK-26940 #close Reported-by: Sandro Gauci Change-Id: I2ce65f3c5cb24b4943a9f75b64d545a1e2cd2898 2017-04-13 17:17 +0000 [d0e628e792] Mark Michelson * AST-2017-003: Handle zero-length body parts correctly. ASTERISK-26939 #close Change-Id: I7ea235ab39833a187db4e078f0788bd0af0a24fd 2017-04-13 17:16 +0000 [14e57ba5b5] Mark Michelson * AST-2017-002: Ensure transaction key buffer is large enough. ASTERISK-26938 #close Change-Id: I266490792fd8896a23be7cb92f316b7e69356413 2017-04-04 12:37 +0000 Asterisk Development Team * asterisk certified/13.13-cert3 Released. 2017-03-27 09:03 +0000 [d91f264721] Corey Farrell * CDR: Protect from data overflow in ast_cdr_setuserfield. ast_cdr_setuserfield wrote to a fixed length field using strcpy. This could result in a buffer overrun when called from chan_sip or func_cdr. This patch adds a maximum bytes written to the field by using ast_copy_string instead. ASTERISK-26897 #close patches: 0001-CDR-Protect-from-data-overflow-in-ast_cdr_setuserfie.patch submitted by Corey Farrell (license #5909) Change-Id: Ib23ca77e9b9e2803a450e1206af45df2d2fdf65c 2017-03-14 09:27 +0000 [563b639e5a] Robert Mordec * app_queue: Member stuck as pending after forwarding previous call from queue Queue member will get stuck in pending_members if queue calls a device that is different from the one observed for state changes. This patch removes members from pending_members as a result of channel stasis events such as blind or attended transfers and hangup. ASTERISK-26862 #close Change-Id: I8bf6df487b9bb35726c08049ff25cdad5e357727 2017-03-07 18:43 +0000 Asterisk Development Team * asterisk certified/13.13-cert2 Released. 2016-11-15 15:01 +0000 [44cac45610] Alexei Gradinari * chan_pjsip: fix switching sending codec when asymmetric_rtp_codec=no The sending codec is switched to the receiving codec and then is switched back to the best native codec on EVERY receiving RTP packets. This is because after call of ast_channel_set_rawwriteformat there is call of ast_set_write_format which calls set_format which sets rawwriteformat to the best native format. This patch adds a new function ast_set_write_format_path which set specific write path on channel and uses this function to switch the sending codec. ASTERISK-26603 #close Change-Id: I5b7d098f8b254ce8f45546e6c36e5d324737f71d (cherry picked from commit cf6d13180effc92a2483dccc68f2f188689a40fa) 2017-02-13 17:11 +0000 [0d7f99a087] Richard Mudgett * pjproject: Fixes to resolve DNS SRV crashes. * Re #1945 (misc): Don't trigger SRV complete callback when there is a parse error. * srv_resolver.c: Don't try to send query if already considered resolved. ** In resolve_hostnames() don't try to resolve a query that is already considered resolved. ** In resolve_hostnames() fix DNS typo in comments. ** In build_server_entries() move a common expression assigning to cnt earlier. * sip_transport.c: Fix tdata object name to actually contain the pointer. It helps if the logs referencing a tdata object buffer actually have a name that includes the correct pointer as part of the name. Also since the tdata has its own pool it helps if any logs referencing the pool have the same name as the tdata object. This change brings tdata logging in line with how tsx objects are named. ASTERISK-26669 #close ASTERISK-26738 #close Change-Id: I56af2ded25476b3e870ca586ee69ed6954ef75af 2017-02-20 13:38 +0000 [35881858db] Richard Mudgett * pjproject: Increase SENDER_WIDTH column size for 64-bit system logs. ASTERISK-26669 ASTERISK-26738 Change-Id: Ibae6fc8cae69a1f04df0c577c4c11200499d6fe0 2017-02-06 14:26 +0000 [0d4412f2b3] Richard Mudgett * pjsip_distributor.c: Update some debug messages to get transaction name. * Removed overloaded unmatched response ignore. We obviously sent the request so we shouldn't ignore it because it isn't new work. ASTERISK-26669 ASTERISK-26738 Change-Id: I55fb5cadc83a8e6699b347c6dc7fa32c5a617d37 2017-02-04 16:00 +0000 [4af241ab60] Richard Mudgett * res_pjsip: Record the serializer earlier on the tdata. When PJPROJECT needs to do a DNS resolution and there is not a cached entry available, the SIP request message goes out on the PJSIP monitor thread instead of the original serializer thread. Thus when the response comes back it does not get processed by the original sending serializer. This patch records the serializer on tdata before passing a request message to PJPROJECT where it can in Asterisk code. There are several places in PJPROJECT for outbound registration and publishing support that would need to record the serializer. Unfortunately, without replacing the PJPROJECT DNS resolver as was done in v14 we cannot fix those without modifying PJPROJECT. Even if we backported the DNS resolver from v14, the outbound registration refresh timer does not go out on a serializer thread but the PJSIP monitor thread. Fortunately, Asterisk's outbound publish support doesn't use the auto refresh timer that would also not go out under the serializer thread. This patch is v13 only. ASTERISK-26669 ASTERISK-26738 Change-Id: I9997b9ed6dbcebd2c37d6a67dc6dcee9c78914a4 2017-02-13 19:25 +0000 Asterisk Development Team * asterisk certified/13.13-cert1 Released. 2017-02-08 12:58 +0000 [0ef6b6960d] gtjoseph * Update for certified/13.13-cert1-rc4 2017-02-08 11:50 +0000 [7603c4f32b] Mark Michelson * Revert "Update qualifies when AOR configuration changes." This reverts commit 6492e91392b8fd394193e411c6eb64b45486093f. The change in question was intended to prevent the need to reload in order to update qualifies on contacts when an AOR changes. However, this ended up causing a deadlock instead. Change-Id: I1a835c90a5bb65b6dc3a1e94cddc12a4afc3d71e 2017-02-03 13:58 +0000 [47febcb927] Mark Michelson * Update for certified/13.13-cert1-rc3 2017-01-31 18:28 +0000 [5c90c1e9f5] Richard Mudgett * channel.c: Fix unbalanced read queue deadlocking local channels. Using the timerfd timing module can cause channel freezing, lingering, or deadlock issues. The problem is because this is the only timing module that uses an associated alert-pipe. When the alert-pipe becomes unbalanced with respect to the number of frames in the read queue bad things can happen. If the alert-pipe has fewer alerts queued than the read queue then nothing might wake up the thread to handle received frames from the channel driver. For local channels this is the only way to wake up the thread to handle received frames. Being unbalanced in the other direction is less of an issue as it will cause unnecessary reads into the channel driver. ASTERISK-26716 is an example of this deadlock which was indirectly fixed by the change that found the need for this patch. * In channel.c:__ast_queue_frame(): Adding frame lists to the read queue did not add the same number of alerts to the alert-pipe. Correspondingly, when there is an exceptionally long queue event, any removed frames did not also remove the corresponding number of alerts from the alert-pipe. ASTERISK-26632 #close Change-Id: Ia98137c5bf6e9d6d202ce0eb36441851875863f6 2017-01-31 16:38 +0000 [5c2b7e34ff] Richard Mudgett * res_agi: Prevent an AGI from eating frames it should not. (Re-do) A dialplan intercept routine is equivalent to an interrupt routine. As such, the routine must be done quickly and you do not have access to the media stream. These restrictions are necessary because the media stream is the responsibility of some other code and interfering with or delaying that processing is bad. A possible future dialplan processing architecture change may allow the interception routine to run in a different thread from the main thread handling the media and remove the execution time restriction. * Made res_agi.c:run_agi() running an AGI in an interception routine run in DeadAGI mode. No touchy channel frames. ASTERISK-25951 ASTERISK-26343 ASTERISK-26716 Change-Id: I638f147ca7a7f2590d7194a8ef4090eb191e4e43 2017-01-31 16:32 +0000 [7d291e9ef7] Richard Mudgett * Frame deferral: Revert API refactoring. There are several issues with deferring frames that are caused by the refactoring. 1) The code deferring frames mishandles adding a deferred frame to the deferred queue. As a result the deferred queue can only be one frame long. 2) Deferrable frames can come directly from the channel driver as well as the read queue. These frames need to be added to the deferred queue. 3) Whoever is deferring frames is really only doing the __ast_read() to collect deferred frames and doesn't care about the returned frames except to detect a hangup event. When frame deferral is completed we must make the normal frame processing see the hangup as a frame anyway. As such, there is no need to have varying hangup frame deferral methods. We also need to be aware of the AST_SOFTHANGUP_ASYNCGOTO hangup that isn't real. That fake hangup is to cause the PBX thread to break out of loops to go execute a new dialplan location. 4) To properly deal with deferrable frames from the channel driver as pointed out by (2) above, means that it is possible to process a dialplan interception routine while frames are deferred because of the AST_CONTROL_READ_ACTION control frame. Deferring frames is not implemented as a re-entrant operation so you could have the unsupported case of two sections of code thinking they have control of the media stream. A worse problem is because of the bad implementation of the AMI PlayDTMF action. It can cause two threads to be deferring frames on the same channel at the same time. (ASTERISK_25940) * Rather than fix all these problems simply revert the API refactoring as there is going to be only autoservice and safe_sleep deferring frames anyway. ASTERISK-26343 ASTERISK-26716 #close Change-Id: I45069c779aa3a35b6c863f65245a6df2c7865496 2017-01-10 17:37 +0000 [640d3b21d1] Richard Mudgett * astobj2.c: Add excessive ref count trap. Change-Id: I32e6a589cf9009450e4ff7cb85c07c9d9ef7fe4a 2017-01-31 11:17 +0000 [107c8a7e19] Joshua Colp * res_pjsip: Handle invocation of callback on outgoing request when error occurs. There are some error cases in PJSIP when sending a request that will result in the callback for the request being invoked. The code did not handle this case and assumed on every error case that the callback was not invoked. The code has been changed to check whether the callback has been invoked and if so to absorb the error and treat it as a success. ASTERISK-26679 ASTERISK-26699 Change-Id: I563982ba204da5aa1428989a11c06dd9087fea91 2017-02-01 13:54 +0000 [3eb5f42090] Mark Michelson * Update qualifies when AOR configuration changes. Prior to this change, qualifies would only update in the following cases: * A reload of res_pjsip.so was issued. * A dynamic contact was re-registered after its AOR's qualify_frequency had been changed This does not work well if you are using realtime for your AORs. You can update your database to have a new qualify_frequency, but the permanent contacts on that AOR will not have their qualifies updated. And the dynamic contacts on that AOR will not have their qualifies updated until the next registration, which could be a long time. This change seeks to fix this problem by making it so that whenever AOR configuration is applied, the contacts pertaining to that AOR have their qualifies updated. Additions from this patch: * AOR sorcery objects now have an apply handler that calls into a newly added function in the OPTIONS code. This causes all contacts associated with that AOR to re-schedule qualifies. * When it is time to qualify a contact, the OPTIONS code checks to see if the AOR can still be retrieved. If not, then qualification is canceled on the contact. Alterations from this patch: * The registrar code no longer updates contact's qualify_frequence and qualify_timeout. There is no point to this since those values already get updated when the AOR changes. * Reloading res_pjsip.so no longer calls the OPTIONS initialization function. Reloading res_pjsip.so results in re-loading AORs, which results in re-scheduling qualifies. Change-Id: I2e7c3316da28f389c45954f24c4e9389abac1121 2017-01-31 12:46 +0000 [0611290911] gtjoseph * debug_utilities: Install ast_logescalator to /var/lib/asterisk/scripts Forgot to install it with the original patch Change-Id: I8bdb540a6694971ae5fe21f48d532332c6482e4c 2017-01-25 06:50 +0000 [805928c98b] gtjoseph * debug_utilities: Add ast_logescalator The escalator works by creating a set of startup commands in cli.conf that set up logger channels and issue the debug commands for the subsystems specified. If asterisk is running when it is executed, the same commands will be issued to the running instance. The original cli.conf is saved before any changes are made and can be restored by executing '$prog --reset'. The log output will be stored in... $astlogdir/message.$uniqueid $astlogdir/debug.$uniqueid $astlogdir/dtmf.$uniqueid $astlogdir/fax.$uniqueid $astlogdir/security.$uniqueid $astlogdir/pjsip_history.$uniqueid $astlogdir/sip_history.$uniqueid Some minor tweaks were made to chan_sip, and res_pjsip_history so their history output could be send to a log channel as packets are captured. A minor tweak was also made to manager so events are output to verbose when "manager set debug on" is issued. Change-Id: I799f8e5013b86dc5282961b27383d134bf09e543 2017-01-25 15:26 +0000 [1997157e7e] Mark Michelson * Add reload options to CLI/AMI stale object commands. Marking an object as stale in a memory cache is supposed to prime the cache so that the next time the item is retrieved, the stale item is deleted from the cache and a background task is run to re-populate the cache with a fresh version of the object. The problem is, there are some object types out there for which there is no natural reason that they would be retrieved from the backend with any regularity. Outbound PJSIP registrations are a good example of this. At startup, they are read, and an object-specific state is created that refers to the initially-retrieved object for all time. Adding the "reload" option to the CLI/AMI commands gives the cache the opportunity to manually re-retrieve the object from the backend, both storing the new object in the cache and applying the new object's configuration to the module that uses that object. Change-Id: Ieb1fe7270ceed491f057ec5cbf0e097bde96c5c8 2016-12-09 12:23 +0000 [92bdcfd57e] Martin Tomec * app_queue: Ensure member is removed from pending when hanging up. In some cases member is added to pending_members, and the channel is hung up before any extension state change. So the member would stay in pending_members forever. So when we call do_hang, we should also remove member from pending. ASTERISK-26621 #close Change-Id: Iae476b5c06481db18ebe0fa594b3e80fdc9a7d54 (cherry picked from commit d13be4eff699449172efbd9fed0ee97f6a790b6a) 2017-01-20 21:13 +0000 [9a4434eb74] Richard Mudgett * PJPROJECT logging: Fix detection of max supported log level. The mechanism used for detecting the maximum log level compiled into the linked pjproject did not work. The API call simply stores the requested level into an integer and does no range checking. Asterisk was assuming that there was range checking and limited the new value to the allowable range. To get the actual maximum log level compiled into the linked pjproject we need to get and save off the initial set log level from pjproject. This is the maximum log level supported. * Get and save off the initial log level setting before altering it to the desired level on startup. This has to be done by a macro rather than calling a core function to avoid incorrectly linking pjproject. * Split the initial log level warning messages to warn if the linked pjproject cannot support the requested startup level and if it is too low to get the pjproject buildopts for "pjproject show buildopts". * Adjust the CLI "pjproject set log level" to check the saved max log level and to generate normal output messages instead of a warning message. ASTERISK-26743 #close Change-Id: I40aa76653e2a1dece66c3f8734594b4f0471cfb4 2017-01-19 09:05 +0000 [6b0d734312] gtjoseph * ari: Implement 'debug all' and request/response logging The 'ari set debug' command has been enhanced to accept 'all' as an application name. This allows dumping of all apps even if an app hasn't registered yet. To accomplish this, a new global_debug global variable was added to res/stasis/app.c and new APIs were added to set and query the value. 'ari set debug' now displays requests and responses as well as events. This required refactoring the existing debug code. * The implementation for 'ari set debug' was moved from stasis/cli.{c,h} to ari/cli.{c,h}, and stasis/cli.{c,h} were deleted. * In order to print the body of incoming requests even if a request failed, the consumption of the body was moved from the ari stubs to ast_ari_callback in res_ari.c and the moustache templates were then regenerated. The body is now passed to ast_ari_invoke and then on to the handlers. This results in code savings since that template was inserted multiple times into all the stubs. An additional change was made to the ao2_str_container implementation to add partial key searching and a sort function. The existing cli code assumed it was already there when it wasn't so the tab completion was never working. Change-Id: Ief936f747ce47f1fb14035fbe61152cf766406bf 2017-01-23 09:10 +0000 [28733bb0ab] gtjoseph * pjproject_bundled: Fix setting max log level An earlier attempt to prevent pjsua from spitting out an extra 6795 lines of debug output every time the testsuite called it was also turning off the ability for asterisk to output debug info when it needed to. This patch reverts the earlier fix and instead adds a pjproject patch that sets the startup log level to 1 for pjsua pjsystest and the pjsua python binding. This is an asterisk-only patch that does not affect pjproject functionality and will not be submitted upstream. Change-Id: I347a8b58b2626f2906ccfc1d339e907627a0c9e8 2017-01-13 11:03 +0000 [0d2f17b22c] gtjoseph * debug_utilities: Create ast_loggrabber ast_loggrabber gathers log files from customizable search patterns, optionally converts POSIX timestamps to a readable format and tarballs the results. Also a few tweaks were made to ast_coredumper. Change-Id: I8bfe1468ada24c1344ce4abab7b002a59a659495 (cherry picked from commit 5fa1c56d7e76999aa14f133a33f6b168e7c3b99c) 2017-01-19 13:18 +0000 [92876c1c2a] Mark Michelson * Update for certified/13.13-cert1-rc2 2017-01-08 10:29 +0000 [52bee5df9e] gtjoseph * pjproject_bundled: Fix compilation with MALLOC_DEBUG When MALLOC_DEBUG was specified, make was failing. Immediately remaking would work. The issues was in the ordering of the make dependencies. Change-Id: If6030b54fc693f3179f32bfd20c6b5d5f1b3f7cd (cherry picked from commit f8cd73ec3c159f2e6c464952c92d8fdb69394371) 2017-01-03 15:14 +0000 [08857b6e0e] gtjoseph * pjproject_bundled: Compile pjsua with max log level = 2 A while back, we changed config_site.h to set PJ_LOG_MAX_LEVEL = 6. This allowed us to control the log level better from inside Asterisk. An unfortunate side effect of this was that the pjsua binary and python bindings were also compiled with log level set to 6 so whenever a testsuite test that uses pjsua runs, it spits out 6795 lines of debug in an instant even before the test starts. I believe this overruns the Jenkins capture buffer and prevents the test from properly terminating. In turn, this results in the testsuite just hanging until the job is killed. It's more frequent on the higher end agents because they can spit out the messages faster. Unfortunately, the messages are all spit out before we have control of the python pj.Lib instance where we can set logging levels so the only alternative was to actually compile pjsua and _pjsua.so with an overridden PJ_LOG_MAX_LEVEL. Although defining a lower max level was done in the Makefile, the define in config_site.h had to be wrapped with "#ifndef" so the change would take effect. Change-Id: I2af9e7d48dde1927279c586c9c725d868fe6f3ff (cherry picked from commit d7e5a747c312de18647213359103ce6022776864) 2016-12-18 15:23 +0000 [7aacc0fc7f] gtjoseph * pjproject_bundled: Make build single threaded There were just too many issues in various environments with multi threaded building of pjproject. It doesn't really speed things up anyway since asterisk is already being compiled in parallel. Change-Id: Ie5648fb91bb89b4224b6bf43a0daa1af793c4ce1 (cherry picked from commit 815f7551550908c83220196ba08742af0c745772) 2016-11-23 18:27 +0000 [3a8a42b404] Richard Mudgett * PJPROJECT logging: Made easier to get available logging levels. Use of the new logging is as simple as issuing the new CLI command or setting the new pjproject.conf option. Other options that can affect the logging are how you have the pjproject log levels mapped to Asterisk log types in pjproject.conf and if you have configured Asterisk to log the DEBUG type messages. Altering the pjproject.conf level mapping shouldn't be necessary for most installations as the default mapping is sensible. Configuring Asterisk to log the DEBUG message type is standard practice for collecting debug information. * Added CLI "pjproject set log level" command to dynamically adjust the maximum pjproject log message level. * Added CLI "pjproject show log level" command to see the currently set maximum pjproject log message level. * Added pjproject.conf startup section "log_level" option to set the initial maximum pjproject log message level so all messages could be captured from initialization. * Set PJ_LOG_MAX_LEVEL to 6 to compile in all defined logging levels into bundled pjproject. Pjproject will use the currently set run time log level to determine if a log message is generated just like Asterisk verbose and debug logging levels. * In log_forwarder(), made always log enabled and mapped pjproject log messages. DEBUG mapped log messages are no longer gated by the current Asterisk debug logging level. * Removed RAII_VAR() from res_pjproject.c:get_log_level(). ASTERISK-26630 #close Change-Id: I6dca12979f482ffb0450aaf58db0fe0f6d2e5389 2017-01-10 18:10 +0000 [8e5e3c2b0c] gtjoseph * debug_utilities: Create the ast_coredumper utility This utility allows easy manipulation of asterisk coredumps. * Configurable search paths and patterns for existing coredumps * Can generate a consistent coredump from the running instance * Can dump the lock_infos table from a coredump * Dumps backtraces to separate files... - thread apply 1 bt full -> .thread1.txt - thread apply all bt -> .brief.txt - thread apply all bt full -> .full.txt - lock_infos table -> .locks.txt * Can tarball corefiles and optionally delete them after processing * Can tarball results files and optionally delete them after processing * Converts ':' in coredump and results file names '-' to facilitate uploading. Jira for instance, won't accept file names with colons in them. Tested on Fedora24+, Ubuntu14+, Debian6+, CentOS6+ and FreeBSD9+[1]. [1] For *BSDs, the "devel/gdb" package might have to be installed to get a recent gdb. The utility will check all instances of gdb it finds in $PATH and if one isn't found that can run python, it prints a friendly error. Change-Id: I935d37ab9db85ef923f32b05579897f0893d33cd (cherry picked from commit 47474cfd54a9185c1433464ccfd6301427a03957) 2016-12-22 16:00 +0000 [cedf8a21a1] Joshua Colp * chan_pjsip: Use session for retrieving CHANNEL() information. The CHANNEL() dialplan function implementation for PJSIP allows querying of PJSIP specific information. This used the channel passed in to get the PJSIP session and associated information. It is possible for this channel to be masqueraded and end up as a different channel type by the time the information request is actually acted upon. This change retrieves the PJSIP session safely and accesses data from it (including channel). This provides a guarantee that the session and channel will not be altered when the request is being acted upon. ASTERISK-26673 Change-Id: I335e12b89e1820cafdd92b3e7526b8ba649eb7e6 2016-12-23 12:10 +0000 [92235dba88] Richard Mudgett * bridge_native_rtp.c: Fix native rtp bridge data race. native_rtp_bridge_compatible() didn't lock the bridge channels before checking the channels for native bridging ability. As a result, one of the channel's native format capabilities structure got replaced out from under the native bridge check. Use of a stale pointer to freed memory causes bad things to happen. MALLOC_DEBUG, DO_CRASH, and the tests/channels/pjsip/transfers/blind_transfer/caller_direct_media testsuite test caught this. * Add missing channel locking in native_rtp_bridge_compatible(). Change-Id: If25fdb3ac8e85563c4857fb8216b3d9dc3d0fa53 2016-12-21 16:28 +0000 [d8747659f0] Richard Mudgett * res_rtp_asterisk.c: Fix uninitialized memory crash. ast_rtp_remote_address_set() could pass an uninitialized 'us' parameter to ast_ouraddrfor(). If ast_ouraddrfor() returns an error then the 'us' parameter may not get initialized. Thus when the code tries to save the 'us' parameter to the local address we could try to copy a ridiculous sized memory buffer and segfault. * Made pass an initialized 'us' parameter to ast_ouraddrfor(). * Optimized out the 'us' struct variable. ASTERISK-26672 #close Change-Id: I4acea5dcdf0813da2c7d3e11c2d6067d160d17dc 2016-12-21 17:54 +0000 [a9400da2d3] Richard Mudgett * chan_rtp.c: Fix uninitialized memory crash. unicast_rtp_request() could pass an uninitialized 'us' parameter to ast_ouraddrfor(). If ast_ouraddrfor() returns an error then the 'us' parameter may not get initialized. Thus when the code tries to save the 'us' parameter to the local address we could try to copy a ridiculous sized memory buffer and segfault. * Made pass an initialized 'us' parameter to ast_ouraddrfor() and abort the UnicastRTP channel request if it fails. ASTERISK-26672 Change-Id: I1ef7a7c09f4da4f15dcb6de660d2bcac5f2a95c0 2016-12-21 17:55 +0000 [a2c695cd18] Richard Mudgett * res_rtp_asterisk.c: Initialize ourip passed to ast_find_ourip(). We access uninitialized memory when the 'ourip' parameter does not have an initial guess to our IP address. ASTERISK-26672 Change-Id: I35507ea1ad7455d2be188f6ccdd4add7bd150e15 2016-12-21 16:25 +0000 [a3502c1885] Richard Mudgett * acl.c: Improve ast_ouraddrfor() diagnostic messages. * Made not generate strings unless they will actually be used. ASTERISK-26672 Change-Id: I155fbe7fdff5ce47dfe5326f3baf5446849702c3 2016-12-14 14:21 +0000 [a3da3bb406] Richard Mudgett * chan_dahdi.c: Fix bounds check regression. Caused by ASTERISK-25494 Change-Id: I1fc408c1a083745ff59da5c4113041bbfce54bcb 2016-12-13 14:34 +0000 [1bb47bc3b0] Richard Mudgett * res_pjsip: Add/update ERROR msg if invalid URI. ASTERISK-24499 Change-Id: Ie305153e47e922233b2ff24715e0e326e5fa3a6c 2016-12-12 18:38 +0000 [ee9c8d0c97] Richard Mudgett * MESSAGE: Flush Message/ast_msg_queue channel alert pipe. ASTERISK-25083 Change-Id: Id54baa57a8dbca84e29f28bcd2ffc0a5ac12d8b2 2016-12-13 14:06 +0000 [a209faa94f] gtjoseph * res_sorcery_memory_cache: Change an error to a debug message When a sorcery user calls ast_sorcery_delete on an object that may have already expired from the cache, res_sorcery_memory_cache spits out an ERROR. Since this can happen frequently and validly when an inbound registration expires after the cache entry expired, the errors are unnecessary and misleading. Changed to a debug/1. Change-Id: Idf3a67038c16e3da814cf612ff4d6d18ad29ecd7 2016-11-30 09:31 +0000 [2021b5380d] Walter Doekes * chan_sip: Do not allow non-SP/HTAB between header key and colon. RFC says SIP headers look like: HCOLON = *( SP / HTAB ) ":" SWS SWS = [LWS] ; sep whitespace LWS = [*WSP CRLF] 1*WSP ; linear whitespace WSP = SP / HTAB ; from rfc2234 chan_sip implemented this: HCOLON = *( LOWCTL / SP ) ":" SWS LOWCTL = %x00-1F ; CTL without DEL This discrepancy meant that SIP proxies in front of Asterisk with chan_sip could pass on unknown headers with \x00-\x1F in them, which would be treated by Asterisk as a different (known) header. For example, the "To\x01:" header would gladly be forwarded by some proxies as irrelevant, but chan_sip would treat it as the relevant "To:" header. Those relying on a SIP proxy to scrub certain headers could mistakenly get unexpected and unvalidated data fed to Asterisk. This change fixes so chan_sip only considers SP/HTAB as valid tokens before the colon, making it agree on the headers with other speakers of SIP. ASTERISK-26433 #close AST-2016-009 Change-Id: I78086fbc524ac733b8f7f78cb423c91075fd489b 2016-11-14 18:18 +0000 [d27eae001d] Joshua Colp * res_format_attr_opus: Fix crash when fmtp contains spaces. When an opus offer or answer was received that contained an fmtp line with spaces between the attributes the module would fail to properly parse it and crash due to recursion. This change makes the module handle the space properly and also removes the recursion requirement. ASTERISK-26579 Change-Id: I01f53e5d9fa9f1925a7365f8d25071b5b3ac2dc3 2016-12-06 14:54 +0000 [f243f7fb4b] gtjoseph * res_pjsip_registrar: AMI Add RegistrationInboundContactStatuses command The PJSIPShowRegistrationsInbound AMI command was just dumping out all AORs which was pretty useless and resource heavy since it had to get all endpoints, then all aors for each endpoint, then all contacts for each aor. PJSIPShowRegistrationInboundContactStatuses sends ContactStatusDetail events which meets the intended purpose of the other command and has significantly less overhead. Also, some additional fields that were added to Contact since the original creation of the ContactStatusDetail event have been added to the end of the event. For compatibility purposes, PJSIPShowRegistrationsInbound is left intact. ASTERISK-26644 #close Change-Id: I326f12c9ecb52bf37ba03f0748749de4da01490a 2016-12-06 16:45 +0000 [c7c2db5a29] Richard Mudgett * Bundled pjproject: Fix finding SIP transactions. Occasionally SIP message transactions are not found when they should be. In the particular case an incoming INVITE transaction is CANCELed but the INVITE transaction cannot be found so a 481 response is returned for the CANCEL. The problematic calls have a '_' character in the Via branch parameter. The problem is in the pjproject PJ_HASH_USE_OWN_TOLOWER feature's code. The problem with the "own tolower" code is that it does not calculate the same hash value as when the pj_tolower() function is used. The "own tolower" code will erroneously modify the ASCII characters '@', '[', '\\', ']', '^', and '_'. Calls to pj_hash_calc_tolower() can use the PJ_HASH_USE_OWN_TOLOWER substitute algorithm when enabled. Calls to pj_hash_get_lower(), pj_hash_set_lower(), and pj_hash_set_np_lower() call find_entry() which never uses the PJ_HASH_USE_OWN_TOLOWER algorithm. As a result you may not be able to find a hash tabled entry because the calculated hash values would differ. * Simply disable PJ_HASH_USE_OWN_TOLOWER. ASTERISK-26490 #close Change-Id: If89bfdb5f301b8b685881a9a2a6e0c3c5af32253 2016-12-06 12:06 +0000 [221e838b26] gtjoseph * pjproject_bundled: Fix missing inclusion of symbols Added back in a -g3, and an -O3 when DONT_OPTIMIZE is not set, to the CFLAGS. Not sure how they went missing. Also fixed an uninstall problem where we weren't removing the symlink from libasteriskpj.so.2 to libasteriskpj.so. While I was there, I fixed it for libasteriskssl as well. Change-Id: I9e00873b1e9082d05b5549d974534b48a2142556 2016-11-30 10:48 +0000 [492b37429c] Mark Michelson * Frame deferral: Re-queue deferred frames one-at-a-time. The recent change that made frame deferral into an API had a behavior change to it. When frame deferral was completed, we would take all of the deferred frames and queue them all onto the channel in one call to ast_queue_frame_head(). Before frame deferral was API-ized, places that performed manual frame deferral would actually take each deferred frame and queue them onto the channel. This change in behavior caused the confbridge_recording test to start failing consistently. Without going too crazily deep into the details, a channel was getting "stuck" in an ast_safe_sleep(). An AMI redirect was attempting to break it out of the sleep, but because there were more frames in the channel read queue than expected, the channel ended up being unable to break from its sleep loop. By restoring the behavior of individual frame queuing after deferral, the test starts passing again. Note, this points to a potential underlying issue pointing to an "unbalance" that can occur when queuing multiple frames at once, and so a follow-up issue is being created to investigate that possibility. Change-Id: Ied5dacacda06d343dea751ed5814a03364fe5a7d 2016-11-28 11:03 +0000 [d4d1909077] gtjoseph * build_tools: Fix download_externals to handle certified branches download_externals wasn't handling the "certified/13.x" version correctly. Change-Id: I124d195bb117ca36fd7bf1150c630f3b474a9d9a 2016-11-23 15:58 +0000 [33a0d64eab] Kevin Harwell * Update for certified/13.13-cert1-rc1 2016-11-23 15:20 +0000 [907160ee21] Kevin Harwell * app_talkdectect: Now core supported, enable for cert Change-Id: Ic0b2cacb21a6e11a25ebbff7e508e106ea156f6c 2016-11-23 15:01 +0000 [0cd0495732] Kevin Harwell * Disable extended support modules Change-Id: Ib6b4f9451b5b68b738d8ab07a27de1c87c28f819 2016-11-23 14:57 +0000 [854196eea9] Kevin Harwell * .version: Update for certified/13.13 Change-Id: Ia1a0f035359d88b8885c7aca22f0d70b73aeb05d 2016-11-23 09:26 +0000 [fdde690e0f] Kevin Harwell * Update for 13.13.0 2016-11-22 12:02 +0000 [f93e55d124] Kevin Harwell * Update for 13.13.0-rc2 2016-11-21 09:40 +0000 [e246b36a3c] gtjoseph * build: Backport addition of librt check to configure.ac A while back, a master-only change was made to check for librt which should probably have been cherry-picked to 13 at that time. Sometime between then and now, part of that change did make it into 13 but it was incomplete and non-functional. This patch backports the rest of the librt check and allows the link of libasteriskpj to use the results. Change-Id: I1424008fd8c90f389dda53162ec4a340b253a3c1 2016-11-22 11:20 +0000 [855f05e525] Kevin Harwell * Update for 13.13.0 2016-11-18 12:59 +0000 [751d43e8e4] Joshua Colp * Update for 13.13.0-rc1 2016-11-18 09:45 +0000 [cb624b10ae] Mark Michelson * Bump ARI version to 1.10.0 The video-related bridge changes mean that the version needs to be bumped. Change-Id: I41c4495068562bef03aa76728f188b8ac4bd393d 2016-11-17 10:50 +0000 [bde3d022a3] Mark Michelson * manager: update minor version Based on bridge video AMI event changes, bump the minor version of AMI. Change-Id: I02586bd6cafc0baa33ea98c2f75356c0f5e03435 2016-11-16 20:24 +0000 [b213045fe4] gtjoseph * build: Various OpenBSD issues OpenBSD's 'find' doesn't take the -delete argument so you have to pipe through 'xargs rm -rf'. 'echo -e' doesn't like \t starting a line. It just prints 't' which causes the libasteriskpj.exports file to be garbage. They were just cosmetic so they were removed. librt doesn't exist so the link of libasteriskpj.so fails. It's not actually needed for linux anyway so -lrt was removed from the link. res_rtp_asterisk was failing to load because of an undefined DTLS_method. '|| defined(LIBRESSL_VERSION_NUMBER)' was added to the #if so DTLSv1_method is used instead. ASTERISK-26608 Change-Id: I926ec95b0b69633231e3ad1d6e803b977272c49c 2016-11-14 18:45 +0000 [404596b790] gtjoseph * channel: Fix issues in hangup scenarios caused by frame deferral ASTERISK-26343 Change-Id: I06dbf7366e26028251964143454a77d017bb61c8 2016-11-16 15:42 +0000 [2c031b67d3] Mark Michelson * res_format_attr_opus: Fix fmtp generation. res_format_attr_opus assumed that the string being passed into it was empty. It tried to determine if the only thing it had written was a=fmtp: And if it had, it would reset the string. Its calculation was off when working with chan_sip, though. chan_sip passes the entire built SDP rather than an empty string. This resulted in always putting an empty fmtp line in the SDP. ASTERISK-26520 #close Reported by scgm11 Change-Id: Ib2e8712d26a47067e5f36d5973577added01dbb5 2016-11-15 16:23 +0000 [ed0f1afc8c] Richard Mudgett * codec_opus: Fix warning when Opus negotiated but codec_opus not loaded. When Opus is negotiated but not loaded, the log is spammed with messages because the system does not know how to calculate the number of samples in a frame. * Suppress the warning by supplying a function that assumes 20ms of samples in the frame. For pass through support it doesn't really seem to matter what number of samples is returned anyway. ASTERISK-26605 #close Change-Id: Icf2273692f040dc2c45b01e72a790d11092f9e0f 2016-11-14 14:36 +0000 [e632222bc4] Richard Mudgett * res_pjsip_outbound_authenticator_digest.c: Fix memory pool leak. Responding to authentication challenges leaks PJSIP memory pools. The leak was introduced with a pjproject 2.5.5 API change. https://trac.pjsip.org/repos/ticket/1929 changed the API usage of pjsip_auth_clt_init() to require the new API pjsip_auth_clt_deinit() to clean up cached authentication allocations that get allocated with pjsip_auth_clt_reinit_req(). ASTERISK-26516 #close Change-Id: I4473141b8c3961d0dc91c382beb3876b3efb45c8 2016-11-15 12:01 +0000 [c92dcc76da] gtjoseph * file.c/__ast_file_read_dirs: Fix issues on filesystems without d_type One of the code paths in __ast_file_read_dirs will only get executed if the OS doesn't support dirent->d_type OR if the filesystem the particular file is on doesn't support it. So, while standard Linux systems support the field, some filesystems like XFS do not. In this case, we need to call stat() to determine whether the directory entry is a file or directory so we append the filename to the supplied directory path and call stat. We forgot to truncate path back to just the directory afterwards though so we were passing a complete file name to the callback in the dir_name parameter instead of just the directory name. The logic has been re-written to only create a full_path if we need to call stat() or if we need to descend into another directory. Change-Id: I54e4228bd8355fad65200c6df3ec4c9c8a98dfba 2015-05-14 17:12 +0000 [7b96e8cc3d] Maciej Szmigiero * Add X.509 subject alternative name support to TLS certificate verification. This way one X.509 certificate can be used for hosts that can be reached under multiple DNS names or for multiple hosts. Signed-off-by: Maciej Szmigiero ASTERISK-25063 #close Change-Id: I13302c80490a0b44c43f1b45376c9bd7b15a538f 2016-11-14 15:57 +0000 [0790aa528a] Matt Jordan * pjproject: Use a much higher limit for PJ_ICE_MAX_CHECKS The PJ_ICE_MAX_CHECKS constant is used by pjproject to determine how many pairs of local/remote candidates will be made. If for some reason we reach this upper bound, ICE will generally fail and no media will flow between the browser and Asterisk. This patch makes PJ_ICE_MAX_CHECKS set to the total possible number of pairs of candidates we'd theoretically allow, which is PJ_ICE_MAX_CAND^2. Prior to this patch, we simply multiplied PJ_ICE_MAX_CAND by two; on systems with multiple interfaces (I blame Docker), this is far too low to allow WebRTC calls to succeed. Setting this to be PJ_ICE_MAX_CAND^2 allowed WebRTC calls to succeed even when the system Asterisk was running on had quite a few virtual interfaces. Change-Id: Icd4f17de0ac9d3a83dddfc8bf1cb7616bc107d55 2016-11-14 15:32 +0000 [993a6f96c7] Matt Jordan * apps/app_echo: Only relay a single video source change frame In 9785e8d0, app_echo was updated to relay video source updates to the channel for the purposes of displaying video in WebRTC tests. Unfortunately, this can cause a Kafkaesque nightmare if two or more Local channels are in a bridge together where their ends are in app_echo. When this situation occurs, a video update sent into app_echo will cause the video update to be relayed to the other Local channels, causing another round of video updates, etc. In not much time at all, the channel length queues will be overwhelmed, channel alert pipes will fail, and all hell will break loose as Asterisk merrily continues to throw more video update requests onto the channels. This patch updates app_echo to *only* relay a single video update. Once a video update has been made, all further video updates are dropped. This meets the intended purpose of the original patch: if we get a video update and we're in app_echo, go ahead and ask the sender to update themselves. However, once we've got that video stream sync'd up, don't keep spamming the world. Change-Id: I9210780b08d4c17ddb38599d1c64453adfc34f74 2016-11-08 10:11 +0000 [d23b4af477] Matt Jordan * res/ari/resource_bridges: Add the ability to manipulate the video source In multi-party bridges, Asterisk currently supports two video modes: * Follow the talker, in which the speaker with the most energy is shown to all participants but the speaker, and the speaker sees the previous video source * Explicitly set video sources, in which all participants see a locked video source Prior to this patch, ARI had no ability to manipulate the video source. This isn't important for two-party bridges, in which Asterisk merely relays the video between the participants. However, in a multi-party bridge, it can be advantageous to allow an external application to manipulate the video source. This patch provides two new routes to accomplish this: (1) setVideoSource: POST /bridges/{bridgeId}/videoSource/{channelId} Sets a video source to an explicit channel (2) clearVideoSource: DELETE /bridges/{bridgeId}/videoSource Removes any explicit video source, and sets the video mode to talk detection ASTERISK-26595 #close Change-Id: I98e455d5bffc08ea5e8d6b84ccaf063c714e6621 2016-11-14 14:22 +0000 [404a62eeee] gtjoseph * Revert "Revert "channel: Use frame deferral API for safe sleep."" This reverts commit 58c88cfbaa80cb43419cde9186d643d1c5d24baf. Change-Id: I72692e2b2e83ef6da9390075ff20b138b2c374b6 2016-11-14 14:22 +0000 [09d8febc91] gtjoseph * Revert "Revert "autoservice: Use frame deferral API"" This reverts commit 1df434e2b4bd7cc34b9b4addf405a3caa7ac16b8. Change-Id: Id2b8a8bccbb4bbdd82b792275d4cd6f32563e401 2016-11-14 14:21 +0000 [ffad2b44df] gtjoseph * Revert "Revert "AGI: Only defer frames when in an interception routine."" This reverts commit 6be5d8de0da7e804544507f70382425af9a07b3f. Change-Id: I4b548137f52ae0686d8f09e21496b778d1c6a797 2016-11-14 14:21 +0000 [2fefb6187f] gtjoseph * Revert "Revert "Add API for channel frame deferral."" This reverts commit 6b5a7ced136b7178ae0b2ba39221eba1cd2e37c9. Change-Id: I61d1dbb2e69e1977f684b7dfc8e98211024e1cd1 2016-11-14 12:16 +0000 [5e0c224043] gtjoseph * cli: Fix ast_el_read_char to work with libedit >= 3.1 Libedit 3.1 is not build with unicode on as a default and so the prototype for the el_gets callback changed from expecting a char buffer to accepting a wchar buffer. If ast_el_read_char isn't changed, the cli reads garbage from teh terminal. Added a configure test for (*el_rfunc_t)(EditLine *, wchar_t *) and updated ast_el_read_char to use the HAVE_ define to detemrine whether to use char or wchar. ASTERISK-26592 #close Change-Id: I9099b46f68e06d0202ff80e53022a2b68b08871a 2016-11-11 02:41 +0000 [3faca1d4ff] Igor Goncharovskiy * Fix closing rtp ports after call finished in chan_unistim. Fix ASTERISK-26565 by adding ast_rtp_instance_stop before rtp instance destroy for chan_unistim. Also several fixes for displayed text translation. Change-Id: If42a03eea09bd1633471406bdc829cf98bf6affc 2016-09-23 17:54 +0000 [412d43fa21] Richard Mudgett * res_pjsip.c: Rework endpt_send_request() req_wrapper code. * Don't hold the req_wrapper lock too long in endpt_send_request(). We could block the PJSIP monitor thread if the timeout timer expires. sip_get_tpselector_from_endpoint() does a sorcery access that could take awhile accessing a database. pjsip_endpt_send_request() might take awhile if selecting a transport. * Shorten the time that the req_wrapper lock is held in the callback functions. * Simplify endpt_send_request() req_wrapper->timeout code. * Removed some redundant req_wrapper->timeout_timer->id assignments. Change-Id: I3195e3a8e0207bb8e7f49060ad2742cf21a6e4c9 2016-09-21 15:10 +0000 [2e7fc56d3c] Richard Mudgett * res_pjsip: Fix tdata leaks in off nominal paths. Change-Id: Ie83e06e88c2d60157775263b07e40b61718ac97b 2016-10-24 12:41 +0000 [da68b185b3] Richard Mudgett * res_pjsip_registrar_expire.c: Remove extra linefeed in debug message. Change-Id: I1f9adb911f23376503396ec8867e8005b755eb94 2016-11-10 10:57 +0000 [b70eb07c53] Joshua Colp * res_pjsip_sdp_rtp: Reject offer of required SRTP without res_srtp. When optimistic SRTP was on it was possible for us to still set up a call without an audio stream if an offer was received with required SRTP. This change makes it so this scenario will now fail with a 488 response. ASTERISK-26575 Change-Id: I7d14187037681f48879bd20319ac79d0877318f3 2016-11-10 08:33 +0000 [71dc333565] Joshua Colp * app_queue: Add mention of 'ABANDON' variable to CHANGES. ASTERISK-26558 Change-Id: I1127010181e79c8ac291f72f036cb8e430dc7f7e 2016-11-10 07:41 +0000 [6b5a7ced13] gtjoseph * Revert "Add API for channel frame deferral." This reverts commit 9231a56cf3d6f5eca1bf2d37d827453400690773. Multiple testsuite failures were detected after the fact. Change-Id: I3bac8d7c3ddb69a4ddf6c5d6de0ffa5ff7ff3af7 2016-11-10 07:41 +0000 [6be5d8de0d] gtjoseph * Revert "AGI: Only defer frames when in an interception routine." This reverts commit 5c10091f3d1430c6fc04015226f8c3e3aa9d8282. Multiple testsuite failures were detected after the fact. Change-Id: I397a841acc17ae230c512449cd6bed89d2ef3b73 2016-11-10 07:41 +0000 [1df434e2b4] gtjoseph * Revert "autoservice: Use frame deferral API" This reverts commit 2e3a3545754749de21873bfdc6d1a40ec7d8893f. Multiple testsuite failures were detected after the fact. Change-Id: Ia45fa4633fae74dca345b24bb6722737c63035de 2016-11-10 07:40 +0000 [58c88cfbaa] gtjoseph * Revert "channel: Use frame deferral API for safe sleep." This reverts commit 44f7e252397fd87420b3374df26941d7436401b3. Multiple testsuite failures were detected after the fact. Change-Id: I56299087da22128a95f0c8f3955f740890d7ca65 2016-11-09 18:18 +0000 [a562fbe618] gtjoseph * build: Fix default values for some SANITIZER options 2 of the sanitizers didn't have default values so in systems that don't support sanitizers menuselect would spit out warnings. They were harmless but confusing. They've now been set to "0". Change-Id: I08dc495e3b83f1feac3160b421f538c375fc5d58 2016-11-06 06:04 +0000 [7fd5031c1c] Sebastian Gutierrez * app_queue: new variable set when abandoned sets the variable ABANDONED to TRUE if the call was not answered. ASTERISK-26558 Change-Id: I4729af9bff4eba436d8a776afd3374065d0036d3 2016-11-08 10:48 +0000 [e043d1a55c] Mark Michelson * res_pjsip_session: Do not call session supplements when it's too late. res_pjsip_sesssion was hooking into transaction and invite state changes. One of the reasons for doing so was due to the PJSIP_EVENT_TX_MSG event. The idea was that we were hooking into the message sending process, and so we should call session supplements to alter the outgoing message. In reality, this event was meant to indicate that the message either a) had already been sent, or b) required a DNS lookup and would be sent when the DNS query completed. In case (a), this meant we were altering an already-sent request/response for no reason. In case (b), this potentially meant we could be trying to alter a request/response at the same time that the DNS resolution completed. In this case, it meant we might be stomping on memory being used by the thread actually sending the message. This caused potential crashes and memory corruption. This patch removes the calls to session supplements from the case where the PJSIP_EVENT_TX_MSG event occurs. In all of these cases, trying to alter the message at this point is too late, and it can cause nothing but harm to try to do it. Because there were no longer any calls to the handle_outgoing() function, it has been removed. Change-Id: Ibcc223fb1c3a237927f38754e0429e80ee301e92 2016-11-03 16:46 +0000 [44f7e25239] Mark Michelson * channel: Use frame deferral API for safe sleep. This is another case where manual frame deferral can be replaced with centralized routines instead. Change-Id: I42cdf205f8f29a7977e599751a57efbaac07c30e 2016-11-03 16:46 +0000 [2e3a354575] Mark Michelson * autoservice: Use frame deferral API Rather than use manual frame deferral, just let the channel API do it for us. ASTERISK-26343 Change-Id: I688386f36e765dbc07be863943a43f26bd5eac49 2016-11-03 16:42 +0000 [5c10091f3d] Mark Michelson * AGI: Only defer frames when in an interception routine. AGI recently was modified to defer important frames. This was because when AGI was used in a connected line interception routine, the resulting connected line frame would end up getting discarded by the AGI. However, this caused bad behavior in other cases. Specifically, during a transfer, if someone attempted to manually set the Caller ID on a channel in an AGI, the deferred connected line frame would end up overwriting what had been manually set in the AGI. Since the initial issue was specific to interception routines, this change removes the manual frame deferral from AGI and instead uses the new frame deferral API in interception routines. ASTERISK-26343 #close Reported by Morton Tryfoss Change-Id: Iab7d39436d0ee99bfe32ad55ef91e9bd88db4208 2016-11-03 16:36 +0000 [9231a56cf3] Mark Michelson * Add API for channel frame deferral. There are several places in Asterisk that have duplicated logic for deferring important frames until later. This commit adds a couple of API calls to facilitate this automatically. ast_channel_start_defer_frames(): Future reads of deferrable frames on this channel will be deferred until later. ast_channel_stop_defer_frames(): Any frames that have been deferred get requeued onto the channel. ASTERISK-26343 Change-Id: I3e1b87bc6796f222442fa6f7d1b6a4706fb33641 2016-11-03 07:42 +0000 [a9ac1f5de4] Alexander Anikin * chan_ooh323: Fixes to work right with Cisco devices Changed output packets queue processing algo to one read-one write instead of all read-all send Remove h.245 tunneling parameter from ReleaseComplete packet ASTERISK-24400 #close Reported by: Dmitry Melekhov Tested by: Dmitry Melekhov Change-Id: I0b31933b062a21011dbac9a82b8bcfe345f406f6 2016-11-03 13:10 +0000 [0ee249075a] Alexander Anikin * chan_ooh323: reset rrq count on gk registration reset registration attempts count on success registration on gatekeeper Change-Id: I5f47351852e0ca76c9ac78421659600e0f106336 2016-11-06 03:46 +0000 [59c23e1768] Michael Kuron * automon: restore mixing of the both channels after recording stops This is a regression over Asterisk 11, introduced by 2dc8a060064f359a17f5ebcd515d85fe5203c019. Previously, recordings started via the automon DTMF code would automatically be mixed together using sox because app_monitor would be called with the m option. This commit restores this behavior. Change-Id: Ibaf58684285c3f1b6ca3714524e6d638ae3b3759 2016-11-04 15:42 +0000 [e79acaeb75] Matt Jordan * res_http_websocket: Increase the buffer size for non-LOW_MEMORY systems Not surprisingly, using Respoke (and possibly other systems) it is possible to blow past the 16k limit for a WebSocket packet size. This patch bumps it up to 32k, which, at least for Respoke, is sufficient. For now. Because 32k is laughable on a LOW_MEMORY system (as is 16k, for that matter), this patch adds a LOW_MEMORY directive that sets the buffer to 8k for systems who have asked for their reduced memory availability to be considered. Change-Id: Id235902537091b58608196844dc4b045e383cd2e 2016-11-04 15:40 +0000 [7a83196985] Matt Jordan * res_stasis: Set a video source mode on Stasis created bridges When a bridge is created via ARI (through res_stasis), no video source mode is set by default. As a result, any endpoint sending video media won't ever see any video reflected back to it. This patch defaults a bridge to a 'follow the talker' video mode. Further work can be done to add routes that allow for the video mode to be controlled through the /bridges resource. Change-Id: I7e9d530a5d7a97a4524a9ee4e468e1a6b3443866 2016-11-04 15:37 +0000 [e7dc536b7a] Matt Jordan * main/bridge_channel: Fix channel reference leak on video source When a channel is made the video source, the bridge holds a reference to it. Whenever the video source changes, that reference is released. However, a ref leak does occur if the channel leaves the bridge (such as being hung up) while it is the video source, as the bridge never releases the ref in such a case. This patch adds a line to the bridge_channel_internal_join routine such that, when a channel finishes its time in the bridge, it notifies the bridge via ast_bridge_remove_video_src that if it is a video source its reference should be released. ASTERISK-26555 #close Change-Id: I3a2f5238a9d2fc49c591f0e65199d782ab0be76a 2016-11-04 15:36 +0000 [7c824b955d] Matt Jordan * main/bridge: Add some verbose logging for video source changes It's actually quite useful to see the source of a video stream change. This doesn't happen terribly often, even with talk detection - but when it does, it's nice to know which channel is now providing your video stream. As a verbose 5 level message, it shouldn't be terribly spammy or costly to have, and is 'lower level' then most other verbose messages that the bridge system emits. ASTERISK-26555 Change-Id: Ia1c20ecafa9670171fd38bddcf3beccae47fb15c 2016-11-04 15:33 +0000 [fd6af2dee8] Matt Jordan * bridges/bridge_softmix: Remove SSRC changes on join/leave; update video source WebRTC clients really, really want to know the SSRC of the media they're getting. Changing the SSRC is generally not a good thing. bridge_softmix, starting in Asterisk 12, started changing the SSRC of parties as they joined or left the bridge. With most phones, this isn't a problem: phones just play back the stream they're getting. With WebRTC clients, however, the SSRC is tied to a media stream that may be negotiated. When a new SSRC just shows up, the media can be dropped. As it turns out, the SSRC change shouldn't even be necessary. From the perspective of the client, it's still talking to Asterisk with the same media stream: why indicate that the far party has suddenly changed to a different source of media? This patch opts to just remove the SSRC changes. With this patch, video clients that join/leave a softmix bridge actually get the video stream instead of freaking out. ASTERISK-26555 Change-Id: I27fec098b32e7c8718b4b65f3fd5fa73527968bf 2016-10-28 15:11 +0000 [bd4d7d8ad0] Kevin Harwell * stasis_recording/stored: remove calls to deprecated readdir_r function. The readdir_r function has been deprecated and should no longer be used. This patch removes the readdir_r dependency (replaced it with readdir) and also moves the directory search code to a more centralized spot (file.c) Also removed a strict dependency on the dirent structure's d_type field as it is not portable. The code now checks to see if the value is available. If so, it tries to use it, but defaults back to using the stats function if necessary. Lastly, for most implementations of readdir it *should* be thread-safe to make concurrent calls to it as long as different directory streams are specified. glibc falls into this category. However, since it is possible that there exist some implementations that are not safe, locking has been added for those other than glibc. ASTERISK-26412 ASTERISK-26509 #close Change-Id: Id8f54689b1e2873e82a09d0d0d2faf41964e80ba 2016-11-04 10:57 +0000 [cb30963d22] Kevin Harwell * Revert "chan_sip: Fix lastrtprx always updated" This reverts commit 93332cb1d0eea18021ea6538237297e627d6e2fc. Unfortunately, the aforementioned commit caused a regression (incoming calls would eventually disconnect). Thus it is being removed. ASTERISK-26523 #close ASTERISK-25270 Change-Id: Ibf5586adc303073a8eac667a4cbfdb6be184a64d 2016-11-02 10:52 +0000 [3a1f9c5dab] Joshua Colp * res_stasis: Don't unsubscribe from a NULL bridge. A NULL bridge has special meaning in res_stasis for unsubscribing. It means that a subscription to ALL bridges should be removed. This should not be done as part of the normal subscription management in the res_stasis channel loop. ASTERISK-26468 Change-Id: I6d5bea8246dd13a22ef86b736aefbf2a39c15af0 2016-11-03 13:45 +0000 [eceab15f33] Alexander Anikin * chan_ooh323: Fix infinite loop on read second part of H.225 packet Fix logic on read second part of H.225 packet. There was infinite loop on wrong connections due to read before poll. Change-Id: I42b4bf75c46e4a5c5df5c5ca1f0bd74b8944e7ff 2016-11-03 11:55 +0000 [a9992da4aa] gtjoseph * pjproject_bundled: Fix issue with libasteriskpj needing libresample libresample is only needed by pjproject if we're building pjsua, which we only do if TEST_FRAMEWORK is selected. It's required by pjsua to process audio which is needed by some testsuite tests. Unfortunately, pjproject relies on a newer version of libresample than the version that ships by most distros so we need to compile the version that's bundled with pjproject. Since we only need it for pjsua, we DON'T want it's symbols exposed when we actually build asterisk. There was a problem however... TEST_FRAMEWORK is only known AFTER we've already run ./configure on both asterisk and pjproject but pjproject's ./configure needs to test it to know whether to set up to build libresample or not. The previous way of figuring this out was to always tell ./configure "yes" but not actually build the library. This caused an issue where building libasteriskpj was being told to include libresample but it wasn't actually there. The solution is to still do a default pjproject configure during an asterisk ./configure but if makeopts or menuselect.makeopts changes subsequently, we now reconfigure pjproject, taking into account the current state of TEST_FRAMEWORK. Previously, if makeopts or menuselect.makeopts changed, only a recompile of pjproject was done. Change-Id: I9b5d84c61384a3ae07fe30e85c49698378cc4685 2016-11-01 19:48 +0000 [714412f6c4] Sebastian Gutierrez * chan_sip: add missing account code Added missing account to AMI event of sip show peers ASTERISK-26176 #close Change-Id: Ieb6c2c80a838a1b59c82103eba4c63ba238dc482 2016-09-13 04:08 +0000 [0cf1778eed] Alexander Traud * rtp_engine: Allow more than 32 dynamic payload types. The dynamic range (96-127) allows 32 RTP Payload Types. RFC 3551 section 3 allows to reassign other ranges. Consequently, when the dynamic range is exhausted, you can go for "rtp_pt_dynamic = 35" (or 0) in asterisk.conf. This enables the range 35-63 (or 0-63) giving room for another 29 (or 64) payload types. ASTERISK-26311 #close Change-Id: I7bc96ab764bc30098a178b841cbf7146f9d64964 (cherry picked from commit 9ac53877f688c06acaa7c377f15da8770e4ee88b) 2016-11-02 09:15 +0000 [d971647949] Joshua Colp * app_dial: Fix incorrect device state when channel is picked up. Given the scenario where multiple channels are dialed using Dial() but the caller is picked up using PickupChan() all outgoing channels except the channel specified to PickupChan() would be marked as ringing until the call had been hung up. When using the PickupChan application the channel executing the application is swapped into place of another channel. As part of this process the channel is answered. The Dial application has explicit logic which checks if the channel is answered, cancels all other outgoing channels, and bridges. This logic is different than the normal logic that is executed when an outgoing channel is answered. This different logic failed to publish dial events stating that the other outgoing channels had been canceled. As a result references to the outgoing channels were held onto by the dial masquerade process until the call had been ended and the channels had gone away. This would result in the channels appearing in the "core show channels" list despite not being present anymore and would also result in incorrect device state. This change makes it so that this logic also publishes dial events stating that the other outgoing channels have been canceled. ASTERISK-26549 Change-Id: Iea7168e6e82f7d4609ec0366153804e4f55ea64f 2016-11-01 13:13 +0000 [afecb2cfc0] Richard Mudgett * bundled pjproject: Fix DNS write to freed memory. PJPROJECT 2.5.5 introduced a race condition with the -r5349 IPv6 DNS patch. The patch below fixes a write to freed memory under cartain DNS lookup conditions. 0006-r5477-svn-backport-Fix-DNS-write-on-freed-memory.patch ASTERISK-26516 Reported by: Richard Mudgett Change-Id: Ifdfae9ecf1e41b53080f33aab44ce1a220f349c5 2016-11-01 06:56 +0000 [5f188bb7a8] Joshua Colp * res_pjsip_sdp_rtp: Limit number of formats to defined maximum. The res_pjsip_sdp_rtp module did not restrict the number of formats added to a media stream in the SDP to the defined limit. If allow=all was used with additional loaded codecs this could result in the next media stream being overwritten some. This change restricts the module to limit it to the defined maximum and also increases the maximum in our bundled pjproject. ASTERISK-26541 #close Change-Id: I0dc5f59d3891246cafa2f3df5ec406f088559ee8 2016-11-01 04:18 +0000 [94c9496ed5] Tzafrir Cohen * netsock.c: fix includes for HURD ASTERISK-25070 Change-Id: I43bf94d2d36d3d8a8d0df40cd6c027d65a462814 2016-11-01 04:00 +0000 [c1c9487375] Tzafrir Cohen * define PATH_MAX for HURD PATH_MAX is not guaranteed to be defined. In parctice, all but the HURD define it to a constant. It is indeed not safe to assume there won't be longer paths and Asterisk generally does err safely on such cases. So even for HURD we'll just pretend PATH_MAX is 4096. ASTERISK-25070 #close Change-Id: I53d10ba18c34c132bcb640a5fd8e0da1d9b22db3 2016-10-31 17:35 +0000 [50fa868ab8] Kevin Harwell * codecs.conf.sample: Add sample and option descriptions for codec_opus codecs.conf.sample was missing codec opus's configuration options, descriptions, and examples. This patch adds the configuration options and examples to codecs.conf.sample that can be used with codec_opus. ASTERISK-26538 #close Change-Id: I1d89bb5e01d3e3b5bd78951b8dd0ff077a83dc8b 2016-11-01 08:32 +0000 [b3f10b7b94] Grachev Sergey * chan_sip: Incorrect display option Outbound reg. retry 403 If in sip.conf (general section) set option register_retry_403=no, the command "sip show settings" return value: Outbound reg. retry 403:0 If in sip.conf (general section) set option register_retry_403=yes, the command "sip show settings" return value: Outbound reg. retry 403:-1 * In static char "sip show settings" for "Outbound.reg. retry 403" option use AST_CLI_YESNO ASTERISK-26476 #close Change-Id: I3c14272f05f1067bd2aeaa8b3ef9cf8fcb12dcf9 2016-10-20 07:27 +0000 [29692d4aa4] Matt Jordan * res/stasis: Add CLI commands for displaying/debugging ARI apps This patch adds three new CLI commands: - ari show apps: list the registered ARI applications - ari show app: show detailed information about an ARI application - ari set debug: dump events being sent to an ARI application Note that while these CLI commands live in the res_stasis module, we use the 'ari' family for these commands. This was done as most users of Asterisk aren't aware of the semantic differences between ARI and res_stasis, and some 'ari' CLI commands already exist. ASTERISK-26488 #close Change-Id: I51ad6ff0cabee0d69db06858c13f18b1c513c9f5 2016-10-31 16:12 +0000 [a36a7d0cf4] gtjoseph * pjproject_bundled: Fix compile of pjsua so it handles audio In order for pjsua and its python binding to actually negotiate audio for the testsuite tests, it needs g711 and resample. The pj* libraries themselves do not. Unfortunately, pjproject relies on a brand new libresample that most distros don't ship so we need to use the libresample already bundled with pjproject. Only the pjsua executable and the _pjsua.so python library are linked with it so it shouldn't interfere with asterisk itself. Also it was pointed out that apply_patches couldn't handle multiple patches that depended on each other during the dry-run, so the dry-run was removed. Change-Id: I24f397462b486dcdde0dcafe40e6c55a6593f098 2016-10-31 13:46 +0000 [42bd70b29f] Etienne Lessard * manager: Add documentation for NewConnectedLine event. The NewConnectedLine event has been added by commit fe7671f, but the documentation was missing. ASTERISK-26537 #close Change-Id: I7fc331f18caa28492da9303e576f70884ca8c9e6 2016-10-30 13:33 +0000 [30b1bc77d2] Corey Farrell * vector: Prevent NULL argument to memcpy. Headers declare that memcpy does not accept NULL argument for the first two parameters. Add a conditional block to prevent memcpy and ast_free from running on vectors with NULL element array. ASTERISK-26526 #close Change-Id: I988a476bb5fcfcbd3f6d6c6b3e7769e4f9629b71 2016-10-29 10:31 +0000 [b96f18560b] Corey Farrell * astobj2: Declare private variable data_size for AO2_DEBUG only. Every ao2 object contains storage for a private variable data_size, though the value is never read if AO2_DEBUG is disabled. This change makes the variable conditional, reducing memory usage. ASTERISK-26524 #close Change-Id: If859929e507676ebc58b0f84247a4231e11da07f 2016-10-28 16:59 +0000 [6b1c55dc9b] gtjoseph * pjproject_bundled: Fix issue where "/version.mak" wasn't found main/Makefile includes third-party/pjproject/build.mak but doesn't set PJDIR beforehand so "include $(PJDIR)/version.mak" evaluates to "/version.mak". Fix is to set PJDIR in main/Makefile before the include. Change-Id: I0f7c67d60209049056fe9c4b041bf0463aa95604 2016-10-28 14:55 +0000 [d7f457e4c1] Richard Mudgett * bundled pjproject: Crashes while resolving DNS names. PJPROJECT 2.5.5 introduced a race condition with the -r5349 IPv6 DNS patch. The patches below fix the DNS lookup race condition crash caused by attempting to send the same message twice for the single DNS lookup. 0006-r5471-svn-backport-Various-fixes-for-DNS-IPv6.patch 0006-r5473-svn-backport-Fix-pending-query.patch The patch below removes a cached DNS response from the hash table when another thread is referencing the old entry. The table still contained the entry when it was destroyed which can result in inexplicable crashes. 0006-r5475-svn-backport-Remove-DNS-cache-entry.patch ASTERISK-26344 #close Reported by: Ian Gilmour ASTERISK-26387 #close Reported by: Harley Peters Change-Id: I17fde80359e66f65a91341ceca58d914d0f61cc4 2016-10-28 09:50 +0000 [87903a6848] Rusty Newton * SAC documentation: don't specify transports for endpoints and registrations Removing explicit transport definition for endpoints and registrations. It isn't necessary and isn't generally advised. ASTERISK-26514 #close Change-Id: Ifdec5e631962438a4683600968dfa4bfd15909fb 2016-10-27 21:49 +0000 [f373de3020] Corey Farrell * Fix shutdown crash caused by modules being left open. It is only safe to run ast_register_cleanup callbacks when all modules have been unloaded. Previously these callbacks were run during graceful shutdown, making it possible to crash during shutdown. ASTERISK-26513 #close Change-Id: Ibfa635bb688d1227ec54aa211d90d6bd45052e21 2016-10-26 18:48 +0000 [61a5c3460e] gtjoseph * pjproject_bundled: Remove usage of tar's --strip-components option Older versions of tar don't support the --strip-components option so instead of doing 'tar --strip-components=1 -C source', we now just untar to the tarball's root directory (pjproject-) and rename that directory to 'source'. Also fixed an issue where the pjproject source directory is a hard coded absolute pathname. ASTERISK-26510 #close ASTERISK-22480 #close Change-Id: I9ec92952507a91ff4e4d01e0149e09fd8e8f32b0 2016-10-27 08:07 +0000 [675c71ae8c] Joshua Colp * res_pjsip_caller_id: Fix crash on session timers UPDATE on inbound calls. The res_pjsip_caller_id module wrongly assumed that a saved From header would always exist on sessions. This is true until an inbound call is received and a session timer causes an UPDATE to be sent. In this case there will be no saved From header and a crash will occur. This change makes it fall back to the From header of the outgoing request if no saved From header is present. ASTERISK-26307 #close Change-Id: Iccc3bc8d243b5ede9b81abf960292930c908d4fa 2016-10-26 07:51 +0000 [14496ce1e5] Joshua Colp * app_voicemail: Clear voice mailbox in MailboxExists and MAILBOX_EXISTS. When executing the MailboxExists dialplan application and MAILBOX_EXISTS dialplan function the passed in temporary voice mailbox was not cleared, causing it to try to free garbage. ASTERISK-26503 #close Change-Id: Ie21ccfa1b80b9c59318e596f6b8e17da2b5a7cb3 2016-10-23 07:38 +0000 [e0bc17edff] Joshua Colp * pjsip: Fix a few media bugs with reinvites and asymmetric payloads. When channel format changes occurred as a result of an RTP re-negotiation the bridge was not informed this had happened. As a result the bridge technology was not re-evaluated and the channel may have been in a bridge technology that was incompatible with its formats. The bridge is now unbridged and the technology re-evaluated when this occurs. The chan_pjsip module also allowed asymmetric codecs for sending and receiving. This did not work with all devices and caused one way audio problems. The default has been changed to NOT do this but to match the sending codec to the receiving codec. For users who want asymmetric codecs an option has been added, asymmetric_rtp_codec, which will return chan_pjsip to the previous behavior. The codecs returned by the chan_pjsip module when queried by the bridge_native_rtp module were also not reflective of the actual negotiated codecs. The nativeformats are now returned as they reflect the actual negotiated codecs. ASTERISK-26423 #close Change-Id: I6ec88c6e3912f52c334f1a26983ccb8f267020dc 2016-10-26 06:32 +0000 [f534f67f52] Joshua Colp * res_pjsip_sdp_rtp: Fix address family of explicit media_address. When an explicit media_address is provided the address family in the SDP needs to be set to reflect it. ASTERISK-26309 Change-Id: Ib9350cc91c120eb2f96f0623d3907d12af67eb79 2016-10-25 11:20 +0000 [3a2092b722] gtjoseph * test_astobj2_thrash: Fix multithreaded issues The test uses 4 threads to grow, count, lookup and shrink 15K objects in a container. If there's only 1 execution engine available, the test will complete in <50ms. If each threads gets its own execution engine, the test may timeout after 60 seconds because the count thread does a locked ao2_callback on the whole container in a tight loop with only a sched_yield to give up time. The lock contention makes the test execution times wildly variable and mostly timeout. 2 execution engines are OK, 3 results in about 33% failure rate and >=4 causes a 80% failure rate. To fix, the sched_yield was changed to a usleep(500). Also, the number of buckets specified for the container was an even number so that was changed to the next prime number greater than (MAX_HASH_ENTRIES / 100). That's 151 currently. Change-Id: I50cd2344161ea61bfe4b96d2a29a6ccf88385c77 2016-10-24 14:13 +0000 [640203802e] Pascal Cadotte Michaud * typo: s/paranthesis/parenthesis/ in a comment Change-Id: I7c1f4eb051177ee22cbe97e063d4a3effe29be30 2016-10-24 10:55 +0000 [9b3557e054] gtjoseph * pjproject_bundled: Fixed various build issues * CFLAGS is now properly set when using older gcc. * All third-party pjproject targets have been removed. This fixes an issue with older libsrtp in some distros. * Manually removing the source directory now causes a rebuild. * EXTERNALS_CACHE_DIR is now properly checked. * Whitespace fixes. Change-Id: I98fec6847efc5602a9f41cb95096fd660a49fa60 2016-09-19 06:13 +0000 [bb982480d8] Joshua Colp * pjsip: Support dual stack automatically. This change adds support for dual stack automatically. No configuration is required and the IP address and version in the SIP messages and SDP will be automatically changed based on the transport over which the message is being sent. RTP usage has also been changed to listen on both IPv4 and IPv6 simultaneously to allow media to flow, and to allow ICE support on both simultaneously. This also allows failover between IPv6 and IPv4 to work as expected. ASTERISK-26309 #close Change-Id: I235a421d8f9a326606d861b449fa6fe3a030572d 2016-10-17 14:18 +0000 [eff97808fb] Mark Michelson * ARI: Detect duplicate channel IDs ARI and AMI allow for an explicit channel ID to be specified when originating channels. Unfortunately, there is nothing in place to prevent someone from using the same ID for multiple channels. Further complicating things, adding ID validation to channel allocation makes it impossible for ARI to discern why channel allocation failed, resulting in a vague error code being returned. The fix for this is to institute a new method for channel errors to be discerned. The method mirrors errno, in that when an error occurs, the caller can consult the channel errno value to determine what the error was. This initial iteration of the feature only introduces "unknown" and "channel ID exists" errors. However, it's possible to add more errors as needed. ARI uses this feature to determine why channel allocation failed and can return a 409 error during origination to show that a channel with the given ID already exists. ASTERISK-26421 Change-Id: Ibba7ae68842dab6df0c2e9c45559208bc89d3d06 2016-10-19 17:53 +0000 [c2036c827c] snuffy * Fix issue with CLI not returning to prompt after running "features show" ASTERISK-26444 #close Change-Id: I91d645b7e6e5dba35f8c410df2be77a8c0e3acb8 2016-10-04 18:24 +0000 [3c62b60e56] Michael Walton * res_rtp_asterisk: Add ice_blacklist option Introduces ice_blacklist configuration in rtp.conf. Subnets listed in the form ice_blacklist = , e.g. ice_blacklist = 192.168.1.0/255.255.255.0, are excluded from ICE host, srflx and relay discovery. This is useful for optimizing the ICE process where a system has multiple host address ranges and/or physical interfaces and certain of them are not expected to be used for RTP. Multiple ice_blacklist configuration lines may be used. If left unconfigured, all discovered host addresses are used, as per previous behavior. Documention in rtp.conf.sample. ASTERISK-26418 #close Change-Id: Ibee88f80d7693874fda1cceaef94a03bd86012c9 2016-10-18 16:30 +0000 [012fda29d2] Mark Michelson * CDR: Alter destruction pattern for CDR chains. CDRs form chains. When the root of the chain is destroyed, it then unreferences the next CDR in the chain. That CDR is destroyed, and it then unreferences the next CDR in the chain. This repeats until the end of the chain is reached. While this typically does not cause any sort of problems, it is possible in strange scenarios for the CDR chain to grow way longer than expected. In such a scenario, the destruction pattern can result in a stack overflow. This patch fixes the problem by switching from a recursive pattern to an iterative pattern for destruction. When the root CDR is destroyed, it is responsible for iterating over the rest of the CDRs and unreferencing each one. Other CDRs in the chain, since they are not the root, will simply destroy themselves and be done. This causes the stack depth not to increase. ASTERISK-26421 #close Reported by Andrew Nagy Change-Id: I3ca90c2b8051f3b7ead2e0e43f60d2c18fb204b8 2016-10-18 09:04 +0000 [6d462b9eaf] Alexei Gradinari * chan_pjsip: segfault on already disconnected session On heavy loaded system the TCP/TLS incoming calls could be disconnected by pjproject while these calls are being processed by asterisk. This patch uses functions pjsip_inv_add_ref/pjsip_inv_dec_ref to inform pjproject that an INVITE session is in use. ASTERISK-26482 #close Change-Id: Ia2e3e2f75358cdb530252a9ce158af3d5d9fdf33 2016-10-18 03:01 +0000 [662b560c35] Alexander Traud * cli: Auto-complete File not Module for core set debug. Since Asterisk 1.8, the command "core set debug" on the command-line interface asks not for a file (.c) but a module name. This change shows modules (.so) on the auto-completion via a tabulator or the question mark. Now, when you partially type a module name, TAB or ?, you get the correct candidiates. ASTERISK-26480 Change-Id: I1213f1dd409bd4ff8de08ad80cb0c73cafb1bae0 2016-09-11 10:13 +0000 [6f5880913f] Tzafrir Cohen * menuselect: invalid test for GTK2 configuire.ac was only checking for the existence of pkg-config and not the gtk2 package itself. Now it calls AST_PKG_CONFIG_CHECK for gtk+-2.0. ASTERISK-26356 #close Change-Id: I8079d515d6ea99f9ab320a7eaa71c2aaa101ccd5 2016-10-17 11:39 +0000 [546ec4b038] gtjoseph * pjproject_bundled: Add patch to address SSL crash Addresses crashes when an attempt is made to operate on an SSL socket after the socket has been closed. ASTERISK-26477 #close Change-Id: I421305b357558b4f9e690210dc0f4831ef4b3002 2016-10-13 02:06 +0000 [644fad7477] Moises Silva * chan_rtp: Set a sane default rtp engine for unicast. ASTERISK-26439 Change-Id: I7f5ee2eeba8906e9ecb3293dbe3a747770bb5011 2016-10-15 20:05 +0000 [42cfdcd1b7] Matt Jordan * res/ari: Add the Asterisk EID field to outgoing events This patch adds the Asterisk EID field to all outgoing ARI events. Because this field should be added to all events as they are transmitted, it is appended to the JSON message just prior to it being handed off to the application message handler. This makes it somewhat resilient to both new events being added to ARI, as well as other potential event transport mechanisms. ASTERISK-26470 #close Change-Id: Ieff0ecc24464e83f3f44e9c3e7bd9a5d70b87a1d 2016-10-16 17:25 +0000 [74d9385273] gtjoseph * utils.c: Fix ast_set_default_eid for multiple platforms ast_set_default_eid was searching for ethX, emX, enoX, ensX and even pciD#U interface names. While this was a good attempt, it wasn't inclusive enough to capture interfaces like enp6s0 or ens6d1, etc. Rather than relying on interface names, we now simply find the first interface returned by the OS that has a hardware address and that address isn't all 0x00 or all 0xff. The code IS different for BSD, Solaris and Linux based on what method is available for enumerating interfaces. Tested on: FreeBSD9 CentOS6 Ubuntu14 Fedora24 I was unable to test on Solaris at this time but the code for Solaris is used elsewhere at Digium. Change-Id: Iaa6db87ca78a9a375e47d70e043ae08c1448cb72 2016-10-15 04:58 +0000 [f1fd873df0] Michael Kuron * chan_sip: Only send video on outgoing channel if incoming channel supports it Previously, the settings videosupport=always and videosupport=yes behaved identically and unconditionally caused a video offer to be sent in the SDP on an outgoing call. This was a regression introduced with commit 5a1d90e1fbfc4b48927aad55311f3b38efbf1f54 in Asterisk 1.6.1. This commit restores correct behavior: videosupport=always causes a video offer to be sent unconditionally, while videosupport=yes will only offer video on an outbound channel if the incoming channel it is bridged to also supports video. That way, the device receiving the outgoing call can display the correct user interface elements for audio or video and will not unnecessarily show a blank video window on an audio-only call. ASTERISK-17470 #close Change-Id: I782f4409d436114dbc97061c3570c0cd24f7c3ae 2016-10-13 14:09 +0000 [0306869399] Leandro Dardini * app_queue: Added initialization for "context" parameter When using Asterisk Realtime Architecture, empty fields are skipped and the default values are used. If the "context" parameter in queue was set and then cleared from the database, the old value remains in memory and it continues to be used. This change initialize the "context" parameter with an empty value, allowing clearing the parameter. ASTERISK-26462 #close Change-Id: I64be73d5044ce38dd02408bd0e53de965ef65905 2016-10-14 00:18 +0000 [ce4cfd2eca] Corey Farrell * Fix issues with bundled pjproject cached download. Previously when testing I had a preexisting makeopts in ASTTOPDIR. The ordering of configure.ac causes --with-externals-cache to be processed after third-party configure. In cases where the Asterisk clone is cleaned it would cause pjproject to be downloaded to /tmp. This moves processing of the externals cache and sounds cache to happen before third-party configure. This also addresses a possible issue with the third-party Makefile. If TMPDIR is set by the environment it would override the path given to --with-externals-cache. ASTERISK-26416 Change-Id: Ifab7f35bfcd5a31a31a3a4353cc26a68c8c6592d 2016-10-12 16:24 +0000 [3c54328c57] Richard Mudgett * Audit ast_json_pack() calls for needed UTF-8 checks. Added needed UTF-8 checks before constructing json objects in various files for strings obtained outside the system. In this case string values from a channel driver's peer and not from the user setting channel variables. * aoc.c: Fixed type mismatch in s_to_json() for time and granularity json object construction. ASTERISK-26466 Reported by: Richard Mudgett Change-Id: Iac2d867fa598daba5c5dbc619b5464625a7f2096 2016-10-12 16:20 +0000 [7f8f125738] Richard Mudgett * json: Check party id name, number, subaddresses for UTF-8. * Updated unit test as ast_json_name_number() is now NULL tolerant. ASTERISK-26466 #close Reported by: Richard Mudgett Change-Id: I7d4e14194f8f81f24a1dc34d1b8602c0950265a6 2016-10-11 18:14 +0000 [9621c9bcbc] Richard Mudgett * json: Add UTF-8 check call. Since the json library does not make the check function public we recreate/copy the function in our interface module. ASTERISK-26466 Reported by: Richard Mudgett Change-Id: I36d3d750b6f5f1a110bc69ea92b435ecdeeb2a99 2016-10-12 17:42 +0000 [e4bb9f9a37] Richard Mudgett * aoc.c: Whitespace cleanup * In s_to_json() removed unnecessary ast_json_ref() to ast_json_null() when creating the type json object. The ref is a noop. Change-Id: I2be8b836876fc2e34a27c161f8b1c53b58a3889a 2016-10-12 17:27 +0000 [bcac905bd3] Richard Mudgett * app_queue.c: Fix clearing of pause reason string. The pause reason is not always cleared when it should be cleared. * Made set_queue_member_pause() always clear pause reason if not pausing with a reason string. Change-Id: I993dad19626ec017478a230e980989438b778c53 2016-10-12 16:22 +0000 [ee4ae2b648] Richard Mudgett * app_minivm.c: Fix malformed ast_json_pack() call. Change-Id: I082b239022fac462666e52a14a44304748908dc0 2016-10-12 16:30 +0000 [90ae4e4337] gtjoseph * res_config_mysql: Fix several issues related to recent table changes Unlike any of the other database drivers, res_config_mysql checks that the table definition matches the requirements for every insert and update statement. Since all requirements are forced to 'char', any column that isn't a char, like ps_contacts' expiration_time, qualify_timeout, etc., will throw a warning. It's kinda harmless but very misleading. Since no other driver does those checks on insert or update, they've been removed from res_config_mysql. Also, all the logic that actually attempted to ALTER the table to fix the issue has been removed. With the move to alembic, the auto-alter functionality is not only unnecessary, it's also dangerous. The other issue is that res_config_mysql calls the mysql_insert_id function inside store_mysql. Presumably the intention was to return the number of rows inserted DESPITE A NOTE IN THE CODE THAT THE VALUE IS NON_PORTABLE AND MAY CHANGE. That value is then returned to config realtime as the number of rows inserted. Guess what? The value changed. It now only returns the number of rows inserted if there's an auto increment column on the table, which ps_contacts doesn't have. Otherwise it returns 0. So now, the insert worked but we tell config realtime and sorcery that no rows were inserted. That call to mysql_insert_id was removed and we now always return 1 if the insert succeeded. We're only inserting 1 row at a time anyway. If the insert fails, we still return -1. ASTERISK-26362 #close Reported-by: Carlos Chavez Change-Id: I83ce633efdb477b03c8399946994ee16fefceaf4 2016-09-29 13:08 +0000 [86c15db6a1] Torrey Searle * res_fax: Fix a tight race condition causing fax to crash in audio fallback When T.38 gets rejected and G711 failback occurs there is a period of time where neither AST_FAX_TECH_T38 nor AST_FAX_TECH_AUDIO is set, leading to a crash. Change-Id: Icc3f457b2292d48a9d7843dac0028347420cc982 2016-09-30 16:29 +0000 [29b7a5b00f] Rodrigo Ramírez Norambuena * Add text of cdr directory into README.md for ast-db-manage Change-Id: I68321c4bea50730c39fdb486e5f23aeadd1ad636 2016-10-06 09:58 +0000 [f919edc4e2] gtjoseph * app_dial: Add the "Q" option to set the cause on unanswered channels The "Q" option will set the cause on the unanswered channels when another channel answers. It overrides the default of ANSWERED_ELSEWHERE. NOTE: chan_sip does not support setting the cause on a CANCEL to anything other than ANSWERED_ELSEWHERE. ASTERISK-26446 #close Change-Id: I71742e0919aaa16784c30a2b2e73fbeed7672e47 2016-10-11 06:55 +0000 [a859bcb49c] Alexander Traud * chan_sip: Support nat=auto_comedia or nat=force_rport,auto_comedia. In the SIP channel driver chan_sip, auto_comedia was expected to be used in tandem with auto_force_rport. Or stated differently: Only when auto_force_rport was chosen (the default), auto_comedia worked. This change allows auto_comedia to be set independently of the state of (auto_)force_rport. For example, nat=force_rport,auto_comedia is useful for IPv4/IPv6 Dual Stack deployments when IPv6 clients are behind a Firewall. ASTERISK-26457 #close Change-Id: Ib29d66c6dbb61648e371e01fc36c6978ddae5bc2 2016-10-10 16:59 +0000 [a884b26392] Badalyan Vyacheslav * vector: After remove element recheck index Small fix. It is necessary to double-check the index that we just removed because there is a new element. ASTERISK-26453 #close Change-Id: Ib947fa94dc91dcd9341f357f1084782c64434eb7 2016-09-29 12:52 +0000 [349c34f72a] Torrey Searle * res_rtp_asterisk: Fix infinite DTMF issue when switching to P2P bridge If a bridge switched to P2P when a DTMF was in progress it was possible for the DTMF to continue being sent indefinitely. Change-Id: I7e2a3efe0d59d4b214ed50cd0b5d0317e2d92e29 2016-10-10 10:59 +0000 [9da3489d24] Badalyan Vyacheslav * res_pjsip_config_wizard: Memory leak in module_unload Fixed a memory leak. It removes only the first element. Added a useful feature in vector.h to remove all items under the CMP through a callback function / macro. ASTERISK-26453 #close Change-Id: I84508353463456d2495678f125738e20052da950 2016-10-09 21:53 +0000 [fa2885b3ff] Badalyan Vyacheslav * cel_odbc: Fix memory leak on module unload Change-Id: Ic7a1236eba2408090fdabb5f717b5fa455ead715 2016-10-03 11:30 +0000 [e6b0053d75] gtjoseph * bundled_pjproject: Add tests for programs used by the Makefile, et al. Added tests for bzip2, tar, patch, sed and nm to configure.ac. Set DOWNLOAD_TO_STDOUT to a working command line regardless of whether the download program is wget, curl or fetch. Added a 'configure.m4' file to the third-party directory which takes care of calling any third-party project setup. Had to move some pjproject_bundled stuff up in configure.ac so it was called before the third-party configure macro. The pjproject tarball is now downloaded to the externals_cache_dir if it was specified on the ./configure command line Removed regeneration of the pjproject aconfigure file. It was only needed for an old patch that no longer applies. Converted the tests for symbols to explicit tests since we know that they're now available in the bundled version. Saves a little time during configure. ASTERISK-26416 #close Reported-by: Corey Farrell Change-Id: Id1d94251c0155f8dd41b7de7067f35cfbaafbb9b 2016-10-05 14:53 +0000 [0dc0356e39] gtjoseph * pjproject_bundled: Add MALLOC_DEBUG capability pjproject_bundled will now use the asterisk memory debugging APIs if MALLOC_DEBUG is turned on in menuselect. Because this required stubs for the executable programs and the python bindings, some Makefile reorganization was needed to properly handle the dependencies. As a result, the makefile now individually makes each of the pjproject libraries separately instead of making them all in 1 shot. The only visible change is that there are separate status lines printed for each library instead oif 1 for all libs. Also, the making of the pjproject dependency files was eliminated. They're not needed for building unless you're actively modifying pjproject source files and it makes the build process faster. Finally, any issues with parallel builds should be resolved again making the build faster. Change-Id: Icc5e3d658fbfb00e0a46b44c66dcc2522d5171b0 2016-10-07 17:32 +0000 [dd873bcada] Corey Farrell * astobj2: Add backtrace to log_bad_ao2. * Compile __ast_assert_failed unconditionally. * Use __ast_assert_failed to log messages from log_bad_ao2 * Remove calls to ast_assert(0) that happen after log_bad_ao2 was run. Change-Id: I48f1af44b2718ad74a421ff75cb6397b924a9751 2016-10-04 16:59 +0000 [86550f9c17] gtjoseph * alembic: Allow cdr, config and voicemail to exist in the same schema cdr, config and voicemail are all separate alembic trees. Because alembic's default is to use a table named 'alembic_version' to store the current tree revision, the 3 trees can't exist in the same schema without stepping on each other. Now each tree uses 'alembic_version_' as the version table. Each tree's env.py script now first checks for 'alembic_version'. If it finds it AND its revision is in the tree's history, the script renames it to 'alembic_version_'. Regardless, the script then continues with the migration using 'alembic_version_' and creates that table if it's not found. The result is that if an existing 'alembic_version' table was found but it didn't belong to this tree, it's left alone and 'alembic_version_' is used or created. WARNING: If multiple trees are using the same schema, they MUST NOT CRU or D any objects with names that might exist in the other trees. An example would be 'yesno_values' type. If two trees perform operations on it, one tree could pull it out from under the other. Thankfully we currently don't share any names among cdr, config and voicemail. NOTE: Since the env.py scripts in each tree were identical, a common env.py has been placed in the ast-db-manage directory and a symlink to it has been placed in each tree directory. ASTERISK-24311 #close Reported-by: Dafi Ni Change-Id: I4d593f000350deb5d21a14fa1e9bc3896844d898 2016-10-05 04:25 +0000 [f166681c12] Alexander Traud * chan_sip: Honor support of Symmetric Response (rport) for SIP requests. In the SIP channel driver chan_sip, the default is "auto_force_rport". When no NAT was detected, for example in case of IPv6, Asterisk uses the IP address from the headers within the SIP-REGISTER for subsequent SIP signaling. When the remote party specifies support for Symmetric Response (RFC 3581) via the parameter "rport", Asterisk should not extract the port from the SIP headers but reuse the port of the transport. This did not happen because of a typo. ASTERISK-26438 #close Change-Id: If6e7891848aaf96666dee5305695f7c6667cd5a6 2016-10-04 20:46 +0000 [430f6e5388] Michael Walton * audiohooks: Remove redundant codec translations when using audiohooks The main frame read and write handlers in main/channel.c don't use the optimum placement in the processing flow for calling audiohooks callbacks, as far as codec translation is concerned. This change places the audiohooks callback code: * After the channel read translation if the frame is not linear before the translation, thereby increasing the chance that the frame is linear as required by audiohooks * Before the channel write translation if the frame is linear at this point This prevents the audiohooks code from instantiating additional translation paths to/from linear where a linear frame format is already available, saving valuable CPU cycles ASTERISK-26419 Change-Id: I6edd5771f0740e758e7eb42558b953f046c01f8f 2016-09-29 14:02 +0000 [2449d2877c] Kevin Harwell * Remove "format_ogg_opus: New format" This reverts commit 40aa28131bc30b4516da2b20eb1a1e043920169c. ASTERISK-26426 #close Change-Id: I81e55c3c512f1dd6f49896f0c6b97a07d74fd8f5 2016-09-27 16:10 +0000 [f0a2e628d6] gtjoseph * download_externals: Fix issue with re-install Needed to ignore an xmlstarlet return code for optional element. Change-Id: I6a96f709b4b38c9a3f3dda4e8b07903787e16873 Reported-by: Dan Jenkins 2016-09-22 09:49 +0000 [5258c067ae] gtjoseph * codec_opus: Add download ability to menuselect Updated codecs/codecs.xml to add codec_opus to the external download list. ASTERISK-26409 Change-Id: Ia07b36539f30e852125fb2b94147dc9774df31a4 2016-07-23 14:50 +0000 [a5af8709c8] gtjoseph * codec_opus: Replace res_format_attr_opus with the one from codec_opus Preparation ASTERISK-26409 Change-Id: I9f20e7cce00c32464d9a180e81283d49d199d0a3 (cherry picked from commit 59f7662a93bf9c07204fb50e1020a0f5bfbbd5c9) 2016-07-23 15:56 +0000 [44c0c51cf1] gtjoseph * format_ogg_opus: New format Add Ogg/Opus playback support. This uses libopusfile in order to be able to read .opus files and play them back. Writing/recording support is not present at this time. ASTERISK-26409 Change-Id: I8815d23345108d8ca7c0bd640f6a1ce6b4f56955 2016-09-24 19:05 +0000 [0ab443007b] gtjoseph * build_tools: Add ability to download variants to download_externals Some external packages have multiple variants that apply to different builds of asterisk. The DPMA for instance has a "bundled" variant that needs to be downloaded if asterisk was configured with --with-pjproject-bundled. There are 2 ways to specify variants: If you need the user to make the decision about which variant to download, simply create multiple menuselect "member" entries like so... external xmlstarlet bash no external xmlstarlet bash no Note that the second entry has "-" appended to the name. You can then use the existing menuselect facilities to restrict which members to enable or disable. Youy probably don't want the user to enable multiple at the same time. If you want to hide the details of the variants, the better way to do it is to create 1 member with "variant" elements. external xmlstarlet bash no The condition must be a bash expression suitable for use with an "if" statement. Any environment variable can be used plus those available in makeopts. In this case, if asterisk was configured with --with-pjproject-bundled the bundled variant will be automatically downloaded. Otherwise the normal version will be downloaded. Change-Id: I4de23e06d4492b0a65e105c8369966547d0faa3e 2016-09-22 01:40 +0000 [a0a17a8c6f] Aaron An * channels/chan_pjsip: fix HANGUPCAUSE function bug. HANGUPCAUSE not return 'SIP 200 Ok' when dialed channel answered. This patch change the call order of ast_queue_control_data and ast_queue_control in chan_pjsip_incoming_response. ASTERISK-26396 #close Reported by: AaronAn Tested by: AaronAn Change-Id: Ide2d31723d8d425961e985de7de625694580be61 2016-09-23 09:54 +0000 [0502675e5c] Alessandro Crespi * chan_sip: Resolve externhost not to IPv6; instead go for IPv4. For the channel driver chan_sip, you specify externhost=example.com in sip.conf when your Asterisk is behind a NAT and your IP address is assigned dynamically. Or stated differently: You do not have a static IP address to use "externaddr" directly. This NAT support is quite handy but just about IPv4. Previously, Asterisk resolved "externhost" to any IP version. When the first DNS answer resolved to an IPv6, Asterisk sent an IPv6 in SIP/SDP for origin (o=) and connection (c=). This happened in outgoing SIP-REGISTER and while answering SIP-INVITE. If the remote peer is IPv4-only, it might not handle o=/c= with an IPv6. This change makes sure, no IPv6 is resolved anymore for "externhost". ASTERISK-18232 #close Reported by: Jacek Kowalski Tested by: Alexander Traud patches: changes.patch submitted by Alessandro Crespi Change-Id: If68eedbeff65bd1c1d8a9ed921c02ba464b32dac 2016-09-20 09:42 +0000 [0056bcaebd] gtjoseph * chan_sip: Address runaway when realtime peers subscribe to mailboxes Users upgrading from asterisk 13.5 to a later version and who use realtime with peers that have mailboxes were experiencing runaway situations that manifested as a continuous stream of taskprocessor congestion errors, memory leaks and an unresponsive chan_sip. A related issue was that setting rtcachefriends=no NEVER worked in asterisk 13 (since the move to stasis). In 13.5 and earlier, when a peer tried to register, all of the stasis threads would block and chan_sip would again become unresponsive. After 13.5, the runaway would happen. There were a number of causes... * mwi_event_cb was (indirectly) calling build_peer even though calls to mwi_event_cb are often caused by build_peer. * In an effort to prevent chan_sip from being unloaded while messages were still in flight, destroy_mailboxes was calling stasis_unsubscribe_and_join but in some cases waited forever for the final message. * add_peer_mailboxes wasn't properly marking the existing mailboxes on a peer as "keep" so build_peer would always delete them all. * add_peer_mwi_subs was unsubscribing existing mailbox subscriptions then just creating them again. All of this was causing a flood of subscribes and unsubscribes on multiple threads all for the same peer and mailbox. Fixes... * add_peer_mailboxes now marks mailboxes correctly and build_peer only deletes the ones that really are no longer needed by the peer. * add_peer_mwi_subs now only adds subscriptions marked as "new" instead of unsubscribing and resubscribing everything. It also adds the peer object's address to the mailbox instead of its name to the subscription userdata so mwi_event_cb doesn't have to call build_peer. With these changes, with rtcachefriends=yes (the most common setting), there are no leaks, locks, loops or crashes at shutdown. rtcachefriends=no still causes leaks but at least it doesn't lock, loop or crash. Since making rtcachefriends=no work wasnt in scope for this issue, further work will have to be deferred to a separate patch. Side fixes... * The ast_lock_track structure had a member named "thread" which gdb doesn't like since it conflicts with it's "thread" command. That member was renamed to "thread_id". ASTERISK-25468 #close Change-Id: I07519ef7f092629e1e844f855abd279d6475cdd0 2016-09-21 15:03 +0000 [323aff3a09] Joshua Colp * core: Ensure presencestate subtype and message are NULL. When retrieving presence state information there is no guarantee that the subtype and message passed in are set to NULL. This change ensures they are. ASTERISK-26397 #close Change-Id: I61f8187972d5d8bbd7d6b7f4daa4f4f7e8237b23 2016-09-21 10:48 +0000 [10c180760c] Joshua Colp * res_odbc: Make pooling option deprecation notice more useful. This changes the notice for the deprecation of the old pooling options to point to the new option for doing pooling. This gives a clearer direction as to what to look into. ASTERISK-26389 #close Change-Id: I2ca9cdfdcd75aec170a7db9d5ff69a4cd25b7c10 2016-09-12 07:37 +0000 [42cc267016] Tzafrir Cohen * cdr_mysql: fix UTC support * Make 'cdrzone=UTC' work properly. * Fix the documentation of cdr_mysql.conf: it's cdrzone and not timezone ASTERISK-26359 #close Change-Id: I2a6f67b71bbbe77cac31a34d0bbfb1d67c933778 2016-09-21 08:46 +0000 [f16ab19292] Joshua Colp * odbc: Remove options that are no longer applicable. The pooling, shared_connection, limit, and idlecheck options are no longer used in res_odbc. ASTERISK-26389 Change-Id: I2fde7b467d01f9d1c82cc0a339bb4f7e1dd6bbe6 2016-09-20 15:17 +0000 [c9ce299b64] Corey Farrell * core: Fix LOW_MEMORY missing symbol ast_pbx_uuid_get. Move the function outside the conditional block that excludes LOW_MEMORY. ASTERISK-26273 #close Change-Id: Ic290fa128222c410c3531107e30efacabc8493b4 2016-09-20 10:05 +0000 [610eb4c189] Corey Farrell * logger: Fix default console settings. When logger.conf is missing or invalid we should be printing notices, warnings and errors to the console. The logmask was incorrectly calculated. Change-Id: Ibaa9465a8682854bc1a5e9ba07079bea1bfb6bb3 2016-06-27 14:26 +0000 [36092ee3a0] Tzafrir Cohen * sd_notify (systemd status notifications) support sd_notify() is used to notify systemd of changes to the status of the process. This allows the systemd daemon to know when the process finished loading (and thus only start another program after Asterisk has finished loading). To use this, use a systemd unit with 'Type=notify' for Asterisk. This commit also adds the function ast_sd_notify(), a wrapper around sd_notify that does nothing if not built with systemd support. Also adds support for libsystemd detection in the configure script. Change-Id: Ied6a59dafd5ef331c5c7ae8f3ccd2dfc94be7811 (cherry picked from commit 07b95f7c65b7c083724f1af2b26f93cc22cad58c) 2016-09-19 14:21 +0000 [9372d32100] Walter Doekes * asterisk.c: Non-root users also get the astcanary after core restart. Without this change, a 'core restart' would kill the astcanary forever if you're not running as root. Both with and without this patch, the scheduling priority was still SCHED_RR after restart. Additionally, the astcanary is now spawned if you start with high priority and Asterisk doesn't get a chance to lower it. For example through: `chrt -r 10 sudo -u asterisk asterisk -c` Also reap killed astcanary processes on core restart. ASTERISK-26352 #close Change-Id: Iacb49f26491a0717084ad46ed96b0bea5f627a55 2016-09-19 09:40 +0000 [e96448e991] Walter Doekes * asterisk.c: When astcanary dies on linux, reset priority on all threads. Previously only the canary checking thread itself had its priority set to SCHED_OTHER. Now all threads are traversed and adjusted. ASTERISK-19867 #close Reported by: Xavier Hienne Change-Id: Ie0dd02a3ec42f66a78303e9c1aac28f7ed9aae39 2016-09-09 06:35 +0000 [01884a7af6] Timo Teräs * Fix showing of swap details when sysinfo() is available If sysinfo() is available, but not sysctl() or swapctl() the printing code for swap buffer sizes is incorrectly omitted. The above condition happens with musl c-library. Fix #if rule to consider defined(HAVE_SYSINFO). And also remove the redundant || defined(HAVE_SYSCTL) which was incorrectly there to start with. Now swap information is displayed only if an actual libc function to get it is available. This also fixes warnings previously seen with musl libc: [CC] asterisk.c -> asterisk.o asterisk.c: In function 'handle_show_sysinfo': asterisk.c:773:6: warning: variable 'totalswap' set but not used [-Wunused-but-set-variable] int totalswap = 0; ^~~~~~~~~ asterisk.c:770:11: warning: variable 'freeswap' set but not used [-Wunused-but-set-variable] uint64_t freeswap = 0; ^~~~~~~~ Change-Id: I1fb21dad8f27e416c60f138c6f2bff03fb626eca 2016-09-12 18:00 +0000 [cdbad152c7] Richard Mudgett * res_config_odbc.c: Fix buffer size limitation creating invalid SQL. Creating ODBC SQL queries resulted in queries too large to fit into the supplied buffer. The resulting truncated buffer contained an invalid SQL query. * Made SQL query generation code use a thread storage buffer that can increase in size as needed. * Fixed bad multi-line warning messages. ASTERISK-26263 #close Reported by: Jeppe Ryskov Larsen Change-Id: I23f3cdd43c2dac80bed3ded4dd77d18cb17f21ae 2016-09-14 08:42 +0000 [449719be00] Joshua Colp * res_pjsip_multihomed: Change Contact port to listening port. The res_pjsip_multihomed module determines what interface and transport a request is going out on and updates the SIP message accordingly with the address information. This currently incorrectly updates the Contact header for connectionful protocols to the ephemeral connection port, instead of the bound address for the listening socket which can actually accept the connection back. If the remote side attempts to connect back on the epehemeral port it will fail. This change makes it so the port is updated to the bound port on connectionful protocols and is maintained on UDP (as there can be multiple of those). ASTERISK-26374 #close Change-Id: I50f8dab65b9f75117d73ba5f6bbcf6c9871854ab 2016-09-07 14:48 +0000 [4d64b176eb] gtjoseph * pjproject_bundled: Prevent SERVFAIL from marking name server bad A name server that returns "Server Failure" is indicating only that the server couldn't process that particular request. We should NOT assume that the name server is incapable of serving other requests. Here's the scenario we've been encountering... * 2 local name servers configured in resolv.conf. * An OPTIONS request causes a request for A and AAAA records to go out to both nameservers. * The A responses both come back successfully resolved. * Because of an issue at some upstream nameserver, the AAAA responses for that particular query come back as "SERVFAIL" from both local name servers. * Both local servers are marked as bad and no further queries can be sent until the 60 second ttl expires. Only previously cached results can be used. * In this case, 60 seconds is just enough time for another OPTIONS request to go out to the same host so the cycle repeats. We could set the bad ttl really low but that also affects REFUSED and NOTAUTH which probably DO signal a real server issue. Besides, even a really low bad ttl would be an issue on a pbx. Although we use our own resolver in 14 and master and don't have this issue there, Teluu has merged this patch upstream so it's appropriate to cherry-pick to 14 and master to keep pjproject consistent. Change-Id: Ie03ba902288e274aff23f9b9bb2786e1e8be09e0 2016-09-14 07:59 +0000 [1cac856e17] Joshua Colp * rtp: Preserve timestamps on video frames. Currently when receiving video over RTP we store only a calculated samples on the frame. When starting the video it can take some time for this calculation to actually yield a value as it requires constant changing timestamps. As well if a video frame passes over multiple RTP packets this calculation will fail as the timestamp is the same as the previous RTP packet and the number of samples calculated will be 0. This change preserves the timestamp on the frame and allows it to pass through the core. When sending the video this timestamp is used instead of a new one being calculated. ASTERISK-26367 #close Change-Id: Iba8179fb5c14c9443aee4baf670d2185da3ecfbd 2016-09-14 09:51 +0000 [9df4056d70] Joshua Colp * res_pjsip_transport_management: Convert time in log message to seconds. ASTERISK-26375 #close Change-Id: I46496af5cae41413e76d44d2068a7431279f09dc 2016-09-13 05:34 +0000 [98e42cc662] Steve Davies * chan_sip: Fix session timeout on retransmit of non-UDP packets Change-Id I1cd33453c77c56c8e1394cd60a6f17bb61c1d957 Enable Session-Timers for SIP over TCP (and TLS) also disables SIP retransmits in chan_sip for non-UDP connections, allowing the TCP layer to handle the retransmits. Unfortunately, this caused sessions to be terminated with a retransmit timeout becasue it stopped at the point of the first retrans call. This patch waits for the 64*T1 timer to expire instead. ASTERISK-19968 Change-Id: I844f26801aada10bc94e9bebe6e151f0a8443204 2016-09-12 12:25 +0000 [0388882cdb] Richard Mudgett * app_queue: Fix CLI "queue show" and AMI Queues action output truncation. The output of CLI "queue show" and AMI Queues action is truncated and "failed to extend from 240 to 327" messages are generated if the queue member and interface names are lengthy. * Increase the string buffer size from 240 to 512 in order to accommodate for more information fields added to the output since v1.8. ASTERISK-26360 #close Reported by: Richard Mudgett Change-Id: Id99c03cf5362453b80491a4b3b0434cb67aa966d 2016-09-12 03:28 +0000 [da8ba990d1] Walter Doekes * chan_sip: Allow target refresh (Contact update) on re-INVITE. Previously, the Contact was stored only on initial INVITE and on any 18X and 200. That meant that after re-INVITEs from *us* the Contact could get updated, but after re-INVITEs from the *peer*, it did not. This changeset fixes this inconsistency, properly allowing target refreshes through re-INVITES (RFC3261, 12.2). If your strictrtp setting allows it, this change allows you to switch the source IP of a connected/calling device mid-call with a simple re-INVITE from the new IP. ASTERISK-26358 #close Change-Id: Ibb8512054ab27c8c3d2514022568fde943bf2435 2016-08-31 15:22 +0000 [e9ddab4685] Richard Mudgett * sip_to_pjsip.py: Map legacy_useroption_parsing. Map the sip.conf general section legacy_useroption_parsing to the new pjsip.conf global ignore_uri_user_options. ASTERISK-26316 Reported by: Kevin Harwell Change-Id: I78108a31995db19d41f4e1a07b3324692c5363fc 2016-08-29 18:08 +0000 [30af92e78d] Richard Mudgett * res_pjsip: Add ignore_uri_user_options option. This implements the chan_sip legacy_useroption_parsing option but with a better name. * Made the caller-id number and redirecting number strings obtained from incoming SIP URI user fields always truncated at the first semicolon. People don't care about anything after the semicolon showing up on their displays even though the RFC allows the semicolon. ASTERISK-26316 #close Reported by: Kevin Harwell Change-Id: Ib42b0e940dd34d84c7b14bc2e90d1ba392624f62 2016-09-09 06:26 +0000 [7ed5dc2c58] Walter Doekes * contrib: Let safe_asterisk script continue without /dev/tty9. If you use the safe_asterisk script, it uses hardcoded defaults before running configurable values from /etc/asterisk/startup.d. The hardcoded default has TTY=9. Some containerized environments don't have such a TTY, and safe_asterisk would stop. The custom configuration from /etc/asterisk/startup.d/* isn't read until after it stopped, so changing TTY in a custom config did not help. This changeset changes safe_asterisk to continue if the TTY setting was untouched and /dev/tty9 and /dev/vc/9 aren't found. Change-Id: I2c7cdba549b77f418a0af4cb1227e8e6fe4148fc 2016-09-09 05:39 +0000 [7580a736bb] Joshua Colp * res_pjsip: Only invoke unidentified endpoint logic when unidentified. The code was incorrectly invoking the unidentified logic when an endpoint had actually been identified, causing log messages to be output. ASTERISK-26349 #close Change-Id: Id8104fc9e3d138d5e8b6f6977ecc08765fd17d4f 2016-08-23 06:35 +0000 [efcfc4c1ee] Corey Farrell (license 5909) * chan_sip: Don't allocate new RTP instances on top of old ones. In some scenarios dialog_initialize_rtp can be called multiple times on the same dialog. This can cause RTP instances to be leaked along with multiple file descriptors for each instance. This change makes it so the existing RTP instances are destroyed and not overwritten, stopping the memory leak. ASTERISK-26272 #close patches: ASTERISK-26272-13.patch submitted by Corey Farrell (license 5909) Change-Id: Id529de1184c68f2f4d254ab41a1f458dafdb5f73 2016-08-16 15:34 +0000 [f1ffc22933] Mark Michelson * res_pjsip: Do not crash on ACKs from unknown endpoints. The endpoint identification PJSIP module is intended to identify which endpoint an incoming request is from. If an endpoint is not identified, then an artificial endpoint is used in its place when proceeding. The problem is that the ACK request type is an exception to the rule. The artificial endpoint is not used when processing an ACK. This results in the possibility of having a NULL endpoint being used further on. The reason ACK is an exception is an attempt not to spam security logs with unidentified requests. Presumably, you've already logged the unidentified request on the preceeding INVITE. Up until Asterisk 13.10, retrieving a NULL endpoint in this fashion didn't cause an issue. A new change in 13.10 added endpoint ACL checking shortly after endpoint identification. Because we are accessing a NULL endpoint, this ACL check resulted in a crash. The fix here is to be sure to retrieve the artificial endpoint for all request types. ACKs still do not generate unidentified request security events. ASTERISK-26264 #close Reported by nappsoft AST-2016-006 Change-Id: Ie0c795ae2d72273decb972dd74b6a1489fb6b703 2016-09-06 11:46 +0000 [23d6ec7417] Richard Mudgett * res_pjsip_messaging.c: Misc cleanups and fixes. * Eliminated RAII_VAR in get_outbound_endpoint(). * Simplify update_to() coding. However, this function can only be a NoOp because the To string can only be a URI and not a name-address formatted string. * Simplify update_from() coding. Also fixed a code path modifying the from string when the caller could still want to use the original string. * Fixed msg_data_create() incompletely removing the "pjsip:" to then add back the "sip:" string if needed. The code didn't handle the "pjsip:sip:" case because it left the colon after pjsip in the string. Change-Id: I68a09a665f6d4daa9eaa59069045ab69122e28db 2016-09-07 16:00 +0000 [5f19657710] Joshua Colp * res_pjsip: Allow global headers to be overridden. Currently when you add global headers from the dialplan both the header in the dialplan and the globally configured header are added to the resulting SIP INVITE. This change makes it so the headers in the dialplan take precedence and are the only ones added. Change-Id: I36f864298f38db3632ad503edc11267cb8ffb3ad 2016-08-11 12:10 +0000 [206d4f57dc] Tzafrir Cohen * followme: initialize all config items on reload Some configuration directives were not initialized on reload, and hence were not reset to default if they were removed from followme.conf. ASTERISK-26288 #close Change-Id: Ief829e16374ad1e0ecfd63e6ee4923b5a1d1c150 2016-08-01 20:55 +0000 [117a7741c8] gtjoseph * build: Add download capability for external packages The DPMA and g729a, silk, siren7 and siren14 codecs hosted at http://downloads.digium.com/pub/telephony/ are now listed in the "External" sections of the "Resource Modules" and "Codec Translators" pages in menuselect. Any that are selected will automatically be downloaded and installed when "make install" is run. Their LICENSE and README (if avaialble) files will be installed to ASTVARLIBDIR/documentation/thirdparty/. Example use with codecs: The codecs/codecs.xml file is a menuselect style xml file that lists the codecs to be included. Their support levels are 'external', which triggers the download and install, and defaultenabled is no. Also because codec_g729a is actually in a directory named codec_g729 on the download server, the newly added 'member_data' element is used to override the default of the directory name being the package name. You can use the 'directory_name' attribute to keep default base URL (http://downloads.digium.com/pub/telephony/) but use the new directory, or you use the 'remote_url' attribute to specify a full URL to the download directory. In this case, you must still follow the same subdirectory naming conventions as that used for the packages located at 'http://downloads.digium.com/pub/telephony'. A new configure option '--with-externals-cache' was added and like '--with-sounds-cache' it allows the installer to cache tarballs so they're not downloaded every time. To assist with the download and install process, each external package now has a manifest.xml file that, among other things, contains a package version and checksums for each file in the tarball. The manifest is saved to both the cache directory and ASTMODDIR and together with the manifest.xml on the downloads site, tells the install scripts whether a download and/or update is needed. bash and xmlstarlet are required for downloader operation. If they're not installed, the external items in menuselect will be unavailable. Change-Id: Id3dcf1289ffd3cb0bbd7dfab3cafbb87be60323a 2016-09-06 02:41 +0000 [d04ae7d1d8] Walter Doekes * chan_sip: Don't refuse calls with "optional crypto"; fall back to RTP. Certain SNOM phones send so-called "optional crypto" in their SDP body. Regular SRTP setup looks like this: m=audio 64620 RTP/SAVP 8 0 9 99 3 18 4 101 a=crypto:1 AES_CM_128_HMAC_SHA1_32 inline:... SNOM-style "optional crypto" looks like this: m=audio 61438 RTP/AVP 8 0 9 99 3 18 4 101 a=crypto:1 AES_CM_128_HMAC_SHA1_32 inline:... A crypto line is supplied, but the m-line does not have SAVP. When res_srtp.so is *not* loaded, then chan_sip.so treats the optional crypto as regular RTP, but when res_srtp.so *is* loaded, it refuses the incoming call with the following message: WARNING: process_sdp: Failed to receive SDP offer/answer with required SRTP crypto attributes for audio For platforms that want to start providing SRTP this presents a compatibility problem. This changeset lets chan_sip handle the SDP as if no crypto-line was supplied: i.e. accept the call as regular RTP, just like it did before res_srtp was loaded. Now you'll get this informative warning instead: WARNING: Ignoring crypto attribute in SDP because RTP transport is insecure ASTERISK-23989 #close Reported by: Olle Johansson Change-Id: I91a15ae05a0296e398d6b65f53bb11afde1d80e2 2016-09-03 16:04 +0000 [df3d0188e4] Matt Jordan * apps/app_dial: Fix crash on non-connect call paths for Privacy/Screening option In any scenario in which the callee is not connected to the caller, the current code in app_dial will crash due to raising a Dial End Stasis Message after the callee channel has been hung up. This patch corrects the error by simply moving the explicit hangup of the callee (peer) channel until after the dial end message. ASTERISK-25691 #close Change-Id: I816a414014424d0d8c80e2a3cbef13ef8c63798d 2016-09-03 16:02 +0000 [a64063cc97] Matt Jordan * apps/app_dial: Set the DIALSTATUS to NOANSWER on privacy option 5 If the callee selects option '5' using the Dial application's privacy (P) option, the DIALSTATUS is erroneously set to ANSWER. This option reflects the callee sending the caller to VoiceMail one time; the call is definitely *not* ANSWERed in such a scenario. With this patch, the DIALSTATUS is instead set to NOANSWER, which is the same DIALSTATUS that is set when the 'send to VoiceMail every time' option is set. ASTERISK-25691 Change-Id: Iaf0c9f0fa00545e7366443875e2bb7d9a89a1358 2016-08-30 16:40 +0000 [03fc438f6e] Richard Mudgett * res_pjsip_registrar.c: Reduce stack usage in find_aor_name(). Change-Id: I8aebad1fdcf303bd115b59a4b57fbbd5b2267f09 2016-08-29 18:06 +0000 [b5e753227d] Richard Mudgett * pjsip_configuration.c: Ignore repeated identify by methods. Change-Id: Ied0c06043d1dfef8fdc9c9a808cf89b118119838 2016-08-30 17:26 +0000 [9b7501b6ad] Richard Mudgett * config_global.c: Comments and a default expression adjustment. Change-Id: Ia6a58f8c73a30da6874b3f94364dce162d6f1ad3 2016-08-31 15:14 +0000 [3314e1cec2] Richard Mudgett * sip_to_pjsip.py: Map canreinvite as directmedia alias. Change-Id: I48b8e150f96a3d2a24d8fc25fbe4f5aff9f4a6b2 2016-08-31 15:37 +0000 [6372f40ba0] Richard Mudgett * sip_to_pjsip.py: Fix typo converting outboundproxy registration. Change-Id: I6f30e5f9fcf8469ba0079fbf884047d54c2c0b15 2016-08-31 15:13 +0000 [11eb1afd2d] Richard Mudgett * sip_to_pjsip.py: Fix comment typo and tabs. Change-Id: If35174614545727817d329c60ba4456c028941b5 2016-08-31 15:56 +0000 [0f9b144c1a] Richard Mudgett * Sample configs: Eliminate false multiline comment block starts. Change-Id: Ie627def9604ae30abd80754f9e6f09874825aec6 2016-09-02 11:36 +0000 [8d1c535bd6] Richard Mudgett * format_cap.c: Fix CLI "core show channeltype Surrogate" crash. * Make ast_format_cap_get_names() NULL tolerant. ASTERISK-26331 #close Reported by: CGI.NET Change-Id: Id67e93936dc8ec2a33a9d33655843d43b59285a3 2016-08-18 14:45 +0000 [9bca895469] Alexei Gradinari * res_pjsip_session: segfault on already disconnected session On heavy loaded system the TCP/TLS incoming calls could be disconnected by pjproject while these calls are being processed by asterisk which could use the session's memory pools. If the session in the disconnected state then the session memory pools were already freed, so we get segfault. This patch adds a lifetime control on an INVITE session to pjproject. The lifetime of the session is manipulated by calling pjsip_inv_add_ref/pjsip_inv_dec_ref. This patch uses these functions to inform pjproject that the session is in use. This patch adds check if the session state is not disconnected and also checks if the memory pool is not NULL. This patch also places tasks 'session_end' and 'session_end_completion' into session's serializer to avoid race condition. ASTERISK-26291 #close Change-Id: I4d28b1fb3b91f0492a911d110049d670fdc3c8d7 2016-08-10 15:14 +0000 [63feffa126] Mark Michelson * ConfBridge: Make some announcements asynchronous. Confbridge announcements tend to block a channel while they are being played. In some circumstances, this is warranted since you want that particular channel not to hear the announcement (Example: "John Doe has entered the conference"). For others it makes less sense. This change first introduces methods for playing sounds asynchronously into the conference. This is very similar to how synchronous sounds are played, except the channel initiating the playback does not wait for the sound to complete before moving on. Asynchronous announcements are used for two circumstances: * Sounds played for a user after they have left the bridge * Sounds that play first to a single user and then the rest of the conference (if the channel and conference use the same language) ASTERISK-26289 #close Reported by Mark Michelson Change-Id: Ie486bb3de1646d50894489030326a423e594ab0a 2016-08-31 12:23 +0000 [a002a4d2db] Michael Kuron * app_mp3: Use correct buffer size and the same sample rate as the channel Previously, the buffer used for MP3 streamed from HTTP servers had a size of 1 MB. For 8 kHz mono audio at 16 bit resolution, such a buffer covers about 1 minute. Only when the buffer is full does audio start to play. For MP3 files streamed from a server, that is usually not a big deal as long as the connection to the server is fast enough to supply that much data within a second or two. For MP3 live streams however, it takes 1 minute to download 1 minute of audio, so without this change, app_mp3 wasn't really usable for MP3 live streams. This commit changes the buffer size so that it covers 6 seconds of an MP3 file streamed from a server and 0.5 seconds of an MP3 live stream. The latter is identified by the use of a .m3u file extension. app_mp3 so far only supported 8 kHz audio. Now it always runs at the sample rate of the channel. ASTERISK-26085 #close Change-Id: Id1ee274733cd804a0edecf7450329b72f1235af0 2016-08-26 10:39 +0000 [308a65fe6c] Alexei Gradinari * res_pjsip: qualify/unqualify added/deleted realtime endpoints If the PJSIP endpoint's AOR with the permanent contact was deleted from the realtime storage the res_pjsip module continues trying to qualify this contact. The error 'Unable to find an endpoint to qualify contact' appeares every 'qualify_frequency' seconds. This patch deletes this contact in this case. The PJSIP endpoint's AOR with the permanent contact is never qualified if it is added to realtime storage after asterisk started. This patch adds qualifying for the AOR's permanent contacts on the first handling of this AOR. ASTERISK-26319 #close Change-Id: Ib93dded9121edb113076903d1aa95402f799f8fe 2016-08-17 02:51 +0000 [2fa168348e] chris de rock * app_macro: Consider '~~s~~' as a macro start extension. As described in issue ASTERISK-26282 the AEL parser creates macros with extension '~~s~~'. app_macro searches only for extension 's' so the created extension cannot be found. with this patch app_macro searches for both extensions and performs the right extension. ASTERISK-26282 #close Change-Id: I939aa2a694148cc1054dd75ec0c47c47f47c90fb 2016-08-29 07:10 +0000 [27951792c4] Etienne Lessard * pbx.c: Prevent infinite recursion in manager_show_dialplan_helper. Previously, if context A was including context B and context B was including context A, i.e. if there was a circular dependency between contexts, then calling manager_show_dialplan_helper could lead to an infinite recursion, resulting in a crash. This commit applies the same solution as the one implemented in the show_dialplan_helper function. The manager_show_dialplan_helper and show_dialplan_helper functions contain lots of code in common, but the former was missing the "infinite recursion avoidance" code. ASTERISK-26226 #close Change-Id: I1aea85133c21787226f4f8442253a93000aa0897 2016-08-26 14:34 +0000 [fb82fdb013] gtjoseph * pjproject_bundled: Disable srtp use by pjmedia The reason for the disable is that while Asterisk works fine with older libsrtp versions, newer versions of pjproject won't compile with them. Debian 6 for instance, has libsrtp 1.4.4 which is older than what pjproject is expecting. We don't use most of pjmedia but we DO use it for SDP negotiation. Luckily disabling srtp in pjmedia doesn't interfere with it's ability to negitiate a secure channel. The proper crypto attributes are negotiated in both directions. ASTERISK-26279 #close Change-Id: Id25a92cdf3df97a26c53cffae65b6b82de33c8e2 2016-08-26 08:41 +0000 [847bd47ff0] Alexander Traud * channel: No hung-up on failing security requirements. In your Diaplan, if you specify same => n,Set(CHANNEL(secure_bridge_media)=1) same => n,Set(CHANNEL(secure_bridge_signaling)=1) only the SIP channel driver chan_sip supports this. All other channels drivers like res_pjsip fail. In case of failure, the original sRTP source code released the whole channel, even if not hung-up, yet. This change does not release the channel but instead hangs-up the channel. ASTERISK-26306 Change-Id: I0489f0cb660fab6673b0db8af027d116e70a66db 2016-08-20 09:04 +0000 [b59d3b48d0] Alexander Traud * sip_to_pjsip: Migrate IPv4/IPv6 (Dual Stack) configurations. When using the migration script sip_to_pjsip.py, and your sip.conf is configured with bindaddr=::, two transports are written to pjsip.conf, one for 0.0.0.0 (IPv4) and one for [::] (IPv6). That way, PJProject listens on the IPv4 and IPv6 wildcards; a IPv4/IPv6 Dual Stack configuration on a single interface like in chan_sip. Furthermore, the script internal functions "build_host" and "split_hostport" did not parse Literal IPv6 addresses as expected (like [::1]:5060). This change makes sure, even such addresses are parsed correctly. ASTERISK-26309 Change-Id: Ia4799a0f80fc30c0550fc373efc207c3330aeb48 2016-08-25 07:06 +0000 [f69f5cd3c4] Joshua Colp * app_queue: Ensure member is removed from pending when hanging up. When dialing channels it is possible that they may not ever leave the not in use state (Local channels in particular) by the time we cancel them. If this occurs but we know they were dialed we explicitly remove them from the pending members container so that subsequent call attempts occur. ASTERISK-26299 #close Change-Id: I6ad0d17c36480c92cebf840626228ce3f7e4bd65 2016-08-04 20:11 +0000 [5cd583d7a2] Richard Mudgett * res_pjsip: Cache global config options. We may check a global config option hundreds of times a second or more. Asking sorcery for the global configuration from the config files backend involves several allocations and container traversals. Using realtime without a memory cache is a lot worse because you have to lookup in the realtime database each time to reconstitute the sorcery object. With a memory cache for realtime, there is about the same amount of overhead as for config files. Either way, it is still fairly expensive to access the sorcery object that much. * Cache the global config options so we can access them faster. You must now always perform a res_pjsip reload to change the global options. Change-Id: Ice16c7a4cbca4614da344aaea21a072b86263ef7 2016-08-23 11:02 +0000 [8b4b2500ee] Richard Mudgett * res_fax: Fix deadlock in ast_channel_get_t38_state(). ast_channel_get_t38_state() calls ast_channel_queryoption() with AST_OPTION_T38_STATE. If the passed in channel is a local channel then a deadlock can happen if a channel lock is held when called. * Made ast_channel_get_t38_state() callers not hold a channel lock before calling. * Update ast_channel_get_t38_state() doxygen to note that no channel locks can be held when calling the function. ASTERISK-26203 #close Reported by: Etienne Lessard ASTERISK-24822 #close Reported by: David Brillert ASTERISK-22732 #close Reported by: Richard Mudgett Change-Id: I49fd76fa9af628b4198009b5c0b82c8b03681214 2016-08-23 10:39 +0000 [e8d4f40022] Richard Mudgett * res_fax: Fix deadlock setting FAXMODE channel variable. ASTERISK-25980 added the FAXMODE channel variable to res_fax.c. Unfortunately, it also introduced a deadlock potential because set_channel_variables() which sets FAXMODE can be called during a masquerade. The ast_channel_get_t38_state() which gets the value used to set FAXMODE cannot be called with the channel locked. As a result, local channels can deadlock because of how they must acquire the locks necessary to operate. The intent of FAXMODE is for dialplan to know how a fax was transferred after the fax completes. However, the previous patch sets FAXMODE to the channel's current T.38 state AFTER the fax has completed and where T.38 may have already disconnected. * Set FAXMODE based upon T.38 negotiations exchanged either with the fax applications or the fax framehooks. ASTERISK-26203 Reported by: Etienne Lessard ASTERISK-24822 Reported by: David Brillert ASTERISK-22732 Reported by: Richard Mudgett Change-Id: Id525747254b64c1efe8b1b5973d52ff9719c2ae1 2016-08-22 12:31 +0000 [35cf6c7702] Richard Mudgett * res_fax.c: Fix deadlock in fax_gateway_indicate_t38(). fax_gateway_indicate_t38() calls ast_indicate_data() which cannot be called with any channel locks already held. A deadlock can happen if the function is operating on a local channel. * Made fax_gateway_indicate_t38() unlock the channel before calling ast_indicate_data() since fax_gateway_indicate_t38() is always called with the channel locked. * Made fax_gateway_indicate_t38() return void since nothing cared about its return value. ASTERISK-26203 Reported by: Etienne Lessard ASTERISK-24822 Reported by: David Brillert ASTERISK-22732 Reported by: Richard Mudgett Change-Id: I701ff2d26c5fc23e0d5a48a3fd98759a9fd09407 2016-08-23 11:16 +0000 [50b2aa506f] Richard Mudgett * res_fax.c: Add chan locked precondition comments. Change-Id: Ic10ae434536bbf7fb7055d6ab36cc50b8748a4e7 2016-08-23 10:42 +0000 [038cbc0215] Richard Mudgett * ast_framehook_detach() must be called with the channel locked. The framehook container could become corrupted if the channel lock is not held before calling. Change-Id: If0a1c7ba0484ed3a191106a7516526b905952584 2016-08-22 15:01 +0000 [88e9d05ef7] Richard Mudgett * ast_framehook_attach() must be called with the channel locked. The framehook container could become corrupted if the channel lock is not held before calling. Change-Id: I1a6b957a1f7b899eb29a186915f8cccab886a438 2016-08-24 14:42 +0000 [c9e83f6d0b] gtjoseph * res_rtp_multicast: Fix SEGV in ast_multicast_rtp_create_options ast_multicast_rtp_create_options now checks for NULL or empty options Change-Id: Ib845eae46a67a9787e89a87ebd1027344e5e0362 2016-08-19 18:19 +0000 [cb8fd610e2] Corey Farrell * Fix checks for allocation debugging. MALLOC_DEBUG should not be used to check if debugging is actually enabled, __AST_DEBUG_MALLOC should be used instead. MALLOC_DEBUG only indicates that debugging is requested, __AST_DEBUG_MALLOC indicates it is active. Change-Id: I3ce9cdb6ec91b74ee1302941328462231be1ea53 2016-08-10 15:14 +0000 [b8b5d52b5e] Mark Michelson * ConfBridge: Rework announcer channel methodology NOTE: This patch was submitted earlier and reverted because of a failing test. The test has been patched so that it adjusts for the changes here, so this is being resubmitted for review. One feature that confbridge has is the ability to play sounds to all participants in the conference. Prior to this commit, the algorithm for this was as follows: * Grab the playback lock * Push the conference announcer channel into the bridge * Play back the sound * Pull the conference announcer channel from the bridge * Release the playback lock The issue here is that the act of adding the playback channel to the bridge and removing it for each announcement is expensive. Amongst the expenses: * The announcer channel is imparted into the bridge, meaning a new thread is spun up for each playback. * When the announcer is added or removed from the bridge, it results in the BRIDGEPEER channel variable being set on all channels in the bridge. This requires keeping the bridge locked and locking each individual channel in order to set it. * There's also just the general overhead of adding the channel and removing it from the bridge. The bridge potentially has to reconfigure every single time With this commit, the paradigm for playing back announcements has shifted. * The announcer channel is now added to the bridge when the conference is allocated, and it is hung up when the conference is destroyed. * A taskprocessor is used to queue playbacks onto the announcer channel. This keeps the behavior from before where playbacks do not overlap. * The announcer channel is no longer placed into the bridge as departable. Since we are not constantly removing the channel from the bridge, it is safe to add the channel using an independent thread and simply hang the channel up when it is time for the conference to be destroyed. The use of the taskprocessor for playbacks opens up the interesting possibility of having asynchronous announcements played. In this commit, however, the behavior is still exactly the same as it previously was. ASTERISK-26289 Reported by Mark Michelson Change-Id: Ica9fa4907c2f3728cdd1cf0bc564ef4eb40754a0 2016-08-23 05:54 +0000 [d5d7cbfcfb] Joshua Colp * Revert "ConfBridge: Rework announcer channel methodology" This reverts commit 0cdeb2bfb0f4203384c08858951af3c77be8b9b3. Change-Id: I18ba73b6d4dc0b994f4ffb01ae0b6cfad36ac636 2016-08-22 17:08 +0000 [c16ef02318] Mark Michelson * res_pjsip: Default endpoints to the "offline" status. A recent change attempted to optimize startup by not updating contact status. Instead, code responsible for qualifying contacts updates the status as it becomes known. The code even accounts for contacts/AORs that are not set to be qualified. The problem, though, is when there are no contacts associated with an endpoint. A common case is when an endpoint is set to register its contacts but has not done so yet. In this case, prior to registration, the endpoint's device state will appear to be "not in use" and hints associated with that device will appear to be "idle". In actuality, the device state and hint should both appear as "unavailable". The reason for the failure is that the optimization change made all persistent endpoint states set to "unknown". The fix here is to change the hard-coded "unknown" to be "offline" instead. The default state will be offline until the qualifying code determines that the contact is actually online. This way, if there are no contacts at all, then the state stays as offline, and device state and hints appear correctly. ASTERISK-26269 #close Reported by nappsoft Change-Id: Ie99b84169393983453076f5e9c0d35ff313a456a 2016-08-20 14:51 +0000 [e54dcf4fd5] David M. Lee * res_odbc_transaction: add dep on generic_odbc When res_odbc_transaction depended on res_odbc, it got the generic_odbc headers and libs implicitly. Now that it no longer depends on res_odbc, its dependency on generic_odbc must be explicit. Change-Id: I9db88f7af7388437f49903d3008ba8d4890d5911 2016-08-20 11:18 +0000 [be38c95def] Alexander Traud * pjproject_bundled: Allow IPv4/IPv6 (Dual Stack) configurations. PJProject supports a lot of platforms even Windows, some with different defaults when it comes to IPv6. In many Linux platforms like Ubuntu 16.04 LTS, "/proc/sys/net/ipv6/bindv6only" is set to 0 (false). Different than in Windows. Because of this, if configured with just an IPv6 address/transport, PJProject listens to both IPv4 and IPv6. However, this is not supported by the PJProject team. As consequence, you end-up with IPv4-mapped IPv6 addresses in SDP, incompatible with IPv4-only clients. Technically, you end-up with an IPv6-only server which accepts incoming connections on IPv4. If you try to configure two transports, one with IPv4 and one with IPv6 on the same interface, as expected by the PJProject team, the IPv4 transport is not able to bind because the IPv6 transport listens to both already. One solution would be to change "/proc/sys/net/ipv6/bindv6only" system-wide. Then, you are able to configure two transports, one for each IP version on the same interface. That way, you get a server which works with IPv4 clients and IPv6 clients at the same time over the same interface. Here, this change sets this parameter directly within PJProject to match the expectations of the PJProject team in any case. This allows IPv4/IPv6 Dual Stack servers out of the box like in chan_sip. This change was accepted by the PJProject team as and is expected to arrive in the next version, PJProject 2.6.0. Until then, this change is incorporated in the bundled PJProject of Asterisk. ASTERISK-26309 Change-Id: I3335d8718f79f4b2feae91b5b005a3ce684a63ae 2016-08-10 15:14 +0000 [0cdeb2bfb0] Mark Michelson * ConfBridge: Rework announcer channel methodology One feature that confbridge has is the ability to play sounds to all participants in the conference. Prior to this commit, the algorithm for this was as follows: * Grab the playback lock * Push the conference announcer channel into the bridge * Play back the sound * Pull the conference announcer channel from the bridge * Release the playback lock The issue here is that the act of adding the playback channel to the bridge and removing it for each announcement is expensive. Amongst the expenses: * The announcer channel is imparted into the bridge, meaning a new thread is spun up for each playback. * When the announcer is added or removed from the bridge, it results in the BRIDGEPEER channel variable being set on all channels in the bridge. This requires keeping the bridge locked and locking each individual channel in order to set it. * There's also just the general overhead of adding the channel and removing it from the bridge. The bridge potentially has to reconfigure every single time With this commit, the paradigm for playing back announcements has shifted. * The announcer channel is now added to the bridge when the conference is allocated, and it is hung up when the conference is destroyed. * A taskprocessor is used to queue playbacks onto the announcer channel. This keeps the behavior from before where playbacks do not overlap. * The announcer channel is no longer placed into the bridge as departable. Since we are not constantly removing the channel from the bridge, it is safe to add the channel using an independent thread and simply hang the channel up when it is time for the conference to be destroyed. The use of the taskprocessor for playbacks opens up the interesting possibility of having asynchronous announcements played. In this commit, however, the behavior is still exactly the same as it previously was. ASTERISK-26289 Reported by Mark Michelson Change-Id: Ic5cd2c4b98a1eaa1715eb7a5b35d62f1a76d78a5 2016-08-19 10:21 +0000 [b494b9f88c] Alexei Gradinari * compilation failed with -Werror=maybe-uninitialized The compilation failed for devmode --enable DONT_OPTIMIZE --enable BETTER_BACKTRACES --enable DO_CRASH --enable TEST_FRAMEWORK res_pjsip/pjsip_configuration.c: In function dtls_handler: res_pjsip/pjsip_configuration.c:974:20: error: back may be used uninitialized in this function [-Werror=maybe-uninitialized] int size = strlen(front); ^ cc1: all warnings being treated as errors Change-Id: I7f082ead0312792a577ec7c73015ba64dabca580 2016-08-19 03:59 +0000 [a628009eb9] Alexander Traud * sip_to_pjsip: Add cert_file. When using the migration script sip_to_pjsip.py, cert_file was not migrated to pjsip.conf. A previous change regarding this contained a copy/paste error. ASTERISK-22374 Change-Id: I0fa72e9412117d53b4284fc6b83fa5b2b95ba03b 2016-08-18 09:21 +0000 [b1fe070d0b] Alexander Traud * sip.conf: tlsclientmethod is using sslv23 as default. When 'tlsclientmethod' is not specified in sip.conf, chan_sip uses the OpenSSL SSLv23_method. This was documented incorrectly in the file sip.conf.sample. SSLv23_method got its name in the 90s. Today, with OpenSSL 1.0.2, this method enables (just) the secure TLSv1.0 and TLSv1.2. Or stated differently, that function should have been called 'secure_method' or 'automatic_method' back in the 90s. Consequently please, specify 'tlsclientmethod=tlsv1' in your sip.conf only if you face a server which has problems like not falling back to TLSv1.0 automatically. ASTERISK-24425 Change-Id: I502ce6146b4504cadfd3973af8d6ec3994f54fa3 2016-08-18 17:16 +0000 [ff2378c735] Kevin Harwell * rest-api: Swagger scripts were not replacing format variable in file brief Given resource paths did not have 'json' substituted in for the '{format}'. For some auto generated documentation/comment strings it resulted in something like the following: "... REST handler for /api-docs/sounds.{format}" This patch makes sure the resource api's path is properly substituted. ASTERISK-25472 #close Change-Id: Ie3e950a35db4043e284019d6c9061f3b03922e23 2016-08-16 15:57 +0000 [43f400ef95] Jason Parker (license 4993) * res_format_attr_g729: Add annexb=no format parameter to SDPs Historically, Asterisk has always specified annexb=no for the g729 format. However, when using res_pjsip no format attribute was specified. This patch makes it so the SDP now contains a format attribute line with annexb=no. Note, that this means only g729a is negotiated. Even for pass through support. According to rfc7261 the type of annex used (a or b) is dependent upon the answerer. However, Asterisk being a back to back user agent makes this tricky to support at this time, thus we only allow annex 'a' for now. ASTERISK-26228 #close patches: res_format_attr_g729.c submitted by Jason Parker (license 4993) Change-Id: I76bc20cc0a01af01536e9915afef319c269c22d0 2016-08-18 15:15 +0000 [4c1ae07d51] gtjoseph * res_odbc: Correct the dependency relationship with res_odbc_transaction The MODULEINFO dependencies between these 2 modules was reversed. res_odbc should depend on res_odbc_transaction, not the other way around. ASTERISK-25984 #close Change-Id: Ifcfbb49c0b51cf6640a5446d47cd6c48caf1331f 2016-08-18 12:04 +0000 [cab6975b02] Kevin Harwell * sip_to_pjsip: Set correct tls transport method A recent update had a copy/paste error where the unused variable 'val' was being passed to the set_value function instead of the 'method' value itself. This patch passes in the right variable. ASTERISK-22374 Change-Id: I895b7b3779ce4442bc58b8ec40d59dd29bb43f06 2016-08-18 08:19 +0000 [2381ddde63] Alexander Traud * sip_to_pjsip: Map the TLS method correctly. When using the migration script sip_to_pjsip.py and tlsclientmethod is not set in sip.conf, the default value of chan_sip (sslv23) is copied to pjsip.conf, to overwrite the default of the PJProject (tlsv1). This makes sure, res_pjsip is offering/using not just TLSv1.0 but TLSv1.2 as well. ASTERISK-22374 Change-Id: Ie530a3dae9926ae14f3920a21be1e2edb15bda4f 2016-08-18 08:17 +0000 [6500f5e138] Alexander Traud * sip_to_pjsip: Add compactheaders, timerb, timert1, and useragent. When using the migration script sip_to_pjsip.py, no section of type=system or type=general were created. Therefore the keys compactheaders, timerb, timert1, and useragent were not migrated to pjsip.conf. ASTERISK-22374 Change-Id: I318a453843227ea36bf130d392d4abd7bd26b5a1 2016-08-18 08:16 +0000 [21e9c69e56] Alexander Traud * sip_to_pjsip: Map (session-)timers correctly. When using the migration script sip_to_pjsip.py, session-timers=accept and session-timers=refuse were mapped to wrong values. ASTERISK-22374 Change-Id: Ie4e90d5f6a29aff07837b7fe5bc8aea5fb6fc092 2016-08-18 08:15 +0000 [c9a97398f7] Alexander Traud * sip_to_pjsip: Write username even without authname. When using the migration script sip_to_pjsip.py, now the (mandatory) username is written to pjsip.conf, even if there was no (optional) authname in the register string in sip.conf. ASTERISK-22374 Change-Id: Ie53e1997104cd2674821688b8a8247249f5e156f 2016-08-18 08:14 +0000 [60275359bc] Alexander Traud * sip_to_pjsip: Parse register even with transport. When using the migration script sip_to_pjsip.py and the register string started with a transport in sip.conf - like tls://... - register was not parsed correctly and therefore not migrated correctly to pjsip.conf. ASTERISK-22374 Change-Id: I44c12104eea2bd8558ada6d25d77edfecd92edd2 2016-08-18 08:13 +0000 [0d479232eb] Alexander Traud * sip_to_pjsip: Write local_net, contact_acl, contact_deny, and contact_permit. When using the migration script sip_to_pjsip.py, those keys got missing. These keys might appear several times and the function "merge_value" tried to collect those. However, because these keys have different names in sip.conf and pjsip.conf, "merge_value" was not able to find the new key name in sip.conf. This change lets "merge_value" search with the old key name in sip.conf and write with the new key name in pjsip.conf. ASTERISK-22374 Change-Id: Ie53c5278ae6f1cb8fa7e96c5289877d46981d9d2 2016-08-18 08:11 +0000 [cbc1b2d020] Alexander Traud * sip_to_pjsip: Map externhost/ip to Transports. When using the migration script sip_to_pjsip.py, the externhost or externip of sip.conf were erroneously written to Endpoints instead to Transports. ASTERISK-22374 Change-Id: I2c5873386cfc388899fa9cf2368639dd12f1b8e4 2016-08-18 08:04 +0000 [5f33e99534] Alexander Traud * sip_to_pjsip: Add defaultexpiry, maxexpiry, and minexpiry. When using the migration script sip_to_pjsip.py, defaultexpiry, maxexpiry, and minexpiry were not migrated to pjsip.conf. ASTERISK-22374 Change-Id: I007fbf543dcadc96fc3ed71c54da502bcb209b7b 2016-08-18 08:03 +0000 [231ea0350d] Alexander Traud * sip_to_pjsip: Write media_encryption. When using the migration script sip_to_pjsip.py, encryption=yes got missing and media_encryption=sdes was not written to pjsip.conf, because of a typo. ASTERISK-22374 Change-Id: I0fc3e55dc512a57603ae0fef41baacccf2a35c05 2016-08-18 08:02 +0000 [23eb065121] Alexander Traud * sip_to_pjsip: Write cos and tos. When using the migration script sip_to_pjsip.py, both tos_sip and cos_sip got missed, because of a typo. Therefore, cos and tos were not written to pjsip.conf. Furthermore, that revealed a misuse of an internal function, caused by a copy-and-paste error. ASTERISK-22374 Change-Id: Id245ebadf70ab9776eb280c026288540af3af5c2 2016-08-18 07:55 +0000 [0b675a208b] Alexander Traud * sip_to_pjsip: Add cert_file and ca_list_path. When using the migration script sip_to_pjsip.py, cert_file and ca_list_path were not migrated to pjsip.conf. ASTERISK-22374 Change-Id: I4612877d190b7f86a48698cefbf5c4db6c265825 2016-08-17 14:13 +0000 [1cd12d73a6] Richard Mudgett * res_pjsip_session.c: Fix unbound srv failover tests. Commit 1b666549f33d69dc080b212bf92126f3bc3a18b2 broke the srv failover functionality if a TCP connection gets disconnected. Under these conditions, session_inv_on_state_changed() gets a PJSIP_EVENT_TRANSPORT_ERROR and restarts the INVITE transaction on a new transport. Unfortunately, session_inv_on_tsx_state_changed() also gets the same PJSIP_EVENT_TRANSPORT_ERROR event and unconditionally terminates the session. * Made session_inv_on_tsx_state_changed() complete terminating the session on PJSIP_EVENT_TRANSPORT_ERROR only if the session state is still PJSIP_INV_STATE_DISCONNECTED. ASTERISK-26305 #close Reported by: Richard Mudgett Change-Id: If736e766b5c55b970fa38ca6c8a885caf27b897d 2016-08-16 15:36 +0000 [329507fe20] gtjoseph * res_pjsip: Add contact_user to endpoint contact_user, when specified on an endpoint, will override the user portion of the Contact header on outgoing requests. Change-Id: Icd4ebfda2f2e44d3ac749d0b4066630e988407d4 2016-08-17 08:10 +0000 [6f448f32fe] Torrey Searle * res_ari: Add http prefix to generated docs updated the uri handler to include the url prefix of the http server this enables res_ari to add it to the uris when generating docs Change-Id: I279335a2625261a8492206c37219698f42591c2e 2016-08-17 06:12 +0000 [56e0aed177] Alexander Traud * BuildSystem: Detect ca_list_path capabilities in external PJProject. Since Asterisk 13.8, pj_ssl_cert_load_from_files2 got detected only in the bundled PJProject but not in an external PJProject. Therefore, ca_list_path could not be used in pjsip.conf. With this change, pj_ssl_cert_load_from_files2 is detected again to enable ca_list_path again. ASTERISK-26303 #close Change-Id: I4a4a0cdc5cdff33730911fb4cfc0498c069043d0 2016-08-16 12:24 +0000 [2edcfcf1eb] gtjoseph * ari: Add documentation that path parameters are case-sensitive Added to api.wiki.mustache so that the generated object pages have the notation in the table header as well as under each method that has path parameters. ASTERISK-25492 #close Change-Id: I36c46c6dc0c9ac350470394a999a1b19ef3fcdaf 2016-08-15 15:29 +0000 [f4e28b3a09] Corey Farrell * Refactor usage pattern of xmldoc info tag. This updates func_channel.c and main/message.c to use a generic xpointer include instead of including info from each channel driver. Now the name attribute of info is CHANNEL or CHANNEL_EXAMPLES to be included in documentation for func_channel. Setting the name attribute of info to MessageToInfo or MessageFromInfo causes it to be included in the MessageSend application and AMI action. Change-Id: I89fd8276a3250824241a618009714267d3a8d1ea 2016-08-04 20:00 +0000 [a8d9a53bae] Richard Mudgett * res_sorcery_config.c: Cleanup ao2 container usage idioms. Change-Id: Iad24b335fb121a2bc7f1d048ab7420569edcba5a 2016-08-04 15:57 +0000 [74a91b9ee5] Richard Mudgett * sorcery.c: Minor optimizations. * Remove some unused parameters from internal functions: sorcery_wizard_create() sorcery_wizard_update() sorcery_wizard_delete() * Created the struct sorcery_observer_invocation ao2 object without a lock since it is not needed in sorcery_observer_invocation_alloc(). * Cleanup generic ao2 container sorcery object id hash, sort, and cmp functions. Change-Id: Iff71d75f52bc1b8cee955456838c149faaa4f92e 2016-08-01 11:04 +0000 [29beb2890c] Richard Mudgett * sorcery.c: Tweak some container declaration formatting. * Tweak sorcery_object_type_alloc() formatting. * Tweak ast_sorcery_init() formatting. Change-Id: Ib02430023f15268cd7a2ea53f2c331213e4d3944 2016-08-11 23:30 +0000 [9b822293bd] Corey Farrell * pbx.c: Additional fixes to ast_context_remove_extension_callerid2. Do not check registrar of the first extension head. We should only check the registrar when we match the priority. Additionally fix a couple calls to strcmp which used the input callerid instead of the clean version ex.cidmatch. ASTERISK-26233 Change-Id: I17ea6881a18f40840ae9c1f5394aab1fbb3769f1 2016-08-10 14:41 +0000 [403c794684] Alexei Gradinari * core: Entity ID is not set or invalid The Exchanging Device and Mailbox States could not working if the Entity ID (EID) is not set manually and can't be obtained from ethernet interface. This patch replaces debug message to warning and addes missing description about option 'entityid' to asterisk.conf.sample. With this patch the asterisk also: (1) decline loading the modules which won't work without EID: res_corosync and res_pjsip_publish_asterisk. (2) warn if EID is empty on loading next modules: pbx_dundi, res_xmpp Starting with v197 systemd/udev will automatically assign "predictable" names for all local Ethernet interfaces. This patch also addes some new ethernet prefixes "eno" and "ens". ASTERISK-26164 #close Change-Id: I72d712f1ad5b6f64571bb179c5cb12461e7c58c6 2016-06-15 17:10 +0000 [93332cb1d0] Evgeniy Tsybra * chan_sip: Fix lastrtprx always updated Packets are read regulary, when there is no data in buffer fr->frametype is AST_FRAME_NULL. There was no check of frametype and lastrtprx always updated and, therefore, rtptimeout did not work at all. ASTERISK-25270 #close Change-Id: If3b5ca0dbb822582a86eb7d01dcae4e83448c41d 2016-08-15 07:17 +0000 [2735ec899a] Joshua Colp * manager: Clarify that dialplan manipulation actions are under system class. ASTERISK-26246 #close Change-Id: Id673b9786389f9d2a87f638ce1a25161f5f31657 2016-08-13 22:02 +0000 [f59bd47ed3] Matt Jordan * app_dial: Improve documentation * Add some helpful and other embedded paragraph tags * Document some of the lesser known channel variables set by Dial * Add examples for some common Dial uses, along with some more challenging but useful options Change-Id: Ib2fb9301e8e044d14fbb2815ec64161f19bbfbc1 2016-08-13 20:16 +0000 [4facaac408] Matt Jordan * manager: Add tags to relate interrelated events/actions together Change-Id: Idbac539205aa732bf786c4f765577d8e9ff28ba4 2016-08-13 20:15 +0000 [232d4fe24f] Matt Jordan * manager: Add tags to relate Bridge related events,actions, and apps Change-Id: I67e6b79fa3102e494b5fe6cc7510472249080e85 2016-08-13 20:14 +0000 [63c0b2f7c9] Matt Jordan * manager: Add tags to relate AoC events and actions Change-Id: Iea89a36222712148c1775c05ed0ad1049d67a70e 2016-08-13 20:13 +0000 [0422667d6c] Matt Jordan * manager: Add tags to relate UserEvent actions/apps/events Change-Id: I80f8a981f62f50e74609c69c49edcaca6c95efa4 2016-08-12 15:53 +0000 [f9e734974b] Matt Jordan * res_agi: Improve documentation * Groups of AGI commands that have similar functionality now reference each other, and all reference the AGI application for ease of wiki reference. * The documentation for the AGI application has been improved, in particular noting the various AGI types and how they are invoked. * A warning message has been added to DeadAGI, noting that it is deprecated. Change-Id: I479ccdee8a7393f01b18692c3d4ab7e6bdd1875d 2016-08-12 13:53 +0000 [781bb410d0] Matt Jordan * manager: Add links between related events This patch adds some see-also references between related AMI events. It focuses primarily on those events that are guaranteed to come in pairs, such as DTMFBegin/DTMFEnd, as well as those that occur during the life cycle of an Asterisk channel, such as Newchannel/Hangup. Change-Id: Iaab600477052018d0f8c03d0c624c0856e9ff1f3 2016-08-12 11:15 +0000 [cfd6852d39] Matt Jordan * func_channel: Reorganize documentation * Following the example of the PJSIP channel driver, the channel technology specific documentation has been moved to the respective channel drivers that provide that functionality. This has the benefit of locating the documentation of items with those modules that provide it. * Examples of using the CHANNEL function for both standard items as well as for PJSIP have been added. * The 'max_forwards' standard item has been documented. Change-Id: Ifaa79a232c8ac99cf8da6ef6cc7815d398b1b79b 2016-08-11 22:11 +0000 [cb043249b6] Corey Farrell * Run mandatory cleanup when startup fails. Errors during startup result in an exit. These error branches should be calling ast_run_atexit(0) to ensure mandatory cleanup is run. ASTERISK-26267 #close Change-Id: If226f2326ae2df7add20040696132214cf2bb680 2016-08-11 11:24 +0000 [4d5e96ab53] gtjoseph * res_pjsip_caller_id: Copy header name to short header name When compact_headers was set, we were sending a zero-length header name for PAI and RPID because we always forced the short header name length to 0. We did this because we cloned the header from "From" and wanted to clear "f" from the sname. By cloning however, we bypass pjproject's automatic logic that sets sname to name if there's no compact form of the header, which there isn't for PAI and RPID. So now we force sname to be the same as name right after we set name. res_pjsip_diversion needed the same treatment for the Diversion header. ASTERISK-26241 #close Change-Id: I633ec139630cd83809aae00336cee4a10077e467 2016-08-11 12:18 +0000 [143df33110] gtjoseph * res_pjsip: Fail global load if debug or default_from_user are empty If debug was specified in the global configuration but left blank, the logger would treat it as a wildcard and log all hosts. If default_from_user was empty, a crash would result. The global apply handler now checks for empty strings. ASTERISK-26239 #close ASTERISK-26238 #close Change-Id: Ie75727f5cd5808845d92cc81f5713842fb203336 2016-08-01 15:07 +0000 [1fc5c90014] Richard Mudgett * res_pjsip res_pjsip_mwi: Misc fixes and cleanups. * Eliminated RAII_VAR() usage in ast_sip_persistent_endpoint_update_state(). * Added a missing allocation failure check to persistent_endpoint_find_or_create(). * Made persistent_endpoint_find_or_create() create the new object without a lock as it isn't needed. * Cleaned up some ao2 container allocation idioms. * Reordered res_pjsip_mwi.c load_module() and unload_module() Change-Id: If8ce88fbd82a0c72a37a2388f74f77237a6a36a8 2016-08-04 18:03 +0000 [73052e5732] Richard Mudgett * location.c: Misc fixes and cleanups. * Eliminated most RAII_VAR() usage. * Added several missing allocation failure checks. * Made ast_sip_for_each_contact() allocate the wrapper ao2 object without a lock as it is not needed. Change-Id: Ie20913365156c95dd79e5d471cfd25e99ae880bc 2016-08-02 13:53 +0000 [9d4bd3d763] Richard Mudgett * taskprocessor.c: Tweak high water checks. * The high water check in ast_taskprocessor_alert_set_levels() would trigger immediately if the new high water level is zero and the queue was empty. * The high water check in taskprocessor_push() was off by one. Change-Id: I687729fb4efa6a0ba38ec9c1c133c4d407bc3d5d 2016-08-03 16:24 +0000 [e1248c3075] Richard Mudgett * res_pjsip: Make aor named lock a mutex. The named aor lock was always being locked for writes so a rwlock adds no benefit and may be slower because rwlocks are biased toward read locking. Change-Id: I8c5c2c780eb30ce5441832257beeb3506fd12b28 2016-07-29 17:41 +0000 [6e40334d89] Richard Mudgett * pjsip_distributor.c: Add missing allocation failure check. Change-Id: I932ab2cea845e534d9ff318035b6de39972d3b28 2016-08-11 11:13 +0000 [a3c5488ff4] Matt Jordan * app_queue: Prevent crash when a call is forwarded to an invalid location When a call forward attempt is made from a Queue member, the current code will hang up the forwarding channel in an off-nominal condition prior to raising the Stasis events informing the rest of Asterisk that the call was forwarded. This will result in a slew of dreaded FRACKs, most likely leading to a crash. This patch modifies the code such that we don't hang up the forwarding channel even in an off-nominal condition until we've safely raised the Stasis messages. ASTERISK-25797 #close Change-Id: Ife5abed351691fd79105321636eaa8ea8dcdba38 2016-08-11 10:50 +0000 [5913929d31] Kevin Harwell * alembic: add auth_username to endpoint's identify_by enum A new identify_by option was added recently, auth_username. However, this setting was not added as an allowable choice in the database enumeration value. This patch updates the current enumeration, adding in the new setting. ASTERISK-26268 #close Change-Id: Ib4788e8485e4cd40172ec0abbf5810a147ab8bf8 2016-08-06 10:57 +0000 [1589452fdc] Alexei Gradinari * pjsip: Fix deadlock with suspend taskprocessor on masquerade If both channels which should be masqueraded are in the same serializer: 1st channel will be locked waiting condition 'complete' 2nd channel will be locked waiting condition 'suspended' On heavy load system a chance that both channels will be in the same serializer 'pjsip/distibutor' is very high. To reproduce compile res_pjsip/pjsip_distributor.c with DISTRIBUTOR_POOL_SIZE=1 Steps to reproduce: 1. Party A calls Party B (bridged call 'AB') 2. Party B places Party A on hold 3. Party B calls Voicemail app (non-bridged call 'BV') 4. Party B attended transfers Party A to voicemail using REFER. 5. When asterisk masquerades calls 'AB' and 'BV', a deadlock is happened. This patch adds a suspension indicator to the taskprocessor. When a session suspends/unsuspends the serializer it sets the indicator to the appropriate state. The session checks the suspension indicator before suspend the serializer. ASTERISK-26145 #close Change-Id: Iaaebee60013a58c942ba47b1b4930a63e686663b 2016-08-09 12:07 +0000 [f6ec94cca6] Kevin Harwell * alembic/sqlalchemy: auto increment only allowed on a single column The extensions table defined two columns (id and priority) as primary key autoincrement columns. However only one is allowed when defining the primary key. This patch removes the autoincrement attribute from the priority column since it does not need to be as such and really should not have been on there in the first place. This patch also removes 'context', 'exten', and 'priority' from the primary key index and creates a new combined unique contraint index on them. ASTERISK-26183 #close Change-Id: Ib9c712c612a4d7ec1edb0dcb77f1bae0905a470b 2016-08-07 09:58 +0000 [5f815f9dba] Matt Jordan * channels/chan_pjsip: Add PJSIP_SEND_SESSION_REFRESH This patch adds a new PJSIP specific dialplan function, PJSIP_SEND_SESSION_REFRESH. When invoked on a PJSIP channel, the media session will be refreshed via either an UPDATE or re-INVITE request. When used in conjunction with the PJSIP_MEDIA_OFFER dialplan function, the formats in use on a PJSIP channel can be re-negotiated and changed dynamically after call setup. ASTERISK-26277 #close Change-Id: Ib98fe09ba889aafe26d58d32f0fd1323f8fd9b1b 2016-08-09 16:19 +0000 [a119bab6a6] Mark Michelson * res_rtp_asterisk: Cache local RTCP address. When an RTCP packet is sent or received, res_rtp_asterisk generates a Stasis event that contains the RTCP report as well as the local and remote addresses that the report pertains to. The addresses are determined using ast_find_ourip(). For the local address, this will typically result in a lookup of the hostname of the server, and then a DNS lookup of that hostname. If you do not have the host in /etc/hosts, then this results in a full DNS lookup, which can potentially block for some time. This is especially problematic when performing RTCP reads, since those are done on the same thread responsible for reading and writing media. This patch addresses the issue by performing a lookup of the local address when RTCP is allocated. We then use this cached local address for the Stasis events when necessary. ASTERISK-26280 #close Reported by Mark Michelson Change-Id: I3dd61882c2e57036f09f0c390cf38f7c87e9b556 2016-08-08 12:53 +0000 [a06a1af0eb] Alexei Gradinari * res_pjsip_mwi: fix unsolicited mwi blocks PJSIP stack The PJSIP taskprocessors could be overflowed on startup if there are many (thousands) realtime endpoints configured with unsolicited mwi. The PJSIP stack could be totally unresponsive for a few minutes after boot completed. This patch creates a separate PJSIP serializers pool for mwi and makes unsolicited mwi use serializers from this pool. This patch also adds 2 new global options to tune taskprocessor alert levels: 'mwi_tps_queue_high' and 'mwi_tps_queue_low'. This patch also adds new global option 'mwi_disable_initial_unsolicited' to disable sending unsolicited mwi to all endpoints on startup. If disabled then unsolicited mwi will start processing on next endpoint's contact update. ASTERISK-26230 #close Change-Id: I4c8ecb82c249eb887930980a800c9f87f28f861a 2016-08-04 10:16 +0000 [485fd27f7c] Joshua Colp * res_pjsip_outbound_publish: Use a serializer shutdown group for unload. This change replaces the custom unload process for the outbound publish module with the common serializer shutdown group. ASTERISK-25217 #close Change-Id: I280a0384d860c486202d87d2d674394cca77ffb6 2016-08-03 15:39 +0000 [805f105f88] Corey Farrell * Add missing checks during startup. This ensures startup is canceled due to allocation failures from the following initializations. * channel.c: ast_channels_init * config_options.c: aco_init ASTERISK-26265 #close Change-Id: I911ed08fa2a3be35de55903e0225957bcdbe9611 2016-07-22 16:37 +0000 [ea71bd6e3e] Alexei Gradinari * app_voicemail: Add taskprocessor alert level options. On heavy loaded system with IMAP or DB storage, 'app_voicemail' taskprocessor queue could reach 500 scheduled tasks. It could happen when the IMAP or DB server dies or is unreachable. It could happen on startup when there are many (thousands) realtime endpoints configured with unsolicited mwi. If the taskprocessor queue reaches the high water level then the alert is triggered and pjsip stops processing new requests until the queue reaches the low water level to clear the alert. This patch adds 2 new 'general' configuration options to tune taskprocessor alert levels: 'tps_queue_high' - Taskprocessor high water alert trigger level. 'tps_queue_low' - Taskprocessor low water clear alert level ASTERISK-26229 #close Change-Id: I766294fbffedf64053c0d9ac0bedd3109f043ee8 2016-08-03 09:47 +0000 [9dc8cfabd5] Joshua Colp * astconfigparser: Really handle case where line is simply a comment. The regular expression would match causing the code that handled the line if it was merely a comment to never get executed. Change-Id: I3e4022481037ebcba9905587fe8c764b4ce21819 2016-07-23 08:51 +0000 [ad3e65433c] gtjoseph * asterisk.c: Add auto generation and persistence of UUID Upcoming features will require the generation and persistence of a UUID. Change-Id: I3ec0062427e133217db6ef496a4216f427c3b92d 2016-08-02 12:55 +0000 [efc4034d72] Kevin Harwell * rest-api: Code out of sync with the model Change-Id: Idccaa26fd4a423d47d013ee592b8fa6a0349c006 2016-07-29 13:13 +0000 [f6821fbaec] Mark Michelson * Remove SILK payload mappings from Asterisk core. SILK is a bit of a hog when it comes to using up our limited number of dynamic payload types in the RTP engine. By freeing up four slots, it allows for other codecs to potentially take the place. Now, codec_silk.so will dynamically use the payload slots in the RTP engine when it loads. A better fix would be make RTP dynamic payload types actually dynamic. However, at this stage of Asterisk 14 development, this is a risky move that would be imprudent. Change-Id: I5774e09408f9a203db189529eabdc0d3f4c1e612 (cherry picked from commit d50895c7b04036aeaad58990089399e46db4c817) 2016-08-01 11:08 +0000 [102d28c11a] Joshua Colp * sorcery: Use more compatible regex for local expressions. This changes the use of an empty regex for both res_sorcery_config and res_sorcery_memory to "." instead. This is a more compatible regular expression which also works on FreeBSD. ASTERISK-26206 #close Change-Id: Ia9166dd176f1597555ba22b6931180d0626c1388 2016-08-02 03:08 +0000 [b78d10a2df] Alexander Traud * res_pjsip: SIP/SDP origin (o=) contained square brackets on IP6 transports. ASTERISK-26256 #close Change-Id: I3fd68df561f81fdb8c6c497d465b50c12422f058 2016-08-01 16:13 +0000 [1f95c011c7] gtjoseph * menuselect: Add an opaque "member_data" string to the acceptable xml Change-Id: Id5ac43b95c8d7395f3be37f983632169db3d1afe 2016-07-27 09:56 +0000 [df42f64d62] David M. Lee * Replace strdupa with more portable ast_strdupa The strdupa function is a GNU extension, and not widely portable. We have an ast_strdupa function used within Asterisk which is preferred. I pulled the definition up from menuselect.c into the menuselect.h header file so it can be shared across menuselect. Change-Id: I9593c97f78386b47dc1e83201e80cb2f62b36c2e 2016-07-24 18:27 +0000 [56a07fbab9] gtjoseph * menuselect: Various menuselect enhancements * Add 'external' as a support level. * Add ability for module directories to add entries to the menu by adding members to the /.xml file. * Expand the description field to 3 lines in the ncurses implementation. * Allow the description field to wrap in the newt implementation. * Add description field to the gtk implementation. Change-Id: I7f9600a1984a42ce0696db574c1051bc9ad7c808 (cherry picked from commit 90f445729d5d86050d9d379485ff0a99f4a006c1) 2016-07-29 04:48 +0000 [7f9369c1b6] Joshua Colp * astconfigparser: Handle case where line is simply a comment. Change-Id: I2dea5815363f4d787d709228a04f33baee383ef5 2016-07-28 14:10 +0000 [57e9c66819] Corey Farrell * pbx.c: Fix handling of '-' in extension name and callerid This adds a two strings to ast_exten. name to go with exten and cidmatch_display to go with cidmatch. The new fields contain input used to add the extension in the first place. The existing fields now contain stripped input that excludes insignificant spaces and dashes. These stripped fields should always be used for comparisons. The unstripped fields should normally be used for display, but displaying stripped values will not cause runtime errors. Note the actual string is only stored twice if it contains dashes. If no dashes are found then both 'char *' fields point to the same memory. So this change has a minimum effect on memory usage. The existing functions ast_get_extension_name and ast_get_extension_cidmatch return unstripped values as they did before this change. Other similar bugs likely still exist where unstripped extensions are saved outside pbx.c then passed back in. ASTERISK-26233 #close Change-Id: I6cd61ce57acc1570ca6cc14960c4c3b0a9eb837f 2016-07-27 17:17 +0000 [873fc0fda5] Richard Mudgett * pbx.c: Allow dangerous functions when adding a hint to dialplan. We can allow dangerous functions when adding a hint since altering dialplan is itself a privileged activity. Otherwise, we could never execute dangerous functions. ASTERISK-25996 #close Reported by: Andrew Nagy Change-Id: I4929ff100ad1200a0198262d069a34f2296e77ba 2016-07-21 10:36 +0000 [f00525a6f6] Alexei Gradinari * pjproject: fixed a few bugs This patch fixes the issue in pjsip_tx_data_dec_ref() when tx_data_destroy can be called more than once, and checks if invalid value (e.g. NULL) is passed to. This patch updates array limit checks and docs in pjsip_evsub_register_pkg() and pjsip_endpt_add_capability(). Change-Id: I4c7a132b9664afaecbd6bf5ea4c951e43e273e40 2016-07-17 18:28 +0000 [972cee2e4c] gtjoseph * pjproject_bundled: Update for pjproject 2.5.5 Add more --disable-* switches to Makefile.rules including --disable-opus which was causing bundled pjproject to fail with "undefined reference" errors in libasteriskpj. Changed PJ_ENABLE_EXTRA_CHECK to 1. Removed 2 obsolete patches and added a new one. The new one was merged by Teluu on 6/27/2016. ASTERISK-26148 #close Change-Id: Ib8af6c6a9d31f7238ce65b336134c2efdc855063 2016-07-27 10:33 +0000 [8902a51d59] David M. Lee * Portably sscanf tv_usec In a timeval, tv_usec is defined as a suseconds_t, which could be different underlying types on different platforms. Instead of trying to scanf directly into the timeval, scanf into a long int, then copy that into the timeval. Change-Id: I29f22d049d3f7746b6c0cc23fbf4293bdaa5eb95 2016-07-27 12:36 +0000 [852e763571] Kevin Harwell * rtp_engine: Failed assertion and wrong name given for codec Fixed an assert check that would trigger when the passed in value was negative. The negative value was being cast to an unsigned value. This resulted in the check failing. Also fixed another problem when loading formats in the engine. When setting the mime type the format's name was being passed in instead of the codec's name. Change-Id: I1a201cd419ba4d8e9a40d337e36b6fbe1737192c 2016-07-21 22:44 +0000 [e8c34680ca] Richard Mudgett * dsp.c: Add fax and DTMF detection unit tests. * Add fax amplitude and frequency sweep tests. * Add DTMF amplitude and twist unit tests. Change-Id: I8d77c9a1eec89e440d715f998c928687e870c3f7 2016-07-21 11:56 +0000 [c1f240b818] Richard Mudgett * dsp.c: Added descriptive comments to Goertzel calculations. * Added doxygen to describe some struct members and what is going on in the code. Change-Id: I2ec706a33b52aee42b16dcc356c2bd916a45190d 2016-07-13 13:48 +0000 [003a52fd62] Richard Mudgett * dsp.c: Fix incorrect format reference typo. Change-Id: Ia131da3ec29acf385cb43a586a29ecc975eb3896 2016-07-25 21:18 +0000 [4c0a0cbe02] Richard Mudgett * dsp.c: Correct DTMF twist dsp.conf documentation. Change-Id: Idf97e3a72f1edc5fca58f2fa7b20785922be0cae 2016-07-22 04:43 +0000 [87433c2566] Joshua Colp * astconfigparser.py: Update with realtime fixes. When configuring SIP URIs in the pjsip.conf file it is necessary to escape the semicolon so the parser does not treat it as a comment. This change allows this to work in the astconfigparser implementation. A secondary bug where some data was lost if a configuration option included a "=" in its value was also fixed. A bug where sections would be considered equal despite being different has also been fixed. Change-Id: If229f656ef22050b50e7b34e90c4bffe796431f8 2016-07-21 22:28 +0000 [159e437e5a] Richard Mudgett * dsp.c: Fix erroneous fax tone detection. The Goertzel calculations get less accurate the lower the signal level being worked with becomes because there is less resolution remaining. If it is too low we can erroneously detect a tone where none really exists. The searched for fax frequencies not only need to be so much stronger than the background noise they must also be a minimum strength. * Add needed minimum threshold test to tone_detect(). * Set TONE_THRESHOLD to allow low volume frequency spread detection. ASTERISK-26237 #close Reported by: Richard Mudgett Change-Id: I84dbba7f7628fa13720add6a88eae3b129e066fc 2016-07-22 14:44 +0000 [eda95236d1] Mark Michelson * Fix sqlalchemy error regarding identifier length. sqlalchemy was complaining: sqlalchemy.exc.IdentifierError: Identifier 'ps_contacts_qualifyfreq_exptime' exceeds maximum length of 30 characters This fixes the problem by changing the index name to be "ps_contacts_qualifyfreq_exp" instead. ASTERISK-26227 #close Reported by Mark Michelson Change-Id: I0ed784f87504be2a59ee8d3242ef6f625d5ed1a9 2016-07-22 05:46 +0000 [66c9dfb272] Alexander Traud * chan_sip: Enable Session-Timers for SIP over TCP (and TLS). Asterisk defaults to timers=accept/refresher=uas. In that scenario, only in that scenario, Sessions-Timers (RFC 4028) had no effect via TCP. This change enables Session-Timers for SIP over TCP (and for SIP over TLS). However with longer international calls via TCP, the SIP channel might break, because all hops on the Internet route must stay online (have not a single power outage, for example). Therefore with Session-Timers enabled (which are enabled at default), you might see dropped calls. Consequently even with this change, you might be better-off going for session-timers=refuse in your sip.conf. ASTERISK-19968 #close Change-Id: I1cd33453c77c56c8e1394cd60a6f17bb61c1d957 2016-07-15 16:16 +0000 [33716106e0] Richard Mudgett * res_pjsip: Whitespace and comment cleanup. Change-Id: I11139a4a95df34e223ba622aa6227e33ab8f6c38 2016-07-21 09:05 +0000 [52ab0bf258] gtjoseph * chan_sip: Prevent deadlock when issuing "sip show channels" sip_show_channels locks the dialogs container first then locks each sip_pvt so it can spit out the details. The rest of sip dialog processing locks the sip_pvt first then locks the dialogs container if it needs to. Both lock in the order they need but deadlocks can result. To fix, sip_show_channels and sip_show_channelstats have been converted to use an iterator rather than ao2_callback. This way the container is locked only while getting the next entry and is unlocked when the callback is called. ASTERISK-23013 #close Change-Id: Id9980419909e811f89484950ed46ef117b9eb990 2016-07-19 15:22 +0000 [5997ec7c9e] Alexei Gradinari * res_pjsip_pubsub: fixed a bug when pjsip_tx_data_dec_ref is called twice. This patch removed call of pjsip_tx_data_dec_ref in send_notify if send_request failed. The pjsip_dlg_send_request deletes the message on error by itself. It seems this patch fixes next issues: ASTERISK-26199 ASTERISK-26166 ASTERISK-26174 Change-Id: I8b05917c93d993f95d604c042ace5f1a5500f59a 2016-07-18 22:46 +0000 [7fdf7c3d4c] Corey Farrell * Add conditional support for noreturn functions. This adds support for tagging functions with the noreturn attribute. If DO_CRASH is enabled then ast_do_crash never returns. If AST_DEVMODE and DO_CRASH are enabled then failed assertions never return. This can resolve a large number of false positives with static analyzers. ASTERISK-26220 #close Change-Id: Icfb61e5fe54574eced4c3e88b317244f467ec753 2016-07-19 13:18 +0000 [dcb8aa8c1c] Richard Mudgett * chan_dahdi.c: Fix deadlock potential in fax redirection. The dahdi_handle_dtmf() and my_handle_dtmf() have the potential to deadlock if an incoming fax happens during the Playback or similar application. * Fixed the potential deadlock by not calling ast_async_goto() with the channel lock held. ASTERISK-26216 #close Reported by: Richard Mudgett Change-Id: I9144b84ade5f96690996624ec8a2d40c56af40aa 2016-07-13 18:49 +0000 [fa91cf3eec] Richard Mudgett * chan_sip.c: Fix deadlock potential in fax redirection. The sip_read() has the potential to deadlock if an incoming fax happens during the Playback or similar application. * Fixed the potential deadlock by not calling ast_async_goto() with the channel lock held. * Made always eat the fax detection frame whether there is a fax extension or not. ASTERISK-26216 Reported by: Richard Mudgett Change-Id: I6d3f5cccd4b77c3aa6ffc1a54c0f6bde61c9278e 2016-07-13 18:48 +0000 [2e1bdc3775] Richard Mudgett * chan_pjsip.c: Fix deadlock potential in fax redirection. The chan_pjsip_cng_tone_detected() has the potential to deadlock if an incoming fax happens during the Playback or similar application. * Fixed the potential deadlock by not calling ast_async_goto() with the channel lock held. * Made always eat the fax detection frame whether there is a fax extension or not. ASTERISK-26216 Reported by: Richard Mudgett Change-Id: I32aecbb4818af646dc5a619f0dc040e9b1f222e5 2016-07-12 17:33 +0000 [628e8c91d5] Richard Mudgett * res_fax.c: Fix deadlock potential in FAXOPT(faxdetect) framehook. The fax_detect_framehook() has the potential to deadlock if an incoming fax happens during the Playback or similar application. * Fixed the potential deadlock by not calling ast_async_goto() with the channel lock held. * Made always eat the fax detection frame whether there is a fax extension or not. * Made only detach the framehook if we detected a fax and not on other possible frames. ASTERISK-26216 Reported by: Richard Mudgett Change-Id: I99da35c26d1cd802626ffb4c1b4eb5b015581b6d 2016-07-12 17:24 +0000 [676aeede36] Richard Mudgett * res_fax: Fix FAXOPT(faxdetect) timeout option. The fax detection timeout option did not work because basically the wrong variable was checked in fax_detect_framehook(). As a result, the timer would timeout immediately and disable fax detection. * Fixed ignoring negative timeout values. We'd complain and then go right on using the negative value. * Fixed destroy_faxdetect() in the off-nominal case of an incomplete object creation. * Added more range checking to FAXOPT(gateway) timeout parameter. ASTERISK-26214 #close Reported by: Richard Mudgett Change-Id: Idc5e698dfe33572de9840bc68cd9fc043cbad976 2016-07-18 16:16 +0000 [652130feb2] Richard Mudgett * chan_dahdi: Add faxdetect_timeout option. The new option allows the channel driver's faxdetect option to timeout on a call after the specified number of seconds into a call. The new feature is disabled if the timeout is set to zero. The option is disabled by default. * Don't clear dsp_features after passing them to the dsp code in my_pri_ss7_open_media(). We should still remember them especially for the new faxdetect_timeout option. ASTERISK-26214 Reported by: Richard Mudgett Change-Id: Ieffd3fe788788d56282844774365546dce8ac810 2016-07-15 20:44 +0000 [851b1c3a17] Richard Mudgett * res_pjsip: Add fax_detect_timeout endpoint option. The new endpoint option allows the PJSIP channel driver's fax_detect endpoint option to timeout on a call after the specified number of seconds into a call. The new feature is disabled if the timeout is set to zero. The option is disabled by default. ASTERISK-26214 Reported by: Richard Mudgett Change-Id: Id5a87375fb2c4f9dc1d4b44c78ec8735ba65453d 2016-07-19 04:48 +0000 [021d4892cd] Alexander Traud * Makefile: Retain XML Declaration and DTD in docs. Since Asterisk 12, the documentation got an XML Stylesheet. Because of a typo, the XML Declaration and DTD were overwritten by this. ASTERISK-26212 #close Change-Id: If5ee4625068042e98ab3fcb22a25e2f15d0c68bd 2016-07-18 18:39 +0000 [c8e41d14a1] Corey Farrell * Unit tests: Use AST_TEST_DEFINE in conditional code only. If AST_TEST_DEFINE is not conditional to TEST_FRAMEWORK it produces dead code. This places all existing unit tests into a conditional block if they weren't already. ASTERISK-26211 #close Change-Id: I8ef83ee11cbc991b07b7a37ecb41433e8c734686 2016-07-18 05:13 +0000 [e404f51b42] Alexander Traud * res_rtp_asterisk: Count a roll-over of the sequence number even on lost packets. With this change, the initial RTP sequence number is randomly chosen not between 0 and 65535 (0xffff) but 0 and 32767 (0x7fff). This assures, the roll-over counter (ROC) synchronization is not lost for sRTP, when the very first RTP packets get lost; see http://srtp.sourceforge.net/faq.html#Q6 ASTERISK-26207 #close Change-Id: I9a527e3aa3ce8f3becc5131d7ba32b57b5845464 2016-07-18 04:14 +0000 [5f24874ebb] Alexander Traud * Makefile: Suppress echoing of target 'config' again. ASTERISK-26038 #close Change-Id: I5746cf639f3fdc6332e8a97cf01f979e30bf403f 2016-07-14 03:25 +0000 [76d4983c15] Corey Farrell * features.c: Remove unneeded adsi.h include. adsi.h is no longer used by features.c since parking was moved to a module. Change-Id: I2248b8a455225a17cb6ddaafd6c20c511a1eaf59 2016-07-14 18:06 +0000 [cb58f853e1] Alexei Gradinari * res_pjsip_mwi: remove unneeded check on endpoint's contacts. The function create_mwi_subscriptions_for_endpoint checks if there is active contacts by retrieving aors and contacts. This function is used to create all unsolicited mwi subscriptions on startup and is used when contact added. In both cases it's not necessary to check if there are contacts. The contacts are needed when asterisk sends mwi. ASTERISK-26200 #close Change-Id: I98e43bdc97f3c0829951cd9bf5f3c6348c6ac1fa 2016-06-30 15:58 +0000 [28501051b4] Mark Michelson * Update support for SILK format. This commit adds scaffolding in order to support the SILK audio format on calls. Roughly, this is what is added: * Cached silk formats. One for each possible sample rate. * ast_codec structures for each possible sample rate. * RTP payload mappings for "SILK". In addition, this change overhauls the res_format_attr_silk file in the following ways: * The "samplerate" attribute is scrapped. That's native to the format. * There are far more checks to ensure that attributes have been allocated before attempting to reference them. * We do not SDP fmtp lines for attributes set to 0. These changes make way to be able to install a codec_silk module and have it actually work. It also should allow for passthrough silk calls in Asterisk. Change-Id: Ieeb39c95a9fecc9246bcfd3c45a6c9b51c59380e 2016-07-14 07:45 +0000 [43b5f8d57b] Richard Miller (license 5685) * app_queue: Only remove queue member from pending when state changes. It is possible for a not in use state change to occur multiple times causing a queue member to be removed from the pending call container prematurely. The first not in use state change will remove the queue member from the container. At this moment the member may be called and placed in the pending container. After this another not in use state change can be received which will remove it from the container. Despite being called at this point the code will incorrectly see that there are no pending calls to it. This change only removes it from the pending container if the state has actually changed. ASTERISK-26133 #close patches: app_queue.diff submitted by Richard Miller (license 5685) Change-Id: Ie5a7f17a44f98e9159e9b85009ce3f8393aa78c0 2016-07-14 02:40 +0000 [a17b071e36] Corey Farrell * pbx: Fix leak of timezone for time based includes. Create include_free to run ast_destroy_timing and ast_free, use that in all places that freed an ast_include structure. This fixes a couple of paths that previously did not run ast_destroy_timing. ASTERISK-26196 #close Change-Id: I1671bd111bef0dc113e8bf8f77f89fcfc395d838 2016-07-13 17:45 +0000 [8cef8f35e7] Kevin Harwell * translate: explicit format destination not properly set If the destination format's name differed from the codec name then the translator's explict_dst field would be improperly set. In some circumstances it would end up setting it to a newly created format that has the same name as the codec when it actually needed to be the given destination codec. This could cause the translation path to use the wrong format. For instance, if an endpoint had specified 'myulaw' as a format the translator could end up using a 'ulaw' format (with whatever/default settings) instead. If the format attribute settings differed between the two then there may unexpected results during processing. This patch removes the name check when building the translation path. This should make it always set the translator's explicit_dst to the given destination format as long as the sample rate and types match. Change-Id: Iaf8a03831d68e657d89569d54b505074efbefab5 2016-07-08 11:46 +0000 [afbd10b0c5] Richard Mudgett * stasis_endpoint.c: Fix contactstatus_to_json(). The roundtrip_usec json member is optional. If it isn't present then don't put it into the converted json structure where ast_json_pack() will choke on it. Change-Id: I39bb2f86154ef54591270c58bfda8635070f9ea0 2016-07-13 13:45 +0000 [2be13d62fd] Corey Farrell * chan_sip: Fix reference leak in mwi_event_cb Cleanup the peer reference when stasis_subscription_final_message is true. Also free peer_name even if peer exists, after reload a new peer_name will be allocated. ASTERISK-26193 #close Change-Id: If7ecd52facdc5c227f701c760841e3f6ca53cc69 2016-06-22 07:13 +0000 [332beb27d8] Eugene Voityuk ,Alexander Traud * res_rtp_asterisk: Enable Forward Secrecy (PFS) for DTLS. Since July 2014, TLS based protocols (SIP over TLS, Secure WebSockets, HTTPS) support PFS thanks to ASTERISK-23905. In July 2015, the same feature was added for DTLS. The source code from main/tcptls.c should have been re-used to ease security audits. Therefore, this change rolls back the change from July 2015 and re-uses the code from July 2014. This has the additional benefits to work under CentOS 7 and enabling not just ECDHE but DHE based cipher suites as well. ASTERISK-25659 #close Reported by: StefanEng86, urbaniak, pay123 Tested by: sarumjanuch, traud patches: res_rtp_asterisk.patch submitted by sarumjanuch dtls_centos_step_1.patch submitted by traud dtls_centos_step_2.patch submitted by traud Change-Id: I537cadf4421f092a613146b230f2c0ee1be28d5c 2016-07-13 11:30 +0000 [672a64bda3] Corey Farrell * threadpool: Fix leak in ast_threadpool_serializer_group error path. ast_threadpool_serializer_group leaks a reference to ser when listener is allocated but tps is not. Although listener takes the reference to ser cleanup functions are not run without tps. ASTERISK-26191 #close Change-Id: Ie3ccf69a3f1e676c2ef62a77067c0cb57dc9a585 2016-07-11 10:22 +0000 [fea201f7e6] Richard Mudgett * pjsip_options.c: Fix container operation. aor_observer_deleted() needs to operate on all contacts found for the deleted AOR instead of only the first one found. This is really only a problem if there is more than one contact for the AOR. Change-Id: Id24ac0d5e8c931330231fb45dd2a331a84339dc1 2016-07-11 10:21 +0000 [02877b4b4f] Richard Mudgett * pjsip_configuration.c: Misc cleanups. * Fix some whitespace in various routines. * Rename i to iter in persistent_endpoint_update_state(). * Fix off-nominal copy/paste message wording in persistent_endpoint_contact_deleted_observer() Change-Id: Id8e34f5d09e7eebac3af22501c44c1110a3e29d8 2016-07-13 08:57 +0000 [148cd1b319] Alexander Traud * BuildSystem: Avoid obsolete warning with pthread.m4 on autoconf. Updated the macro-set autoconf/ax_pthread.m4 to its latest upstream version. ASTERISK-26046 #close Change-Id: I11abc11d17acd2b6a8a5a5be8ae8e0949dab9cc7 2016-07-11 10:25 +0000 [97b4c7a5b4] Richard Mudgett * res_pjsip: Fix statsd regression. The ASTERISK-25904 change-id I8fad8aae9305481469c38d2146e1ba3a56d3108f patch introduced several regressions when the newly created "Updated" state goes out for each endpoint registration refresh. 1) It restarted any OPTIONS RTT ping cycle. 2) It would interfere with a currently active ping and throw off that ping's resulting RTT calculation. 3) It cleared the RTT time each time the endpoint was refreshed. 4) The cleared RTT time was sent out as a statsd update each time. 5) It created two AMI events for each update. * Revert the original patch and reimplement it. Now the current contact status state is re-sent instead of the state being momentarily toggled every time the endpoint refreshes its registration. The statsd events are not created for the re-sent refresh because they are sent after every OPTIONS ping. ASTERISK-26160 #close Reported by: Matt Jordan Change-Id: Ie072be790fbb2a8f5c1c874266e4143fa31f66d1 2016-07-12 03:50 +0000 [3be6fa1e4b] Alexander Traud * BuildSystem: Allow own CFLAGS on ./configure. Before this change, make failed with the error Unknown value '' found in build_tools/menuselect-deps for NATIVE_ARCH when CFLAGS were supplied to the configure script. This was introduced with which disabled BUILD_NATIVE when CFLAGS were supplied. Those who need different -march= values, please, go for ./configure make menuselect.makeopts or make menuselect ./menuselect/menuselect --disable BUILD_NATIVE ASTERISK-25289 #close Change-Id: Ic6365d5a97bb9b3556858f06432a8d1cfa83eebc 2016-07-11 13:42 +0000 [5ee205d8bb] Richard Mudgett * ast_expr2: Fix off-nominal memory leak. Thanks to ibercom for pointing out a memory leak that was missed in the earlier patch for the issue. ASTERISK-26119 Reported by: Alexei Gradinari Change-Id: I9a151f5c4725d97fb82a9e938bc73dc659532b71 2016-07-11 10:17 +0000 [f5e9872016] Alexander Traud * install_prereq: Checkout of libSRTP 1.5.x. Since 5th November 2014, the master branch of libSRTP changed the prefix of several member names and is not compatible with the source code in Asterisk anymore. Therefore instead, this change checks out the latest version of the libSRTP 1.5.x branch. Furthermore now, libSRTP is compiled with OpenSSL as backend. This makes AES-GCM and AES-IN possible. ASTERISK-22131 #close Change-Id: I2e396cdc01da0ff610686e398ed210ca7408f7d6 2016-07-10 19:08 +0000 [17efed6cf7] Joshua Colp * func_odbc: Fix connection deadlock. The func_odbc module was modified to ensure that the previous behavior of using a single database connection was maintained. This was done by getting a single database connection and holding on to it. With the new multiple connection support in res_odbc this will actually starve every other thread from getting access to the database as it also maintains the previous behavior of having only a single database connection. This change disables the func_odbc specific behavior if the res_odbc module is running with only a single database connection active. The connection is only kept for the duration of the request. ASTERISK-26177 #close Change-Id: I9bdbd8a300fb3233877735ad3fd07bce38115b7f 2016-07-09 13:32 +0000 [06ba533bc7] Corey Farrell * chan_sip: Fix reference leaks in error paths. * get_sip_pvt_from_replaces leaks sip_pvt_ptr on any error. * build_peer leaks peer on failure to allocate the endpoint. This patch fixes get_sip_pvt by using an RAII_VAR, build_peer is fixed with an unref in the appropriate place. ASTERISK-26184 #close Change-Id: I728b424648ad041409f7d90880f4c28b3ce2ca12 2016-07-07 12:41 +0000 [9d4e664f62] Corey Farrell * REF_DEBUG: Prevent logging of container node objects. Using AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE can result in an unref being recorded to the refs log for the node being replaced. This prevents logging of those unrefs since they would produce errors in refcounter.py. ASTERISK-26181 #close Change-Id: Ie4fded84e8a1a58b3a59ce59dfd7eb0da3ddc5d4 2016-07-07 10:55 +0000 [e26bd15e7a] Scott Griepentrog * PJSIP: provide valid tcp nodelay option for reuse When using TCP transport with chan_pjsip, the TCP_NODELAY option value was allocated on the stack, then passed as a pointer to the tcp transport configuration structure, and later re-used on subsequently created sockets when it was no longer valid. This patch changes the allocation to be a static. ASTERISK-26180 #close Reported by: Scott Griepentrog Change-Id: I3251164c7f710dbdab031282f00e30a9770626a0 2016-07-07 10:38 +0000 [77b0145a25] Joshua Colp * chan_sip/res_pjsip_t38: Handle a request to negotiate T.38 after it is enabled. Some T.38 implementations may send another re-invite after the initial one which adds additional negotiation details (such as the max bitrate). Currently this will fail when passthrough is being done in chan_sip as we do nothing if T.38 is already active. Other handlers of T.38 inside of Asterisk (such as res_fax) handle this scenario so this change adds support for it to chan_sip and res_pjsip_t38. If a request to negotiate is received while T.38 is already enabled a new re-INVITE is sent and negotiation is done again. ASTERISK-26179 #close Change-Id: I0298494d3da6df3219bbfa4be9aa04015043145c 2016-07-04 16:38 +0000 [b4a9fa2c9e] Alexei Gradinari * res_sorcery_realtime: fix bug when successful UPDATE is treated as failed If the SQL UPDATE statement changes nothing then SQLRowCount returns 0. This value should be treated as success. But the function sorcery_realtime_update treats it as failed. This bug was found using stress tests on PJSIP. If there are 2 consecutive SIP REGISTER requests with the same contact data during 1 second then res_pjsip_registrar adds contact location on 1st request and tries to update contact location on 2nd. The update fails and res_pjsip_registrar even removes correct contact location. The test "object_update_uncreated" was removed from test_sorcery_realtime.c because it's now a valid situation. This patch also adds missing debug of extra SQL parameter. ASTERISK-26172 #close Change-Id: I05a7f3051455336c9dda29efc229decf86071303 2016-06-24 19:55 +0000 [1dfd3fc995] Matt Jordan * res/res_pjsip_session: Check for presence of an active negotiator It is possible in a hypothetical situation for a session refresh to be invoked on a PJSIP when the negotiatior on the INVITE session has not yet been established. While this shouldn't occur with existing uses of ast_sip_session_refresh, the crashes that occur due to improperly calling PJSIP functions that expect a non-NULL negotiatior are avoidable. PJSIP will create the negotiator in pjsip_inv_reinvite; this means that simply checking for the presence of the negotiator before passing it to other PJSIP functions that use it is allowable. As such, this patch adds checks for the presence of the negotiator before calling PJSIP functions that assume it is non-NULL. Change-Id: I1028323e7e01b0a531865e5412a71b6f6ec4276d 2015-10-19 18:55 +0000 [9dd0aeeb44] Matt Jordan * res/res_pjsip_pubsub: Add additional debug statements When something very sad and wrong occurs, it's challenging sometimes to figure out why. This patch adds some additional debug statements on off-nominal paths to try and make debugging easier. Change-Id: I7bffb73cc733b6f80193a23340881db4a102b640 2015-10-19 18:55 +0000 [1ec4f8dd00] Matt Jordan * res/res_corosync: Raise a Stasis message on node join/leave events When res_corosync detects that a node leaves or joins, it currently is informed of this via Corosync callbacks. However, there are a few limitations with the information presented: (1) While we have information that Corosync is aware of - such as the Corosync nodeid - that information is really only useful inside of Corosync or res_corosync. There's no way to translate a Corosync nodeid to some other internally useful unique identifier for the Asterisk instance that just joined or left the cluster. (2) While res_corosync is notified of the instance joining or leaving the cluster, it has no mechanism to inform the Asterisk core or other modules of this event. This limits the usefulness of res_corosync as a heartbeat mechanism for other modules. This patch addresses both issues. First, it adds the notion of a cluster discovery message both within the Stasis message bus, as well as the binary event messages that res_corosync uses to transmit data back and forth within the cluster. When Asterisk joins the cluster, it sends a discovery message to the other nodes in the cluster, which correlates the Corosync nodeid along with the Asterisk EID. res_corosync now maintains a hash of Corosync nodeids to Asterisk EIDs, such that it can map changes in cluster state with the Asterisk instance that has that nodeid. Likewise, when an Asterisk instance receives a discovery message from a node in the cluster, it now sends its own discovery message back to the originating node with the local Asterisk EID. This lets Asterisk instances within the cluster build a complete picture of the other Asterisk instances within the cluster. Second, it publishes the discovery messages onto the Stasis message bus. Said messages are published whenever a node joins or leaves the cluster. Interested modules can subscribe for the ast_cluster_discovery_type() message under the ast_system_topic() and be notified when changes in cluster state occur. Change-Id: I9015f418d6ae7f47e4994e04e18948df4d49b465 2016-07-04 13:54 +0000 [2c16a81dd5] Alexei Gradinari * res_pjsip: Added "subscribe_context" to endpoint If specified, incoming SUBSCRIBE requests will be searched for the matching extension in the indicated context. If no "subscribe_context" is specified, then the "context" setting is used. ASTERISK-25471 #close Change-Id: I3fb7a15f5bc154079bd348c08b7ad1cdd2d5e514 2016-07-04 05:58 +0000 [a1bd57884d] Alexander Traud * BuildSystem: Avoid obsolete warning with libcurl.m4 on autoconf. Updated the macro-set autoconf/libcurl.m4 to its latest upstream version. This avoids a warning about an obsolete macro on AC_HELP_STRING, because Asterisk is using AS_HELP_STRING everywhere else already. ASTERISK-26046 Change-Id: I8299faf504ceaeee3e39930c59293809e116c631 2016-06-30 15:17 +0000 [640fbbbe28] Richard Mudgett * features: Fix channel datastore access. Found as a result of the testsuite tests/callparking test crashing. Several calls to ast_get_chan_featuremap_config() and ast_get_chan_features_xfer_config() did not lock the channel before calling so the channel's datastore list was accessed without the lock's protection. Apparently another thread deleted a datastore on the channel's list while the crashing thread was walking the list. Crash at 0xdeaddead due to MALLOC_DEBUG's memory filler value as a result. * Add missing channel locks to calls that were not already protected as the doxygen for those calls indicates. Change-Id: Id273b3d305cc616406c353cbc841b2b7655efaa1 2016-06-22 17:26 +0000 [359134c8d3] Richard Mudgett * res_pjsip_session.c: Don't send extra BYE if SDP invalid. When an answer SDP is invalid we were disconnecting the outgoing call and sending two BYE requests. The first BYE was sent by PJPROJECT because of the invalid SDP answer. The second BYE was sent by Asterisk because it thought the canceled call was the result of the RFC5407 section 3.1.2 race condition. * Made not send the BYE on a canceled session if the SDP negotiation is incomplete because PJPROJECT has already sent a BYE for the failed negotiation. ASTERISK-25772 #close Reported by: Dmitriy Serov Change-Id: I44ad0bd0605e8eeb7035c890d6f97a1331f1a836 2016-06-27 17:19 +0000 [5fabcf2ca1] Richard Mudgett * res_pjsip_session.c: End call on initial invalid SDP negotiation. When an incoming call defers SDP negotiation and then sends us an invalid SDP in the ACK, we need to send a BYE to disconnect the call. In this case SDP negotiation has failed and we don't have valid media streams negotiated. ASTERISK-25772 Change-Id: Ia358516b0fc1e6c4c139b78246f10b9da7a2dfb8 2016-06-23 15:13 +0000 [38a4e983dc] Richard Mudgett * res_pjsip.c: Register PJMEDIA error code decoder. Registering the PJMEDIA error codes allows errors found when parsing an incoming SDP to be easier to figure out. "Missing SDP rtpmap for dynamic payload type (PJMEDIA_SDP_EMISSINGRTPMAP)" is much easier to understand than "Unknown error 220030". ASTERISK-25772 Change-Id: I44b2dcea656fedd7593171be9e845880a2c70ca0 2016-06-27 16:56 +0000 [1952434df5] Richard Mudgett * res_pjsip_session.c: Remove unused parameter from handle_incoming(). Change-Id: Iedd182d189ec947c42edc2c66c4bda3c22060daa 2016-06-22 18:02 +0000 [28928ba5c4] Richard Mudgett * res_pjsip: Add missing NULL checks when using pjsip_inv_end_session(). pjsip_inv_end_session() is documented as being able to return the passed in tdata parameter set to NULL on success. Change-Id: I09d53725c49b7183c41bfa1be3ff225f3a8d3047 2016-06-30 08:25 +0000 [43a78100c0] gtjoseph * configure: Fix HAVE_PJSIP_EVSUB_GRP_LOCK not set with external pjproject There was a typo in configure.ac preventing HAVE_PJSIP_EVSUB_GRP_LOCK from getting set when using an external pjproject. ASTERISK-26099 #close Reported-by: Ross Beer Change-Id: I709af70428e125fb5ccd44b171d25dd29141f0ae 2016-06-29 15:31 +0000 [99eff80e76] Matt Jordan * hep.conf.sample: Default 'enabled' to 'no' Following the principle of least surprise, we should not be sending massive numbers of PJSIP and RTCP HEP packets out into the ether to some only-slightly-random IP address. Having 'enabled' set to 'no' in the sample configuration file should prevent this from happening for those who run 'make samples'. ASTERISK-26159 #close Change-Id: I1753a64ca83a3442a6ebdc31061f8185c062d9b1 2016-06-29 15:09 +0000 [78960975f2] Matt Jordan * pjproject/patches/config_site: Increase the max number of ICE candidates When negotiating ICE candidates with WebRTC capable endpoints, many networks will result in a browser offering ICE candidates that exceeds the default number of max candidates, 16. This patch bumps the max candidates to 32, with the max checks at twice the number of candidates. In practice, this has shown to be sufficient for browser/WebRTC negotiation. Change-Id: Ifd8da8b315f5ae14814d4ce20e10d2e6355020e5 2016-06-28 09:00 +0000 [d07c8a0504] gtjoseph * codecs: Fix ABI incompatibility created by adding format_name to ast_codec Adding format_name even to the end of ast_codec caused issued with binary codec modules because the pointer would be garbage in asterisk when they registered. So, the ast_codec structure was reverted and an internal_ast_codec structure was created just for use in codec.c. A new internal-only API was also added (__ast_codec_register_with_format) so that codec_builtin could register codecs with the format_name in a separate parameter rather than in the ast_codec structure. ASTERISK-26144 #close Reported-by: Alexei Gradinari Change-Id: I6df1b08f6a6ae089db23adfe1ebc8636330265ba 2016-06-28 08:22 +0000 [f3d236ca7f] gtjoseph * BuildSystem: Fix a few issues hightlighted by gcc 6.x gcc 6.1.1 caught a few more issues. Made sure the unit tests still pass for the func_env and stdtime issues. ASTERISK-26157 #close Change-Id: I6664d8f34a45bc1481d2a854481c7878b0c1cf8e 2016-06-28 10:33 +0000 [9d5b0934d9] Matt Jordan * configs/basic-pbx/modules.conf: Remove 'bad' modules This patch removes the following modules: - pbx_functions: It never existed. - res_pjsip_log_forwarder: It no longer exists. - res_hep_pjsip: The base HEP module wasn't loaded, and most basic PBXs aren't going to be installing HOMER - res_pjsip_phoneprov_provider: The basic res_phoneprov module isn't loaded, and we aren't configured to make use of the module Change-Id: Id91f68cae7c9c8c3d370029fe1268cb51e4ff5a5 2016-06-22 11:19 +0000 [1dfc286418] Joshua Colp * siren: Add format attribute modules for Siren7 and Siren14. This change removes hardcoded SDP parsing and generation for Siren7 and Siren14 from chan_sip and moves it to format attribute modules so it can also be used by chan_pjsip. With this the fmtp lines for both are added with the bitrate information. ASTERISK-26021 Change-Id: Ibb004eda37a14c0a35ef0613f6237977fc800037 2016-06-23 04:33 +0000 [5f0a098243] Alexander Traud * BuildSystem: Avoid obsolete warning with AC_TYPE_SIGNAL on autoconf. Removed the obsolete macro AC_TYPE_SIGNAL because Asterisk does not use K&R C but requires ANSI C anyway. ASTERISK-26046 Change-Id: I914c014385e1862102d90fe7650621def78db02e 2016-06-22 15:04 +0000 [3d904659ec] Corey Farrell * res_fax: Fix reference leak in fax_v21_session_new. fax_v21_session_new created a session details object but only released the allocation reference during error conditions. fax_session_new adds it's own reference to details if needed so the caller is always responsible for cleaning it's own reference. ASTERISK-26141 #close Change-Id: Ie7fc52a83b6596ce9ce2d5a2bd9f3e204f48fc88 2016-06-22 13:41 +0000 [48db4c2159] gtjoseph * res_rtp_asterisk: Fix a self-comparison identified by gcc 6 gcc 6 caught a previously unidentified self-comparison in ice_candidate_cmp. Fixed it and re-ordered the predicates for better short-circuiting. ASTERISK-26140 #close Change-Id: I3da713c568e24064430257b3502fbdafd35af7a7 2016-06-22 10:37 +0000 [bc69b03316] gtjoseph * chan_unistim: Fix memcpy in get_to_address A code block only enabled when HAVE_PKTINFO is not defined (FreeBSD) was using a pointer to a pointer as the destination of a memcpy and a '&' instead of '*' in the sizeof. ASTERISK-26138 #close Change-Id: Id4927ff256c0e470bdf7bcfc025146a2f656e708 2016-06-20 13:18 +0000 [1b79e2deff] Mark Michelson * Fix Alembic upgrades. A non-existent constraint was being referenced in the upgrade script. This patch corrects the problem by removing the reference. This patch fixes another realtime problem as well. Our Alembic scripts store booleans as yes or no values. However, Sorcery tries to insert "true" or "false" instead. This patch updates Sorcery to use "yes" and "no" ASTERISK-26128 #close Change-Id: I366dbbf91418a9cb160b3ca74b0e59b5ac284bec 2016-06-22 10:55 +0000 [e30602587c] Alexander Traud * BuildSystem: Avoid obsolete warning with AC_FUNC_SETVBUF_REVERSED on autoconf. Removed the obsolete macro AC_FUNC_SETVBUF_REVERSED because Asterisk does not support the platform SVR2 from the year 1987 anymore. ASTERISK-26046 Change-Id: I28161b037feb2d29ab46ed20e785928460226c22 2016-06-22 10:51 +0000 [77da168e58] gtjoseph * test_res_pjsip_scheduler: Add 'depends' on pjproject in MODULEINFO Since the file was missing the depends on pjproject, it wasn't picking up the pjproject related include path. If there was no system installed pjproject and pjproject-bundled was used, a compile would fail because pjsip.h wasn't found. ASTERISK-26139 #close Change-Id: I2ee64a999051452bc198c4e2c168c70769cd3757 2016-06-02 17:26 +0000 [b3c787d1dd] Alexei Gradinari * res_pjsip: improve realtime performance #2 The patch removes updating all Endpoints' status on startup. Instead, only non-qualified aors with static contact and non-qualified non-expired contacts are retrieved from the realtime to update the endpoint status to ONLINE. The endpoint name was added to the contact object to simply find the endpoint that created this contact. The status of endpoints with qualified aors will be updated by 'qualify' functions. ASTERISK-26061 #close Change-Id: Id324c1776fa55d3741e0c5457ecac0304cb1a0df 2016-06-21 06:52 +0000 [dfcd466bf0] Torrey Searle * res_rtp_asterisk: fix memory leak in dtls ensure that cert bios get freed after creating the fingerprint ASTERISK-26129 #close Change-Id: I44d23aea07dce80176ca1ff877c5ace9452ef451 2016-06-21 17:42 +0000 [c982da0641] Richard Mudgett * res_pjproject.c: Replace inlined DEBUG_ATLEAST() with macro. Change-Id: I8799fb0a347ad76e747dafd0eacf1ea1086b9a8c 2016-06-12 11:19 +0000 [6a568bcc66] gtjoseph * res_pjsip_pubsub: Address SEGV when attempting to terminate a subscription Occasionally under load we'll attempt to send a final NOTIFY on a subscription that's already been terminated and a SEGV will occur down in pjproject's evsub_destroy function. This is a result of a race condition between all the paths that can generate a notify and/or destroy the underlying pjproject evsub object: * The client can send a SUBSCRIBE with Expires: 0. * The client can send a SUBSCRIBE/refresh. * The subscription timer can expire. * An extension state can change. * An MWI event can be generated. * The pjproject transaction timer (timer_b) can expire. Normally when our pubsub_on_evsub_state is called with a terminate, we push a task to the serializer and return at which point the dialog is unlocked. This is usually not a problem because the task runs immediately and locks the dialog again. When the system is heavily loaded though, there may be a delay between the unlock and relock during which another event may occur such as the subscription timer or timer_b expiring, an extension state change, etc. These may also cause a terminate to be processed and if so, we could cause pjproject to try to destroy the evsub structure twice. There's no way for us to tell that the evsub was already destroyed and the evsub's group lock can't tolerate this and SEGVs. The remedy is twofold. * A patch has been submitted to Teluu and added to the bundled pjproject which adds add/decrement operations on evsub's group lock. * In res_pjsip_pubsub: * configure.ac and pjproject-bundled's configure.m4 were updated to check for the new evsub group lock APIs. * We now add a reference to the evsub group lock when we create the subscription and remove the reference when we clean up the subscription. This prevents evsub from being destroyed before we're done with it. * A state has been added to the subscription tree structure so termination progress can be tracked through the asyncronous tasks. * The pubsub_on_evsub_state callback has been split so it's not doing double duty. It now only handles the final cleanup of the subscription tree. pubsub_on_rx_refresh now handles both client refreshes and client terminates. It was always being called for both anyway. * The serialized_on_server_timeout task was removed since serialized_pubsub_on_rx_refresh was almost identical. * Missing state checks and ao2_cleanups were added. * Some debug levels were adjusted to make seeing only off-nominal things at level 1 and nominal or progress things at level 2+. ASTERISK-26099 #close Reported-by: Ross Beer. Change-Id: I779d11802cf672a51392e62a74a1216596075ba1 2016-06-21 07:05 +0000 [ef97911a1c] Alexander Traud * res_rtp_asterisk: Use latest DTLS version available by underlying platform. Do not use DTLSv1_method() but DTLS_method() when available in OpenSSL of the underlying platform. This change enables DTLS 1.2 since OpenSSL 1.0.2, for WebRTC (DTLS-SRTP via SIP-over-WebSockets). This change enables AEAD-based cipher-suites. ASTERISK-26130 #close Change-Id: I41f24448d6d2953e8bdb97c9f4a6bc8a8f055fd0 2016-06-21 10:53 +0000 [69d58a1e37] Scott Griepentrog * PJSIP: provide transport type with received messages The receipt of a SIP MESSAGE may occur over any transport including TCP and TLS. When the message is received, the original URI is added to the message in the field PJSIP_RECVADDR, but this is insufficient to ensure a reply message can reach the originating endpoint. This patch adds the PJSIP_TRANSPORT field populated with the transport type. ASTERISK-26132 #close Change-Id: I28c4b1e40d573a056c81deb213ecf53e968f725e 2016-06-21 08:01 +0000 [cbfa9f771e] Alexander Traud * BuildSystem: Avoid obsolete warning with HELP_STRING on autoconf. Some configure scripts used both AC_HELP_STRING and its replacement AS_HELP_STRING. For consistency and to avoid obsolete warnings, those were changed to AS_HELP_STRING. ASTERISK-26046 Change-Id: I8aad4fd2bdee40aa2a31ce3339a1eb33ff4f5b0f 2016-06-20 10:29 +0000 [ba0d9e7f7a] Joshua Colp * res_pjsip_session: Handle race condition at shutdown with timer. When shutting down res_pjsip_session will get unloaded before res_pjsip. The act of unloading unregisters all the PJSIP services and sets their module IDs to -1. In some cases it is possible for a timer to occur after this happens which calls into res_pjsip_session. The res_pjsip_session module can then try to get the session from the INVITE session using the module ID. Since the module ID is now -1 this fails. This change stores a copy of the module ID and uses it for the timer callback scenario. If the module ID is -1 the callback immediately returns but if the module ID is valid then it continues as normal. This works as the original ID of the module is guaranteed to still be valid when used with the INVITE session. ASTERISK-26127 #close Change-Id: I88df72525c4e9ef9f19c13aedddd3ac4a335c573 2016-06-20 12:13 +0000 [c1512f4108] Richard Mudgett * app_voicemail.c: Fix IMAP compile error. Fix compile error introduced by the patch for ASTERISK-26045 Change-Id: I5b02876266f2824f4cec2b54d6ff4db5de5778d3 2016-06-16 15:56 +0000 [5134a8043a] Alexei Gradinari * fix: memory leaks, resource leaks, out of bounds and bugs ASTERISK-26119 #close Change-Id: Iecbf7d0f360a021147344c4e83ab242fd1e7512c 2016-06-13 17:40 +0000 [cfebe3b94a] Mark Michelson * ARI: Ensure announcer channels are destroyed. Announcer channels were not being destroyed because the stasis_app_control structure that referenced them was not being destroyed. The control structure was not being destroyed because it was not being unlinked from its container. It was not being unlinked from its container because the after bridge callback for the announcer channel was not being run. The after bridge callback was not being run because the after bridge datastore was not being removed from the channel on destruction. The channel was not being destroyed because the hangup that used to destroy the channel was now only reducing the reference count to one. The reference count of the channel was only being reduced to one because the stasis_app_control structure was holding the final reference... The control structure used to not keep a reference to the channel, so that loop described above did not happen. The solution is to manually remove the control structure from its container when the playback on a bridge is complete. ASTERISK-26083 #close Reported by Joshua Colp Change-Id: I0ddc0f64484ea0016245800b409b567dfe85cfb4 2016-06-20 08:05 +0000 [76516bd79d] Alexander Traud * http: leverage 'bindaddr' for TLS in http.conf The internal HTTP/WebSocket server supports both TCP and TLS, which can be activated separately via the file http.conf. The source code intends to re-use the TCP parameter 'bindaddr' for TLS, even if 'tlsbindaddr' is not specified explicitly. This did not work because of a typo. This change resolves this typo. ASTERISK-26126 #close Change-Id: I5efb0409ae12044dfb3495b6b97b6d40a8c9c51f 2016-05-31 09:10 +0000 [89cc86fc38] Vasil Kolev * chan_sip: bigger buffers for headers, better failure mode Currently chan_sip can give weird messages if the contacts don't fit in the From: or To: headers. This fix changes the from,to and invite variables to use ast_str, allocates and deallocates them and resizes them if needed. ASTERISK-26069 #close Change-Id: I1b68fcbddca6f6cc7d7a92fe1cb0d5430282b2b3 2016-05-18 17:37 +0000 [d53a36ff33] Richard Mudgett * res_pjsip_transport_management.c: Misc cleanups to survive shutdown. * In unload_module(), reordered destroying things to minimize the window that the global transports container could be used by other threads on shutdown. When shutting down you need to stop things in the opposite order of creation. * Put the global transports container into an AO2_GLOBAL_OBJ_STATIC to eliminate the crash potential by other threads using the container on shutdown. * Made struct monitored_transport.sip_received not use ast_atomic_fetchadd_int() since it is used as a boolean value that is only set TRUE. It was previously incremented for every received SIP message and could theoretically overflow. * In monitored_transport_state_callback(), allocated the monitored transport object without a lock since the lock was unused. * In keepalive_global_loaded(), removed releasing the transports container if the keepalive_thread could not be started. I set it up to be tried again if the user reloads the configuration. Change-Id: I8d12d16ef564290fa6d25a32334bb5ce8fdf87ff 2016-01-05 19:08 +0000 [03953d8034] Richard Mudgett * res_pjsip.c: Add check that timer actually got scheduled. Change-Id: Iabaa2e5dccf0762c258101ea0eb1487cf6959ad1 2016-06-13 13:33 +0000 [32ab98116e] Richard Mudgett * res_rtp_multicast.c: Fix warning message typo. Change-Id: Ic9928208b9957e09866abe3d9649030942ec52b3 2016-02-11 18:15 +0000 [0429c53368] Richard Mudgett * res_pjsip_session.c: Reorganize ast_sip_session_terminate(). Change-Id: I68a2128bcba4830985d2d441e70dfd1ac5bd712b 2016-06-10 12:35 +0000 [5823f279f3] Richard Mudgett * chan_rtp: Backport changes from master. * Deprecate chan_multicast_rtp. Change-Id: Ib5a45e58c75ee8abd0b4f9575379b5321feb853e 2016-06-10 16:13 +0000 [dde58df318] Richard Mudgett * chan_rtp.c: Copy file from chan_multicast_rtp.c Change-Id: I1119b53f2152ab1cbec74b5be7ea44844dbda8ef 2016-06-08 06:15 +0000 [ca38a3cbb4] Alexander Traud * core: Not the configured but granted number of possible file descriptors. With CLI "core show settings", simply the parameter maxfiles of the file asterisk.conf was shown. If that parameter was not set, nothing was displayed although the environment might have set a default number itself. Or if maxfiles were not granted (completely), still maxfiles was shown. Now, the maximum number of possible file descriptors in the environment is shown. ASTERISK-26097 Change-Id: I2df5c58863b5007b34b77adbe28b885dfcdf7e0b 2016-06-07 18:45 +0000 [caf6cccc5c] Joshua Colp * cel: Ensure only one dial status per channel exists. CEL wrongly assumed that a channel would only have a single dial event on it. This is incorrect. Particularly in a queue each call attempt to a member will result in a dial event, adding a new dial status in CEL without removing the old one. This would cause the container to grow with only one dial status being removed when the channel went away. The other dial status entries would remain leaking memory. This change fixes the memory leak by ensuring that only one dial status will only ever exist for each channel. The behavior during the scenario where multiple events are received has also been improved. For failure cases the first failure will be the dial status. If an answer dial status is received, though, it will take priority and the dial status for the channel will be answer. Memory usage has also been decreased by storing the minimal amount of information and the code has been cleaned up slightly. ASTERISK-25262 #close Change-Id: I5944eb923db17b6a0faa7317ff6abc9307c009fe 2016-06-09 10:37 +0000 [715ef071a1] Mark Michelson * chan_pjsip: Lock channel when checking for RTP changes. bridge_native_rtp can call into an RTP-capable channel driver in order for the driver to update information about who the channel is communicating with. For SIP channel drivers, this means deactivating RTCP and sending a reinvite so that the endpoints can communicate directly. bridge_native_rtp does the right thing and has the channel locked when calling into the channel driver. chan_pjsip can't alter session properties in this thread, though. chan_pjsip queues a task on the session serializer in order to update properties there. The problem is that this queued task was not locking the channel. This meant that the queued task could attempt to deactivate RTCP at the same time that the channel thread was attempting to process an incoming RTCP packet. This could lead to a crash. This patch fixes the issue by locking the channel in the queued task when altering RTP properties. ASTERISK-26092 #close Reported by Niklas Larsson Change-Id: I3464e226a3c41f6b915f97891e07fa1599e2a159 2016-06-09 09:20 +0000 [a99ddc6a0d] gtjoseph * build: Fix ast_sockaddr initialization to be more portable A change to glibc 2.22 changed the order of the sockadddr_storage members which caused the places where we do an initialization of ast_sockaddr with '{ { 0, 0, } }' to fail compilation. Those initializers (which we shouldn't have been using anyway) have been replaced with memsets. Change-Id: Idd1b3b320903d8771bfe221f0b015685de628fa4 2016-06-08 12:26 +0000 [eabb398d71] Matt Jordan * res_hep_{pjsip|rtcp}: Decline module loads if res_hep had not loaded A crash can occur in res_hep_pjsip or res_hep_rtcp if res_hep has not loaded and does not have a configuration file. Previously when this occurred, checks were put in to see if the configuration was loaded successfully. While this is a good idea - and has been added to the offending function in res_hep - the reality is res_hep_pjsip and res_hep_rtcp have no business running if res_hep isn't also running. As such, this patch also adds a function to res_hep that returns whether or not it successfully loaded. Oddly enough, ast_module_check returns "everything is peachy" even if a module declined its load - so it cannot be solely relied on. res_hep_pjsip and res_hep_rtcp now also check this function to see if they should continue to load; if it fails, they decline their load as well. ASTERISK-26096 #close Change-Id: I007e535fcc2e51c2ca48534f48c5fc2ac38935ea 2016-06-08 05:58 +0000 [0d84421f93] Alexander Traud * astfd: Not maximum size of a single file but maximum file descriptors. With menuselect "DEBUG_FD_LEAKS" and CLI "core show fd", the maximum size of a single file was shown. Now, the maximum number of possible file descriptors is shown. ASTERISK-26097 Change-Id: Icf98d145774b38cac144ca76d19eaef42ce659a3 2016-06-02 14:53 +0000 [9c5a0b814b] Timo Teräs * Fix #include poll.h and sys/cdefs.h POSIX defines poll.h, sys/poll.h should not be used at is c-library internal header which may or may not exist. Notable in musl it generates warning of being incorrect. And add explict include of sys/cdefs.h where needed. Change-Id: I142930df53fe7585a06b854b6faddc5301e024be 2016-06-03 22:44 +0000 [9c35f34301] Richard Mudgett * res_pjsip_registrar.c: Eliminate rx REGISTER request race condition. This patch fixes a race condition processing received REGISTER requests and their retransmissions caused by REGISTER requests being processed by two threads. The "sip_transaction Unable to register REGISTER transaction (key exists)" message is a notable symptom of this issue. This issue was more likely to happen before the pjsip/distributor serializers were created. Instead of steps one and two below placing the REGISTER messages into the same pjsip/distributor they were placed in random pjsip/default serializers. 1) REGISTER requests come in and get placed on the pjsip/distributor serializer. 2) Before the first request is processed a retransmission comes in and is placed on the same pjsip/distributor serializer. 3) The first request goes up the pjsip stack and is then shunted off to the pjsip/aor/ serializer. 4) Before the first request is completed processing in the pjsip/aor/ serializer, the second request goes up the pjsip stack and is also shunted off to the pjsip/aor/ serializer. 5) The first request completes processing and sends out its response. 6) The second request completes processing and tries to send out its response but pjlib complains that the REGISTER transaction key already exists. 7) Sadness ensues. * The race is eliminated by removing the pjsip/aor/ serializer and continuing the processing in the pjsip/distributor serializer. Now any retransmissions queued in the pjsip/distributor serializer will be processed after the first message is completely processed. ASTERISK-26088 #close Reported by: Richard Mudgett Change-Id: I842d714346088bf717ea27437f1dd85bff0bab5a 2016-06-03 11:35 +0000 [557333ea4c] Richard Mudgett * stasis: Add setting subscription congestion levels. Stasis subscriptions and message routers create taskprocessors to process the event messages. API calls are needed to be able to set the congestion levels of these taskprocessors for selected subscriptions and message routers. * Updated CDR, CEL, and manager's stasis subscription congestion levels based upon stress testing. Increased the congestion levels to reduce the potential for bursty call setup/teardown activity from triggering the taskprocessor overload alert. CDRs in particular need an extra high congestion level because they can take awhile to process the stasis messages. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: Id0a716394b4eee746dd158acc63d703902450244 2016-06-02 18:19 +0000 [110d772467] Richard Mudgett * sorcery: Add setting object type congestion levels. Sorcery creates taskprocessors for object types to process object observer callbacks. An API call is needed to be able to set the congestion levels of these taskprocessors for selected object types. * Updated PJSIP's contact and contact_status sorcery object type observer default congestion levels based upon stress testing. Increased the congestion levels to reduce the potential for bursty register/unregister and subscribe/unsubscribe activity from triggering the taskprocessor overload alert. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I4542e83b556f0714009bfeff89505c801f1218c6 2016-06-02 16:08 +0000 [610eee2a36] Richard Mudgett * taskprocessors: Implement high/low water mark alerts. When taskprocessors get backed up, there is a good chance that we are being overloaded and need to defer adding new work to the system. * Implemented a high/low water alert mechanism for modules to check if the system is being overloaded and take appropriate action. When a taskprocessor is created it has default congestion levels set. A taskprocessor can later have those congestion levels altered for specific needs if stress testing shows that the taskprocessor is a symptom of overloading or needs to handle bursty activity without triggering an overload alert. * Add CLI "core show taskprocessor" low/high water columns. * Fixed __allocate_taskprocessor() to not use RAII_VAR(). RAII_VAR() was never a good thing to use when creating a taskprocessor because of the nature of how its references needed to be cleaned up on a partial creation. * Made res_pjsip's distributor check if the taskprocessor overload alert is active before placing a message representing brand new work onto a distributor serializer. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I182f1be603529cd665958661c4c05ff9901825fa 2016-05-27 17:31 +0000 [26e3492246] Richard Mudgett * res_pjsip_session: Use distributor serializer for incoming calls. We must continue using the serializer that the original INVITE came in on for the dialog. There may be retransmissions already enqueued in the original serializer that can result in reentrancy and message sequencing problems. Outgoing call legs create the pjsip/outsess/ serializers for their dialogs. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I24d7948749c582b8045d5389ba3f6588508adbbc 2016-05-27 16:28 +0000 [ceb1007ed7] Richard Mudgett * res_pjsip_pubsub.c: Recreate subscriptions using distributor serializer. * Resolves potential reentrancy problems if system restarted in the middle of subscription message transactions. * Fixes memory leak recreating persistent subscriptions when the subscription resource tree could not be created. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I71e34d7ae8ed35a694f1030e820e2548c48697be 2016-05-27 12:50 +0000 [27bafc3a8b] Richard Mudgett * res_pjsip_pubsub.c: Use distributor serializer for incoming subscriptions. We must continue using the serializer that the original SUBSCRIBE came in on for the dialog. There may be retransmissions already enqueued in the original serializer that can result in reentrancy and message sequencing problems. The "sip_transaction Unable to register SUBSCRIBE transaction (key exists)" message is a notable symptom of this issue. Outgoing subscriptions still create the pjsip/pubsub/ serializers for their dialogs. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I18b00bb74a56747b2c8c29543a82440b110bf0b0 2016-05-26 17:35 +0000 [16b08444da] Richard Mudgett * pjsip_distributor.c: Consistently pick a serializer for messages. Incoming messages that are not part of a dialog or a recognized response to one of our requests need to be sent to a consistent serializer. Under load we may be queueing retransmissions before we can process the original message. We don't need to throw these messages onto random serializers and cause reentrancy and message sequencing problems. * Created a pool of pjsip/distributor serializers that get picked by hashing the call-id and remote tag strings of the received messages. * Made ast_sip_destroy_distributor() destroy items in the reverse order of creation. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I2ce769389fc060d9f379977f559026fbcb632407 2016-06-02 12:51 +0000 [993b769524] Richard Mudgett * pjsip_distributor.c: Ignore messages until fully booted. We should not be processing any incoming messages until we are fully booted. We may not have dialplan or other needed configuration loaded yet. ASTERISK-26089 #close Reported by: Scott Griepentrog ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I584aefb4f34b885a8927e1f13a2c64babd606264 2016-06-02 12:04 +0000 [321a9b128f] Joshua Colp * res_odbc: Implement a connection pool. Testing has shown that our usage of UnixODBC is problematic due to bugs within UnixODBC itself as well as the heavy weight cost of connecting and disconnecting database connections, even when pooling is enabled. For users of UnixODBC 2.3.1 and earlier crashes would occur due to insufficient protection of the disconnect operation. This was fixed in UnixODBC 2.3.2 and above. For users of UnixODBC 2.3.3 and higher a slow-down would occur under heavy database use due to repeated connection establishment. A regression is present where on each connection the database configuration is cached again, with the cache growing out of control. The connection pool implementation present in this change helps to mitigate these issues by reducing how much we connect and disconnect database connections. We also solve the issue of crashes under UnixODBC 2.3.1 by defaulting the maximum number of connections to 1, returning us to the previous working behavior. For users who may have a fixed version the maximum concurrent connection limit can be increased helping with performance. The connection pool works by keeping a list of active connections. If the connection limit has not been reached a new connection is established. If the connection limit has been reached then the request waits until a connection becomes available before continuing. ASTERISK-26074 #close ASTERISK-26054 #close Change-Id: I6774bf4bac49a0b30242c76a09c403d2e856ecff 2016-06-07 05:45 +0000 [c6ee4a0f44] Alexander Traud * res_srtp: Instead of libSRTP use OpenSSL as random source. Since libSRTP 1.5, its Random Number Generator (RNG) is not maintained anymore. Therefore, the symbol RAND_bytes is used instead of crypto_get_random. ASTERISK-24436 #close Change-Id: Iea0bae4d4e3c9aa0926ea442b6484b5159789d96 2016-06-07 02:16 +0000 [d38b8e6399] Alexander Traud * BuildSystem: Avoid 'ar cru' and use 'ar cr' instead. In several internal library projects, the files are archived with the help of 'ar cr'. Only the projects editline and the Objective Open H.323 stack implementation in C (ooh323c) use 'ar cru' instead. Recently, some platforms changed the default parameters of AR which creates "/usr/bin/ar: `u' modifier ignored since `D' is the default (see `U')". For consistency and to avoid this message all projects use 'ar cr' now. ASTERISK-26091 #close Change-Id: I710a9b1c01c1b5a1931a646098c044c8161ead40 2016-05-27 14:49 +0000 [c27c232057] gtjoseph * ari/resource_channels: Add 'formats' to channel create/originate If you create a local channel and don't specify an originator channel to take capabilities from, we automatically add all audio formats to the new channel's capabilities. When we try to make the channel compatible with another, the "best format" functions pick the best format available, which in this case will be slin192. While this is great for preserving quality, it's the worst for performance and overkill for the vast majority of applications. In the absense of any other information, adding all formats is the correct thing to do and it's not always possible to supply an originator so a new parameter 'formats' has been added to the channel create/originate functions. It's just a comma separated list of formats to make availalble for the channel. Example: "ulaw,slin,slin16". 'formats' and 'originator' are mutually exclusive. To facilitate determination of format names, the format name has been added to "core show codecs". ASTERISK-26070 #close Change-Id: I091b23ecd41c1b4128d85028209772ee139f604b 2016-06-02 04:59 +0000 [cda3385409] Joshua Colp * alembic: Fix migration. The 81b01a191a46_pjsip_add_contact_reg_server.py script was attempting to use UniqueConstraint and failing. It was not imported and after importing it also continued to fail. I've changed the script to use the explicit name of the constraint instead. Change-Id: I2438b0be90b7ce583b47dd27983c0c1a02cea5b9 2016-06-01 13:57 +0000 [e2132dd358] Richard Mudgett * logging,cdr,cel: Fix stringfield memory leak. The stringfields refactor to allow adding stringfields to the end of a structure (f6f4cf459f43f072604927209b39646f84aaa2e2) exposed some incomplete cleanup code by some stringfield users. The most noticeable leaker is the logging system where there is a leak for every log message generated. ASTERISK-26078 #close Reported by: Etienne Lessard Patches: jira_asterisk_26078_v13.patch (license #5621) patch uploaded by Richard Mudgett Change-Id: If6a08b31336b492c3de6f9dfd07c447f8d5a8782 2016-05-25 10:34 +0000 [2de58c6d01] Alexei Gradinari * core/dial: New channel variable FORWARDERNAME Added a new channel variable FORWARDERNAME which indicates which channel was responsible for a forwarding requests received on dial attempt. Fixed a bug in the app_queue: FORWARD_CONTEXT is not used. ASTERISK-26059 #close Change-Id: I34e93e8c1b5e17776a77b319703c48c8ca48e7b2 2016-05-31 13:02 +0000 [b2ce0e354b] Richard Mudgett * pjsip_distributor.c: Use correct rdata info access method (Part 2). The pjproject doxygen for rdata->msg_info.info says to call pjsip_rx_data_get_info() instead of accessing the struct member directly. You need to call the function mostly because the function will generate the struct member value if it is not already setup. Change-Id: I4d519385a577f3e9d9193a88125e493cf17fa799 2016-05-30 19:27 +0000 [fe305ccf01] gtjoseph * res_pjsip_mwi_body_generator: Re-order the body items Re-ordered the body items so Message-Account is second. Messages-Waiting: no Message-Account: sip:1571@:5060 Voice-Message: 0/0 (0/0) ASTERISK-26065 #close Reported-by: Ross Beer Change-Id: If5d35a64656eac98c2dd5e490cc0b2807bed80c3 2016-05-30 10:58 +0000 [e8abfdcdc5] gtjoseph * pjproject_bundled: Move to pjproject 2.5 Although all the patches we had against 2.4.5 were applied by Teluu, a new bug was introduced preventing re-use of tcp and tls transports This patch removes all the previous patches against 2.4.5, updates the version to 2.5, and adds a new patch to correct the transport re-use problem. Change-Id: I0dc6c438c3910f7887418a5832ca186aea23d068 2016-05-27 12:25 +0000 [37d039fdf3] Rusty Newton * res_pjsip: Add clarifying documentation to PJSIP_HEADER help text Added notes about when you can read or write headers. Specifically about being able to read on the inbound channel and write on an outbound channel. ASTERISK-26063 #close Reported by: Private Name Tested by: Rusty Newton Change-Id: Ibeb64af17d1f6451028b3c29855a3f151a01d8c5 2016-05-25 18:30 +0000 [03d5b3ce5c] Richard Mudgett * pjsip_distributor.c: Use correct rdata info access method. The pjproject doxygen for rdata->msg_info.info says to call pjsip_rx_data_get_info() instead of accessing the struct member directly. You need to call the function mostly because the function will generate the struct member value if it is not already setup. Change-Id: Iafe8b01242b7deb0ebfdc36685e21374a43936d2 2016-05-20 13:56 +0000 [859bbec09b] Alexei Gradinari * app_voicemail: fix bugs, imap mm_status log change to debug Fixed some bugs: - create dirpath when save downloading message from IMAP storage. - create IMAP folder if not exists when saving to IMAP storage - check if file successfully opened before write to it - some IMAP checks - remove non-standard flag 'Unseen' etc Change to debug IMAP mm_status log instead of verbose. Remove unused X-Asterisk-VM-Caller-channel message header for security reason. The clients should not know name of peer/endpoint. ASTERISK-26045 #close Change-Id: I7f83d88b69b36934e2539c114b9fb612deed971b 2016-05-19 14:56 +0000 [230686f4ec] Alexei Gradinari * res_pjsip: add "via_addr", "via_port", "call_id" to contact As res_pjsip_nat rewrites contact's address, only the last Via header can contain the source address of registered endpoint. Also Call-Id header may contain the source address of registered endpoint. Added "via_addr", "via_port", "call_id" to contact. Added new fields ViaAddress, CallID to AMI event ContactStatus. ASTERISK-26011 Change-Id: I36bcc0bf422b3e0623680152d80486aeafe4c576 2016-05-24 16:56 +0000 [04c12561a7] Alexei Gradinari * res_pjsip: chatty verbose messages There are a lot of verbose messages about Endpoint and Contact status changes if there are many dynamic endpoints. The patch sets verbose level 2 for Endpoint status changes and verbose level 3 for Contact status changes. ASTERISK-26055 #close Change-Id: Ie64e261ddbbc41bfff0f0190241152cc123fe6d7 2016-02-12 09:59 +0000 [a42bea3314] Corey Farrell * threadpool: Fix potential data race. worker_start checked for ZOMBIE status without holding a lock. All other read/write of worker status are performed with a lock, so this check should do the same. ASTERISK-25777 #close Change-Id: I5e33685a5c26fdb300851989a3b82be8c4e03781 2016-05-18 10:58 +0000 [a32616d60c] Tzafrir Cohen * Makefile: remove OSARCH check for init install There are more specific checks for the platform. Specifically this allows installing OS/X init scripts. ASTERISK-26038 #close Change-Id: If08933621145b10362a0cfe73c079301d9c13f50 Signed-off-by: Tzafrir Cohen 2016-05-21 05:42 +0000 [9ddaab789e] Jesper (License 5518) * func_curl: Don't trim response text on non-ASCII characters The characters 0x80-0xFF were trimmed as well as 0x00-0x20 because of a signed comparison. ASTERISK-25669 #close Reported by: Jesper patches: strings.curl.trim.patch submitted by Jesper (License 5518) Change-Id: Ia51e169f24e3252a7ebbaab3728630138ec6f60a 2016-05-20 16:59 +0000 [9453d1187a] Richard Mudgett * parking.h: Update ast_parking_park_call() doxygen to reality. ASTERISK-26029 Change-Id: I2db14d102a48d3224010e6d1c69e856373cc1260 2016-05-10 14:30 +0000 [cd89501d48] Alexei Gradinari * func_odbc: single database connection should be optional func_odbc was changed in Asterisk 13.9.0 to make func_odbc use a single database connection per DSN because of reported bug ASTERISK-25938 with MySQL/MariaDB LAST_INSERT_ID(). This is drawback in performance when func_odbc is used very often in dialplan. Single database connection should be optional. ASTERISK-26010 Change-Id: I57d990616c957dabf7597dea5d5c3148f459dfb6 2016-05-20 09:39 +0000 [c0b190dd9a] Mark Michelson * res_pjsip: Match dialogs on responses better. When receiving an incoming response to a dialog-starting INVITE, we were not matching the response to the INVITE dialog. Since we had not recorded the to-tag to the dialog structure, the PJSIP-provided method to find the dialog did not match. Most of the time, this was not a problem, because there is a fall-back that makes the response get routed to the same serializer that the request was sent on. However, in cases where an asynchronous DNS lookup occurs in the PJSIP core, the thread that sends the INVITE is not actually a threadpool serializer thread. This means we are unable to record a serializer to handle the incoming response. Now, imagine what happens when an INVITE is sent on a non-serialized thread, and an error response (such as a 486) arrives. The 486 ends up getting put on some random threadpool thread. Eventually, a hangup task gets queued on the INVITE dialog serializer. Since the 486 is being handled on a different thread, the hangup task can execute at the same time that the 486 is being handled. The hangup task assumes that it is the sole owner of the INVITE session and channel, so it ends up potentially freeing the channel and NULLing the session's channel pointer. The thread handling the 486 can crash as a result. This change has the incoming response match the INVITE transaction, and then get the dialog from that transaction. It's the same method we had been using for matching incoming CANCEL requests. By doing this, we get the INVITE dialog and can ensure that the 486 response ends up being handled by the same thread as the hangup, ensuring that the hangup runs after the 486 has been completely handled. ASTERISK-25941 #close Reported by Javier Riveros Change-Id: I0d4cc5d07e2a8d03e9db704d34bdef2ba60794a0 2016-05-19 11:41 +0000 [ddcf983e39] Joshua Colp * res_sorcery_astdb: Filter fields to only the registered ones. This change introduces the same filtering that is done in res_sorcery_realtime to the res_sorcery_astdb module. This allows persisted sorcery objects that may contain unknown fields to still be read in from the AstDB and used. This is particularly useful when switching between different versions of Asterisk that may have introduced additional fields. ASTERISK-26014 #close Change-Id: Ib655130485a3ccfd635b7ed5546010ca14690fb2 2016-05-09 21:40 +0000 [39fedfa423] snuffy * res_pjsip_empty_info: Respond to empty SIP INFO packets Some SBCs require responses to empty SIP INFO packets after establishing call via INVITE, if not responded to they may drop your call after unspecified timeout of X minutes. They are identified by having no Content-Type, check for this and respond with 200 - OK message. ASTERISK-24986 #close Reported-by: Ilya Trikoz, Federico Santulli Change-Id: Ib27e4f07151e5aef28fa587e4ead36c5b87c43e0 2016-05-18 07:54 +0000 [935e0496c4] gtjoseph * udptl: Don't eat sequence numbers until OK is received Scenario: Local fax -> Asterisk w/ firewall -> Provider -> Remote fax * Local fax starts rtp call to remote fax * Remote fax starts t38 call back to local fax. * Local fax sends t38 no-signal to Asterisk before sending an OK. * udptl processes the frame and increments the expected sequence number. * chan_sip drops the frame because the call isn't up so nothing goes out the external interface to open the port for incoming packets. * Local fax sends OK and Asterisk sends OK to the remote fax. * Remote fax sends t38 packets which are dropped by the firewall. * Local fax re-sends t38 no-signal with the same sequence number. * udptl drops the frame because it thinks it's a dup. * Still no outgoing packets to open the firewall. * t38 negotiation fails. The patch drops frames t38 received before udptl sequence processing when the call hasn't been answered yet. The second no-signal frame is then seen as new and is relayed out the external interface which opens the port and allows negotiation to continue. ASTERISK-26034 #close Change-Id: I11744b39748bd2ecbbe8ea84cdb4f3c5943c5af9 2016-05-17 11:14 +0000 [77e8ec162b] gtjoseph * chan_sip: Prevent extra Session-Expires headers from being added When chan_sip does a re-INVITE to refresh a session and authentication is required, the INVITE with the Authorization header containes a second Session-Expires header without the ";refersher=" parameter. This is causing some proxies to return a 400. Also, when Asterisk is the uas and the refresher, it is including the Session-Expires and Min-SE headers in OPTIONS messages which is not allowed per RFC4028. This patch (based on the reporter's) Checks to see if a Session-Expires header is already in the message before adding another one. It also checks that the method is INVITE or UPDATE. ASTERISK-26030 #close Change-Id: I58a7b07bab5a3177748d8a7034fb8ad8e11ce1d9 2016-05-16 15:29 +0000 [3f6ef63099] gtjoseph * res_pjsip_outbound_registration: Clean up state when registration is deleted Nothing was cleaning up the registration state object when ast_sorcery_delete was called on a registration. So, the registration was deleted from sorcery but the state object went right on refreshing the registration (or failing to refresh the registration) with the peer. * Added a 'deleted' observer on registration that removes the state object. ASTERISK-25964 #close Reported-by Matt Jordan Change-Id: I2db792145cdb1f72ebbf57dd9099596dbbf12c23 2016-05-15 19:05 +0000 [b6f9392a12] gtjoseph * res_pjsip: Set TCP_NODELAY on TCP transports Although it's perfectly legal to place multiple SIP messages in the same packet, it can cause problems because the Linux default is to enable Path MTU Discovery which sets the Don't Fragment bit on the packets. If adding a second message to the packet causes the MTU to be exceeded, and the destination isn't equipped to send a FRAGMENTATION NEEDED response to a large packet, the packet will just be dropped. We can't specifically tell the stack to send only 1 message per packet, but we can turn on TCP_NODELAY when we create the transport. This will at least tell the stack to send packets as soon as possible. ASTERISK-26005 #close Reported-by: Ross Beer Change-Id: I820f23227183f2416ca5e393bec510e8fe1c8fbd 2016-05-14 21:48 +0000 [361a16f316] Matt Jordan * configs/samples/pjsip.conf.sample: Fix typo A ':' is not a valid token for starting a comment. Change-Id: I123592d93a83d1bdde3e352822881eb9da85e5ad 2016-05-12 07:08 +0000 [f91a7dc993] Matt Jordan * res/res_hep_pjsip: Fix reported local IP address when bound to 'any' When bound to an 'any' address, e.g., 0.0.0.0, PJSIP reports as its local address the 'any' address, as opposed to the IP address we actually received the packet on. This can cause some confusion in Homer, as it will dutifully report what we send it. This patch uses the PJSIP inspection routines to determine which IP address we probably received the packet on based on the remote party's IP address. In the event that this fails, it falls back to the IP address natively reported by the transport. Change-Id: I076f835d2aef489e1ee1d01595b211eb2ce62da3 2016-05-14 12:29 +0000 [9de5cd209e] Sean Bright * res_ari: Correct Location headers returned by some ARI resources The Location headers returned by: * /bridges/{bridgeId}/play * /bridges/{bridgeId}/record * /channels/{channelId}/play * /channels/{channelId}/record Did not have the '/ari' prefix, and in the case of the 'play' resources, were using 'playback' instead of 'playbacks.' Change-Id: I957c58a3a1471bf477dae7c67faa1b74fcd9241c 2016-05-13 11:38 +0000 [524a302974] Alexei Gradinari * res_pjsip: Endpoint IP Access Controls With the old SIP module we can use IP access controls per peer. PJSIP module missing this feature. This patch added next configuration Endpoint options: "acl" - list of IP ACL section names in acl.conf "deny" - List of IP addresses to deny access from "permit" - List of IP addresses to permit access from "contact_acl" - List of Contact ACL section names in acl.conf "contact_deny" - List of Contact header addresses to deny "contact_permit" - List of Contact header addresses to permit This patch also better logging failed request: add custom message instead of "No matching endpoint found" add SIP method to logging ASTERISK-25900 Change-Id: I456dea3909d929d413864fb347d28578415ebf02 2016-05-11 20:17 +0000 [89ae4466ea] Matt Jordan * res_hep: Provide an option to pick the UUID type At one point in time, it seemed like a good idea to use the Asterisk channel name as the HEP correlation UUID. In particular, it felt like this would be a useful identifier to tie PJSIP messages and RTCP messages together, along with whatever other data we may eventually send to Homer. This also had the benefit of keeping the correlation UUID channel technology agnostic. In practice, it isn't as useful as hoped, for two reasons: 1) The first INVITE request received doesn't have a channel. As a result, there is always an 'odd message out', leading it to be potentially uncorrelated in Homer. 2) Other systems sending capture packets (Kamailio) use the SIP Call-ID. This causes RTCP information to be uncorrelated to the SIP message traffic seen by those capture nodes. In order to support both (in case someone is trying to use res_hep_rtcp with a non-PJSIP channel), this patch adds a new option, uuid_type, with two valid values - 'call-id' and 'channel'. The uuid_type option is used by a module to determine the preferred UUID type. When available, that source of a correlation UUID is used; when not, the more readily available source is used. For res_hep_pjsip: - uuid_type = call-id: the module uses the SIP Call-ID header value - uuid_type = channel: the module uses the channel name if available, falling back to SIP Call-ID if not For res_hep_rtcp: - uuid_type = call-id: the module uses the SIP Call-ID header if the channel type is PJSIP and we have a channel, falling back to the Stasis event provided channel name if not - uuid_type = channel: the module uses the channel name ASTERISK-25352 #close Change-Id: Ide67e59a52d9c806e3cc0a797ea1a4b88a00122c 2016-05-10 02:56 +0000 [a73d79c22f] Tzafrir Cohen * basic-cfg: asterisk.conf: remove [directories] A minimal configuration does not need to explicitly spell out the directories. The built-in defaults will do just fine. In many cases they are wrong. Change-Id: Id1a671e5c5e9923765a4156b57f9f7e263fdd26c Signed-off-by: Tzafrir Cohen 2016-05-10 03:06 +0000 [1c56de9453] Tzafrir Cohen * basic-cfg: asterisk.conf: defaults of options Note the default of remmed-out options. To clarify that those values are not the defaults. Change-Id: I849c29b7a710f0abc37355fcb5bfee335ae30738 Signed-off-by: Tzafrir Cohen 2016-05-10 03:08 +0000 [d7af591c59] Tzafrir Cohen * basic-cfg: asterisk.conf: debug level 5 spams Don't suggest users to use debug level 5, which spews (usually non-useful) debug information. Reduce the suggestion to (an arbitrarily-selected) level 2. Change-Id: Ib53195f78945970956ff59ef13fa89b90e0fcd60 Signed-off-by: Tzafrir Cohen 2016-05-10 03:10 +0000 [9b7db18fc1] Tzafrir Cohen * basic-cfg: asterisk.conf: don't set languages * No need to set language in a miniml configuration. 'en' will do just fine. * It would be useful to have an example of setting it to a different language. * Setting the documentation language explicitly is likewise not required. Setting it to a different value is not common. At least until there is a set of translated documentation. Change-Id: I94d91ea34e129925f25af81ef8dc0906fb568cb7 Signed-off-by: Tzafrir Cohen 2016-05-10 08:17 +0000 [eec539a46e] Tzafrir Cohen * followme: delete the right recorded name file FollowMe with the option a records the name of the caller and plays it to the callee. However it has failed to clean up that recorded file as it tried to delete the file name without the '.sln' extension. ASTERISK-26008 #close Change-Id: I79d7b1be7d5cde57bf076d9389e2a8a4422776ec Signed-off-by: Tzafrir Cohen 2016-05-12 14:36 +0000 [02d30e171e] Mark Michelson * Use doubles instead of floats for conversions when comparing strings. In 13.9.0, there was an issue where PJSIP contacts added to an AOR would be deleted at seemingly random times. One reason this was happening was because of an operation to retrieve the contacts whose expiration time was less than or equal to the current time. When retrieving existing contacts, the contact's expiration time and the current time were converted from a string to a float, and those two floats were compared. On some systems, including mine, this conversion was horribly off. For instance, I could regularly see the string "1463079214" get converted into 1463079168.000000. When switching from using a float to using a double, the conversion was as expected. Why was the conversion to float off? My best guess is that the conversion to float was attempting to store the entire value in the 23 bit significand of the IEEE-754 floating point number. In particular, if you take only the 23 most significant bits of 1463079214, you get the messed up 1463079168 that we were seeing in the conversion. It likely was possible to get a more precise value by composing the number using an exponent, but the conversion did not work that way. With a double, you have a 52 bit significand, allowing the entire value to fit there, and thereby allowing an accurate conversion. ASTERISK-26007 #close Reported by Greg Siemon Change-Id: I83ca7944aae8b7cd994b254c78ec02411d321070 2016-05-12 09:13 +0000 [e2df15bae9] gtjoseph * pjsip_distributor: Add missing newline to NOTICE There was a newline missing from the end of the "no matching endpoint" notice. Change-Id: Idc11fe5bc0354072291663dbffe648c471e39181 2016-05-10 10:19 +0000 [a94a12bbf7] Sebastian Damm * res_pjsip_outbound_registration: generate correct Contact URI for TLS There are two types of SIP URIs indicating a secure transport: * sips:user@example.org * sip:user@example.org;transport=tls When using a sips URI, Asterisk checks incoming INVITEs and answers from the other side for sips URIs, and rejects the packet if there are only sip URIs. So Asterisk should only generate a sips Contact URI if the other side supports it. This patch makes Asterisk generate either a sip or sips Contact URI depending on the format of the server URI. If you want a sip URI, use: server_uri=sip:example.org\;transport=tls If you want a sips URI, use: server_uri=sips:example.org ASTERISK-25990 #close Reported-by: Sebastian Damm Change-Id: I5ae57d6531ce940b5fc64d5cd2673e60db0f9ba2 2016-05-05 16:41 +0000 [36d66a23e0] Alexei Gradinari * logger: Add PID to syslog messages. During refactoring of this support the addition of the PID to messages was removed. This change adds it back in. ASTERISK-25538 #close Change-Id: Ie2d43b0652e59b7ac319a7dba94501540d70ba36 2016-05-11 14:07 +0000 [37214b0bdf] Matt Jordan * configure: Fix errors with AST_UNDEFINED_SANITIZER/AST_LEAK_SANITIZER When running on a system that does not support or use AST_UNDEFINED_SANITIZER or AST_LEAK_SANITIZER, the configure script would incorrectly set those constants to a blank value, e.g., 'AST_UNDEFINED_SANITIZER='. This would cause menuselect to error out, complaining that a blank value is not a valid option. This patch corrects the issue by setting the value to 0 if the options that those constants enable/disable is not found. Change-Id: Ib39814aaf940f308d500c1e026edb3d70de47fba 2016-05-03 15:43 +0000 [49b25a0956] Kevin Harwell * res_pjsip_outbound_publish: state potential dropped on reloads/realtime fetches When reloading, or fetching realtime data, if the "apply" failed for any numerous reasons the current state object would not be maintained. This potentially resulted in publishes being stopped for some states/clients when they should not have been. This patch makes it so the current state object is kept upon any type of reload/ fetch failures. Change-Id: Iab6020c116d628ed2ae81183e987e2eaa3c90b30 2016-05-03 15:31 +0000 [1b5c91b7be] Kevin Harwell * res_pjsip_outbound_publish: Potential crash due to off nominal path It was possible for the explicit publish destroy function to be called without the pjsip client ever being initialized. This fix checks to make sure there is a client to destroy before attempting. Change-Id: I8eea1bfa3bd472149bfc255310be2a6248688f5c 2016-05-03 15:35 +0000 [10de553c9d] Kevin Harwell * res_pjsip_outbound_publishing: After unloading the library won't load again The same thing was happening in res_pjsip_publish_asterisk. When the library was unloaded it did not unregister the object type from sorcery. Subsequent loads resulted in a failed load due to the sorcery type already existing. Change-Id: Ifdc25e94e4cd40bc5a19eb4d0a00b86c2e9fedc9 2016-05-03 14:59 +0000 [1a833b9739] Kevin Harwell * res_pjsip_outbound_publish: Ref leak in off nominal callback paths There were a few spots where the client object's reference was being leaked in sip_outbound_publish_callback. This patch cleans up those leaks. Change-Id: I485d0bc9335090f373026f77c548042e258461df 2016-05-03 15:39 +0000 [4752ef02e0] Kevin Harwell * res_pjsip_outbound_publish: Won't unload if condition wait times out When res_pjsip_outbound_publish unloads it has to wait for all current publishing objects to get done. However if the wait condition times out then it does not fail the unload. This sometimes results in an infinite loop check while unloading. This patch now fails the unload operation if the condition times out. Change-Id: Id57b8cbed9d61222690fcba1e4f18e259df4c7ec 2016-05-05 11:37 +0000 [4d063814ba] Kevin Harwell * res_pjsip_authenticator_digest: Don't use source port in nonce verification From the issue reporter: "res_pjsip_outbound_authenticator_digest builds a nonce that is a hash of the timestamp, the source address, the source port, a server UUID that is calculated at startup, and the authentication realm. Rather than caching nonces that we create, we instead attempt to re-calculate the nonce when receiving an incoming request with authentication. We then compare the re-calculated nonce to the incoming nonce, and if they don't match, then authentication has failed early. The problem is that it is possible, especially when using TCP, to receive two requests from the same endpoint but have differing source ports for those requests. Asterisk itself commonly will use different source ports for outbound TCP requests." This patch removes the source port dependency when building the nonce. ASTERISK-25978 #close Change-Id: I871b5f4adce102df1c4988066283095ec509dffe 2016-05-07 14:39 +0000 [fb6227a372] gtjoseph * config_transport: Tell pjproject to allow all SSL/TLS protocols The default tls settings for pjproject only allow TLS 1, TLS 1.1 and TLS 1.2. SSL is not allowed. So, even if you specify "sslv3" for a transport method, it's silently ignored and one of the TLS protocols is used. This was a new behavior of pjsip_tls_setting_default() in 2.4 (when tls.proto was added) that we never caught. Now we need to set tls.proto = 0 after we call pjsip_tls_setting_default(). This tells pjproject to set the socket protocol to match the method. ASTERISK-26004 #close Change-Id: Icfb55c1ebe921298dedb4b1a1d3bdc3ca41dd078 2016-05-04 02:40 +0000 [2db17a793c] Jaco Kroon * app_confbridge: Add a regcontext option for confbridge bridge profiles. This patch allows for having app_confbridge register the name of the conference as an extension into a specific context, similar to regcontext for chan_sip. This variant is not quite as involved as the one in chan_sip and doesn't allow for multiple contexts or custom extensions, you can only specify the context and the conference name will always be used as the extension to register. ASTERISK-25989 #close Change-Id: Icacf94d9f2b5dfd31ef36f6cb702392619a7902f 2016-05-08 20:19 +0000 [2a7130b8b0] gtjoseph * pjproject_bundled: Check for python-dev and TEST_FRAMEWORK The pjsua and pjsystest apps are now built only if TEST_FRAMEWORK is set. The python bindings are now built only if TEST_FRAMEWORK is set and a python development package is installed. libresample was also disabled. ASTERISK-25993 #close Reported-by: Joshua Colp Change-Id: If4e91c503a02f113d5b71bc8b972081fa3ff6f03 2016-05-04 15:16 +0000 [72eb7c8301] Alexei Gradinari * res_pjsip: module load priority The res_pjsip_authenticator_digest, res_pjsip_endpoint_identifier_* and res_pjsip_registrar modules should load ASAP to avoid "No matching endpoint found" for legitimate endpoint. ASTERISK-25994 Change-Id: Iac95d95ad031e0be104189d29e923a2ad7c24a1b 2016-05-04 03:17 +0000 [dd00c71aae] Chris Trobridge * config_options.c: Expand #ifdef to contain whole if statement. ASTERISK-25956 #close Change-Id: If6961ec54be276d5ab4f012ee7e7b420cb45de38 2016-05-05 15:16 +0000 [e6eb17efd9] Alexei Gradinari * stasis_endpoints: Add new Status and Headers to ContactStatus ASTERISK-25903 added a new headers to AMI Event ContactStatusDetail. ASTERISK-25904 added a new Status to AMI Event ContactStatusDetail. These additions should be also in stasis_endpoints to include in command "manager show event ContactStatus" Change-Id: I7610ad02a998e1f26c20caa27aa50279d0164f6a 2016-05-05 05:07 +0000 [fa11f4c920] Joshua Colp * file: Ensure nativeformats remains valid for lifetime of use. It is possible for the nativeformats of a channel to change throughout its lifetime. As a result a user of it needs to either ensure the channel is locked when accessing the formats or keep a reference to the nativeformats themselves. This change fixes the file playback support so it keeps a reference to the nativeformats when accessing things. ASTERISK-25998 #close Change-Id: Ie45b65475e1481ddf05b874ee48f63e39fff8915 2016-04-15 09:32 +0000 [9c2032240e] Alexei Gradinari * res_pjsip: improve realtime performance This patch modified pjsip_options to retrieve only permament contacts for aor if the qualify_frequency is > 0 and persisted contacts if the qualify_frequency is > 0. This patch also fixed a bug in res_sorcery_astdb. res_sorcery_astdb doesn't save object data retrived from astdb. ASTERISK-25826 Change-Id: I1831fa46c4578eae5a3e574ee3362fddf08a1f05 2016-05-04 16:11 +0000 [fe38d21c2a] Alexei Gradinari * pjsip: Added "reg_server" to contacts (fixed alembic) ASTERISK-25931 Change-Id: Icc4321a88f5c93ff809da3f372eebbf69c6a8549 2016-04-07 16:33 +0000 [7a14e669f0] Alexei Gradinari * res_pjsip/AMI: add contact.updated event With the old SIP module AMI sends PeerStatus event on every successfully REGISTER requests, ie, on start registration, update registration and stop registration. With PJSIP AMI sends ContactStatus only when status is changed. Regarding registration: on start registration - Created on stop registration - Removed but on update registration nothing This patch added contact.updated event. ASTERISK-25904 Change-Id: I8fad8aae9305481469c38d2146e1ba3a56d3108f 2016-05-02 16:08 +0000 [06d4ac0355] Alexei Gradinari * res_fax: add FAXMODE variable The app_fax set FAXMODE variable, but res_fax missing this feature. This patch add FAXMODE variable which is set to either "audio" or "T38". ASTERISK-25980 Change-Id: Ie3dcbfb72cc681e9e267a60202f7fb8723a51b6b 2016-05-02 16:52 +0000 [2d17fe06c5] Alexei Gradinari * res_fax/t38_gateway: Peer V.21 session is created on wrong channel The channel and peer V.21 sessions are created on the same channel now. The peer V.21 session should be created only on peer channel when one of channel can handle T.38. Also this patch enable debug for T.38 gateway session if global fax debug enabled. ASTERISK-25982 Change-Id: I78387156ea521a77eb0faf170179ddd37a50430e 2016-05-01 02:21 +0000 [a2f19d82a8] Diederik de Groot * configs/basic-pbx/asterisk.conf: contains incorrect path separator Note: When packagers use these files (as an example) the paths are never really used when they are split using '='. Note: Thirdparty applications will also have trouble parsing the file when expecting '=>'. Change-Id: I0ada647f588e81f023fb1333ca15a1a333fd6004 2016-04-30 17:52 +0000 [f39089f17c] gtjoseph * pjproject_bundled: Various fixes discovered during testing of OSes For all OSes: * Disabled third-party codecs in pjproject and added '--disable-speex-codec --disable-speex-aec --disable-gsm-codec' to the configure options since we don't use the pjsip codec capability. FreeBSD: * Added FreeBSD support to install_prereq. * Changed pjproject/configure.m4 to use $GNU_MAKE instead of hardcoding "make". * Added __progname and environ to asterisk.exports.in. * Reverted the use of ldconfig to create shared library symlinks to ln. * Only enable epoll in pjproject if `uname -s` is Linux. * Added a patch to pjproject to take the name of the 'make' command from an environment variable if supplied. This is needed for the python bindings. (merged by Teluu into pjproject trunk 5/3/2016) FreeBSD support isn't complete. Still some general issues regarding make/gmake having nothing to do with pjproject. With some handholding it DOES build successfully. CentOS: Added 'patch' and 'bzip2' to install_prereq PACKAGES_RH. CentOS 6/7 32/64 build and run the pjsip testsuite successfully. Ubuntu: No changes required. Ubuntu 15/16 32/64 build and run the pjsip testsuite successfully. Debian: No changes required. Debian 6/7/8 32/64 build and run the pjsip testsuite successfully. There will utimately be a follow-up patch to create an install_prereq for the testsuite as I've discovered a few missing requirements. ASTERISK-25968 #close Change-Id: I5756a07facfc63798115a5e73a8709382fe9259c 2016-03-17 14:29 +0000 [8028fc7585] Andrew Nagy * app_voicemail: always copy dynamic struct to avoid race condition Voicemail email addresses can be corrupt or voicemail emails can end up being sent to the wrong email address if asterisk is reading voicemail.conf during a reload and processing an email at the same time. This patch always copies the struct that would otherwise only be copied once. ASTERISK-24463 #close Reported by: John Campbell Tested by: Etienne Lessard Tested by: Andrew Nagy Change-Id: I3a0643813116da84e2617291903d0d489b7425fb 2016-04-15 14:26 +0000 [3cb8934de0] Alexei Gradinari * pjsip: Added "reg_server" to contacts. If the Asterisk system name is set in asterisk.conf, it will be stored into the "reg_server" field in the ps_contacts table to facilitate multi-server setups. ASTERISK-25931 Change-Id: Ia8f6bd2267809c78753b52bcf21835b9b59f4cb8 2016-04-28 11:35 +0000 [7992923c70] Richard Mudgett * res_pjsip: Start body generator users after suppliers. Change-Id: I8f0b57841feaab56c8a4e821b5ccb4e05e5fbadb 2016-04-28 16:06 +0000 [5dc0e082b2] Richard Mudgett * res_pjsip_pubsub.c: Add useful information to some messages. Change-Id: Ia0b2e15773894c599e5c5748bbc70e99f434192a 2016-04-26 15:58 +0000 [f9e416f053] Richard Mudgett * res_pjsip_pubsub.c: Fix body generator registration race. Change-Id: Id8752073ef06472a2fd96080f4009fac42843e67 2016-04-26 15:13 +0000 [b1b2019046] Richard Mudgett * res_pjsip_pubsub.h: Fix doxygen association. Change-Id: I110d3e3572598289fcd4215d966cf0c858f98632 2016-04-25 16:00 +0000 [b7f07fdff5] Richard Mudgett * res_pjsip_outbound_publish.c: Remove redundant flag check. Change-Id: I0da80a3c3e0eae0c52ff27e7412ba027d6f52353 2016-04-28 16:54 +0000 [719ece5659] gtjoseph * pjproject_bundled: Disable PJSIP_UNESCAPE_IN_PLACE When pjsip_parse_uri is called with PJSIP_UNESCAPE_IN_PLACE enabled, the input uri string will become corrupted if it contains escape sequences. It's not possible to automatically strdup or strdupa the input string because the output uri pj_str_t's will have pointers to chunks of the input string. Getting around this would require more memory management code and wouldn't be worth the savings of doing the unescape in place. ASTERISK-25970 #close Reported-by: Dmitriy Serov Change-Id: I28dc0e599b5108f7959b9c46dc8278371b372f88 2016-03-07 18:34 +0000 [38bed4515d] gtjoseph * res_pjsip: Add ability to identify by Authorization username A feature of chan_sip that service providers relied upon was the ability to identify by the Authorization username. This is most often used when customers have a PBX that needs to register rather than identify by IP address. From my own experiance, this is pretty common with small businesses who otherwise don't need a static IP. In this scenario, a register from the customer's PBX may succeed because From will usually contain the PBXs account id but an INVITE will contain the caller id. With nothing recognizable in From, the service provider's Asterisk can never match to an endpoint and the INVITE just stays unauthorized. The fixes: A new value "auth_username" has been added to endpoint/identify_by that will use the username and digest fields in the Authorization header instead of username and domain in the the From header to match an endpoint, or the To header to match an aor. This code as added to res_pjsip_endpoint_identifier_user rather than creating a new module. Although identify_by was always a comma-separated list, there was only 1 choice so order wasn't preserved. So to keep the order, a vector was added to the end of ast_sip_endpoint. This is only used by res_pjsip_registrar to find the aor. The res_pjsip_endpoint_identifier_* modules are called in globals/endpoint_identifier_order. Along the way, the logic in res_pjsip_registrar was corrected to match most-specific to least-specific as res_pjsip_endpoint_identifier_user does. The order is: username@domain username@domain_alias username Auth by username does present 1 problem however, the first INVITE won't have an Authorization header so the distributor, not finding a match on anything, sends a securty_alert. It still sends a 401 with a challenge so the next INVITE will have the Authorization header and presumably succeed. As a result though, that first security alert is actually a false alarm. To address this, a new feature has been added to pjsip_distributor that keeps track of unidentified requests and only sends the security alert if a configurable number of unidentified requests come from the same IP in a configurable amout of time. Those configuration options have been added to the global config object. This feature is only used when auth_username is enabled. Finally, default_realm was added to the globals object to replace the hard coded "asterisk" used when an endpoint is not yet identified. The testsuite tests all pass but new tests are forthcoming for this new feature. ASTERISK-25835 #close Reported-by: Ross Beer Change-Id: I30ba62d208e6f63439600916fcd1c08a365ed69d 2016-04-27 13:23 +0000 [677d5b5151] Mark Michelson * func_odbc: Check connection status before executing queries. A recent change to func_odbc made it so that a single connection was maintained per DSN. The problem was that the code was optimistic about the health of the connection after initially opening it and did nothing to re-connect in case the connection had died. This change adds a check before executing a query to ensure that the connection to the database is still up and running. ASTERISK-25963 #close Reported by Ross Beer Change-Id: Id33c86eb04ff48ca088bb2e3086c27b3b683491d 2016-04-15 11:59 +0000 [df3639700a] Alexei Gradinari * res_pjsip: disable multi domain to improve realtime performace This patch added new global pjsip option 'disable_multi_domain'. Disabling Multi Domain can improve Realtime performance by reducing number of database requests. ASTERISK-25930 #close Change-Id: I2e7160f3aae68475d52742107949a799aa2c7dc7 2016-04-26 11:13 +0000 [949bf6b282] Joshua Colp * chan_sip: Give more time for TCP/TLS threads to stop. The unload process currently tells each TCP/TLS to terminate but does not wait for them to do so. This introduces a race condition where the container holding the threads may be destroyed before the threads are able to remove themselves from it. When they finally do the container is invalid and can't be used causing a crash. A previous change existed which waited a bit to wait for any stranglers to finish. This change extends this and waits longer. ASTERISK-25961 #close Change-Id: Idc6262b670ca49ede32061159e323b7b63c6f3c6 2016-04-26 05:48 +0000 [6959f5484b] Joshua Colp * app_queue: Fix crash when unloading module. When unloading the app_queue module the members in each queue are destroyed and as part of this they are removed from the pending members container. Unfortunately a crash would occur as the container was destroyed before the members were removed. This change tweaks ordering so the container destruction occurs after the members are destroyed. ASTERISK-16115 Change-Id: I48c728668c55aee3d05b751a5d450fb57e87f44b 2016-04-24 22:51 +0000 [b38f1146e5] gtjoseph * config: Fix ast_config_text_file_save2 writability check for missing files A patch I did back in 2014 modified ast_config_text_file_save2 to check the writability of the main file and include files before truncating and re-writing them. An unintended side-effect of this was that if a file doesn't exist, the check fails and the write is aborted. This patch causes ast_config_text_file_save2 to check the writability of the parent directory of missing files instead of checking the file itself. This allows missing files to be created again. A unit test was also added to test_config to test saving of config files. The regression was discovered when app_voicemail's passwordlocation=spooldir feature stopped working. ASTERISK-25917 #close Reported-by: Jonathan Rose Change-Id: Ic4dbe58c277a47b674679e49daed5fc6de349f80 2016-04-21 23:53 +0000 [29bab0d1a4] Kirill Katsnelson * chan_sip: Make autocreated peers send PeerStatus events Since Stasis has been introduced, an attempt to send AMI messages by an autocreated peer caused a crash, and all events from autocreated peers were semi-inadvertently disabled altogether in 0b83761. This change restores the disabled functionality. ASTERISK-25950 Change-Id: Iecc350f23db603fadb2f302064643ebe9664e974 2016-04-21 14:23 +0000 [c345e530f4] Kevin Harwell * app_queue: queue members can receive multiple calls It was possible for a queue member that is a member of at least 2 or more queues to receive mulitiple calls at the same time. This happened because of a race between when a member was being rung and when the device state notified the other queue(s) member object of the state change. This patch makes it so when a queue member is being rung it gets added to a global pool of queue members. If that same member is tried again, e.g. from another queue, and it is found to already exist in the pending member container then it will not ring that member. ASTERISK-16115 #close Change-Id: I546dd474776d158c2b6be44205353dee5bac7e48 2016-04-25 08:11 +0000 [c0688a6398] Javier Acosta * Fix case sensitive actions in AMI QueueSummary and QueueStatus ASTERISK-25954 #close Reported by: Javier Acosta Change-Id: I00be83d45cc7e8385de2523012bd196aafeeb256 2016-04-22 17:53 +0000 [eb7c581806] gtjoseph * res_agi: Prevent run_agi from eating frames it shouldn't The run_agi function is eating control frames when it shouldn't be. This is causing issues when an AGI is run from CONNECTED_LINE_SEND_SUB in a blond transfer. Alice calls Bob. Bob attended transfers to Charlie but hangs up before Charlie answers. Alice gets the COLP UPDATE indicating Charlie but Charlie never gets an UPDATE and is left thinking he's connected to Bob. In this case, when CONNECTED_LINE_SEND_SUB runs on Alice's channel and it calls an AGI, the extra eaten frames prevent CONNECTED_LINE_SEND_SUB from running on Charlie's channel. The fix was to accumulate deferrable frames in the "forever" loop instead of dropping them, and re-queue them just before running the actual agi command or exiting. ASTERISK-25951 #close Change-Id: I0f4bbfd72fc1126c2aaba41da3233a33d0433645 2016-04-22 15:25 +0000 [ebf0724a83] Richard Mudgett * test_message.c: Wait longer in case dialplan also processes the test message. Bumped the wait from 1 second to 5 seconds. The test message was hitting my default call handler and failing the test because it took longer. Change-Id: I3a03737f25e92983de00548fcc7bbc50dd7544ba 2016-04-12 15:29 +0000 [ba63aa7c9e] Richard Mudgett * Manager: Short circuit AMI message processing. Improve AMI message processing performance if there are no consumers listening for the messages. We now skip creating the AMI event message text strings. Change-Id: I7b22fc5ec4e500d00635c1a467aa8ea68a1bb2b3 2016-04-13 17:54 +0000 [d5ee6acf28] Richard Mudgett * manager.c: Eliminate most RAII_VAR usage. * Made ast_manager_event_blob_create() not allocate the ao2 event object with a lock as it is not needed. Change-Id: I8e11bfedd22c21316012e0b9dd79f5918f644b7c 2016-04-13 17:09 +0000 [7303e3dc96] Richard Mudgett * manager_channels.c: Fix allocation failure crash. An earlier allocation failure failed to create a channel snapshot for the AMI HangupRequest/SoftHangupRequest event which resulted in a crash in channel_hangup_request_cb(). Where the stasis message gets generated cannot tell if the NULL snapshot returned was because of an allocation failure or the channel was a dummy channel. * Made channel_hangup_request_cb() check if the channel blob has a snapshot and exit if it doesn't. * Eliminated the RAII_VAR usage in channel_hangup_request_cb(). Change-Id: I0b6a1c4e95cbb7d80b2a7054c6eadecc169dfd24 2016-04-13 13:50 +0000 [1e93f3d723] Richard Mudgett * Bridge system: Fix memory leaks and double frees on impart failure. You cannot reference the passed in features struct after calling ast_bridge_impart(). Even if the call fails. Change-Id: I902b88ba0d5d39520e670fb635078a367268ea21 2016-04-13 13:20 +0000 [5e388d4188] Richard Mudgett * bridge_softmix.c: Fix crash if channel fails to join mixing tech. softmix_bridge_join() failed because of an allocation failure. To address this, the softmix bridge technology now checks if the channel failed to join softmix successfully. In addition, the bridge now begins the process of kicking the channel out of the bridge so we don't have channels partially in the bridge for very long. * Fix the test_channel_feature_hooks.c unit tests. The test channel must have a valid codec to join the simple_bridge technology. This patch makes joining a bridge more strict by not allowing partially joined channels to remain in the bridge. Change-Id: I97e2ade6a2bcd1214f24fb839fda948825b61a2b 2016-04-22 13:49 +0000 [068ae54c76] Mark Michelson * func_odbc: Use one connection per DSN. res_odbc was changed in Asterisk 13.8.0 to remove connection management, opting instead to let unixodbc maintain open connections and return those to Asterisk as requested. This was a boon for realtime, since it meant that multiple threads could potentially run parallel queries since they could each be using their own database connections. However, on the user-facing side, func_odbc, there were some inherent behaviors being relied on that no longer hold true after the change. One such reported behavior was that MySQL's LAST_INSERTED_ID() works per-connection. This means that if Asterisk uses separate connections for every database operation, whereas before it used one connection for everything, we have broken expectations and functionality. The fix provided in this patch is to make func_odbc use a single database connection per DSN. This way, user-facing database usage will have the same behavior as it did pre-13.8.0. However, realtime, which is the real workhorse of database interaction, will continue to let unixodbc manage connections. ASTERISK-25938 #close Reported by Edwin Vandamme Change-Id: Iac961fe79154c6211569afcdfec843c0c24c46dc 2016-04-22 13:02 +0000 [6aeefa89bc] Leif Madsen * Remove reference to non-existent sip.conf option Option was removed in commit 7f883ef495b57ae9182e47213d01d5e8009dbf3f ASTERISK-25927 #close Change-Id: I92f9b0196d9fc41d1d58354c07340c465ef1fcf8 2016-04-21 08:26 +0000 [e750ea9b5b] Diederik de Groot * lock.c: Check *lt before dereferencing it *lt is NULL if t->tracking == 0 ASTERISK-25948 #close Change-Id: I4a81af28f9c82a74aa82413d772a7dc8fa6f45ba 2016-04-15 14:36 +0000 [a036c35903] Richard Mudgett * res_stasis: Handle re-enter stasis bridge with swap channel. We lose the fact that there is a swap channel if there is one. We currently wind up rejoining the stasis bridge as a normal join after the swap channel has already been kicked from the bridge. This patch preserves the swap channel so the AMI/ARI events can note that the channel joining the bridge is swapping with another channel. Another benefit to swaqpping in one operation is if there are any channels that get lonely (MOH, bridge playback, and bridge record channels). The lonely channels won't leave before the joining channel has a chance to come back in under stasis if the swap channel is the only reason the lonely channels are staying in the bridge. ASTERISK-25947 #close Reported by: Richard Mudgett ASTERISK-24649 Reported by: John Bigelow ASTERISK-24782 Reported by: John Bigelow Change-Id: If37ea508831d1fed6dbfac2f191c638fc0a850ee 2016-04-19 16:58 +0000 [9942d50aa5] Richard Mudgett * bridge: Hold off more than one imparting channel at a time. An earlier patch blocked the ast_bridge_impart() call until the channel either entered the target bridge or it failed. Unfortuantely, if the target bridge is stasis and the imprted channel is not a stasis channel, stasis bounces the channel out of the bridge to come back into the bridge as a proper stasis channel. When the channel is bounced out, that released the block on ast_bridge_impart() to continue. If the impart was a result of a transfer, then it became a race to see if the swap channel would get hung up before the imparted channel could come back into the stasis bridge. If the imparted channel won then everything is fine. If the swap channel gets hung up first then the transfer will fail because the swap channel is leaving the bridge. * Allow a chain of ast_bridge_impart()'s to happen before any are unblocked to prevent the race condition described above. When the channel finally joins the bridge or completely fails to join the bridge then the ast_bridge_impart() instances are unblocked. ASTERISK-25947 Reported by: Richard Mudgett ASTERISK-24649 Reported by: John Bigelow ASTERISK-24782 Reported by: John Bigelow Change-Id: I8fef369171f295f580024ab4971e95c799d0dde1 2016-04-19 17:52 +0000 [516c626a7d] gtjoseph * res_pjsip_callerid: Clear out display name if id->name is not valid When create_new_id_hdr creates a new RPID or PAI header, it starts by cloning the From header, then it overwrites the display name and uri from the channel's connected.id. If the connected.id.name wasn't valid, create_new_id_hdr was leaving the display name from the From header in the new RPID or PAI header. On an attended transfer where the originator had a caller id number set but not a display name, the re-INVITE to the final transferee had the number of the originator but the display name of the transferer. Added a check to clear out the display name in the new header if connected.id.name was invalid. ASTERISK-25942 #close Change-Id: I60b4bf7a7ece9b7425eba74151c0b4969cd2738b 2016-04-19 13:02 +0000 [ded3794fc6] Joshua Colp * app_talkdetect: Make the module core supported. This module is used as part of testsuite tests to confirm stuff works. I'm accordingly marking it as core as it is required by those tests. Change-Id: I558e7af7679b22b8ed641d7dd37ee4ca35b11e88 2016-04-18 12:12 +0000 [efae187217] Mark Michelson * PJSIP: Remove PJSIP parsing functions from uri length validation. The PJSIP parsing functions provide a nice concise way to check the length of a hostname in a SIP URI. The problem is that in order to use those parsing functions, it's required to use them from a thread that has registered with PJLib. On startup, when parsing AOR configuration, the permanent URI handler may not be run from a PJLib-registered thread. Specifically, this could happen when Asterisk was started in daemon mode rather than console-mode. If PJProject were compiled with assertions enabled, then this would cause Asterisk to crash on startup. The solution presented here is to do our own parsing of the contact URI in order to ensure that the hostname in the URI is not too long. The parsing does not attempt to perform a full SIP URI parse/validation, since the hostname in the URI is what is important. ASTERISK-25928 #close Reported by Joshua Colp Change-Id: Ic3d6c20ff3502507c17244a8b7e2ca761dc7fb60 2016-04-18 17:00 +0000 [f436b9ab11] Mark Michelson * res_pjsip_registrar: Fix bad memory-ness with user_agent. Recent changes to the PJSIP registrar resulted in tests failing due to missing AOR_CONTACT_ADDED test events. The reason for this was that the user_agent string had junk values in it, resulting in being unable to generate the event. I'm going to be honest here, I have no idea why this was happening. Here are the steps needed for the user_agent variable to get messed up: * REGISTER is received * First contact in the REGISTER results in a contact being removed * Second contact in the REGISTER results in a contact being added * The contact, AOR, expiration, and user agent all have to be passed as format parameters to the creation of a string. Any subset of those parameters would not be enough to cause the problem. Looking into what was happening, the thing that struck me as odd was that the user_agent variable was meant to be set to the value of the User-Agent SIP header in the incoming REGISTER. However, when removing a contact, the user_agent variable would be set (via ast_strdupa inside a loop) to the stored contact's user_agent. This means that the user_agent's value would be incorrect when attempting to process further contacts in the incoming REGISTER. The fix here is to use a different variable for the stored user agent when removing a contact. Correcting the behavior to be correct also means the memory usage is less weird, and the issue no longer occurs. ASTERISK-25929 #close Reported by Joshua Colp Change-Id: I7cd24c86a38dec69ebcc94150614bc25f46b8c08 2016-04-18 13:41 +0000 [49bfdc9ac0] Joshua Colp * res_pjsip_transport_management: Allow unload to occur. At shutdown it is possible for modules to be unloaded that wouldn't normally be unloaded. This allows the environment to be cleaned up. The res_pjsip_transport_management module did not have the unload logic in it to clean itself up causing the res_pjsip module to not get unloaded. As a result the res_pjsip monitor thread kept going processing traffic and timers when it shouldn't. Change-Id: Ic8cadee131e3b2c436a81d3ae8bb5775999ae00a 2016-04-15 11:41 +0000 [f4693d1897] Richard Mudgett * bridge_channel.c: Ignore role setup failure in channel push. We have to setup the channel roles after the bridge class push is called because the bridge class push callback may have set roles on the incoming channel. Since we have already partially pushed the channel into the bridge and reversing what we have already done could be problematic, the only thing we can do is press on to complete pushing the channel into the bridge. * Ignore any channel role setup errors after pushing the channel into a bridge. The channel may behave incorrectly in the bridge but we can no longer abort the push at this time. Change-Id: I08a97082b729052ee65cdca6bb730cf1289ede00 2016-04-17 15:37 +0000 [22335fe18a] Jaco Kroon * chan_sip: Don't verify table if rtupdate=no If rtupdate=no do not verify sipregs/peers table has updatable fields. ASTERISK-25934 #close Change-Id: Iaa2c53037b93daccc7e7333c40d61861847b856d 2016-04-18 04:53 +0000 [3b9d8b60b2] ibercom * app_queue: Frequent segfaults in function can_ring_entry() ASTERISK-25888 #close Change-Id: I007a2f2dd99823e04fb5be3ff01f02b0a2956117 2016-04-15 16:51 +0000 [724acb6ce7] Richard Mudgett * stasis_bridge.c: Update stasis bridge push diagnostic messages. Change-Id: I195b14994c9dcccb9452491ca20a885d2a54605a 2016-04-14 13:49 +0000 [5f78801859] Mark Michelson * transport management: Register thread with PJProject. The scheduler thread that kills idle TCP connections was not registering with PJProject properly and causing assertions if PJProject was built in debug mode. This change registers the thread with PJProject the first time that the scheduler callback executes. AST-2016-005 Change-Id: I5f7a37e2c80726a99afe9dc2a4a69bdedf661283 2016-03-17 12:28 +0000 [9740277713] gtjoseph * res_pjsip: Add serialized scheduler (res_pjsip/pjsip_scheduler.c) There are several places that do scheduled tasks or periodic housecleaning, each with its own implementation: * res_pjsip_keepalive has a thread that sends keepalives. * pjsip_distributor has a thread that cleans up expired unidentified requests. * res_pjsip_registrar_expire has a thread that cleans up expired contacts. * res_pjsip_pubsub uses ast_sched directly and then calls ast_sip_push_task. * res_pjsip_sdp_rtp also uses ast_sched to send keepalives. There are also places where we should be doing scheduled work but aren't. A good example are the places we have sorcery observers to start registration or qualify. These don't work when changes are made to a backend database without a pjsip reload. We need to check periodically. As a first step to solving these issues, a new ast_sip_sched facility has been created. ast_sip_sched wraps ast_sched but only uses ast_sched as a scheduled queue. When a task is ready to run, ast_sip_task_pusk is called for it. This ensures that the task is executed in a PJLIB registered thread and doesn't hold up the ast_sched thread so it can immediately continue processing the queue. The serializer used by ast_sip_sched is one of your choosing or a random one from the res_pjsip pool if you don't choose one. Another feature is the ability to automatically clean up the task_data when the task expires (if ever). If it's an ao2 object, it will be dereferenced, if it's a malloc'd object it will be freed. This is selectable when the task is scheduled. Even if you choose to not auto dereference an ao2 task data object, the scheduler itself maintains a reference to it while the task is under it's control. This prevents the data from disappearing out from under the task. There are two scheduling models. AST_SIP_SCHED_TASK_PERIODIC specifies that the invocations of the task occur at the specific interval. That is, every "interval" milliseconds, regardless of how long the task takes. If the task takes longer than the interval, it will be scheduled at the next available multiple of interval. For exmaple: If the task has an interval of 60 secs and the task takes 70 secs (it better not), the next invocation will happen at 120 seconds. AST_SIP_SCHED_TASK_DELAY specifies that the next invocation of the task should start "interval" milliseconds after the current invocation has finished. Also, the same ast_sched facility for fixed or variable intervals exists. The task's return code in conjunction with the AST_SIP_SCHED_TASK_FIXED or AST_SIP_SCHED_TASK_VARIABLE flags controls the next invocation start time. One res_pjsip.h housekeeping change was made. The pjsip header files were added to the top. There have been a few cases lately where I've needed res_pjsip.h just for ast_sip calls and had compiles fail spectacularly because I didn't add the pjsip header files to my source even though I never referenced any pjsip calls. Finally, a few new convenience APIs were added to astobj2 to make things a little easier in the scheduler. ao2_ref_and_lock() calls ao2_ref() and ao2_lock() in one go. ao2_unlock_and_unref() does the reverse. A few macros were also copied from res_phoneprov because I got tired of having to duplicate the same hash, sort and compare functions over and over again. The AO2_STRING_FIELD_(HASH|SORT|CMP)_FN macros will insert functions suitable for aor_container_alloc into your source. This facility can be used immediately for the situations where we already have a thread that wakes up periodically or do some scheduled work. For the registration and qualify issues, additional sorcery and schema changes would need to be made so that we can easily detect changed objects on a periodic basis without having to pull the entire database back to check. I'm thinking of a last-updated timestamp on the rows but more on this later. Change-Id: I7af6ad2b2d896ea68e478aa1ae201d6dd016ba1c 2016-03-08 12:12 +0000 [7fb3724a77] Mark Michelson * res_pjsip_transport_management: Kill idle TCP connections. "Idle" here means that someone connects to us and does not send a SIP request. PJProject will not automatically time out such connections, so it's up to Asterisk to do it instead. When we receive an incoming TCP connection, we will start a timer (equivalent to transaction timer D) waiting to receive an incoming request. If we do not receive a request in that timeframe, then we will shut down the TCP connection. ASTERISK-25796 #close Reported by George Joseph AST-2016-005 Change-Id: I7b0d303e5d140d0ccaf2f7af562071e3d1130ac6 2016-03-08 10:52 +0000 [707fd4dcd0] Mark Michelson * Rename res_pjsip_keepalive res_pjsip_transport_management ASTERISK-25796 Reported by George Joseph AST-2016-005 Change-Id: Id322a05f927392293570599730050bc677d99433 2016-04-14 07:15 +0000 [0b4bb19e0b] Mark Michelson * AST-2016-004: Fix crash on REGISTER with long URI. Due to some ignored return values, Asterisk could crash if processing an incoming REGISTER whose contact URI was above a certain length. ASTERISK-25707 #close Reported by George Joseph Patches: 0001-res_pjsip-Validate-that-URIs-don-t-exceed-pjproject-.patch AST-2016-004 Change-Id: I0ed3898fe7ab10121b76c8c79046692de3a1be55 2016-04-12 13:10 +0000 [f6e080c6a4] Richard Mudgett * bridge_softmix.c: Fix crash if could not allocate the dsp. Fix off nominal crash where we could not setup the channel to process frames for the softmix bridge technology because of allocation failure. Change-Id: Ic307a8386e46bf551e48fcd1eb97276714d56372 2016-04-12 15:41 +0000 [cf15a2f2d3] gtjoseph * pjproject: Add patch for removing strip of '[]' from header params From the patch submitted to Teluu on 4/12/2016 <<<<<<<<< The wholesale stripping of '[]' from header parameters causes issues if something (like a port) occurs after the final ']'. '[2001:a::b]' will correctly parse to '2001:a::b' '[2001:a::b]:8080' will correctly parse to '2001:a::b' but the scanner is left with ':8080' and parsing stops with a syntax error. I can't even find a case where stripping the '[]' is a good thing anyway. Even if you continued to parse and resulted in a string that looks like this... '2001:a::b:8080', it's not valid. This came up in Asterisk because Kamailio sends us a Contact with an alias URI parameter that has an IPv6 address in it like this: Contact: which should be legal but causes a syntax error because of the characters after the final ']'. Even if it didn't, the '[]' should still not be stripped. I've run the Asterisk Test Suite for PJSIP (252 tests) many of which are IPv6 enabled. No issues were caused by removing the code that strips the '[]'. >>>>>>>>>>> ASTERISK-25123 #close Reported-by: Anthony Messina Change-Id: I5cb33f4ebf07ee1f2b26d07caae715e2ec65595a 2016-04-12 09:10 +0000 [daa086fae4] Joshua Colp * app_voicemail: Fix test_voicemail_notify_endl test. The test_voicemail_notify_endl test checks the end-of-line characters of an email message to confirm that they are consistent. The test wrongfully assumed that reading from the email message into a buffer will always result in more than 1 character being read. This is incorrect. If only 1 character was read the test would go outside of the buffer and access other memory causing a crash. The test now checks to ensure that 2 or more characters are read in ensuring the test stays within the buffer. ASTERISK-25874 #close Change-Id: Ic2c89cea6e90f2c0bc2d8138306ebbffd4f8b710 2016-04-07 12:02 +0000 [f896136460] Alexei Gradinari * app_voicemail/IMAP: function 'save_to_folder' creates wrong folder If try to move message to Cust1 (number 5) the function 'save_to_folder' tries to create Greeting folder instead of Cust1. This patch fixed it by setting GREETINGS_FOLDER = -1 ASTERISK-24927 #close Change-Id: I03d1a761894bcc2d130ec9b003bbcddc28e25c51 2016-04-07 16:18 +0000 [70b7673f09] Alexei Gradinari * res_pjsip: Add headers to AMI Event ContactStatusDetail * Added Useragent and RegExpire headers to AMI Event ContactStatusDetail with associated documentation. ASTERISK-25903 #close Change-Id: If3d121e943e588d016ba51d4eb9c6a421a562239 2016-04-11 16:20 +0000 [64ecd41c8f] Alexei Gradinari * Codecs: strip codec name while parsing allow/disallow options Failed registration using PJSIP/Realtime if one of the codec name in allow/disallow option is wrong or contains space. This patch strip codec name. ASTERISK-25914 Change-Id: Ifdf02de94e5ddbce305640f6f0666084a3b9283d 2016-04-11 14:26 +0000 [3f6c4667b8] Jaco Kroon * core_unreal: Fix hangupcauses not getting set on Local channels ASTERISK-25912 #close Change-Id: I8e72e6894feaf36c9450f2788d205d07baec23aa 2016-04-01 13:30 +0000 [fe7e48db03] gtjoseph * res_pjsip contact: Lock expiration/addition of contacts Contact expiration can occur in several places: res_pjsip_registrar, res_pjsip_registrar_expire, and automatically when anyone calls ast_sip_location_retrieve_aor_contact. At the same time, res_pjsip_registrar may also be attempting to renew or add a contact. Since none of this was locked it was possible for one thread to be renewing a contact and another thread to expire it immediately because it was working off of stale data. This was the casue of intermittent registration/inbound/nominal/multiple_contacts test failures. Now, the new named lock functionality is used to lock the aor during contact expire and add operations and res_pjsip_registrar_expire now checks the expiration with the lock held before deleting the contact. ASTERISK-25885 #close Reported-by: Josh Colp Change-Id: I83d413c46a47796f3ab052ca3b349f21cca47059 2016-04-10 14:16 +0000 [0c414eaf35] gtjoseph * pjproject: Add patch to fix Via IPv6 parsing There's a bug in pjproject's sip_parser where the ":" wasn't correctly interpreted. This is causing IPv6 addresses in the "received" parameter of the Via header to cause a syntax check failure. This patch was submitted to Teluu on 4/10/2016. ASTERISK-25910 #close Reported-by: Anthony Messina Change-Id: Ic7e4c4aa14ded61860401ec349f5177568c4d922 2016-03-31 20:04 +0000 [772ff3048f] gtjoseph * lock: Add named lock capability Locking some objects like sorcery objects can be tricky because the underlying ao2 object may not be the same for all callers. For instance, two threads that call ast_sorcery_retrieve_by_id on the same aor name might actually get 2 different ao2 objects if the underlying wizard had to rehydrate the aor from a database. Locking one ao2 object doesn't have any effect on the other even if those objects had locks in the first place. Named locks allow access control by keyspace and key strings. Now an "aor" named "1000" can be locked and any other thread attempting to lock "aor" "1000" will wait regardless of whether the underlying ao2 object is the same or not. Mutex and rwlocks are supported. This capability will initially be used to lock an aor when multiple threads may be attempting to prune expired contacts from it. Change-Id: If258c0b7f92b02d07243ce70e535821a1ea7fb45 2016-04-05 16:56 +0000 [fd601f26f7] Alexei Gradinari * res_pjsip_outbound_publish: Add transport for outbound PUBLISH The first available transport of the appropriate type is used now. This patch adds new config option 'transport' for outbound-publish. If transport is set then outbound PUBLISH requests will use this transport. ASTERISK-25901 #close Change-Id: Ib389130489b70e36795b0003fa5fd386e2680151 2016-04-07 16:39 +0000 [5f768d2a9c] Alexei Gradinari * res_pjsip_dialog_info: Add missing "direction" attribute in NOTIFY event BLF pickup isn't working on Cisco SPA and Snom phones if the direction="recipient" attribute is missing in 'dialog' tag. This patch adds direction="recipient" if extension state is Ringing. ASTERISK-24601 #close Change-Id: I5b2c097ca29fd59e92ba237ca5d397cb1b0bcd8c 2016-04-07 10:59 +0000 [82638fb0c7] Richard Mudgett * pbx.c: Minor code rearangements. * Pull out a loop invariant. * Convert an else-if ladder to a switch statement. Change-Id: I0a95cfa9474a4600b9865f7b444534d275b37e95 2016-04-07 11:37 +0000 [bc320df173] Alexei Gradinari * app_voicemail/IMAP: IMAP access FATAL error: Out of memory Sometimes uw-imap function 'mail_fetchbody' returns huge len which then pass to uw-imap function 'rfc822_base64'. uw-imap tries to allocate huge memory and abort() on fail. This patch check the len. If the len more than max size (128 Mbytes) log error. This patch also set variables len, newlen to avoid uninizialezed len. This patch also check pointer returned by rfc822_base64. ASTERISK-25899 #close Change-Id: I4a0e7d655f11abef6a5224e2169df6d5c1f1caca 2016-04-07 12:26 +0000 [2ef8a954b3] Richard Mudgett * pbx: Update doxygen for extension state watchers. Change-Id: Id1403b12136de62a272c01bb355aef65fd2c2d1e 2016-04-07 11:49 +0000 [d312fdeb1b] gtjoseph * alembic: Remove batch operations (and sqlite support) Because SQLite doesn't support full ALTER capabilities, alembic scripts require batch operations. However, that capability wasn't available until 0.7.0 which some distributions haven't reached yet. Therefore, the batch operations introduced in commit 86d6e44cc (review 2319) have been reverted and SQLite is unsupported again, for now anyway. Tested the full upgrade and downgrade on MySQL/Mariadb and Postgresql. ASTERISK-25890 #close Reported-by: Harley Peters Change-Id: I82eba5456736320256f6775f5b0b40133f4d1c80 2016-04-07 11:05 +0000 [901e8d78c4] Joshua Colp * res_pjsip_registrar_expire: Fix race condition at shutdown. When shutting down, the PJSIP sorcery is destroyed. The registrar expiration module queries the PJSIP sorcery to determine what to expire. As there was no synchronization between termination of the expiration thread and the unloading of the module it was possible for the thread to try to access the PJSIP sorcery after it had been destroyed. This change ensures that the thread is shut down before allowing the module to be considered unloaded. Change-Id: I69fd239edbaaf160c2d37ae00d3ac06e5596fe8b 2016-04-06 16:28 +0000 [8207372e66] Joshua Colp * res_pjsip: Fix configuration setting of "regcontext". Due to a merge problem two options were swapped causing the regcontext setting to not get set. Change-Id: Icb33edc668e7357bacbaec2861a6b5ac64edaff1 2016-04-06 08:01 +0000 [0735a4d6d7] Jacek Konieczny * frame.c: Copy the whole subclass in ast_frdup(). The problem is ast_frdup() does not copy whole frame.subclass for voice, video and image frames, only the format is copied. For video frames, the subclass structure contains the .frame_ending flag used to put the RTP marker where it needs to be. ASTERISK-25894 #close Change-Id: I812ca90e84ed5d4f473b997d0dd0d3c5a915fe33 2016-04-05 14:23 +0000 [c61dca6419] Mark Michelson * res_pjsip: Handle deferred SDP hold/unhold properly. Some SIP devices indicate hold/unhold using deferred SDP reinvites. In other words, they provide no SDP in the reinvite. A typical transaction that starts hold might look something like this: * Device sends reinvite with no SDP * Asterisk sends 200 OK with SDP indicating sendrecv on streams. * Device sends ACK with SDP indicating sendonly on streams. At this point, PJMedia's SDP negotiator saves Asterisk's local state as being recvonly. Now, when the device attempts to unhold, it again uses a deferred SDP reinvite, so we end up doing the following: * Device sends reinvite with no SDP * Asterisk sends 200 OK with SDP indicating recvonly on streams * Device sends ACK with SDP indicating sendonly on streams The problem here is that Asterisk offered recvonly, and by RFC 3264's rules, if an offer is recvonly, the answer has to be sendonly. The result is that the device is not taken off hold. What is supposed to happen is that Asterisk should indicate sendrecv in the 200 OK that it sends. This way, the device has the freedom to indicate sendrecv if it wants the stream taken off hold, or it can continue to respond with sendonly if the purpose of the reinvite was something else (like a session timer refresher). The fix here is to alter the SDP negotiator's state when we receive a reinvite with no SDP. If the negotiator's state is currently in the recvonly or inactive state, then we alter our local state to be sendrecv. This way, we allow the device to indicate the stream state as desired. ASTERISK-25854 #close Reported by Robert McGilvray Change-Id: I7615737276165eef3a593038413d936247dcc6ed 2016-03-27 23:33 +0000 [50b0922a22] gtjoseph * config: Allow filters when appending to a category In sorcery based config files where there are multiple categories with the same name, you can't use the (+) operator to reliably append to a category because config.c stops looking when it finds the first one with the same name. Example: [1000] type = endpoint [1000] type = aor [1000](+) authenticate_qualify = yes This config will fail because config.c appends authenticate_qualify to the first category it finds, the endpoint, and that's not valid for endpoint. Solution: The capability to find a category that contains a certain variable already exists so the only real change was to parse anything after the '+' that's not a comma, as a filter string. [1000] type = endpoint [1000] type = aor [1000](+type=aor) authenticate_qualify = yes This now works as expected. Although the following example doesn't make any sense for pjsip, you can even specify multiple filters: [1000](+type=aor&qualify_frequency=10) ASTERISK-25868 #close Reported-by: Nick Repin Change-Id: I10773da4c79db36fbf1993961992af63d3441580 2016-04-05 10:21 +0000 [cb56ef8069] Joshua Colp * res_http_websocket: Make core supported. Websockets are a core part of ARI support and as such this module should also be core supported. Change-Id: I8f9283c6a167152761b92984779bb39e3db51a9c 2016-03-25 23:22 +0000 [f6f4cf459f] gtjoseph * stringfields: Refactor to allow fields to be added to the end of structures String fields are great, except that you can't add new ones without breaking ABI compatibility because it shifts down everything else in the structure. The only alternative is to add your own char * field to the end of the structure and manage the memory yourself which isn't ideal, especially since you then can't use the OPT_STRINGFIELD_T type. Background: The reason string fields had to be declared inside the AST_DECLARE_STRING_FIELDS block was to facilitate iteration over all declared fields for initialization, compare and copy. Since AST_DECLARE_STRING_FIELDS declared the pool, then the fields, then the manager, you could use the offsets of the pool and manager and iterate over the sequential addresses in between to access the fields. The actual pool, field allocation and field set operations don't actually care where the field is. It's just iteration over the fields that was the problem. Solution: Extended String Fields An extended string field is one that is declared outside the AST_DECLARE_STRING_FIELDS block but still (anywhere) inside the parent structure. Other than using AST_STRING_FIELD_EXTENDED instead of AST_STRING_FIELD, it looks the same as other string fields. It's storage comes from the pool and it participates in string field compare and copy operations peformed on the parent structure. It's also a valid target for the OPT_STRINGFIELD_T aco option type. Implementation: To keep track of the extended fields and make sure that ABI isn't broken, the existing embedded_pool pointer in the manager structure was repurposed to be a pointer to a separate header structure that contains the embedded_pool pointer plus a vector of fields. The length of the manager structure didn't change and the embedded_pool pointer isn't used in the macros, only the stringfields C code. A side benefit of this is that changing the header structure in the future won't break ABI. ast_string_fields_init initializes the normal string fields and appends them to the vector, and subsequent calls to ast_string_field_init_extended initialize and append the extended fields. Cleanup, ast_string_fields_cmp, and ast_string_fields_copy can now work on the vector instead of sequentially traversing the addresses between the pool and manager. The total size of a structure using string fields didn't change, whether using extended fields or not, nor have the offsets of any structure members, either inside the original block or outside. Adding an extended field to the end of a structure is the same as adding a char *. Details: The stringfield C code was pulled out from utils.c and into stringfields.c. It just made sense. Additional work was done in ast_string_field_init and ast_calloc_with_stringfields to handle the allocation of the new header structure and the vector, and the associated cleanup. In the process some additional NULL pointer checking was added. A lot of work was done in stringfields.h since the logic for compare and copy is there. Documentation was added as well as somne additional NULL checking. The ability to call ast_calloc_with_stringfields with a number of structures greater than 1 never really worked. Well, the calloc worked but there was no way to access the additional structures or clean them up. It was agreed that there was no use case for requesting more than 1 structure so an ast_assert was added to prevent it and the iteration code removed. Testing: The stringfield unit tests were updated to test both normal and extended fields. Tests for ast_string_field_ptr_set_by_fields and ast_calloc_with_stringfields were also added. As an ABI test, 13 was compiled from git and the res_pjsip_* modules, except res_pjsip itself, saved off. The patch was then added and a full compile and install was performed. Then the older res_pjsip_* moduled were copied over the installed versions so res_pjsip was new and the rest were old. No issues. contact->aor, which is a char * at the end of contact, was then changed to an extended string field and a recompile and reinstall was performed, again leaving stock versions of the the res_pjsip_* modules. Again, no issues with the res_pjsip_* modules using the old stringfield implementation and with contact->aor as a char *, and res_pjsip itself using the new stringfield implementation and contact->aor being an extended string field. Finally, several existing string fields were converted to extended string fields to test OPT_STRINGFIELD_T. Again, no issues. Change-Id: I235db338c5b178f5a13b7946afbaa5d4a0f91d61 2016-04-04 18:02 +0000 [fe448ac8a7] gtjoseph * res_pjsip_mwi: Fix segv caused by 16c7d8e74a9af13f98c3c22aa9c43ce39965f6b7 I forgot the new voicemail_extension wasn't a stringfield and didn't check for NULL where I should have. Change-Id: I029482d5c2ab72474838750461bd46b0809c90fb 2016-04-03 11:47 +0000 [9d4318f798] gtjoseph * install_prereq: Fix check_installed_debs remove subversion check_installed_debs wasn't handling virtual packages like libsrtp-dev and libresample-dev and on multiarch systems it was accidentally filtering out all packages if any :i386 packages were found instead of just filtering out the :i386 packages themselves. Change-Id: Ifd68da0d1ee30cc84df14de3f9b9079d7c3cecda 2016-04-01 13:09 +0000 [566601837e] gtjoseph * utils.c: Fix typo in handle_show_locks ast_cli_allow_on_shutdown(e) should have been ast_cli_allow_at_shutdown(e). Change-Id: I4f092495c0b2bfd85c2651e0b5877bf4d05d9faf 2016-03-30 18:34 +0000 [964f54bd5d] gtjoseph * pjproject_bundled: Fix use of LDCONFIG for shared library link creation LDCONFIG apparently isn't set to something sane on all systems so the creation of the shared library links fails. Instead of just testing for non-blank, main/Makefile now checks that LDCONFIG is actually executable and reverts to LN if it isn't. This applies to both libasteriskpj and libasteriskssl. Thanks to 'abelbeck' for pointing out that the issue was LDCONFIG. ASTERISK-25873 #close Reported-by: Hans van Eijsden Change-Id: I25b76379bc637726ec044b2c0e709b56b3701729 2016-03-30 13:31 +0000 [5f73c2ef0a] Richard Mudgett * res_stasis.c: Protect channel datastore list from stasis end. Change-Id: Ifadc469590bd4d5368e19d3763db3bd1f80fdb95 2016-03-29 18:06 +0000 [74d63f56ee] Richard Mudgett * res_ari: Cannot get control also means channel is unavailable. The only caller of ari_bridges_play_found() has this note: If ari_bridges_play_found fails because the channel is unavailable for playback, The channel will be removed from the playback list soon. We can keep trying to get channels from the list until we either get one that will work or else there isn't a channel for this bridge anymore, in which case we'll revert to ari_bridges_play_new. Change-Id: Ib068141b367ccaa17be0dab4181c98e26c5127d6 2016-03-29 14:29 +0000 [cf49b44090] Richard Mudgett * res_stasis_recording.c: Cleanup stasis_app_recording_find_by_name(). Change-Id: Ic7d93c402c498677a122505558859c853d4e5ac7 2016-03-28 14:23 +0000 [7f53f1d89e] Richard Mudgett * core_unreal.c: Add clarification comment about channel ref. Change-Id: I0be0627260cd8d6b6c3cc345949dcfdf32eff1f3 2016-03-29 13:47 +0000 [ecf4102d02] Richard Mudgett * res_stasis: Add control ref to playback and recording structs. The stasis_app_playback and stasis_app_recording structs need to have a struct stasis_app_control ref. Other threads can get a reference to the playback and recording structs from their respective global container. These other threads can then use the control pointer they contain after the control struct has gone. * Add control ref to stasis_app_playback and stasis_app_recording structs. With the refs added, the control command queue can now have a circular control reference which will cause the control struct to never get released if the control's command queue is not flushed when the channel leaves the Stasis application. Also the command queue needs better protection from adding commands if the control->is_done flag is set. * Flush the control command queue on exit. ASTERISK-25882 #close Change-Id: I3cf1fb59cbe6f50f20d9e35a2c07ac07d7f4320d 2016-03-28 18:10 +0000 [a179aba65e] Richard Mudgett * res_stasis: Fix crash on a hanging up channel. * Give the struct stasis_app_control ao2 object a ref to the channel held in the object. Now the channel will still be around if a thread needs to post a stasis message instead of crash because the topic was destroyed. * Moved stopping any lingering silence generator out of the struct stasis_app_control destructor and made it a part of exiting the Stasis application. Who knows which thread the destructor will be called under so it cannot affect the channel's silence generator. Not only was the channel unprotected when the silence generator was stopped, stasis may no longer even control the channel. ASTERISK-25882 Change-Id: I21728161b5fe638cef7976fa36a605043a7497e4 2016-03-30 12:38 +0000 [16c7d8e74a] gtjoseph * res_pjsip_mwi: Allow subscribe to vm access extension as an alias Background: If your extension is 1000 and the voicemail access extension is 1571 and you dial 1571, usually a dialplan rule calls voicemailmain with your extension and you are placed directly in your mailbox. Therefore most admins program the voicemail (or other speed dial) button on their phones to the access extension. Some phones (Snom at least) use whatever is programmed there to also subscribe for MWI and so can't dial one number and subscribe to another. This works fine in chan_sip because chan_sip completely ignores the user portion of the SUBSCRIBE message request URI. If it can match the peer, is subscribes to the peer's mailbox. The user could be set to anything or nothing and you'd still get subscribed to your mailbox. Issue: chan_pjsip actually uses the user portion of the URI to find an aor and its mailboxes. Therefore a subscribe to 1571 results in a 404. Sure, you can create an aor for 1571 but you certainly can't add your entire voicemail system's mailboxes to it and everyone would get notified of every MWI. Solution: When an MWI subscribe comes in and an aor can't be found that matches the resource directly, check the resource against the endpoint's aors. If an aor is found that has a voicemail_extension that matches the resource, use it. ASTERISK-25865 Reported-by: Ross Beer Change-Id: I770ea185f751f1ada888fafb4b452115f1c06e9e 2016-03-24 22:55 +0000 [d8f0bc3572] gtjoseph * res_pjsip_mwi: Add voicemail extension and mwi_subscribe_replaces_unsolicited res_pjsip_mwi was missing the chan_sip "vmexten" functionality which adds the Message-Account header to the MWI NOTIFY. Also, specifying mailboxes on endpoints for unsolicited mwi and on aors for subscriptions required that the admin know in advance which the client wanted. If you specified mailboxes on the endpoint, subscriptions were rejected even if you also specified mailboxes on the aor. Voicemail extension: * Added a global default_voicemail_extension which defaults to "". * Added voicemail_extension to both endpoint and aor. * Added ast_sip_subscription_get_dialog for support. * Added ast_sip_subscription_get_sip_uri for support. When an unsolicited NOTIFY is constructed, the From header is parsed, the voicemail extension from the endpoint is substituted for the user, and the result placed in the Message-Account field in the body. When a subscribed NOTIFY is constructed, the subscription dialog local uri is parsed, the voicemail_extension from the aor (looked up from the subscription resource name) is substituted for the user, and the result placed in the Message-Account field in the body. If no voicemail extension was defined, the Message-Account field is not added to the NOTIFY body. mwi_subscribe_replaces_unsolicited: * Added mwi_subscribe_replaces_unsolicited to endpoint. The previous behavior was to reject a subscribe if a previous internal subscription for unsolicited MWI was found for the mailbox. That remains the default. However, if there are mailboxes also set on the aor and the client subscribes and mwi_subscribe_replaces_unsolicited is set, the existing internal subscription is removed and replaced with the external subscription. This allows an admin to configure mailboxes on both the endpoint and aor and allows the client to select which to use. ASTERISK-25865 #close Reported-by: Ross Beer Change-Id: Ic15a9415091760539c7134a5ba3dc4a6a1217cea 2016-03-30 09:46 +0000 [8dc8d6ceb8] gtjoseph * res_rtp_asterisk: Fix placement of txcount increment Commit 1bce690ccb36a4744a327c07af23a9a3a0fa20cd was incrementing txcount for rtcp packets as well as rtp packets and that was causing sender reports to be generated instead of receiver reports in cases where no rtp was actually being sent. Moved the txcount increment from __rtp_sento, which handles both rtp and rtcp, to rtp_sento which only handles rtp packets. Discovered by the hep/rtcp-receiver test. Change-Id: Ie442e4bb947a68847a676497021ba10ffaf376d5 2016-03-26 22:33 +0000 [c7eb18d865] gtjoseph * chan_pjsip: Add 'pjsip show channelstats' Added the ability to show channel statistics to chan_pjsip (cli_functions.c) Moved the existing 'pjsip show channel(s)' functionality from pjsip_configuration to cli_functions.c. The stats needed chan_pjsip's private header so it made sense to move the existing channel commands as well. Now using stasis_cache_dump to get the channel snapshots rather than retrieving all endpoints, then getting each one's channel snapshots. Much more efficient. Change-Id: I03b114522126d27434030b285bf6d531ddd79869 2016-03-10 19:52 +0000 [1583559a06] gtjoseph * res_pjsip/pjsip_options: Fix From generation on outgoing OPTIONS No one seemed to notice but every time an OPTIONS goes out, it goes out with a From of "asterisk" (or whatever the default from_user is set to), even if you specify an endpoint. The issue had several causes... qualify_contact is only called with an endpoint if called from the CLI. If the endpoint is NULL, qualify_contact only looks up the endpoint if authenticate_qualify=yes. Even then, it never passes it on to ast_sip_create_request where the From header is set. Therefore From is always "asterisk" (or whatever the default from_user is set to). Even if ast_sip_create_request were to get an endpoint, it only sets the From if endpoint->from_user is set. The fix is 4 parts... First, create_out_of_dialog_request was modified to use the endpoint id if endpoint was specified and from_user is not set. Second, qualify_contact was modified to always look up an endpoint if one wasn't specified regardless of authenticate_qualify. It then passes the endpoint on to create_out_of_dialog_request. Third (and most importantly), find_an_endpoint was modified to find an endpoint by using an "aors LIKE %contact->aor%" predicate with ast_sorcery_retrieve_by_fields. As such, this patch will only work if the sorcery realtime optimizations patch goes in. Otherwise we'd be pulling the entire endpoints database every time we send an OPTIONS. Since we already know the contact's aor, the on_endpoint callback was also modified to just check if the contact->aor is an exact match to one of the endpoint's. Finally, since we now have an endpoint for every OPTIONS request, res_pjsip/endpt_send_request (which handles out-of-dialog reqests) was updated to get the transport from the endpoint and set it on tdata. Now the correct transport is used. Change-Id: I2207e12bb435e373bd1e03ad091d82e5aba011af 2016-03-25 10:59 +0000 [0cfab30b28] Jacek Konieczny * res_rtp_asterisk: Use separate SRTP session for RTCP with DTLS Asterisk uses separate UDP ports for RTP and RTCP traffic and RFC 5764 explicitly states: There MUST be a separate DTLS-SRTP session for each distinct pair of source and destination ports used by a media session This means RTP keying material cannot be used for DTLS RTCP, which was the reason why RTCP encryption would fail. ASTERISK-25642 Change-Id: I7e8779d8b63e371088081bb113131361b2847e3a 2016-03-25 10:42 +0000 [6a9c18fb59] Jacek Konieczny * app_echo: forward and generate VIDUPDATE frames When using app_echo via WebRTC with VP8 video the video would appear only after a few minutes, because there would be nothing to request a full reference frame. This fixes the problem in both ways: - echos any VIDUPDATE frames received on the channel - sends one such frame when first video frame is to be forwarded This makes the echo work with Firefox and Chrome WebRTC implementation. ASTERISK-25867 #close Change-Id: I73bda87bf7532ee8bfb28d917045a21034908c1e 2016-03-27 12:53 +0000 [1bce690ccb] gtjoseph * res_rtp_asterisk: Fix packet stats on bridged connection rxcount, txcount, rxoctetcount and txoctetcount weren't being calculated for bridged streams because the calulations were being done after the bridged short-circuit. Actually, rxoctetcount wasn't ever being calculated. Moved the calculations so they occur for all valid received packets and all transmitted packets. Also added rxoctetcount and txoctetcount to ast_rtp_instance_stat. Change-Id: I08fb06011a82d38c3b4068867a615068fbe59cbb 2016-03-25 23:19 +0000 [50f90d4099] Philip Correia * res_parking: Fix blind transfer dynamic lots creation. Blind transfers to a recognized parking extension need to use the parker's channel variable values to create the dynamic parking lot. This is because there is always only one parker while the parkee may actually be a multi-party bridge. A multi-party bridge can never supply the needed channel variables to create the dynamic parking lot. In the multi-party bridge blind transfer scenario, the parker's CHANNEL(parkinglot) value and channel variables are inherited by the local channel used to park the bridge. * In park_common_setup(), make use the parker instead of the parkee to supply the dynamic parking lot channel variable values. In all but one case, the parkee is the same as the parker. However, in the recognized parking extension blind transfer scenario for a two party bridge they are different channels. For consistency, we need to use the parker channel. * In park_local_transfer(), pass the CHANNEL(parkinglot) value to the local channel when blind transferring a multi-party bridge to a recognized parking extension. * When a local channel starts a call, the Local;2 side needs to inherit the CHANNEL(parkinglot) value from Local;1. The DTMF one-touch parking case wasn't even trying to create dynamic parking lots before it aborted the attempt. * In parking_park_call(), add missing code to create a dynamic parking lot. A DTMF bridge hook is documented as returning -1 to remove the hook. Though the hook caller is really coded to accept non-zero. See the ast_bridge_hook_callback typedef. * In feature_park_call(), don't remove the DTMF one-touch parking hook because of an error. ASTERISK-24605 #close Reported by: Philip Correia Patches: call_park.patch (license #6672) patch uploaded by Philip Correia Change-Id: I221d3a8fcc181877a1158d17004474d35d8016c9 2016-03-08 15:55 +0000 [5aa5c49413] gtjoseph * sorcery/res_pjsip: Refactor for realtime performance There were a number of places in the res_pjsip stack that were getting all endpoints or all aors, and then filtering them locally. A good example is pjsip_options which, on startup, retrieves all endpoints, then the aors for those endpoints, then tests the aors to see if the qualify_frequency is > 0. One issue was that it never did anything with the endpoints other than retrieve the aors so we probably could have skipped a step and just retrieved all aors. But nevermind. This worked reasonably well with local config files but with a realtime backend and thousands of objects, this was a nightmare. The issue really boiled down to the fact that while realtime supports predicates that are passed to the database engine, the non-realtime sorcery backends didn't. They do now. The realtime engines have a scheme for doing simple comparisons. They take in an ast_variable (or list) for matching, and the name of each variable can contain an operator. For instance, a name of "qualify_frequency >" and a value of "0" would create a SQL predicate that looks like "where qualify_frequency > '0'". If there's no operator after the name, the engines add an '=' so a simple name of "qualify_frequency" and a value of "10" would return exact matches. The non-realtime backends decide whether to include an object in a result set by calling ast_sorcery_changeset_create on every object in the internal container. However, ast_sorcery_changeset_create only does exact string matches though so a name of "qualify_frequency >" and a value of "0" returns nothing because the literal "qualify_frequency >" doesn't match any name in the objset set. So, the real task was to create a generic string matcher that can take a left value, operator and a right value and perform the match. To that end, strings.c has a new ast_strings_match(left, operator, right) function. Left and right are the strings to operate on and the operator can be a string containing any of the following: = (or NULL or ""), !=, >, >=, <, <=, like or regex. If the operator is like or regex, the right string should be a %-pattern or a regex expression. If both left and right can be converted to float, then a numeric comparison is performed, otherwise a string comparison is performed. To use this new function on ast_variables, 2 new functions were added to config.c. One that compares 2 ast_variables, and one that compares 2 ast_variable lists. The former is useful when you want to compare 2 ast_variables that happen to be in a list but don't want to traverse the list. The latter will traverse the right list and return true if all the variables in it match the left list. Now, the backends' fields_cmp functions call ast_variable_lists_match instead of ast_sorcery_changeset_create and they can now process the same syntax as the realtime engines. The realtime backend just passes the variable list unaltered to the engine. The only gotcha is that there's no common realtime engine support for regex so that's been noted in the api docs for ast_sorcery_retrieve_by_fields. Only one more change to sorcery was done... A new config flag "allow_unqualified_fetch" was added to reg_sorcery_realtime. "no": ignore fetches if no predicate fields were supplied. "error": same as no but emit an error. (good for testing) "yes": allow (the default); "warn": allow but emit a warning. (good for testing) Now on to res_pjsip... pjsip_options was modified to retrieve aors with qualify_frequency > 0 rather than all endpoints then all aors. Not only was this a big improvement in realtime retrieval but even for config files there's an improvement because we're not going through endpoints anymore. res_pjsip_mwi was modified to retieve only endpoints with something in the mailboxes field instead of all endpoints then testing mailboxes. res_pjsip_registrar_expire was completely refactored. It was retrieving all contacts then setting up scheduler entries to check for expiration. Now, it's a single thread (like keepalive) that periodically retrieves only contacts whose expiration time is < now and deletes them. A new contact_expiration_check_interval was added to global with a default of 30 seconds. Ross Beer reports that with this patch, his Asterisk startup time dropped from around an hour to under 30 seconds. There are still objects that can't be filtered at the database like identifies, transports, and registrations. These are not going to be anywhere near as numerous as endpoints, aors, auths, contacts however. Back to allow_unqualified_fetch. If this is set to yes and you have a very large number of objects in the database, the pjsip CLI commands will attempt to retrive ALL of them if not qualified with a LIKE. Worse, if you type "pjsip show endpoint " guess what's going to happen? :) Having a cache helps but all the objects will have to be retrieved at least once to fill the cache. Setting allow_unqualified_fetch=no prevents the mass retrieve and should be used on endpoints, auths, aors, and contacts. It should NOT be used for identifies, registrations and transports since these MUST be retrieved in bulk. Example sorcery.conf: [res_pjsip] endpoint=config,pjsip.conf,criteria=type=endpoint endpoint=realtime,ps_endpoints,allow_unqualified_fetch=error ASTERISK-25826 #close Reported-by: Ross Beer Tested-by: Ross Beer Change-Id: Id2691e447db90892890036e663aaf907b2dc1c67 2016-03-23 14:24 +0000 [05fc3a96d1] Richard Mudgett * res_parking: Cleanup find_channel_parking_lot_name() usage. Change-Id: I8f7a8890aef27824301c642d4d15407ac83e6f02 2016-03-18 14:01 +0000 [a4189763ab] Richard Mudgett * res_parking: Misc fixes. res/parking/parking_applications.c: * Add malloc fail checks in setup_park_common_datastore(). * Fix playing parking failed announcement to only happen on non-blind transfers in park_app_exec(). It could never go out before because a test was provedly always false. res/parking/parking_bridge.c: * Fix NULL tolerance in generate_parked_user() because bridge_parking_push() can theoretically pass a NULL parker channel if the parker channel went away for some reason. * Clarify some weird code dealing with blind_transfer in bridge_parking_push(). res/parking/parking_bridge_features.c: * Made park_local_transfer() set BLINDTRANSFER on the Local;1 channel which will be bulk copied to the Local;2 channel on the subsequent ast_call(). The additional advantage is if the parker channel has the BLINDTRANSFER and ATTENDEDTRANSFER variables set they are now guaranteed to be overridden. res/parking/parking_manager.c: * Fix AMI Park action input range checking of the Timeout header in manager_park(). * Reduced locking scope to where needed in manager_park(). res/res_parking.c: * Fix some off nominal missing unlocks by eliminating the returns. Change-Id: Ib64945bc285acb05a306dc12e6f16854898915ca 2014-12-15 05:23 +0000 [6f95b5eda1] Philip Correia * res_parking: Update parking documentation for dynamic parking lots. * Remove duplicate res_parking.conf courtesytone config option documentation. ASTERISK-24596 #close Reported by: Philip Correia ASTERISK-24605 Reported by: Philip Correia Patches: call_park_app_doc.patch (license #6672) patch uploaded by Philip Correia Change-Id: I90a92a891c6494dc08173e675856afcc4764c5b5 2016-03-24 14:08 +0000 [81ce60f6d4] Alexander Traud * chan_sip: Do not send all codecs on INVITE. Do not break on Session-Timers. Asterisk 13.7.0 included a fix for ASTERISK-24543, not to send all those codecs, which the caller did not request/support. That fix was not complete because on the second Session Timer all codecs were sent again. Some VoIP/SIP clients interpreted that complete codec-list as a change in the SIP session. Because of that, Asterisk did not send the RTP audio via NAT anymore which created a non-audio scenario after the second Session Timer fired. ASTERISK-24543 #close Change-Id: I1881827816ab7fd47eb4287a95961179b34a0b66 2016-03-19 07:34 +0000 [c6e4c48e67] Gianluca Merlo * config: fix flags in uint option handler The configuration unsigned integer option handler sets flags for the parser as if the option should be a signed integer (PARSE_INT32), leading to errors on "out of range" values. Fix flags (PARSE_UINT32). A fix to res_pjsip is also present which stops invalid flags from being passed when registering sorcery object fields for qualify status. ASTERISK-25612 #close Change-Id: I96b539336275e0e72a8e8033487d2c3344debd3e 2016-03-10 16:58 +0000 [59c8e189fd] Mark Michelson * Restrict CLI/AMI commands on shutdown. During stress testing, we have frequently seen crashes occur because a CLI or AMI command attempts to access information that is in the process of being destroyed. When addressing how to fix this issue, we initially considered fixing individual crashes we observed. However, the changes required to fix those problems would introduce considerable overhead to the nominal case. This is not reasonable in order to prevent a crash from occurring while Asterisk is already shutting down. Instead, this change makes it so AMI and CLI commands cannot be executed if Asterisk is being shut down. For AMI, this is absolute. For CLI, though, certain commands can be registered so that they may be run during Asterisk shutdown. ASTERISK-25825 #close Change-Id: I8887e215ac352fadf7f4c1e082da9089b1421990 2016-03-24 07:45 +0000 [ff3eebf454] Walter Doekes * musiconhold: Only warn if music class is not found in memory and database. The log message when a MusicOnHold music class was not found was changed from debug level to WARNING level in Asterisk 11.19 and 13.5. For those using realtime musiconhold, this message is wrong because it warns before checking the database. This changeset delays the warning until after the database has been checked. Reported-by: Conrad de Wet ASTERISK-25444 #close Change-Id: I6cfb2db2f9cfbd2bb3d30566ecae361c4abf6dbf 2016-03-24 05:38 +0000 [82e55e4883] Walter Doekes * core/logging: Fix broken syslog levels on older glibc. The fix to ASTERISK-25407 introduced the usage of LOG_MAKEPRI. However this macro is broken in older glibc (< 2.17); it would left-shift the facility a second time, causing the resultant priority to become invalid. The syslog manpage mentions nothing about LOG_MAKEPRI and suggests this: The priority argument is formed by ORing the facility and the level values [...]. ASTERISK-25510 #close Reported by: Michael Newton Change-Id: Ia89debe7fac5ad090c7ef595c0707f31bb1e3d03 2016-03-23 08:59 +0000 [d963a33749] gtjoseph * pjproject-bundled: Cleanups for reported issues PortAudio should no longer be required PJSIP_MAX_PKT_LEN is now 6000 Older autoconf issue fixed. (CentOS 6) Change-Id: I463fa9586cbe7c6b3b603289f535bd8e361611dd 2015-11-20 08:02 +0000 [c5170677e7] Francesco Castellano * chan_sip.c: Space after port causes unnecessary resolution attempt check_via() already skips leading blanks where the sent-by address (with the optional port) should be placed. Since RFC 3261 allows for blanks between the port ant the Via parameters: > https://tools.ietf.org/html/rfc3261#section-20.42 (actually it allows a lot of blanks more ;-)). I just switched from ast_skip_blanks() to ast_strip() on the local copy of the string. ASTERISK-21301 #close Change-Id: Ie5b8fe5a07067b7c0dc9bcdd1707e99b23b02b06 2016-03-19 17:49 +0000 [51deadee38] gtjoseph * progdocs: Exclude ./third-party from documentation generation We don't need pjproject's documentation embedded in Asterisk's. Change-Id: Iea6f5a621c0f4e3168dda3321eaab258d9f24a17 2016-03-18 20:32 +0000 [aa2fcd244e] Gianluca Merlo * func_aes: fix misuse of strlen on binary data The encryption code for AES_ENCRYPT evaluates the length of the data to be encoded in base64 using strlen. The data is binary, thus the length of it can be underestimated at the first NULL character. Reuse the write pointer offset to evaluate it, instead. ASTERISK-25857 #close Change-Id: If686b5d570473eb926693c73461177b35b13b186 2016-12-08 17:42 +0000 Asterisk Development Team * asterisk certified/13.8-cert4 Released. 2016-12-08 11:40 +0000 [2e0239c28c] Kevin Harwell * Update for certified/13.8-cert4 2016-11-30 09:31 +0000 [4fece22836] Walter Doekes * chan_sip: Do not allow non-SP/HTAB between header key and colon. RFC says SIP headers look like: HCOLON = *( SP / HTAB ) ":" SWS SWS = [LWS] ; sep whitespace LWS = [*WSP CRLF] 1*WSP ; linear whitespace WSP = SP / HTAB ; from rfc2234 chan_sip implemented this: HCOLON = *( LOWCTL / SP ) ":" SWS LOWCTL = %x00-1F ; CTL without DEL This discrepancy meant that SIP proxies in front of Asterisk with chan_sip could pass on unknown headers with \x00-\x1F in them, which would be treated by Asterisk as a different (known) header. For example, the "To\x01:" header would gladly be forwarded by some proxies as irrelevant, but chan_sip would treat it as the relevant "To:" header. Those relying on a SIP proxy to scrub certain headers could mistakenly get unexpected and unvalidated data fed to Asterisk. This change fixes so chan_sip only considers SP/HTAB as valid tokens before the colon, making it agree on the headers with other speakers of SIP. ASTERISK-26433 #close AST-2016-009 Change-Id: I78086fbc524ac733b8f7f78cb423c91075fd489b 2016-08-06 10:57 +0000 [016d20ce12] Alexei Gradinari * pjsip: Fix deadlock with suspend taskprocessor on masquerade If both channels which should be masqueraded are in the same serializer: 1st channel will be locked waiting condition 'complete' 2nd channel will be locked waiting condition 'suspended' On heavy load system a chance that both channels will be in the same serializer 'pjsip/distibutor' is very high. To reproduce compile res_pjsip/pjsip_distributor.c with DISTRIBUTOR_POOL_SIZE=1 Steps to reproduce: 1. Party A calls Party B (bridged call 'AB') 2. Party B places Party A on hold 3. Party B calls Voicemail app (non-bridged call 'BV') 4. Party B attended transfers Party A to voicemail using REFER. 5. When asterisk masquerades calls 'AB' and 'BV', a deadlock is happened. This patch adds a suspension indicator to the taskprocessor. When a session suspends/unsuspends the serializer it sets the indicator to the appropriate state. The session checks the suspension indicator before suspend the serializer. ASTERISK-26145 #close Change-Id: Iaaebee60013a58c942ba47b1b4930a63e686663b 2016-11-08 10:48 +0000 [87e1ebc91a] Mark Michelson * res_pjsip_session: Do not call session supplements when it's too late. res_pjsip_sesssion was hooking into transaction and invite state changes. One of the reasons for doing so was due to the PJSIP_EVENT_TX_MSG event. The idea was that we were hooking into the message sending process, and so we should call session supplements to alter the outgoing message. In reality, this event was meant to indicate that the message either a) had already been sent, or b) required a DNS lookup and would be sent when the DNS query completed. In case (a), this meant we were altering an already-sent request/response for no reason. In case (b), this potentially meant we could be trying to alter a request/response at the same time that the DNS resolution completed. In this case, it meant we might be stomping on memory being used by the thread actually sending the message. This caused potential crashes and memory corruption. This patch removes the calls to session supplements from the case where the PJSIP_EVENT_TX_MSG event occurs. In all of these cases, trying to alter the message at this point is too late, and it can cause nothing but harm to try to do it. Because there were no longer any calls to the handle_outgoing() function, it has been removed. Change-Id: Ibcc223fb1c3a237927f38754e0429e80ee301e92 (cherry picked from commit e043d1a55cf356066b3b39ebac8b4bbb612ce807) 2016-11-02 09:15 +0000 [c8df727502] Joshua Colp * app_dial: Fix incorrect device state when channel is picked up. Given the scenario where multiple channels are dialed using Dial() but the caller is picked up using PickupChan() all outgoing channels except the channel specified to PickupChan() would be marked as ringing until the call had been hung up. When using the PickupChan application the channel executing the application is swapped into place of another channel. As part of this process the channel is answered. The Dial application has explicit logic which checks if the channel is answered, cancels all other outgoing channels, and bridges. This logic is different than the normal logic that is executed when an outgoing channel is answered. This different logic failed to publish dial events stating that the other outgoing channels had been canceled. As a result references to the outgoing channels were held onto by the dial masquerade process until the call had been ended and the channels had gone away. This would result in the channels appearing in the "core show channels" list despite not being present anymore and would also result in incorrect device state. This change makes it so that this logic also publishes dial events stating that the other outgoing channels have been canceled. ASTERISK-26549 Change-Id: Iea7168e6e82f7d4609ec0366153804e4f55ea64f 2016-10-18 16:50 +0000 [4c50689d09] Joshua Colp * Revert "pjproject_bundled: Add patch to address SSL crash" This reverts commit 28cc8a9dff2fb9210726cfa6274ae683fbfa4a01. Change-Id: I777cf8173f7a88273090bed72bfe57fb0e72b84f 2016-10-17 11:39 +0000 [28cc8a9dff] gtjoseph * pjproject_bundled: Add patch to address SSL crash Addresses crashes when an attempt is made to operate on an SSL socket after the socket has been closed. ASTERISK-26477 #close Change-Id: I421305b357558b4f9e690210dc0f4831ef4b3002 (cherry picked from commit 546ec4b038ac3d750c5138d7fbb8e3ce93f482df) 2016-10-12 16:24 +0000 [7c2bd702fd] Richard Mudgett * Audit ast_json_pack() calls for needed UTF-8 checks. Added needed UTF-8 checks before constructing json objects in various files for strings obtained outside the system. In this case string values from a channel driver's peer and not from the user setting channel variables. * aoc.c: Fixed type mismatch in s_to_json() for time and granularity json object construction. ASTERISK-26466 Reported by: Richard Mudgett Change-Id: Iac2d867fa598daba5c5dbc619b5464625a7f2096 2016-10-12 16:20 +0000 [3b1b2fc1d5] Richard Mudgett * json: Check party id name, number, subaddresses for UTF-8. * Updated unit test as ast_json_name_number() is now NULL tolerant. ASTERISK-26466 #close Reported by: Richard Mudgett Change-Id: I7d4e14194f8f81f24a1dc34d1b8602c0950265a6 2016-10-11 18:14 +0000 [a835adfa92] Richard Mudgett * json: Add UTF-8 check call. Since the json library does not make the check function public we recreate/copy the function in our interface module. ASTERISK-26466 Reported by: Richard Mudgett Change-Id: I36d3d750b6f5f1a110bc69ea92b435ecdeeb2a99 2016-07-19 15:22 +0000 [7baedd9ecd] Alexei Gradinari * res_pjsip_pubsub: fixed a bug when pjsip_tx_data_dec_ref is called twice. This patch removed call of pjsip_tx_data_dec_ref in send_notify if send_request failed. The pjsip_dlg_send_request deletes the message on error by itself. It seems this patch fixes next issues: ASTERISK-26199 ASTERISK-26166 ASTERISK-26174 Change-Id: I8b05917c93d993f95d604c042ace5f1a5500f59a 2016-10-05 14:53 +0000 [a8e37c3d06] gtjoseph * pjproject_bundled: Add MALLOC_DEBUG capability pjproject_bundled will now use the asterisk memory debugging APIs if MALLOC_DEBUG is turned on in menuselect. Because this required stubs for the executable programs and the python bindings, some Makefile reorganization was needed to properly handle the dependencies. As a result, the makefile now individually makes each of the pjproject libraries separately instead of making them all in 1 shot. The only visible change is that there are separate status lines printed for each library instead oif 1 for all libs. Also, the making of the pjproject dependency files was eliminated. They're not needed for building unless you're actively modifying pjproject source files and it makes the build process faster. Finally, any issues with parallel builds should be resolved again making the build faster. NOTE: The certified/13.8 version of this patch also builds libresample which is needed by pjsua. Later versions do not need libresample. Change-Id: Icc5e3d658fbfb00e0a46b44c66dcc2522d5171b0 2016-08-29 18:08 +0000 [adcdecd47f] Richard Mudgett * res_pjsip: Add ignore_uri_user_options option. This implements the chan_sip legacy_useroption_parsing option but with a better name. * Made the caller-id number and redirecting number strings obtained from incoming SIP URI user fields always truncated at the first semicolon. People don't care about anything after the semicolon showing up on their displays even though the RFC allows the semicolon. ASTERISK-26316 #close Reported by: Kevin Harwell Change-Id: Ib42b0e940dd34d84c7b14bc2e90d1ba392624f62 2016-09-08 16:34 +0000 Asterisk Development Team * asterisk certified/13.8-cert3 Released. 2016-09-08 11:34 +0000 [6cec20200b] gtjoseph * Release summaries: Remove previous versions 2016-09-08 11:34 +0000 [9c0f0eef6e] gtjoseph * .version: Update for certified/13.8-cert3 2016-09-08 11:34 +0000 [3923b114b9] gtjoseph * .lastclean: Update for certified/13.8-cert3 2016-09-08 11:34 +0000 [83362b5590] gtjoseph * realtime: Add database scripts for certified/13.8-cert3 2016-08-23 06:35 +0000 [d947baa255] Corey Farrell (license 5909) * chan_sip: Don't allocate new RTP instances on top of old ones. In some scenarios dialog_initialize_rtp can be called multiple times on the same dialog. This can cause RTP instances to be leaked along with multiple file descriptors for each instance. This change makes it so the existing RTP instances are destroyed and not overwritten, stopping the memory leak. ASTERISK-26272 #close patches: ASTERISK-26272-13.patch submitted by Corey Farrell (license 5909) Change-Id: Id529de1184c68f2f4d254ab41a1f458dafdb5f73 2016-08-10 15:14 +0000 [df9aa402a5] Mark Michelson * ConfBridge: Make some announcements asynchronous. Confbridge announcements tend to block a channel while they are being played. In some circumstances, this is warranted since you want that particular channel not to hear the announcement (Example: "John Doe has entered the conference"). For others it makes less sense. This change first introduces methods for playing sounds asynchronously into the conference. This is very similar to how synchronous sounds are played, except the channel initiating the playback does not wait for the sound to complete before moving on. Asynchronous announcements are used for two circumstances: * Sounds played for a user after they have left the bridge * Sounds that play first to a single user and then the rest of the conference (if the channel and conference use the same language) ASTERISK-26289 #close Reported by Mark Michelson Change-Id: Ie486bb3de1646d50894489030326a423e594ab0a 2016-08-24 14:42 +0000 [b1e827d259] gtjoseph * res_rtp_multicast: Fix SEGV in ast_multicast_rtp_create_options ast_multicast_rtp_create_options now checks for NULL or empty options Change-Id: Ib845eae46a67a9787e89a87ebd1027344e5e0362 2016-08-10 15:14 +0000 [c218e038d7] Mark Michelson * ConfBridge: Rework announcer channel methodology NOTE: This patch was submitted earlier and reverted because of a failing test. The test has been patched so that it adjusts for the changes here, so this is being resubmitted for review. One feature that confbridge has is the ability to play sounds to all participants in the conference. Prior to this commit, the algorithm for this was as follows: * Grab the playback lock * Push the conference announcer channel into the bridge * Play back the sound * Pull the conference announcer channel from the bridge * Release the playback lock The issue here is that the act of adding the playback channel to the bridge and removing it for each announcement is expensive. Amongst the expenses: * The announcer channel is imparted into the bridge, meaning a new thread is spun up for each playback. * When the announcer is added or removed from the bridge, it results in the BRIDGEPEER channel variable being set on all channels in the bridge. This requires keeping the bridge locked and locking each individual channel in order to set it. * There's also just the general overhead of adding the channel and removing it from the bridge. The bridge potentially has to reconfigure every single time With this commit, the paradigm for playing back announcements has shifted. * The announcer channel is now added to the bridge when the conference is allocated, and it is hung up when the conference is destroyed. * A taskprocessor is used to queue playbacks onto the announcer channel. This keeps the behavior from before where playbacks do not overlap. * The announcer channel is no longer placed into the bridge as departable. Since we are not constantly removing the channel from the bridge, it is safe to add the channel using an independent thread and simply hang the channel up when it is time for the conference to be destroyed. The use of the taskprocessor for playbacks opens up the interesting possibility of having asynchronous announcements played. In this commit, however, the behavior is still exactly the same as it previously was. ASTERISK-26289 Reported by Mark Michelson Change-Id: Ica9fa4907c2f3728cdd1cf0bc564ef4eb40754a0 2016-08-23 05:53 +0000 [b82f0b7722] Joshua Colp * Revert "ConfBridge: Rework announcer channel methodology" This reverts commit 4ca730127ccdc895e4d9e32cb0828c27bf74817b. Change-Id: I8886feb69ae2dbf521a8c0937792349b70db52b2 2016-08-10 15:14 +0000 [4ca730127c] Mark Michelson * ConfBridge: Rework announcer channel methodology One feature that confbridge has is the ability to play sounds to all participants in the conference. Prior to this commit, the algorithm for this was as follows: * Grab the playback lock * Push the conference announcer channel into the bridge * Play back the sound * Pull the conference announcer channel from the bridge * Release the playback lock The issue here is that the act of adding the playback channel to the bridge and removing it for each announcement is expensive. Amongst the expenses: * The announcer channel is imparted into the bridge, meaning a new thread is spun up for each playback. * When the announcer is added or removed from the bridge, it results in the BRIDGEPEER channel variable being set on all channels in the bridge. This requires keeping the bridge locked and locking each individual channel in order to set it. * There's also just the general overhead of adding the channel and removing it from the bridge. The bridge potentially has to reconfigure every single time With this commit, the paradigm for playing back announcements has shifted. * The announcer channel is now added to the bridge when the conference is allocated, and it is hung up when the conference is destroyed. * A taskprocessor is used to queue playbacks onto the announcer channel. This keeps the behavior from before where playbacks do not overlap. * The announcer channel is no longer placed into the bridge as departable. Since we are not constantly removing the channel from the bridge, it is safe to add the channel using an independent thread and simply hang the channel up when it is time for the conference to be destroyed. The use of the taskprocessor for playbacks opens up the interesting possibility of having asynchronous announcements played. In this commit, however, the behavior is still exactly the same as it previously was. ASTERISK-26289 Reported by Mark Michelson Change-Id: Ic5cd2c4b98a1eaa1715eb7a5b35d62f1a76d78a5 2016-08-16 15:36 +0000 [f40c6874c6] gtjoseph * res_pjsip: Add contact_user to endpoint contact_user, when specified on an endpoint, will override the user portion of the Contact header on outgoing requests. Change-Id: Icd4ebfda2f2e44d3ac749d0b4066630e988407d4 2016-08-09 12:07 +0000 [78a6da0885] Kevin Harwell * alembic/sqlalchemy: auto increment only allowed on a single column The extensions table defined two columns (id and priority) as primary key autoincrement columns. However only one is allowed when defining the primary key. This patch removes the autoincrement attribute from the priority column since it does not need to be as such and really should not have been on there in the first place. This patch also removes 'context', 'exten', and 'priority' from the primary key index and creates a new combined unique contraint index on them. ASTERISK-26183 #close Change-Id: Ib9c712c612a4d7ec1edb0dcb77f1bae0905a470b (cherry picked from commit f6ec94cca66addac71d566d6fa48188b407f26ba) 2016-08-15 13:27 +0000 Asterisk Development Team * asterisk certified/13.8-cert2 Released. 2016-08-15 08:27 +0000 [d7eec92332] Joshua Colp * Release summaries: Remove previous versions 2016-08-15 08:27 +0000 [847b0d007d] Joshua Colp * .version: Update for certified/13.8-cert2 2016-08-15 08:27 +0000 [bd8581cd52] Joshua Colp * .lastclean: Update for certified/13.8-cert2 2016-08-15 08:27 +0000 [628620c5ef] Joshua Colp * realtime: Add database scripts for certified/13.8-cert2 2016-08-09 16:19 +0000 [13b950f4be] Mark Michelson * res_rtp_asterisk: Cache local RTCP address. When an RTCP packet is sent or received, res_rtp_asterisk generates a Stasis event that contains the RTCP report as well as the local and remote addresses that the report pertains to. The addresses are determined using ast_find_ourip(). For the local address, this will typically result in a lookup of the hostname of the server, and then a DNS lookup of that hostname. If you do not have the host in /etc/hosts, then this results in a full DNS lookup, which can potentially block for some time. This is especially problematic when performing RTCP reads, since those are done on the same thread responsible for reading and writing media. This patch addresses the issue by performing a lookup of the local address when RTCP is allocated. We then use this cached local address for the Stasis events when necessary. ASTERISK-26280 #close Reported by Mark Michelson Change-Id: I3dd61882c2e57036f09f0c390cf38f7c87e9b556 2016-08-01 06:57 +0000 [acf021cdec] Joshua Colp * ChangeLog: Updated for certified/13.8-cert2-rc1 2016-08-01 06:57 +0000 [fba5cf4a00] Joshua Colp * Release summaries: Add summaries for certified/13.8-cert2-rc1 2016-08-01 06:57 +0000 [b2cc9b4879] Joshua Colp * Release summaries: Remove previous versions 2016-08-01 06:57 +0000 [20e25657fa] Joshua Colp * .version: Update for certified/13.8-cert2-rc1 2016-08-01 06:57 +0000 [08c26fba06] Joshua Colp * .lastclean: Update for certified/13.8-cert2-rc1 2016-08-01 06:57 +0000 [b539479f10] Joshua Colp * realtime: Add database scripts for certified/13.8-cert2-rc1 2016-06-21 10:53 +0000 [164bfc8574] Scott Griepentrog * PJSIP: provide transport type with received messages The receipt of a SIP MESSAGE may occur over any transport including TCP and TLS. When the message is received, the original URI is added to the message in the field PJSIP_RECVADDR, but this is insufficient to ensure a reply message can reach the originating endpoint. This patch adds the PJSIP_TRANSPORT field populated with the transport type. ASTERISK-26132 #close Change-Id: I28c4b1e40d573a056c81deb213ecf53e968f725e (cherry picked from commit 69d58a1e377938e5236f51200e222eb219739441) 2016-07-21 22:28 +0000 [7809034c0d] Richard Mudgett * dsp.c: Fix erroneous fax tone detection. The Goertzel calculations get less accurate the lower the signal level being worked with becomes because there is less resolution remaining. If it is too low we can erroneously detect a tone where none really exists. The searched for fax frequencies not only need to be so much stronger than the background noise they must also be a minimum strength. * Add needed minimum threshold test to tone_detect(). * Set TONE_THRESHOLD to allow low volume frequency spread detection. ASTERISK-26237 #close Reported by: Richard Mudgett Change-Id: I84dbba7f7628fa13720add6a88eae3b129e066fc 2016-07-21 09:05 +0000 [5bc48a290b] gtjoseph * chan_sip: Prevent deadlock when issuing "sip show channels" sip_show_channels locks the dialogs container first then locks each sip_pvt so it can spit out the details. The rest of sip dialog processing locks the sip_pvt first then locks the dialogs container if it needs to. Both lock in the order they need but deadlocks can result. To fix, sip_show_channels and sip_show_channelstats have been converted to use an iterator rather than ao2_callback. This way the container is locked only while getting the next entry and is unlocked when the callback is called. ASTERISK-23013 #close Change-Id: Id9980419909e811f89484950ed46ef117b9eb990 2016-07-12 17:24 +0000 [49defa5578] Richard Mudgett * res_fax: Fix FAXOPT(faxdetect) timeout option. The fax detection timeout option did not work because basically the wrong variable was checked in fax_detect_framehook(). As a result, the timer would timeout immediately and disable fax detection. * Fixed ignoring negative timeout values. We'd complain and then go right on using the negative value. * Fixed destroy_faxdetect() in the off-nominal case of an incomplete object creation. * Added more range checking to FAXOPT(gateway) timeout parameter. ASTERISK-26214 #close Reported by: Richard Mudgett Change-Id: Idc5e698dfe33572de9840bc68cd9fc043cbad976 2016-07-18 16:16 +0000 [a0485fe851] Richard Mudgett * chan_dahdi: Add faxdetect_timeout option. The new option allows the channel driver's faxdetect option to timeout on a call after the specified number of seconds into a call. The new feature is disabled if the timeout is set to zero. The option is disabled by default. * Don't clear dsp_features after passing them to the dsp code in my_pri_ss7_open_media(). We should still remember them especially for the new faxdetect_timeout option. ASTERISK-26214 Reported by: Richard Mudgett Change-Id: Ieffd3fe788788d56282844774365546dce8ac810 2016-07-15 20:44 +0000 [d172104e12] Richard Mudgett * res_pjsip: Add fax_detect_timeout endpoint option. The new endpoint option allows the PJSIP channel driver's fax_detect endpoint option to timeout on a call after the specified number of seconds into a call. The new feature is disabled if the timeout is set to zero. The option is disabled by default. ASTERISK-26214 Reported by: Richard Mudgett Change-Id: Id5a87375fb2c4f9dc1d4b44c78ec8735ba65453d 2016-07-13 14:09 +0000 Asterisk Development Team * asterisk certified/13.8-cert1 Released. 2016-07-13 08:34 +0000 [482561f1e3] Joshua Colp * Release summaries: Remove previous versions 2016-07-13 08:34 +0000 [3cb116d75a] Joshua Colp * .version: Update for certified/13.8-cert1 2016-07-13 08:34 +0000 [797d39c81c] Joshua Colp * .lastclean: Update for certified/13.8-cert1 2016-07-13 08:34 +0000 [f5fbfe9a6a] Joshua Colp * realtime: Add database scripts for certified/13.8-cert1 2016-07-07 10:38 +0000 [22a36e5b10] Joshua Colp * chan_sip/res_pjsip_t38: Handle a request to negotiate T.38 after it is enabled. Some T.38 implementations may send another re-invite after the initial one which adds additional negotiation details (such as the max bitrate). Currently this will fail when passthrough is being done in chan_sip as we do nothing if T.38 is already active. Other handlers of T.38 inside of Asterisk (such as res_fax) handle this scenario so this change adds support for it to chan_sip and res_pjsip_t38. If a request to negotiate is received while T.38 is already enabled a new re-INVITE is sent and negotiation is done again. ASTERISK-26179 #close Change-Id: I0298494d3da6df3219bbfa4be9aa04015043145c 2016-06-22 13:41 +0000 [d0c04c8986] gtjoseph * res_rtp_asterisk: Fix a self-comparison identified by gcc 6 gcc 6 caught a previously unidentified self-comparison in ice_candidate_cmp. Fixed it and re-ordered the predicates for better short-circuiting. ASTERISK-26140 #close Change-Id: I3da713c568e24064430257b3502fbdafd35af7a7 2016-06-30 08:25 +0000 [0d694ce9b8] gtjoseph * configure: Fix HAVE_PJSIP_EVSUB_GRP_LOCK not set with external pjproject There was a typo in configure.ac preventing HAVE_PJSIP_EVSUB_GRP_LOCK from getting set when using an external pjproject. ASTERISK-26099 #close Reported-by: Ross Beer Change-Id: I709af70428e125fb5ccd44b171d25dd29141f0ae 2016-06-28 08:22 +0000 [5f444b1f5b] gtjoseph * BuildSystem: Fix a few issues hightlighted by gcc 6.x gcc 6.1.1 caught a few more issues. Made sure the unit tests still pass for the func_env and stdtime issues. ASTERISK-26157 #close Change-Id: I6664d8f34a45bc1481d2a854481c7878b0c1cf8e 2016-06-22 16:15 +0000 [f282a88ee4] Mark Michelson * ChangeLog: Updated for certified/13.8-cert1-rc3 2016-06-22 16:15 +0000 [bd6da93116] Mark Michelson * Release summaries: Add summaries for certified/13.8-cert1-rc3 2016-06-22 16:14 +0000 [4df81def29] Mark Michelson * Release summaries: Remove previous versions 2016-06-22 16:14 +0000 [286d58affc] Mark Michelson * .version: Update for certified/13.8-cert1-rc3 2016-06-22 16:14 +0000 [8b7fe94df7] Mark Michelson * .lastclean: Update for certified/13.8-cert1-rc3 2016-06-22 16:14 +0000 [0449fd2e1e] Mark Michelson * realtime: Add database scripts for certified/13.8-cert1-rc3 2016-06-09 09:20 +0000 [a6610fbe2f] gtjoseph * build: Fix ast_sockaddr initialization to be more portable A change to glibc 2.22 changed the order of the sockadddr_storage members which caused the places where we do an initialization of ast_sockaddr with '{ { 0, 0, } }' to fail compilation. Those initializers (which we shouldn't have been using anyway) have been replaced with memsets. Change-Id: Idd1b3b320903d8771bfe221f0b015685de628fa4 2016-06-12 11:19 +0000 [102d88e791] gtjoseph * res_pjsip_pubsub: Address SEGV when attempting to terminate a subscription Occasionally under load we'll attempt to send a final NOTIFY on a subscription that's already been terminated and a SEGV will occur down in pjproject's evsub_destroy function. This is a result of a race condition between all the paths that can generate a notify and/or destroy the underlying pjproject evsub object: * The client can send a SUBSCRIBE with Expires: 0. * The client can send a SUBSCRIBE/refresh. * The subscription timer can expire. * An extension state can change. * An MWI event can be generated. * The pjproject transaction timer (timer_b) can expire. Normally when our pubsub_on_evsub_state is called with a terminate, we push a task to the serializer and return at which point the dialog is unlocked. This is usually not a problem because the task runs immediately and locks the dialog again. When the system is heavily loaded though, there may be a delay between the unlock and relock during which another event may occur such as the subscription timer or timer_b expiring, an extension state change, etc. These may also cause a terminate to be processed and if so, we could cause pjproject to try to destroy the evsub structure twice. There's no way for us to tell that the evsub was already destroyed and the evsub's group lock can't tolerate this and SEGVs. The remedy is twofold. * A patch has been submitted to Teluu and added to the bundled pjproject which adds add/decrement operations on evsub's group lock. * In res_pjsip_pubsub: * configure.ac and pjproject-bundled's configure.m4 were updated to check for the new evsub group lock APIs. * We now add a reference to the evsub group lock when we create the subscription and remove the reference when we clean up the subscription. This prevents evsub from being destroyed before we're done with it. * A state has been added to the subscription tree structure so termination progress can be tracked through the asyncronous tasks. * The pubsub_on_evsub_state callback has been split so it's not doing double duty. It now only handles the final cleanup of the subscription tree. pubsub_on_rx_refresh now handles both client refreshes and client terminates. It was always being called for both anyway. * The serialized_on_server_timeout task was removed since serialized_pubsub_on_rx_refresh was almost identical. * Missing state checks and ao2_cleanups were added. * Some debug levels were adjusted to make seeing only off-nominal things at level 1 and nominal or progress things at level 2+. ASTERISK-26099 #close Reported-by: Ross Beer. Change-Id: I779d11802cf672a51392e62a74a1216596075ba1 2016-06-13 13:33 +0000 [d9ab222edc] Richard Mudgett * res_rtp_multicast.c: Fix warning message typo. Change-Id: Ic9928208b9957e09866abe3d9649030942ec52b3 2016-06-10 12:35 +0000 [39329a9e66] Richard Mudgett * chan_rtp: Backport changes from master. * Deprecate chan_multicast_rtp. Change-Id: Ib5a45e58c75ee8abd0b4f9575379b5321feb853e 2016-06-10 16:13 +0000 [6d45341963] Richard Mudgett * chan_rtp.c: Copy file from chan_multicast_rtp.c Change-Id: I1119b53f2152ab1cbec74b5be7ea44844dbda8ef 2016-06-03 22:44 +0000 [0322479ff7] Richard Mudgett * res_pjsip_registrar.c: Eliminate rx REGISTER request race condition. This patch fixes a race condition processing received REGISTER requests and their retransmissions caused by REGISTER requests being processed by two threads. The "sip_transaction Unable to register REGISTER transaction (key exists)" message is a notable symptom of this issue. This issue was more likely to happen before the pjsip/distributor serializers were created. Instead of steps one and two below placing the REGISTER messages into the same pjsip/distributor they were placed in random pjsip/default serializers. 1) REGISTER requests come in and get placed on the pjsip/distributor serializer. 2) Before the first request is processed a retransmission comes in and is placed on the same pjsip/distributor serializer. 3) The first request goes up the pjsip stack and is then shunted off to the pjsip/aor/ serializer. 4) Before the first request is completed processing in the pjsip/aor/ serializer, the second request goes up the pjsip stack and is also shunted off to the pjsip/aor/ serializer. 5) The first request completes processing and sends out its response. 6) The second request completes processing and tries to send out its response but pjlib complains that the REGISTER transaction key already exists. 7) Sadness ensues. * The race is eliminated by removing the pjsip/aor/ serializer and continuing the processing in the pjsip/distributor serializer. Now any retransmissions queued in the pjsip/distributor serializer will be processed after the first message is completely processed. ASTERISK-26088 #close Reported by: Richard Mudgett Change-Id: I842d714346088bf717ea27437f1dd85bff0bab5a 2016-06-03 11:35 +0000 [942fa0c95b] Richard Mudgett * stasis: Add setting subscription congestion levels. Stasis subscriptions and message routers create taskprocessors to process the event messages. API calls are needed to be able to set the congestion levels of these taskprocessors for selected subscriptions and message routers. * Updated CDR, CEL, and manager's stasis subscription congestion levels based upon stress testing. Increased the congestion levels to reduce the potential for bursty call setup/teardown activity from triggering the taskprocessor overload alert. CDRs in particular need an extra high congestion level because they can take awhile to process the stasis messages. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: Id0a716394b4eee746dd158acc63d703902450244 2016-06-02 18:19 +0000 [b046fa1907] Richard Mudgett * sorcery: Add setting object type congestion levels. Sorcery creates taskprocessors for object types to process object observer callbacks. An API call is needed to be able to set the congestion levels of these taskprocessors for selected object types. * Updated PJSIP's contact and contact_status sorcery object type observer default congestion levels based upon stress testing. Increased the congestion levels to reduce the potential for bursty register/unregister and subscribe/unsubscribe activity from triggering the taskprocessor overload alert. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I4542e83b556f0714009bfeff89505c801f1218c6 2016-06-02 16:08 +0000 [237f9ef7af] Richard Mudgett * taskprocessors: Implement high/low water mark alerts. When taskprocessors get backed up, there is a good chance that we are being overloaded and need to defer adding new work to the system. * Implemented a high/low water alert mechanism for modules to check if the system is being overloaded and take appropriate action. When a taskprocessor is created it has default congestion levels set. A taskprocessor can later have those congestion levels altered for specific needs if stress testing shows that the taskprocessor is a symptom of overloading or needs to handle bursty activity without triggering an overload alert. * Add CLI "core show taskprocessor" low/high water columns. * Fixed __allocate_taskprocessor() to not use RAII_VAR(). RAII_VAR() was never a good thing to use when creating a taskprocessor because of the nature of how its references needed to be cleaned up on a partial creation. * Made res_pjsip's distributor check if the taskprocessor overload alert is active before placing a message representing brand new work onto a distributor serializer. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I182f1be603529cd665958661c4c05ff9901825fa 2016-05-27 17:31 +0000 [ff70f04a37] Richard Mudgett * res_pjsip_session: Use distributor serializer for incoming calls. We must continue using the serializer that the original INVITE came in on for the dialog. There may be retransmissions already enqueued in the original serializer that can result in reentrancy and message sequencing problems. Outgoing call legs create the pjsip/outsess/ serializers for their dialogs. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I24d7948749c582b8045d5389ba3f6588508adbbc 2016-05-27 16:28 +0000 [4b26c9ead8] Richard Mudgett * res_pjsip_pubsub.c: Recreate subscriptions using distributor serializer. * Resolves potential reentrancy problems if system restarted in the middle of subscription message transactions. * Fixes memory leak recreating persistent subscriptions when the subscription resource tree could not be created. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I71e34d7ae8ed35a694f1030e820e2548c48697be 2016-05-27 12:50 +0000 [a137d1822e] Richard Mudgett * res_pjsip_pubsub.c: Use distributor serializer for incoming subscriptions. We must continue using the serializer that the original SUBSCRIBE came in on for the dialog. There may be retransmissions already enqueued in the original serializer that can result in reentrancy and message sequencing problems. The "sip_transaction Unable to register SUBSCRIBE transaction (key exists)" message is a notable symptom of this issue. Outgoing subscriptions still create the pjsip/pubsub/ serializers for their dialogs. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I18b00bb74a56747b2c8c29543a82440b110bf0b0 2016-05-26 17:35 +0000 [9a7a5aec18] Richard Mudgett * pjsip_distributor.c: Consistently pick a serializer for messages. Incoming messages that are not part of a dialog or a recognized response to one of our requests need to be sent to a consistent serializer. Under load we may be queueing retransmissions before we can process the original message. We don't need to throw these messages onto random serializers and cause reentrancy and message sequencing problems. * Created a pool of pjsip/distributor serializers that get picked by hashing the call-id and remote tag strings of the received messages. * Made ast_sip_destroy_distributor() destroy items in the reverse order of creation. ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I2ce769389fc060d9f379977f559026fbcb632407 2016-06-02 12:51 +0000 [f2a76c4292] Richard Mudgett * pjsip_distributor.c: Ignore messages until fully booted. We should not be processing any incoming messages until we are fully booted. We may not have dialplan or other needed configuration loaded yet. ASTERISK-26089 #close Reported by: Scott Griepentrog ASTERISK-26088 Reported by: Richard Mudgett Change-Id: I584aefb4f34b885a8927e1f13a2c64babd606264 2016-04-01 13:30 +0000 [51e45e5ca5] gtjoseph * res_pjsip contact: Lock expiration/addition of contacts Contact expiration can occur in several places: res_pjsip_registrar, res_pjsip_registrar_expire, and automatically when anyone calls ast_sip_location_retrieve_aor_contact. At the same time, res_pjsip_registrar may also be attempting to renew or add a contact. Since none of this was locked it was possible for one thread to be renewing a contact and another thread to expire it immediately because it was working off of stale data. This was the casue of intermittent registration/inbound/nominal/multiple_contacts test failures. Now, the new named lock functionality is used to lock the aor during contact expire and add operations and res_pjsip_registrar_expire now checks the expiration with the lock held before deleting the contact. ASTERISK-25885 #close Reported-by: Josh Colp Change-Id: I83d413c46a47796f3ab052ca3b349f21cca47059 2016-03-31 20:04 +0000 [880d502141] gtjoseph * lock: Add named lock capability Locking some objects like sorcery objects can be tricky because the underlying ao2 object may not be the same for all callers. For instance, two threads that call ast_sorcery_retrieve_by_id on the same aor name might actually get 2 different ao2 objects if the underlying wizard had to rehydrate the aor from a database. Locking one ao2 object doesn't have any effect on the other even if those objects had locks in the first place. Named locks allow access control by keyspace and key strings. Now an "aor" named "1000" can be locked and any other thread attempting to lock "aor" "1000" will wait regardless of whether the underlying ao2 object is the same or not. Mutex and rwlocks are supported. This capability will initially be used to lock an aor when multiple threads may be attempting to prune expired contacts from it. Change-Id: If258c0b7f92b02d07243ce70e535821a1ea7fb45 2016-06-02 12:04 +0000 [a81feefde9] Joshua Colp * res_odbc: Implement a connection pool. Testing has shown that our usage of UnixODBC is problematic due to bugs within UnixODBC itself as well as the heavy weight cost of connecting and disconnecting database connections, even when pooling is enabled. For users of UnixODBC 2.3.1 and earlier crashes would occur due to insufficient protection of the disconnect operation. This was fixed in UnixODBC 2.3.2 and above. For users of UnixODBC 2.3.3 and higher a slow-down would occur under heavy database use due to repeated connection establishment. A regression is present where on each connection the database configuration is cached again, with the cache growing out of control. The connection pool implementation present in this change helps to mitigate these issues by reducing how much we connect and disconnect database connections. We also solve the issue of crashes under UnixODBC 2.3.1 by defaulting the maximum number of connections to 1, returning us to the previous working behavior. For users who may have a fixed version the maximum concurrent connection limit can be increased helping with performance. The connection pool works by keeping a list of active connections. If the connection limit has not been reached a new connection is established. If the connection limit has been reached then the request waits until a connection becomes available before continuing. ASTERISK-26074 #close ASTERISK-26054 #close Change-Id: I6774bf4bac49a0b30242c76a09c403d2e856ecff 2016-05-30 10:58 +0000 [aab8bc5d31] gtjoseph * pjproject_bundled: Move to pjproject 2.5 Although all the patches we had against 2.4.5 were applied by Teluu, a new bug was introduced preventing re-use of tcp and tls transports This patch removes all the previous patches against 2.4.5, updates the version to 2.5, and adds a new patch to correct the transport re-use problem. Change-Id: I0dc6c438c3910f7887418a5832ca186aea23d068 (cherry picked from commit e8abfdcdc5ce4d32d1fe281e75b13fd652f9e5f7) 2016-05-18 07:54 +0000 [b9a28ccbd4] gtjoseph * udptl: Don't eat sequence numbers until OK is received Scenario: Local fax -> Asterisk w/ firewall -> Provider -> Remote fax * Local fax starts rtp call to remote fax * Remote fax starts t38 call back to local fax. * Local fax sends t38 no-signal to Asterisk before sending an OK. * udptl processes the frame and increments the expected sequence number. * chan_sip drops the frame because the call isn't up so nothing goes out the external interface to open the port for incoming packets. * Local fax sends OK and Asterisk sends OK to the remote fax. * Remote fax sends t38 packets which are dropped by the firewall. * Local fax re-sends t38 no-signal with the same sequence number. * udptl drops the frame because it thinks it's a dup. * Still no outgoing packets to open the firewall. * t38 negotiation fails. The patch drops frames t38 received before udptl sequence processing when the call hasn't been answered yet. The second no-signal frame is then seen as new and is relayed out the external interface which opens the port and allows negotiation to continue. ASTERISK-26034 #close Change-Id: I11744b39748bd2ecbbe8ea84cdb4f3c5943c5af9 2016-05-17 11:14 +0000 [f85c77a9e1] gtjoseph * chan_sip: Prevent extra Session-Expires headers from being added When chan_sip does a re-INVITE to refresh a session and authentication is required, the INVITE with the Authorization header containes a second Session-Expires header without the ";refersher=" parameter. This is causing some proxies to return a 400. Also, when Asterisk is the uas and the refresher, it is including the Session-Expires and Min-SE headers in OPTIONS messages which is not allowed per RFC4028. This patch (based on the reporter's) Checks to see if a Session-Expires header is already in the message before adding another one. It also checks that the method is INVITE or UPDATE. ASTERISK-26030 #close Change-Id: I58a7b07bab5a3177748d8a7034fb8ad8e11ce1d9 2016-05-07 14:39 +0000 [8bf050b853] gtjoseph * config_transport: Tell pjproject to allow all SSL/TLS protocols The default tls settings for pjproject only allow TLS 1, TLS 1.1 and TLS 1.2. SSL is not allowed. So, even if you specify "sslv3" for a transport method, it's silently ignored and one of the TLS protocols is used. This was a new behavior of pjsip_tls_setting_default() in 2.4 (when tls.proto was added) that we never caught. Now we need to set tls.proto = 0 after we call pjsip_tls_setting_default(). This tells pjproject to set the socket protocol to match the method. ASTERISK-26004 #close Change-Id: Icfb55c1ebe921298dedb4b1a1d3bdc3ca41dd078 2016-05-05 11:37 +0000 [4fc2c98369] Kevin Harwell * res_pjsip_authenticator_digest: Don't use source port in nonce verification From the issue reporter: "res_pjsip_outbound_authenticator_digest builds a nonce that is a hash of the timestamp, the source address, the source port, a server UUID that is calculated at startup, and the authentication realm. Rather than caching nonces that we create, we instead attempt to re-calculate the nonce when receiving an incoming request with authentication. We then compare the re-calculated nonce to the incoming nonce, and if they don't match, then authentication has failed early. The problem is that it is possible, especially when using TCP, to receive two requests from the same endpoint but have differing source ports for those requests. Asterisk itself commonly will use different source ports for outbound TCP requests." This patch removes the source port dependency when building the nonce. ASTERISK-25978 #close Change-Id: I871b5f4adce102df1c4988066283095ec509dffe 2016-05-05 05:07 +0000 [4e7791d483] Joshua Colp * file: Ensure nativeformats remains valid for lifetime of use. It is possible for the nativeformats of a channel to change throughout its lifetime. As a result a user of it needs to either ensure the channel is locked when accessing the formats or keep a reference to the nativeformats themselves. This change fixes the file playback support so it keeps a reference to the nativeformats when accessing things. ASTERISK-25998 #close Change-Id: Ie45b65475e1481ddf05b874ee48f63e39fff8915 2016-05-03 07:55 +0000 [601602f44b] Joshua Colp * ChangeLog: Updated for certified/13.8-cert1-rc2 2016-05-03 07:55 +0000 [13461bb9a6] Joshua Colp * Release summaries: Add summaries for certified/13.8-cert1-rc2 2016-05-03 07:54 +0000 [cadb5c4e64] Joshua Colp * Release summaries: Remove previous versions 2016-05-03 07:54 +0000 [d4d5548ef8] Joshua Colp * .version: Update for certified/13.8-cert1-rc2 2016-05-03 07:54 +0000 [a5bc40ae51] Joshua Colp * .lastclean: Update for certified/13.8-cert1-rc2 2016-05-03 07:54 +0000 [2b6df52c66] Joshua Colp * realtime: Add database scripts for certified/13.8-cert1-rc2 2016-04-15 11:59 +0000 [c4426f1035] Alexei Gradinari * res_pjsip: disable multi domain to improve realtime performace This patch added new global pjsip option 'disable_multi_domain'. Disabling Multi Domain can improve Realtime performance by reducing number of database requests. ASTERISK-25930 #close Change-Id: I2e7160f3aae68475d52742107949a799aa2c7dc7 2016-04-26 05:48 +0000 [c69e0f1813] Joshua Colp * app_queue: Fix crash when unloading module. When unloading the app_queue module the members in each queue are destroyed and as part of this they are removed from the pending members container. Unfortunately a crash would occur as the container was destroyed before the members were removed. This change tweaks ordering so the container destruction occurs after the members are destroyed. ASTERISK-16115 Change-Id: I48c728668c55aee3d05b751a5d450fb57e87f44b 2016-04-21 14:23 +0000 [eebe8b3dd3] Kevin Harwell * app_queue: queue members can receive multiple calls It was possible for a queue member that is a member of at least 2 or more queues to receive mulitiple calls at the same time. This happened because of a race between when a member was being rung and when the device state notified the other queue(s) member object of the state change. This patch makes it so when a queue member is being rung it gets added to a global pool of queue members. If that same member is tried again, e.g. from another queue, and it is found to already exist in the pending member container then it will not ring that member. ASTERISK-16115 #close Change-Id: I546dd474776d158c2b6be44205353dee5bac7e48 2016-04-22 17:53 +0000 [5cbd4b9799] gtjoseph * res_agi: Prevent run_agi from eating frames it shouldn't The run_agi function is eating control frames when it shouldn't be. This is causing issues when an AGI is run from CONNECTED_LINE_SEND_SUB in a blond transfer. Alice calls Bob. Bob attended transfers to Charlie but hangs up before Charlie answers. Alice gets the COLP UPDATE indicating Charlie but Charlie never gets an UPDATE and is left thinking he's connected to Bob. In this case, when CONNECTED_LINE_SEND_SUB runs on Alice's channel and it calls an AGI, the extra eaten frames prevent CONNECTED_LINE_SEND_SUB from running on Charlie's channel. The fix was to accumulate deferrable frames in the "forever" loop instead of dropping them, and re-queue them just before running the actual agi command or exiting. ASTERISK-25951 #close Change-Id: I0f4bbfd72fc1126c2aaba41da3233a33d0433645 2016-04-15 14:36 +0000 [bc51227ef8] Richard Mudgett * res_stasis: Handle re-enter stasis bridge with swap channel. We lose the fact that there is a swap channel if there is one. We currently wind up rejoining the stasis bridge as a normal join after the swap channel has already been kicked from the bridge. This patch preserves the swap channel so the AMI/ARI events can note that the channel joining the bridge is swapping with another channel. Another benefit to swaqpping in one operation is if there are any channels that get lonely (MOH, bridge playback, and bridge record channels). The lonely channels won't leave before the joining channel has a chance to come back in under stasis if the swap channel is the only reason the lonely channels are staying in the bridge. ASTERISK-25947 #close Reported by: Richard Mudgett ASTERISK-24649 Reported by: John Bigelow ASTERISK-24782 Reported by: John Bigelow Change-Id: If37ea508831d1fed6dbfac2f191c638fc0a850ee 2016-04-19 16:58 +0000 [8dd79720e6] Richard Mudgett * bridge: Hold off more than one imparting channel at a time. An earlier patch blocked the ast_bridge_impart() call until the channel either entered the target bridge or it failed. Unfortuantely, if the target bridge is stasis and the imprted channel is not a stasis channel, stasis bounces the channel out of the bridge to come back into the bridge as a proper stasis channel. When the channel is bounced out, that released the block on ast_bridge_impart() to continue. If the impart was a result of a transfer, then it became a race to see if the swap channel would get hung up before the imparted channel could come back into the stasis bridge. If the imparted channel won then everything is fine. If the swap channel gets hung up first then the transfer will fail because the swap channel is leaving the bridge. * Allow a chain of ast_bridge_impart()'s to happen before any are unblocked to prevent the race condition described above. When the channel finally joins the bridge or completely fails to join the bridge then the ast_bridge_impart() instances are unblocked. ASTERISK-25947 Reported by: Richard Mudgett ASTERISK-24649 Reported by: John Bigelow ASTERISK-24782 Reported by: John Bigelow Change-Id: I8fef369171f295f580024ab4971e95c799d0dde1 2016-04-19 17:52 +0000 [2a2e754d15] gtjoseph * res_pjsip_callerid: Clear out display name if id->name is not valid When create_new_id_hdr creates a new RPID or PAI header, it starts by cloning the From header, then it overwrites the display name and uri from the channel's connected.id. If the connected.id.name wasn't valid, create_new_id_hdr was leaving the display name from the From header in the new RPID or PAI header. On an attended transfer where the originator had a caller id number set but not a display name, the re-INVITE to the final transferee had the number of the originator but the display name of the transferer. Added a check to clear out the display name in the new header if connected.id.name was invalid. ASTERISK-25942 #close Change-Id: I60b4bf7a7ece9b7425eba74151c0b4969cd2738b 2016-04-19 13:02 +0000 [188ce34aff] Joshua Colp * app_talkdetect: Make the module core supported. This module is used as part of testsuite tests to confirm stuff works. I'm accordingly marking it as core as it is required by those tests. Change-Id: I558e7af7679b22b8ed641d7dd37ee4ca35b11e88 2016-04-19 13:00 +0000 [da80f40014] Joshua Colp * app_talkdetect: Enable for testsuite tests. Change-Id: I9acf2e2210f7a15cdd2c63c4c8dcb92de6b47d43 2016-04-18 12:12 +0000 [9f3ecf0a8d] Mark Michelson * PJSIP: Remove PJSIP parsing functions from uri length validation. The PJSIP parsing functions provide a nice concise way to check the length of a hostname in a SIP URI. The problem is that in order to use those parsing functions, it's required to use them from a thread that has registered with PJLib. On startup, when parsing AOR configuration, the permanent URI handler may not be run from a PJLib-registered thread. Specifically, this could happen when Asterisk was started in daemon mode rather than console-mode. If PJProject were compiled with assertions enabled, then this would cause Asterisk to crash on startup. The solution presented here is to do our own parsing of the contact URI in order to ensure that the hostname in the URI is not too long. The parsing does not attempt to perform a full SIP URI parse/validation, since the hostname in the URI is what is important. ASTERISK-25928 #close Reported by Joshua Colp Change-Id: Ic3d6c20ff3502507c17244a8b7e2ca761dc7fb60 2016-04-18 17:00 +0000 [39b4742db1] Mark Michelson * res_pjsip_registrar: Fix bad memory-ness with user_agent. Recent changes to the PJSIP registrar resulted in tests failing due to missing AOR_CONTACT_ADDED test events. The reason for this was that the user_agent string had junk values in it, resulting in being unable to generate the event. I'm going to be honest here, I have no idea why this was happening. Here are the steps needed for the user_agent variable to get messed up: * REGISTER is received * First contact in the REGISTER results in a contact being removed * Second contact in the REGISTER results in a contact being added * The contact, AOR, expiration, and user agent all have to be passed as format parameters to the creation of a string. Any subset of those parameters would not be enough to cause the problem. Looking into what was happening, the thing that struck me as odd was that the user_agent variable was meant to be set to the value of the User-Agent SIP header in the incoming REGISTER. However, when removing a contact, the user_agent variable would be set (via ast_strdupa inside a loop) to the stored contact's user_agent. This means that the user_agent's value would be incorrect when attempting to process further contacts in the incoming REGISTER. The fix here is to use a different variable for the stored user agent when removing a contact. Correcting the behavior to be correct also means the memory usage is less weird, and the issue no longer occurs. ASTERISK-25929 #close Reported by Joshua Colp Change-Id: I7cd24c86a38dec69ebcc94150614bc25f46b8c08 2016-04-18 13:41 +0000 [4caa57f6b3] Joshua Colp * res_pjsip_transport_management: Allow unload to occur. At shutdown it is possible for modules to be unloaded that wouldn't normally be unloaded. This allows the environment to be cleaned up. The res_pjsip_transport_management module did not have the unload logic in it to clean itself up causing the res_pjsip module to not get unloaded. As a result the res_pjsip monitor thread kept going processing traffic and timers when it shouldn't. Change-Id: Ic8cadee131e3b2c436a81d3ae8bb5775999ae00a 2016-04-14 13:49 +0000 [0b35582bbb] Mark Michelson * transport management: Register thread with PJProject. The scheduler thread that kills idle TCP connections was not registering with PJProject properly and causing assertions if PJProject was built in debug mode. This change registers the thread with PJProject the first time that the scheduler callback executes. AST-2016-005 Change-Id: I5f7a37e2c80726a99afe9dc2a4a69bdedf661283 2016-03-08 12:12 +0000 [9f8b803a29] Mark Michelson * res_pjsip_transport_management: Kill idle TCP connections. "Idle" here means that someone connects to us and does not send a SIP request. PJProject will not automatically time out such connections, so it's up to Asterisk to do it instead. When we receive an incoming TCP connection, we will start a timer (equivalent to transaction timer D) waiting to receive an incoming request. If we do not receive a request in that timeframe, then we will shut down the TCP connection. ASTERISK-25796 #close Reported by George Joseph AST-2016-005 Change-Id: I7b0d303e5d140d0ccaf2f7af562071e3d1130ac6 2016-03-08 10:52 +0000 [a35d3eb73b] Mark Michelson * Rename res_pjsip_keepalive res_pjsip_transport_management ASTERISK-25796 Reported by George Joseph AST-2016-005 Change-Id: Id322a05f927392293570599730050bc677d99433 2016-04-14 07:15 +0000 [3de37dee68] Mark Michelson * AST-2016-004: Fix crash on REGISTER with long URI. Due to some ignored return values, Asterisk could crash if processing an incoming REGISTER whose contact URI was above a certain length. ASTERISK-25707 #close Reported by George Joseph Patches: 0001-res_pjsip-Validate-that-URIs-don-t-exceed-pjproject-.patch AST-2016-004 Change-Id: I0ed3898fe7ab10121b76c8c79046692de3a1be55 2016-03-23 08:59 +0000 [e378c18815] gtjoseph * pjproject-bundled: Cleanups for reported issues PortAudio should no longer be required PJSIP_MAX_PKT_LEN is now 6000 Older autoconf issue fixed. (CentOS 6) Change-Id: I463fa9586cbe7c6b3b603289f535bd8e361611dd (cherry picked from commit d963a3374991c64594cf196e90a5c74964c8ba7c) 2016-04-06 11:02 +0000 [dd93204a84] Joshua Colp * ChangeLog: Updated for certified/13.8-cert1-rc1 2016-04-06 11:01 +0000 [6d29a919d4] Joshua Colp * Release summaries: Add summaries for certified/13.8-cert1-rc1 2016-04-06 10:27 +0000 [4fa3428247] Joshua Colp * Release summaries: Remove previous versions 2016-04-06 10:27 +0000 [b418e14998] Joshua Colp * .version: Update for certified/13.8-cert1-rc1 2016-04-06 10:27 +0000 [69b6cf2368] Joshua Colp * .lastclean: Update for certified/13.8-cert1-rc1 2016-04-06 10:27 +0000 [847dc5c7d7] Joshua Colp * realtime: Add database scripts for certified/13.8-cert1-rc1 2016-04-06 09:20 +0000 [c23bf7c8df] Joshua Colp * ChangeLog: Updated for certified/13.8-cert1-rc1 2016-04-06 09:19 +0000 [4f94668022] Joshua Colp * Release summaries: Add summaries for certified/13.8-cert1-rc1 2016-04-06 08:47 +0000 [454daec0e1] Joshua Colp * Release summaries: Remove previous versions 2016-04-06 08:47 +0000 [4ba2b5e92c] Joshua Colp * .version: Update for certified/13.8-cert1-rc1 2016-04-06 08:47 +0000 [e6f27ca09c] Joshua Colp * .lastclean: Update for certified/13.8-cert1-rc1 2016-04-06 08:47 +0000 [08dbdd5996] Joshua Colp * realtime: Add database scripts for certified/13.8-cert1-rc1 2016-04-06 08:26 +0000 [ec7a89771d] Joshua Colp * ChangeLog: Updated for certified/13.8-cert1-rc1 2016-04-06 08:25 +0000 [ffcb651205] Joshua Colp * Release summaries: Add summaries for certified/13.8-cert1-rc1 2016-04-06 07:52 +0000 [97499f717a] Joshua Colp * Release summaries: Remove previous versions 2016-04-06 07:52 +0000 [99d52771b5] Joshua Colp * .version: Update for certified/13.8-cert1-rc1 2016-04-06 07:52 +0000 [eb9e193c65] Joshua Colp * .lastclean: Update for certified/13.8-cert1-rc1 2016-04-06 07:52 +0000 [8ec588b8b1] Joshua Colp * realtime: Add database scripts for certified/13.8-cert1-rc1 2016-04-05 14:23 +0000 [4b87a773dc] Mark Michelson * res_pjsip: Handle deferred SDP hold/unhold properly. Some SIP devices indicate hold/unhold using deferred SDP reinvites. In other words, they provide no SDP in the reinvite. A typical transaction that starts hold might look something like this: * Device sends reinvite with no SDP * Asterisk sends 200 OK with SDP indicating sendrecv on streams. * Device sends ACK with SDP indicating sendonly on streams. At this point, PJMedia's SDP negotiator saves Asterisk's local state as being recvonly. Now, when the device attempts to unhold, it again uses a deferred SDP reinvite, so we end up doing the following: * Device sends reinvite with no SDP * Asterisk sends 200 OK with SDP indicating recvonly on streams * Device sends ACK with SDP indicating sendonly on streams The problem here is that Asterisk offered recvonly, and by RFC 3264's rules, if an offer is recvonly, the answer has to be sendonly. The result is that the device is not taken off hold. What is supposed to happen is that Asterisk should indicate sendrecv in the 200 OK that it sends. This way, the device has the freedom to indicate sendrecv if it wants the stream taken off hold, or it can continue to respond with sendonly if the purpose of the reinvite was something else (like a session timer refresher). The fix here is to alter the SDP negotiator's state when we receive a reinvite with no SDP. If the negotiator's state is currently in the recvonly or inactive state, then we alter our local state to be sendrecv. This way, we allow the device to indicate the stream state as desired. ASTERISK-25854 #close Reported by Robert McGilvray Change-Id: I7615737276165eef3a593038413d936247dcc6ed 2016-04-05 09:06 +0000 [c29e2e3fb7] Joshua Colp * .version: Update for certified/13.8 Change-Id: I37e5a8e36c2f4f9137f8f230c99220005424e514 2015-01-06 21:29 +0000 [3c796e694e] Matt Jordan * Disable extended support modules Change-Id: Ia2e359021b3eccecce20028098c5b6d1099c3f9e 2016-03-28 18:10 +0000 [7b6c4decd3] Richard Mudgett * res_stasis: Fix crash on a hanging up channel. * Give the struct stasis_app_control ao2 object a ref to the channel held in the object. Now the channel will still be around if a thread needs to post a stasis message instead of crash because the topic was destroyed. * Moved stopping any lingering silence generator out of the struct stasis_app_control destructor and made it a part of exiting the Stasis application. Who knows which thread the destructor will be called under so it cannot affect the channel's silence generator. Not only was the channel unprotected when the silence generator was stopped, stasis may no longer even control the channel. ASTERISK-25882 Change-Id: I21728161b5fe638cef7976fa36a605043a7497e4 2016-03-29 14:39 +0000 [fad0410486] Mark Michelson * ChangeLog: Updated for 13.8.0 2016-03-29 14:39 +0000 [0f885f0076] Mark Michelson * Release summaries: Add summaries for 13.8.0 2016-03-29 14:34 +0000 [a1fa37aebd] Mark Michelson * Release summaries: Remove previous versions 2016-03-29 14:34 +0000 [e7de5fd439] Mark Michelson * .version: Update for 13.8.0 2016-03-29 14:34 +0000 [8baf813848] Mark Michelson * .lastclean: Update for 13.8.0 2016-03-29 14:34 +0000 [42469df205] Mark Michelson * realtime: Add database scripts for 13.8.0 2016-03-22 13:32 +0000 [06f5ace1fa] Mark Michelson * ChangeLog: Updated for 13.8.0-rc1 2016-03-22 13:26 +0000 [a698424678] Mark Michelson * Release summaries: Add summaries for 13.8.0-rc1 2016-03-22 13:21 +0000 [e395a0b973] Mark Michelson * .version: Update for 13.8.0-rc1 2016-03-22 13:21 +0000 [38a86b2dbf] Mark Michelson * .lastclean: Update for 13.8.0-rc1 2016-03-22 13:21 +0000 [e0c8c8bf4a] Mark Michelson * realtime: Add database scripts for 13.8.0-rc1 2016-03-18 14:31 +0000 [6a40520fe9] Kevin Harwell * chan_pjsip: ref leak when checking direct_media_glare Fix the reference leak introduced in the following commit: 9444ddadf8525d1ce66a1faf1db97f9f6c265ca4 ASTERISK-25849 Change-Id: I5cfefd5ee6c1c3a1715c050330aaa10e4d2a5e85 2016-03-16 12:37 +0000 [9444ddadf8] Kevin Harwell * chan_pjsip: transfers with direct media reinvite has wrong address/port During a transfer involving direct media a race occurs between when the transferer channel is swapped out, initiating rtp changes/updates, and the subsequent reinvites. When Alice, after speaking with Charlie (Bob is on hold), connects Bob and Charlie invites are sent to each in order to establish the call between them. Bob is taken off hold and Charlie is told to have his media flow through Asterisk. However, if before those invites go out the bridge updates Bob's and/or Charlie's rtp information with direct media data (i.e. address, port) then the invite(s) will contain the remote data in the SDP instead of the Asterisk data. The race occurs in the native bridge glue code when updating the peer. The direct_media_address can get set twice before sending out the first invite during call connection. This can happen because the checking/setting of the direct_media_address happened in one thread while the sending of the invite(s) happened in another thread. This fix removes the race condition by moving the checking/setting of the direct_media_address to be in the same thread as the sending of the invites(s). This serializes the checking/setting and sending so they can no longer happen out of order. ASTERISK-25849 #close Change-Id: Idfea590175e74f401929a601dba0c91ca1a7f873 2015-10-19 07:11 +0000 [88240f98d9] Rodrigo Ramírez Norambuena * install_prereq: Update repositories before install on Debian systems When to install packages the indexed local is more old of the version of software on the repository they have been upgraded by security update then get the package will give 404 not found. The patch prevent by update local index to repository for aptitude before install. ASTERISK-25495 #close Reporte by: Rodrigo Ramírez Norambuena Change-Id: I645959e553aac542805ced394cac2dca964051fa (cherry picked from commit 88f3dbaec9509bfba8bc1de7799aa0dc65304bb5) 2015-06-03 20:12 +0000 [efcf9a96db] Rodrigo Ramírez Norambuena * install_prereq: Check if is installed aptitude otherwise to install. If in Debian or system based, dont have aptitude installed the script do nothing. This patch checked if aptitude installed, if not installed. Also, if execute script with all packages installed yet, the script not show nothing and return exit 1 because the command 'grep' get nothing from pipe from 'awk'. ASTERISK-25113 #close Reported By: Rodrigo Ramírez Norambuena Change-Id: Iebdff55805d3917166e5e08e0a1e2176f36ff27f (cherry picked from commit 6737ded0581a9e1256bdfe30c1d747e7ca93f8b3) 2016-03-03 04:43 +0000 [2b1b8e382a] Sergio Medina Toledo * res_pjsip_refer.c: Fix seg fault in process of Refer-to header. The "Refer-to" header of an incoming REFER request is parsed by pjsip_parse_uri(). That function requires the URI parameter to be NULL terminated. Unfortunately, the previous code added the NULL terminator by overwriting memory that may not be safe. The overwritten memory results could be benign, memory corruption, or a segmentation fault. Now the URI is NULL terminated safely by copying the URI to a new chunk of memory with the correct size to be NULL terminated. ASTERISK-25814 #close Change-Id: I32565496684a5a49c3278fce06474b8c94b37342 2016-03-11 12:22 +0000 [de04308ae4] Richard Mudgett * chan_sip.c: Fix mwi resub deadlock potential. This patch is part of a series to resolve deadlocks in chan_sip.c. Stopping a scheduled event can result in a deadlock if the scheduled event is running when you try to stop the event. If you hold a lock needed by the scheduled event while trying to stop the scheduled event then a deadlock can happen. The general strategy for resolving the deadlock potential is to push the actual starting and stopping of the scheduled events off onto the scheduler/do_monitor() thread by scheduling an immediate one shot scheduled event. Some restructuring may be needed because the code may assume that the start/stop of the scheduled events is immediate. ASTERISK-25023 #close Change-Id: I96d429c57a48861fd8bde63dd93db4e92dc3adb6 2016-03-10 17:01 +0000 [5f6627a8a4] Richard Mudgett * chan_sip.c: Fix registration timeout and expire deadlock potential. This patch is part of a series to resolve deadlocks in chan_sip.c. Stopping a scheduled event can result in a deadlock if the scheduled event is running when you try to stop the event. If you hold a lock needed by the scheduled event while trying to stop the scheduled event then a deadlock can happen. The general strategy for resolving the deadlock potential is to push the actual starting and stopping of the scheduled events off onto the scheduler/do_monitor() thread by scheduling an immediate one shot scheduled event. Some restructuring may be needed because the code may assume that the start/stop of the scheduled events is immediate. ASTERISK-25023 Change-Id: I2e40de89efc8ae6e8850771d089ca44bc604b508 2016-03-10 12:17 +0000 [32bd7a64f9] Richard Mudgett * chan_sip.c: Fix t38id deadlock potential. This patch is part of a series to resolve deadlocks in chan_sip.c. Stopping a scheduled event can result in a deadlock if the scheduled event is running when you try to stop the event. If you hold a lock needed by the scheduled event while trying to stop the scheduled event then a deadlock can happen. The general strategy for resolving the deadlock potential is to push the actual starting and stopping of the scheduled events off onto the scheduler/do_monitor() thread by scheduling an immediate one shot scheduled event. Some restructuring may be needed because the code may assume that the start/stop of the scheduled events is immediate. ASTERISK-25023 Change-Id: If595e4456cd059d7171880c7f354e844c21b5f5f 2016-03-09 16:34 +0000 [43556b800b] Richard Mudgett * chan_sip.c: Fix reinviteid deadlock potential. This patch is part of a series to resolve deadlocks in chan_sip.c. Stopping a scheduled event can result in a deadlock if the scheduled event is running when you try to stop the event. If you hold a lock needed by the scheduled event while trying to stop the scheduled event then a deadlock can happen. The general strategy for resolving the deadlock potential is to push the actual starting and stopping of the scheduled events off onto the scheduler/do_monitor() thread by scheduling an immediate one shot scheduled event. Some restructuring may be needed because the code may assume that the start/stop of the scheduled events is immediate. ASTERISK-25023 Change-Id: I9c11b9d597468f63916c99e1dabff9f4a46f84c1 2016-03-09 16:32 +0000 [38c1cdab2c] Richard Mudgett * chan_sip.c: Fix packet retransid deadlock potential. This patch is part of a series to resolve deadlocks in chan_sip.c. Stopping a scheduled event can result in a deadlock if the scheduled event is running when you try to stop the event. If you hold a lock needed by the scheduled event while trying to stop the scheduled event then a deadlock can happen. The general strategy for resolving the deadlock potential is to push the actual starting and stopping of the scheduled events off onto the scheduler/do_monitor() thread by scheduling an immediate one shot scheduled event. Some restructuring may be needed because the code may assume that the start/stop of the scheduled events is immediate. * Fix retrans_pkt() to call check_pendings() with both the owner channel and the private objects locked as required. * Refactor dialog retransmission packet list to safely remove packet nodes. The list nodes are now ao2 objects. The list has a ref and the scheduled entry has a ref. ASTERISK-25023 Change-Id: I50926d81be53f4cd3d572a3292cd25f563f59641 2016-03-09 16:26 +0000 [e4ad55c888] Richard Mudgett * chan_sip.c: Fix waitid deadlock potential. This patch is part of a series to resolve deadlocks in chan_sip.c. Stopping a scheduled event can result in a deadlock if the scheduled event is running when you try to stop the event. If you hold a lock needed by the scheduled event while trying to stop the scheduled event then a deadlock can happen. The general strategy for resolving the deadlock potential is to push the actual starting and stopping of the scheduled events off onto the scheduler/do_monitor() thread by scheduling an immediate one shot scheduled event. Some restructuring may be needed because the code may assume that the start/stop of the scheduled events is immediate. * Made always run check_pendings() under the scheduler thread so scheduler ids can be checked safely. ASTERISK-25023 Change-Id: Ia834d6edd5bdb47c163e4ecf884428a4a8b17d52 2016-03-08 15:08 +0000 [98d5669c28] Richard Mudgett * chan_sip.c: Fix session timers deadlock potential. This patch is part of a series to resolve deadlocks in chan_sip.c. Stopping a scheduled event can result in a deadlock if the scheduled event is running when you try to stop the event. If you hold a lock needed by the scheduled event while trying to stop the scheduled event then a deadlock can happen. The general strategy for resolving the deadlock potential is to push the actual starting and stopping of the scheduled events off onto the scheduler/do_monitor() thread by scheduling an immediate one shot scheduled event. Some restructuring may be needed because the code may assume that the start/stop of the scheduled events is immediate. ASTERISK-25023 Change-Id: I6d65269151ba95e0d8fe4e9e611881cde2ab4900 2016-03-07 13:21 +0000 [9cb8f73226] Richard Mudgett * chan_sip.c: Fix autokillid deadlock potential. This patch is part of a series to resolve deadlocks in chan_sip.c. Stopping a scheduled event can result in a deadlock if the scheduled event is running when you try to stop the event. If you hold a lock needed by the scheduled event while trying to stop the scheduled event then a deadlock can happen. The general strategy for resolving the deadlock potential is to push the actual starting and stopping of the scheduled events off onto the scheduler/do_monitor() thread by scheduling an immediate one shot scheduled event. Some restructuring may be needed because the code may assume that the start/stop of the scheduled events is immediate. * Fix clearing autokillid in __sip_autodestruct() even though we could reschedule. ASTERISK-25023 Change-Id: I450580dbf26e2e3952ee6628c735b001565c368f 2016-03-07 18:28 +0000 [c5c7f48a15] Richard Mudgett * chan_sip.c: Fix provisional_keepalive_sched_id deadlock. This patch is part of a series to resolve deadlocks in chan_sip.c. Stopping a scheduled event can result in a deadlock if the scheduled event is running when you try to stop the event. If you hold a lock needed by the scheduled event while trying to stop the scheduled event then a deadlock can happen. The general strategy for resolving the deadlock potential is to push the actual starting and stopping of the scheduled events off onto the scheduler/do_monitor() thread by scheduling an immediate one shot scheduled event. Some restructuring may be needed because the code may assume that the start/stop of the scheduled events is immediate. ASTERISK-25023 Change-Id: I98a694fd42bc81436c83aa92de03226e6e4e3f48 2016-03-09 11:22 +0000 [f959d84dfd] Richard Mudgett * chan_sip.c: Adjust how dialog_unlink_all() stops scheduled events. This patch is part of a series to resolve deadlocks in chan_sip.c. * Make dialog_unlink_all() unschedule all items at once in the sched thread. ASTERISK-25023 Change-Id: I7743072fb228836e8228b72f6dc46c8cc50b3fb4 2016-03-10 21:54 +0000 [5f3225ddcc] Richard Mudgett * chan_sip.c: Clear scheduled immediate events on unload. This patch is part of a series to resolve deadlocks in chan_sip.c. The reordering of chan_sip's shutdown is to handle any immediate events that get put onto the scheduler so resources aren't leaked. The typical immediate events at this time are going to be concerned with stopping other scheduled events. ASTERISK-25023 Change-Id: I3f6540717634f6f2e84d8531a054976f2bbb9d20 2016-03-15 14:51 +0000 [7a74971771] Richard Mudgett * sip/dialplan_functions.c: Fix /channels/chan_sip/test_sip_rtpqos crash. This patch is part of a series to resolve deadlocks in chan_sip.c. Delaying destruction of the chan_sip sip_pvt structures caused the /channels/chan_sip/test_sip_rtpqos unit test to crash. That test registers a special test ast_rtp_engine with the rtp engine module. When the unit test completes it cleans up by unregistering the test ast_rtp_engine and exits. Since the delayed destruction of the sip_pvt happens after the unit test returns, the destructor tries to call the rtp engine destroy callback of the test ast_rtp_engine auto variable which no longer exists on the stack. * Change the test ast_rtp_engine auto variable to a static variable. Now the variable can still exist after the unit test exits so the delayed sip_pvt destruction can complete successfully. ASTERISK-25023 Change-Id: I61e34a12d425189ef7e96fc69ae14993f82f3f13 2016-03-15 13:31 +0000 [d2c09ed73b] Andrew Nagy * app_stasis: Don't hang up if app is not registered This prevents pbx_core from hanging up the channel if the app isn't registered. ASTERISK-25846 #close Change-Id: I63216a61f30706d5362bc0906b50b6f0544aebce 2016-03-07 15:50 +0000 [b2d2906445] Richard Mudgett * sched.c: Ensure oldest expiring entry runs first. This patch is part of a series to resolve deadlocks in chan_sip.c. * Updated sched unit test to check new behavior. ASTERISK-25023 Change-Id: Ib69437327b3cda5e14c4238d9ff91b2531b34ef3 2016-03-04 18:25 +0000 [9ae21b510f] Richard Mudgett * chan_sip.c: Made sip_reinvite_retry() call sip_pvt_lock_full(). Change-Id: I90f04208a089f95488a2460185a8dbc3f6acca12 2016-03-07 18:56 +0000 [56bcb97a3c] Richard Mudgett * chan_sip.c: Simplify sip_pvt destructor call levels. Remove destructor calling destroy_it calling really_destroy_it for no benefit. Just make the destructor the really_destroy_it function. Change-Id: Idea0d47b27dd74f2488db75bcc7f353d8fdc614a 2016-03-14 08:59 +0000 [677a65fcbb] Joshua Colp * build: Add configure check for proto field of PJSIP TLS transport setting. Older versions of PJSIP do not have the proto field on the TLS transport setting structure. This change adds a configure check so even if it is not present we will still be able to build. Change-Id: Ibf3f47befb91ed1b8194bf63888baa6fee05aba9 2016-03-12 16:02 +0000 [32f0a3d52a] gtjoseph * build_system: Split COMPILE_DOUBLE from DONT_OPTIMIZE I can't ever recall actually needing the intermediate files or the checking that a double compile produces. What I CAN remember is every DONT_OPTIMIZE build needing 3 invocations of gcc instead of 1 just to do the checks and produce those intermediate files. Having said that, Richard pointed out that the reason for the double compile was that there were cases in the past where a submitted patch failed to compile because the submitter never tried it with the optimizations turned on. To get the best of both worlds, COMPILE_DOUBLE has been split into its own option. If DONT_OPTIMIZE is turned on, COMPILE_DOUBLE will also be selected BUT you can then turn it off if all you need are the debugging symbols. This way you have to make an informed decision about disabling COMPILE_DOUBLE. To allow COMPILE_DOUBLE to be both auto-selected and turned off, a new feature was added to menuselect. The element can now contain an "autoselect" attribute which will turn the used member on but not create a hard dependency. The cflags.xml implementation for COMPILE_DOUBLE looks like this... COMPILE_DOUBLE core * app_chanspy: Fix occasional deadlock with ChanSpy and Local channels. Channel masquerading had a conflict with autochannel locking. When locking autochannel->channel, the channel is fetched from the autochannel and then locked. During the fetch, the autochannel -- which has no locks itself -- can be modified by someone who owns the channel lock. That means that the value of autochan->channel cannot be trusted until you hold the lock. In practice, this caused problems with Local channels getting masqueraded away while the ChanSpy attempted to get info from that channel. The old channel which was about to get removed got locked, but the new (replaced) channel got unlocked (no-op). Because the replaced channel was now locked (and would never get unlocked), it couldn't get removed from the channel list in a timely manner, and would now cause deadlocks when iterating over the channel list. This change checks the autochannel after locking the channel for changes to the autochannel. If the channel had been changed, the lock is reobtained on the new channel. In theory it seems possible that after this fix, the lock attempt on the old (wrong) channel can be on an already destroyed lock, maybe causing a crash. But that hasn't been observed in the wild and is harder induce than the current deadlock. Thanks go to Filip Frank for suggesting a fix similar to this and especially to IRC user hexanol for pointing out why this deadlock was possible and testing this fix. And to Richard for catching my rookie while loop mistake ;) ASTERISK-25321 #close Change-Id: I293ae0014e531cd0e675c3f02d1d118a98683def 2016-03-07 21:34 +0000 [875d5e9872] gtjoseph * pjproject_bundled: Remove --with-external-pa from configure options. Not sure why it was there in the first place as we already specify --disable-sound. Change-Id: Ia80a40e8b1e1acc287955ab11ba1fbd0c7d4cff9 2016-03-06 14:38 +0000 [530cff5f5f] gtjoseph * res_pjsip: Strip spaces from items parsed from comma-separated lists Configurations like "aors = a, b, c" were either ignoring everything after "a" or trying to look up " b". Same for mailboxes, ciphers, contacts and a few others. To fix, all the strsep(©, ",") calls have been wrapped in ast_strip. To facilitate this, ast_strip, ast_skip_blanks and ast_skip_nonblanks were updated to handle null pointers. In some cases, an ast_strlen_zero() test was added to skip consecutive commas. There was also an attempt to ast_free an ast_strdupa'd string in ast_sip_for_each_aor which was causing a SEGV. I removed it. Although this issue was reported for realtime, the issue was in the res_pjsip modules so all config mechanisms were affected. ASTERISK-25829 #close Reported-by: Mateusz Kowalski Change-Id: I0b22a2cf22a7c1c50d4ecacbfa540155bec0e7a2 2016-03-04 20:37 +0000 [3c8076a83b] gtjoseph * install_prereq: Add packages for bundled pjproject RedHat/CentOS needs python-devel Debian/Ubuntu needs automake, libsrtp-dev and python-dev Ubuntu also needed libncurses5-dev for cmenuselect so while not needed for pjproject, I adedd it anyway. Change-Id: Idf5fa16e2d87c687439621507e122cb9461d7089 2016-02-24 17:25 +0000 [27f32cd0a6] gtjoseph * res_pjsip_caller_id: Anonymize 'From' when caller id presentation is prohibited Per RFC3325, the 'From' header is now anonymized on outgoing calls when caller id presentation is prohibited. TID = trust_id_outbound PRO = Set(CALLERID(pres)=prohib) USR = endpoint/from_user DOM = endpoint/from_domain PAI = YES(privacy=off), NO(not sent), PRI(privacy=full) (assumes send_pai=yes) Conditions |Result --------------------|---------------------------------------------------- TID PRO USR DOM |PAI FROM --------------------|---------------------------------------------------- Y Y abc def.ghi |PRI "Anonymous" Y Y abc |PRI "Anonymous" Y Y def.ghi |PRI "Anonymous" Y Y |PRI "Anonymous" Y N abc def.ghi |YES Y N abc |YES > Y N def.ghi |YES "Caller Name" @def.ghi> Y N |YES "Caller Name" @> N Y abc def.ghi |NO "Anonymous" N Y abc |NO "Anonymous" N Y def.ghi |NO "Anonymous" N Y |NO "Anonymous" N N abc def.ghi |YES N N abc |YES > N N def.ghi |YES "Caller Name" @def.ghi> N N |YES "Caller Name" @> ASTERISK-25791 #close Reported-by: Anthony Messina Change-Id: I2c82a5ca1413c2c00fb62ea95b0ae8e97af54dc9 2016-03-03 17:34 +0000 [7cf7b0a4f9] gtjoseph * third_party/Makefile.rules: Replace unsupported != operator with $(shell ...) Apparently the != operator is fairly new so I've replaced it with the old $(shell ...) syntax. Change-Id: I16b2e1878a4f91e7e9740abd427f9639f933c479 Reported-by: Richard Mudgett 2016-01-23 15:50 +0000 [53f57001f2] gtjoseph * loader: Retry dlopen when loading fails Although we use the RTLD_LAZY flag when calling dlopen the first time on a module, this only defers resolution for function calls. Pointer references to functions are determined at link time so dlopen expects them to be there. Since we don't cross-module link, pointers to functions in other modules won't be available and dlopen will fail. Doing a "hardened" build also causes problems because it typically sets "-z now" on the ld command line which overrides RTLD_LAZY at run time. If the failing module isn't a GLOBAL_SYMBOLS module, then dlopen will be called again after all the GLOBAL_SYMBOLS modules have been loaded and they'll eventually resolve. If the calling module IS a GLOBAL_SYMBOLS module itself and a third module depends on it, then there's an issue because the second time through the dlopen loop, GLOBAL_SYMBOLS modules aren't given any special treatment and since the order in which dlopen is called isn't deterministic, the dependent may again be tried before the module it needs is loaded. Simple solution: Save modules that fail load_resource because of a dlopen error in a list and retry them immediately after the first pass. Keep retrying until the failed list is empty or we reach a #defined max retries. Error messages are suppressed until the final pass which also gets rid of those confusing error messages about module failures that are later corrected. Change-Id: Iddae1d97cd2f00b94e61662447432765755f64bb 2016-03-01 16:18 +0000 [40d9e9e238] Kevin Harwell * bridge.c: Crash during attended transfer when missing a local channel half It's possible for the transferer channel to get hung up early during the attended transfer process. For instance, a phone may send a "bye" immediately upon receiving a sip notify that contains a sip frag 100 (I'm looking at you Jitsi). When this occurs a race begins between the transferer being hung up and completion of the transfer code. If the channel hangs up too early during a transfer involving stasis bridging for instance, then when the created local channel goes to look up its swap channel (and associated datastore) it can't find it (since it is no longer in the bridge) thus it fails to enter the stasis application. Consequently, the created local channel(s) hang up as well. If the timing is just right then the bridging code attempts to add the message link with missing local channel(s). Hence the crash. Unfortunately, there is no great way to solve the problem of the unexpected "bye". While we can't guarantee we won't receive an early hangup, and in this case still fail to enter the stasis application, we can make it so asterisk does not crash. This patch does just that by locking the local channel structure, checking that the local channel's peer has not been lost, and then continuing. This keeps the local channel's peer from being ripped out from underneath it by the local/unreal hangup code while attempting to set the stasis message link. ASTERISK-25771 Change-Id: Ie6d6061e34c7c95f07116fffac9a09e5d225c880 2016-03-01 18:08 +0000 [ff3da61c35] Kevin Harwell * res_pjsip_refer.c: Delay sending the initial SIP Notify with frag 100 During the transfer process, some phones (okay it was the Jitsi softphone, but maybe others are out there) send a "bye" immediately after receiving a SIP Notify. When a "bye" is received early for some types of transfers the transferer channel may no longer be available during late stage transfer processing. For instance, during an attended transfer involving stasis bridging at one point the created local channel looks for an associated swap channel in order to retrieve the stasis application name. If the transferer has hung up then the local channel will fail to find it. The local channel then has no way to know which stasis app to enter, so it fails and hangs up as well. Thus the transfer does not complete as expected. This patch delays the sending of the initial notify in order to give the transfer process enough time to gather the necessary data for a successful transfer. ASTERISK-25771 Change-Id: I09cfc9a5d6ed4c007bc70625e0972b470393bf16 2016-03-03 08:26 +0000 [26b8f2692e] Joshua Colp * res_pjsip_dtmf_info: NULL terminate the message body. PJSIP does not ensure that when printing the message body the buffer will be NULL terminated. This is problematic when searching for the signal and duration values of the DTMF. This change ensures the buffer is always NULL terminated. Change-Id: I52653a1a60c93092d06af31a27408d569cc98968 2016-03-01 20:03 +0000 [86d6e44cc1] gtjoseph * alembic: Fix downgrade and tweak for sqlite Downgrade had a few issues. First there was an errant 'update' statement in add_auto_dtmf_mode that looks like it was a copy/paste error. Second, we weren't cleaning up the ENUMs so subsequent upgrades on postgres failed because the types already existed. For sqlite... sqlite doesn't support ALTER or DROP COLUMN directly. Fortunately alembic batch_operations takes care of this for us if we use it so the alter and drops were converted to use batch operations. Here's an example downgrade: with op.batch_alter_table('ps_endpoints') as batch_op: batch_op.drop_column('tos_audio') batch_op.drop_column('tos_video') batch_op.add_column(sa.Column('tos_audio', yesno_values)) batch_op.add_column(sa.Column('tos_video', yesno_values)) batch_op.drop_column('cos_audio') batch_op.drop_column('cos_video') batch_op.add_column(sa.Column('cos_audio', yesno_values)) batch_op.add_column(sa.Column('cos_video', yesno_values)) with op.batch_alter_table('ps_transports') as batch_op: batch_op.drop_column('tos') batch_op.add_column(sa.Column('tos', yesno_values)) # Can't cast integers to YESNO_VALUES, so dropping and adding is required batch_op.drop_column('cos') batch_op.add_column(sa.Column('cos', yesno_values)) Upgrades from base to head and downgrades from head to base were tested repeatedly for postgresql, mysql/mariadb, and sqlite3. Change-Id: I862b0739eb3fd45ec3412dcc13c2340e1b7baef8 2016-03-02 15:55 +0000 [6f0d7ce9db] gtjoseph * config_transport: Fix objects returned by ast_sip_get_transport_states ast_sip_get_transport_states was returning a container of internal_state objects instead of ast_sip_transport_state objects. This was causing transport lookups to fail, most noticably in res_pjsip_nat, which couldn't find the correct external addresses. This was causing contacts to go out with internal ip addresses. ASTERISK-25830 #close Reported-by: Sean Bright Change-Id: I1aee6a2fd46c42e8dd0af72498d17de459ac750e 2016-03-02 11:17 +0000 [1ea7a5a774] Scott Griepentrog * CHAOS: cleanup possible null vars on msg alloc failure In message.c, if msg_alloc fails to init the string field, vars may be null, so use a null tolerant cleanup. In res_pjsip_messaging.c, if msg_data_create fails, mdata will be null, so use a null tolerant cleanup. ASTERISK-25323 Change-Id: Ic2d55c2c3750d5616e2a05ea92a19c717507ff56 2016-03-02 09:34 +0000 [3c37c7071f] Scott Griepentrog * CHAOS: prevent crash on failed strdup This patch avoids crashing on a null pointer if the strdup() allocation fails. ASTERISK-25323 Change-Id: I3f67434820ba53b53663efd6cbb42749f4f6c0f5 2016-02-29 18:11 +0000 [9633be9d25] Richard Mudgett * func_callerid.c: Update REDIRECTING reason documentation. Change-Id: I6e8d39b0711110a4bceafa652e58b30465e28386 2016-02-26 18:57 +0000 [4165ea7778] Richard Mudgett * SIP diversion: Fix REDIRECTING(reason) value inconsistencies. Previous chan_sip behavior: Before this patch chan_sip would always strip any quotes from an incoming reason and pass that value up as the REDIRECTING(reason). For an outgoing reason value, chan_sip would check the value against known values and quote any it didn't recognize. Incoming 480 response message reason text was just assigned to the REDIRECTING(reason). Previous chan_pjsip behavior: Before this patch chan_pjsip would always pass the incoming reason value up as the REDIRECTING(reason). For an outgoing reason value, chan_pjsip would send the reason value as passed down. With this patch: Both channel drivers match incoming reason values with values documented by REDIRECTING(reason) and values documented by RFC5806 regardless of whether they are quoted or not. RFC5806 values are mapped to the equivalent REDIRECTING(reason) documented value and is set in REDIRECTING(reason). e.g., an incoming RFC5806 'unconditional' value or a quoted string version ('"unconditional"') is converted to REDIRECTING(reason)'s 'cfu' value. The user's dialplan only needs to deal with 'cfu' instead of any of the aliases. The incoming 480 response reason text supported by chan_sip checks for known reason values and if not matched then puts quotes around the reason string and assigns that to REDIRECTING(reason). Both channel drivers send outgoing known REDIRECTING(reason) values as the unquoted RFC5806 equivalent. User custom values are either sent as is or with added quotes if SIP doesn't allow a character within the value as part of a RFC3261 Section 25.1 token. Note that there are still limitations on what characters can be put in a custom user value. e.g., embedding quotes in the middle of the reason string is silly and just going to cause you grief. * Setting a REDIRECTING(reason) value now recognizes RFC5806 aliases. e.g., Setting REDIRECTING(reason) to 'unconditional' is converted to the 'cfu' value. * Added missing malloc() NULL return check in res_pjsip_diversion.c set_redirecting_reason(). * Fixed potential read from a stale pointer in res_pjsip_diversion.c add_diversion_header(). The reason string needed to be copied into the tdata memory pool to ensure that the string would always be available. Otherwise, if the reason string returned by reason_code_to_str() was a user's reason string then the string could be freed later by another thread. Change-Id: Ifba83d23a195a9f64d55b9c681d2e62476b68a87 2016-02-26 18:54 +0000 [41f4af4ce5] Richard Mudgett * res_pjsip_send_to_voicemail.c: Allow either quoted or not send_to_vm reason. Change-Id: Id6350b3c7d4ec8df7ec89863566645e2b0f441fd 2016-02-29 20:41 +0000 [4c5998ff55] Richard Mudgett * res_pjsip_send_to_voicemail.c: Fix off-nominal double channel unref. * Fix double unref of other_party channel in off nominal path. * This is unlikely to be a real problem. However, for safety, in handle_incoming_request() keep the datastore ref with the other_party channel ref until we are finished with the other_party channel. Change-Id: I78f22547bf0bb99fb20814ceab75952bd857f821 2016-01-18 21:54 +0000 [b59956a875] gtjoseph * build-system: Allow building with static pjproject Background here: http://lists.digium.com/pipermail/asterisk-dev/2016-January/075266.html From CHANGES: * To help insure that Asterisk is compiled and run with the same known version of pjproject, a new option (--with-pjproject-bundled) has been added to ./configure. When specified, the version of pjproject specified in third-party/versions.mak will be downloaded and configured. When you make Asterisk, the build process will also automatically build pjproject and Asterisk will be statically linked to it. Once a particular version of pjproject is configured and built, it won't be configured or built again unless you run a 'make distclean'. To facilitate testing, when 'make install' is run, the pjsua and pjsystest utilities and the pjproject python bindings will be installed in ASTDATADIR/third-party/pjproject. The default behavior remains building with the shared pjproject installation, if any. Building: All you have to do is include the --with-pjproject-bundled option on the ./configure command line (and remove any existing --with-pjproject option if specified). Everything else is automatic. Behind the scenes: The top-level Makefile was modified to include 'third-party' in the list of MOD_SUBDIRS. The third-party directory was created to contain any third party packages that may be needed in the future. Its Makefile automatically iterates over any subdirectories passing on targets. The third-party/pjproject directory was created to house the pjproject source distribution. Its Makefile contains targets to download, patch configure, generate dependencies, compile libs, apps and python bindings, sanitized build.mak and generate a symbols list. When bootstrap.sh is run, it automatically includes the configure.m4 file in third-party/pjproject. This file has a macro to download and conifgure pjproject and get and set PJPROJECT_INCLUDE, PJPROJECT_DIR and PJPROJECT_BUNDLED. It also tests for the capabilities like PJ_TRANSACTION_GRP_LOCK by parsing preprocessor output as opposed to trying to compile. Of course, bootstrap.sh is only run once and the configure file is incldued in the patch. When configure is run with the new options, the macro in configure.m4 triggers the download, patch, conifgure and tests. No compilation is performed at this time. The downloaded tarball is cached in /tmp so it doesn't get downloaded again on a distclean. When make is run in the top-level Asterisk source directory, it will automatically descend all the subdirectories in third_party just as it does for addons, apps, etc. The top-level Makefile makes sure that the 'third-party' is built before 'main' so that dependencies from the other directories are built first. When main does build, a new shared library (libasteriskpj) is created that links statically to the pjproject .a files and exports all their symbols. The asterisk binary links to that, just as it does with libasteriskssl. When Asterisk is installed, the pjsua and pjsystest apps, and the pjproject python bindings are installed in ASTDATADIR/third-party/pjproject. This will facilitate testing, including running the testsuite which will be updated to check that directory for the pjsua module ahead of the system python library. Modules should continue to depend on pjproject if they use pjproject APIs directly. They should not care about the implementation. No changes to any res_pjsip modules were made. Change-Id: Ia7a60c28c2e9ba9537c5570f933c1ebcb20a3103 2016-02-22 16:59 +0000 [18a323e542] Richard Mudgett * chan_sip.c: Fix T.38 issues caused by leaving a bridge. chan_sip could not handle AST_T38_TERMINATED frames being sent to it when the channel left the bridge. The action resulted in overlapping outgoing reINVITEs. The testsuite tests/fax/sip/directmedia_reinvite_t38 was not happy. * Force T.38 to be remembered as locally bridged. Now when the channel leaves the native RTP bridge after T.38, the channel remembers that it has already reINVITEed the media back to Asterisk. It just needs to terminate T.38 when the AST_T38_TERMINATED arrives. * Prevent redundant AST_T38_TERMINATED from causing problems. Redundant AST_T38_TERMINATED frames could cause overlapping outgoing reINVITEs if they happen before the T.38 state changes to disabled. Now the T.38 state is set to disabled before the reINVITE is sent. ASTERISK-25582 #close Change-Id: I53f5c6ce7d90b3f322a942af1a9bcab6d967b7ce 2016-02-18 18:27 +0000 [263a39f2cc] Richard Mudgett * res_pjsip_t38.c: Back out part of an earlier fix attempt. This backs out item 4 of the 4875e5ac32f5ccad51add6a4216947bfb385245d commit. Item 4 added the t38_bye_supplement. Unfortunately, the frame that it puts into the bridge may or may not be processed by the time the bridged peer is kicked out of the bridge. If it is processed then all is well. However, if it is not processed then that channel is stuck in fax mode until it hangs up or maybe if it joins another bridge for T.38 faxing. ASTERISK-25582 Change-Id: Ib20a03ecadf1bf8a0dcadfadf6c2f2e60919a9f7 2016-02-22 13:54 +0000 [221422be50] Richard Mudgett * bridge core: Add owed T.38 terminate when channel leaves a bridge. The channel is now going to get T.38 terminated when it leaves the bridging system and the bridged peers are going to get T.38 terminated as well. ASTERISK-25582 Change-Id: I77a9205979910210e3068e1ddff400dbf35c4ca7 2016-02-19 16:01 +0000 [0a5bc64491] Richard Mudgett * channel api: Create is_t38_active accessor functions. ASTERISK-25582 Change-Id: I69451920b122de7ee18d15bb231c80ea7067a22b 2016-02-19 19:06 +0000 [513638a5f4] Richard Mudgett * bridge_channel: Don't settle owed events on an optimization. Local channel optimization could cause DTMF digits to be duplicated. Pending DTMF end events would be posted to a bridge when the local channel optimizes out and is replaced by the channel further down the chain. When the real digit ends, the channel would get another DTMF end posted to the bridge. A -- LocalA;1/n -- LocalA;2/n -- LocalB;1 -- LocalB;2 -- B 1) LocalA has the /n flag to prevent optimization. 2) B is sending DTMF to A through the local channel chain. 3) When LocalB optimizes out it can move B to the position of LocalB;1 4) Without this patch, when B swaps with LocalB;1 then LocalB;1 would settle an owed DTMF end to the bridge toward LocalA;2. 5) When B finally ends its DTMF it sends the DTMF end down the chain. 6) Without this patch, A would hear the DTMF digit end when LocalB optimizes out and when B ends the original digit. ASTERISK-25582 Change-Id: I1bbd28b8b399c0fb54985a5747f330a4cd2aa251 2016-02-22 12:15 +0000 [7c4495cb70] Richard Mudgett * channel.c: Route all control frames to a channel through the same code. Frame hooks can conceivably return a control frame in exchange for an audio frame inside ast_write(). Those returned control frames were not handled quite the same as if they were sent to ast_indicate(). Now it doesn't matter if you use ast_write() to send an AST_FRAME_CONTROL to a channel or ast_indicate(). ASTERISK-25582 Change-Id: I5775f41421aca2b510128198e9b827bf9169629b 2016-02-25 15:13 +0000 [48d713a832] gtjoseph * sorcery: Refactor create, update and delete to better deal with caches The ast_sorcery_create, update and delete function have been refactored to better deal with caches and errors. The action is now called on all non-caching wizards first. If ANY succeed, the action is called on all caching wizards and the observers are notified. This way we don't put something in the cache (or update or delete) before knowing the action was performed in at least 1 backend and we only call the observers once even if there were multiple writable backends. ast_sorcery_create was never adding to caches in the first place which was preventing contacts from getting added to a memory_cache when they were created. In turn this was causing memory_cache to emit errors if the contact was deleted before being retrieved (which would have populated the cache). ASTERISK-25811 #close Reported-by: Ross Beer Change-Id: Id5596ce691685a79886e57b0865888458d6e7b46 2016-02-25 15:39 +0000 [ee947d4a7a] gtjoseph * res_pjsip_mwi: Turn some NOTICEs and WARNINGs into debug 1s. There are a few cases where we're emitting notices or warnings for things that really need neither, like a client retrying to subscribe to mwi when they're not conifgured for it. They get a 404 so there's no need for non-debug messages. Change-Id: I05e38a7ff6c2f2521146f4be6a79731b9864e61f 2016-02-25 14:17 +0000 [6e70e8ccdb] gtjoseph * res_sorcery_memory_cache: Fix SEGV in some CLI commands A few of the CLI commands weren't checking for enough arguments and were SEGVing. Change-Id: Ie6494132ad2fe54b4f014bcdc112a37c36a9b413 2016-02-25 10:29 +0000 [4417f64d83] Leif Madsen * Add initial support to build Docker images This work-in-progress is the first step to being able to reliably build Asterisk containers from the Asterisk source. I'm submitting this based on feedback gained at AstriDevCon 2015. Information about how to use this is provided in contrib/docker/README.md and will result in a local Asterisk container being built right from your source. I believe this can eventually be automated via hub.docker.com. Change-Id: Ifa070706d40e56755797097b6ed72c1e243bd0d1 2016-02-22 19:31 +0000 [e7a6abbbd3] Richard Mudgett * rtp_engine.h: Remove extraneous semicolons. Change-Id: Ib462633d396fa941379dfef648dcd2245e350084 2016-02-23 14:57 +0000 [6656afffa0] Richard Mudgett * chan_sip.c: Suppress T.38 SDP c= line if addr is the same. Use the correct comparison function since we only care if the address without the port is the same. Change-Id: Ibf6c485f843a1be6dee58a47b33d81a7a8cbe3b0 2016-02-16 08:14 +0000 [ea9deff996] Christof Lauber * res_config_sqlite3: Fix crashes when reading peers from sqlite3 tables Introduced realloaction of ast_str buf in sqlite3_escape functions in case the returned buffer from threadstorage was actually too small. Change-Id: I3c5eb43aaade93ee457943daddc651781954c445 2016-02-11 11:01 +0000 [d2a1457e0b] gtjoseph * res_pjsip/config_transport: Allow reloading transports. The 'reload' mechanism actually involves closing the underlying socket and calling the appropriate udp, tcp or tls start functions again. Only outbound_registration, pubsub and session needed work to reset the transport before sending requests to insure that the pjsip transport didn't get pulled out from under them. In my testing, no calls were dropped when a transport was changed for any of the 3 transport types even if ip addresses or ports were changed. To be on the safe side however, a new transport option was added (allow_reload) which defaults to 'no'. Unless it's explicitly set to 'yes' for a transport, changes to that transport will be ignored on a reload of res_pjsip. This should preserve the current behavior. Change-Id: I5e759850e25958117d4c02f62ceb7244d7ec9edf 2016-02-07 17:34 +0000 [6b921f706d] gtjoseph * res_pjproject: Add ability to map pjproject log levels to Asterisk log levels Warnings and errors in the pjproject libraries are generally handled by Asterisk. In many cases, Asterisk wouldn't even consider them to be warnings or errors so the messages emitted by pjproject directly are either superfluous or misleading. A good exampe of this are the level-0 errors pjproject emits when it can't open a TCP/TLS socket to a client to send an OPTIONS. We don't consider a failure to qualify a UDP client an "ERROR", why should a TCP/TLS client be treated any differently? A config file for res_pjproject has bene added (pjproject.conf) and a new log_mappings object allows mapping pjproject levels to Asterisk levels (or nothing). The defaults if no pjproject.conf file is found are the same as those that were hard-coded into res_pjproject initially: 0,1 = LOG_ERROR, 2 = LOG_WARNING, 3,4,5 = LOG_DEBUG Change-Id: Iba7bb349c70397586889b8f45b8c3d6c6c8c3898 2016-02-18 10:55 +0000 [f295088764] Alexei Gradinari * res_pjsip_outbound_publish: Fix processing 412 response When Asterisk receives a 412 (Conditional Request Failed) response it has to recreate publish session. There is bug in res_pjsip_outbound_publish.c The function sip_outbound_publish_client_alloc is called with wrong object while processing 412 (Conditional Request Failed) response. This patch fixes it. ASTERISK-25229 #close Change-Id: I3b62f2debf6bb1e5817cde7b13ea39ef2bf14359 2016-02-18 11:15 +0000 [f1f79812c1] Mark Michelson * Fix failing threadpool_auto_increment test. The threadpool_auto_increment test fails infrequently for a couple of reasons * The threadpool listener was notified of fewer tasks being pushed than were actually pushed * The "was_empty" flag was set to an unexpected value. The problem is that the test pushes three tasks into the threadpool. Test expects the threadpool to essentially gather those three tasks, and then distribute those to the threadpool threads. It also expects that as the tasks are pushed in, the threadpool listener is alerted immediately that the tasks have been pushed. In reality, a task can be distributed to the threadpool threads quicker than expected, meaning that the threadpool has already emptied by the time each subsequent task is pushed. In addition, the internal threadpool queue can be delayed so that the threadpool listener is not alerted that a task has been pushed even after the task has been executed. From the test's point of view, there's no way to be able to predict exactly the order that task execution/listener notifications will occur, and there is no way to know which listener notifications will indicate that the threadpool was previously empty. For this reason, the test has been updated to only check the things it can check. It ensures that all tasks get executed, that the threads go idle after the tasks are executed, and that the listener is told the proper number of tasks that were pushed. Change-Id: I7673120d74adad64ae6894594a606e102d9a1f2c 2016-02-16 23:37 +0000 [79dc5e2f00] Rodrigo Ramírez Norambuena * app_queue: fix Calculate talktime when is first call answered Fix calculate of average time for talktime is wrong when is completed the first call beacuse the time for talked would be that call. ASTERISK-25800 #close Change-Id: I94f79028935913cd9174b090b52bb300b91b9492 2016-02-17 13:30 +0000 [5a3a857dd6] Richard Mudgett * cel.c: Fix mismatch in ast_cel_track_event() return type. The return type of ast_cel_track_event() is not large enough to return all 64 potential bits of the event enable mask. Fortunately, the defined CEL events do not really need all 64 bits and the return value is only used to determine if the requested CEL event is enabled. * Made the ast_cel_track_event() return 0 or 1 only so the return value can fit inside an int type instead of zero or a truncated 64 bit non-zero value. Change-Id: I783d932320db11a95c7bf7636a72b6fe2566904c 2016-02-16 16:37 +0000 [87ab65c557] gtjoseph * res_odbc: Fix exports.in for missing symbols res_odbc.exports.in was missing a few symbols. Changed to wildcards. Change-Id: Ieadd76df24e43ea92577f651d478a0f7b742c30c 2016-02-16 12:20 +0000 [c0f3062031] gtjoseph * res_statsd: Fix exports.in for missing symbols res_statsd.export.in was missing the _va variations of the log functions causing Asterisk to crash in res_pjsip if OPTIONAL_API wasn't enabled. ASTERISK-25727 #close Reported-by: Gergely Dömsödi Change-Id: I395729f9f51bdd33c5ca757f5f96ebedad74077b 2016-02-15 21:31 +0000 [5e848dae7b] gtjoseph * res_pjsip_config_wizard: Add command to export primitive objects A new command (pjsip export config_wizard primitives) has been added that will export all the pjsip objects it created to the console or a file suitable for reuse in a pjsip.conf file. ASTERISK-24919 #close Reported-by: Ray Crumrine Change-Id: Ica2a5f494244b4f8345b0437b16d06aa0484452b 2016-02-15 15:37 +0000 [34c64707d1] gtjoseph * res_pjsip_caller_id: Fix segfault when replacing rpid or pai header If the PJSIP_HEADER dialplan function adds a PAI or RPID header and send_rpid or send_pai is set, res_pjsip_caller_id attemps to retrieve, parse and modify the header added by the dialplan function. Since the header added by the dialplan function is generic string, there are no virtual functions to parse the uri and we get a segfault when we try. Since the modify, was really only an overwrite, we now just delete the old header if it was type PJSIP_H_OTHER and recreate it. This raises a question for another time though: What should happen with duplicate headers? Right now res_pjsip_header_funcs doesn't check for dups so if it's session supplement is loaded after res_pjsip_caller_id's (or any other module that adds headers), there'll be dups in the message. ASTERISK-25337 #close Change-Id: I5e296b52d30f106b822c0eb27c4c2b0e0f71c7fa 2016-02-15 13:08 +0000 [ebe167f792] Mark Michelson * Fix creation race of contact_status structures. It is possible when processing a SIP REGISTER request to have two threads end up creating contact_status structures in sorcery. contact_status is created using a "find or create" function. If two threads call into this at the same time, each thread will fail to find an existing contact_status, and so both will end up creating a new contact status. During testing, we would see sporadic failures because the PJSIP_CONTACT() dialplan function would operate on a different contact_status than what had been updated by res_pjsip/pjsip_options. The fix here is two-fold: 1) The "find or create" function for contact_status now has a lock around the entire operation. This way, if two threads attempt the operation simultaneously, the first to get there will create the object, and the second will find the object created by the first thread. 2) res_sorcery_memory has had its create callback updat