- Jun 02, 2020
-
-
George Joseph authored
What's wrong with ast_debug? ast_debug is fine for general purpose debug output but it's not really geared for scope tracing since it doesn't present its output in a way that makes capturing and analyzing flow through Asterisk easy. How is scope tracing better? Scope tracing uses the same "cleanup" attribute that RAII_VAR uses to print messages to a separate "trace" log level. Even better, the messages are indented and unindented based on a thread-local call depth counter. When output to a separate log file, the output is uncluttered and easy to follow. Here's an example of the output. The leading timestamps and thread ids are removed and the output cut off at 68 columns for commit message restrictions but you get the idea. --> res_pjsip_session.c:3680 handle_incoming PJSIP/1173-00000001 --> res_pjsip_session.c:3661 handle_incoming_response PJSIP/1173 --> res_pjsip_session.c:3669 handle_incoming_response PJSIP/ --> chan_pjsip.c:3265 chan_pjsip_incoming_response_after --> chan_pjsip.c:3194 chan_pjsip_incoming_response P chan_pjsip.c:3245 chan_pjsip_incoming_respon <-- chan_pjsip.c:3194 chan_pjsip_incoming_response P <-- chan_pjsip.c:3265 chan_pjsip_incoming_response_after <-- res_pjsip_session.c:3669 handle_incoming_response PJSIP/ <-- res_pjsip_session.c:3661 handle_incoming_response PJSIP/1173 <-- res_pjsip_session.c:3680 handle_incoming PJSIP/1173-00000001 The messages with the "-->" or "<--" were produced by including the following at the top of each function: SCOPE_TRACE(1, "%s\n", ast_sip_session_get_name(session)); Scope isn't limited to functions any more than RAII_VAR is. You can also see entry and exit from "if", "for", "while", etc blocks. There is also an ast_trace() macro that doesn't track entry or exit but simply outputs a message to the trace log using the current indent level. The deepest message in the sample (chan_pjsip.c:3245) was used to indicate which "case" in a "select" was executed. How do you use it? More documentation is available in logger.h but here's an overview: * Configure with --enable-dev-mode. Like debug, scope tracing is #ifdef'd out if devmode isn't enabled. * Add a SCOPE_TRACE() call to the top of your function. * Set a logger channel in logger.conf to output the "trace" level. * Use the CLI (or cli.conf) to set a trace level similar to setting debug level... CLI> core set trace 2 res_pjsip.so Summary Of Changes: * Added LOG_TRACE logger level. Actually it occupies the slot formerly occupied by the now defunct "event" level. * Added core asterisk option "trace" similar to debug. Includes ability to specify global trace level in asterisk.conf and CLI commands to turn on/off and set levels. Levels can be set globally (probably not a good idea), or by module/source file. * Updated sample asterisk.conf and logger.conf. Tracing is disabled by default in both. * Added __ast_trace() to logger.c which keeps track of the indent level using TLS. It's #ifdef'd out if devmode isn't enabled. * Added ast_trace() and SCOPE_TRACE() macros to logger.h. These are all #ifdef'd out if devmode isn't enabled. Why not use gcc's -finstrument-functions capability? gcc's facility doesn't allow access to local data and doesn't operate on non-function scopes. Known Issues: The only know issue is that we currently don't know the line number where the scope exited. It's reported as the same place the scope was entered. There's probably a way to get around it but it might involve looking at the stack and doing an 'addr2line' to get the line number. Kind of like ast_backtrace() does. Not sure if it's worth it. Change-Id: Ic5ebb859883f9c10a08c5630802de33500cad027
-
- May 13, 2020
-
-
Ben Ford authored
Adds the "STIR_SHAKEN" dialplan function and an API call to add a STIR_SHAKEN verification result to a channel. This information will be held in a datastore on the channel that can later be queried through the "STIR_SHAKEN" dialplan funtion to get information on STIR_SHAKEN results including identity, attestation, and verify_result. Here are some examples: STIR_SHAKEN(count) STIR_SHAKEN(0, identity) STIR_SHAKEN(1, attestation) STIR_SHAKEN(2, verify_result) Getting the count can be used to iterate through the results and pull information by specifying the index and the field you want to retrieve. Change-Id: Ice6d52a3a7d6e4607c9c35b28a1f7c25f5284a82
-
- May 06, 2020
-
-
Nathan Bruning authored
Add a new "masquarade" channel event, and use it in app_queue to track unique id's. Testcase is submitted as https://gerrit.asterisk.org/c/testsuite/+/14210 ASTERISK-28829 #close ASTERISK-25844 #close Change-Id: Ifc5f9f9fd70903f3c6e49738d3bc632b085d2df6
-
- May 01, 2020
-
-
Ben Ford authored
There are a lot of moving parts in this patch, but the focus of it is on the verification of the signature using a public key located at the public key URL provided in the JSON payload. First, we check the database to see if we have already downloaded the key. If so, check to see if it has expired. If it has, redownload from the URL. If we don't have an entry in the database, just go ahead and download the public key. The expiration is tested each time we download the file. After that, read the public key from the file and use it to verify the signature. All sanity checking is done when the payload is first received, so the verification is complete once this point is reached. The XML has also been added since a new config option was added to general (curl_timeout). The maximum amount of time to wait for a download can be configured through this option, with a low value by default. Change-Id: I3ba4c63880493bf8c7d17a9cfca1af0e934d1a1c
-
- Apr 23, 2020
-
-
Joshua C. Colp authored
Some places in Asterisk did not treat the formats on a stream as immutable when they are. The ast_stream_get_formats function is now const to enforce this and parts of Asterisk have been updated to take this into account. Some violations of this were also fixed along the way. An additional minor tweak is that streams are now allocated with an empty format capabilities structure removing the need in various places to check that one is present on the stream. ASTERISK-28846 Change-Id: I32f29715330db4ff48edd6f1f359090458a9bfbe
-
- Apr 20, 2020
-
-
Joshua C. Colp authored
When in a conference bridge it may be necessary to have text messages disabled for specific participants or for all. This change adds a configuration option, "text_messaging", which can be used to enable or disable this on the user profile. By default existing behavior is preserved as it defaults to "yes". ASTERISK-28841 Change-Id: I30b5d9ae6f4803881d1ed9300590d405e392bc13
-
- Apr 14, 2020
-
-
Jean Aunis authored
Allow voice volume to be multiplied or divided by a floating point number. ASTERISK-28813 Change-Id: I5b42b890ec4e1f6b0b3400cb44ff16522b021c8c
-
- Apr 06, 2020
-
-
George Joseph authored
This unit test runs through combinations of... * Local codecs * Remote Codecs * Codec Preference * Incoming/Outgoing A few new APIs were created to make it easier to test the functionality but didn't result in any actual functional change. ASTERISK_28777 Change-Id: Ic8957c43e7ceeab0e9272af60ea53f056164f164
-
George Joseph authored
Based on this new endpoint setting, a joint list of preferred codecs between those received from the Asterisk core (remote), and those specified in the endpoint's "allow" parameter (local) is created and is used to create the outgoing SDP offer. * Add outgoing_call_offer_pref to pjsip_configuration (endpoint) * Add "call_direction" to res_pjsip_session. * Update pjsip_session_caps.c to make the functions more generic so they could be used for both incoming and outgoing. * Update ast_sip_session_create_outgoing to create the pending_media_state->topology with the results of ast_sip_session_create_joint_call_stream(). * The endpoint "preferred_codec_only" option now automatically sets AST_SIP_CALL_CODEC_PREF_FIRST in incoming_call_offer_pref. * A helper function ast_stream_get_format_count() was added to streams to return the current count of formats. ASTERISK-28777 Change-Id: Id4ec0b4a906c2ae5885bf947f101c59059935437
-
- Apr 03, 2020
-
-
Ben Ford authored
This change provides functions that take in a JSON payload, verify that the contents contain all the mandatory fields and required values (if any), and signs the payload with the private key. Four fields are added to the payload: x5u, attest, iat, and origid. As of now, these are just placeholder values that will be set to actual values once the logic is implemented for what to do when an actual payload is received, but the functions to add these values have all been implemented and are ready to use. Upon successful signing and the addition of those four values, a ast_stir_shaken_payload is returned, containing other useful information such as the algorithm and signature. Change-Id: I74fa41c0640ab2a64a1a80110155bd7062f13393
-
- Mar 31, 2020
-
-
Jaco Kroon authored
named_acl.c (which is really a named_ha) now uses ast_ha_output. I've also updated main/manager.c to output the actual ACL on "manager show user <username>" if one is set. If this works then we can add similar to other modules as required. Change-Id: I0ec9876a90dddd379c80ec078d48e3ee6991eb0f
-
- Mar 26, 2020
-
-
Jaco Kroon authored
This fixes ast_addressfamily_to_sockaddrsize to reference the provided argument, and ast_sockaddr_from_sockaddr to not use the name of a structure as argument. Change-Id: Ibf5db469c47c3b4214edf8456326086174e8edd7
-
- Mar 25, 2020
-
-
Ben Ford authored
This commit sets up some of the initial framework for the module and adds a way to read the private key from the specified file, which will then be appended to the certificate object. This works fine for now, but eventually some other structure will likely need to be used to store all this information. Similarly, the caller_id_number is specified on the certificate config object, but in the end we will want that information to be tied to the certificate itself and read it from there. A method has been added that will retrieve the private key associated with the caller_id_number passed in. Tab completion for certificates and stores has also been added. Change-Id: Ic4bc1416fab5d6afe15a8e2d32f7ddd4e023295f
-
- Mar 13, 2020
-
-
Sean Bright authored
Change-Id: Ie0eca23b8e6f4c7d9846b6013d79099314d90ef5
-
- Mar 03, 2020
-
-
Kevin Harwell authored
Add a new option, incoming_call_offer_pref, to res_pjsip endpoints that specifies the preferred order of codecs after receiving an offer. This patch does the following: Adds a new enumeration, ast_sip_call_codec_pref, used by the the new configuration option that's added to the endpoint media structure. Adds a new ast_sip_session_caps structure that's set for each session media object. Creates a new file, res_pjsip_session_caps that "implements" the new structure and option, and is compiled into the res_pjsip_session library. ASTERISK-28756 #close Change-Id: I35e7a2a0c236cfb6bd9cdf89539f57a1ffefc76f
-
- Mar 02, 2020
-
-
Kevin Harwell authored
When a text message was received any associated variable was not written to the ARI TextMessageReceived event. This occurred because Asterisk only wrote out "send" variables. However, even those "send" variables would fail ARI validation due to a TextMessageVariable formatting bug. Since it seems the TextMessageReceived event has never been able to include actual variables it was decided to remove the TextMessageVariable object type from ARI, and simply return a JSON object of key/value pairs for variables. This aligns more with how the ARI sendMessage handles variables, and other places in ARI. ASTERISK-28755 #close Change-Id: Ia6051c01a53b30cf7edef84c27df4ed4479b8b6f
-
- Feb 26, 2020
-
-
Torrey Searle authored
Update the state of remote_hold immediately on receipt of remote SDP so that the information is available when building the SDP answer ASTERISK-28754 #close Change-Id: I7026032a807e9c95081cb8f060400b05deb4836f
-
- Feb 24, 2020
-
-
Kevin Harwell authored
There were a couple places where the format cap function parameter was not 'const' when it should have been. This patch makes them 'const'. Change-Id: Ife753fb16a962d842a6b44f45363a61a66bfdb2e
-
Walter Doekes authored
There are exceptions for plural objects, but they are detected using the supplied NUMBER, not using an extra option. Change-Id: I95d1d1b2796b1aba92048a2dbae8a3856ed8a113
-
- Feb 20, 2020
-
-
Joshua C. Colp authored
This change extends the Sorcery API to allow a wizard to be told to explicitly reload objects or a specific object type even if the wizard believes that nothing has changed. This has been leveraged by res_pjsip and res_pjsip_acl to reload endpoints and PJSIP ACLs when a named ACL changes. ASTERISK-28697 Change-Id: Ib8fee9bd9dd490db635132c479127a4114c1ca0b
-
- Feb 18, 2020
-
-
Joshua C. Colp authored
This change adds support to bridge_softmix to allow the addition and removal of additional video source streams. When such a change occurs each participant is renegotiated as needed to reflect the update. If another video source is added then each participant gets another source. If a video source is removed then it is removed from each participant. This functionality allows you to have both your webcam and screenshare providing video if you desire, or even more streams. Mapping has been changed to use the topology index on the source channel as a unique identifier for outgoing participant streams, this will never change and provides an easy way to establish the mapping. The bridge_simple and bridge_native_rtp modules have also been updated to renegotiate when the stream topology of a party changes allowing the same behavior to occur as added to bridge_softmix. If a screen share is added then the opposite party is renegotiated. If that screen share is removed then the opposite party is renegotiated again. Some additional fixes are also included in here. Stream state is now conveyed in SDP so sendonly/recvonly/inactive streams can be requested. Removed streams now also remove previous state from themselves so consumers don't get confused. ASTERISK-28733 Change-Id: I93f41fb41b85646bef71408111c17ccea30cb0c5
-
Ben Ford authored
When handling ICE negotiations, it's possible that there can be a delay between STUN binding requests which in turn will cause a delay in ICE completion, preventing media from flowing. It should be possible to send media when there is at least one valid pair, preventing this scenario from occurring. A change was added to PJPROJECT that adds an optional callback (on_valid_pair) that will be called when the first valid pair is found during ICE negotiation. Asterisk uses this to start the DTLS handshake, allowing media to flow. It will only be called once, either on the first valid pair, or when ICE negotiation is complete. ASTERISK-28716 Change-Id: Ia7b68c34f06d2a1d91c5ed51627b66fd0363d867
-
- Feb 03, 2020
-
-
George Joseph authored
In order to reduce the amount of AMI and ARI events generated, the global "Message/ast_msg_queue" channel can be set to suppress it's normal channel housekeeping events such as "Newexten", "VarSet", etc. This can greatly reduce load on the manager and ARI applications when the Digium Phone Module for Asterisk is in use. To enable, set "hide_messaging_ami_events" in asterisk.conf to "yes" In Asterisk versions <18, the default is "no" preserving existing behavior. Beginning with Asterisk 18, the option will default to "yes". NOTE: This change does not affect UserEvents or the ARI TextMessageReceived events. * Added the "hide_messaging_ami_events" option to asterisk.conf. * Changed message.c to set the AST_CHAN_TP_INTERNAL property on the "Message/ast_msg_queue" channel if the option is set in asterisk.conf. This suppresses the reporting of the events. Change-Id: Ia2e3516d43f4e0df994fc6598565d6bba2d7018b
-
- Jan 14, 2020
-
-
Seán C McCord authored
This commit adds support for [AudioSocket]( https://wiki.asterisk.org/wiki/display/AST/AudioSocket), a very simple bidirectional audio streaming protocol. There are both channel and application interfaces. A description of the protocol can be found on the above referenced GitHub page. A short talk about the reasons and implementation can be found on [YouTube](https://www.youtube.com/watch?v=tjduXbZZEgI), from CommCon 2019. ARI support has also been added via the existing "externalMedia" ARI functionality. The UUID is specified using the arbitrary "data" field. ASTERISK-28484 #close Change-Id: Ie866e6c4fa13178ec76f2a6971ad3590a3a588b5
-
- Jan 10, 2020
-
-
Jaco Kroon authored
ast_addressfamily_to_sockaddrize will determine the size that's required, and ast_sockaddr_from_sockaddr then wraps this new function and ast_sockaddr_copy_sockaddr to copy arbitrary sockaddr's (without knowing the address family) into the ast_sockaddr structure. Change-Id: Iee604e96e9096c79b477d6e5ff310cf0b06dae86 Signed-off-by:
Jaco Kroon <jaco@uls.co.za>
-
- Jan 08, 2020
-
-
Joshua C. Colp authored
Some body generators, such as dialog-info+xml, require storing state information which is then conveyed in the NOTIFY request itself. Up until now there was no way for such body generators to persist this information. Two new API calls have been added to allow body generators to set and get persisted data. This data is persisted out alongside the normal persistence information and allows the body generator to restore state information or to simply use this for normal storage of state. State is stored in the form of JSON and it is up to the body generator to interpret this as needed. The dialog-info+xml body generator has been updated to take advantage of this to persist the version number. ASTERISK-27759 Change-Id: I5fda56c624fd13c17b3c48e0319b77079e9e27de
-
Sean Bright authored
Adds source port matching support when IP matching is used: [example] type = identify match = 1.2.3.4:5060/32, 1.2.3.4:6000/32, asterisk.org:4444 If the IP matches but the source port does not, we reject and search for alternatives. SRV lookups are still performed if enabled (srv_lookups = yes), unless the configured FQDN includes a port number in which case just a host lookup is performed. ASTERISK-28639 #close Reported by: Mitch Claborn Change-Id: I256d5bd5d478b95f526e2f80ace31b690eebba92
-
- Jan 06, 2020
-
-
George Joseph authored
When a topic is created for an object, its name is only <object>:<uniqueid> For example: bridge:cb68b3a8-fce7-4738-8a17-d7847562f020 When a topic is added to a pool, its name has the pool's topic name prepended. For example: bridge:all/bridge:cb68b3a8-fce7-4738-8a17-d7847562f020 The topic_pool_entry's name however, is only what was passed in to stasis_topic_pool_get_topic which is bridge:cb68b3a8-fce7-4738-8a17-d7847562f020 That's actually correct because the entry is qualified by the pool that's in. When you're ready to delete the entry from the pool, you retrieve the tropic name from the object but since it now has the pool's topic name prepended, it won't be found in the pool container. Fix: * Modified stasis_topic_pool_delete_topic() to skip past the pool topic's name, if it was prepended to the topic name, before searching the container for a pool entry. ASTERISK-28633 Reported by: Joeran Vinzens Change-Id: I4396aa69dd83e4ab84c5b91b39293cfdbcf483e6
-
- Jan 02, 2020
-
-
Sean Bright authored
When TLS is in use, checking the readiness of the underlying FD is insufficient for determining if there is data available to be read. So before polling the FD, check if there is any buffered data in the TLS layer and use that first. ASTERISK-28562 #close Reported by: Robert Sutton Change-Id: I95fcb3e2004700d5cf8e5ee04943f0115b15e10d
-
Jean Aunis authored
This patch adds a new flag "inhibitConnectedLineUpdates" to the 'addChannel' operation in the Bridges REST API. When set, this flag avoids generating COLP frames when the specified channels enter the bridge. ASTERISK-28629 Change-Id: Ib995d4f0c6106279aa448b34b042b68f0f2ca5dc
-
- Dec 16, 2019
-
-
Joshua C. Colp authored
Instead of trying to use the defined MySQL client version from the header use a configure check to determine whether the bool or my_bool type should be used for defining a boolean. ASTERISK-28604 Change-Id: Id2225b3785115de074c50c123ff1a68005b4a9c7
-
Joshua C. Colp authored
ConfBridge has the ability to move between different sample rates for mixing the conference bridge. Up until now there has only been the ability to set the conference bridge to mix at a specific sample rate, or to let it move between sample rates as necessary. This change adds the ability to configure a conference bridge with a maximum sample rate so it can move between sample rates but only up to the configured maximum. ASTERISK-28658 Change-Id: Idff80896ccfb8a58a816e4ce9ac4ebde785963ee
-
- Dec 13, 2019
-
-
Kevin Harwell authored
A previous patch: Gerrit Change-Id: I73bb24799bfe1a48adae9c034a2edbae54cc2a39 made it so a T.38 Gateway tries to negotiate with both sides by sending T.38 negotiation request to both endpoints supported T.38 versus the previous behavior of forwarding negotiation to the "other" channel once a preamble was detected. This had the unfortunate side effect of breaking some setups. Specifically ones that set the max datagram option on an endpoint configuration (configured max datagram was not propagated since Asterisk now initiates negotiations). This patch adds a configuration option, "negotiate_both", that when enabled makes it so Asterisk initiates the negotiation requests to both endpoints vs. the previous behavior of waiting, and forwarding the request. The default is disabled keeping with the old behavior. ASTERISK-28660 Change-Id: I5deb875f3485e20bc75119ec743090655d864a1a
-
- Dec 12, 2019
-
-
Jaco Kroon authored
Due to use in res_rtp_asterisk there is a need to be able to apply an ACL without logging any invalid/denies. It's probably sensible to at least validate the ACL once directly after load and report invalid ACLs. Change-Id: I256169229d945ca7c1bbf228fc492d91df345843 Signed-off-by:
Jaco Kroon <jaco@uls.co.za>
-
- Nov 18, 2019
-
-
Kevin Harwell authored
This patch fixes several issues reported by the lgtm code analysis tool: https://lgtm.com/projects/g/asterisk/asterisk Not all reported issues were addressed in this patch. This patch mostly fixes confirmed reported errors, potential problematic code points, and a few other "low hanging" warnings or recommendations found in core supported modules. These include, but are not limited to the following: * innapropriate stack allocation in loops * buffer overflows * variable declaration "hiding" another variable declaration * comparisons results that are always the same * ambiguously signed bit-field members * missing header guards Change-Id: Id4a881686605d26c94ab5409bc70fcc21efacc25
-
- Nov 08, 2019
-
-
Corey Farrell authored
* Pass caller information to frame allocation functions. * Disable caching as it interfers with MALLOC_DEBUG reporting. * Stop using ast_calloc_cache. Change-Id: Id343cd80a3db941d2daefde2a060750fea8cd260
-
- Oct 18, 2019
-
-
Sean Bright authored
ASTERISK-28590 #close Change-Id: I51abce00c04d0a06550bda5205580705185b9c1c
-
- Oct 07, 2019
-
-
Kevin Harwell authored
Serializer pools have previously existed in Asterisk. However, for the most part the code has been duplicated across modules. This patch abstracts the code into an 'ast_serializer_pool' object. As well the code is now centralized in serializer.c/h. In addition serializer pools can now optionally be monitored by a shutdown group. This will prevent the pool from being destroyed until all serializers have completed. Change-Id: Ib1e906144b90ffd4d5ed9826f0b719ca9c6d2971
-
Kevin Harwell authored
Both res_pjsip and res_pjsip_mwi made use of serializer pools. However, they both implemented their own serializer pool functionality that was pretty much identical in each of the source files. This patch removes the duplicated code, and uses the new 'ast_serializer_pool' object instead. Additionally res_pjsip_mwi enables a shutdown group on the pool since if the timing was right the module could be unloaded while taskprocessor threads still needed to execute, thus causing a crash. Change-Id: I959b0805ad024585bbb6276593118be34fbf6e1d
-
- Oct 01, 2019
-
-
Torrey Searle authored
Add a new dialplan function PJSIP_MOH_PASSTHROUGH that allows the on-hold behavior to be controlled on a per-call basis ASTERISK-28542 #close Change-Id: Iebe905b2ad6dbaa87ab330267147180b05a3c3a8
-