summaryrefslogtreecommitdiff
path: root/channels/sip
AgeCommit message (Collapse)Author
2017-12-22Remove as much trailing whitespace as possible.Sean Bright
Change-Id: I873c1c6d00f447269bd841494459efccdd2c19c0
2017-12-20Fix Common Typo's.Corey Farrell
Fix instances of: * Retreive * Recieve * other then * different then * Repeated words ("the the", "an an", "and and", etc). * othterwise, teh ASTERISK-24198 #close Change-Id: I3809a9c113b92fd9d0d9f9bac98e9c66dc8b2d31
2017-12-04security-events: Fix SuccessfulAuth using_password declaration.Richard Mudgett
The SuccessfulAuth using_password field was declared as a pointer to a uint32_t when the field was later read as a uint32_t value. This resulted in unnecessary casts and a non-portable field value reinterpret in main/security_events.c:add_json_object(). i.e., It would work on a 32 bit architecture but not on a 64 bit big endian architecture. Change-Id: Ia08bc797613a62f07e5473425f9ccd8d77c80935
2017-09-19chan_sip: Expose read-only access to the full SIP INVITE Request-URIDavid J. Pryke
Provide a way to get the contents of the the Request URI from the initial SIP INVITE in dial plan function call. (In this case "${CHANNEL(ruri)}") ASTERISK-27278 Reported by: David J. Pryke Tested by: David J. Pryke Change-Id: I1dd4d6988eed1b6c98a9701e0e833a15ef0dac3e
2017-08-03Correct some leaks in unit tests.Corey Farrell
* chan_sip: channel in test_sip_rtpqos_1. * test_config: config hook, config info and global config holder. * test_core_format: format in format_attribute_set_without_interface. * test_stream: unneeded frame duplication. * test_taskprocessor: task_data. Change-Id: I94d364d195cf3b3b5de2bf3ad565343275c7ad31
2017-03-17chan_sip: Add rtcp-mux supportSean Bright
ASTERISK-26846 #close Change-Id: I541a1602ff55ab73684e9f8002edb9e0e745d639
2016-10-27Remove ASTERISK_REGISTER_FILE.Corey Farrell
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes all traces of it. Previously exported symbols removed: * __ast_register_file * __ast_unregister_file * ast_complete_source_filename This also removes the mtx_prof static variable that was declared when MTX_PROFILE was enabled. This variable was only used in lock.c so it is now initialized in that file only. ASTERISK-26480 #close Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-09-23chan_sip: Address runaway when realtime peers subscribe to mailboxesGeorge Joseph
Users upgrading from asterisk 13.5 to a later version and who use realtime with peers that have mailboxes were experiencing runaway situations that manifested as a continuous stream of taskprocessor congestion errors, memory leaks and an unresponsive chan_sip. A related issue was that setting rtcachefriends=no NEVER worked in asterisk 13 (since the move to stasis). In 13.5 and earlier, when a peer tried to register, all of the stasis threads would block and chan_sip would again become unresponsive. After 13.5, the runaway would happen. There were a number of causes... * mwi_event_cb was (indirectly) calling build_peer even though calls to mwi_event_cb are often caused by build_peer. * In an effort to prevent chan_sip from being unloaded while messages were still in flight, destroy_mailboxes was calling stasis_unsubscribe_and_join but in some cases waited forever for the final message. * add_peer_mailboxes wasn't properly marking the existing mailboxes on a peer as "keep" so build_peer would always delete them all. * add_peer_mwi_subs was unsubscribing existing mailbox subscriptions then just creating them again. All of this was causing a flood of subscribes and unsubscribes on multiple threads all for the same peer and mailbox. Fixes... * add_peer_mailboxes now marks mailboxes correctly and build_peer only deletes the ones that really are no longer needed by the peer. * add_peer_mwi_subs now only adds subscriptions marked as "new" instead of unsubscribing and resubscribing everything. It also adds the peer object's address to the mailbox instead of its name to the subscription userdata so mwi_event_cb doesn't have to call build_peer. With these changes, with rtcachefriends=yes (the most common setting), there are no leaks, locks, loops or crashes at shutdown. rtcachefriends=no still causes leaks but at least it doesn't lock, loop or crash. Since making rtcachefriends=no work wasnt in scope for this issue, further work will have to be deferred to a separate patch. Side fixes... * The ast_lock_track structure had a member named "thread" which gdb doesn't like since it conflicts with it's "thread" command. That member was renamed to "thread_id". ASTERISK-25468 #close Change-Id: I07519ef7f092629e1e844f855abd279d6475cdd0
2016-08-16Refactor usage pattern of xmldoc info tag.Corey Farrell
This updates func_channel.c and main/message.c to use a generic xpointer include instead of including info from each channel driver. Now the name attribute of info is CHANNEL or CHANNEL_EXAMPLES to be included in documentation for func_channel. Setting the name attribute of info to MessageToInfo or MessageFromInfo causes it to be included in the MessageSend application and AMI action. Change-Id: I89fd8276a3250824241a618009714267d3a8d1ea
2016-08-15func_channel: Reorganize documentationMatt Jordan
* Following the example of the PJSIP channel driver, the channel technology specific documentation has been moved to the respective channel drivers that provide that functionality. This has the benefit of locating the documentation of items with those modules that provide it. * Examples of using the CHANNEL function for both standard items as well as for PJSIP have been added. * The 'max_forwards' standard item has been documented. Change-Id: Ifaa79a232c8ac99cf8da6ef6cc7815d398b1b79b
2016-07-18Unit tests: Use AST_TEST_DEFINE in conditional code only.Corey Farrell
If AST_TEST_DEFINE is not conditional to TEST_FRAMEWORK it produces dead code. This places all existing unit tests into a conditional block if they weren't already. ASTERISK-26211 #close Change-Id: I8ef83ee11cbc991b07b7a37ecb41433e8c734686
2016-03-16chan_sip.c: Fix registration timeout and expire deadlock potential.Richard Mudgett
This patch is part of a series to resolve deadlocks in chan_sip.c. Stopping a scheduled event can result in a deadlock if the scheduled event is running when you try to stop the event. If you hold a lock needed by the scheduled event while trying to stop the scheduled event then a deadlock can happen. The general strategy for resolving the deadlock potential is to push the actual starting and stopping of the scheduled events off onto the scheduler/do_monitor() thread by scheduling an immediate one shot scheduled event. Some restructuring may be needed because the code may assume that the start/stop of the scheduled events is immediate. ASTERISK-25023 Change-Id: I2e40de89efc8ae6e8850771d089ca44bc604b508
2016-03-16chan_sip.c: Fix session timers deadlock potential.Richard Mudgett
This patch is part of a series to resolve deadlocks in chan_sip.c. Stopping a scheduled event can result in a deadlock if the scheduled event is running when you try to stop the event. If you hold a lock needed by the scheduled event while trying to stop the scheduled event then a deadlock can happen. The general strategy for resolving the deadlock potential is to push the actual starting and stopping of the scheduled events off onto the scheduler/do_monitor() thread by scheduling an immediate one shot scheduled event. Some restructuring may be needed because the code may assume that the start/stop of the scheduled events is immediate. ASTERISK-25023 Change-Id: I6d65269151ba95e0d8fe4e9e611881cde2ab4900
2016-03-16chan_sip.c: Fix autokillid deadlock potential.Richard Mudgett
This patch is part of a series to resolve deadlocks in chan_sip.c. Stopping a scheduled event can result in a deadlock if the scheduled event is running when you try to stop the event. If you hold a lock needed by the scheduled event while trying to stop the scheduled event then a deadlock can happen. The general strategy for resolving the deadlock potential is to push the actual starting and stopping of the scheduled events off onto the scheduler/do_monitor() thread by scheduling an immediate one shot scheduled event. Some restructuring may be needed because the code may assume that the start/stop of the scheduled events is immediate. * Fix clearing autokillid in __sip_autodestruct() even though we could reschedule. ASTERISK-25023 Change-Id: I450580dbf26e2e3952ee6628c735b001565c368f
2016-03-16sip/dialplan_functions.c: Fix /channels/chan_sip/test_sip_rtpqos crash.Richard Mudgett
This patch is part of a series to resolve deadlocks in chan_sip.c. Delaying destruction of the chan_sip sip_pvt structures caused the /channels/chan_sip/test_sip_rtpqos unit test to crash. That test registers a special test ast_rtp_engine with the rtp engine module. When the unit test completes it cleans up by unregistering the test ast_rtp_engine and exits. Since the delayed destruction of the sip_pvt happens after the unit test returns, the destructor tries to call the rtp engine destroy callback of the test ast_rtp_engine auto variable which no longer exists on the stack. * Change the test ast_rtp_engine auto variable to a static variable. Now the variable can still exist after the unit test exits so the delayed sip_pvt destruction can complete successfully. ASTERISK-25023 Change-Id: I61e34a12d425189ef7e96fc69ae14993f82f3f13
2016-03-14chan_sip.c: Simplify sip_pvt destructor call levels.Richard Mudgett
Remove destructor calling destroy_it calling really_destroy_it for no benefit. Just make the destructor the really_destroy_it function. Change-Id: Idea0d47b27dd74f2488db75bcc7f353d8fdc614a
2016-01-21Merge "chan_sip: option 'notifyringing' change and doc fix"Mark Michelson
2015-12-26chan_sip: option 'notifyringing' change and doc fixWard van Wanrooij
In the sample sip.conf this is written with regard to notifyringing: ;notifyringing = no ; Control whether subscriptions already INUSE get sent RINGING when another call is sent (default: yes) However, this setting changes whether or not any RINGING indications are sent to subscriptions. There is no separate configurable setting that allows to control whether INUSE subscriptions also get sent RINGING. This is however a useful option, to see (using BLF) if somebody else is able to handle an incoming call or if everybody is busy. This patch corrects the documentation for notifyringing (so the documentation matches the functionality) and make notifyringing a tri-state option, by adding the value 'notinuse' (in addition to 'yes' and 'no'). When notifyringing = notinuse, only subscriptions that are not INUSE are sent the RINGING signal. The default setting for notifyringing remains set to yes, so the default behaviour is not affected. ASTERISK-25558 Change-Id: I88f7036ee084bb3f43b74f15612695c6708f74aa
2015-12-01Audit improper usage of scheduler exposed by 5c713fdf18f.Richard Mudgett
channels/chan_iax2.c: * Initialize struct chan_iax2_pvt scheduler ids earlier because of iax2_destroy_helper(). channels/chan_sip.c: channels/sip/config_parser.c: * Fix initialization of scheduler id struct members. Some off nominal paths had 0 as a scheduler id to be destroyed when it was never started. chan_skinny.c: * Fix some scheduler id comparisons that excluded the valid 0 id. channel.c: * Fix channel initialization of the video stream scheduler id. pbx_dundi.c: * Fix channel initialization of the packet retransmission scheduler id. ASTERISK-25476 Change-Id: I07a3449f728f671d326a22fcbd071f150ba2e8c8
2015-11-03chan_sip: Allow websockets to be disabled.Corey Farrell
This patch adds a new setting "websockets_enabled" to sip.conf. Setting this to false allows chan_sip to be used without causing conflicts with res_pjsip_transport_websocket. ASTERISK-24106 #close Reported by: Andrew Nagy Change-Id: I04fe8c4f2d57b2d7375e0e25826c91a72e93bea7
2015-10-06chan_sip: Fix port parsing for IPv6 addresses in SIP Via headers.Florian Sauerteig
If a Via header containes an IPv6 address and a port number is ommitted, as it is the standard port, we now leave the port empty and to not set it to the value after the first colon of the IPv6 address. ASTERISK-25443 #close Change-Id: Ie3c2f05471cd006bf04ed15598589c09577b1e70
2015-08-13chan_sip.c: wrong peer searched in sip_report_security_eventKevin Harwell
In chan_sip, after handling an incoming invite a security event is raised describing authorization (success, failure, etc...). However, it was doing a lookup of the peer by extension. This is fine for register messages, but in the case of an invite it may search and find the wrong peer, or a non existent one (for instance, in the case of call pickup). Also, if the peers are configured through realtime this may cause an unnecessary database lookup when caching is enabled. This patch makes it so that sip_report_security_event searches by IP address when looking for a peer instead of by extension after an invite is processed. ASTERISK-25320 #close Change-Id: I9b3f11549efb475b6561c64f0e6da1a481d98bc4
2015-05-04Modules: Make ast_module_info->self available to auxiliary sources.Corey Farrell
ast_module_info->self is often needed to register items with the core. Many modules have ad-hoc code to make this pointer available to auxiliary sources. This change updates the module build process to make the needed information available to all sources in a module. ASTERISK-25056 #close Reported by: Corey Farrell Change-Id: I18c8cd58fbcb1b708425f6757becaeca9fa91815
2015-04-13git migration: Refactor the ASTERISK_FILE_VERSION macroMatt Jordan
Git does not support the ability to replace a token with a version string during check-in. While it does have support for replacing a token on clone, this is somewhat sub-optimal: the token is replaced with the object hash, which is not particularly easy for human consumption. What's more, in practice, the source file version was often not terribly useful. Generally, when triaging bugs, the overall version of Asterisk is far more useful than an individual SVN version of a file. As a result, this patch removes Asterisk's support for showing source file versions. Specifically, it does the following: * Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and remove passing the version in with the macro. Other facilities than 'core show file version' make use of the file names, such as setting a debug level only on a specific file. As such, the act of registering source files with the Asterisk core still has use. The macro rename now reflects the new macro purpose. * main/asterisk: - Refactor the file_version structure to reflect that it no longer tracks a version field. - Remove the "core show file version" CLI command. Without the file version, it is no longer useful. - Remove the ast_file_version_find function. The file version is no longer tracked. - Rename ast_register_file_version/ast_unregister_file_version to ast_register_file/ast_unregister_file, respectively. * main/manager: Remove value from the Version key of the ModuleCheck Action. The actual key itself has not been removed, as doing so would absolutely constitute a backwards incompatible change. However, since the file version is no longer tracked, there is no need to attempt to include it in the Version key. * UPGRADE: Add notes for: - Modification to the ModuleCheck AMI Action - Removal of the "core show file version" CLI command Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2015-04-10chan_sip: make progressinband default to noKevin Harwell
After the "progressinband" value setting of "never" was updated to never send a 183 this separated its use from the "no" value. Since "never" was the default, but most users probably expect "no" this patch updates the default for the "progressinband" setting to "no." ASTERISK-24835 #close Reported by: Andrew Nagy Review: https://reviewboard.asterisk.org/r/4606/ ........ Merged revisions 434654 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-31chan_sip: Fix expression in unit test /channels/chan_sip/test_sip_rtpqos.Richard Mudgett
Fix misplaced parentheses in original fabs() expression. ........ Merged revisions 433816 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433817 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-30clang compiler warnings: Fix -Wabsolute-value warningsMatthew Jordan
This patch fixes several warnings caught by clang - in this case, usage of the abs function on non-integer values. This patch uses labs and fabs, as appropriate, in the various affected files. Review: https://reviewboard.asterisk.org/r/4525 ASTERISK-24917 Reported by: dkdegroot patches: rb4525.patch submitted by dkdegroot (License 6600) ........ Merged revisions 433749 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 433750 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433751 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-19chan_sip: Simplify dialog/peer references, improve REF_DEBUG output.Corey Farrell
* Replace functions for ref/undef of dialogs and peers with macro's to call ao2_t_bump/ao2_t_cleanup. * Enable passthough of REF_DEBUG caller information to sip_alloc and find_call. ASTERISK-24882 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4189/ ........ Merged revisions 433115 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433116 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-13Logger: Convert 'struct ast_callid' to unsigned int.Corey Farrell
Switch logger callid's from AO2 objects to simple integers. This helps in two ways. Copying integers is faster than referencing AO2 objects, so this will result in a small reduction in logger overhead. This also erases the possibility of an infinate loop caused by an invalid callid in threadstorage. ASTERISK-24833 #comment Committed callid conversion to trunk. Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4466/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432834 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-01-26Various fixes for OS XDavid M. Lee
This patch addresses compilation errors on OS X. It's been a while, so there's quite a few things. * Fixed __attribute__ decls in route.h to be portable. * Fixed htonll and ntohll to work when they are defined as macros. * Replaced sem_t usage with our ast_sem wrapper. * Added ast_sem_timedwait to our ast_sem wrapper. * Fixed some GCC 4.9 warnings using sig*set() functions. * Fixed some format strings for portability. * Fixed compilation issues with res_timing_kqueue (although tests still fail on OS X). * Fixed menuconfig /sbin/launchd detection, which disables res_timing_kqueue on OS X). ASTERISK-24539 #close Reported by: George Joseph ASTERISK-24544 #close Reported by: George Joseph Review: https://reviewboard.asterisk.org/r/4327/ ........ Merged revisions 431092 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431093 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-11-19ast_str: Fix improper member access to struct ast_str members.Richard Mudgett
Accessing members of struct ast_str outside of the string manipulation API routines is invalid since struct ast_str is supposed to be treated as opaque. Review: https://reviewboard.asterisk.org/r/4194/ ........ Merged revisions 428244 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 428245 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 428246 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@428255 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-31channels/sip/reqresp_parser: Fix unit tests for r426594Matthew Jordan
When r426594 was made, it did not take into account a unit test that verified that the function properly populated the unsupported buffer. The function would previously memset the buffer if it detected it had any contents; since this function can now be called iteratively on successive headers, the unit tests would now fail. This patch updates the unit tests to reset the buffer themselves between successive calls, and updates the documentation of the function to note that this is now required. ........ Merged revisions 426858 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 426860 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 426863 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 426865 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@426868 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-10-30channels/chan_sip: Support mutltiple Supported and Required headersMatthew Jordan
A SIP request may contain multiple Supported: and Required: headers. Currently, chan_sip only parses the first Supported/Required header it finds. This patch adds support for multiple Supported/Required headers for INVITE requests. Review: https://reviewboard.asterisk.org/r/2478 ASTERISK-21721 #close Reported by: Olle Johansson patches: rb2478.patch uploaded by oej (License 5267) ........ Merged revisions 426594 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 426595 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 426596 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 426597 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@426598 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-08chan_sip: Mark chan_sip and its files as extended supportMatthew Jordan
........ Merged revisions 420562 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420563 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-08-04Add the ability to retrieve the source port of a SIP call.Mark Michelson
This adds the ability to call CHANNEL(recvport) on chan_sip channels to see the port on which an INVITE was received. ASTERISK-24040 #close Reported by dtryba Patches: dialplan_functions.patch uploaded by dtryba (License #6628) Review: https://reviewboard.asterisk.org/r/3781 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419970 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-24chan_sip: complete upgrade to ao2Corey Farrell
This change upgrades sip_registry and sip_subscription_mwi to astobj2. ASTERISK-24067 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/3759/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419438 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-07-20media formats: re-architect handling of media for performance improvementsMatthew Jordan
In the old times media formats were represented using a bit field. This was fast but had a few limitations. 1. Asterisk was limited in how many formats it could handle. 2. Formats, being a bit field, could not include any attribute information. A format was strictly its type, e.g., "this is ulaw". This was changed in Asterisk 10 (see https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal for notes on that work) which led to the creation of the ast_format structure. This structure allowed Asterisk to handle attributes and bundle information with a format. Additionally, ast_format_cap was created to act as a container for multiple formats that, together, formed the capability of some entity. Another mechanism was added to allow logic to be registered which performed format attribute negotiation. Everywhere throughout the codebase Asterisk was changed to use this strategy. Unfortunately, in software, there is no free lunch. These new capabilities came at a cost. Performance analysis and profiling showed that we spend an inordinate amount of time comparing, copying, and generally manipulating formats and their related structures. Basic prototyping has shown that a reasonably large performance improvement could be made in this area. This patch is the result of that project, which overhauled the media format architecture and its usage in Asterisk to improve performance. Generally, the new philosophy for handling formats is as follows: * The ast_format structure is reference counted. This removed a large amount of the memory allocations and copying that was done in prior versions. * In order to prevent race conditions while keeping things performant, the ast_format structure is immutable by convention and lock-free. Violate this tenet at your peril! * Because formats are reference counted, codecs are also reference counted. The Asterisk core generally provides built-in codecs and caches the ast_format structures created to represent them. Generally, to prevent inordinate amounts of module reference bumping, codecs and formats can be added at run-time but cannot be removed. * All compatibility with the bit field representation of codecs/formats has been moved to a compatibility API. The primary user of this representation is chan_iax2, which must continue to maintain its bit-field usage of formats for interoperability concerns. * When a format is negotiated with attributes, or when a format cannot be represented by one of the cached formats, a new format object is created or cloned from an existing format. That format may have the same codec underlying it, but is a different format than a version of the format with different attributes or without attributes. * While formats are reference counted objects, the reference count maintained on the format should be manipulated with care. Formats are generally cached and will persist for the lifetime of Asterisk and do not explicitly need to have their lifetime modified. An exception to this is when the user of a format does not know where the format came from *and* the user may outlive the provider of the format. This occurs, for example, when a format is read from a channel: the channel may have a format with attributes (hence, non-cached) and the user of the format may last longer than the channel (if the reference to the channel is released prior to the format's reference). For more information on this work, see the API design notes: https://wiki.asterisk.org/wiki/display/AST/Media+Format+Rewrite Finally, this work was the culmination of a large number of developer's efforts. Extra thanks goes to Corey Farrell, who took on a large amount of the work in the Asterisk core, chan_sip, and was an invaluable resource in peer reviews throughout this project. There were a substantial number of patches contributed during this work; the following issues/patch names simply reflect some of the work (and will cause the release scripts to give attribution to the individuals who work on them). Reviews: https://reviewboard.asterisk.org/r/3814 https://reviewboard.asterisk.org/r/3808 https://reviewboard.asterisk.org/r/3805 https://reviewboard.asterisk.org/r/3803 https://reviewboard.asterisk.org/r/3801 https://reviewboard.asterisk.org/r/3798 https://reviewboard.asterisk.org/r/3800 https://reviewboard.asterisk.org/r/3794 https://reviewboard.asterisk.org/r/3793 https://reviewboard.asterisk.org/r/3792 https://reviewboard.asterisk.org/r/3791 https://reviewboard.asterisk.org/r/3790 https://reviewboard.asterisk.org/r/3789 https://reviewboard.asterisk.org/r/3788 https://reviewboard.asterisk.org/r/3787 https://reviewboard.asterisk.org/r/3786 https://reviewboard.asterisk.org/r/3784 https://reviewboard.asterisk.org/r/3783 https://reviewboard.asterisk.org/r/3778 https://reviewboard.asterisk.org/r/3774 https://reviewboard.asterisk.org/r/3775 https://reviewboard.asterisk.org/r/3772 https://reviewboard.asterisk.org/r/3761 https://reviewboard.asterisk.org/r/3754 https://reviewboard.asterisk.org/r/3753 https://reviewboard.asterisk.org/r/3751 https://reviewboard.asterisk.org/r/3750 https://reviewboard.asterisk.org/r/3748 https://reviewboard.asterisk.org/r/3747 https://reviewboard.asterisk.org/r/3746 https://reviewboard.asterisk.org/r/3742 https://reviewboard.asterisk.org/r/3740 https://reviewboard.asterisk.org/r/3739 https://reviewboard.asterisk.org/r/3738 https://reviewboard.asterisk.org/r/3737 https://reviewboard.asterisk.org/r/3736 https://reviewboard.asterisk.org/r/3734 https://reviewboard.asterisk.org/r/3722 https://reviewboard.asterisk.org/r/3713 https://reviewboard.asterisk.org/r/3703 https://reviewboard.asterisk.org/r/3689 https://reviewboard.asterisk.org/r/3687 https://reviewboard.asterisk.org/r/3674 https://reviewboard.asterisk.org/r/3671 https://reviewboard.asterisk.org/r/3667 https://reviewboard.asterisk.org/r/3665 https://reviewboard.asterisk.org/r/3625 https://reviewboard.asterisk.org/r/3602 https://reviewboard.asterisk.org/r/3519 https://reviewboard.asterisk.org/r/3518 https://reviewboard.asterisk.org/r/3516 https://reviewboard.asterisk.org/r/3515 https://reviewboard.asterisk.org/r/3512 https://reviewboard.asterisk.org/r/3506 https://reviewboard.asterisk.org/r/3413 https://reviewboard.asterisk.org/r/3410 https://reviewboard.asterisk.org/r/3387 https://reviewboard.asterisk.org/r/3388 https://reviewboard.asterisk.org/r/3389 https://reviewboard.asterisk.org/r/3390 https://reviewboard.asterisk.org/r/3321 https://reviewboard.asterisk.org/r/3320 https://reviewboard.asterisk.org/r/3319 https://reviewboard.asterisk.org/r/3318 https://reviewboard.asterisk.org/r/3266 https://reviewboard.asterisk.org/r/3265 https://reviewboard.asterisk.org/r/3234 https://reviewboard.asterisk.org/r/3178 ASTERISK-23114 #close Reported by: mjordan media_formats_translation_core.diff uploaded by kharwell (License 6464) rb3506.diff uploaded by mjordan (License 6283) media_format_app_file.diff uploaded by kharwell (License 6464) misc-2.diff uploaded by file (License 5000) chan_mild-3.diff uploaded by file (License 5000) chan_obscure.diff uploaded by file (License 5000) jingle.diff uploaded by file (License 5000) funcs.diff uploaded by file (License 5000) formats.diff uploaded by file (License 5000) core.diff uploaded by file (License 5000) bridges.diff uploaded by file (License 5000) mf-codecs-2.diff uploaded by file (License 5000) mf-app_fax.diff uploaded by file (License 5000) mf-apps-3.diff uploaded by file (License 5000) media-formats-3.diff uploaded by file (License 5000) ASTERISK-23715 rb3713.patch uploaded by coreyfarrell (License 5909) rb3689.patch uploaded by mjordan (License 6283) ASTERISK-23957 rb3722.patch uploaded by mjordan (License 6283) mf-attributes-3.diff uploaded by file (License 5000) ASTERISK-23958 Tested by: jrose rb3822.patch uploaded by coreyfarrell (License 5909) rb3800.patch uploaded by jrose (License 6182) chan_sip.diff uploaded by mjordan (License 6283) rb3747.patch uploaded by jrose (License 6182) ASTERISK-23959 #close Tested by: sgriepentrog, mjordan, coreyfarrell sip_cleanup.diff uploaded by opticron (License 6273) chan_sip_caps.diff uploaded by mjordan (License 6283) rb3751.patch uploaded by coreyfarrell (License 5909) chan_sip-3.diff uploaded by file (License 5000) ASTERISK-23960 #close Tested by: opticron direct_media.diff uploaded by opticron (License 6273) pjsip-direct-media.diff uploaded by file (License 5000) format_cap_remove.diff uploaded by opticron (License 6273) media_format_fixes.diff uploaded by opticron (License 6273) chan_pjsip-2.diff uploaded by file (License 5000) ASTERISK-23966 #close Tested by: rmudgett rb3803.patch uploaded by rmudgetti (License 5621) chan_dahdi.diff uploaded by file (License 5000) ASTERISK-24064 #close Tested by: coreyfarrell, mjordan, opticron, file, rmudgett, sgriepentrog, jrose rb3814.patch uploaded by rmudgett (License 5621) moh_cleanup.diff uploaded by opticron (License 6273) bridge_leak.diff uploaded by opticron (License 6273) translate.diff uploaded by file (License 5000) rb3795.patch uploaded by rmudgett (License 5621) tls_fix.diff uploaded by mjordan (License 6283) fax-mf-fix-2.diff uploaded by file (License 5000) rtp_transfer_stuff uploaded by mjordan (License 6283) rb3787.patch uploaded by rmudgett (License 5621) media-formats-explicit-translate-format-3.diff uploaded by file (License 5000) format_cache_case_fix.diff uploaded by opticron (License 6273) rb3774.patch uploaded by rmudgett (License 5621) rb3775.patch uploaded by rmudgett (License 5621) rtp_engine_fix.diff uploaded by opticron (License 6273) rtp_crash_fix.diff uploaded by opticron (License 6273) rb3753.patch uploaded by mjordan (License 6283) rb3750.patch uploaded by mjordan (License 6283) rb3748.patch uploaded by rmudgett (License 5621) media_format_fixes.diff uploaded by opticron (License 6273) rb3740.patch uploaded by mjordan (License 6283) rb3739.patch uploaded by mjordan (License 6283) rb3734.patch uploaded by mjordan (License 6283) rb3689.patch uploaded by mjordan (License 6283) rb3674.patch uploaded by coreyfarrell (License 5909) rb3671.patch uploaded by coreyfarrell (License 5909) rb3667.patch uploaded by coreyfarrell (License 5909) rb3665.patch uploaded by mjordan (License 6283) rb3625.patch uploaded by coreyfarrell (License 5909) rb3602.patch uploaded by coreyfarrell (License 5909) format_compatibility-2.diff uploaded by file (License 5000) core.diff uploaded by file (License 5000) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@419044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-30Recorded merge of revisions 417677 from ↵Joshua Colp
http://svn.asterisk.org/svn/asterisk/branches/11 ........ res_rtp_asterisk: Add SHA-256 support for DTLS and perform DTLS negotiation on RTCP. This change fixes up DTLS support in res_rtp_asterisk so it can accept and provide a SHA-256 fingerprint, so it occurs on RTCP, and so it occurs after ICE negotiation completes. Configuration options to chan_sip and chan_pjsip have also been added to allow behavior to be tweaked (such as forcing the AVP type media transports in SDP). ASTERISK-22961 #close Reported by: Jay Jideliov Review: https://reviewboard.asterisk.org/r/3679/ Review: https://reviewboard.asterisk.org/r/3686/ ........ Merged revisions 417678 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417679 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-26res_http_websocket: Close websocket correctly and use careful fwriteMatthew Jordan
When a client takes a long time to process information received from Asterisk, a write operation using fwrite may fail to write all information. This causes the underlying file stream to be in an unknown state, such that the socket must be disconnected. Unfortunately, there are two problems with this in Asterisk's existing websocket code: 1. Periodically, during the read loop, Asterisk must write to the connected websocket to respond to pings. As such, Asterisk maintains a reference to the session during the loop. When ast_http_websocket_write fails, it may cause the session to decrement its ref count, but this in and of itself does not break the read loop. The read loop's write, on the other hand, does not break the loop if it fails. This causes the socket to get in a 'stuck' state, preventing the client from reconnecting to the server. 2. More importantly, however, is that the fwrite in ast_http_websocket_write fails with a large volume of data when the client takes awhile to process the information. When it does fail, it fails writing only a portion of the bytes. With some debugging, it was shown that this was failing in a similar fashion to ASTERISK-12767. Switching this over to ast_careful_fwrite with a long enough timeout solved the problem. Note that this version of the patch, unlike r417310 in Asterisk 11, exposes configuration options beyond just chan_sip's sip.conf. Configuration options to configure the write timeout have also been added to pjsip.conf and ari.conf. #ASTERISK-23917 #close Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/3624/ ........ Merged revisions 417310 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 417311 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417317 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-19Fix build warnings with TEST_FRAMEWORK enabledKinsey Moore
........ Merged revisions 416732 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 416733 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 416734 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416736 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09Allow Asterisk to compile under GCC 4.10Kinsey Moore
This resolves a large number of compiler warnings from GCC 4.10 which cause the build to fail under dev mode. The vast majority are signed/unsigned mismatches in printf-style format strings. ........ Merged revisions 413586 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 413587 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 413588 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-21chan_sip: Add sendrpid trust optionsJonathan Rose
In r411189, some behavior was changed which made sendrpid behavior act in a more trusting manner by sending full user data for peers set with private caller presence in P-Asserted-Identity headers. Since this changed long time expected behaviors, we decided to pull that patch when that was pointed out by the community. Instead, this patch provides a trust_id_outbound setting which will expose the data per RFC-3325 if set to 'yes' and simply not send the PAI/RPID headers at all if set to 'no'. By default trust_id_outbound will be set to 'legacy' which will preserve the behavior prior to these patches. Extra special thanks to Walter Doekes for providing advice and feedback. (closes issue AST-1301) (closes issue ASTERISK-19465) Reported by: Krzysztof Chmielewski Review: https://reviewboard.asterisk.org/r/3447/ ........ Merged revisions 412744 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 412746 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 412747 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412759 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-17chan_sip: Add SIPURIPHONECONTEXT channel variable for Request TEL URIsMatthew Jordan
This patch is a continuation of https://reviewboard.asterisk.org/r/3349/, committed in r412303. It resolves a finding oej had that the phone-context be available in a channel variable separate from SIPDOMAIN. This patch adds that variable as SIPURIPHONECONTEXT. It also allows a local number (or global number specified in the TEL URI) to be used to look up as a peer. (issue ASTERISK-17179) Review: https://reviewboard.asterisk.org/r/3349/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412467 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-12chan_sip: Support RFC-3966 TEL URIs in inbound INVITE requestsMatthew Jordan
This patch adds support for handling TEL URIs in inbound INVITE requests. This includes the Request URI and the From URI. The number specified in the Request URI will be the destination of the inbound channel in the dialplan. The phone-context specified in the Request URI will be stored in the TELPHONECONTEXT channel variable. Review: https://reviewboard.asterisk.org/r/3349 ASTERISK-17179 #close Reported by: Geert Van Pamel Tested by: Geert Van Pamel patches: asterisk-12.0.0-chan_sip-RFC3966_patch.txt uploaded by Geert Van Pamel (License 6140) asterisk-12.0.0-reqresp_parser-RFC3966_patch.txt uploaded by Geert Van Pamel (License 6140) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412292 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-11main/astobj2: Make REF_DEBUG a menuselect item; improve REF_DEBUG outputMatthew Jordan
This patch does the following: (1) It makes REF_DEBUG a meneselect item. Enabling REF_DEBUG now enables REF_DEBUG globally throughout Asterisk. (2) The ref debug log file is now created in the AST_LOG_DIR directory. Every run will now blow away the previous run (as large ref files sometimes caused issues). We now also no longer open/close the file on each write, instead relying on fflush to make sure data gets written to the file (in case the ao2 call being performed is about to cause a crash) (3) It goes with a comma delineated format for the ref debug file. This makes parsing much easier. This also now includes the thread ID of the thread that caused ref change. (4) A new python script instead for refcounting has been added in the contrib/scripts folder. (5) The old refcounter implementation in utils/ has been removed. Review: https://reviewboard.asterisk.org/r/3377/ ........ Merged revisions 412114 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 412115 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 412153 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412154 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-28chan_sip: Add MESSAGE request to allowed methodsMatthew Jordan
The allowed methods advertised by chan_sip did not previously note the MESSAGE request. Even in Asterisk 1.8, we do accept in-dialog MESSAGE requests; we should advertise that we support MESSAGE requests. ASTERISK-23504 #close ASTERISK-23504 #comment Reported by: Martin Kontsek ASTERISK-23504 #comment Patch sip.h_patch.diff uploaded by Martin Kontsek (license 6587) Review: https://reviewboard.asterisk.org/r/3396/ ........ Merged revisions 411372 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 411373 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 411374 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411375 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-10chan_sip: Isolate code that manages struct sip_route.Corey Farrell
* Move route code to sip/route.c + sip/include/route.h * Rename functions to sip_route_* * Replace ad-hoc list code with macro's from linkedlists.h * Create sip_route_process_header() to processes Path and Record-Route headers (previously done with different code in build_route and build_path) * Add use of const where possible * Move struct uriparams, struct contact and contactliststruct from sip.h to reqresp_parser.h. sip/route.c uses reqresp_parser.h but not sip.h, this was a problem. These moved declares are not used outside of reqresp_parser. * While modifying reqprep() the lack of {} caused me trouble. I added them. * Code outside route.c treats sip_route as an opaque structure, using macro's or procedures for all access. (closes issue ASTERISK-22582) Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/3173/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407926 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-19Voicemail: Remove mailbox identifier format (box@context) assumptions in the ↵Richard Mudgett
system. This change is in preparation for external MWI support. Removed code from the system for normal mailbox handling that appends @default to the mailbox identifier if it does not have a context. The only exception is the legacy hasvoicemail users.conf option. The legacy option will only work for app_voicemail mailboxes. The system cannot make any assumptions about the format of the mailbox identifer used by app_voicemail. chan_sip and chan_dahdi/sig_pri had the most changes because they both tried to interpret the mailbox identifier. chan_sip just stored and compared the two components. chan_dahdi actually used the box information. The ISDN MWI support configuration options had to be reworked because chan_dahdi was parsing the box@context format to get the box number. As a result the mwi_vm_boxes chan_dahdi.conf option was added and is documented in the chan_dahdi.conf.sample file. Review: https://reviewboard.asterisk.org/r/3072/ ........ Merged revisions 404348 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-11-08chan_sip: keep same local (from) tag for outgoing register requestsScott Griepentrog
For outbound register requests the tag on the From line was updated every 20 seconds prior to a successful registration and also once for each registration renewal. That behavior can possibly cause the registration to be denied because of the different tag, and is not aligned with the intention of RFC 3261 8.1.3.5 "... request constitutes a new transaction and SHOULD have the same value of the Call-ID, To, and From of the previous request...". This updates chan_sip to have a field to keep the local tag in the registration structure and use that tag for registration requests where the callid is also unchanged. (closes issue ASTERISK-12117) Reported by: Pawel Pierscionek Review: https://reviewboard.asterisk.org/r/2988/ ........ Merged revisions 402604 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 402605 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 402606 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@402607 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-23memory leaks: Memory leak cleanup patch by Corey Farrell (first set)Jonathan Rose
(issue ASTERSIK-22467) Reported by: Corey Farrell Patches: chan_sip-parse_contact_header_test-free-contacts.patch uploaded by coreyfarrell (license 5909) cli-filename-completion-leak.patch uploaded by coreyfarrell (license 5909) func_math.patch uploaded by corefarrell (license 5909) main-test-cleanup.patch uploaded by coreyfarrell (license 5909) test_dlinklists.patch uploaded by coreyfarrell (license 5909) ........ Merged revisions 401660 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 401661 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 401662 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401663 65c4cc65-6c06-0410-ace0-fbb531ad65f3