summaryrefslogtreecommitdiff
path: root/main
AgeCommit message (Collapse)Author
2016-05-26res_pjsip: add "via_addr", "via_port", "call_id" to contactAlexei Gradinari
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-25Merge "Bridging: introduce "invisible" bridges."Joshua Colp
2016-05-24threadpool: Fix potential data race.Corey Farrell
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-23Bridging: introduce "invisible" bridges.Mark Michelson
Invisible bridges function the same as normal bridges, but they have the following restrictions: * They never show up in CLI, AMI, or ARI queries. * They do not have Stasis messages published about them. Invisible bridges' main use is for when use of the bridging system is desired, but the bridge should not be known to users of the Asterisk system. ASTERISK-25925 Change-Id: I804a209d3181d7c54e3d61a60eb462e7ce0e3670
2016-05-19Merge "udptl: Don't eat sequence numbers until OK is received"Joshua Colp
2016-05-19Merge "logger: Support JSON logging with Verbose messages"Joshua Colp
2016-05-18udptl: Don't eat sequence numbers until OK is receivedGeorge Joseph
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-14logger: Support JSON logging with Verbose messagesMatt Jordan
When 2d7a4a3357 was merged, it missed the fact that Verbose log messages are formatted and handled by 'verbosers'. Verbosers are registered functions that handle verbose messages only; they exist as a separate class of callbacks. This was done to handle the 'magic' that must be inserted into Verbose messages sent to remote consoles, so that the consoles can format the messages correctly, i.e., the leading tabs/characters. In reality, verbosers are a weird appendage: they're a separate class of formatters/message handlers outside of what handles all other log messages in Asterisk. After some code inspection, it became clear that simply passing a Verbose message along with its 'sublevel' importance through the normal logging mechanisms removes the need for verbosers altogether. This patch removes the verbosers, and makes the default log formatter aware that, if the log channel is a console log, it should simply insert the 'verbose magic' into the log messages itself. This allows the console handlers to interpret and format the verbose message themselves. This simplifies the code quite a lot, and should improve the performance of printing verbose messages by a reasonable factor: (1) It removes a number of memory allocations that were done on each verobse message (2) It removes the need to strip the verbose magic out of the verbose log messages before passing them to non-console log channels (3) It now performs fewer iterations over lists when handling verbose messages Since verbose messages are now handled like other log messages (for the most part), the JSON formatting of the messages works as well. ASTERISK-25425 Change-Id: I21bf23f0a1e489b5102f8a035fe8871552ce4f96
2016-05-14Merge "logger: Add PID to syslog messages."Joshua Colp
2016-05-12Use doubles instead of floats for conversions when comparing strings.Mark Michelson
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-12logger: Add PID to syslog messages.Alexei Gradinari
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-09Merge "datastore: Add common container based datastores API."zuul
2016-05-09datastore: Add common container based datastores API.Joshua Colp
This change introduces a common container based datastores management API. This has been done in a few places across the tree but this consolidates all of the logic into one place in a generic fashion. ASTERISK-25999 Change-Id: I72eb15941dcdbc2a37bb00a33ce00f8755bd336a
2016-05-09Merge "file: Ensure nativeformats remains valid for lifetime of use."Joshua Colp
2016-05-06stasis_endpoints: Add new Status and Headers to ContactStatusAlexei Gradinari
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-05file: Ensure nativeformats remains valid for lifetime of use.Joshua Colp
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-04config_options.c: Expand #ifdef to contain whole if statement.Chris Trobridge
ASTERISK-25956 #close Change-Id: If6961ec54be276d5ab4f012ee7e7b420cb45de38
2016-05-03pjproject_bundled: Various fixes discovered during testing of OSesGeorge Joseph
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-04-28Merge "app_chanspy: reduce audio loss on the spying channel."zuul
2016-04-27Merge "config: Fix ast_config_text_file_save2 writability check for missing ↵Joshua Colp
files"
2016-04-27app_chanspy: reduce audio loss on the spying channel.Jean Aunis
ChanSpy was creating its audiohook with the flags AST_AUDIOHOOK_TRIGGER_SYNC and AST_AUDIOHOOK_SMALL_QUEUE, which caused audio frames to be lost when queues grow too large or when read and write queues go out of sync. Now these flags are set conditionally: - AST_AUDIOHOOK_TRIGGER_SYNC is not set if the option "o" is set - a new option "l" is created: if set, AST_AUDIOHOOK_SMALL_QUEUE will not be set on the audiohook ASTERISK-25866 Change-Id: I9c7652f41d9fa72c8691e4e70ec4fd16b047a4dd
2016-04-26Merge changes from topic 'system_stress_patches'Joshua Colp
* changes: test_message.c: Wait longer in case dialplan also processes the test message. Manager: Short circuit AMI message processing. manager.c: Eliminate most RAII_VAR usage.
2016-04-25Merge "manager_channels.c: Fix allocation failure crash."zuul
2016-04-25Merge "Bridge system: Fix memory leaks and double frees on impart failure."zuul
2016-04-25Merge "bridge_softmix.c: Fix crash if channel fails to join mixing tech."zuul
2016-04-25config: Fix ast_config_text_file_save2 writability check for missing filesGeorge Joseph
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-22Merge "bridge: Hold off more than one imparting channel at a time."zuul
2016-04-22manager_channels.c: Fix allocation failure crash.Richard Mudgett
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-22Bridge system: Fix memory leaks and double frees on impart failure.Richard Mudgett
You cannot reference the passed in features struct after calling ast_bridge_impart(). Even if the call fails. Change-Id: I902b88ba0d5d39520e670fb635078a367268ea21
2016-04-22bridge_softmix.c: Fix crash if channel fails to join mixing tech.Richard Mudgett
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-22Manager: Short circuit AMI message processing.Richard Mudgett
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-22manager.c: Eliminate most RAII_VAR usage.Richard Mudgett
* 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-21Merge "lock.c: Check *lt before dereferencing it"zuul
2016-04-21Merge "stringfields: Update extended string fields for master only."zuul
2016-04-21lock.c: Check *lt before dereferencing itDiederik de Groot
*lt is NULL if t->tracking == 0 ASTERISK-25948 #close Change-Id: I4a81af28f9c82a74aa82413d772a7dc8fa6f45ba
2016-04-20bridge: Hold off more than one imparting channel at a time.Richard Mudgett
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-20Merge "Dial: Combine frame handling functions."zuul
2016-04-18bridge_channel.c: Ignore role setup failure in channel push.Richard Mudgett
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-14Dial: Combine frame handling functions.Mark Michelson
There is a good amount of repetition in the two frame handling routines in the Dial API. This commit combines the two functions into one. This is in preparation for an upcoming commit that adds the ability to handle frames for a channel in a bridge. ASTERISK-25925 Reported by Mark Michelson Change-Id: Iaae2f174e3058e774cb44e10659fcdfb85345c58
2016-04-14Codecs: strip codec name while parsing allow/disallow optionsAlexei Gradinari
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-13stringfields: Update extended string fields for master only.George Joseph
In 13, the new ast_string_field_header structure had to be dynamically allocated and assigned to a pointer in ast_string_field_mgr to preserve ABI compatability. In master, it can be converted to being a structure-in-place in ast_string_field_mgr to eliminate the extra alloc and free calls. Change-Id: Ia97c5345eec68717a15dc16fe2e6746ff2a926f4
2016-04-11core_unreal: Fix hangupcauses not getting set on Local channelsJaco Kroon
ASTERISK-25912 #close Change-Id: I8e72e6894feaf36c9450f2788d205d07baec23aa
2016-04-11Merge "lock: Add named lock capability"Joshua Colp
2016-04-08Merge "pbx.h: Make ast_state_cb_type take more const."Joshua Colp
2016-04-08lock: Add named lock capabilityGeorge Joseph
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-08Merge "pbx.c: Minor code rearangements."Joshua Colp
2016-04-07pbx.h: Make ast_state_cb_type take more const.Richard Mudgett
This eliminates some casts that I made a note saying v10 and above would no longer need them. Better late than never :) Change-Id: I346cdb3032b6478ceb40eb6fe732978b54035572
2016-04-07pbx.c: Minor code rearangements.Richard Mudgett
* Pull out a loop invariant. * Convert an else-if ladder to a switch statement. Change-Id: I0a95cfa9474a4600b9865f7b444534d275b37e95
2016-04-07pbx: Update doxygen for extension state watchers.Richard Mudgett
Change-Id: Id1403b12136de62a272c01bb355aef65fd2c2d1e
2016-04-07Merge "pbx: Add support for autohints."Joshua Colp