summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-04-07app_voicemail/IMAP: IMAP access FATAL error: Out of memoryAlexei Gradinari
Sometimes uw-imap function 'mail_fetchbody' returns huge len which then pass to uw-imap function 'rfc822_base64'. uw-imap tries to allocate huge memory and abort() on fail. This patch check the len. If the len more than max size (128 Mbytes) log error. This patch also set variables len, newlen to avoid uninizialezed len. This patch also check pointer returned by rfc822_base64. ASTERISK-25899 #close Change-Id: I4a0e7d655f11abef6a5224e2169df6d5c1f1caca
2016-04-07pbx: Update doxygen for extension state watchers.Richard Mudgett
Change-Id: Id1403b12136de62a272c01bb355aef65fd2c2d1e
2016-04-07alembic: Remove batch operations (and sqlite support)George Joseph
Because SQLite doesn't support full ALTER capabilities, alembic scripts require batch operations. However, that capability wasn't available until 0.7.0 which some distributions haven't reached yet. Therefore, the batch operations introduced in commit 86d6e44cc (review 2319) have been reverted and SQLite is unsupported again, for now anyway. Tested the full upgrade and downgrade on MySQL/Mariadb and Postgresql. ASTERISK-25890 #close Reported-by: Harley Peters Change-Id: I82eba5456736320256f6775f5b0b40133f4d1c80
2016-04-07res_pjsip_registrar_expire: Fix race condition at shutdown.Joshua Colp
When shutting down, the PJSIP sorcery is destroyed. The registrar expiration module queries the PJSIP sorcery to determine what to expire. As there was no synchronization between termination of the expiration thread and the unloading of the module it was possible for the thread to try to access the PJSIP sorcery after it had been destroyed. This change ensures that the thread is shut down before allowing the module to be considered unloaded. Change-Id: I69fd239edbaaf160c2d37ae00d3ac06e5596fe8b
2016-04-06res_pjsip: Fix configuration setting of "regcontext".Joshua Colp
Due to a merge problem two options were swapped causing the regcontext setting to not get set. Change-Id: Icb33edc668e7357bacbaec2861a6b5ac64edaff1
2016-04-06frame.c: Copy the whole subclass in ast_frdup().Jacek Konieczny
The problem is ast_frdup() does not copy whole frame.subclass for voice, video and image frames, only the format is copied. For video frames, the subclass structure contains the .frame_ending flag used to put the RTP marker where it needs to be. ASTERISK-25894 #close Change-Id: I812ca90e84ed5d4f473b997d0dd0d3c5a915fe33
2016-04-06Merge "res_pjsip: Handle deferred SDP hold/unhold properly." into 13Joshua Colp
2016-04-05res_pjsip: Handle deferred SDP hold/unhold properly.Mark Michelson
Some SIP devices indicate hold/unhold using deferred SDP reinvites. In other words, they provide no SDP in the reinvite. A typical transaction that starts hold might look something like this: * Device sends reinvite with no SDP * Asterisk sends 200 OK with SDP indicating sendrecv on streams. * Device sends ACK with SDP indicating sendonly on streams. At this point, PJMedia's SDP negotiator saves Asterisk's local state as being recvonly. Now, when the device attempts to unhold, it again uses a deferred SDP reinvite, so we end up doing the following: * Device sends reinvite with no SDP * Asterisk sends 200 OK with SDP indicating recvonly on streams * Device sends ACK with SDP indicating sendonly on streams The problem here is that Asterisk offered recvonly, and by RFC 3264's rules, if an offer is recvonly, the answer has to be sendonly. The result is that the device is not taken off hold. What is supposed to happen is that Asterisk should indicate sendrecv in the 200 OK that it sends. This way, the device has the freedom to indicate sendrecv if it wants the stream taken off hold, or it can continue to respond with sendonly if the purpose of the reinvite was something else (like a session timer refresher). The fix here is to alter the SDP negotiator's state when we receive a reinvite with no SDP. If the negotiator's state is currently in the recvonly or inactive state, then we alter our local state to be sendrecv. This way, we allow the device to indicate the stream state as desired. ASTERISK-25854 #close Reported by Robert McGilvray Change-Id: I7615737276165eef3a593038413d936247dcc6ed
2016-04-05Merge "config: Allow filters when appending to a category" into 13Joshua Colp
2016-04-05Merge "res_http_websocket: Make core supported." into 13Joshua Colp
2016-04-05config: Allow filters when appending to a categoryGeorge Joseph
In sorcery based config files where there are multiple categories with the same name, you can't use the (+) operator to reliably append to a category because config.c stops looking when it finds the first one with the same name. Example: [1000] type = endpoint [1000] type = aor [1000](+) authenticate_qualify = yes This config will fail because config.c appends authenticate_qualify to the first category it finds, the endpoint, and that's not valid for endpoint. Solution: The capability to find a category that contains a certain variable already exists so the only real change was to parse anything after the '+' that's not a comma, as a filter string. [1000] type = endpoint [1000] type = aor [1000](+type=aor) authenticate_qualify = yes This now works as expected. Although the following example doesn't make any sense for pjsip, you can even specify multiple filters: [1000](+type=aor&qualify_frequency=10) ASTERISK-25868 #close Reported-by: Nick Repin Change-Id: I10773da4c79db36fbf1993961992af63d3441580
2016-04-05res_http_websocket: Make core supported.Joshua Colp
Websockets are a core part of ARI support and as such this module should also be core supported. Change-Id: I8f9283c6a167152761b92984779bb39e3db51a9c
2016-04-05Merge "stringfields: Refactor to allow fields to be added to the end of ↵Joshua Colp
structures" into 13
2016-04-05Merge "res_rtp_asterisk: Use separate SRTP session for RTCP with DTLS" into 13Joshua Colp
2016-04-04stringfields: Refactor to allow fields to be added to the end of structuresGeorge Joseph
String fields are great, except that you can't add new ones without breaking ABI compatibility because it shifts down everything else in the structure. The only alternative is to add your own char * field to the end of the structure and manage the memory yourself which isn't ideal, especially since you then can't use the OPT_STRINGFIELD_T type. Background: The reason string fields had to be declared inside the AST_DECLARE_STRING_FIELDS block was to facilitate iteration over all declared fields for initialization, compare and copy. Since AST_DECLARE_STRING_FIELDS declared the pool, then the fields, then the manager, you could use the offsets of the pool and manager and iterate over the sequential addresses in between to access the fields. The actual pool, field allocation and field set operations don't actually care where the field is. It's just iteration over the fields that was the problem. Solution: Extended String Fields An extended string field is one that is declared outside the AST_DECLARE_STRING_FIELDS block but still (anywhere) inside the parent structure. Other than using AST_STRING_FIELD_EXTENDED instead of AST_STRING_FIELD, it looks the same as other string fields. It's storage comes from the pool and it participates in string field compare and copy operations peformed on the parent structure. It's also a valid target for the OPT_STRINGFIELD_T aco option type. Implementation: To keep track of the extended fields and make sure that ABI isn't broken, the existing embedded_pool pointer in the manager structure was repurposed to be a pointer to a separate header structure that contains the embedded_pool pointer plus a vector of fields. The length of the manager structure didn't change and the embedded_pool pointer isn't used in the macros, only the stringfields C code. A side benefit of this is that changing the header structure in the future won't break ABI. ast_string_fields_init initializes the normal string fields and appends them to the vector, and subsequent calls to ast_string_field_init_extended initialize and append the extended fields. Cleanup, ast_string_fields_cmp, and ast_string_fields_copy can now work on the vector instead of sequentially traversing the addresses between the pool and manager. The total size of a structure using string fields didn't change, whether using extended fields or not, nor have the offsets of any structure members, either inside the original block or outside. Adding an extended field to the end of a structure is the same as adding a char *. Details: The stringfield C code was pulled out from utils.c and into stringfields.c. It just made sense. Additional work was done in ast_string_field_init and ast_calloc_with_stringfields to handle the allocation of the new header structure and the vector, and the associated cleanup. In the process some additional NULL pointer checking was added. A lot of work was done in stringfields.h since the logic for compare and copy is there. Documentation was added as well as somne additional NULL checking. The ability to call ast_calloc_with_stringfields with a number of structures greater than 1 never really worked. Well, the calloc worked but there was no way to access the additional structures or clean them up. It was agreed that there was no use case for requesting more than 1 structure so an ast_assert was added to prevent it and the iteration code removed. Testing: The stringfield unit tests were updated to test both normal and extended fields. Tests for ast_string_field_ptr_set_by_fields and ast_calloc_with_stringfields were also added. As an ABI test, 13 was compiled from git and the res_pjsip_* modules, except res_pjsip itself, saved off. The patch was then added and a full compile and install was performed. Then the older res_pjsip_* moduled were copied over the installed versions so res_pjsip was new and the rest were old. No issues. contact->aor, which is a char * at the end of contact, was then changed to an extended string field and a recompile and reinstall was performed, again leaving stock versions of the the res_pjsip_* modules. Again, no issues with the res_pjsip_* modules using the old stringfield implementation and with contact->aor as a char *, and res_pjsip itself using the new stringfield implementation and contact->aor being an extended string field. Finally, several existing string fields were converted to extended string fields to test OPT_STRINGFIELD_T. Again, no issues. Change-Id: I235db338c5b178f5a13b7946afbaa5d4a0f91d61
2016-04-04Merge "res_pjsip_mwi: Fix segv caused by ↵Joshua Colp
16c7d8e74a9af13f98c3c22aa9c43ce39965f6b7" into 13
2016-04-04Merge "install_prereq: Fix check_installed_debs remove subversion" into 13Joshua Colp
2016-04-04res_pjsip_mwi: Fix segv caused by 16c7d8e74a9af13f98c3c22aa9c43ce39965f6b7George Joseph
I forgot the new voicemail_extension wasn't a stringfield and didn't check for NULL where I should have. Change-Id: I029482d5c2ab72474838750461bd46b0809c90fb
2016-04-04Merge "res_pjsip_mwi: Allow subscribe to vm access extension as an alias" ↵Joshua Colp
into 13
2016-04-04Merge "res_pjsip_mwi: Add voicemail extension and ↵Joshua Colp
mwi_subscribe_replaces_unsolicited" into 13
2016-04-04install_prereq: Fix check_installed_debs remove subversionGeorge Joseph
check_installed_debs wasn't handling virtual packages like libsrtp-dev and libresample-dev and on multiarch systems it was accidentally filtering out all packages if any :i386 packages were found instead of just filtering out the :i386 packages themselves. Change-Id: Ifd68da0d1ee30cc84df14de3f9b9079d7c3cecda
2016-04-01utils.c: Fix typo in handle_show_locksGeorge Joseph
ast_cli_allow_on_shutdown(e) should have been ast_cli_allow_at_shutdown(e). Change-Id: I4f092495c0b2bfd85c2651e0b5877bf4d05d9faf
2016-03-31Merge "chan_sip: Do not send all codecs on INVITE. Do not break on ↵zuul
Session-Timers." into 13
2016-03-31Merge "res_stasis: Add control ref to playback and recording structs." into 13zuul
2016-03-31Merge "pjproject_bundled: Fix use of LDCONFIG for shared library link ↵Joshua Colp
creation" into 13
2016-03-31Merge "res_stasis: Fix crash on a hanging up channel." into 13Joshua Colp
2016-03-31Merge "res_stasis_recording.c: Cleanup stasis_app_recording_find_by_name()." ↵Joshua Colp
into 13
2016-03-31Merge "res_rtp_asterisk: Fix placement of txcount increment" into 13Joshua Colp
2016-03-31Merge "core_unreal.c: Add clarification comment about channel ref." into 13zuul
2016-03-31Merge "res_stasis.c: Protect channel datastore list from stasis end." into 13zuul
2016-03-30pjproject_bundled: Fix use of LDCONFIG for shared library link creationGeorge Joseph
LDCONFIG apparently isn't set to something sane on all systems so the creation of the shared library links fails. Instead of just testing for non-blank, main/Makefile now checks that LDCONFIG is actually executable and reverts to LN if it isn't. This applies to both libasteriskpj and libasteriskssl. Thanks to 'abelbeck' for pointing out that the issue was LDCONFIG. ASTERISK-25873 #close Reported-by: Hans van Eijsden Change-Id: I25b76379bc637726ec044b2c0e709b56b3701729
2016-03-30res_stasis.c: Protect channel datastore list from stasis end.Richard Mudgett
Change-Id: Ifadc469590bd4d5368e19d3763db3bd1f80fdb95
2016-03-30res_ari: Cannot get control also means channel is unavailable.Richard Mudgett
The only caller of ari_bridges_play_found() has this note: If ari_bridges_play_found fails because the channel is unavailable for playback, The channel will be removed from the playback list soon. We can keep trying to get channels from the list until we either get one that will work or else there isn't a channel for this bridge anymore, in which case we'll revert to ari_bridges_play_new. Change-Id: Ib068141b367ccaa17be0dab4181c98e26c5127d6
2016-03-30res_stasis_recording.c: Cleanup stasis_app_recording_find_by_name().Richard Mudgett
Change-Id: Ic7d93c402c498677a122505558859c853d4e5ac7
2016-03-30core_unreal.c: Add clarification comment about channel ref.Richard Mudgett
Change-Id: I0be0627260cd8d6b6c3cc345949dcfdf32eff1f3
2016-03-30res_stasis: Add control ref to playback and recording structs.Richard Mudgett
The stasis_app_playback and stasis_app_recording structs need to have a struct stasis_app_control ref. Other threads can get a reference to the playback and recording structs from their respective global container. These other threads can then use the control pointer they contain after the control struct has gone. * Add control ref to stasis_app_playback and stasis_app_recording structs. With the refs added, the control command queue can now have a circular control reference which will cause the control struct to never get released if the control's command queue is not flushed when the channel leaves the Stasis application. Also the command queue needs better protection from adding commands if the control->is_done flag is set. * Flush the control command queue on exit. ASTERISK-25882 #close Change-Id: I3cf1fb59cbe6f50f20d9e35a2c07ac07d7f4320d
2016-03-30res_stasis: Fix crash on a hanging up channel.Richard Mudgett
* Give the struct stasis_app_control ao2 object a ref to the channel held in the object. Now the channel will still be around if a thread needs to post a stasis message instead of crash because the topic was destroyed. * Moved stopping any lingering silence generator out of the struct stasis_app_control destructor and made it a part of exiting the Stasis application. Who knows which thread the destructor will be called under so it cannot affect the channel's silence generator. Not only was the channel unprotected when the silence generator was stopped, stasis may no longer even control the channel. ASTERISK-25882 Change-Id: I21728161b5fe638cef7976fa36a605043a7497e4
2016-03-30res_pjsip_mwi: Allow subscribe to vm access extension as an aliasGeorge Joseph
Background: If your extension is 1000 and the voicemail access extension is 1571 and you dial 1571, usually a dialplan rule calls voicemailmain with your extension and you are placed directly in your mailbox. Therefore most admins program the voicemail (or other speed dial) button on their phones to the access extension. Some phones (Snom at least) use whatever is programmed there to also subscribe for MWI and so can't dial one number and subscribe to another. This works fine in chan_sip because chan_sip completely ignores the user portion of the SUBSCRIBE message request URI. If it can match the peer, is subscribes to the peer's mailbox. The user could be set to anything or nothing and you'd still get subscribed to your mailbox. Issue: chan_pjsip actually uses the user portion of the URI to find an aor and its mailboxes. Therefore a subscribe to 1571 results in a 404. Sure, you can create an aor for 1571 but you certainly can't add your entire voicemail system's mailboxes to it and everyone would get notified of every MWI. Solution: When an MWI subscribe comes in and an aor can't be found that matches the resource directly, check the resource against the endpoint's aors. If an aor is found that has a voicemail_extension that matches the resource, use it. ASTERISK-25865 Reported-by: Ross Beer Change-Id: I770ea185f751f1ada888fafb4b452115f1c06e9e
2016-03-30res_pjsip_mwi: Add voicemail extension and mwi_subscribe_replaces_unsolicitedGeorge Joseph
res_pjsip_mwi was missing the chan_sip "vmexten" functionality which adds the Message-Account header to the MWI NOTIFY. Also, specifying mailboxes on endpoints for unsolicited mwi and on aors for subscriptions required that the admin know in advance which the client wanted. If you specified mailboxes on the endpoint, subscriptions were rejected even if you also specified mailboxes on the aor. Voicemail extension: * Added a global default_voicemail_extension which defaults to "". * Added voicemail_extension to both endpoint and aor. * Added ast_sip_subscription_get_dialog for support. * Added ast_sip_subscription_get_sip_uri for support. When an unsolicited NOTIFY is constructed, the From header is parsed, the voicemail extension from the endpoint is substituted for the user, and the result placed in the Message-Account field in the body. When a subscribed NOTIFY is constructed, the subscription dialog local uri is parsed, the voicemail_extension from the aor (looked up from the subscription resource name) is substituted for the user, and the result placed in the Message-Account field in the body. If no voicemail extension was defined, the Message-Account field is not added to the NOTIFY body. mwi_subscribe_replaces_unsolicited: * Added mwi_subscribe_replaces_unsolicited to endpoint. The previous behavior was to reject a subscribe if a previous internal subscription for unsolicited MWI was found for the mailbox. That remains the default. However, if there are mailboxes also set on the aor and the client subscribes and mwi_subscribe_replaces_unsolicited is set, the existing internal subscription is removed and replaced with the external subscription. This allows an admin to configure mailboxes on both the endpoint and aor and allows the client to select which to use. ASTERISK-25865 #close Reported-by: Ross Beer Change-Id: Ic15a9415091760539c7134a5ba3dc4a6a1217cea
2016-03-30Merge "res_pjsip/pjsip_options: Fix From generation on outgoing OPTIONS" ↵Joshua Colp
into 13
2016-03-30res_rtp_asterisk: Fix placement of txcount incrementGeorge Joseph
Commit 1bce690ccb36a4744a327c07af23a9a3a0fa20cd was incrementing txcount for rtcp packets as well as rtp packets and that was causing sender reports to be generated instead of receiver reports in cases where no rtp was actually being sent. Moved the txcount increment from __rtp_sento, which handles both rtp and rtcp, to rtp_sento which only handles rtp packets. Discovered by the hep/rtcp-receiver test. Change-Id: Ie442e4bb947a68847a676497021ba10ffaf376d5
2016-03-29chan_pjsip: Add 'pjsip show channelstats'George Joseph
Added the ability to show channel statistics to chan_pjsip (cli_functions.c) Moved the existing 'pjsip show channel(s)' functionality from pjsip_configuration to cli_functions.c. The stats needed chan_pjsip's private header so it made sense to move the existing channel commands as well. Now using stasis_cache_dump to get the channel snapshots rather than retrieving all endpoints, then getting each one's channel snapshots. Much more efficient. Change-Id: I03b114522126d27434030b285bf6d531ddd79869
2016-03-29Merge "res_rtp_asterisk: Fix packet stats on bridged connection" into 13zuul
2016-03-29res_pjsip/pjsip_options: Fix From generation on outgoing OPTIONSGeorge Joseph
No one seemed to notice but every time an OPTIONS goes out, it goes out with a From of "asterisk" (or whatever the default from_user is set to), even if you specify an endpoint. The issue had several causes... qualify_contact is only called with an endpoint if called from the CLI. If the endpoint is NULL, qualify_contact only looks up the endpoint if authenticate_qualify=yes. Even then, it never passes it on to ast_sip_create_request where the From header is set. Therefore From is always "asterisk" (or whatever the default from_user is set to). Even if ast_sip_create_request were to get an endpoint, it only sets the From if endpoint->from_user is set. The fix is 4 parts... First, create_out_of_dialog_request was modified to use the endpoint id if endpoint was specified and from_user is not set. Second, qualify_contact was modified to always look up an endpoint if one wasn't specified regardless of authenticate_qualify. It then passes the endpoint on to create_out_of_dialog_request. Third (and most importantly), find_an_endpoint was modified to find an endpoint by using an "aors LIKE %contact->aor%" predicate with ast_sorcery_retrieve_by_fields. As such, this patch will only work if the sorcery realtime optimizations patch goes in. Otherwise we'd be pulling the entire endpoints database every time we send an OPTIONS. Since we already know the contact's aor, the on_endpoint callback was also modified to just check if the contact->aor is an exact match to one of the endpoint's. Finally, since we now have an endpoint for every OPTIONS request, res_pjsip/endpt_send_request (which handles out-of-dialog reqests) was updated to get the transport from the endpoint and set it on tdata. Now the correct transport is used. Change-Id: I2207e12bb435e373bd1e03ad091d82e5aba011af
2016-03-29Merge "sorcery/res_pjsip: Refactor for realtime performance" into 13Joshua Colp
2016-03-29Merge "app_echo: forward and generate VIDUPDATE frames" into 13Joshua Colp
2016-03-29res_rtp_asterisk: Use separate SRTP session for RTCP with DTLSJacek Konieczny
Asterisk uses separate UDP ports for RTP and RTCP traffic and RFC 5764 explicitly states: There MUST be a separate DTLS-SRTP session for each distinct pair of source and destination ports used by a media session This means RTP keying material cannot be used for DTLS RTCP, which was the reason why RTCP encryption would fail. ASTERISK-25642 Change-Id: I7e8779d8b63e371088081bb113131361b2847e3a
2016-03-29Merge "res_parking: Misc fixes." into 13zuul
2016-03-29app_echo: forward and generate VIDUPDATE framesJacek Konieczny
When using app_echo via WebRTC with VP8 video the video would appear only after a few minutes, because there would be nothing to request a full reference frame. This fixes the problem in both ways: - echos any VIDUPDATE frames received on the channel - sends one such frame when first video frame is to be forwarded This makes the echo work with Firefox and Chrome WebRTC implementation. ASTERISK-25867 #close Change-Id: I73bda87bf7532ee8bfb28d917045a21034908c1e
2016-03-28res_rtp_asterisk: Fix packet stats on bridged connectionGeorge Joseph
rxcount, txcount, rxoctetcount and txoctetcount weren't being calculated for bridged streams because the calulations were being done after the bridged short-circuit. Actually, rxoctetcount wasn't ever being calculated. Moved the calculations so they occur for all valid received packets and all transmitted packets. Also added rxoctetcount and txoctetcount to ast_rtp_instance_stat. Change-Id: I08fb06011a82d38c3b4068867a615068fbe59cbb