summaryrefslogtreecommitdiff
path: root/res
AgeCommit message (Collapse)Author
2017-12-13AST-2017-012: Place single RTCP report block at beginning of report.14Joshua Colp
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-11-09Merge "res_pjsip_registrar.c: Fix AOR and pjproject group deadlock." into 14Kevin Harwell
2017-11-08AST-2017-011 - res_pjsip_session: session leak when a call is rejectedKevin Harwell
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-11-07res_pjsip_registrar.c: Fix AOR and pjproject group deadlock.Richard Mudgett
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 AOR lock to avoid the deadlock. ASTERISK-27391 Change-Id: I89a90f87cb7a02facbafb44c75d8845f93417364
2017-11-02res_pjsip: Add to list of valid characters for from_user.Ben Ford
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-25res_xmpp: Ensure the connection filter is available.Joshua Colp
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-12res_pjsip_session: Prevent user=phone being added to anonimized URIs.Daniel Tryba
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-11Merge "res_pjsip_registrar.c: Update remove_existing AOR contact handling." ↵Jenkins2
into 14
2017-10-09res_pjproject: Fix cleanup of buildopts vector.Corey Farrell
ASTERISK-27306 Change-Id: I3bed0edf3f55b1d4adcbabb25ec14f11dc766c72
2017-10-09Merge "res_pjsip: Fix issues that prevented shutdown of modules." into 14Jenkins2
2017-10-09Merge "res_pjsip: Fix leak of persistent endpoint references." into 14Jenkins2
2017-10-09res_pjsip_registrar.c: Update remove_existing AOR contact handling.Richard Mudgett
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-09res_pjsip: Fix issues that prevented shutdown of modules.Corey Farrell
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-09res/res_ari.c Fix: Memory leaks in ARI when using Content-Type: application/jsonhajekd
ASTERISK-27305 Reported by: David Hajek Tested by: David Hajek Change-Id: Ife3e289062e6cf7d0e7d342dbf79ed96feff441e
2017-10-06res_pjsip: Fix leak of persistent endpoint references.Corey Farrell
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-06Merge "res_pjsip: Fix leak of fake_auth references." into 14Jenkins2
2017-10-06res_pjsip: Fix leak of fake_auth references.Corey Farrell
pjsip_distributor leaks references to fake_auth when the default realm has not changed. ASTERISK-27306 Change-Id: I3fcf103b3680ad2d1d4610dcd6738eeaebf4d202
2017-10-05res_pjsip_caller_id chan_sip: Comply to RFC 3323 values for privacyDaniel Tryba
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-10-04res_calendar_icalendar: Filter out occurrences superceded by another VEVENTkrells
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-09-28Merge "pjsip_message_filter: Fix regression causing bad contact address" into 14Jenkins2
2017-09-28Merge "res_rtp_asterisk.c: Fix bridge_p2p_rtp_write() reentrancy potential." ↵Jenkins2
into 14
2017-09-27res_pjsip_outbound_publish.c: Fix misplaced parenthesis.Richard Mudgett
The pjsip_publishc_init() call was referenced with a misplaced parentheses. As a result, outbound publication messages went out with an expiration of 1 second. ASTERISK-27298 Change-Id: I93622eabc8ee83e7a22e98c107f921284c605a08
2017-09-26pjsip_message_filter: Fix regression causing bad contact addressGeorge Joseph
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-26res_rtp_asterisk.c: Fix bridge_p2p_rtp_write() reentrancy potential.Richard Mudgett
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-22res_pjsip: Use ast_sip_is_content_type() where appropriateSean Bright
Change-Id: If3ab0d73d79ac4623308bd48508af2bfd554937d
2017-09-22Merge "res_config_pgsql: Fix removed support to previous for versions ↵Joshua Colp
PostgreSQL 9.1" into 14
2017-09-21Merge "res_srtp: lower log level of auth failures" into 14Jenkins2
2017-09-21res_config_pgsql: Fix removed support to previous for versions PostgreSQL 9.1Rodrigo Ramírez Norambuena
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-19res_pjsip_pubsub: Check for Content-Type header in rx_notify_requestGeorge Joseph
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-19Merge "AST-2017-008: Improve RTP and RTCP packet processing." into 14Joshua Colp
2017-09-19Merge "res_calendar: On reload, update all configuration" into 14Joshua Colp
2017-09-18res_srtp: lower log level of auth failuresAlexander Traud
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-15AST-2017-008: Improve RTP and RTCP packet processing.Richard Mudgett
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-15Merge "res_pjsip: Filter out non SIP(S) requests" into 14Jenkins2
2017-09-15res_calendar: On reload, update all configurationSean Bright
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-15Merge "res_calendar: Various fixes" into 14Jenkins2
2017-09-14res_pjsip: Filter out non SIP(S) requestsGeorge Joseph
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-13res_calendar: Various fixesSean Bright
* 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-13res_pjsip: Add handling for incoming unsolicited MWI NOTIFYGeorge Joseph
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-11res_rtp_asterisk.c: Add doxygen to RTCP payload types.Richard Mudgett
Change-Id: I3f20ce428777cc4ce9c13b2f808d29ff8c873998
2017-09-10res/res_pjsip: Fix localnet checks in pjsip, part 2.Walter Doekes
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-07Merge "res_srtp: Add support for libsrtp2.1." into 14Jenkins2
2017-09-07Merge "stasis/control.c: Fix set_interval_hook() ref leak." into 14Jenkins2
2017-09-06stasis/control.c: Fix set_interval_hook() ref leak.Richard Mudgett
Change-Id: Ia0edb7dc0dbbb879c079ff7000f1b722d86ce7dc
2017-09-06stasis/control: Fix possible deadlock with swap channelGeorge Joseph
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-06Merge "res/res_pjsip: Standardize/fix localnet checks across pjsip." into 14Jenkins2
2017-09-06Merge "res_rtp_asterisk.c: Check RTP packet version earlier." into 14Jenkins2
2017-09-06res_srtp: Add support for libsrtp2.1.Alexander Traud
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-05res_rtp_asterisk.c: Check RTP packet version earlier.Richard Mudgett
Change-Id: Ic6493a7d79683f3e5845dff1cee49445fd5a0adf
2017-09-05res/res_pjsip: Standardize/fix localnet checks across pjsip.Walter Doekes
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