dect
/
asterisk
Archived
13
0
Fork 0
Commit Graph

2922 Commits

Author SHA1 Message Date
tilghman d3c2823fc7 Merged revisions 220873 via svnmerge from
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
2009-09-29 19:57:37 +00:00
jpeeler 4754a40bd5 Fix building of registration entry in build_peer when using callbackextension
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
2009-09-28 19:10:10 +00:00
mnicholson 7037729f69 Ensure the numeric portion of the P-Asserted-Identity header is properly escaped.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@220174 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-24 16:33:20 +00:00
dvossel 8a55297f29 Merged revisions 219450 via svnmerge from
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
2009-09-18 16:20:41 +00:00
dvossel 443c110821 fixes deadlock when performing directed pickup w Invite/replaces
(closes issue #15340)
Reported by: lmsteffan
Patches:
      deadlock.patch uploaded by lmsteffan (license 779)
Tested by: lmsteffan



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@219371 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-17 22:37:28 +00:00
mmichelson c0792a9c30 Merged revisions 219320 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r219320 | mmichelson | 2009-09-17 17:20:50 -0500 (Thu, 17 Sep 2009) | 6 lines
  
  Send a 100 Trying response when we detect a spiral.
  
  This was problematic during spiral tests at SIPit...
  along with some other things as well.
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@219324 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-17 22:22:01 +00:00
dvossel f22a0ecb78 Merged revisions 219303 via svnmerge from
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
2009-09-17 21:59:21 +00:00
file d99b2c0999 Ensure no spaces exist before "refresher=" when doing the comparison.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@219264 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-17 19:57:39 +00:00
mmichelson bdc586caee Reverse order of args to fread.
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
2009-09-16 19:25:36 +00:00
file bfbc078467 On TCP and TLS connections do not attempt to stop retransmission of the packet internally.
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
2009-09-16 18:31:47 +00:00
dvossel eb39751215 upward bound checking for port string to int conversion
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@218687 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-15 19:22:37 +00:00
mnicholson fc0d24d1d9 Merged revisions 218578 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r218578 | mnicholson | 2009-09-15 11:03:54 -0500 (Tue, 15 Sep 2009) | 8 lines
  
  Send request contact header field with response to registrer queries instead of the address of record.
  
  (closes issue #14438)
  Reported by: ravindrad
  Patches:
        regquerypatch uploaded by ravindrad (license 684)
  Tested by: ravindrad
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@218586 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-15 16:15:02 +00:00
mmichelson 37b9a0031a Use a better method of ensuring null-termination of the buffer
while reading the SDP when using TCP.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@218566 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-15 15:40:14 +00:00
mmichelson ff9c8e969f Ensure that SDP read from TCP socket is null-terminated.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@218504 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-15 15:05:53 +00:00
mmichelson f5aa5d608b Fix off-by-one error when reading SDP sent over TCP.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@218499 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-15 14:59:50 +00:00
tilghman 0e328e2e61 Make calltoken support work with realtime users and peers.
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
2009-09-10 23:12:16 +00:00
oej 111eb071bd Don't assign UINT_MAX to an INT.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@217663 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-10 18:29:21 +00:00
oej a97e99188d Include ActionID in all events that are responsed to AMI Action SIPShowRegistry
(closes issue #15868)
Reported by: nic_bellamy
Patches: 
      manager_SIPshowregistry_actionid.patch uploaded by nic bellamy (license 299)



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@217593 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-10 12:06:55 +00:00
oej 9b18f38a6d Don't report transfer success until we actually know. 1xx messages are not final.
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
2009-09-09 20:09:31 +00:00
oej 659c6e9ada Not having any TLS session to write to is a serious XMIT_ERROR.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@217368 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-09 10:39:43 +00:00
oej 7dbb4fcea6 Formatting and doxygen updates
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@217367 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-09 10:38:45 +00:00
dvossel 8bd1cbda04 caller id number empty
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
2009-09-08 14:26:30 +00:00
oej 92f38b32ee Moving another function declared in the middle of forward declarations.
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
2009-09-07 18:29:45 +00:00
oej d7abc8467a Move "deprecated_username" to a flag like the others - unsigned int blah:1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216912 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 18:26:37 +00:00
oej 6f0ee304aa - Doxygen additions
- 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
2009-09-07 18:24:04 +00:00
oej d38be2c15f Clean up the "offered_media" code
- 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
2009-09-07 18:00:48 +00:00
oej ccc05a3e9f Make sure we reset global_exclude_static at channel reload
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216842 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 16:35:12 +00:00
oej dc6fc3c18a Move capability into sip_cfg. While at it, make sure we reset it at channel reload.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216841 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 16:31:36 +00:00
oej 5235f4fb01 Move global_regcontext into the sip_cfg structure
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216834 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 16:26:04 +00:00
oej c16bfc9b8d Move contact_ha to sip_cfg structure
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216826 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 16:23:39 +00:00
oej fe1294fbd8 Doxygen updates
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216806 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 16:16:58 +00:00
oej c8e7d6a547 Since it's possible to have more than 999 calls, I'm changing the call counter roof to something higher.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216805 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 16:08:08 +00:00
oej 81088476ee add doxygen and remove duplicate declaration of variable
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216804 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 16:00:41 +00:00
oej 33bb032a54 After many years, remove VOCAL_DATA_HACK definition
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216803 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 15:48:41 +00:00
oej 3fdaf788c2 Remove unneeded header files (tested on Linux and OS/X)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216802 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 15:47:40 +00:00
oej db82e86ec3 Don't send MESSAGE with sendtext() if recepient doesn't allow MESSAGE requests
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216769 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 14:54:14 +00:00
oej d990771e5f Add some doxygen
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216748 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 14:21:01 +00:00
oej dd1af7eba2 Fix typo
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216735 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 14:04:40 +00:00
oej 706a4e2e00 If there is no session timer in the INVITE, set it to default value (not unset minimum = -1)
Patch by oej

closes issue #15621
Reported by: fnordian
Tested by: atis


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216695 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 13:06:19 +00:00
oej 8ef30dd8a7 Simplify the code in this function
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216652 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-07 11:31:19 +00:00
dvossel daa3bdc670 sip peer matching by address only with TCP/TLS
This patch removes the contact header matching logic and
adds logic to match all tcp/tls connections by ip only.
Thanks to oej for finding the issue and suggesting solutions.

Review: https://reviewboard.asterisk.org/r/354/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216594 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-04 19:32:07 +00:00
oej 6a9ca399c1 Merged revisions 216430 via svnmerge from
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
2009-09-04 14:02:34 +00:00
russell 6c5991c6a8 Do not treat every SIP peer as if they were configured with insecure=port.
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
2009-09-04 13:14:25 +00:00
oej bdc4118a20 Add known internal IP address when autodomain=yes
(closes issue #14573)
Reported by: pj
Patches: 
      sip-internip-autodomain1.diff uploaded by mnicholson (license 96)
	modified by oej
Tested by: pj



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@215891 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-03 13:02:41 +00:00
tilghman 7e4c619f6b Default the callback extension to "s". This is a regression.
(closes issue #15764)
 Reported by: elguero
 Change-type: bugfix


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@215801 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-03 03:43:51 +00:00
twilson cfc9e68644 Merged revisions 215682 via svnmerge from
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
2009-09-02 23:31:04 +00:00
dvossel ed68a7c6fe port string to int conversion using sscanf
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
2009-09-02 21:39:31 +00:00
mvanbaak 5289ec4c5b add Parkinglot info to sip show peer <foo> and skinny show line <foo>
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
2009-09-02 21:23:17 +00:00
dvossel 5575faefc3 SIP uri parsing cleanup
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
2009-09-02 17:26:40 +00:00
dvossel b1db895f3c SIP support for keep-alive event
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
2009-09-02 16:08:00 +00:00
mvanbaak fc59e0d578 Honor configured parkinglot when parking and retrieving parked calls
Thank oej for pointing out the fact that sip_new did not copy parkinglot from the peer
into the newly created channel.

(closes issue #15538)
Reported by: gracedman
Patches:
      2009090100_sipnewparkinglot-161.diff.txt uploaded by mvanbaak (license 7)
	  With mod by me to also fix callparking as well (this uploaded patch only fixed retrieving a parked call)
Tested by: gracedman, mvanbaak


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@215462 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-02 15:56:46 +00:00
tilghman dc61593f9a Add MASTER_CHANNEL() dialplan function, as well as a useful usage.
(closes issue #13140)
 Reported by: cpina
 Patches: 
       20090807__issue13140.diff.txt uploaded by tilghman (license 14)
 Tested by: lmadsen
 Change-type: feature


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@215301 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-01 23:41:06 +00:00
tilghman f3042acc4f Fix register such that lines with a transport string, but without an authuser, parse correctly.
(AST-228)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@215222 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-01 21:19:40 +00:00
oej 393cb2ca24 Removing whitespace that causes red dots in reviewboard
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@215110 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-01 14:40:42 +00:00
tilghman 846213eee7 Typo fix ("SIP/2.0 XXX" is 11 chars, not 10)
(closes issue #15362)
 Reported by: klaus3000
 Patches: 
       chan_sip.c_logmessagefix_patch.txt uploaded by klaus3000 (license 65)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@214199 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-26 16:53:03 +00:00
tilghman cd1099b4a4 Clarifying comments in sip_register, and removing a dead section
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@213738 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-21 22:36:39 +00:00
dvossel 9827bf13e4 Register request line contains wrong address when user domain and register host differ
(closes issue #15539)
Reported by: Nick_Lewis
Patches:
      chan_sip.c-registraraddr.patch uploaded by Nick (license 657)
      register_domain_fix_1.6.2 uploaded by dvossel (license 671)
Tested by: Nick_Lewis, dvossel



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@213716 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-21 22:22:11 +00:00
dvossel fc3aabd42e fixes sip register parsing when user@domain is used
(issue #15008)
(issue #15672)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@213635 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-21 21:02:50 +00:00
tilghman 68214f704c Better parsing for the "register" line
Allows characters that are otherwise used as delimiters to be used within
certain fields (like the secret).
(closes issue #15008, closes issue #15672)
 Reported by: tilghman
 Patches: 
       20090818__issue15008.diff.txt uploaded by tilghman (license 14)
 Tested by: lmadsen, tilghman


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@213098 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-19 21:05:17 +00:00
tilghman 2c0159363d If we have realtime caching enabled, 'sip reload' must purge users/peers, even if the config files haven't changed.
(closes issue #12869)
 Reported by: bcnit
 Patches: 
       20090819__issue12869__2.diff.txt uploaded by tilghman (license 14)
 Tested by: lasko


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@213093 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-19 20:29:41 +00:00
kpfleming cedc8495a0 Ensure that T38FaxVersion is put into outgoing SDP in the proper case.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@212113 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-13 15:46:25 +00:00
file 0f0e599d9c Check an actual populated variable when seeing if we need to do video or not.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@212067 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-13 13:51:04 +00:00
mnicholson 2ec43d0c94 This patch adds support for choosing a realm based on the domain in the From or To header in the incoming request. Eligible domains are taken from the domains list in the config file. This functionality is enabled when domainsasrealm is enabled in the config file.
(closes issue #11361)
Reported by: arkadia
Patches:
      sip_realm_mnich_to_added_2.patch uploaded by arkadia (license 233)
Tested by: arkadia


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@211947 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-12 22:18:09 +00:00
mnicholson 234deff0d4 Make asterisk handle 423 Interval Too Short messages better.
This change uses separate values for the acceptable minimum expiry provided by the 423 error and the expiry value stored in the configuration file.  Previously, the value pulled from the configuration file would be overwritten.

(closes issue #14366)
Reported by: Nick_Lewis
Patches:
      sip-expiry-fix1.diff uploaded by mnicholson (license 96)
      chan_sip.c-reqexpiry.patch uploaded by Nick (license 657)
Tested by: mnicholson


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@211876 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-12 19:53:14 +00:00
tilghman d1ec1aa57d AST-2009-005
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@211539 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-10 19:20:57 +00:00
file 818953e1c7 Fix retrieval of the port used for the video stream when adding SDP to a SIP message.
(closes issue #15121)
Reported by: jsmith


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@211347 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-10 14:07:44 +00:00
file c3f1a20178 Accept additional T.38 reinvites after an initial one has been handled.
Discussion of this subject has yielded that it is not actually acceptable to change
T.38 parameters after the initial reinvite but declining is harsh and can cause the
fax to fail when it may be possible to allow it to continue. This patch changes things
so that additional T.38 reinvites are accepted but parameter changes ignored. This gives
the fax a fighting chance.

(closes issue #15610)
Reported by: huangtx2009


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@210817 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-06 17:47:04 +00:00
kpfleming a73782aff5 Rename 'canreinvite' option to 'directmedia', with backwards compatibility.
It is clear from multiple mailing list, forum, wiki and other sorts of posts
that users don't really understand the effects that the 'canreinvite' config
option actually has, and that in some cases they think that setting it to 'no'
will actually cause various other features (T.38, MOH, etc.) to not work properly,
when in fact this is not the case. This patch changes the proper name of the
option to what it should have been from the beginning ('directmedia'), but
preserves backwards compatibility for existing configurations.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@210190 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-03 20:48:48 +00:00
mmichelson 9366a4f774 Improve chan_sip's ability to determine what methods should and should not be used in a dialog.
The previous effort here was to store what a peer is capable of receiving by parsing REGISTER
requests from the peer and keeping that information for as long as the registration was active.
The problem with this is that there are a great number of SIP devices which give no indication
of the methods allowed in their REGISTER requests, and it is unreasonable to try to guess what
the device may or may not support. In addition, some SIP devices have been found to claim support
for a specific method, but their handling the method is less than ideal, or they are actually
lying.

With this patch, we now determine what methods a device supports  by parsing the Allow header we
receive from them, and we do this with each new dialog. In addition, a configuration option has
been added so that an administrator can essentially blacklist certain methods from being used
with certain peers if the admin knows that support for a specific method is dodgy or nonexistent.

ABE-1822



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@209673 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-31 17:55:44 +00:00
mmichelson 9674bf7689 Fix a crash that can result if text codecs are allowed but textsupport is disabled.
(closes issue #15596)
Reported by: fabled
Patches:
      sip-red.patch uploaded by fabled (license 448)



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@209516 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-30 14:38:21 +00:00
kpfleming c268ce9100 Define side-effect-safe MIN and MAX macros and remove duplicate definitions from various files.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@209400 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-28 13:49:46 +00:00
mmichelson 0b709d474e Merged revisions 208587 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r208587 | mmichelson | 2009-07-24 13:26:50 -0500 (Fri, 24 Jul 2009) | 10 lines
  
  Only send a BYE when hanging up a channel that is up.
  
  For cases where Asterisk sends an INVITE and receives a non 2XX final
  response, Asterisk would follow the INVITE transaction by immediately
  sending a BYE, which was unnecessary.
  
  (closes issue #14575)
  Reported by: chris-mac
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@208588 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-24 18:31:04 +00:00
kpfleming b4baa21fbf Resolve a T.38 negotiation issue left over from the udptl-updates merge.
The udptl-updates branch that was merged yesterday failed to properly send back
T.38 SDP responses with the correct error correction mode, if the incoming SDP
from the other end caused us to change error correction modes. This patch
corrects that situation.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@208548 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-24 15:02:53 +00:00
kpfleming aa4f4e142d Rework of T.38 negotiation and UDPTL API to address interoperability problems
Over the past couple of months, a number of issues with Asterisk
negotiating (and successfully completing) T.38 sessions with various
endpoints have been found. This patch attempts to address many of
them, primarily focused around ensuring that the endpoints'
MaxDatagram size is honored, and in addition by ensuring that T.38
session parameter negotiation is performed correctly according to the
ITU T.38 Recommendation.

The major changes here are:

1) T.38 applications in Asterisk (app_fax) only generate/receive IFP
packets, they do not ever work with UDPTL packets. As a result of
this, they cannot be allowed to generate packets that would overflow
the other endpoints' MaxDatagram size after the UDPTL stack adds any
error correction information. With this patch, the application is told
the maximum *IFP* size it can generate, based on a calculation using
the far end MaxDatagram size and the active error correction mode on
the T.38 session. The same is true for sending *our* MaxDatagram size
to the remote endpoint; it is computed from the value that the
application says it can accept (for a single IFP packet) combined with
the active error correction mode.

2) All treatment of T.38 session parameters as 'capabilities' in
chan_sip has been removed; these parameters are not at all like
audio/video stream capabilities. There are strict rules to follow for
computing an answer to a T.38 offer, and chan_sip now follows those
rules, using the desired parameters from the application (or channel)
that wants to accept the T.38 negotiation.

3) chan_sip now stores and forwards ast_control_t38_parameters
structures for tracking 'our' and 'their' T.38 session parameters;
this greatly simplifies negotiation, especially for pass-through
calls.

4) Since T.38 negotiation without specifying parameters or receiving
the final negotiated parameters is not very worthwhile, the
AST_CONTROL_T38 control frame has been removed. A note has been added
to UPGRADE.txt about this removal, since any out-of-tree applications
that use it will no longer function properly until they are upgraded
to use AST_CONTROL_T38_PARAMETERS.

Review: https://reviewboard.asterisk.org/r/310/



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@208464 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-23 21:57:24 +00:00
mmichelson 88af24c65f Merged revisions 208386 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r208386 | mmichelson | 2009-07-23 14:24:21 -0500 (Thu, 23 Jul 2009) | 17 lines
  
  Fix a problem where a 491 response could be sent out of dialog.
  
  This generalizes the fix for issue 13849. The initial fix corrected the
  problem that Asterisk would reply with a 491 if a reinvite were received
  from an endpoint and we had not yet received an ACK from that endpoint
  for the initial INVITE it had sent us. This expansion also allows Asterisk
  to appropriately handle an INVITE with authorization credentials if Asterisk
  had not received an ACK from the previous transaction in which Asterisk had
  responded to an unauthorized INVITE with a 407.
  
  (closes issue #14239)
  Reported by: klaus3000
  Patches:
        14239.patch uploaded by mmichelson (license 60)
  Tested by: klaus3000
  	  
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@208388 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-23 19:34:49 +00:00
mmichelson 26519fab7f Merged revisions 208312 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r208312 | mmichelson | 2009-07-23 11:29:18 -0500 (Thu, 23 Jul 2009) | 3 lines
  
  Remove inaccurate XXX comment.
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@208314 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-23 16:29:37 +00:00
mmichelson a8d3801e65 Merged revisions 208262 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r208262 | mmichelson | 2009-07-23 10:43:07 -0500 (Thu, 23 Jul 2009) | 8 lines
  
  Properly handle 183 responses which do not contain an SDP.
  
  (closes issue #15442)
  Reported by: ffloimair
  Patches:
        15442.patch uploaded by mmichelson (license 60)
  Tested by: tkarl, ffloimair
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@208263 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-23 15:46:34 +00:00
mmichelson 5ecf41935a Fix potential crash if p->owner is NULL.
Problem was observed when a call-forwarding loop was accidentally
configured.

ABE-1906



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@208229 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-23 14:46:53 +00:00
dvossel 32577ff93f reg->username is parsed only once on sip reload
The registration string can contain an expanded user portion of the
form user@domain. This expanded user portion was stored in
reg->username and parsed each time there is a registration refresh.
Now, the domain portion of the user is parsed and stored separately
in the regdomain field.

(closes issue #14331)
Reported by: Nick_Lewis
Patches:
      chan_sip.c.domainparse3.patch uploaded by Nick (license 657)
Tested by: Nick_Lewis, dvossel




git-svn-id: http://svn.digium.com/svn/asterisk/trunk@207484 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-20 20:45:26 +00:00
mmichelson 83bc6e1ff6 Merged revisions 207423 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r207423 | mmichelson | 2009-07-20 14:39:59 -0500 (Mon, 20 Jul 2009) | 33 lines
  
  Answer video SDP offers properly when videosupport is not enabled.
  
  Copied from Review board:
  
  In issue 12434, the reporter describes a situation in which audio and video 
  is offered on the call, but because videosupport is disabled in sip.conf, 
  Asterisk gives no response at all to the video offer. According to RFC 3264, 
  all media offers should have a corresponding answer. For offers we do not 
  intend to actually reply to with meaningful values, we should still reply 
  with the port for the media stream set to 0.
  
  In this patch, we take note of what types of media have been offered and 
  save the information on the sip_pvt. The SDP in the response will take into 
  account whether media was offered. If we are not otherwise going to answer 
  a media offer, we will insert an appropriate m= line with the port set to 0.
  
  It is important to note that this patch is pretty much a bandage being 
  applied to a broken bone. The patch *only* helps for situations where video 
  is offered but videosupport is disabled and when udptl_pt is disabled but 
  T.38 is offered. Asterisk is not guaranteed to respond to every media offer. 
  Notable cases are when multiple streams of the same type are offered. 
  The 2 media stream limit is still present with this patch, too.
  
  In trunk and the 1.6.X branches, things will be a bit different since Asterisk 
  also supports text in SDPs as well.
  
  (closes issue #12434)
  Reported by: mnnojd
  
  Review: https://reviewboard.asterisk.org/r/311
  Review: https://reviewboard.asterisk.org/r/313
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@207424 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-20 19:48:12 +00:00
dvossel f768495846 sip option flags handled incorrectly
(closes issue #15376)
Reported by: Takehiko Ooshima
Tested by: dvossel, Takehiko_Ooshima


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@207029 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-17 17:51:44 +00:00
dvossel f7e5b0d061 Merged revisions 206938 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r206938 | dvossel | 2009-07-17 11:05:06 -0500 (Fri, 17 Jul 2009) | 14 lines
  
  SIP incorrect From: header information when callpres is prohib
  
  Some ITSP make use of the "Anonymous" display name to detect a
  requirement to withhold caller id across the PSTN. This does
  not work if the display name is "Unknown".
  
  (closes issue #14465)
  Reported by: Nick_Lewis
  Patches:
        chan_sip.c-callerpres.patch uploaded by Nick (license 657)
        chan_sip.c-callerpres_trunk.patch uploaded by dvossel (license 671)
  Tested by: Nick_Lewis, dvossel
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@206939 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-17 16:13:22 +00:00
dvossel 743fa80c82 Session timer were not activated if Supported header field in INVITE had both "timer" and other options.
(closes issue #15403)
Reported by: makoto
Patches:
      sip-session-timer.patch uploaded by makoto (license 38)



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@206768 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-15 22:04:13 +00:00
dvossel 26f126f5ee callerid(num) is wrong when username is missing
A domain only sip uri <sip:123.123.123.123> would return
123.123.123.123 as callid num.  Now, if the username is
missing from a uri, the callerid num field is left empty.

(closes issue #15476)
Reported by: viraptor



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@206702 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-15 20:20:01 +00:00
dvossel b8e52a3435 dns lookup of peername rather than peer's host in transmit_register()
(closes issue #15052)
Reported by: fsantulli
Patches:
      chan_sip_bug_15052_[20090626204511].patch uploaded by fsantulli (license 818)
Tested by: fsantulli



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@206280 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-13 23:26:51 +00:00
dvossel 419482cad4 SIP register not using peer's outbound proxy
If callbackextension is defined for a peer it successfully causes
a registration to occur, but the registration ignores the
outboundproxy settings for the peer.  This patch allows the
peer to be passed to obproxy_get() in transmit_register().

(closes issue #14344)
Reported by: Nick_Lewis
Patches:
      callbackextension_peer_trunk.diff uploaded by dvossel (license 671)
Tested by: dvossel

Review: https://reviewboard.asterisk.org/r/294/



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@205985 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-10 21:42:10 +00:00
mmichelson 58912cc383 Merged revisions 205877 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
  r205877 | mmichelson | 2009-07-10 12:39:13 -0500 (Fri, 10 Jul 2009) | 23 lines
  
  Merged revisions 205776 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/trunk
  
  ................
    r205776 | mmichelson | 2009-07-10 10:56:45 -0500 (Fri, 10 Jul 2009) | 16 lines
    
    Merged revisions 205775 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r205775 | mmichelson | 2009-07-10 10:51:36 -0500 (Fri, 10 Jul 2009) | 10 lines
      
      Ensure that outbound NOTIFY requests are properly routed through stateful proxies.
      
      With this change, we make note of Record-Route headers present in any SUBSCRIBE
      request that we receive so that our outbound NOTIFY requests will have the proper
      Route headers in them.
      
      (closes issue #14725)
      Reported by: ibc
    ........
  ................
................


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@205878 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-10 17:39:57 +00:00
dvossel e769d3add1 Merged revisions 205804 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r205804 | dvossel | 2009-07-10 11:23:59 -0500 (Fri, 10 Jul 2009) | 31 lines
  
  SIP registration auth loop caused by stale nonce
  
  If an endpoint sends two registration requests in a very short
  period of time with the same nonce, both receive 401 responses
  from Asterisk, each with a different nonce (the second 401
  containing the current nonce and the first one being stale).
  If the endpoint responds to the first 401, it does not match
  the current nonce so Asterisk sends a third 401 with a newly
  generated nonce (which updates the current nonce)... Now if
  the endpoint responds to the second 401, it does not match the
  current nonce either and Asterisk sends a fourth 401 with a
  newly generated nonce... This loop goes on and on.
  
  There appears to be a simple fix for this.  If the nonce from
  the request does not match our nonce, but is a good response
  to a previous nonce, instead of sending a 401 with a newly
  generated nonce, use the current one instead.  This breaks
  the loop as the nonce is not updated until a response is
  received. Additional logic has been added to make sure no
  nonce can be responded to twice though.
  
  (closes issue #15102)
  Reported by: Jamuel
  Patches:
        patch-bug_0015102 uploaded by Jamuel (license 809)
        nonce_sip.diff uploaded by dvossel (license 671)
  Tested by: Jamuel
  
  Review: https://reviewboard.asterisk.org/r/289/
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@205840 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-10 16:42:04 +00:00
mmichelson 477e9880b8 Merged revisions 205775 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r205775 | mmichelson | 2009-07-10 10:51:36 -0500 (Fri, 10 Jul 2009) | 10 lines
  
  Ensure that outbound NOTIFY requests are properly routed through stateful proxies.
  
  With this change, we make note of Record-Route headers present in any SUBSCRIBE
  request that we receive so that our outbound NOTIFY requests will have the proper
  Route headers in them.
  
  (closes issue #14725)
  Reported by: ibc
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@205776 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-10 15:56:45 +00:00
kpfleming 358f6c409e Repair ability of SendFAX/ReceiveFAX to respond to T.38 switchover.
Recent changes in T.38 negotiation in Asterisk caused these applications to
not respond when the other endpoint initiated a switchover to T.38; this
resulted in the T.38 switchover failing, and the FAX attempt to be made
using an audio connection, instead of T.38 (which would usually cause the
FAX to fail completely).

This patch corrects this problem, and the applications will now correctly
respond to the T.38 switchover request. In addition, the response will include
the appopriate T.38 session parameters based on what the other end offered
and what our end is capable of.

(closes issue #14849)
Reported by: afosorio


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@205696 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-09 21:20:23 +00:00
tilghman f3f5ecb6fb Permit setting custom headers from the peer definition.
(closes issue #14059)
 Reported by: fnordian


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@205086 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-07 21:10:14 +00:00
mmichelson 631bfd0a75 Move the masquerade in local_attended_transfer to a point where we hold the channel lock.
Masquerading without the channel's lock held is a *horrible* idea.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@204532 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-30 19:59:20 +00:00
mmichelson 3f7e58e819 Remove some bogus deadlock avoidance code from local_attended_transfer.
First of all, the code was unnecessary. The goal was to lock a channel
which was already locked. Second, the assumption of the deadlock avoidance
loop was that the sip_pvt was already locked and we were trying to get the
channel lock. The problem is that the sip_pvt was unlocked a few lines above.

Basically, I'm removing 5 lines of no-op.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@204530 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-30 19:55:59 +00:00
mmichelson 91471a5698 Merged revisions 204300 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r204300 | mmichelson | 2009-06-29 17:45:34 -0500 (Mon, 29 Jun 2009) | 9 lines
  
  Add error message so that it is clear why a SIP peer was not processed when
  a DNS lookup fails on a host or outboundproxy.
  
  (closes issue #13432)
  Reported by: p_lindheimer
  Patches:
        outboundproxy.patch uploaded by p (license 558)
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@204301 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-29 22:50:35 +00:00
mmichelson e9af6af344 Merged revisions 204243,204246 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r204243 | mmichelson | 2009-06-29 16:23:43 -0500 (Mon, 29 Jun 2009) | 22 lines
  
  Fix a problem where chan_sip would ignore "old" but valid responses.
  
  chan_sip has had a problem for quite a long time that would manifest when
  Asterisk would send multiple SIP responses on the same dialog before receiving
  a response. The problem occurred because chan_sip only kept track of the highest
  outgoing sequence number used on the dialog. If Asterisk sent two requests out,
  and a response arrived for the first request sent, then Asterisk would ignore
  the response. The result was that Asterisk would continue retransmitting the
  requests and ignoring the responses until the maximum number of retransmissions
  had been reached.
  
  The fix here is to rearrange the code a bit so that instead of simply comparing
  the sequence number of the response to our latest outgoing sequence number, we
  walk our list of outstanding packets and determine if there is a match. If there is,
  we continue. If not, then we ignore the response.
  
  In doing this, I found a few completely useless variables that I have now removed.
  
  (closes issue #11231)
  Reported by: flefoll

  Review: https://reviewboard.asterisk.org/r/298
........
  r204246 | mmichelson | 2009-06-29 16:37:05 -0500 (Mon, 29 Jun 2009) | 3 lines
  
  Fix build oops.
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@204247 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-29 21:48:54 +00:00
russell 3a2956f83a Ensure the TCP read buffer is fully initialized before handling each packet.
(closes issue #14452)
Reported by: umberto71


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@203779 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-26 20:45:00 +00:00
file 051fb41bd1 Fix the 'nat' option to actually do RFC3581 as expected and extend the configurable values for finer control.
(closes issue #8855)
Reported by: mikma
Tested by: klaus3000, file


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@203735 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-26 20:19:49 +00:00
file c26b86e763 Improve T.38 negotiation by exchanging session parameters between application and channel.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@203699 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-26 19:27:24 +00:00
russell ac3b35dcc7 Merge the new Channel Event Logging (CEL) subsystem.
CEL is the new system for logging channel events.  This was inspired after
facing many problems trying to represent what is possible to happen to a call
in Asterisk using CDR records.  For more information on CEL, see the built in
HTML or PDF documentation generated from the files in doc/tex/.

Many thanks to Steve Murphy (murf) and Brian Degenhardt (bmd) for their hard
work developing this code.  Also, thanks to Matt Nicholson (mnicholson) and
Sean Bright (seanbright) for their assistance in the final push to get this
code ready for Asterisk trunk.

Review: https://reviewboard.asterisk.org/r/239/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@203638 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-26 15:28:53 +00:00
russell 4385c36f89 Merged revisions 203115 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r203115 | russell | 2009-06-25 11:02:16 -0500 (Thu, 25 Jun 2009) | 11 lines
  
  Resolve a crash related to a T.38 reinvite race condition.
  
  This change resolves a crash observed locally during some T.38 testing.
  A call was set up using a call file, and when the T.38 reinvite came in,
  the channel state was still AST_STATE_DOWN.  The reason is explained by
  a comment in the code that previously lived in the handling of
  AST_STATE_RINGING.  This change modifies the logic to handle the same
  race condition for any channel state that is not UP.
  
  (closes ABE-1895)
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@203116 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-25 16:04:10 +00:00
mmichelson d65224a207 Merged revisions 202966 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r202966 | mmichelson | 2009-06-24 13:28:47 -0500 (Wed, 24 Jun 2009) | 3 lines
  
  Use the handy UNLINK macro instead of hand-coding the same thing in-line.
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@202967 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-24 18:29:10 +00:00
file 40194738eb Ensure the default settings are applied for T.38 when we set it up for a peer.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@202925 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-24 18:08:17 +00:00
dvossel edaa32fe4f Merged revisions 202671 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r202671 | dvossel | 2009-06-23 11:28:46 -0500 (Tue, 23 Jun 2009) | 12 lines
  
  MWI NOTIFY contains a wrong URI if Asterisk listens to non-standard port and transport
  
  (closes issue #14659)
  Reported by: klaus3000
  Patches:
        patch_chan_sip_fixMWIuri_1.4.txt uploaded by klaus3000 (license 65)
        mwi_port-transport_trunk.diff uploaded by dvossel (license 671)
  Tested by: dvossel, klaus3000
  
  Review: https://reviewboard.asterisk.org/r/288/
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@202672 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-23 16:31:30 +00:00
russell ba055f493e Merged revisions 202414 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r202414 | russell | 2009-06-22 11:00:00 -0500 (Mon, 22 Jun 2009) | 2 lines
  
  Make Polycom subscription type override check more explicit.
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@202415 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-22 16:05:08 +00:00
mmichelson 186e7d83f4 Merged revisions 202341-202342 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r202341 | mmichelson | 2009-06-22 09:42:55 -0500 (Mon, 22 Jun 2009) | 26 lines
  
  Fix a situation in which Asterisk would not stop retransmitting 487s.
  
  If a CANCEL were received by Asterisk, we would send a 487 in response
  to the original INVITE and a 200 OK for the CANCEL. If there were a network
  hiccup which caused the 200 OK and the 487 to be lost, then the UA communicating
  with Asterisk may try to retransmit its CANCEL. Asterisk's response to this used
  to be to try sending another 487 to the canceled INVITE and another 200 OK to the
  CANCEL.
  
  The problem here is that the originally-sent 487 was sent "reliably" meaning that
  it will be retransmitted until it is received properly. So when we receive the second
  CANCEL it is likely that the first batch of 487s we sent is still going strong and
  reaches the UA. The result was that the second set of 487s would be retransmitted
  constantly until the maximum number of retries had been reached.
  
  The fix for this is that if we receive a second CANCEL for an INVITE, then we cancel
  the retransmission of the first set of 487s and start a second set. This causes the
  dialog to be terminated reasonably.
  
  (closes issue #14584)
  Reported by: klaus3000
  Patches:
        14584_v2.patch uploaded by mmichelson (license 60)
  Tested by: klaus3000
........
  r202342 | mmichelson | 2009-06-22 09:44:58 -0500 (Mon, 22 Jun 2009) | 3 lines
  
  Remove an extra debug line left from previous commit.
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@202343 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-22 14:58:24 +00:00
mmichelson bedf47f1a0 Merged revisions 202336 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r202336 | mmichelson | 2009-06-22 09:34:05 -0500 (Mon, 22 Jun 2009) | 25 lines
  
  Fix a possible infinite loop in SDP parsing during glare situation.
  
  There was a while loop in get_ip_and_port_from_sdp which was controlled
  by a call to get_sdp_iterate. The loop would exit either if what we were
  searching for was found or if the return was NULL. The problem is that
  get_sdp_iterate never returns NULL. This means that if what we were searching
  for was not present, the loop would run infinitely. This modification of the
  loop fixes the problem.
  
  (closes issue #15213)
  Reported by: schmidts
  
  (closes issue #15349)
  Reported by: samy
  
  (closes issue #14464)
  Reported by: pj
  
  (closes issue #15345)
  Reported by: aragon
  Patches:
        sip_inf_loop.patch uploaded by mmichelson (license 60)
  Tested by: aragon
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@202337 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-22 14:35:09 +00:00
mnicholson e24fc1a3de Use sched_yield() instead of usleep(1)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@202039 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-19 21:25:06 +00:00
file 6271d5fe30 Add support for allowing an RTP engine to decide on whether it is possible for specific formats to be transcoded for an RTP instance.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@201902 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-19 15:41:24 +00:00
mnicholson 199322d410 Added deadlock protection to try_suggested_sip_codec in chan_sip.c.
Review: https://reviewboard.asterisk.org/r/285/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@201717 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-18 17:41:09 +00:00
mmichelson 90de52f0b7 Trunk implementation of setting an alternate RTP source.
This contains the interface by which we can let an rtp instance know
that it might start receiving audio from a new source. This is similar
in nature to revision 197588 of Asterisk 1.4.

Review: https://reviewboard.asterisk.org/r/276



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@201583 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-18 15:20:17 +00:00
dvossel 1c7aa6c621 parsing extension correctly from sip register lines
If a transport type was specified, but no extension, parsing of the extension would return whatever was after the transport rather than defaulting to 's'.

(closes issue #15111)
Reported by: ffs
Patches:
      chan_sip.c_register-parser.patch uploaded by ffs (license 730)
Tested by: ffs, dvossel



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@201570 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-18 15:16:05 +00:00
mmichelson 23d8e46349 Fix problem with no audio due to ignoring the SDP.
A recent change to our SDP version comparison made audio not function
on some calls. This was because of a test wherein we were trying to
see if an unsigned value was less than 0. This is a dumb comparison
and arguably the compiler should have warned about it. Alas, though,
it slipped past. Now it's fixed by changing the variable to be a
signed type.

Found by several developers. Tested by mnicholson and dbrooks.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@201462 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-17 20:10:01 +00:00
dbrooks ce47d24ecd Merged revisions 201380 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r201380 | dbrooks | 2009-06-17 13:45:50 -0500 (Wed, 17 Jun 2009) | 9 lines
  
  Checks for NULL sip_pvt pointer in chan_sip.c->acf_channel_read()
  
  Zombie channels could be passed, and chan_sip.c wasn't checking for it.
  Could crash Asterisk. Now checking for NULL pointer.
  
  (closes issue #15330)
  Reported by: okrief
  Tested by: dbrooks
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@201381 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-17 19:15:07 +00:00
dvossel 235c549dcd SIP registry ref count error
During a sip reload, the list of sip_registry objects are
supposed to be traversed, unlinked, and destroyed, but
destruction never takes place due to a ref counting error.
This causes a memory leak when registry items are removed
from sip.conf and reloaded.  While the registries are removed
from the global list, they are not removed from the scheduler.
Because of this, SIP register attempts continue to be sent
out for the item even though it may no longer be in the .conf.

(closes issue #15295)
Reported by: amorsen

Review: https://reviewboard.asterisk.org/r/282/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@201344 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-17 15:20:26 +00:00
dvossel 17234b22f0 fix issue with build_contact introduced by the "SIP trasnport type issues" commit
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@201223 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-16 22:29:30 +00:00
kpfleming 0d442a7c2c Enable applications to enable/disable digit and tone detection.
Some applications (notably app_fax) do not need digit detection nor FAX tone
detection while they are running, and if Asterisk is using software DSPs to provide
the detection, this consumes extra CPU cycles that could be better spent on the
actual application. This patch allows applications to query and control the state
of digit and tone detection on a channel, and modifies app_fax to disable them
while the FAX operations are occurring (and re-enable digit detection afterwards).



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@201139 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-16 21:10:15 +00:00
dvossel 39c737328c SIP transport type issues
What this patch addresses:
1. ast_sip_ouraddrfor() by default binds to the UDP address/port
reguardless if the sip->pvt is of type UDP or not.  Now when no
remapping is required, ast_sip_ouraddrfor() checks the sip_pvt's
transport type, attempting to set the address and port to the
correct TCP/TLS bindings if necessary.
2.  It is not necessary to send the port number in the Contact
header unless the port is non-standard for the transport type.
This patch fixes this and removes the todo note.
3.  In sip_alloc(), the default dialog built always uses transport
type UDP.  Now sip_alloc() looks at the sip_request (if present)
and determines what transport type to use by default.
4.  When changing the transport type of a sip_socket, the file
descriptor must be set to -1 and in some cases the tcptls_session's
ref count must be decremented and set to NULL.  I've encountered
several issues associated with this process and have created a function,
set_socket_transport(), to handle the setting of the socket type.


(closes issue #13865)
Reported by: st
Patches:
      dont_add_port_if_tls.patch uploaded by Kristijan (license 753)
      13865.patch uploaded by mmichelson (license 60)
      tls_port_v5.patch uploaded by vrban (license 756)
      transport_issues.diff uploaded by dvossel (license 671)
Tested by: mmichelson, Kristijan, vrban, jmacz, dvossel

Review: https://reviewboard.asterisk.org/r/278/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@200946 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-16 16:03:30 +00:00
kpfleming 51867ba12c Accept T.38 re-INVITE responses with invalid SDP versions.
This commit changes the 'incoming SDP version' check logic a bit more; when
'ignoresdpversion' is *not* set for a peer, if we initiate a re-INVITE to
switch to T.38, we'll always accept the peer's SDP response, even if they
don't properly increment the SDP version number as they should. If this situation
occurs, a warning message will be generated suggesting that the peer's
configuration be changed to include the 'ignoresdpversion' configuration option
(although ideally they'd fix their SIP implementation to be RFC compliant).

AST-221


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@200689 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-15 20:42:38 +00:00
kpfleming abe57aceec Convert a number of global module variables to 'static'.
These modules all contained variables that are module-global but not system-global,
but were not marked 'static'.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@200587 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-15 17:06:34 +00:00
kpfleming 4a6d090061 Some minor structure size improvements in sip_pvt and sip_peer.
Using the 'pahole' tool, it is now quite easy to see where structure fields
could be organized differently to keep the compiler from having to add
padding to satisfy alignment requirements. These changes reduced the sizes of
sip_pvt and sip_peer by a few bytes each (on 64-bit platforms), and also fixed
a spelling error in a field name.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@200584 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-15 16:38:32 +00:00
mmichelson 80c50f0c39 Merged revisions 200513 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r200513 | mmichelson | 2009-06-15 10:21:46 -0500 (Mon, 15 Jun 2009) | 5 lines
  
  Add INFO to our allowed methods so that endpoints know they may send it to us.
  
  AST-223
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@200514 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-15 15:22:11 +00:00
mmichelson ae5aa230f5 Fix a crash due to a potentially NULL p->options.
Thanks to mnicholson for pointing it out.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@200146 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-11 21:17:14 +00:00
mmichelson 41c14a1987 Only try to use the invite_branch on outgoing INVITEs with auth credentials.
I have added a comment to the code to help ease understanding of the logic here
as well.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@199958 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-10 20:15:48 +00:00
dvossel 076307a2a4 CLI NOTIFY sending wrong transport type.
SIP's cli NOTIFY command only used UDP rather than copying the transport type from the peer.

(closes issue #15283)
Reported by: jthurman
Patches:
      sip-notify-tcp-svn199728.patch uploaded by jthurman (license 614)
Tested by: jthurman, dvossel



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@199818 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-09 20:47:57 +00:00
mmichelson 8bb605869c Fix a deadlock that could occur when setting rtp stats on SIP calls.
(closes issue #15143)
Reported by: cristiandimache
Patches:
      15143.patch uploaded by mmichelson (license 60)
Tested by: cristiandimache



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@199588 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-08 17:32:04 +00:00
file 61e3c796d8 Correct documentation for the register line, specifically where the domain should be specified.
(closes issue #14367)
Reported by: Nick_Lewis


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@198791 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-02 13:48:06 +00:00
mmichelson ce47d41510 Add the ability to execute connected line interception macros.
When connected line updates are received or generated in the middle
of an application call, it is now possible to execute a macro to
manipulate the connected line data. This way, phone numbers may be
manipulated to be more presentable to users, names may be changed 
for...whatever reason, or whatever else needs to be done may be.

Review: https://reviewboard.asterisk.org/r/256

AST-165



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@198727 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-01 20:57:31 +00:00
file 585dca4eab Fix a bug where the Event and Content-Type headers were added twice to outgoing SIP NOTIFY messages.
(closes issue #15239)
Reported by: pj


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@198498 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-01 13:31:27 +00:00
file 222b494c02 When removing all packets from a dialog we also need to free the data if present.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@198248 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-30 02:31:48 +00:00
file ebbf2ea929 Fix a bug where the default setting did not perform a remote bridge when it should have.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@197996 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-29 17:51:06 +00:00
mmichelson a98202f13f A few fixes to SIP with regards to connected line updates during transfers.
* Set the invitestate to INV_CALLING when we send a connected line reinvite.
This prevents us from potentially rapid-firing reinvites to a single peer.

* Use the astdb to store a peer's allowed methods. This prevents us from sending
an UPDATE during the interval between startup and the peer's first registration
if the peer does not support the UPDATE method.

* Handle Polycom's method of indicating allowed methods in REGISTER. Instead of
using an Allow header, they place the allowed methods in a methods= parameter
in the Contact header.

ABE-1873



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@197959 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-29 15:48:04 +00:00
mmichelson f5e466a35f Treat 405 responses the same way we would a 501.
This makes sure that we mark a method as being unallowed if we
receive a 405 response so that we don't continue to try to 
send that same type of message.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@197740 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-28 20:17:24 +00:00
eliel b733ebf8c3 Merged revisions 197562 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r197562 | eliel | 2009-05-28 11:21:32 -0400 (Thu, 28 May 2009) | 13 lines
  
  Use the address we already know when reloading a peer with nat=yes.
  
  If we already have an address for a peer, and we are reloading the sip
  configuration, try to use that address to contact the peer, instead of
  getting it from the Contact.
  
  (closes issue #15194)
  Reported by: ibc
  Patches:
        sip.patch uploaded by eliel (license 64)
        Tested by: manwe
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@197621 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-28 16:01:48 +00:00
file 0a45784168 Merged revisions 197466 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r197466 | file | 2009-05-28 10:44:58 -0300 (Thu, 28 May 2009) | 8 lines
  
  Fix a bug where the flag indicating the presence of rport would get overwritten by the nat setting.
  
  The presence of rport is now stored as a separate flag. Once the dialog is setup and authenticated
  (or it passes through unauthenticated) the proper nat flag is set.
  
  (closes issue #13823)
  Reported by: dimas
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@197467 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-28 13:47:45 +00:00
oej a48714000e Adding some generic handling of error codes sent to us in replys to requests.
Previously they always set hangupcause 0, which is generally wrong. With this
change, we're setting some generic hangup causes. For 5xx errors, which indicate
some sort of problem with the remote server, we're now setting CONGESTION.

EDVX002


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@197266 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-27 20:14:00 +00:00
mmichelson c1ae3106d7 Remove some redundant or unnecessary connected line-related function calls.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@196893 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-26 19:50:07 +00:00
file fffeee371b Fix a bug where the sip unregister CLI command did not completely unregister the peer.
(closes issue #15118)
Reported by: alecdavis
Patches:
      chan_sip_unregister.diff2.txt uploaded by alecdavis (license 585)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@196721 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-26 13:43:13 +00:00
dvossel d7bff1e4c2 SIP set outbound transport type from Registration
In sip.conf the transport option allows for the configuration of what transport types (udp, tcp, and tls) a peer will accept, but only the first type listed was used for outbound connections.  This patch changes this.  Now the default transport type is only used until the peer registers.  When registration takes place the transport type is parsed out of the Contact header.  If the Contact header's transport type is equal to one that the peer supports, the peer's default transport type for outbound connections is set to match the Contact header's type.  If the Contact header's transport type is not present, then the peer's default transport type is set to match the one the peer registered with.  When a peer unregisters or the registration expires, the default transport type for that peer is reset.

(closes issue #12282)
Reported by: rjain
Patches:
      reg_patch_1.diff uploaded by dvossel (license 671)
Tested by: dvossel

(closes issue #14727)
Reported by: pj
Patches:
      reg_patch_3.diff uploaded by dvossel (license 671)
Tested by: pj, dvossel

Review: https://reviewboard.asterisk.org/r/249/



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@196416 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-22 21:09:45 +00:00
eliel cbbfdc573c Implement a new element in AstXML for AMI actions documentation.
A new xml element was created to manage the AMI actions documentation,
using AstXML.
To register a manager action using XML documentation it is now possible
using ast_manager_register_xml().
The CLI command 'manager show command' can be used to show the parsed
documentation.

Example manager xml documentation:
<manager name="ami action name" language="en_US">
    <synopsis>
        AMI action synopsis.
    </synopsis>
    <syntax>
        <xi:include xpointer="xpointer(...)" /> <-- for ActionID
        <parameter name="header1" required="true">
	    <para>Description</para>
	</parameter>
	...
    </syntax>
    <description>
        <para>AMI action description</para>
    </description>
    <see-also>
    	...
    </see-also>
</manager>



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@196308 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-22 17:52:35 +00:00
mmichelson 5123e1ee5d s/it's/its/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@196268 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-22 16:50:31 +00:00
kpfleming 230a66da7d Const-ify the world (or at least a good part of it)
This patch adds 'const' tags to a number of Asterisk APIs where they are appropriate (where the API already demanded that the function argument not be modified, but the compiler was not informed of that fact). The list includes:

- CLI command handlers
- CLI command handler arguments
- AGI command handlers
- AGI command handler arguments
- Dialplan application handler arguments
- Speech engine API function arguments

In addition, various file-scope and function-scope constant arrays got 'const' and/or 'static' qualifiers where they were missing.

Review: https://reviewboard.asterisk.org/r/251/



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@196072 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-21 21:13:09 +00:00
mmichelson b8d22b76a5 Get rid of some duplicated code and correct a connected line error.
When receiving a 200 OK response to an INVITE, it was possible to transmit two
connected line updates instead of a single one. Furthermore, the second did not
have the proper information present.

Now the two have been combined into a single update and the correct information
is presented.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@195798 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-20 20:45:05 +00:00
mmichelson 26b2284b8f Add basic support for handling connected line-related UPDATE requests.
SIP purists may want to look the other way...

When COLP/CONP support for SIP was committed, there was a condition under 
which Asterisk may transmit a SIP UPDATE in order to communicate the change 
in connected line information. The issue here is that while we could send a 
SIP UPDATE message, we were not prepared to receive such an UPDATE and would 
always responde with a 501 when we received an UPDATE.

The situation was a bit rough. We really want to be able to receive UPDATEs 
having to do with connected line changes, but the amount of effort involved 
in properly supporting RFC 3311 was staggering. This commit represents a 
compromise.

First, it was decided that it is important to only send a SIP UPDATE to 
an endpoint that is able to handle one. So, now we have added parsing of 
the Allow header into SIP. We store the allowed methods on SIP peers so 
that when we communicate with them, we already will know what we can and 
cannot send to them. We will parse the peer's allowed methods when he registers
with us. If the peer is not the type to register with us, but the qualify option 
is enabled, then we will use the response to the OPTIONS request we send 
the peer to determine the peer's allowed methods. When the peer's registration 
expires, or when qualify deems the peer to be unreachable, we clear the allowed 
methods from the peer.

For an actual call, we will copy the peer's allowed methods to the sip_pvt 
representing the call leg. If we are communicating with an endpoint which is 
not a peer, then we will just parse the Allow header from the first message 
we receive during the call and store the information in the sip_pvt.

If, during communication with a peer, we receive a 501 response, then we will 
make sure to save the fact that we cannot use that method when communicating 
with that peer.

Now, with all that infrastructure in place, the only actual place we use this 
information currently is when attempting to send a connected line change using 
an UPDATE request. If we cannot send the change immediately using an UPDATE, 
we will set the SIP_NEEDREINVITE flag so that we can send a REINVITE as soon 
as it is allowed.

The second part of the changes here is for Asterisk to accept UPDATE requests 
that have connected line changes. Since we are not fully supporting RFC 3311, 
Asterisk will NOT place the UPDATE method in Allow headers it sends. Instead, 
if you are communicating with what you know to be another Asterisk box, you may 
set the rpid_update parameter in sip.conf so that we will send UPDATEs to that 
Asterisk box. When we send a connected line update, we set a custom header 
called "X-Asterisk-rpid-update."

On the receiving end, if Asterisk receives an UPDATE that does not have the 
"X-Asterisk-rpid-update" header present, then Asterisk will respond with a 501 
since media-changing UPDATEs are not supported. We should never get such 
UPDATEs, since as was stated earlier, Asterisk does not put UPDATE in its Allow
header. If the custom header is present in the received UPDATE, though, then we 
will check the incoming request for connected line updates and queue the update
on the channel where the change occurred.

ABE-1840
ABE-1822



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@195589 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-19 20:59:38 +00:00
file 7946be333a Merged revisions 195448 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r195448 | file | 2009-05-19 11:41:45 -0300 (Tue, 19 May 2009) | 7 lines
  
  Fix a bug where direct RTP setup would partially occur even when disabled if the calling channel was answered.
  
  (issue #13545)
  Reported by: davidw
  (issue #14244)
  Reported by: mbnwa
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@195449 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-19 14:43:54 +00:00
file b327267739 Fix a bug where specifying an empty outboundproxy would cause packets to get sent to ourself.
(closes issue #15106)
Reported by: timeshell


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@195089 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-18 13:36:17 +00:00
mmichelson 76c8925c8f Merged revisions 194484 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r194484 | mmichelson | 2009-05-14 17:17:55 -0500 (Thu, 14 May 2009) | 24 lines
  
  Fix a race condition where a reinvite could trigger a 482 response.
  
  The loop detection/spiral detection code in chan_sip used the owner
  channel's state as a criterion for determining if the incoming INVITE
  is a looped request. The problem with this is that the INVITE-handling
  code happens in a different thread than the thread that marks the owner
  channel as being up. As a result, if a reinvite were to come in very quickly,
  say from another Asterisk on the same LAN, it was possible for the reinvite
  to arrive before the owner channel had been set to the up state.
  
  This patch corrects the problem by using the invitestate of the sip_pvt
  instead, since that can be guaranteed to be set correctly by the time
  the reinvite arrives. Since there is a switch statement further in the
  INVITE-handling code, the AST_STATE_RINGING state also checks the invitestate
  of the sip_pvt in case we should actually be treating the channel as if it were
  up already.
  
  (closes issue #12215)
  Reported by: jpyle
  Patches:
        12215_confirmed.patch uploaded by mmichelson (license 60)
  Tested by: lmadsen
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@194496 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-14 22:20:51 +00:00
mmichelson 8fe009fe77 Update spiral support in trunk and 1.6.X to match what is in 1.4.
In 1.4, a SIP spiral is treated the same way as a call forward. This
works much better than what is currently in trunk and 1.6.X. The code
in trunk and 1.6.X did not create a new call to the recipient of the spiral,
instead trying to continue the same call. In addition to just being plain
wrong, this also had the side effect of only being able to spiral calls
to other SIP channels.

With this in place, as long as call forwards are honored, SIP spirals
will work properly. This means that it will work for outbound calls
made  by the Queue, Dial, and Page applications. For originated calls and
spool calls, however, the spiral will not work properly until a generic
call forward mechanism is introduced into Asterisk.

(relates to issue #13630)



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@193954 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-12 20:28:13 +00:00
dvossel ca0911df01 TCP not matching valid peer.
find_peer() does not find a valid peer when using pvt->recv as the sockaddr_in argument.  Because of the way TCP works, the port number in pvt->recv is not what we're looking for at all.  There is currently only one place that find_peer searches for a peer using the sockaddr_in argument.  If the peer is not found after using pvt->recv (works for UDP since the port number will be correct), a temp sockaddr_in struct is made using the Contact header in the sip_request.  This has the correct port number in it.

Review: http://reviewboard.digium.com/r/236/



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@193387 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-08 20:32:51 +00:00
tilghman d159ca98e1 Merged revisions 192932 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r192932 | tilghman | 2009-05-07 11:29:08 -0500 (Thu, 07 May 2009) | 10 lines
  
  Eliminate repetition of fullcontact during reconstruction.
  If the fullcontact field appears in both the sippeers and the
  sipregs table, then during reconstruction of the field, it will
  otherwise be doubled.
  (closes issue #14754)
   Reported by: Alexei Gradinari
   Patches: 
         20090506__bug14754.diff.txt uploaded by tilghman (license 14)
   Tested by: lmadsen
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@192933 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-07 16:43:56 +00:00
file 20a5a5e5a9 Merged revisions 192633 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r192633 | file | 2009-05-06 10:30:51 -0300 (Wed, 06 May 2009) | 7 lines
  
  Update some old logic to stop both begin and end DTMF frames from reaching the core if rfc2833 is not enabled.
  
  (closes issue #15036)
  Reported by: dimas
  Patches:
        v1-15036.patch uploaded by dimas (license 88)
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@192634 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-06 13:34:35 +00:00
rmudgett 28fb3d8a7d Fixed crashes from issue8824 review board channel locking changes.
The local struct ast_party_connected_line connected_caller variable
was uninitialized when the copy function was called.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@192590 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-05 20:54:07 +00:00
file 2aadc4a710 Fix a bug with setting t38pt_udptl at the user or peer level.
If an incoming call authenticated as a user or peer and t38pt_udptl was
not set to yes in general then no UDPTL session would be present and any
T38 related things would fail. This commit changes it so that if after
authenticating T38 is enabled but no UDPTL session is present one will be
created.

(issue AST-215)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@192387 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-05 14:22:47 +00:00
tilghman 782fa5f52f Merged revisions 191559 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r191559 | tilghman | 2009-05-01 15:00:23 -0500 (Fri, 01 May 2009) | 6 lines
  
  SIP Response 410 maps to cause code 22 (or 23), not 1.
  (closes issue #14993)
   Reported by: BigJimmy
   Patches: 
         causepatch uploaded by BigJimmy (license 371)
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@191560 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-01 20:01:21 +00:00
dvossel cfa021cb17 Consistent SSL/TLS options across conf files
ast_tls_read_conf() is a new api call for handling SSL/TLS options across all conf files.  Before this change, SSL/TLS options were not consistent.  http.conf and manager.conf required the 'ssl' prefix while sip.conf used options with the 'tls' prefix.  While the options had different names in different conf files, they all did the exact same thing.  Now, instead of mixing 'ssl' or 'tls' prefixes to do the same thing depending on what conf file you're in, all SSL/TLS options use the 'tls' prefix.  For example.  'sslenable' in http.conf and manager.conf is now 'tlsenable' which matches what already existed in sip.conf. Since this has the potential to break backwards compatibility, previous options containing the 'ssl' prefix still work, but they are no longer documented in the sample.conf files.  The change is noted in the CHANGES file though.

Review: http://reviewboard.digium.com/r/237/



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@191028 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-29 14:39:48 +00:00
dvossel 1d52218463 TLS/SSL private key option
Adds option to specify a private key .pem file when configuring TLS or SSL in AMI, HTTP, and SIP.  Before this, the certificate file was used for both the public and private key.  It is possible for this file to hold both, but most configurations allow for a separate private key file to be specified.  Clarified in .conf files how these options are to be used.  The current conf files do not explain how the private key is handled at all, so without knowledge of Asterisk's TLS implementation, it would be hard to know for sure what was going on or how to set it up.

Review: http://reviewboard.digium.com/r/234/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@190545 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-24 21:22:31 +00:00
russell 89175b7e04 Convert the ast_channel data structure over to the astobj2 framework.
There is a lot that could be said about this, but the patch is a big 
improvement for performance, stability, code maintainability, 
and ease of future code development.

The channel list is no longer an unsorted linked list.  The main container 
for channels is an astobj2 hash table.  All of the code related to searching 
for channels or iterating active channels has been rewritten.  Let n be 
the number of active channels.  Iterating the channel list has gone from 
O(n^2) to O(n).  Searching for a channel by name went from O(n) to O(1).  
Searching for a channel by extension is still O(n), but uses a new method 
for doing so, which is more efficient.

The ast_channel object is now a reference counted object.  The benefits 
here are plentiful.  Some benefits directly related to issues in the 
previous code include:

1) When threads other than the channel thread owning a channel wanted 
   access to a channel, it had to hold the lock on it to ensure that it didn't 
   go away.  This is no longer a requirement.  Holding a reference is 
   sufficient.

2) There are places that now require less dealing with channel locks.

3) There are places where channel locks are held for much shorter periods 
   of time.

4) There are places where dealing with more than one channel at a time becomes 
   _MUCH_ easier.  ChanSpy is a great example of this.  Writing code in the 
   future that deals with multiple channels will be much easier.

Some additional information regarding channel locking and reference count 
handling can be found in channel.h, where a new section has been added that 
discusses some of the rules associated with it.

Mark Michelson also assisted with the development of this patch.  He did the 
conversion of ChanSpy and introduced a new API, ast_autochan, which makes it 
much easier to deal with holding on to a channel pointer for an extended period 
of time and having it get automatically updated if the channel gets masqueraded.
Mark was also a huge help in the code review process.

Thanks to David Vossel for his assistance with this branch, as well.  David 
did the conversion of the DAHDIScan application by making it become a wrapper 
for ChanSpy internally.

The changes come from the svn/asterisk/team/russell/ast_channel_ao2 branch.

Review: http://reviewboard.digium.com/r/203/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@190423 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-24 14:04:26 +00:00
file a8182a597e Fix nat setting on RTP instances.
(closes issue #14827)
Reported by: pj


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@190421 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-24 13:49:03 +00:00
russell 73dd01b855 Merged revisions 190356 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r190356 | russell | 2009-04-23 16:07:07 -0500 (Thu, 23 Apr 2009) | 2 lines

Remove a bogus ast_channel_unlock().

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@190357 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-23 21:13:07 +00:00
dvossel 8a2cc6b398 Fixes segfault when switching UDP to TCP in sip.conf after reload.
If transport in sip.conf is switched from UDP to TCP, Asterisk segfaults right after issuing a sip reload.  The problem is the socket type is changed to TCP but the fd may still be present for UDP.  Later, when the TCP session should be created or set using an existing one, it isn't because the old file descriptor is still present.  Now every time transport is changed during a sip.conf reload, the file descriptor is set to -1, signifying it must be created or found.

(closes issue #14727)
Reported by: pj
Tested by: dvossel

Review: http://reviewboard.digium.com/r/229/



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@189771 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-21 20:28:37 +00:00
file e13fd1f9fd Fix a bug with non-UDP connections that caused dialogs to not get freed.
This issue crept up because of a reference count issue on non-UDP based dialogs.
The dialog reference count was increased when transmitting a packet reliably but never
decreased. This caused the dialog structure to hang around despite being unlinked from
the dialogs container.

(closes issue #14919)
Reported by: vrban


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@189350 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-20 17:05:15 +00:00
mmichelson f4542acb18 Prevent a crash when SIP blonde transferring an unbridged call.
If one attempts to use the attended transfer button on a SIP phone
to transfer an unbridged call (such as a call to an IVR) but hangs
up while the target of the transfer is still ringing, we need to not
crash.

The problem was that ast_hangup was called from outside the channel
thread.

AST-211



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@189097 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-17 20:20:23 +00:00
file 3337353cd1 Merged revisions 188946 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r188946 | file | 2009-04-17 11:41:25 -0300 (Fri, 17 Apr 2009) | 15 lines
  
  Fix a bug where a value used to create the channel name was bogus.
  
  This commit fixes the scenario where an incoming call is authenticated
  using a peer entry. Previously the channel name was created using either
  the username setting from the sip.conf entry or the IP address that the
  call came from. Now the channel name will be created using the peer name
  itself. This commit will not change the way the channel name is generated
  for users or friends.
  
  (closes issue #14256)
  Reported by: Nick_Lewis
  Patches:
        chan_sip.c-chname.patch uploaded by Nick (license 657)
  Tested by: Nick_Lewis, file
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@188947 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-17 14:44:56 +00:00
tilghman f530d225dc Merged revisions 188835 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r188835 | tilghman | 2009-04-16 16:41:13 -0500 (Thu, 16 Apr 2009) | 7 lines
  
  Only update realtime, if global option rtupdate != false
  (closes issue #14885)
   Reported by: deepesh
   Patches: 
         20090413__bug14885.diff.txt uploaded by tilghman (license 14)
   Tested by: deepesh
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@188836 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-16 21:57:37 +00:00
dvossel cc06d11633 SIP state notify reorganization
What I've done here is simply break up how a state NOTIFY is built.  Originally both the XML and sip header information were built within the same function.  While this does work, it does not allow for the creation of multipart/related message bodies that can contain multiple XML entries with only one sip header.  Now a separate function builds the XML for each notify.  This patch also makes maintaining and modifying state notifications in the future much less of a pain.

Review: http://reviewboard.digium.com/r/224/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@188742 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-16 19:30:23 +00:00
file 88fc073714 Fix a bug with the change I made yesterday to outbound proxy support.
Per discussion with oej on IRC we need the actual IP address, not the
outbound proxy IP address, in the sa field. This change matches the already
existing code for all other uses of the outbound proxy setting.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@188247 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-14 13:14:21 +00:00
file 2aa5a22ba9 Fix a bug where using an outbound proxy would cause the local address to be 127.0.0.1.
Copy the outbound proxy IP address into the SIP dialog structure as the IP address we will
be sending to. This has to be done because the logic that determines what local IP address to use
in the SIP messages is not aware of an outbound proxy being in place. It only knows what IP address
we are sending to.

(closes issue #12006)
Reported by: mnicholson


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@188067 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-13 16:28:06 +00:00
file f52aa65700 Fix some uninitialized memory notices that appeared under valgrind.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@187772 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-10 18:02:44 +00:00
tilghman 5de3fe02ad Ensure pvt is not NULL before dereferencing it.
(closes issue #14784)
 Reported by: pj


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@187674 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-10 15:59:40 +00:00
mmichelson 9e631e31c3 Add a new option, mwi_from, to sip.conf.
This allows for you to change the From header for outgoing MWI
NOTIFY requests. Prior to this, the best you could do was to
set a callerid in the general section of sip.conf. The problem
was that this was used for all outbound requests, not just
MWI NOTIFY requests.

AST-201



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@187560 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-09 21:06:26 +00:00
mmichelson 7ee1f97552 Merged revisions 187484 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r187484 | mmichelson | 2009-04-09 13:51:20 -0500 (Thu, 09 Apr 2009) | 18 lines
  
  Handle a SIP race condition (reinvite before an ACK) properly.
  
  RFC 5047 explains the proper course of action to take if a 
  reINVITE is received before the ACK from a previous invite
  transaction. What we are to do is to treat the reINVITE as
  if it were both an ACK and a reINVITE and process it normally.
  
  Later, when we receive the ACK we had been expecting, we will
  ignore it since its CSeq is less than the current iseqno of
  the sip_pvt representing this dialog.
  
  (closes issue #13849)
  Reported by: klaus3000
  Patches:
        13849_v2.patch uploaded by mmichelson (license 60)
  Tested by: mmichelson, klaus3000
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@187488 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-09 18:58:41 +00:00
tilghman 9271f8a127 Allow '/' in username portion of register; this is a regression.
(closes issue #14668)
 Reported by: Netview


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@187381 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-09 17:20:49 +00:00
tilghman f207dd463c Merged revisions 187362 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r187362 | tilghman | 2009-04-09 11:38:37 -0500 (Thu, 09 Apr 2009) | 3 lines
  
  Permit zero-length text messages in SIP.
  (Related to an issue posted to the -users list, subject "AEL2, BASE64_DECODE and hexadecimal")
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@187363 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-09 16:39:43 +00:00
file 0728169c6a Add support for allowing the channel driver to handle transcoding.
This was accomplished using a set of options and the setoption channel callback.
The core calls into the channel driver using these options and the channel driver
either returns success or failure.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@187360 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-09 16:19:35 +00:00
russell bfa0727781 Remove duplicate prototype for temp_peer().
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@187105 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-08 17:51:35 +00:00
russell 7578403318 Update some comments and resolve potential memory corruption in chan_sip.
While browsing chan_sip the other day, I noticed this dangerous code in
dialog_needdestroy().  This function is an ao2_callback.  It is absolutely
_not_ okay to unlock the container from within this function.  It's also not
clear why it was useful.  Given that it could cause memory corruption, I have
removed it.

There was also a TODO comment left describing a potential implementation of
an improvement to the needdestroy handling.  I'm not convinced that what was
described is the best choice here, so I have briefly described the way that
this function is used today that could be improved.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@186928 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-08 12:35:57 +00:00
tilghman cb3c695481 Add lastms to the require API call.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@186899 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-08 05:06:22 +00:00
mmichelson 15893b0c7c Fix bad merge from fix for issue 13867.
(closes issue #14686)
Reported by: davidw




git-svn-id: http://svn.digium.com/svn/asterisk/trunk@186837 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-08 00:01:49 +00:00
file f9de0464a7 Fix problem when authenticating a non-RTP dialog.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@186653 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-06 17:03:07 +00:00
file f3f7095a51 Add support for changing the outbound codec on a SIP call using
a dialplan variable.

This adds a dialplan variable (SIP_CODEC_OUTBOUND) which controls
the codec offered for an outgoing SIP call. This is much like the
SIP_CODEC dialplan variable and has the same restrictions. The codec
set must be one that is configured for the call.

(closes issue #13243)
Reported by: samdell3
Patches:
      13243.diff uploaded by file (license 11)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@186624 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-06 16:15:30 +00:00
mmichelson f00656db9e This commit introduces COLP/CONP and Redirecting party information into Asterisk.
The channel drivers which have been most heavily tested with these enhancements are
chan_sip and chan_misdn. Further work is being done to add Q.SIG support and will be
introduced in a later commit. chan_skinny has code added to it here, but according
to user pj, the support on chan_skinny is not working as of now. This will be fixed in
a later commit.

A special thanks goes out to bugtracker user gareth for getting the ball rolling and
providing the initial support for this work. Without his initial work on this, this would
not have been nearly as painless as it was.

This functionality has been tested by Digium's product quality department, as well as a
customer site running thousands of calls every day. In addition, many many many many bugtracker
users have tested this, too.

(closes issue #8824)
Reported by: gareth

Review: http://reviewboard.digium.com/r/201



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@186525 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-03 22:41:46 +00:00
file 27b4657d60 Add better support for relaying success or failure of the ast_transfer() API call.
This API call now waits for a special frame from the underlying channel driver to
indicate success or failure. This allows the return value to truly convey whether
the transfer worked or not. In the case of the Transfer() dialplan application this
means the value of the TRANSFERSTATUS dialplan variable is actually true.

(closes issue #12713)
Reported by: davidw
Tested by: file


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@186382 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-03 16:47:27 +00:00
file 0eb1480fe0 Merge in the RTP engine API.
This API provides a generic way for multiple RTP stacks to be
integrated into Asterisk. Right now there is only one present, res_rtp_asterisk,
which is the existing Asterisk RTP stack. Functionality wise this commit
performs the same as previously. API documentation can be viewed in the
rtp_engine.h header file.

Review: http://reviewboard.digium.com/r/209/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@186078 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-02 17:20:52 +00:00
tilghman 889f2ce31e Merged revisions 186059 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
  r186059 | tilghman | 2009-04-02 12:09:13 -0500 (Thu, 02 Apr 2009) | 9 lines
  
  Merged revisions 186056 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.2
  
  ........
    r186056 | tilghman | 2009-04-02 12:02:18 -0500 (Thu, 02 Apr 2009) | 2 lines
    
    Fix for AST-2009-003
  ........
................


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@186060 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-02 17:10:28 +00:00
dvossel 65ce74d65d Merged revisions 185845 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r185845 | dvossel | 2009-04-01 14:02:00 -0500 (Wed, 01 Apr 2009) | 10 lines
  
  Fixes issue with dropped calles due to re-Invite glare and re-Invites never executing after a 491
  
  Acknowledgement for 491 responses were never being processed because it didn't match our pending invite's seqno.  Since the ACK was never processed, the 491 frame would continue to be retransmitted until eventually the call was dropped due to max retries.  Now during a pending invite, if we receive another invite, we send an 491 and hold on to that glare invite's seqno in the "glareinvite" variable for that sip_pvt struct.  When ACK's are received, we first check to see if it is in response to our pending invite, if not we check to see if it is in response to a glare invite.  In this case, it is in response to the glare invite and must be dealt with or the call is dropped.  I've changed the wait time for resending the re-Invite after receving a 491 response to comply with RFC 3261.  Before this patch the scheduled re-Invite would only change a flag indicating that the re-Invite should be sent out, now it actually sends it out as well. 
  
  (closes issue #12013)
  Reported by: alx
  
  Review: http://reviewboard.digium.com/r/213/
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@185846 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-01 19:03:32 +00:00
file f05524da50 Merged revisions 184947 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r184947 | file | 2009-03-30 11:35:47 -0300 (Mon, 30 Mar 2009) | 14 lines
  
  Improve our handling of T38 in the initial INVITE from a device.
  
  We now answer with matching media streams to what is requested. If an INVITE
  is received with both a T38 and RTP media stream this means we answer with both.
  For any outgoing calls created as a result of this inbound one no T38 is requested
  in the initial INVITE. Instead if we start receiving udptl packets we trigger a
  reinvite on the outbound side.
  
  (closes issue #12437)
  Reported by: marsosa
  Tested by: pinga-fogo, okrief, file, afu
  
  Review: http://reviewboard.digium.com/r/208/
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@184948 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-30 14:37:47 +00:00
file c59cbe4bef Merged revisions 184565 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r184565 | file | 2009-03-27 10:06:45 -0300 (Fri, 27 Mar 2009) | 9 lines
  
  Fix an issue where nat=yes would not always take effect for the RTP session on outgoing calls.
  
  If calls were placed using an IP address or hostname the global nat setting was copied over
  but was not set on the RTP session itself. This caused the RTP stack to not perform symmetric RTP
  actions.
  
  (closes issue #14546)
  Reported by: acunningham
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@184566 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-27 13:15:26 +00:00
russell f89c5f7e6c Improve performance of the ast_event cache functionality.
This code comes from svn/asterisk/team/russell/event_performance/.

Here is a summary of the changes that have been made, in order of both
invasiveness and performance impact, from smallest to largest.

1) Asterisk 1.6.1 introduces some additional logic to be able to handle
   distributed device state.  This functionality comes at a cost.
   One relatively minor change in this patch is that the extra processing
   required for distributed device state is now completely bypassed if
   it's not needed.

2) One of the things that I noticed when profiling this code was that a
   _lot_ of time was spent doing string comparisons.  I changed the way
   strings are represented in an event to include a hash value at the front.
   So, before doing a string comparison, we do an integer comparison on the
   hash.

3) Finally, the code that handles the event cache has been re-written.
   I tried to do this in a such a way that it had minimal impact on the API.
   I did have to change one API call, though - ast_event_queue_and_cache().
   However, the way it works now is nicer, IMO.  Each type of event that
   can be cached (MWI, device state) has its own hash table and rules for
   hashing and comparing objects.  This by far made the biggest impact on
   performance.

For additional details regarding this code and how it was tested, please see the
review request.

(closes issue #14738)
Reported by: russell

Review: http://reviewboard.digium.com/r/205/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@184339 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-25 21:57:19 +00:00
file e7b5772c49 Fix issue with a T38 reinvite being sent even if not configured to do so.
If we receive a T38 request negotiate control frame we should only attempt to do so
if the option is enabled on the dialog.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@184280 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-25 19:22:06 +00:00
dvossel 3347477a00 SIP preferred codec only feature
Added an option to respond to a SIP invite with only the single most preferred joint codec.  This limits the options of what codecs the other side can use.

(closes issue #12485)
Reported by: bamby
Review: http://reviewboard.digium.com/r/206/




git-svn-id: http://svn.digium.com/svn/asterisk/trunk@183995 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-24 20:01:29 +00:00
mmichelson d84a480aef Fix chan_sip so it builds.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@183555 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-20 16:25:17 +00:00
mmichelson b863608307 Merged revisions 183115 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r183115 | mmichelson | 2009-03-19 11:04:02 -0500 (Thu, 19 Mar 2009) | 14 lines
  
  Fix an issue where cancelled outgoing SIP calls would erroneously report the device as "in use."
  
  A user was having an issue where if an outgoing SIP call was canceled, the SIP device
  would remain in use if we had not received any response to the initial INVITE we sent out.
  The SIP device would remain in use until the autocongestion timer was exhausted.
  
  I tracked down the cause of this to be the section of code I am removing here. I asked several
  people what the purpose of this code was meant to be, but no one could give me any sort of
  answer as to why this was here. The person who was having this issue has been using this patch
  for several months and it has stopped the problems they have had.
  
  AST-196
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@183117 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-19 16:07:54 +00:00
file beb9e53f46 Improve our triggering of a T38 switchover internally when triggered by a received reinvite.
Previously we reached across the channel bridge to get the other party's SIP dialog
structure in order to trigger an outgoing reinvite. This is extremely dangerous to do
and only works if bridged to another SIP channel. This patch changes this to use the
T38 control frame method of requesting a switchover. This change also causes the SIP
channel driver to propogate back whether the switchover worked or not instead of blindly
accepting the incoming T38 reinvite.

Review: http://reviewboard.digium.com/r/200/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@183108 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-19 15:37:23 +00:00
file b1e7fa8737 Fix an issue with requesting a T38 reinvite before the call is answered.
The code responsible for sending the T38 reinvite did not check if an INVITE was
already being handled. This caused things to get confused and the call to fail.
The code now defers sending the T38 reinvite until the current INVITE is done being
handled.

(issue AST-191)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@182022 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-13 17:25:09 +00:00
kpfleming b85c11f49a improve a bit of suboptimal code
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@181985 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-13 16:55:38 +00:00
mmichelson 287090e090 Merged revisions 181768 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r181768 | mmichelson | 2009-03-12 13:29:48 -0500 (Thu, 12 Mar 2009) | 22 lines
  
  Properly send a 487 on an INVITE we have not responded to if we receive a BYE.
  
  If we receive an INVITE from an endpoint and then later receive a BYE from that
  same endpoint before we have sent a final response for the INVITE, then we need
  to respond to the INVITE with a 487. 
  
  There was logic in the code prior to this commit which seemed to exist solely to 
  handle this situation, but there was one condition in an if statement which 
  was incorrect. The only way we would send a 487 was if the sip_pvt had no owner
  channel. This made no sense since we created the owner channel when we received
  the INVITE, meaning that the majority of the time we would never send the 487.
  The 487 being sent should not rely on whether we have created a channel. Its
  delivery should be dependent on the current state of the initial INVITE transaction.
  With this commit, that logic is now correctly in place.
  
  (closes issue #14149)
  Reported by: legranjl
  Patches:
        14149.patch uploaded by mmichelson (license 60)
  Tested by: legranjl
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@181769 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-12 18:30:58 +00:00
file 028ef32ff9 Merged revisions 181328 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r181328 | file | 2009-03-11 14:22:52 -0300 (Wed, 11 Mar 2009) | 14 lines
  
  Fix issue where an attended transfer could not be completed under a rare scenario.
  
  When completing an attended transfer chan_sip does a check to make sure the extension
  in the URI portion of the Refer-To header is a local valid extension. We don't actually
  need to check this since we know for sure the other channel is already up and talking to
  the extension. Some devices do not put the extension in the Refer-To header either, which
  can cause the extension check to fail. We now no longer do this check if it is an attended
  transfer.
  
  (closes issue #14628)
  Reported by: sverre
  Patches:
        14628.diff uploaded by file (license 11)
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@181345 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-11 17:26:40 +00:00
file 880672dcb6 Merged revisions 181295 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r181295 | file | 2009-03-11 13:36:50 -0300 (Wed, 11 Mar 2009) | 9 lines
  
  Fix a problem with inband DTMF detection on outgoing SIP calls when dtmfmode=auto.
  
  When dtmfmode was set to auto the inband DTMF detector was not setup
  on outgoing SIP calls. This caused inband DTMF detection to fail.
  The inband DTMF detector is now setup for both dtmfmode inband and auto.
  
  (closes issue #13713)
  Reported by: makoto
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@181296 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-11 16:40:48 +00:00
jpeeler 7e7a32a4ed Fix malloc debug macros to work properly with h323.
The main problem here was that cstdlib was undefining free thereby causing the
proper debug macros to not be used. ast_h323.cxx has been changed to call
ast_free instead to avoid the issue. 

A few other issues were addressed:
- There were a few instances of functions improperly passing ast_free instead
of ast_free_ptr.
- Some clean up was done to avoid the debug macros intentionally being redefined.
(copied below from Kevin's commit, appreciate the help)
- disable astmm.h from doing anything when STANDALONE is defined, which is used
by the tools in the utils/ directory that use parts of Asterisk header files in
hackish ways; also ensure that utils/extconf.c and utils/conf2ael.c are
compiled with STANDALONE defined.

(closes issue #13593)
Reported by: pj



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@181135 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-11 04:06:44 +00:00
mmichelson fb5a0cb000 Add missing comment that quotes RFC 3891
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@181033 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-11 00:49:00 +00:00
mmichelson 964aa232b7 Merged revisions 181029,181031 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r181029 | mmichelson | 2009-03-10 19:30:26 -0500 (Tue, 10 Mar 2009) | 9 lines
  
  Fix incorrect tag checking on transfers when pedantic=yes is enabled.
  
  (closes issue #14611)
  Reported by: klaus3000
  Patches:
        patch_chan_sip_attended_transfer_1.4.23.txt uploaded by klaus3000 (license 65)
  Tested by: klaus3000
........
  r181031 | mmichelson | 2009-03-10 19:32:40 -0500 (Tue, 10 Mar 2009) | 3 lines
  
  Remove unused variables.
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@181032 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-11 00:46:47 +00:00
russell 9ffcd3c394 Resolve object matching issues related to the removal of the sip_user object.
Previously, chan_sip had both sip_peer and sip_user objects in memory.  A
patch went in to remove sip_user to simplify the code, since everything
could be done with just sip_peer.  This patch resolves some regressions
found that were introduced by those changes.

This code comes from svn/asterisk/team/group/sip-object-matching/.

Here is a list of the changes that have been made:

1) When doing a match by name with the find_peer() function, make it much
   easier to specify which objects should be matched by having a parameter
   that specifies exactly which object types should be considered.  Also,
   update find_by_name() to handle this parameter.  Finally, update all
   code to use the new option values.

2) When looking up an object for an outbound request by name, consider
   peers only.  (create_addr())

3) Only match peers on an incoming registration request.

4) When doing authentication (except for SUBSCRIBE), look up users
   by name, instead of all objects by name.
   
5) When doing authentication (except for SUBSCRIBE), after looking for
   a user by name, look for a peer by IP address, instead of all objects
   by IP address.

6) When handling the SIP qualify CLI command or manager action, look for
   a peer by name, instead of any object by name.

7) When handling the SIP unregister CLI command, look for a peer by name,
   instead of any object by name.

9) In sip_do_debug_peer(), search for a peer by name, instead of any object
   by name.

9) When handling the SIPPEER() dialplan function, search for a peer by name,
   instead of any object by name.

10) In the following session timer related functions, st_get_se(),
    st_get_refresher(), and st_get_mode(), when looking for an object for a
    given sip_pvt using pvt->peername, look for a peer by name, instead of any
    object by name.

11) Fix build_peer() to properly handle the case where separate type=peer and
    type=user entries were specified in sip.conf.

(closes issue #14505)
Reported by: lmadsen

Review: http://reviewboard.digium.com/r/172/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@180261 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-04 21:01:05 +00:00
mmichelson 3c05737b3d Allow for "magic" pickups to work when we wish to ignore the context
When the subscription context for a call pickup subscription differs
from the context of the call pickup target, there's not an easy way
to divine what context should be used for the pickup. The way to work
around this is to use PICKUPMARK as the context for the pickup.

This has been documented in the sip.conf.sample file

(ABE-1708)



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@180155 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-04 17:03:32 +00:00
oej 8ac970ba28 Please prefix default values with DEFAULT
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@179675 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-03 15:13:42 +00:00
mmichelson 8675791e9e Properly free memory and remove scheduler entries when a transmission failure occurs.
Previously, only the "data" field of the sip_pkt created during __sip_reliable_xmit 
was freed when XMIT_ERROR was returned by __sip_xmit. When retrans_pkt was called,
this inevitably resulted in the reading and writing of freed memory.

XMIT_ERROR is a condition meaning that we don't want to attempt resending the packet
at all. The proper action to take is to remove the scheduler entry we just created,
free the packet's data as well as the packet itself, and unlink it from the list of
packets on the sip_pvt structure.

(closes issue #14455)
Reported by: Nick_Lewis
Patches:
      14455.patch uploaded by mmichelson (license 60)
Tested by: Nick_Lewis



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@179219 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-01 21:45:08 +00:00
file 87a909a362 Merged revisions 178205 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r178205 | file | 2009-02-24 11:16:07 -0400 (Tue, 24 Feb 2009) | 9 lines
  
  Skip check for extension when subscribing for MWI.
  
  Since the remote side is not actually subscribing to a specific extension when
  subscribing for MWI just skip the check to see if the extension exists. They can't use it
  to specify the mailbox either since we require configuration of that in sip.conf
  
  (closes issue #14531)
  Reported by: festr
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@178213 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-24 15:18:38 +00:00
tilghman 36f2f83a6c On update, test against the existence of sipregs.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@177944 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-21 15:59:49 +00:00
mvanbaak aa99ddd212 make chan_sip.c compile on OpenBSD again.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@177849 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-21 12:22:32 +00:00
jpeeler a288ad4151 Set sip_request ast_str data to NULL so ast_str_copy allocates space properly
in copy_request

(issue #14478)
Reported by: erik_dedecker



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@177624 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-20 00:35:53 +00:00
file ec3b70a59d Fix ordering of output for a ChannelUpdate manager event.
(closes issue #14497)
Reported by: vinsik
Patches:
      chan_update_fix-chan_sip.c.diff uploaded by vinsik (license 623)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@177005 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-18 17:11:52 +00:00
dhubbard 8f4488cebe T38 faxdetect should jump to the 'fax' extension for incoming calls only
The previous implementation of T38 faxdetect resulted in both sides of the
call jumping to a fax extension when both sides had 't38pt_udptl=yes' and
'faxdetect=yes' in sip.conf and a 'fax' extension in the current context.
This revision will jump to a 'fax' extension on incoming calls only.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176869 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-18 02:55:12 +00:00
dhubbard 9f40716814 create a UDPTL structure in create_addr_from_peer() if it does not already exist for T38
This is required to create a UDPTL structure in create_addr_from_peer() to handle the
scenario where 't38pt_udptl=yes' is not defined in the [general] section of sip.conf but 
is defined the peer's context.  I tested this patch by enabling t38pt_udptl in the 
[general] section on one system and only enabling t38pt_udptl in a peer's context on
the system sending a fax.  Without the patch, the sending system will fail to initiate
T38 negotiation with the warning message, "No way to add SDP without an UDPTL structure".
When this patch is applied the sending side will successfully initiate T38 negotiation.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176705 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-17 21:59:38 +00:00
tilghman 21702a5169 In this version, we can combine the queries, because we support dropping
nonexistent columns.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176501 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-17 14:39:36 +00:00
tilghman 44235f022f Merged revisions 176426 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r176426 | tilghman | 2009-02-16 18:49:22 -0600 (Mon, 16 Feb 2009) | 10 lines
  
  After a 'sip reload', qualifies for realtime peers weren't immediately
  restarted, instead waiting until the next registration.  We're now
  caching the qualify across a reload/restart and starting the qualify
  immediately upon loading the peer.
  (closes issue #14196)
   Reported by: pdf
   Patches: 
         20090120__bug14196_1.4.diff.txt uploaded by pdf (license 663)
   Tested by: pdf
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176459 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-17 01:58:39 +00:00
file bbbe3830c7 Merged revisions 176029 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r176029 | file | 2009-02-16 11:33:53 -0400 (Mon, 16 Feb 2009) | 9 lines
  
  Don't have the Via header stored as a stringfield as it can change often during the lifetime of a dialog.
  
  This issue crept up with subscriptions on the AA50. When an outgoing NOTIFY is sent a new branch value
  is created and the Via header is changed to reflect it. Since this was a stringfield a new spot in the
  pool was used for the value while the old was left untouched/unused. If the current pool was full a new
  pool was created. This would cause memory usage to increase steadily.
  
  (issue #AA50-2332)
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176030 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-16 15:36:19 +00:00
mvanbaak 6573bfb8ea Merged revisions 175921 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r175921 | mvanbaak | 2009-02-16 00:37:03 +0100 (Mon, 16 Feb 2009) | 3 lines
  
  fix mis-spelling of the word registered.
  Reported by De_Mon on #asterisk-dev.
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@175952 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-16 00:26:59 +00:00
russell 3714d9820f Fix a number of problems with ast_sched_report().
1) It had numerous coding guidelines violations with regards to formatting.

2) It allocated memory using ast_calloc() that was never freed.

3) It didn't check for failure from the allocation.

4) It used sprintf() and strcat() to build the result, doing zero checking to
   prevent writing past the end of the provided buffer.

The function also lacks API documentation, but that has not been addressed in
this commit.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@175829 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-15 20:56:27 +00:00
oej 3e7a19b7e1 Merged revisions 175777 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r175777 | oej | 2009-02-15 20:48:38 +0100 (Sön, 15 Feb 2009) | 2 lines

Make sure that the debug line is not printed on debug level 0

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@175783 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-15 20:18:27 +00:00
kpfleming a46dd55034 Add basic (passthrough, playback, record) support for ITU G.722.1 and G.722.1C (also known as Siren7 and Siren14)
This patch adds passthrough, file recording and file playback support for the codecs listed above, with negotiation over SIP/SDP supported. Due to Asterisk's current limitation of treating a codec/bitrate combination as a unique codec, only G.722.1 at 32 kbps and G.722.1C at 48 kbps are supported.

Along the way, some related work was done:

1) The rtpPayloadType structure definition, used as a return result for an API call in rtp.h, was moved from rtp.c to rtp.h so that the API call was actually usable. The only previous used of the API all was chan_h323.c, which had a duplicate of the structure definition instead of doing it the right way.

2) The hardcoded SDP sample rates for various codecs in chan_sip.c were removed, in favor of storing these sample rates in rtp.c along with the codec definitions there. A new API call was added to allow retrieval of the sample rate for a given codec.

3) Some basic 'a=fmtp' parsing for SDP was added to chan_sip, because chan_sip *must* decline any media streams offered for these codecs that are not at the bitrates that we support (otherwise Bad Things (TM) would result).

Review: http://reviewboard.digium.com/r/158/



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@175508 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-13 13:35:24 +00:00
russell e1db2e3c5a Remove useless string copy, and make sscanf safe again
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@175368 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-12 21:41:01 +00:00
russell 0ee8c277d7 Avoid using ast_strdupa() in a loop.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@175295 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-12 20:45:47 +00:00
file 884af3b641 Only decrease inringing count if above zero.
(issue #13238)
Reported by: kowalma


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@174710 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-10 20:15:43 +00:00
file fff38ff0e6 Set the type for the peer structure to be a peer as the default.
(closes issue #14447)
Reported by: triccyx


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@174580 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-10 17:48:29 +00:00
file 0c8b6d125e Make the logic for inuse and inringing manipluation match that of 1.4. The old broken logic would reset the values back to 0 during certain scenarios causing the wrong state to be reported.
(closes issue #14399)
Reported by: caspy
(issue #13238)
Reported by: kowalma


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@174543 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-10 15:37:07 +00:00
mmichelson 8fc4fe7043 Fix something I messed up in the merge I just did
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@174327 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-09 17:27:32 +00:00
mmichelson a610dee8ab Merged revisions 174282 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r174282 | mmichelson | 2009-02-09 11:11:05 -0600 (Mon, 09 Feb 2009) | 12 lines

Don't do an SRV lookup if a port is specified

RFC 3263 says to do A record lookups on a hostname
if a port has been specified, so that's what we're
going to do. See section 4.2.

(closes issue #14419)
Reported by: klaus3000
Patches:
      patch_chan_sip_nosrvifport_1.4.23.txt uploaded by klaus3000 (license 65)


........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@174301 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-09 17:20:55 +00:00
dhubbard 6be77d4911 Merged revisions 174082 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r174082 | dhubbard | 2009-02-06 17:36:03 -0600 (Fri, 06 Feb 2009) | 5 lines

check ast_strlen_zero() before calling ast_strdupa() in sip_uri_headers_cmp()
and sip_uri_params_cmp()

The reporter didn't actually upload a properly-formed patch, instead a 
modified chan_sip.c file was uploaded.  I created a patch to determine the
changes, then modified the suggested changes to create a proper fix.  The
summary above is a complete description of the changes.

(closes issue #13547)
Reported by: tecnoxarxa
Patches:
      chan_sip.c.gz uploaded by tecnoxarxa (license 258)
Tested by: tecnoxarxa

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@174084 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-06 23:51:56 +00:00
file 1975038c48 Merged revisions 173967-173968 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r173967 | file | 2009-02-06 13:14:15 -0400 (Fri, 06 Feb 2009) | 4 lines
  
  Some clients do not put the call-id for replaces at the beginning, so support it being anywhere in the string.
  (closes issue #14350)
  Reported by: fhackenberger
........
  r173968 | file | 2009-02-06 13:15:01 -0400 (Fri, 06 Feb 2009) | 2 lines
  
  Remove a debug message I put in by accident.
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@173974 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-06 17:18:35 +00:00
mnicholson e17d56ebe8 Merged revisions 173917 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r173917 | mnicholson | 2009-02-06 10:20:23 -0600 (Fri, 06 Feb 2009) | 7 lines
  
  Limit the addition of the Contact header in SIP responses according to various
  SIP RFCs.
  
  (closes issue #13602)
  Reported by: hjourdain
  Tested by: mnicholson
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@173952 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-06 16:28:19 +00:00
russell c223d3d18e Fix a spelling mistake.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@172855 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-02 16:42:58 +00:00
oej aefd318d0a Add a todo. I do need to really check what's going on with this kill-the-user business ;-)
Why do we suddenly have two flags to set peer type?


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@172818 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-02 10:46:19 +00:00
oej ee78a4c03e Small formatting change
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@172817 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-02 10:44:48 +00:00
oej 278f4bbb6f Add some well-needed improvements to the wishlist in the code, so that we can close
some bug reports. 


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@172816 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-02 10:29:07 +00:00
seanbright 284c70cb02 The CID lookup feature wasn't actually working properly with dialog-info+xml
supporting devices.  The devices (snoms, specifically) need to receive a SIP
URI instead of just an extension.  This adds that functionality.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@172778 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-02 01:41:29 +00:00
oej 10712d118c Fix "cancel answered elsewhere" through app_queue with members in chan_local.
Also, implement a private cause code (as suggested by Tilghman). This works with
chan_sip, but doesn't propagate through chan_local.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@172318 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-29 17:08:22 +00:00
oej 7ad1a935c8 - Make sure we set setvar= variables on outbound calls too, not only inbound calls.
- Also, change a function in app.c to return a userful value instead of always returning 0.

Patch by fnordian, changed by Corydon76 and myself.

This does not close the bug report, as fnordian had an additional change we're still discussing.

(related to issue #14059)
Reported by: fnordian
Patches: 
      chan_sip_hfield.patch uploaded by fnordian (license 110)
      20090116__bug14059.diff.txt uploaded by Corydon76 (license 14)
Tested by: fnordian, Corydon76, oej



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@172268 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-29 13:21:31 +00:00
oej 97b25e2c2f Make sure register= line supports both port and expiry at the same time.
(closes issue #14185)
Reported by: Nick_Lewis
Patches: 
      chan_sip.c-expiryrequest6.patch uploaded by Nick (license 657)
Tested by: Nick_Lewis


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@172234 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-29 11:19:29 +00:00
oej 147b586189 Merged revisions 172169 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r172169 | oej | 2009-01-29 09:48:18 +0100 (Tor, 29 Jan 2009) | 16 lines

Make sure that we always add the hangupcause headers. In some cases, the owner was disconnected before we checked for the cause.
This patch implements a temporary storage in the pvt and use that instead.

The code is based on ideas from code from Adomjan in issue #13385 (Add support for Reason: header)
Thanks to Klaus Darillion for testing!

(closes issue #14294)
related to issue #13385

Reported by: klaus3000 and adomjan
Patches: 
      bug14294b.diff uploaded by oej (license 306)
      Based on 20080829_chan_sip.c-q850reason_header.patch uploaded by adomjan (license 487)
Tested by: oej, klaus3000


........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@172173 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-29 09:18:01 +00:00
oej 930bc0ddd3 Solving the same issue, but a bit different in trunk...
Merged revisions 171527 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r171527 | oej | 2009-01-27 15:33:20 +0100 (Tis, 27 Jan 2009) | 13 lines

Use the same branch tag in CANCEL as in INVITE

Originally putnopvut implemented some changes in revision 142079 that according to the bug report seemed to have worked then, but somehow fails now.
I guess code, as humans, get old and forget stuff. Anyway, this bug caused CANCEL not to work with picky systems. 

Thanks Fredrik for pointing out where the bug in the SIP messaging was.

(closes issue #14346)
Reported by: oej
Patches: 
      bug14346.diff uploaded by oej (license 306)
Tested by: oej

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@171528 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-27 15:00:19 +00:00
oej 15288ca4ab Moving generic setting to friends
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@171401 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-26 15:56:13 +00:00
oej 88f8e905b1 Continue to move variables into the sip_cfg structure to make them easier to handle in the future as a group of settings for a group of devices.
At some point, I want one sip_cfg per domain handled, so we can have "group" settings.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@171400 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-26 15:51:00 +00:00
oej 9e1e3a106c Just moving around variable declarations so that we have all globals in the same place.
Default setting is set before we activate the channel or at reloads, not where we declare the variable.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@171364 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-26 15:11:39 +00:00
oej 1b760584f5 Merged revisions 171264 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r171264 | oej | 2009-01-26 13:51:53 +0100 (MÃ¥n, 26 Jan 2009) | 9 lines

Don't retransmit 401 on REGISTER requests when alwaysauthreject=yes

(closes issue #14284)
Reported by: klaus3000
Patches: 
      patch_chan_sip_unreliable_1.4.23_14284.txt uploaded by klaus3000 (license 65)
Tested by: klaus3000


........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@171326 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-26 13:44:40 +00:00
file 3c1dec78d3 Merged revisions 170504 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r170504 | file | 2009-01-23 14:04:08 -0400 (Fri, 23 Jan 2009) | 4 lines
  
  Use the on hold flag to see if the call is on hold or not. It is possible that our address for them will still be valid even though they are on hold.
  (closes issue #14295)
  Reported by: klaus3000
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@170505 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-23 18:09:45 +00:00
mmichelson 694c1c897b Further fix some oddities in sip show users and sip show peers logic
ccesario on IRC pointed out that his sip peers were not displayed
properly when he would issue the command "sip show peers." The problem
was that the onlymatchonip field was used to determine if the endpoint
was a "peer" or "user." The tricky part is that a "friend" is supposed
to be treated as both a "user" and a "peer" but the logic would not allow
"friends" to show up as "peers" since onlymatchonip was set to FALSE
for friends.

I have modified the sip_peer structure to more explicitly keep track of
what type endpoint it is so that the various manager and CLI commands
will display the expected information

Reported by ccesario via IRC
Tested by ccesario



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@169791 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-21 21:53:55 +00:00
mmichelson 25fb02c6db Convert the character pointers in a sip_request to be pointer offsets
When an ast_str expands to hold more data, any pointers that were pointing
to the data prior to the expansion will be pointing at invalid memory. This
change makes such pointers used in chan_sip.c instead be offsets from the
beginning of the string so that the same math may be applied no matter where
in memory the string resides.

To help ease this transition, a macro called REQ_OFFSET_TO_STR has been added
to chan_sip.c so that given a sip_request and an offset, the string at that
offset is returned.

(closes issue #14220)
Reported by: riksta
Tested by: putnopvut

Review http://reviewboard.digium.com/r/126/



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@169557 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-20 20:10:31 +00:00
twilson 729d4f1b6b Fix port :0 added to SIP INVITE URI when outboundproxy used
(closes issue #14233)
Reported by: chris-mac
Patches: 
      asterisk-bug14233.diff.txt uploaded by jamesgolovich (license 176)
Tested by: jamesgolovich, chris-mac, otherwiseguy


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@169044 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-17 00:03:39 +00:00
mmichelson 1472104f5c Merged revisions 168975 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r168975 | mmichelson | 2009-01-16 16:42:13 -0600 (Fri, 16 Jan 2009) | 18 lines

Account for possible NULL pointer when we receive a 408 in response to a REGISTER

It may be that by the time we receive a reply to a REGISTER request, the attempt has
timed out and thus the registry structure pointed to by the corresponding sip_pvt has
gone away. This situation was handled properly for a 200 OK response, but the 408
case assumed that the sip_registry struct was non-NULL, thus potentially causing a crash

This commit fixes this assumption and prints out a message to the console if we should
receive a late 408 response to a REGISTER


(closes issue #14211)
Reported by: aborghi
Patches:
      14211.diff uploaded by putnopvut (license 60)
Tested by: aborghi


........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@168976 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-16 22:43:09 +00:00
mmichelson 9c759ce0bc Add missing brace
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@168732 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-15 20:00:46 +00:00
mmichelson 7813d653a7 Fix the compactheaders option in sip.conf
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@168728 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-15 19:16:29 +00:00
mmichelson 07d9f87e9f Remove an unneeded condition for line addition to a SIP request/response
In Asterisk 1.4 and 1.6.0, the sip_request structure had a statically
allocated buffer to hold the text of the request. There was a check in the
add_line function to not attempt to write the line into the buffer if we
did not have room for it.

In trunk and Asterisk versions starting with 1.6.1, an expandable ast_str
structure is used to hold the text. Since it may grow to fit an arbitrarily
sized string, this check in add_line is no longer valid.

I found this oddity while attempting to fix issue #14220; however, I do not
believe that this is the fix for that issue since the output supplied by the
reporter did not contain the warning message that would be printed had this
condition been satisfied.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@168725 f38db490-d61c-443f-a65b-d21fe96a405b
2009-01-15 19:00:06 +00:00