summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-05-17core/conversions: Added string to unsigned integer and long conversionsKevin Harwell
Added functions that convert a string to an unsigned integer or unsigned long. A couple of unit test were also created to test the routines. The reasons for adding these conversion utilities (and hopefully eventually more) are as follows: * Conversion routines are functionally contained with consistent and better error checking * The function names offer a better description of what is happening * It encourages code reuse for easier bug fixing at a single source * It's simpler to use * It's unit testable For instance, currently in a lot of places when converting to an integer or similar the "sscanf" function is used. When using "sscanf" it may not be immediately clear what's happening as it lacks semantic naming. Limited error checking is usually done as well. For example, most of the time a check is done to make sure the value converted, but does not check for overflows or negative valued conversions when converting unsigned numbers. Why use/wrap "strtoul" and not "sscanf" then? Primarily, it lacks some of the built in error handling that "strtoul" has. For instance "strtoul" contains overflow checks. Less so, but can still factor as reasons, "sscanf" is slightly more complex in its use. And maybe a bit controversial, but it may be ("big if") potentially slower than "strtoul" in some cases. Change-Id: If7eaca4a48f8c7b89cc8b5a1f4bed2852fca82bb
2017-05-17Merge "res_pjsip_session.c: Process initial INVITE sooner. (key exists)"Jenkins2
2017-05-17Merge "Fix spelling queues.conf.sample file"Joshua Colp
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-15Merge "chan_sip: Change sip_get_codec() to return correct codec list"Joshua Colp
2017-05-14Fix spelling queues.conf.sample fileRodrigo Ramírez Norambuena
Change-Id: Ie1c2d83af66f27a449da09a68d987e0992627fee
2017-05-12Merge changes from topic 'sdp_api_adjustments'George Joseph
* changes: SDP: Make process possible multiple fmtp attributes per rtpmap. SDP: Explicitly stop a RTP instance before destoying it. SDP: Rework merge_capabilities(). SDP: Update ast_get_topology_from_sdp() to keep RTP map.
2017-05-12Merge "SDP: Remove sdp_state.remote_capabilities"George Joseph
2017-05-12Merge "SDP: Add interface_address to specify our address to use."Jenkins2
2017-05-12chan_sip: Change sip_get_codec() to return correct codec listVitezslav Novy
Return cahnnel nativeformats to fix bridge technology selection process. Same approach as in pjsip module. ASTERISK-26143 Reported-by: Henning Holtschneider Change-Id: I64e863753954d6ad67a9e722df2ebc328705ad48
2017-05-11Merge "res_hep_rtcp: Provide chan_sip Call-ID for RTCP messages."Jenkins2
2017-05-11Merge "logger: Added logger_queue_limit to the configuration options."Jenkins2
2017-05-11Merge "tcptls: Improve error messages for TLS connections."Jenkins2
2017-05-11Merge "Prevent Undefined Capath Crash"Jenkins2
2017-05-09SDP: Make process possible multiple fmtp attributes per rtpmap.Richard Mudgett
Change-Id: Ie7511008d82b59590e0eb520a21b5e1da4bd7349
2017-05-09SDP: Remove sdp_state.remote_capabilitiesRichard Mudgett
The sdp_state.remote_capabilities was only used inside merge_sdps() and subsequent calls to merge_sdps() by re-INVITE's would leak them. Change-Id: I0ceb7838ea044cc913e8ad4a255c39c9740ae0ce
2017-05-09SDP: Add interface_address to specify our address to use.Richard Mudgett
When we optionally set the interface_address we are forcing the media to go out a specific interface address. This allows us to optionally have the media go out the interface that SIP signalling came in on or if we are configured to have the media always go out a specific address. Change-Id: I160d9fac322a075bd2557b430632544178196189
2017-05-09SDP: Explicitly stop a RTP instance before destoying it.Richard Mudgett
* Made sdp_add_m_from_rtp_stream() and sdp_add_m_from_udptl_stream() handle generating disabled/declined streams. * Added /main/sdp/sdp_merge_asymmetric unit test. It currently does not check the offerer side negotiated SDP because that isn't the purpose of this patch and there is much to be done to handle declined/dummy streams. * Added T.38 image streams to the /main/sdp/sdp_merge_symmetric and /main/sdp/sdp_merge_crisscross unit tests. Change-Id: Ib4dcb3ca4f9a9133b376f4e3302f9a1f963f2b31
2017-05-09SDP: Rework merge_capabilities().Richard Mudgett
* Tried to give better variable names. * Made our SDP answer use the offer's RTP payload types as the SDP RFC says we SHOULD. * Updating the local topology now takes the stream format caps. We are likely preparing to send an offer. Change-Id: I34d3be8e3036402a8575ffcae3eebc5ce348d7c0
2017-05-09SDP: Update ast_get_topology_from_sdp() to keep RTP map.Richard Mudgett
* Add failure exits to ast_get_topology_from_sdp(). Change-Id: I4cc85c1ede8d712766ed20f544dbcef04c8c1049
2017-05-09tcptls: Improve error messages for TLS connections.Joshua Colp
This change uses the functions provided by OpenSSL to query and better construct error messages for situations where the connection encounters a problem. ASTERISK-26606 Change-Id: I7ae40ce88c0dc4e185c4df1ceb3a6ccc198f075b
2017-05-09Prevent Undefined Capath CrashJoshua Elson
It is possible to initialize a valid config without a capath or cafile definition. This will cause a crash on a reload. This fix ensures capath is always allocated. ASTERISK-26983 #close Change-Id: I63ff715d9d9023427543a5b8a4ba7b0d82533c12
2017-05-09cel_odbc: Fix timestamp processing for microsecondsGeorge Joseph
When a column is of type timestamp, the fraction part of the event field's seconds was frequently parsed incorrectly especially if there were leading zeros. For instance "2017-05-23 23:55:03.023" would be parsed into an int as "23" then when the timestamp was formatted again to be inserted into the database column it'd be "2017-05-23 23:55:03.23" which is now 230 milliseconds instead of 23 milliseconds. "03.000001" would be transformed to "03.1", etc. * If the event field is 'eventtime' and the db column is timestamp, then existing processing has already correctly formatted the timestamp so now we simply use it rather than parsing it and re-printing it. This is the most common use case anyway. * If the event field is other than 'eventtime' and the db column is timestamp, we now parse the seconds, including the fractional part into a double rather than 2 ints. This preserves the magnitude and precision of the fractional part. When we print it, we now print it as a "%09.6lf" which correctly represents the input. To be honest, why we parse the string timestamp into components, test the components, then print the components back into a string timestamp is beyond me. We should use parse it, test it, then if it passes, use the original string representation in the database call. Maybe someone thought that some implementations wouldn't take a partial timestamp string like "2017-05-06" and decided to always produce a full timestamp string even if an abbreviated one was supplied. Anyway, I'm leaving it as it is. ASTERISK-25032 #close Reported-by: Etienne Lessard Change-Id: Id407e6221f79a5c1120e1a70bc7e893bbcaf1938
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-08Merge "func_cdr: Allow empty value for CDR dialplan function."Joshua Colp
2017-05-08Merge "stream: ast_stream_clone() cannot copy the opaque user data."Joshua Colp
2017-05-08logger: Added logger_queue_limit to the configuration options.George Joseph
All log messages go to a queue serviced by a single thread which does all the IO. This setting controls how big that queue can get (and therefore how much memory is allocated) before new messages are discarded. The default is 1000. Should something go bezerk and log tons of messages in a tight loop, this will prevent memory escalation. When the limit is reached, a WARNING is logged to that effect and messages are discarded until the queue is empty again. At that time another WARNING will be logged with the count of discarded messages. There's no "low water mark" for this queue because the logger thread empties the entire queue and processes it in 1 batch before going back and waiting on the queue again. Implementing a low water mark would mean additional locking as the thread processes each message and it's not worth it. A "test" was added to test_logger.c but since the outcome is non-deterministic, it's really just a cli command, not a unit test. Change-Id: Ib4520c95e1ca5325dbf584c7989ce391649836d1
2017-05-08Merge "netsock2.c: Made get/set addr port avoid potential uninitialized memory."Joshua Colp
2017-05-08Merge "bridge: Fix returning to dialplan when executing Bridge() from AMI."Joshua Colp
2017-05-05stream: ast_stream_clone() cannot copy the opaque user data.Richard Mudgett
ast_stream_clone() cannot copy the opaque user data stored on a stream. We don't know how to clone the data so it isn't copied into the clone. Change-Id: Ia51321bf38ecbfdcc53787ca77ea5fd2cabdf367
2017-05-05netsock2.c: Made get/set addr port avoid potential uninitialized memory.Richard Mudgett
Change-Id: I532052bd7cd95a4b3565485fc01e2a1ea07ee647
2017-05-05func_cdr: Allow empty value for CDR dialplan function.Joshua Colp
A regression was introduced in 12 where passing an empty value to the CDR dialplan function was not longer allowed. This change returns to the behavior of 11 where it is permitted. ASTERISK-26173 Change-Id: I3f148203b54ec088007e29e30005a5de122e51c5
2017-05-04app_confbridge: Fix reference to cfg in menu_template_handlerGeorge Joseph
menu_template_handler wasn't properly accounting for the fact that it might be called both during a load/reload (which isn't really valid but not prevented) and by a dialplan function. In both cases it was attempting to use the "pending" config which wasn't valid in the latter case. aco_process_config is also partly to blame because it wasn't properly cleaning "pending" up when a reload was done and no changes were made. Both of these contributed to a crash if CONFBRIDGE(menu,template) was called in a dialplan after a reload. * aco_process_config now sets info->internal->pending to NULL after it unrefs it although this isn't strictly necessary in the context of this fix. * menu_template_handler now uses the "current" config and silently ignores any attempt to be called as a result of someone uses the "template" parameter in the conf file. Luckily there's no other place in the codebase where aco_pending_config is used outside of aco_process_config. ASTERISK-25506 #close Reported-by: Frederic LE FOLL Change-Id: Ib349a17d3d088f092480b19addd7122fcaac21a7
2017-05-04Merge "SDP: Replace SDP telephone_event option with dtmf option"Jenkins2
2017-05-04Merge "res_rtp_asterisk: Clearing the remote RTCP address causes RTCP failures"Jenkins2
2017-05-04bridge: Fix returning to dialplan when executing Bridge() from AMI.Joshua Colp
When using the Bridge AMI action on the same channel multiple times it was possible for the channel to return to the wrong location in the dialplan if the other party hung up. This happened because the priority of the channel was not preserved across each action invocation and it would fail to move on to the next priority in other cases. This change makes it so that the priority of a channel is preserved when taking control of it from another thread and it is incremented as appropriate such that the priority reflects where the channel should next be executed in the dialplan, not where it may or may not currently be. The Bridge AMI action was also changed to ensure that it too starts the channels at the next location in the dialplan. ASTERISK-24529 Change-Id: I52406669cf64208aef7252a65b63ade31fbf7a5a
2017-05-03bridge_simple: Added support for streamsKevin Harwell
This patch is the first cut at adding stream support to the bridging framework. Changes were made to the framework that allows mapping of stream topologies to a bridge's supported media types. The first channel to enter a bridge initially defines the media types for a bridge (i.e. a one to one mapping is created between the bridge and the first channel). Subsequently added channels merge their media types into the bridge's adding to it when necessary. This allows channels with different sized topologies to map correctly to each other according to media type. The bridge drops any frame that does not have a matching index into a given write stream. For now though, bridge_simple will align its two channels according to size or first to join. Once both channels join the bridge the one with the most streams will indicate to the other channel to update its streams to be the same as that of the other. If both channels have the same number of streams then the first channel to join is chosen as the stream base. A topology change source was also added to a channel when a stream toplogy change request is made. This allows subsystems to know whether or not they initiated a change request. Thus avoiding potential recursive situations. ASTERISK-26966 #close Change-Id: I1eb5987921dd80c3cdcf52accc136393ca2d4163
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-03Merge "channels/chan_sip.c: use binding IP address for outgoing TCP SIP ↵Joshua Colp
connections"
2017-05-02cleanup: Change severity of fread short-read warningSean Bright
Many sound files don't have a full frame's worth of data at EOF, so the warning messages were a bit too noisy. So we demote them to debug messages. Change-Id: I6b617467d687658adca39170a81797a11cc766f6
2017-05-02SDP: Replace SDP telephone_event option with dtmf optionRichard Mudgett
The telephone_event option was used as a flag and a bit mapped value in different places when it is a boolean. It is also inadequate to configure the DTMF operation of the RTP instance created for the stream. Change-Id: Ib1addeaf0ce86f07039f2f979cab29405dc5239b
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-02Merge "stream: Make ast_stream_topology_create_from_format_cap() allow NULL ↵Joshua Colp
cap."
2017-05-01Merge "SDP: Make ast_sdp_state_set_remote_sdp() return error."Jenkins2
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