summaryrefslogtreecommitdiff
path: root/res
AgeCommit message (Collapse)Author
2016-01-13pjsip: Add option global/regcontextDaniel Journo
Added new global option (regcontext) to pjsip. When set, Asterisk will dynamically create and destroy a NoOp priority 1 extension for a given endpoint who registers or unregisters with us. ASTERISK-25670 #close Reported-by: Daniel Journo Change-Id: Ib1530c5b45340625805c057f8ff1fb240a43ea62
2016-01-13Merge "res_pjsip_log_forwarder.c: Add CLI "pjsip show buildopts"."Mark Michelson
2016-01-13res_musiconhold: Prevent multiple simultaneous reloads.Sean Bright
There are two ways in which the reload() function in res_musiconhold can be called from the CLI: * module reload res_musiconhold.so * moh reload In the former case, the module loader holds a lock that prevents multiple concurrent calls, but in the latter there is no such protection. This patch changes the 'moh reload' CLI command to invoke the module loader directly, rather than call reload() explicitly. ASTERISK-25687 #close Change-Id: I408968b4c8932864411b7f9ad88cfdc7b9ba711c
2016-01-12res_pjsip_log_forwarder.c: Add CLI "pjsip show buildopts".Richard Mudgett
PJPROJECT has a function available to dump the compile time options used when building the library. * Add CLI "pjsip show buildopts" command. * Update contrib/scripts/autosupport to get pjproject information. Change-Id: Id93a6a916d765b2a2e5a1aeb54caaf83206be748
2016-01-12Merge "pjsip_sdp_rtp: Add option endpoint/bind_rtp_to_media_address"Joshua Colp
2016-01-12Merge "res_pjsip: Create human friendly serializer names."Joshua Colp
2016-01-12res_sorcery_realtime: Remove leading ^ requirement.Mark Michelson
res_sorcery_realtime's search-by-regex callback performed a check to ensure that the passed-in regex began with a caret (^). If it did not, then no results would be returned. This callback only started to become used when "like" support was added to PJSIP CLI commands. The CLI command for listing objects would pass an empty regex ("") to the sorcery backend if no "like" statement was present. For most sorcery backends, this resulted in returning all objects. However, for realtime, this resulted in returning no objects. This commit seeks to fix the regression by removing the requirement from res_sorcery_realtime for the passed-in-regex to begin with a caret. ASTERISK-25689 #close Reported by Marcelo Terres Change-Id: I22b4dc5d7f3f11bb29ac2e42ef94682e9bab3b20
2016-01-11pjsip_sdp_rtp: Add option endpoint/bind_rtp_to_media_addressGeorge Joseph
On a system with multiple ip addresses in the same subnet, if a transport is bound to a specific ip address and endpoint/media_address is set, the SIP/SDP will have the correct address in all fields but the rtp stream MAY still originate from one of the other ip addresses, most probably the "primary" ip address. This happens because res_pjsip_sdp_rtp/create_rtp always calls ast_instance_new with the "all" ip address (0.0.0.0 or ::). The new option causes res_pjsip_sdp_rtp/create_rtp to call ast_rtp_instance_new with the endpoint's media_address (if specified) instead of the "all" address. This causes the packets to originate from the specified address. ASTERISK-25632 ASTERISK-25637 Reported-by: Olivier Krief Reported-by: Dan Journo Change-Id: I3dfaa079e54ba7fb7c4fd1f5f7bd9509bbf8bd88
2016-01-11Merge "Revert "pjsip_location: Delete contact_status object when contact is ↵Mark Michelson
deleted""
2016-01-11Merge "res_crypto: Perform cleanup at shutdown."Joshua Colp
2016-01-11Merge "res_calendar: Cleanup scheduler context at unload."Joshua Colp
2016-01-10res_calendar: Cleanup scheduler context at unload.Corey Farrell
ASTERISK-25679 #close Change-Id: I839159bf6882cccc1b23494c7aa2bc2a2624613f
2016-01-09res_rtp_asterisk: Revert DTLS negotiation changes.Joshua Colp
Due to locking issues within pjnath these changes are being reverted until pjnath can be changed. ASTERISK-25645 Revert "res_rtp_asterisk.c: Fix DTLS negotiation delays." This reverts commit 24ae124e4f7310cfa64c187b944b2ffc060da28d. Change-Id: I2986cfb2c43dc14455c1bcaf92c3804f9da49705 Revert "res_rtp_asterisk: Resolve further timing issues with DTLS negotiation" This reverts commit 965a0eee46d24321f74c244e23c5a5f45e67e12b. Change-Id: Ie68fafde27dad4b03cb7a1e27ce2a8502c3f7bbe
2016-01-09Revert "pjsip_location: Delete contact_status object when contact is deleted"George Joseph
This reverts commit 0a9941de9d24093b5ff44096d1d7406f29d11e45. Matt, This patch causes another problem and should not have been needed. Before this patch, persistent_endpoint_contact_deleted_observer WAS deleting the contact_status when ast_sip_location_delete_contact was called. By deleting it yourself in ast_sip_location_delete_contact it was gone before the observer could run and the observer therefore was throwing an error and not sending stasis/AMI/statsd messages. So, I don't think this was the cause of your original issue. I also had verified the contact AMI and statsd lifecycle and it was working. I'll double check now though. ASTERISK-25675 Reported-by: Daniel Journo Change-Id: Ib586a6b7f90acb641b0c410f659743ab90e84f1a
2016-01-09res_crypto: Perform cleanup at shutdown.Corey Farrell
This change causes res_crypto to unregister CLI at shutdown while still preventing the module from being unloaded. ASTERISK-25673 #close Change-Id: Ie5d57338dc2752abfc0dd05d0eec86413f2304fc
2016-01-08res_pjsip: Create human friendly serializer names.Richard Mudgett
PJSIP name formats: pjsip/aor/<aor>-<seq> -- registrar thread pool serializer pjsip/default-<seq> -- default thread pool serializer pjsip/messaging -- messaging thread pool serializer pjsip/outreg/<registration>-<seq> -- outbound registration thread pool serializer pjsip/pubsub/<endpoint>-<seq> -- pubsub thread pool serializer pjsip/refer/<endpoint>-<seq> -- REFER thread pool serializer pjsip/session/<endpoint>-<seq> -- session thread pool serializer pjsip/websocket-<seq> -- websocket thread pool serializer Change-Id: Iff9df8da3ddae1132cb2ef65f64df0c465c5e084
2016-01-07PJSIP: Prevent deadlock due to dialog/transaction lock inversion.Mark Michelson
A deadlock was observed where the monitor thread was stuck, therefore resulting in no incoming SIP traffic being processed. The problem occurred when two 200 OK responses arrived in response to a terminating NOTIFY request sent from Asterisk. The first 200 OK was dispatched to a threadpool worker, who locked the corresponding transaction. The second 200 OK arrived, resulting in the monitor thread locking the dialog. At this point, the two threads are at odds, because the monitor thread attempts to lock the transaction, and the threadpool thread loops attempting to try to lock the dialog. In this case, the fix is to not have the monitor thread attempt to hold both the dialog and transaction locks at the same time. Instead, we release the dialog lock before attempting to lock the transaction. There have also been some debug messages added to the process in an attempt to make it more clear what is going on in the process. ASTERISK-25668 #close Reported by Mark Michelson Change-Id: I4db0705f1403737b4360e33a8e6276805d086d4a
2016-01-04voicemail: Move app_voicemail / res_mwi_external conflict to runtimeGeorge Joseph
The menuselect conflict between app_voicemail and res_mwi_external makes it hard to package 1 version of Asterisk. There no actual build dependencies between the 2 so moving this check to runtime seems like a better solution. The ast_vm_register and ast_vm_greeter_register functions in app.c were modified to return AST_MODULE_LOAD_DECLINE instead of -1 if there is already a voicemail module registered. The modules' load_module functions were then modified to return DECLINE instead of -1 to the loader. Since -1 is interpreted by the loader as AST_MODULE_LOAD_FAILURE, the modules were incorrectly causing Asterisk to stop so this needed to be cleaned up anyway. Now you can build both and use modules.conf to decide which voicemail implementation to load. The default menuselect options still build app_voicemail and not res_mwi_external but if both ARE built, res_mwi_external will load first and become the voicemail provider unless modules.conf rules prevent it. This is noted in CHANGES. Change-Id: I7d98d4e8a3b87b8df9e51c2608f0da6ddfb89247
2015-12-31Merge "res_pjsip_history: Add a module that provides PJSIP history for ↵Matt Jordan
debugging"
2015-12-31res_pjsip_history: Add a module that provides PJSIP history for debuggingMatt Jordan
This patch adds a new module, res_pjsip_history, that provides a slightly better way of debugging SIP message traffic on a busy Asterisk system. The existing mechanisms all rely on passively dumping a SIP message to the CLI. While this is perfectly fine for logging purposes and well controlled environments, on many installations, the amount of SIP messages Asterisk receives will quickly swamp the CLI. This makes it difficult to view/capture those messages that you want to diagnose in real time. This patch provides another way of handling this. When enabled, the module will store SIP message traffic in memory. This traffic can then be queried at leisure. In order to make the querying useful, a CLI command has been implemented, 'pjsip show history', that supports a basic expression syntax similar to SQL or other query languages. A small number of useful fields have been added in this initial patch; additional fields can easily be added in later improvements. Those fields are: - number: The entry index in the history - timestamp: The time the message was recieved - addr: The source/destination address of the message - sip.msg.request.method: The request method - sip.msg.call-id: The Call-ID header Note - this is a resurrection of the module initially proposed on Review Board here: https://reviewboard.asterisk.org/r/4053/ Change-Id: I39bd74ce998e99ad5ebc0aab3e84df3a150f8e36
2015-12-28res_http_websocket.c: prevent avoidable disconnections caused by write errorsDade Brandon
Updated ast_websocket_write to encode the entire frame in to one write operation, to ensure that we don't end up with a situation where the websocket header has been sent, while the body can not be written. Previous to August's patch in commit b9bd3c14, certain network conditions could cause the header to be written, and then the sub-sequent body to fail - which would cause the next successful write to contain a new header, and a new body (resulting in the peer receiving two headers - the second of which would be read as part of the body for the first header). This was patched to have both write operations individually fail by closing the websocket. In a case available to the submitter of this patch, the same body which would consistently fail to write, would succeed if written at the same time as the header. This update merges the two operations in to one, adds debug messages indicating the reason for a websocket connection being closed during a write operation, and clarifies some variable names for code legibility. Change-Id: I4db7a586af1c7a57184c31d3d55bf146f1a40598
2015-12-28Merge "res/res_pjsip_location: Delete contact_status object when contact is ↵Joshua Colp
deleted"
2015-12-27Remove res_jabber file that was left behind.Corey Farrell
Change-Id: I9d88fac0394d5bbaff0900a2ee911c4e4478846b
2015-12-24res/res_pjsip_location: Delete contact_status object when contact is deletedMatt Jordan
In 450579e908, a change was made that removed the deletion of the 'contact_status' object when a 'contact' object is deleted in sorcery. This unfortunately means that the 'contact_status' object persists, even when something has explicitly removed a contact. The result is that the state of the contact will not be regenerated if that contact is re-created, and the stale state will be reported/used for that contact. It also results in no ContactStatusChanged events being generated for either ARI or AMI. This patch restores the deletion logic that was removed. Doing so now results in the expected events being generated again. Change-Id: I28789a112e845072308b5b34522690e3faf58f07
2015-12-24res_rtp_asterisk: rtp->ice check not wrapped in HAVE_PJPROJECT ifdefKevin Harwell
Change-Id: I19b49112e1b630bd04e859f14ccf96f8ebd6b151
2015-12-21res_rtp_asterisk: Resolve further timing issues with DTLS negotiationDade Brandon
Resolves an edge case dtls negotiation delay for certain networks which somehow manage to drop the rtcp side's packet when these are both sent ast_rtp_remote_address_set, causing it to have to time-out and restart the handshake. Move dtls pending bio flush in to it's own function, and call it from ast_rtp_on_ice_complete, when we're rtp->ice, rather than when ast_rtp_remote_address_set. Keep the existing flush from the recent change to res_rtp_remote_address_set if ice is not being used. ASTERISK-25614 #close Reported-by: XenCALL Tested by: XenCALL Change-Id: Ie2caedbdee1783159f375589b6fd3845c8577ba5
2015-12-18Merge "json: Audit ast_json_* usage for thread safety."Joshua Colp
2015-12-17res_sorcery_memory_cache: Add support for a full backend cache.Joshua Colp
This change introduces the configuration option 'full_backend_cache' which changes the cache to be a full mirror of the backend instead of a per-object cache. This allows all sorcery retrieval operations to be carried out against it and is useful for object types which are used in a "retrieve all" or "retrieve some" pattern. ASTERISK-25625 #close Change-Id: Ie2993487e9c19de563413ad5561c7403b48caab5
2015-12-16json: Audit ast_json_* usage for thread safety.Joshua Colp
The JSON library Asterisk uses, jansson, is not thread safe for us in a few ways. To help with this wrappers for JSON object reference count increasing and decreasing were added which use a global lock to ensure they don't clobber over each other. This does not extend to reference count manipulation within the jansson library itself. This means you can't safely use the object borrowing specifier (O) in ast_json_pack and you can't share JSON instances between objects. This change removes uses of the O specifier and replaces them with the o specifier and an explicit ast_json_ref. Some cases of instance sharing have also been removed. ASTERISK-25601 #close Change-Id: I06550d8b0cc1bfeb56cab580a4e608ae4f1ec7d1
2015-12-15res_rtp_asterisk.c: Fix DTLS negotiation delays.server-pandora
- Trigger pending DTLS packets to send out, once the RTP instance's remote address is set. - Avoids locking the DTLS structure unnecessarily by only doing this if DTLS is passive. - Add DTLS locks around the structurally sensitive calls in the SSL portion of __rtp_recvfrom, since dtls_srtp_check_pending does not lock inside of itself, and we're dealing with the SSL BIO in at least two threads. WebRTC channels may receive a DTLS handshake before ast_rtp_remote_address_set is called, which causes there to be a pending response to send out. Previous to 1ad827, this was handled by calling dtls_srtp_check_pending on receipt of any RTP packet - a STUN or RTP packet could trigger the pending handshake response. Since that was rightfully removed, whenever the DTLS handshake is received before the remote address is set, we would have to wait until another SSL packet arrives. As of Chrome M47's optimizations to their handshake process, WebRTC conversations between Chrome M47+ and Asterisk, where Asterisk is passive, experience a 1 second delay without this patch, because the SSL handshake is received before ICE negotation stores the remote_address, and the next SSL packet isn't received until after a 1 second timeout in Chrome, which causes a new handshake request. ASTERISK-25614 #close Change-Id: I547f1be7e302dbf71f6553dd8cbc0657b1d0b908
2015-12-12pjsip/config_transport: Check pjproject version at runtime for async opsGeorge Joseph
pjproject < 2.5.0 will segfault on a tls transport if async_operations is greater than 1. A runtime version check has been added to throw an error if the version is < 2.5.0 and async_operations > 1. To assist in the check, a new api "ast_compare_versions" was added to utils which compares 2 major.minor.patch.extra version strings. ASTERISK-25615 #close Change-Id: I8e88bb49cbcfbca88d9de705496d6f6a8c938a98 Reported-by: George Joseph Tested-by: George Joseph
2015-12-10Merge "res_pjsip: Add existence and readablity checks for tls related files"Joshua Colp
2015-12-10Merge "res_chan_stats: Fix bug to send correct statistics to StatsD"Joshua Colp
2015-12-09res_chan_stats: Fix bug to send correct statistics to StatsDtcambron
Fixed a bug that originally would show a negative number of active calls occuring in Asterisk. A gauge is persistent so incrementing and decrementing it results in a more consistent performance. Also changed to the call to StatsD to use ast_statsd_log_string() so that a "+" could be sent to StatsD. ASTERISK-25619 #close Change-Id: Iaaeff5c4c6a46535366b4d16ea0ed0ee75ab2ee7
2015-12-08res_pjsip: Add existence and readablity checks for tls related filesGeorge Joseph
Both transport and endpoint now check for the existence and readability of tls certificate and key files before passing them on to pjproject. This will cause the object to not load rather than waiting for pjproject to discover that there's a problem when a session is attempted. NOTE: chan_sip also uses ast_rtp_dtls_cfg_parse but it's located in build_peer which is gigantic and I didn't want to disturb it. Error messages will emit but it won't interrupt chan_sip loading. ASTERISK-25618 #close Change-Id: Ie43f2c1d653ac1fda6a6f6faecb7c2ebadaf47c9 Reported-by: George Joseph Tested-by: George Joseph
2015-12-08res_pjsip/config_transport: Prevent async_operations > 1 when protocol = tlsGeorge Joseph
See ASTERISK-25615. If the transport protocol is tls and async_operations > 1, pjproject will segfault if more than one operation is attempted on the same socket. Until this is fixed upstream, a check has been added to throw an error if a tls transport config has async_operations set to > 1. ASTERISK-25615 Change-Id: I76b9a5b2a5a0054fe71ca5851e635f2dca7685a6 Reported-by: George Joseph Tested-by: George Joseph
2015-12-04res_pjsip/contacts/statsd: Make contact lifecycle events more consistentGeorge Joseph
It will never be perfect or even pretty, mostly because of the differences between static and dynamic contacts. Created: Can't use the contact or contact_status alloc functions because the objects come and go regardless of the actual state. Can't use the contact_apply_handler, ast_sip_location_add_contact or a sorcery created handler because they only get called for dynamic contacts. Similarly, permanent_uri_handler only gets called for static contacts. So, Matt had it right. :) ast_res_pjsip_find_or_create_contact_status is the only place it can go and not have duplicated code. Both permanent_uri_handler and contact_apply_handler call find_or_create. Removed: Can't use the destructors for the same reason as above. The only place to put this is in persistent_endpoint_contact_deleted_observer which I believe is the "correct" place but even that will handle only dynamic contacts. This doesn't called on shutdown however. There is no hook to use for static contacts that may be removed because of a config change while asterisk is in operation. I moved the cleanup of contact_status from ast_sip_location_delete_contact to the handler as well. Status Change and RTT: Although they worked fine where they were (in update_contact_status) I moved them to persistent_endpoint_contact_status_observer to make it more consistent with removed. There was logic there already to detect a state change. Finally, fixed a nit in permanent_uri_handler rmudgett reported eralier. ASTERISK-25608 #close Change-Id: I4b56e7dfc3be3baaaf6f1eac5b2068a0b79e357d Reported-by: George Joseph Tested-by: George Joseph
2015-12-04Merge "res_format_attr_vp8: In SDP, forward max-fr and max-fs for ↵Matt Jordan
video-codec VP8."
2015-12-04Merge "res_format_attr_opus: Update to latest RFC 7587."Matt Jordan
2015-12-04res_format_attr_vp8: In SDP, forward max-fr and max-fs for video-codec VP8.Alexander Traud
ASTERISK-25584 #close Change-Id: Iae00071b4ff1ae76f24995aeac4d00284fd14f91
2015-12-04res_format_attr_opus: Update to latest RFC 7587.Alexander Traud
Beside that, the format-attribute module sends only non-default values in the line fmtp, now. This avoids unnecessary overhead in SDP messages. Furthermore, previously the parameter stereo was not parsed when being the first parameter. ASTERISK-25583 #close Change-Id: Iae85ba3e5960bfd5d51cf65bcffad00dd4875a73
2015-12-03Merge "res_pjsip: Use a MD5 hash for static Contact IDs"Joshua Colp
2015-12-03Merge "res_pjsip: Update logging to show contact->uri in messages"Joshua Colp
2015-12-03res_pjsip: Use a MD5 hash for static Contact IDsGeorge Joseph
When 90d9a70789 was merged, it mostly tested dynamic contacts created as a result of registering a PJSIP endpoint. Contacts generated in this fashion typically have a long alphanumeric string as their object identifier, which maps reasonably well for StatsD. Unfortunately, this doesn't work in the general case. StatsD treats both '.' and ':' characters as special characters. In particular, having a ':' appear in the middle of a StatsD metric will result in the metric being rejected. This causes some obvious issues with SIP URIs. The StatsD API should not be responsible for escaping the metric name passed to it. The metric is treated as a single long string, and it would be challenging to know what to escape in the string passed to the function. Likewise, we don't want to escape the metric in PJSIP, as that involves overhead that is wasted when either res_statsd isn't loaded or enabled. This patch takes an alternative approach. The Contact ID has been changed to be "aor@@uri_hash" instead of "aor@@uri". This (a) won't contain any of the aforementioned special characters, (b) can be done on Contact creation, which has minimal impact on run-time performance, and (c) also conforms to an earlier commit that changed the ID for dynamic contacts. The downside of this is that StatsD users will have to map SHA1 hashes back to the Contacts that are emitting the statistics. To that end, the CLI commands have been updated to include the first 10 characters of the MD5 hash, which should be enough to match what is shown in Graphite (or some other StatsD backend). ASTERISK-25595 #close Change-Id: Ic674a3307280365b4a45864a3571c295b48a01e2 Reported-by: Matt Jordan Tested-by: George Joseph
2015-12-02res_pjsip: Update logging to show contact->uri in messagesGeorge Joseph
An earlier commit changed the id of dynamic contacts to contain a hash instead of the uri. This patch updates status change logging to show the aor/uri instead of the id. This required adding the aor id to contact and contact_status and adding uri to contact_status. The aor id gets added to contact and contact_status in their allocators and the uri gets added to contact_status in pjsip_options when the contact_status is created or updated. ASTERISK-25598 #close Reported-by: George Joseph Tested-by: George Joseph Change-Id: I56cbec1d2ddbe8461367dd8b6da8a6f47f6fe511
2015-12-01res_sorcery_memory_cache.c: Fix off nominal ref leak.Richard Mudgett
Change-Id: If83d63cf11cbc6df9b15251848b01feb570ade49
2015-11-25fastagi: record file closed after sending resultKevin Harwell
The fastagi record-file testsuite test sometimes fails reporting an empty recorded file. This was happening because Asterisk was sending the agi result notification prior to actually closing the file and the data, being buffered, had not been written to the file yet when the test attempts to check the file size. This patch makes it so the record file stream is closed prior to sending the agi result notification. ASTERISK-25593 #close Change-Id: I6b2b3be3ae37f7c7b18e672c419a89b3b8513cde
2015-11-24Merge "Fixed some typos"Matt Jordan
2015-11-24Fixed some typosDavid M. Lee
Fixes some minor typos in the CHANGES file, plus an embarrasing typo in the StatsD API. Change-Id: I9ca4858c64a4a07d2643b81baa64baebb27a4eb7
2015-11-24res_pjsip_notify: Fix CLI usage infoCorey Farrell
The usage info for 'pjsip send notify' previously referenced the chan_sip configuration sip_notify.conf. Fix this to reference the correct configuration pjsip_notify.conf. ASTERISK-25590 #close Change-Id: I3898271a8e8a8b1db201741e790ebe2c6bf5cdea