summaryrefslogtreecommitdiff
path: root/res
AgeCommit message (Collapse)Author
2017-05-15res_pjsip_session.c: Process initial INVITE sooner. (key exists)Richard Mudgett
Retransmissions of an initial INVITE could be queued in the serializer before we have processed the first INVITE message. If the first INVITE message doesn't get completely processed before the retransmissions are seen then we could try to setup the same call from the retransmissions. A symptom of this is seeing a (key exists) message associated with an INVITE. An earlier change attempted to address this kind of problem by calculating a distributor serializer to use for unassociated messages. Part of that change also made incoming calls keep using that distributor serializer. (ASTERISK-26088) However, some leftover code was still deferring the INVITE processing to the session's serializer even though we were already in that serializer. This not only is unnecessary but would cause the same call resetup problem. * Removed the code to defer processing the initial INVITE to the session's serializer because we are already running in that serializer. ASTERISK-26998 #close Change-Id: I1e822d82dcc650e508bc2d40d545d5de4f3421f6
2017-05-09res_hep_rtcp: Provide chan_sip Call-ID for RTCP messages.Joshua Colp
This change adds the required logic to allow the SIP Call-ID to be placed into the HEP RTCP traffic if the chan_sip module is used. In cases where the option is enabled but the channel is not either SIP or PJSIP then the code will fallback to the channel name as done previously. Based on the change on Nir's branch at: team/nirs/hep-chan-sip-support ASTERISK-26427 Change-Id: I09ffa5f6e2fdfd99ee999650ba4e0a7aad6dc40d
2017-05-03res_rtp_asterisk: Clearing the remote RTCP address causes RTCP failuresKevin Harwell
When a call gets put on hold RTP is temporarily stopped and Asterisk was setting the remote RTCP address to NULL. Then when RTCP data was received from the remote endpoint, Asterisk would be missing this information when publishing the rtcp_message stasis event. Consequently, message subscribers (in this case res_hep_rtcp) trying to parse the "from" field output the following error: "ast_sockaddr_split_hostport: Port missing in (null)" This patch makes it so the remote RTCP address is no longer set to NULL when stopping RTP. There was only one place that appeared to check if the remote RTCP address was NULL as a way to tell if RTCP was running. This patch added an additional check on the RTCP schedid for that case to make sure RTCP was truly not running. ASTERISK-26860 #close Change-Id: I6be200fb20db647e48b5138ea4b81dfa7962974b
2017-05-02Merge "res_pjsip_t38.c: Fix deadlock in T.38 framehook."Jenkins2
2017-05-02Merge "res_sdp_translator_pjmedia.c: Add TODO notes."Joshua Colp
2017-05-02Merge "SDP: Make SDP translation to/from internal representation more const."Joshua Colp
2017-05-01Merge "res_pjsip_outbound_authenticator_digest: Add context to log messages"Jenkins2
2017-05-01Merge "SDP: Misc cleanups (Mostly memory leaks)"Jenkins2
2017-05-01Merge "SDP API: Add SSRC-level attributes"Jenkins2
2017-04-29res_pjsip_t38.c: Fix deadlock in T.38 framehook.Richard Mudgett
A deadlock can happen between a channel lock and a pjsip session media container lock. One thread is processing a reINVITE's SDP and walking through the session's media container when it waits for the channel lock to put the determined format capabilities onto the channel. The other thread is writing a frame to the channel and processing the T.38 frame hook. The T.38 frame hook then waits for the pjsip session's media container lock. The two threads are now deadlocked. * Made the T.38 frame hook release the channel lock before searching the session's media container. This fix has been done to several other frame hooks to fix deadlocks. ASTERISK-26974 #close Change-Id: Ie984a76ce00bef6ec9aa239010e51e8dd74c8186
2017-04-28res_pjsip_outbound_authenticator_digest: Add context to log messagesGeorge Joseph
There was no context info in this module's log messages so it was impossible to toubleshoot. Added endpoint or host to all messages and added the realms in the challenge for the "No auth credentials for any realm" message. Change-Id: Ifeed2786f35fbea7d141237ae15625e472acff9b
2017-04-27res_sdp_translator_pjmedia.c: Add TODO notes.Richard Mudgett
Change-Id: If27ca61f79accc882c3376d2e876d2b44aa1347b
2017-04-27SDP: Make SDP translation to/from internal representation more const.Richard Mudgett
Change-Id: I473a174b869728604b37c60853896b0c458bc504
2017-04-27SDP: Misc cleanups (Mostly memory leaks)Richard Mudgett
Change-Id: I74431b385da333f2c5f5a6d7c55e70b69a4f05d2
2017-04-27Merge "res_pjsip_session: Add cleanup to ast_sip_session_terminate"Jenkins2
2017-04-27Merge "res_pjsip/res_pjsip_callerid: NULL check on caller id name string"Jenkins2
2017-04-27SDP API: Add SSRC-level attributesMark Michelson
RFC 5576 defines how SSRC-level attributes may be added to SDP media descriptions. In general, this is useful for grouping related SSRCes, indicating SSRC-level format attributes, and resolving collisions in RTP SSRC values. These attributes are used widely by browsers during WebRTC communications, including attributes defined by documents outside of RFC 5576. This commit introduces the addition of SSRC-level attributes into SDPs generated by Asterisk. Since Asterisk does not tend to use multiple SSRCs on a media stream, the initial support is minimal. Asterisk includes an SSRC-level CNAME attribute if configured to do so. This at least gives browsers (and possibly others) the ability to resolve SSRC collisions at offer-answer time. In order to facilitate this, the RTP engine API has been enhanced to be able to retrieve the SSRC and CNAME on a given RTP instance. res_rtp_asterisk currently does not provide meaningful CNAME values in its RTCP SDES items, and therefore it currently will always return an empty string as the CNAME value. A task in the near future will result in res_rtp_asterisk generating more meaningful CNAMEs. Change-Id: I29e7f23e7db77524f82a3b6e8531b1195ff57789
2017-04-27res_pjsip_session: Add cleanup to ast_sip_session_terminateGeorge Joseph
If you use ast_request to create a PJSIP channel but then hang it up without causing a transaction to be sent, the session will never be destroyed. This is due ot the fact that it's pjproject that triggers the session cleanup when the transaction ends. app_chanisavail was doing this to get more granular channel state and it's also possible for this to happen via ARI. * ast_sip_session_terminate was modified to explicitly call the cleanup tasks and unreference session if the invite state is NULL AND invite_tsx is NULL (meaning we never sent a transaction). * chan_pjsip/hangup was modified to bump session before it calls ast_sip_session_terminate to insure that session stays valid while it does its own cleanup. * Added test events to session_destructor for a future testsuite test. ASTERISK-26908 #close Reported-by: Richard Mudgett Change-Id: I52daf6f757184e5544c261f64f6fe9602c4680a9
2017-04-27Merge "res_rtp_asterisk.c: Fix crash in RTCP DTLS operation."Jenkins2
2017-04-26res_pjsip/res_pjsip_callerid: NULL check on caller id name stringKevin Harwell
It's possible for a name in a party id structure to be marked as valid, but the name string itself be NULL (for instance this is possible to do by using the dialplan CALLERID function). There were a couple of places where the name was validated, but the string itself was not checked before passing it to functions like 'strlen'. This of course caused a crashed. This patch adds in a NULL check before attempting to pass it into a function that is not NULL tolerant. ASTERISK-25823 #close Change-Id: Iaa6ffe9d92f598fe9e3c8ae373fadbe3dfbf1d4a
2017-04-26Merge "res_pjsip_sdp_rtp: No rtpmap for static RTP payload IDs in SDP."Jenkins2
2017-04-25Merge "res_pjsip_session.c: Send 100 Trying out earlier to prevent ↵Jenkins2
retransmissions."
2017-04-25Merge "res_hep: Add additional config initialization and validation"George Joseph
2017-04-25Merge "res_pjsip_session.c: Restructure ast_sip_session_alloc()"George Joseph
2017-04-24res_hep: Add additional config initialization and validationSean Bright
* Initialize hepv3_runtime_data.sockfd to -1 so that our ao2 destructor does not close fd 0 * Add logging output when the required option - capture_address - is not specified. * Remove a no longer relevant #define and correct related documentation * Pass appropriate flags to aco_option_register so that capture_address cannot be the empty string. ASTERISK-26953 #close Change-Id: Ief08441bc6596d6f1718fa810e54a5048124f076
2017-04-21Merge "rtp_engine/res_rtp_asterisk: Fix RTP struct reentrancy crashes."George Joseph
2017-04-21res_pjsip_session.c: Send 100 Trying out earlier to prevent retransmissions.Richard Mudgett
If ICE is enabled and a STUN server does not respond then we will block until we give up on the STUN response. This will take nine seconds. In the mean time the peer that sent the INVITE will send retransmissions. * Restructure res_pjsip_session.c:new_invite() to send a 100 Trying out earlier to prevent these retransmissions. ASTERISK-26890 Change-Id: Ie3fc611e53a0eff6586ad55e4aacad81cf6319a8
2017-04-21res_pjsip_session.c: Restructure ast_sip_session_alloc()Richard Mudgett
* Restructure ast_sip_session_alloc() to need less cleanup on off nominal error paths. * Made ast_sip_session_alloc() and ast_sip_session_create_outgoing() avoid unnecessary ref manipulation to return a session. This is faster than calling a function. That function may do logging of the ref changes with REF_DEBUG enabled. Change-Id: I2a0affc4be51013d3f0485782c96b8fee3ddb00a
2017-04-20Merge "res_stun_monitor: Don't fail to load if DNS resolution fails"George Joseph
2017-04-19res_rtp_asterisk.c: Fix crash in RTCP DTLS operation.Richard Mudgett
Occasionally a crash happens when processing the RTCP DTLS timeout handler. The RTCP DTLS timeout timer could be left running if we have not completed the DTLS handshake before we place the call on hold or we attempt direct media. * Made ast_rtp_prop_set() stop the RTCP DTLS timer when disabling RTCP. * Made some sanity tweaks to ast_rtp_prop_set() when switching from standard RTCP mode to RTCP multiplexed mode. ASTERISK-26692 #close Change-Id: If6c64c79129961acfa4b3d63a864e8f6b664acc0
2017-04-19rtp_engine/res_rtp_asterisk: Fix RTP struct reentrancy crashes.Richard Mudgett
The struct ast_rtp_instance has historically been indirectly protected from reentrancy issues by the channel lock because early channel drivers held the lock for really long times. Holding the channel lock for such a long time has caused many deadlock problems in the past. Along comes chan_pjsip/res_pjsip which doesn't necessarily hold the channel lock because sometimes there may not be an associated channel created yet or the channel pointer isn't available. In the case of ASTERISK-26835 a pjsip serializer thread was processing a message's SDP body while another thread was reading a RTP packet from the socket. Both threads wound up changing the rtp->rtcp->local_addr_str string and interfering with each other. The classic reentrancy problem resulted in a crash. In the case of ASTERISK-26853 a pjsip serializer thread was processing a message's SDP body while another thread was reading a RTP packet from the socket. Both threads wound up processing ICE candidates in PJPROJECT and interfering with each other. The classic reentrancy problem resulted in a crash. * rtp_engine.c: Make the ast_rtp_instance_xxx() calls lock the RTP instance struct. * rtp_engine.c: Make ICE and DTLS wrapper functions to lock the RTP instance struct for the API call. * res_rtp_asterisk.c: Lock the RTP instance to prevent a reentrancy problem with rtp->rtcp->local_addr_str in the scheduler thread running ast_rtcp_write(). * res_rtp_asterisk.c: Avoid deadlock when local RTP bridging in bridge_p2p_rtp_write() because there are two RTP instance structs involved. * res_rtp_asterisk.c: Avoid deadlock when trying to stop scheduler callbacks. We cannot hold the instance lock when trying to stop a scheduler callback. * res_rtp_asterisk.c: Remove the lock in struct dtls_details and use the struct ast_rtp_instance ao2 object lock instead. The lock was used to synchronize two threads to prevent a race condition between starting and stopping a timeout timer. The race condition is no longer present between dtls_perform_handshake() and __rtp_recvfrom() because the instance lock prevents these functions from overlapping each other with regards to the timeout timer. * res_rtp_asterisk.c: Remove the lock in struct ast_rtp and use the struct ast_rtp_instance ao2 object lock instead. The lock was used to synchronize two threads using a condition signal to know when TURN negotiations complete. * res_rtp_asterisk.c: Avoid deadlock when trying to stop the TURN ioqueue_worker_thread(). We cannot hold the instance lock when trying to create or shut down the worker thread without a risk of deadlock. This patch exposed a race condition between a PJSIP serializer thread setting up an ICE session in ice_create() and another thread reading RTP packets. * res_rtp_asterisk.c:ice_create(): Set the new rtp->ice pointer after we have re-locked the RTP instance to prevent the other thread from trying to process ICE packets on an incomplete ICE session setup. A similar race condition is between a PJSIP serializer thread resetting up an ICE session in ice_create() and the timer_worker_thread() processing the completion of the previous ICE session. * res_rtp_asterisk.c:ast_rtp_on_ice_complete(): Protect against an uninitialized/null remote_address after calling update_address_with_ice_candidate(). * res_rtp_asterisk.c: Eliminate the chance of ice_reset_session() destroying and setting the rtp->ice pointer to NULL while other threads are using it by adding an ao2 wrapper around the PJPROJECT ice pointer. Now when we have to unlock the RTP instance object to call a PJPROJECT ICE function we will hold a ref to the wrapper. Also added some rtp->ice NULL checks after we relock the RTP instance and have to do something with the ICE structure. ASTERISK-26835 #close ASTERISK-26853 #close Change-Id: I780b39ec935dcefcce880d50c1a7261744f1d1b4
2017-04-16make ari-stubs so doc periodic jobs can runGeorge Joseph
The periodic doc job does a make ari-stubs and checks that there are no changes before generating the docs. Since I changed the mustache template (and the generated code directly) recently and forgot to regenerate the stubs, the doc job thinks they're out of date. Change-Id: I94b97035311eccf52b0101b8590223265a7881d4
2017-04-14res_stun_monitor: Don't fail to load if DNS resolution failsSean Bright
res_stun_monitor will fail to load if DNS resolution of the STUN server fails. Instead, we continue without the STUN server being resolved and we will re-attempt the resolution on the STUN refresh interval. ASTERISK-21856 #close Reported by: Jeremy Kister Change-Id: I6334c54a1cc798f8a836b4b47948e0bb4ef59254
2017-04-13res_pjsip_sdp_rtp: No rtpmap for static RTP payload IDs in SDP.Alexander Traud
This saves around 100 bytes when G.711, G.722, G.729, and GSM are advertised in SDP. This reduces the chance to hit the MTU bearer of 1300 bytes for SIP over UDP, if many codecs are allowed in Asterisk. This new feature is enabled together with the optional feature compact_headers=yes via the file pjsip.conf. ASTERISK-26932 #close Change-Id: Iaa556ab4c8325cd34c334387ab2847fab07b1689
2017-04-12modules: change module LOAD_FAILUREs to LOAD_DECLINES (14)George Joseph
Change-Id: If99e3b4fc2d7e86fc3e61182aa6c835b407ed49e
2017-04-12modules: change module LOAD_FAILUREs to LOAD_DECLINESGeorge Joseph
In all non-pbx modules, AST_MODULE_LOAD_FAILURE has been changed to AST_MODULE_LOAD_DECLINE. This prevents asterisk from exiting if a module can't be loaded. If the user wishes to retain the FAILURE behavior for a specific module, they can use the "require" or "preload-require" keyword in modules.conf. A new API was added to logger: ast_is_logger_initialized(). This allows asterisk.c/check_init() to print to the error log once the logger subsystem is ready instead of just to stdout. If something does fail before the logger is initialized, we now print to stderr instead of stdout. Change-Id: I5f4b50623d9b5a6cb7c5624a8c5c1274c13b2b25
2017-04-11res_rtp_asterisk.c: Add stun_blacklist optionRichard Mudgett
Added the stun_blacklist option to rtp.conf. Some multihomed servers have IP interfaces that cannot reach the STUN server specified by stunaddr. Blacklist those interface subnets from trying to send a STUN packet to find the external IP address. Attempting to send the STUN packet needlessly delays processing incoming and outgoing SIP INVITEs because we will wait for a response that can never come until we give up on the response. Multiple subnets may be listed. ASTERISK-26890 #close Change-Id: I3ff4f729e787f00c3e6e670fe6435acce38be342
2017-04-11res_pjsip: Fix pointer use after unref.Richard Mudgett
Change-Id: I4b6e1b0070563eeaee223cb58326f1b962ed5bc1
2017-04-11res_pjsip_sdp_rtp.c: Don't use deprecated transport struct member.Richard Mudgett
* create_rtp(): Eliminate use of deprecated transport struct member. That member and several others in the transport structure were deprecated because of an infinite loop created when using realtime configuration. See 2451d4e4550336197ee2e482750cc53f30afa352 ASTERISK-26851 Change-Id: I0533aa13c9ce3c6cc394e0fd2b5bf1cd1b2ef3bc
2017-04-07pjsip: Add Alembic for PUBLISH support.Joshua Colp
This change adds database tables for the PUBLISH support so it can be configured using realtime. A minor fix to the res_pjsip_publish_asterisk module was done so that it read the sorcery configuration from the correct section. Finally the sample configuration files have been updated. ASTERISK-26928 Change-Id: I81991ae5c75af98d247f7eacd1c0b0a763675952
2017-04-05Merge "Unused realtime MOH classes not purged on 'moh reload'"zuul
2017-04-05Merge "res_pjsip_session: Allow BYE to be sent on disconnected session."zuul
2017-04-04res_pjsip_sdp_rtp.c: Don't alter global addr variable.Richard Mudgett
* create_rtp(): Fix unexpected alteration of global address_rtp if a transport is bound to an address. * create_rtp(): Fix use of uninitialized memory if the endpoint RTP media address is invalid or the transport has an invalid address. ASTERISK-26851 Change-Id: Icde42e65164a88913cb5c2601b285eebcff397b7
2017-04-03Unused realtime MOH classes not purged on 'moh reload'Daniel Journo
Purge Realtime MOH classes on 'moh reload' even when musiconhold.conf hasn't changed. ASTERISK-25974 #close Change-Id: I42c78ea76528473a656f204595956c9eedcf3246
2017-04-03res_pjsip: Fix transport ref leak.Richard Mudgett
We were leaking a transport ref in multihomed_on_rx_message() which resulted in the FRACK about excessive ref counts. ASTERISK-26916 #close Change-Id: I7a96658a9614a060565bb9ad51cb1c9c11ee145f
2017-04-01res_pjsip_session: Allow BYE to be sent on disconnected session.Joshua Colp
It is perfectly acceptable for a BYE to be sent on a disconnected session. This occurs when we respond to a challenge to the BYE for authentication credentials. ASTERISK-26363 Change-Id: I6ef0ddece812fea6665a1dd2549ef44fb9d90045
2017-03-30Merge "res_pjsip_config_wizard: Add 2 new parameters to help with proxy config"zuul
2017-03-29Merge "srtp: Allow zero as tag value for a sRTP Crypto Suite."Joshua Colp
2017-03-29Merge "Add DTLS sanity check."zuul
2017-03-29Merge "res_musiconhold: Don't chdir() when scanning MoH files"zuul