summaryrefslogtreecommitdiff
path: root/res
AgeCommit message (Collapse)Author
2015-03-17Reverting accidental ci of wrong change in r433061Scott Griepentrog
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433062 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17various: cleanup issues found during leak huntScott Griepentrog
In this collection of small patches to prevent Valgrind errors are: fixes for reference leaks in config hooks, evaluating a parameter beyond bounds, and accessing a structure after a lock where it could have been already free'd. Review: https://reviewboard.asterisk.org/r/4407/ ........ Merged revisions 431583 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433061 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17Audit ast_sockaddr_resolve() usage for memory leaks.Richard Mudgett
Valgrind found some memory leaks associated with ast_sockaddr_resolve(). Most of the leaks had already been fixed by earlier memory leak hunt patches. This patch performs an audit of ast_sockaddr_resolve() and found one more. * Fix ast_sockaddr_resolve() memory leak in apps/app_externalivr.c:app_exec(). * Made main/netsock2.c:ast_sockaddr_resolve() always set the addrs parameter for safety so the pointer will never be uninitialized on return. The same goes for res/res_pjsip_acl.c:extract_contact_addr(). * Made functions that call ast_sockaddr_resolve() with RAII_VAR() controlling the addrs variable use ast_free instead of ast_free_ptr to provide better MALLOC_DEBUG information. Review: https://reviewboard.asterisk.org/r/4509/ ........ Merged revisions 433056 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433057 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433058 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17res_pjsip: Allow configuration of endpoint identifier query orderKevin Harwell
Updated some documentation stating that endpoint identifiers registered without a name are place at the front of the lookup list. Also renamed register method 'ast_sip_register_endpoint_identifier_by_name' to 'ast_sip_register_endpoint_identifier_with_name' ASTERISK-24840 Reported by: Mark Michelson ........ Merged revisions 433031 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433032 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17res_pjsip: Allow configuration of endpoint identifier query orderKevin Harwell
This patch fixes previously reverted code that caused binary incompatibility problems with some modules. And like the original patch it makes sure that no matter what order the endpoint identifier modules were loaded, priority is given based on the ones specified in the new global 'endpoint_identifier_order' option. ASTERISK-24840 Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/4489/ ........ Merged revisions 433028 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-17res_pjsip: Add reason comment.Richard Mudgett
........ Merged revisions 433005 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433006 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13chan_pjsip: AMI action PJSIPShowEndpoint closes AMI connection on error.Richard Mudgett
Also fixed similar problem with AMI action PJSIPShowEndpoints. ASTERISK-24872 #close Reported by: Dmitriy Serov Review: https://reviewboard.asterisk.org/r/4487/ ........ Merged revisions 432894 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432895 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13chan_pjsip/res_pjsip_callerid: Make Party ID handling simpler and consistent.Richard Mudgett
The res_pjsip modules were manually checking both name and number presentation values when there is a function that determines the combined presentation for a party ID struct. The function takes into account if the name or number components are valid while the manual code rarely checked if the data was even valid. * Made use ast_party_id_presentation() rather than manually checking party ID presentation values. * Ensure that set_id_from_pai() and set_id_from_rpid() will not return presentation values other than what is pulled out of the SIP headers. It is best if the code doesn't assume that AST_PRES_ALLOWED and AST_PRES_USER_NUMBER_UNSCREENED are zero. * Fixed copy paste error in add_privacy_params() dealing with RPID privacy. * Pulled the id->number.valid test from add_privacy_header() and add_privacy_params() up into the parent function add_id_headers() to skip adding PAI/RPID headers earlier. * Made update_connected_line_information() not send out connected line updates if the connected line number is invalid. Lower level code would not add the party ID information and thus the sent message would be unnecessary. * Eliminated RAII_VAR usage in send_direct_media_request(). Review: https://reviewboard.asterisk.org/r/4472/ ........ Merged revisions 432892 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432893 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13Revert - res_pjsip: Allow configuration of endpoint identifier query orderKevin Harwell
Due to a break in binary compatibility with some other modules these changes are being reverted until the issue can be resolved. ASTERISK-24840 Reported by: Mark Michelson ........ Merged revisions 432868 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432869 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13Logger: Convert 'struct ast_callid' to unsigned int.Corey Farrell
Switch logger callid's from AO2 objects to simple integers. This helps in two ways. Copying integers is faster than referencing AO2 objects, so this will result in a small reduction in logger overhead. This also erases the possibility of an infinate loop caused by an invalid callid in threadstorage. ASTERISK-24833 #comment Committed callid conversion to trunk. Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4466/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432834 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-11res_pjsip: Move internal init/destroy prototypes to private header file.Richard Mudgett
Done as a separate commit from a finding in https://reviewboard.asterisk.org/r/4467/ ........ Merged revisions 432787 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432788 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-11res_pjsip: Fix pjsip.conf type=global object default value handling.Richard Mudgett
When a type=global section is not defined in pjsip.conf the global defaults are not applied. As a result the mandatory Max-Forwards header is not added to SIP messages for res_pjsip/chan_pjsip. The handling of pjsip.conf type=global objects has several problems: 1) If the global object is missing the defaults are not applied. 2) If the global object is missing the default_outbound_endpoint's default value is not returned by ast_sip_global_default_outbound_endpoint(). 3) Defines are needed so default values only need to be changed in one place. * Added a sorcery instance observer callback to check if there were any type=global sections loaded. If there were more than one then issue an error message. If there were none then apply the global defaults. * Fixed ast_sip_global_default_outbound_endpoint() to return the documented default when no type=global object is defined. * Made defines for the global default values. * Increased the default_useragent[] size because SVN version strings can get lengthy and 128 characters may not be enough. * Fixed an off-nominal code path ref leak in global_alloc() if the string fields fail to initialize. * Eliminated RAII_VAR in get_global_cfg() and ast_sip_global_default_outbound_endpoint(). ASTERISK-24807 #close Reported by: Anatoli Review: https://reviewboard.asterisk.org/r/4467/ ........ Merged revisions 432766 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432767 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-11res_pjsip: Fixed invalid empty Server and User-Agent SIP headers.Richard Mudgett
Setting pjsip.conf useragent to an empty string results in an empty SIP header being sent. * Made not add an empty SIP header item to the global SIP headers list. Review: https://reviewboard.asterisk.org/r/4467/ ........ Merged revisions 432764 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432765 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-10res/res_config_odbc: Fix improper escaping of backslashes with MySQLMatthew Jordan
When escaping backslashes with MySQL, the proper way to escape the characters in a LIKE clause is to escape the '\' four times, i.e., '\\\\'. To quote the MySQL manual: "Because MySQL uses C escape syntax in strings (for example, “\n” to represent a newline character), you must double any “\” that you use in LIKE strings. For example, to search for “\n”, specify it as “\\n”. To search for “\”, specify it as “\\\\”; this is because the backslashes are stripped once by the parser and again when the pattern match is made, leaving a single backslash to be matched against." ASTERISK-24808 #close Reported by: Javier Acosta patches: res_config_odbc.diff uploaded by Javier Acosta (License 6690) ........ Merged revisions 432720 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432721 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432722 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-10res_pjsip_refer: Fix occasional unexpected BYE sent after receiving a REFER.Richard Mudgett
A race condition happened between initiating a transfer and requesting that a dialog termination be delayed. Occasionally, the transferrer channels would exit the bridge and hangup before the dialog termination delay was requested. * Made request dialog termination delay before initiating the transfer action. If the transfer fails then cancel the delayed dialog termination request. ASTERISK-24755 #close Reported by: John Bigelow Review: https://reviewboard.asterisk.org/r/4460/ ........ Merged revisions 432668 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432669 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-09res_pjsip: allow configuration of endpoint identifier query orderKevin Harwell
It's possible to have a scenario that will create a conflict between endpoint identifiers. For instance an incoming call could be identified by two different endpoint identifiers and the one chosen depended upon which identifier module loaded first. This of course causes problems when, for example, the incoming call is expected to be identified by username, but instead is identified by ip. This patch adds a new 'global' option to res_pjsip called 'endpoint_identifier_order'. It is a comma separated list of endpoint identifier names that specifies the order by which identifiers are processed and checked. ASTERISK-24840 #close Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/4455/ ........ Merged revisions 432638 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432639 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-08res_rtp_asterisk: Fix wrongful use of USE_PJPROJECT define.Joshua Colp
As pjproject is now used as a shared library a different define, HAVE_PJPROJECT, is used to specify if pjproject is present. ASTERISK-24830 #close Reported by: Stefan Engström ........ Merged revisions 432614 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432615 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-06res_pjsip_refer: Make safely get the context for a blind transfer.Richard Mudgett
Made safely get the TRANSFER_CONTEXT channel value while the channel is locked in refer_incoming_attended_request() and refer_incoming_blind_request(). The pointer returned by pbx_builtin_getvar_helper() is only valid while the channel is locked. ........ Merged revisions 432594 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432595 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-06res_pjsip_refer: Made refer_attended_alloc() not create the ao2 object with ↵Richard Mudgett
a lock. The lock is unused. ........ Merged revisions 432574 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432579 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-02res/res_pjsip_sdp_rtp: Revert portion of r432195Matthew Jordan
Unfortunately, while initial testing with ConfBridge did not reproduce the audio problem alluded to in the comment in res_pjsip_sdp_rtp, further testing did show that bridge_softmix and/or ConfBridge has a severe problem bridging two or more participants at different sampling rates. Sometimes, it even picks odd sampling rates that cause hideous audio problems. This patch backs out the offending portion of the code until the issues in the affected bridging modules can be more properly analyzed. ASTERISK-24841 ........ Merged revisions 432423 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432425 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-27ARI: Fix crash if integer values used in JSON payload 'variables' object.Richard Mudgett
Sending the following ARI commands caused Asterisk to crash if the JSON body 'variables' object passes values of types other than strings. POST /ari/channels POST /ari/channels/{channelid} PUT /ari/endpoints/sendMessage PUT /ari/endpoints/{tech}/{resource}/sendMessage * Eliminated RAII_VAR usage in ast_ari_channels_originate_with_id(), ast_ari_channels_originate(), ast_ari_endpoints_send_message(), and ast_ari_endpoints_send_message_to_endpoint(). ASTERISK-24751 #close Reported by: jeffrey putnam Review: https://reviewboard.asterisk.org/r/4447/ ........ Merged revisions 432404 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432405 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-25Increase WebSocket frame size and improve large read handlingDavid M. Lee
Some WebSocket applications, like [chan_respoke][], require a larger frame size than the default 8k; this patch bumps the default to 16k. This patch also fixes some problems exacerbated by large frames. The sanity counter was decremented on every fread attempt in ws_safe_read(), regardless of whether data was read from the socket or not. For large frames, this could result in loss of sanity prior to reading the entire frame. (16k frame / 1448 bytes per segment = 12 segments). This patch changes the sanity counter so that it only decrements when fread() doesn't read any bytes. This more closely matches the original intention of ws_safe_read(), given that the error message is "Websocket seems unresponsive". This patch also properly logs EOF conditions, so disconnects are no longer confused with unresponsive connections. [chan_respoke]: https://github.com/respoke/chan_respoke Review: https://reviewboard.asterisk.org/r/4431/ ........ Merged revisions 432236 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 432237 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432238 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-24ARI/PJSIP: Apply requesting channel's format cap to created channelsMatthew Jordan
This patch addresses the following problems: * ari/resource_channels: In ARI, we currently create a format capability structure of SLIN and apply it to the new channel being created. This was originally done when the PBX core was used to create the channel, as there was a condition where a newly created channel could be created without any formats. Unfortunately, now that the Dial API is being used, this has two drawbacks: (a) SLIN, while it will ensure audio will flows, can cause a lot of needless transcodings to occur, particularly when a Local channel is created to the dialplan. When no format capabilities are available, the Dial API handles this better by handing all audio formats to the requsted channels. As such, we defer to that API to provide the format capabilities. (b) If a channel (requester) is causing this channel to be created, we currently don't use its format capabilities as we are passing in our own. However, the Dial API will use the requester channel's formats if none are passed into it, and the requester channel exists and has format capabilities. This is the "best" scenario, as it is the most likely to create a media path that minimizes transcoding. Fixing this simply entails removing the providing of the format capabilities structure to the Dial API. * chan_pjsip: Rather than blindly picking the first format in the format capability structure - which actually *can* be a video or text format - we select an audio format, and only pick the first format if that fails. That minimizes the weird scenario where we attempt to transcode between video/audio. * res_pjsip_sdp_rtp: Applied the joint capapbilites to the format structure. Since ast_request already limits us down to one format capability once the format capabilities are passed along, there's no reason to squelch it here. * channel: Fixed a comment. The reason we have to minimize our requested format capabilities down to a single format is due to Asterisk's inability to convey the format to be used back "up" a channel chain. Consider the following: PJSIP/A => L;1 <=> L;2 => PJSIP/B g,u,a g,u,a g,u,a u That is, we have PJSIP/A dialing a Local channel, where the Local;2 dials PJSIP/B. PJSIP/A has native format capabilities g722,ulaw,alaw; the Local channel has inherited those format capabilities down the line; PJSIP/B supports only ulaw. According to these format capabilities, ulaw is acceptable and should be selected across all the channels, and no transcoding should occur. However, there is no way to convey this: when L;2 and PJSIP/B are put into a bridge, we will select ulaw, but that is not conveyed to PJSIP/A and L;1. Thus, we end up with: PJSIP/A <=> L;1 <=> L;2 <=> PJSIP/B g g X u u Which causes g722 to be written to PJSIP/B. Even if we can convey the 'ulaw' choice back up the chain (which through some severe hacking in Local channels was accomplished), such that the chain looks like: PJSIP/A <=> L;1 <=> L;2 <=> PJSIP/B u u u u We have no way to tell PJSIP/A's *channel driver* to Answer in the SDP back with only 'ulaw'. This results in all the channel structures being set up correctly, but PJSIP/A *still* sending g722 and causing the chain to fall apart. There's a lot of difficulty just in setting this up, as there are numerous race conditions in the act of bridging, and no clean mechanism to pass the selected format backwards down an established channel chain. As such, the best that can be done at this point in time is clarifying the comment. Review: https://reviewboard.asterisk.org/r/4434/ ASTERISK-24812 #close Reported by: Matt Jordan ........ Merged revisions 432195 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432196 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-21res_ari_channels: Return a 404 response when a requested channel variable ↵Joshua Colp
does not exist. This change makes it so that if a channel variable is requested and it does not exist a 404 response will be returned instead of an allocation failed response. This makes it easier to debug and figure out what is going on for a user. ASTERISK-24677 #close Reported by: Joshua Colp ........ Merged revisions 432154 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432155 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-21res_pjsip_registrar: Add Expires header to 200 OK if present in REGISTER.Joshua Colp
Some implementations don't pay attention to the expires for individual contacts. In this case they may consider the lack of an Expires header in the 200 OK as unregistered. This change makes it so if an Expires header is present in the REGISTER we will add one in the 200 OK. ASTERISK-24785 #close Reported by: Ross Beer ........ Merged revisions 432136 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432137 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-21res_pjsip: Add a log message when creating a UAC dialog to a target URI that ↵Joshua Colp
is invalid. ASTERISK-24499 #close Reported by: Rusty Newton ........ Merged revisions 432118 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432119 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-20ASTERISK-24811: Add ast_sorcery_apply_config() to res_pjsip_publish_asterisk.George Joseph
Matt Hoskins reported that res_pjsip_publish_asterisk wouldn't pull config from realtime. Turns out it was just missing a call ast_sorcery_apply_config(). res_pjsip_acl was missing it as well, so I added it. The other pjsip modules looked OK. ASTERISK-24811 #close Reported-by: Matt Hoskins Tested-by: George Joseph Tested-by: Matt Hoskins patches: res_pjsip_publish_asterisk.c.patch submitted by Matt Hoskins (license 6688) Review: https://reviewboard.asterisk.org/r/4433/ ........ Merged revisions 432033 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432035 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-19res_pjsip_refer: Handle INVITE with Replaces failure after answer.Richard Mudgett
* Fixed hangup handling of the session->channel after answer if the ast_channel_move() or ast_bridge_impart() fails. We are still the thread controlling the session->channel so we need to call ast_hangup() to kill the channel. * Fixed debug messages in refer_incoming_invite_request() referencing incorrect channnels on success. Code comments now say why the session->channel cannot be used. Review: https://reviewboard.asterisk.org/r/4422/ ........ Merged revisions 431956 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431957 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-17res_pjsip_refer: Fix crash from a REFER and BYE collision.Richard Mudgett
Analyzing a one-off crash on a busy system showed that processing a REFER request had a NULL session channel pointer. The only way I can think of that could cause this is if an outgoing BYE transaction overlapped the incoming REFER transaction in a collision. Asterisk sends a BYE while the phone sends a REFER to complete an attended transfer. * Made check the session channel pointer before processing an incoming REFER request in res_pjsip_refer. * Fixed similar crash potential for res_pjsip supplement incoming request processing for res_pjsip_sdp_rtp INFO, res_pjsip_caller_id INVITE/UPDATE, res_pjsip_messaging MESSAGE, and res_pjsip_send_to_voicemail REFER messages. * Made res_pjsip_messaging respond to a message body too large with a 413 instead of ignoring it. ASTERISK-24700 #close Reported by: Zane Conkle Review: https://reviewboard.asterisk.org/r/4417/ ........ Merged revisions 431898 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431899 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-16res/res_rtp_asterisk: Fix crash in debug from RTCP reports without report blockMatthew Jordan
When RTCP debugging was enabled, an RTCP report without a report block would cause a crash. This was due to the verbose output not checking to see if the report_block pointer was NULl before dereferencing it. This patch adds the necessary check to prevent printing any verbose output if the far side hasn't provided us the information they should have. ASTERISK-24791 #close Reported by: JoshE Tested by: JoshE ........ Merged revisions 431879 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431880 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-15res_sorcery_config: Improve object lookup times.Joshua Colp
The res_sorcery_config module currently uses a fixed bucket size of 53. This means that depending on the number of objects you either end up with excess buckets or a lot of collisions. Due to the way that res_sorcery_config is implemented it's actually possible to make the bucket size dynamic based on the number of objects. This is due to the fact that each loading of the config file produces a new container and does not modify the existing one. This change uses the number of expected objects and finds a prime number near it. In practice depending on the number of objects this can speed up lookups anywhere from 2X to 15X. This change also removes the lock from the container as it is not needed. Review: https://reviewboard.asterisk.org/r/4423/ ........ Merged revisions 431841 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-15res_pjsip: Add "pjsip show version" CLI command.Joshua Colp
When debugging things it can be useful to know absolutely what version of pjproject res_pjsip is running against. This change adds a "pjsip show version" CLI command which can be used to query for this. ASTERISK-24685 #close Reported by: Joshua Colp Review: https://reviewboard.asterisk.org/r/4424/ ........ Merged revisions 431824 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431825 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-15res_timing_pthread: Fix leaky pipes.Joshua Colp
During some refactoring the way private information for timers was stored was changed. As a result of this the action which normally removed the timer upon closure in res_timing_pthread was also removed causing the timer to remain after it should using up resources. This change ensures that the timer is removed upon closure. ASTERISK-24768 #close Reported by: Matthias Urlichs patches: timer.patch submitted by Matthias Urlichs (license 5508) ........ Merged revisions 431807 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431808 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-14res_pjsip_exten_state: Improve log message when a subscription is attempted ↵Joshua Colp
to a non-existent extension. ASTERISK-24716 #close Reported by: Rusty Newton ........ Merged revisions 431754 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431755 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-13res_pjsip_session: Fix double re-INVITE collision crash.Richard Mudgett
A multi-asterisk box setup with direct media enabled would occasionally crash when two re-INVITE collisions on a call leg happen in a row. The re-INVITE logic only had one timer struct to defer the re-INVITE. When the second collision happens the timer struct is overwritten and put into the timer heap again. Resources for the first timer are leaked and the heap has two positions occupied by the same timer struct. Now the heap ordering is potentially corrupted, the timer will fire twice, and any resources allocated for the second timer will be released twice. * The solution is to put the collided re-INVITE into the delayed requests queue with all the other delayed requests and cherry pick the next request that can come off the queue when an event happens. * Changed to put delayed BYE requests at the head of the delayed queue. There is no sense in processing delayed UPDATEs and re-INVITEs when a BYE has been requested. * Made the start of a BYE request flush the delayed requests queue to prevent a delayed request from overlapping the BYE transaction. I saw a few cases where a delayed re-INVITE got started after the BYE transaction started. * Changed the delayed_request struct to use an enum instead of a string for the request method. Cherry picking the queue is easier with an enum than string comparisons and the compiler can warn if a switch statement does not cover all defined enum values. * Improved the debug output to give more information. It helps to know which channel is involved with an endpoint. Trunks can have many channels associated with the endpoint at the same time. ASTERISK-24727 #close Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/4414/ ........ Merged revisions 431734 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431735 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-12ARI/PJSIP: Add the ability to redirect (transfer) a channel in a Stasis appMatthew Jordan
This patch adds a new feature to ARI to redirect a channel to another server, and fixes a few bugs in PJSIP's handling of the Transfer dialplan application/ARI redirect capability. *New Feature* A new operation has been added to the ARI channels resource, redirect. With this, a channel in a Stasis application can be redirected to another endpoint of the same underlying channel technology. *Bug fixes* In the process of writing this new feature, two bugs were fixed in the PJSIP stack: (1) The existing .transfer channel callback had the limitation that it could only transfer channels to a SIP URI, i.e., you had to pass 'PJSIP/sip:foo@my_provider.com' to the dialplan application. While this is still supported, it is somewhat unintuitive - particularly in a world full of endpoints. As such, we now also support specifying the PJSIP endpoint to transfer to. (2) res_pjsip_multihomed was, unfortunately, trying to 'help' a 302 redirect by updating its Contact header. Alas, that resulted in the forwarding destination set by the dialplan application/ARI resource/whatever being rewritten with very incorrect information. Hence, we now don't bother updating an outgoing response if it is a 302. Since this took a looong time to find, some additional debug statements have been added to those modules that update the Contact headers. Review: https://reviewboard.asterisk.org/r/4316/ ASTERISK-24015 #close Reported by: Private Name ASTERISK-24703 #close Reported by: Matt Jordan ........ Merged revisions 431717 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431718 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11res_pjsip: dtls_handler causes Asterisk to crashKevin Harwell
There have been a couple of times where a crash occurred in the dtls_handler section of the code for res_pjsip. Unfortunately, in working this issue the problem was unable to be reproduced. After looking at the backtraces and through the code the current best guess as to why this happened might be due to a reentrance problem and the strtok function. So, the current fix is to convert the strtok function into the reentrant version of the function, strtok_r. ASTERISK-24741 #close Reported by: Zane Conkle Review: https://reviewboard.asterisk.org/r/4409/ ........ Merged revisions 431698 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431699 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11ari_websockets: removed extra check on websocket session readKevin Harwell
When merging the websocket timeout issue (ASTERISK-24701) an extra, almost duplicate, check was left in the code that should not have been. This removes it. ASTERISK-24701 #close Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/4412/ ........ Merged revisions 431693 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431695 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11HTTP: Stop accepting requests on final system shutdown.Richard Mudgett
There are three CLI commands to stop and restart Asterisk each. 1) core stop/restart now - Hangup all calls and stop or restart Asterisk. New channels are prevented while the shutdown request is pending. 2) core stop/restart gracefully - Stop or restart Asterisk when there are no calls remaining in the system. New channels are prevented while the shutdown request is pending. 3) core stop/restart when convenient - Stop or restart Asterisk when there are no calls in the system. New calls are not prevented while the shutdown request is pending. ARI has made stopping/restarting Asterisk more problematic. While a shutdown request is pending it is desirable to continue to process ARI HTTP requests for current calls. To handle the current calls while a shutdown request is pending, a new committed to shutdown phase is needed so ARI applications can deal with the calls until the system is fully committed to shutdown. * Added a new shutdown committed phase so ARI applications can deal with calls until the final committed to shutdown phase is reached. * Made refuse new HTTP requests when the system has reached the final system shutdown phase. Starting anything while the system is actively releasing resources and unloading modules is not a good thing. * Split the bridging framework shutdown to not cleanup the global bridging containers when shutting down in a hurry. This is similar to how other modules prevent crashes on rapid system shutdown. * Moved ast_begin_shutdown(), ast_cancel_shutdown(), and ast_shutting_down(). You should not have to include channel.h just to access these system functions. ASTERISK-24752 #close Reported by: Matthew Jordan Review: https://reviewboard.asterisk.org/r/4399/ ........ Merged revisions 431692 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431694 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-11res_http_websocket: websocket write timeout fails to fully disconnectKevin Harwell
When writing to a websocket if a timeout occurred the underlying socket did not get closed/disconnected. This patch makes sure the websocket gets disconnected on a write timeout. Also a notice is logged stating that the websocket was disconnected. ASTERISK-24701 #close Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/4412/ ........ Merged revisions 431669 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 431670 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431671 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-10res_pjsip_config_wizard: Add ability to auto-create hints.George Joseph
Looking at the Super Awesome Company sample reminded me that creating hints is just plain gruntwork. So you can now have the pjsip conifg wizard auto-create them for you. Specifying 'hint_exten' in the wizard will create 'exten => <hint_exten>,hint/PJSIP/<wizard_id>' in whatever is specified for 'hint_context'. Specifying 'hint_application' in the wizard will create 'exten => <hint_exten>,1,<hint_application>' in whatever is specified for 'hint_context'. The default for 'hint_context' is the endpoint's context. There's no default for 'hint_application'. If not specified, no app is added. There's no default for 'hint_exten'. If not specified, neither the hint itself nor the application will be created. Some may think this is the slippery slope to users.conf but hints are a basic necessity for phones unlike voicemail, manager, etc that users.conf creates. Tested-by: George Joseph Review: https://reviewboard.asterisk.org/r/4383/ ........ Merged revisions 431643 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431644 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-09res/ari/resource_channels: Add missing 'no_answer' reason to DELETE /channelsMatthew Jordan
One of the canonical reasons for hanging up a channel is because the far end failed to answer - or because someone else answered, and we want to get rid of this channel. This patch adds the missing value to the 'reason' query parameter for the DELETE /channels operation. Review: https://reviewboard.asterisk.org/r/4400 ASTERISK-24745 #close Reported by: Ben Merrills patches: add_no_answer_ari_hangup_cause.diff uploaded by Ben Merrills (License 6678) ........ Merged revisions 431622 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-09res/res_odbc: Remove unneeded queries when determining if a table existsMatthew Jordan
This patch modifies the ast_odbc_find_table function such that it only performs a lookup of the requested table if the table is not already known. Prior to this patch, a queries would be executed against the database even if the table was already known and cached. Review: https://reviewboard.asterisk.org/r/4405/ ASTERISK-24742 #close Reported by: ibercom patches: patch.diff uploaded by ibercom (License 6599) ........ Merged revisions 431617 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 431618 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431619 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-08res/res_pjsip_sdp_rtp: Fix leak of local ICE candidates when applying to SDPMatthew Jordan
When an SDP is created for an outgoing request/response, the ICE candidates obtained from the RTP instance are currently leaked. This causes the ao2 container that holds the candidates to never properly be reclaimed when the RTP instance is destroyed. This patch properly decrements the ICE candidates' container if it is successfully obtained. ASTERISK-24769 #close Reported by: Matt Jordan ........ Merged revisions 431600 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431601 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-06various: cleanup issues found during leak huntScott Griepentrog
In this collection of small patches to prevent Valgrind errors are: fixes for reference leaks in config hooks, evaluating a parameter beyond bounds, and accessing a structure after a lock where it could have been already free'd. Review: https://reviewboard.asterisk.org/r/4407/ ........ Merged revisions 431583 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431584 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-02-04res_pjsip_keepalive: Don't crash if PJSIP module is not loaded.Joshua Colp
........ Merged revisions 431555 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431556 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-31res_format_attr_h264: Fix crash when determining joint capability.Joshua Colp
The res_format_attr_h264 module currently incorrectly attempts to copy SPS and PPS information from the wrong attribute. This change fixes that. ASTERISK-24616 #close Reported by: Yura Kocyuba Review: https://reviewboard.asterisk.org/r/4392/ ........ Merged revisions 431521 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431522 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-30res_pjsip_outbound_publish: eventually crashes when no response is ever receivedKevin Harwell
When Asterisk attempts to send SIP outbound publish information and no response is ever received (no 200 okay, 412, 423) the system eventually crashes. A response is never received because the system Asterisk is attempting to send publish information to is not available. The underlying pjsip framework attempts to send publish information. After several attempts it calls back into the Asterisk outbound publish code. At this point if the "client->queue" is empty Asterisk attempts to schedule a refresh which utilizes "rdata" and since no response was received the given "rdata" struture is NULL. Attempting to dereference a NULL object of course results in a crash. The fix here removes the dependency on rdata for schedule_publish_refresh. Instead param->expiration is now passed to it as this is set to -1 if no response is received. Also added a notification when no response is received. ASTERISK-24635 #close Reported by: Marco Paland Review: https://reviewboard.asterisk.org/r/4384/ ........ Merged revisions 431490 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431491 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-30Fix some memory leaks.Mark Michelson
These memory leaks were found and fixed by John Hardin. I'm just committing them for him. ASTERISK-24736 #close Reported by Mark Michelson Review: https://reviewboard.asterisk.org/r/4389 ........ Merged revisions 431468 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431469 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-29stasis transfer: fix stasis bridge push race part twoScott Griepentrog
When swapping a Local channel in place of one already in a bridge (to complete a bridge attended transfer), the channel that was swapped out can actually be hung up before the stasis bridge push callback executes on the independant transfer thread. This results in the stasis app loop dropping out and removing the control that has the the app name which the local replacement channel needs so it can re-enter stasis. To avoid this race condition a new push_peek callback has been added, and called from the ast_bridge_impart thread before it launches the independant thread that will complete the transfer. Now the stasis push_peek callback can copy the stasis app name before the swap channel can hang up. ASTERISK-24649 Review: https://reviewboard.asterisk.org/r/4382/ ........ Merged revisions 431450 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431451 65c4cc65-6c06-0410-ace0-fbb531ad65f3