summaryrefslogtreecommitdiff
path: root/res
AgeCommit message (Collapse)Author
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 15Jenkins2
2017-09-07Merge "res_pjsip_session: Preserve stream name during renegotiation." into 15Jenkins2
2017-09-07Merge "stasis/control.c: Fix set_interval_hook() ref leak." into 15Joshua Colp
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 15Joshua Colp
2017-09-06Merge "res_pjsip_t38: Make t38_reinvite_response_cb tolerant of NULL ↵Jenkins2
channel" into 15
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/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
2017-09-05res_pjsip_session: Preserve stream name during renegotiation.Joshua Colp
Stream names within Asterisk can have meaning so when an externally initiated renegotiation occurs we need to preserve the name of the stream if it already exists. Change-Id: I29f50d0cc7f3238287d6d647777e76e1bdf8c596
2017-09-05res_calendar*, res_smdi: Move to "extended" supportGeorge Joseph
Change-Id: I31eee8be30c6b0fc3dadb31111dd47742da8892d
2017-09-05res_pjsip_t38: Make t38_reinvite_response_cb tolerant of NULL channelGeorge Joseph
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-08-31Merge "res_rtp_asterisk: Allow remote SSRC to change on an RTP instance." ↵Jenkins2
into 15
2017-08-31Merge "AST-2017-006: Fix app_minivm application MinivmNotify command ↵Joshua Colp
injection" into 15
2017-08-31Merge "res_rtp_asterisk: Only learn a new source in learn state." into 15Joshua Colp
2017-08-30pjsip_message_ip_updater: Fix issue handling "tel" URIsGeorge Joseph
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-08-30AST-2017-006: Fix app_minivm application MinivmNotify command injectionCorey Farrell
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-08-30res_rtp_asterisk: Only learn a new source in learn state.Joshua Colp
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-30res_rtp_asterisk: Allow remote SSRC to change on an RTP instance.Joshua Colp
When SDP renegotiation occurs it is possible for an RTP instance to be reused for a new stream, resulting in the remote SSRC changing if it is part of a bundle group. This change allows this and updates its mapping in the current bundle group. ASTERISK-27231 Change-Id: I6e3703974f236bc024c5dbe9bd43adae0c6fb490
2017-08-25res/res_pjsip_session: allow SDP answer to be regeneratedTorrey Searle
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-24res_smdi: Clean up memory leakSean Bright
Change-Id: I1e33290929e1aa7c5b9cb513f8254f2884974de8
2017-08-22res_pjsip_session.c: Fix crash when declining an active stream.Richard Mudgett
If a previously active stream is declined we could crash because the channel's thread is still using the stream while we are updating the topology in the serializer thread. * Defer removing any declined stream's handler until we have blocked the channel's thread with the channel lock. ASTERISK-27212 Change-Id: I50e1d3ef26f8e41948f4c411ee329aa3b960a420
2017-08-22Merge "res_xmpp: fix inverted return code check in OAuth" into 15Joshua Colp
2017-08-22res_xmpp: fix inverted return code check in OAuthMichael Kuron
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-17res_calendar_icalendar: Properly handle recurring eventsSean Bright
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-15res_pjsip: Fix prune_on_boot to remove only contacts for the host.Richard Mudgett
* 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-15res_xmpp: Google OAuth 2.0 protocol support for XMPP / MotifAndrey Egorov
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-10res_pjsip_outbound_registration.c: Re-REGISTER on transport shutdown.Richard Mudgett
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-08-10res_pjsip: Remove ephemeral registered contacts on transport shutdown.Richard Mudgett
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-08-10res_pjsip: PJSIP Transport state monitor refactor.Richard Mudgett
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-08-10res_pjsip_transport_management.c: Rename some variables.Richard Mudgett
* Use monitored instead of the misleading keepalive name. Change-Id: I9e5bcbb4ab2b82d49bcd0f06dfe85d15e0b552b6
2017-08-10res_pjsip_messaging: IPv6 receive address needs bracketsScott Griepentrog
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-09Merge "res_rtp_asterisk: Make P2P bridge Asymmetric codec aware" into 15Joshua Colp
2017-08-09res_rtp_asterisk: enable rtcp & QOS stats on native bridgeTorrey Searle
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-08-09res_rtp_asterisk: Make P2P bridge Asymmetric codec awareTorrey Searle
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-09Merge "res_pjsip_session/_sdp_rtp: Handling of 'msid' is incorrect" into 15Joshua Colp
2017-08-08Merge "res_pjsip_session: Release media resources on session end quicker." ↵Jenkins2
into 15
2017-08-08res_pjsip_session: Release media resources on session end quicker.Joshua Colp
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 are told to terminate the session we immediately release any media sessions associated with it. ASTERISK-27110 Change-Id: I643e431d5c3bf05cda220c1d39e824a505a29b82
2017-08-07Merge "res_pjsip_nat.c: Remove unnecessary CMP_STOP." into 15Joshua Colp
2017-08-07Merge "Support GMIME 3.0" into 15Jenkins2
2017-08-04res_pjsip_session/_sdp_rtp: Handling of 'msid' is incorrectKevin Harwell
Currently, the handling of the msid attribute is not quite right. According to the spec the msid's between the offer/answer are not dependent upon one another. Meaning the same msid's given in an offer do not have to be returned in the answer for a given stream. And they probably shouldn't be (copied/reused) since this can potentially cause some browser side confusion. This patch generates new msids when both an offer and answer are sent from Asterisk. However, Asterisk does reuse the original msid it sent out for a reinvite. Also audio+video streams are paired together by sharing the same stream id, but a different track id. ASTERISK-27179 #close Change-Id: Ifaec06dc7e65ad841633a24ebec8c8a9302d6643
2017-08-04Merge "alembic/res_pjsip: Add "webrtc" configuration option" into 15Jenkins2
2017-08-04Merge "res_pjsip_transport_websocket.c: Fix serializer ref leak." into 15Jenkins2
2017-08-04Merge "res_pjsip_outbound_registration.c: Misc fixes." into 15Jenkins2
2017-08-04Support GMIME 3.0Tzafrir Cohen
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-08-03res_pjsip_transport_websocket.c: Fix serializer ref leak.Richard Mudgett
Change-Id: Ib5a19bfd597f63d9021baeb645fc11153b3afa57
2017-08-03res_pjsip_outbound_registration.c: Misc fixes.Richard Mudgett
* 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