This change basically reverts the change reviewed in
https://reviewboard.asterisk.org/r/374/ and instead limits the
updating of the RTP synchronization source to only those times when we
detect that the other side of the conversation has changed the ssrc.
The problem is that SRCUPDATE control frames are sent many times where
we don't want a new ssrc, including whenever Asterisk has to send DTMF
in a normal bridge. This is also not the first time that this mistake
has been made. The initial implementation of the ast_rtp_new_source
function also changed the ssrc--and then it was removed because of
this same issue. Then, we put it back in again to fix a different
issue. This patch attempts to only change the ssrc when we see that
the other side of the conversation has changed the ssrc.
It also renames some functions to make their purpose more clear.
Review: https://reviewboard.asterisk.org/r/540/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@252089 f38db490-d61c-443f-a65b-d21fe96a405b
The first real test added to the external test suite found a pretty nasty crash
that occurred in Asterisk trunk. The crash was due to a race condition between
the REFER handling and channel destruction in the channel thread. After the
transfer has been completed, we go back to the transferrer channel and try to
lock it so we can fire off a CEL event. However, there was no guarantee that
the channel was still around at that point since it's racing against the channel
thread.
Since ast_channel is a reference counted object, the fix is simple. The code
unlocks the transferrer channel before finally completing the transfer with
an async goto. At this point the channel thread is going to start call tear
down and the channel will eventually be destroyed. To ensure that the channel
is valid when we want to fire off the CEL event, increase the channel's
reference count.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@251137 f38db490-d61c-443f-a65b-d21fe96a405b
The get_local_address() function for an RTP instance was used when building an
SDP, but the results were not honored. The RTP engine activate() function was
not being used once we have determined that media will now flow.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@250917 f38db490-d61c-443f-a65b-d21fe96a405b
When configuring the adaptive jitterbuffer, the target_extra
value not only could not be set from the configuration, but was
not even being set to its proper default. This value is required
in order for the adaptive jitterbuffer to work correctly. To resolve
this a config option has been added to expose this value to the conf
files, and a default value is provided when no config specific value
is present.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@249893 f38db490-d61c-443f-a65b-d21fe96a405b
Uncommenting the REF_DEBUG definition where it was in the source
resulted in only a small part of the astobj2 references being logged
to a file. Moving this up higher in the include list causes all references
to be logged as they should be.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@248347 f38db490-d61c-443f-a65b-d21fe96a405b
I'm working with this code right now trying to analyze a deadlock.
This change is just to clean up a few things before I make a more
complex patch.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@247915 f38db490-d61c-443f-a65b-d21fe96a405b
NULL means the value is not specified for the column, which normally means
the driver uses whatever is the default value. However, on MySQL, placing
a NULL in either a float or integer column results in a retrieval of the 0
value. Hence, users get an errant error on load. This patch suppresses
that error and makes the value as if it was not there.
Note that this cannot be done in the realtime driver, because the lack of
difference between NULL and 0 can only be intepreted correctly by the
driver itself. If we did it in the realtime driver, then it would be
effectively impossible to set any realtime field to 0, because it would act
as if the field were unspecified and possibly take on a different value.
(closes issue #16683)
Reported by: wdoekes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@247787 f38db490-d61c-443f-a65b-d21fe96a405b
Also includes a test for retrieving rtpqos parameters, including a NULL RTP
driver. Additionally, some further separation of the SIP internal API into
headers was necessary.
(closes issue #16652)
Reported by: kkm
Patches:
20100204__issue16652.diff.txt uploaded by tilghman (license 14)
Review: https://reviewboard.asterisk.org/r/501/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@247124 f38db490-d61c-443f-a65b-d21fe96a405b
Code Refactoring Changes
- read_to_parts() moved to reqresp_parser.c and has been renamed as
get_name_and_number()
- get_in_brackets() moved to reqresp_parser.c
- find_closing_quotes() added to sip_utils.h
Logic Changes
- get_name_and_number() now uses parse_uri() and get_calleridname()
for parsing. Before this change only names within quotes were
found, when names not within quotes are possible.
New Unit Tests
-sip_get_name_and_number_test
-sip_get_in_brackets_test
(closes issue #16707)
Reported by: Nick_Lewis
Patches:
issue16706.diff uploaded by dvossel (license 671)
Review: https://reviewboard.asterisk.org/r/499/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@246627 f38db490-d61c-443f-a65b-d21fe96a405b
A patch was committed recently that converted duplicate uri parsing
code to use the parse_uri function. There were two instances where
this conversion did not mimic previous behavior exactly because the
port was not being parsed off the end of the domain. In order to do
this, a dummy pointer argument needs to be passed into parse_uri so
it will know it must parse out the port from the domain. If a port
output paramenter is not present, the domain is returned with the
port still attached.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@246420 f38db490-d61c-443f-a65b-d21fe96a405b
This config option is already handled by the function handle_common_options
and it is unnecessary to parse the value again.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@245230 f38db490-d61c-443f-a65b-d21fe96a405b
First off, these options weren't actually doing anything.
By the time the options were parsed, the peer and dialog
containers had already been allocated with their default
values.
Second, hash table size is something that doesn't really
make sense to change in a config file. If a user is that
interested in changing the hashtable size, he can modify
the source itself.
I have removed the parsing of the hash_peer, hash_user,
and hash_dialog options. I have removed the hash_user_size
variable altogether since it is not used at all. I also
changed hash_peer_size and hash_dialog_size to be constant,
and have changed the symbols to be in all caps as constants
typically are. I have also removed the entire section in
sip.conf.sample regarding configurable hashtable sizes.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@245192 f38db490-d61c-443f-a65b-d21fe96a405b
default expiry was not being set correctly for a registry object.
Thanks to ebroad for reporting the issue and testing the patch.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@244924 f38db490-d61c-443f-a65b-d21fe96a405b
parse_moved_contact attempts to remove a quoted string
twice, and the first try wasn't even being done correctly.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@244769 f38db490-d61c-443f-a65b-d21fe96a405b
New files
- channels/sip/sip.h – A new header for shared #define, enum, and struct
definitions.
- channels/sip/include/sip_utils.h – sip util functions shared among
the all the sip APIs
- channels/sip/include/config_parser.h – sip config-parser API
- channels/sip/config_parser.c – Contains sip.conf parsing helper functions
with unit tests.
- channels/sip/include/reqresp_parser.h – sip request response parser API
- channels/sip/reqresp_parser.c – Contains sip request and response parsing
helper functions with unit tests.
New Unit Tests
- sip_parse_uri_test
- sip_parse_host_test
- sip_parse_register_line_test
Code Refactoring
- All reusable #define, enum, and struct definitions were moved out of chan_sip.c
into sip.h. During this process formatting changes were made to comments
in both sip.h and chan_sip.c in order to better adhere to the coding guidelines.
- The beginnings of three new sip APIs, sip-utils.h, config-parser.h,
reqresp-parser.h using existing chan_sip.c functions.
- parse_uri() and get_calleridname() were moved from chan_sip.c to request-parser.c
along with unit tests for both functions.
- sip_parse_host() and sip_parse_register_line() were moved from chan_sip.c to
config-parser.c along with unit tests for both functions.
Changes to parse_uri()
-removal of the options parameter. It was never used and did not behave correctly.
-additional check for [?header] field. When this field was present, the transport
type was not being set correctly.
----- Overview -----
This patch is introduced with the hope that unit tests for all our sip parsing
functions will be written soon. chan_sip is a huge file, and with the addition of
each unit test chan_sip is going to grow larger and harder to maintain. I'm proposing
we begin refactoring chan_sip, starting with the parsing functions. With each parsing
function we move into a separate helper file, a unit test should accompany it. I've
attempted to lay down the ground work for this change by creating two new parser
helper files (config-parser.c and reqresp-parser.c) and moving all shared structs,
enums, and defines from chan_sip.c into a shared sip.h file. We can't verify everything
in Asterisk using unit tests, but string parsing is one area where unit tests make
the most sense. By beginning to restructure the code in this way, chan_sip not only
becomes less bloated, but Asterisk as a whole will become more stable.
Review: https://reviewboard.asterisk.org/r/477/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@244597 f38db490-d61c-443f-a65b-d21fe96a405b
1. URI Encoding
This patch changes ast_uri_encode()'s behavior when doreserved is enabled.
Previously when doreserved was enabled only a small set of reserved
characters were encoded. This set was comprised primarily of the reserved
characters defined in RFC3261 section 25.1, but contained other characters as
well. Rather than only escaping the reserved set, doreserved now escapes
all characters not within the unreserved set as defined by RFC 3261 and
RFC 2396. Also, the 'doreserved' variable has been renamed to 'do_special_char'
in attempts to avoid confusion.
When doreserve is not enabled, the previous logic of only encoding the
characters <= 0X1F and > 0X7f remains, except for the '%' character, which
must always be encoded as it signifies a HEX escaped character during the decode
process.
2. URI Decoding: Break up URI before decode.
In chan_sip.c ast_uri_decode is called on the entire URI instead of it's
individual parts after it is parsed. This is not good as ast_uri_decode
can introduce special characters back into the URI which can mess up parsing.
This patch resolves this by not decoding a URI until parsing is completely
done. There are many instances where we check to see if pedantic checking
is enabled before we decode a URI. In these cases a new macro,
SIP_PEDANTIC_DECODE, is used on the individual parsed segments of the URI
rather than constantly putting if (pedantic) { decode() } checks everywhere
in the code. In the areas where ast_uri_decode is not dependent upon
pedantic checking this macro is not used, but decoding is still moved to
each individual part of the URI. The only behavior that should change from
this patch is the time at which decoding occurs.
Since I had to look over every place URI parsing occurs to create this
patch, I found several places where we use duplicate code for parsing.
To consolidate the code, those areas have updated to use the parse_uri()
function where possible.
3. SIP display-name decoding according to RFC3261 section 25.
To properly decode the display-name portion of a FROM header, chan_sip's
get_calleridname() function required a complete re-write. More information
about this change can be found in the comments at the beginning of this function.
4. Unit Tests.
Unit tests for ast_uri_encode, ast_uri_decode, and get_calleridname() have been
written. This involved the addition of the test_utils.c file for testing the
utils api.
(closes issue #16299)
Reported by: wdoekes
Patches:
astsvn-16299-get_calleridname.diff uploaded by wdoekes (license 717)
get_calleridname_rewrite.diff uploaded by dvossel (license 671)
Tested by: wdoekes, dvossel, Nick_Lewis
Review: https://reviewboard.asterisk.org/r/469/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@243200 f38db490-d61c-443f-a65b-d21fe96a405b
(closes issue #15819)
Reported by: klaus3000
Patches:
asterisk-sip-show-channelstats-trunk.txt uploaded by klaus3000 (license 65)
Tested by: klaus3000, oej
This patch is for trunk only and will be blocked in 1.6.2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@239663 f38db490-d61c-443f-a65b-d21fe96a405b
The code that handled setting 'm=text' in the sdp was not executing
in the correct order. The check to see if text was needed came after
the check to add 'm=text' to the sdp, this resulted in 'm=text' always
being set to 0 because it looked like text was never required.
(closes issue #16457)
Reported by: peterj
Patches:
textportinsdp.diff uploaded by peterj (license 951)
issue16457.diff uploaded by dvossel (license 671)
Tested by: peterj
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@239427 f38db490-d61c-443f-a65b-d21fe96a405b
Modified handle_verbose to be LOW_MEMORY aware, removed old RTP related code
in chan_sip.
(closes issue #16381)
Reported by: michael_iedema
Patches:
ast_complete_source_filename.patch uploaded by michael iedema (license 942)
modified by me
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@236893 f38db490-d61c-443f-a65b-d21fe96a405b
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r236062 | dvossel | 2009-12-22 10:58:19 -0600 (Tue, 22 Dec 2009) | 11 lines
fixes issue with p->method incorrectly set to ACK
It is possible for a second ACK to come in for a retransmitted message.
If an ack does not match an unacked message in our queue, restore the previous
p->method as this ACK is completely ignored.
(closes issue #16295)
Reported by: omolenkamp
Patches:
issue16295_v2.diff uploaded by dvossel (license 671)
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@236063 f38db490-d61c-443f-a65b-d21fe96a405b
A registration regression caused by a code tweak in (issue #14331)
and a bug fix in (issue #15539) caused some sip registration
config entries to be constructed incorrectly. Origially
issue #14331 contained the code tweak as well as a bug fix, but since
the issue was reported as a tweak the bug fix portion was moved into
issue #15539. Both the tweak and the bug fix contained minor incorrect
logic that resulted in some SIP registrations to fail.
(issue #14331)
(issue #15539)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@235132 f38db490-d61c-443f-a65b-d21fe96a405b
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r234492 | oej | 2009-12-14 11:16:00 +0100 (Mån, 14 Dec 2009) | 8 lines
Stop sending 183's after call hangup.
There where still cases where the 183 keep-alive mechanism would not stop
sending 183's even though the Asterisk server had sent a final reply to
the invite.
EDVX-28
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@234526 f38db490-d61c-443f-a65b-d21fe96a405b
In the process of swapping ULAW to a place in the extended codec space, we
found several unhandled cases, where a 32-bit integer was still being used to
handle a codec field. Most of these have been fixed with this commit, although
there is at least one case (codec_dahdi) which depends upon outside headers to
be altered before a conversion can be made.
(Fixes AST-278, SWP-459)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@231850 f38db490-d61c-443f-a65b-d21fe96a405b
1) Allow users of UDPTL stack to associate a character-string tag with a UDPTL
session, so that log/error/debug messages generated by the UDPTL stack can
be 'connected' to the endpoint that caused them to be generated.
2) Improve comments (and process) of calculating the far end's maximum IFP size
when redundancy mode is in use for error correction.
3) When an IFP larger than the calculated 'far max IFP' size is presented for
writing, truncate it rather than putting in the buffer and allowing the buffer
to overflow; this will cause the ends to retrain to a lower bit rate that
produces IFPs of an appropriate size if possible, and if not possible, the
FAX transfer will fail completely. In these cases, it is due to the one endpoint
supplying a T38FaxMaxDatagram value that is improperly calculated and is
too low to be of use; we have configuration options available to override
this behavior.
4) Eliminate use of T38FaxMaxDatagram value in udptl.conf; it is no longer
needed.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@231692 f38db490-d61c-443f-a65b-d21fe96a405b
Internally the way T.38 is negotiated has changed and the option no longer
reflects a behavior that is valid. It will now look for a CNG tone on
received calls and if present send the call to the 'fax' extension. It is
then up to the application or channel to request the switch over to T.38.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@230881 f38db490-d61c-443f-a65b-d21fe96a405b
With the new code, media level proprieties should no longer be confused with session level proprieties. This change also reorganizes some of the SDP parsing code which should make it easier to manage in the future.
(closes issue #14994)
Reported by: frawd
Tested by: frawd, mnicholson, file
Review: https://reviewboard.asterisk.org/r/414/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@227759 f38db490-d61c-443f-a65b-d21fe96a405b
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r227700 | file | 2009-11-04 15:17:39 -0400 (Wed, 04 Nov 2009) | 5 lines
Fix a security issue where sending a REGISTER with a differing username in the From
URI and Authorization header would reveal whether it was valid or not.
(AST-2009-008)
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@227712 f38db490-d61c-443f-a65b-d21fe96a405b
SIP channel names were supposed to be unique by way of a name suffix derived from the
pointer to the channel's private data. Uniqueness was preserved on 32-bit systems, but
not on 64-bit systems. This patch, as suggested by kpfleming, replaces this suffix with
a simple incremented unsigned int.
(closes issue #15152)
Reported by: palbrecht
Review: https://reviewboard.asterisk.org/r/420/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@226974 f38db490-d61c-443f-a65b-d21fe96a405b
This change adds a configuration option to SIP peers, unsolicited_mailbox, which
configures a virtual mailbox to use for received new/old MWI information. This
virtual mailbox can then be used by any device supporting MWI.
(closes issue #13028)
Reported by: AsteriskRocks
Patches:
bug_13028_chan_sip_external_mwi_20090707.patch uploaded by cmaj (license 830)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@226060 f38db490-d61c-443f-a65b-d21fe96a405b
The ACL check in check_peer_ok was missing and has now been restored. The
missing check allowed for calls to be made on prohibited networks where an ACL
was defined in sip.conf and the allowguest option was set to off. See the AST
security advisory below for more information.
Merge code associated with AST-2009-007.
(closes issue #16091)
Reported by: thom4fun
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@225912 f38db490-d61c-443f-a65b-d21fe96a405b
This patch changes chan_sip to use the new astobj2 OBJ_MULTIPLE iterator support
to make pedantic mode dialog searching in find_call() not require a linear search
of all dialogs in the list of dialogs. This patch does *not* change the dialog
matching logic (more on that later), just improves the searching performance.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@225727 f38db490-d61c-443f-a65b-d21fe96a405b
What this patch fixes
1.Moves sip TCP/TLS connection setup into the TCP helper thread:
Connection setup takes awhile and before this it was being
done while holding the monitor lock.
2.Moves TCP/TLS writing to the TCP helper thread: Through the
use of a packet queue and an alert pipe, the TCP helper thread
can now be woken up to write data as well as read data.
3.Locking error: sip_xmit returned an XMIT_ERROR without giving
up the tcptls_session lock. This lock has been completely removed
from sip_xmit and placed in the new sip_tcptls_write() function.
4.Memory leak: When creating a tcptls_client the tls_cfg was alloced
but never freed unless the tcptls_session failed to start. Now the
session_args for a sip client are an ao2 object which frees the
tls_cfg on destruction.
5.Pointer to stack variable: During sip_prepare_socket the creation
of a client's ast_tcptls_session_args was done on the stack and
stored as a pointer in the newly created tcptls_session. Depending
on the events that followed, there was a slight possibility that
pointer could have been accessed after the stack returned. Given
the new changes, it is always accessed after the stack returns
which is why I found it.
Notable code changes
1.I broke tcptls.c's ast_tcptls_client_start() function into two
functions. One for creating and allocating the new tcptls_session,
and a separate one for starting and handling the new connection.
This allowed me to create the tcptls_session, launch the helper
thread, and then establish the connection within the helper thread.
2.Writes to a tcptls_session are now done within the helper thread.
This is done by using an alert pipe to wake up the thread if new
data needs to be sent. The thread's sip_threadinfo object contains
the alert pipe as well as the packet queue.
3.Since the threadinfo object contains the alert pipe, it must now be
accessed outside of the helper thread for every write (queuing of a
packet). For easy lookup, I moved the threadinfo objects from a
linked list to an ao2_container.
(closes issue #13136)
Reported by: pabelanger
Tested by: dvossel, whys
(closes issue #15894)
Reported by: dvossel
Tested by: dvossel
Review: https://reviewboard.asterisk.org/r/380/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@225445 f38db490-d61c-443f-a65b-d21fe96a405b
This is the second commit for this and documents the text stream using the configured
IP address and fixes a bug in the original patch where the UDPTL stream would also
use the different IP address.
(closes issue #14729)
Reported by: _brent_
Patches:
media_address.patch uploaded by brent (license 388)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@225089 f38db490-d61c-443f-a65b-d21fe96a405b
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r225032 | dvossel | 2009-10-21 09:37:04 -0500 (Wed, 21 Oct 2009) | 20 lines
IAX/SIP shrinkcallerid option
The shrinking of caller id removes '(', ' ', ')', non-trailing '.',
and '-' from the string. This means values such as 555.5555 and
test-test result in 555555 and testtest. There are instances,
such as Skype integration, where a specific value is passed via
caller id that must be preserved unmodified. This patch makes
the shrinking of caller id optional in chan_sip and chan_iax in
order to support such cases. By default this option is on to
preserve previous expected behavior.
(closes issue #15940)
Reported by: dimas
Patches:
v2-15940.patch uploaded by dimas (license 88)
15940_shrinkcallerid_trunk.c uploaded by dvossel (license 671)
Tested by: dvossel
Review: https://reviewboard.asterisk.org/r/408/
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@225033 f38db490-d61c-443f-a65b-d21fe96a405b
Ability has been added to both manager command SIPnotify as well as console
command sip notify. Message body is stored in the "Content" variable. An
example is present in sip_notify.conf.
(closes issue #13926)
Reported by: jthurman
Patches:
sip-notify-svn189463.diff uploaded by gareth (license 208)
Tested by: gareth
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@224035 f38db490-d61c-443f-a65b-d21fe96a405b
chan_sip has some code to automatically switch from T.38 mode to voice mode when
a voice frame is written to the channel while it is in T.38 mode; this was
intended to handle the situation when a FAX transmission has ended and the channel
is not yet hung up, but is causing problems at the beginning of FAX sessions as
well when there are still voice frames 'in flight' at the time the T.38 negotiation
completes. This patch removes the automatic switchover, and changes app_fax to
explicitly switch off T.38 mode when the FAX transmission process ends.
(closes issue #16025)
Reported by: jamicque
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@223652 f38db490-d61c-443f-a65b-d21fe96a405b
If a pending reinvite were sent, we might not properly
send connected party info since we were checking the wrong
flag. This was a rare occurrence, but could still happen
nevertheless.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@223617 f38db490-d61c-443f-a65b-d21fe96a405b
When using callbackextension or specifing the peer name
in a registration string, the peer's specific auth settings
set by the "auth=" strings within the peer definition are not
used by the registration. Thanks to ebroad for reporting the
issue and providing the patch.
(closes issue #15955)
Reported by: ebroad
Patches:
regauthfix.patch uploaded by ebroad (license 878)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@223088 f38db490-d61c-443f-a65b-d21fe96a405b
chan_sip calls pbx_exec on a pvt's owner channel while only the
pvt lock is held. Since pbx_exec calls ast_cel_report_event which
attempts to lock the channel, invalid locking order occurs. Channels
should be locked before pvt's.
(closes issue #15512)
Reported by: lmsteffan
Patches:
ast_cel_deadlock_15512.diff uploaded by dvossel (license 671)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@222981 f38db490-d61c-443f-a65b-d21fe96a405b
externtcpport and externtlsport need to be declared as static
variables. Thanks to russell for finding and pointing this out.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@222947 f38db490-d61c-443f-a65b-d21fe96a405b
Channels are stored in an ao2_container. When accessing an item within
an ao2_container the proper locking order is to first lock the container,
and then the items within it.
In ast_do_masquerade both the clone and original channel must be locked
for the entire duration of the function. The problem with this is that
it attemptes to unlink and link these channels back into the ao2_container
when one of the channel's name changes. This is invalid locking order as
the process of unlinking and linking will lock the ao2_container while
the channels are locked!!! Now, both the channels in do_masquerade are
unlinked from the ao2_container and then locked for the entire function.
At the end of the function both channels are unlocked and linked back
into the container with their new names as hash values.
This new method of requiring all channels and tech pvts to be unlocked
before ast_do_masquerade() or ast_change_name() required several
changes throughout the code base.
(closes issue #15911)
Reported by: russell
Patches:
masq_deadlock_trunk.diff uploaded by dvossel (license 671)
Tested by: dvossel, atis
(closes issue #15618)
Reported by: lmsteffan
Patches:
deadlock_local_attended_transfers_trunk.diff uploaded by dvossel (license 671)
Tested by: lmsteffan, dvossel
Review: https://reviewboard.asterisk.org/r/387/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@222761 f38db490-d61c-443f-a65b-d21fe96a405b
This patch adds support for TCP/TLS in the Contact header when using
NAT, specifically externip or externhost. The original issue was that
Asterisk sent 5060 as the port in the contact header whether TLS was
used or not. Additionally, this patch adds 2 config options to sip.conf,
specifically externtcpport and externtlsport. This allows a user to
specify different external ports for TCP and TLS other than those used
internally, this is especially useful in in a PAT/port redirection setup.
Thanks to ebroad for reporting the issue and providing the patch!
(closes issue #15880)
Reported by: ebroad
Patches:
portmap.patch uploaded by ebroad (license 878)
externtXXport_v2.patch uploaded by ebroad (license 878)
Tested by: ebroad
Review: https://reviewboard.asterisk.org/r/392/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@222398 f38db490-d61c-443f-a65b-d21fe96a405b
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r222152 | kpfleming | 2009-10-05 20:16:36 -0500 (Mon, 05 Oct 2009) | 20 lines
Fix ao2_iterator API to hold references to containers being iterated.
See Mantis issue for details of what prompted this change.
Additional notes:
This patch changes the ao2_iterator API in two ways: F_AO2I_DONTLOCK
has become an enum instead of a macro, with a name that fits our
naming policy; also, it is now necessary to call
ao2_iterator_destroy() on any iterator that has been
created. Currently this only releases the reference to the container
being iterated, but in the future this could also release other
resources used by the iterator, if the iterator implementation changes
to use additional resources.
(closes issue #15987)
Reported by: kpfleming
Review: https://reviewboard.asterisk.org/r/383/
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@222176 f38db490-d61c-443f-a65b-d21fe96a405b
Many T.38 endpoints incorrectly send the maximum IFP frame size they can accept
as the T38FaxMaxDatagram value in their SDP, when in fact this value is
supposed to be the maximum UDPTL payload size (datagram size) they can accept.
If the value they supply is small enough (a commonly supplied value is '72'),
T.38 UDPTL transmissions will likely fail completely because the UDPTL packets
will not have enough room for a primary IFP frame and the redundancy used for
error correction. If this occurs, the Asterisk UDPTL stack will emit log messages
warning that data loss may occur, and that the value may need to be overridden.
This patch extends the 't38pt_udptl' configuration option in sip.conf to allow
the administrator to override the value supplied by the remote endpoint and
supply a value that allows T.38 FAX transmissions to be successful with that
endpoint. In addition, in any SIP call where the override takes effect, a debug
message will be printed to that effect. This patch also removes the
T38FaxMaxDatagram configuration option from udptl.conf.sample, since it has not
actually had any effect for a number of releases.
In addition, this patch cleans up the T.38 documentation in sip.conf.sample
(which incorrectly documented that T.38 support was passthrough only).
(issue #15586)
Reported by: globalnetinc
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@222110 f38db490-d61c-443f-a65b-d21fe96a405b
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r221360 | mnicholson | 2009-09-30 14:36:06 -0500 (Wed, 30 Sep 2009) | 10 lines
Fix SRV lookup and Request-URI generation in chan_sip.
This patch adds a new field "portinuri" to the sip dialog struct and the sip peer struct. That field is used during RURI generation to determine if the port should be included in the RURI. It is also used in some places to determine if an SRV lookup should occur.
(closes issue #14418)
Reported by: klaus3000
Tested by: klaus3000, mnicholson
Review: https://reviewboard.asterisk.org/r/369/
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@221432 f38db490-d61c-443f-a65b-d21fe96a405b
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r221086 | twilson | 2009-09-30 09:49:11 -0500 (Wed, 30 Sep 2009) | 25 lines
Change the SSRC by default when our media stream changes
Be default, change SSRC when doing an audio stream changes Asterisk doesn't
honor marker bit when reinvited to already-bridged RTP streams,resulting in
far-end stack discarding packets with "old" timestamps that areactually part of
a new stream. This patch sends AST_CONTROL_SRCUPDATE whenever there is a
reinvite, unless the 'constantssrc' is set to true in sip.conf.
The original issue reported to Digium support detailed the following situation:
ITSP <-> Asterisk 1.4.26.2 <-> SIP-based Application Server Call comes in
fromITSP, Asterisk dials the app server which sends a re-invite back
toAsterisk--not to negotiate to send media directly to the ITSP, but to
indicatethat it's changing the stream it's sending to Asterisk. The app
servergenerates a new SSRC, sequence numbers, timestamps, and sets the marker
bit on the new stream. Asterisk passes through the teimstamp of the new stream,
butdoes not reset the SSRC, sequence numbers, or set the marker bit.
When the timestamp on the new stream is older than the timestamp on the
originalstream, the ITSP (which doesn't know there has been any change) discards
the newframes because it thinks they are too old. This patch addresses this by
changing the SSRC on a stream update unless constantssrc=true is set in
sip.conf.
Review: https://reviewboard.asterisk.org/r/374/
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@221266 f38db490-d61c-443f-a65b-d21fe96a405b
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r220873 | tilghman | 2009-09-29 12:59:26 -0500 (Tue, 29 Sep 2009) | 9 lines
Reduce CPU usage related to building a peer merely for devicestates.
This fixes a 100% CPU problem in the SIP driver, found by profiling
the driver while the problem was occurring.
(closes issue #14309)
Reported by: pkempgen
Patches:
20090924__issue14309.diff.txt uploaded by tilghman (license 14)
Tested by: pkempgen, vrban
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@220906 f38db490-d61c-443f-a65b-d21fe96a405b
Check for remotesecret option was unintentionally always true, which therefore
caused the secret option to never be used. Thanks to dvossel for pointing out
the exact fix.
(closes issue #15943)
Reported by: tpsast
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@220718 f38db490-d61c-443f-a65b-d21fe96a405b
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r219450 | dvossel | 2009-09-18 11:19:15 -0500 (Fri, 18 Sep 2009) | 14 lines
via-header branches not updated correctly on INVITE
INVITE requests must always contain a new unique branch id. When
a new branch id is created for an INVITE, the dialog's invite_branch
variable must be updated so CANCEL requests use the correct branch id.
(closes issue #15262)
Reported by: maniax
Patches:
asterisk-1.6.1.0-sip-branch.patch uploaded by tweety (license 608)
invite_new_branch_trunk.diff uploaded by dvossel (license 671)
Tested by: maniax, dvossel
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@219451 f38db490-d61c-443f-a65b-d21fe96a405b
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r219303 | dvossel | 2009-09-17 16:29:37 -0500 (Thu, 17 Sep 2009) | 21 lines
INVITE w/Replaces deadlock fix
This patch cleans up the locking logic in chan_sip.c's
handle_invite_replaces() function as well as making use
of ast_do_masquerade() rather than forcing the masquerade
on an ast_read(). The code had several redundant unlocks
that would result in 'freed more times than we've locked!'
errors. I cleaned these up as well as moving all the unlock
logic to the end of the function. This patch should also
resolve the issue people were having with the replacecall
channel never being unlocked with one legged calls.
(closes issue #15151)
Reported by: irroot
Patches:
invite_w_replaces_1.4.diff uploaded by dvossel (license 671)
Tested by: irroot, dvossel
Review: https://reviewboard.asterisk.org/r/371/
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@219304 f38db490-d61c-443f-a65b-d21fe96a405b
This way, we don't always write a null byte into
byte 1 of the buffer
(closes issue #15905)
Reported by: ebroad
Patches:
freadfix.patch uploaded by ebroad (license 878)
Tested by: ebroad
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@218933 f38db490-d61c-443f-a65b-d21fe96a405b
This was preventing responses from being properly processed because the packet was not being found
causing handle_response to return prematurely.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@218918 f38db490-d61c-443f-a65b-d21fe96a405b
In the course of this, I also found that the results of ast_gethostbyname
were being used incorrectly in both chan_iax2 and chan_sip, so both have
been fixed.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@217916 f38db490-d61c-443f-a65b-d21fe96a405b
Related to #12713
Patch by oej
A big thank you to file for finally fixing the transfer() dialplan application.
I've been waiting for years for this. Great work!
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@217482 f38db490-d61c-443f-a65b-d21fe96a405b
parse_uri was not being given the correct scheme's, as
a result, uri parsing did not parse the username correctly.
One of the side effects of this is an empty caller id.
(closes issue #15839)
Reported by: ebroad
Patches:
blank_cidv2.patch uploaded by ebroad (license 878)
parse_uri_fix.diff uploaded by dvossel (license 671)
Tested by: ebroad, dvossel
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216993 f38db490-d61c-443f-a65b-d21fe96a405b
Please follow the structure of the source code, thanks. Chan_sip is messy enough as it is :-)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216917 f38db490-d61c-443f-a65b-d21fe96a405b
- Remove unused string in sip_registry -- "random"
- Someone added a function in the middle of all forward declarations... Weird. Moved it out of that
section.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216905 f38db490-d61c-443f-a65b-d21fe96a405b
- Add variable for number of known media streams instead of hardcoding in definition of sip_pvt
- Rename "text" to "codecs" - beacuse it's what it is
- Add documentation for future developers so that we make sure that we define new sdp media types
for SRTP-variants
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216883 f38db490-d61c-443f-a65b-d21fe96a405b
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r216430 | oej | 2009-09-04 15:45:48 +0200 (Fre, 04 Sep 2009) | 27 lines
Make apps send PROGRESS control frame for early media and fix too early media issue in SIP
The issue at hand is that some legacy (dying) PBX systems send empty media frames on PRI
links *before* any call progress. The SIP channel receives these frames and by default
signals 183 Session progress and starts sending media. This will cause phones to
play silence and ignore the later 180 ringing message. A bad user experience.
The fix is twofold:
- We discovered that asterisk apps that support early media ("noanswer") did not send
any PROGRESS frame to indicate early media. Fixed.
- We introduce a setting in chan_sip so that users can disable any relay of media frames
before the outbound channel actually indicates any sort of call progress.
In 1.4, 1.6.0 and 1.6.1, this will be disabled for backward compatibility. In later versions
of Asterisk, this will be enabled. We don't assume that it will change your Asterisk
phone experience - only for the better.
We encourage third-party application developers to make sure that if they have applications
that wants to send early media, add a PROGRESS control frame transmission to make sure that
all channel drivers actually will start sending early media. This has not been the default
in Asterisk previous to this patch, so if you got inspiration from our code, you need to
update accordingly. Sorry for the trouble and thanks for your support.
This code has been running for a few months in a large scale installation (over 250
servers with PRI and/or BRI links to old PBX systems).
That's no proof that this is an excellent patch, but, well, it's tested :-)
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216438 f38db490-d61c-443f-a65b-d21fe96a405b
There was a problem in the function responsible for doing peer matching by
IP address and port number such that during the second pass for checking for
a peer configured with insecure=port, it would end up treating every peer as
if it had been configured that way. These changes fix the logic in the peer
IP and port comparison callback to handle insecure=port checking properly.
This problem was introduced when SIP peers were converted to astobj2. Many
thanks to dvossel for noticing this while working on another peer matching
issue.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216368 f38db490-d61c-443f-a65b-d21fe96a405b
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r215682 | twilson | 2009-09-02 16:41:22 -0500 (Wed, 02 Sep 2009) | 18 lines
Re-send non-100 provisional responses to prevent cancellation
From section 13.3.1.1 of RFC 3261:
If the UAS desires an extended period of time to answer the INVITE,
it will need to ask for an "extension" in order to prevent proxies
from canceling the transaction. A proxy has the option of canceling
a transaction when there is a gap of 3 minutes between responses in a
transaction. To prevent cancellation, the UAS MUST send a non-100
provisional response at every minute, to handle the possibility of
lost provisional responses.
(closes issue #11157)
Reported by: rjain
Tested by: twilson
Review: https://reviewboard.asterisk.org/r/315/
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@215758 f38db490-d61c-443f-a65b-d21fe96a405b
There are several instances where a port is parsed
from a uri or some other source and converted to
an int value using atoi(), if for some reason the
port string is empty, then a standard port is used.
This logic is used over and over, so I created a function
to handle it in a safer way using sscanf().
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@215681 f38db490-d61c-443f-a65b-d21fe96a405b
If we had this from the start, debugging the 'parking not using configured parkinglot'
bug would have been easier.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@215665 f38db490-d61c-443f-a65b-d21fe96a405b
Now, the scheme passed to parse_uri can either be a
single scheme, or a list of schemes ',' delimited.
This gets rid of the whole problem of having to create
two buffers and calling parse_uri twice to check for
separate schemes.
Review: https://reviewboard.asterisk.org/r/343/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@215522 f38db490-d61c-443f-a65b-d21fe96a405b
keep-alive events are used by Sipura/Linksys for NAT keepalive.
There currently don't appear to be any problems with NAT, but
everytime a keep-alive event is received, Asterisk responds with a
"489 Bad event". This error may indicate to a user that NAT
problems exist just because this even is not supported. Now,
rather than respond with an error, the packet is consumed and
a "200 ok" is sent just to indicate we received the packet.
(issue #15084)
Patches:
chan_sip.keepalive.v1.diff uploaded by IgorG (license 20)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@215466 f38db490-d61c-443f-a65b-d21fe96a405b