Commit Graph

1908 Commits

Author SHA1 Message Date
Jeff Peeler
3296b7882e (closes issue #12362) [redo of 113012]
This fixes a for loop (in realtime_peer) to check all the ast_variables the loop was intending to test rather than just the first one. The change exposed the problem of calling memcpy on a NULL pointer, in this case the passed in sockaddr_in struct which is now checked. 



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@113240 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-07 21:34:45 +00:00
Jeff Peeler
ca8d1cf992 (closes issue #12362)
(closes issue #12372)
Reported by: vinsik
Tested by: tecnoxarxa

This one line change makes an if inside a for loop (in realtime_peer) check all the ast_variables the loop was intending to test rather than just the first one.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@113012 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-07 15:16:44 +00:00
Joshua Colp
dcad2163df Do not pass audio until the remote side has indicated they are providing early media, or if the channel has been answered.
(closes issue #11823)
Reported by: SDamm


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@112204 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-01 17:43:46 +00:00
Joshua Colp
d2eef8c07e If we are requested to authenticate a reinvite make sure that it contains T38 SDP if need be.
(closes issue #11995)
Reported by: fall


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@111020 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-26 19:04:35 +00:00
Jeff Peeler
e510971e20 This one line change makes an if inside a for loop (in realtime_peer) check all the ast_variables the loop was intending to test rather than just the first one.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@110727 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-25 20:03:13 +00:00
Mark Michelson
baa405e8c3 When reverting a commit, I accidentally left in this bit which was an experiment
to see what would happen. It passed the compile test, and I didn't notice I had
left this change in too.

So this is a revert of a revert...sort of.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@110635 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-25 15:40:33 +00:00
Mark Michelson
6eed7ae503 This is a revert for revision 108288. The reason is that that revision
was not for an actual bug fix per se, and so it really should not have been in 1.4 in
the first place. Plus, people who compile with DO_CRASH are more likely
to encounter a crash due to this change. While I think the usage of DO_CRASH
in ast_sched_del is a bit absurd, this sort of change is beyond the scope of 1.4
and should be done instead in a developer branch based on trunk 
so that all scheduler functions are fixed at once.

I also am reverting the change to trunk and 1.6 since they also suffer from
the DO_CRASH potential.

(closes issue #12272)
Reported by: qq12345



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@110618 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-24 19:17:41 +00:00
Russell Bryant
e653f8b232 Merged revisions 110335 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r110335 | russell | 2008-03-20 16:53:27 -0500 (Thu, 20 Mar 2008) | 6 lines

Fix some very broken code that was introduced in 1.2.26 as a part of the security
fix.  The dnsmgr is not appropriate here.  The dnsmgr takes a pointer to an address
structure that a background thread continuously updates.  However, in these cases,
a stack variable was passed.  That means that the dnsmgr thread would be continuously
writing to bogus memory.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@110336 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-20 21:54:58 +00:00
Jason Parker
7f7e7d27e4 Merged revisions 109391 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r109391 | qwell | 2008-03-18 10:08:41 -0500 (Tue, 18 Mar 2008) | 3 lines

Do not return with a successful authentication if the From header ends up empty.
(AST-2008-003)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@109393 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-18 15:10:16 +00:00
Joshua Colp
5fda7910c6 Put a maximum limit on the number of payloads accepted, and also make sure a given payload does not exceed our maximum value.
(AST-2008-002)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@109386 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-18 14:58:39 +00:00
Joshua Colp
8bb334e308 200 OKs in response to a reinvite need to be sent reliably. If the remote side does not receive one the dialog will be torn down.
(closes issue #12208)
Reported by: atrash


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@109107 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-17 16:24:29 +00:00
Mark Michelson
e0194ffaa7 Fix a race condition in the SIP packet scheduler which could cause a crash.
chan_sip uses the scheduler API in order to schedule retransmission of reliable
packets (such as INVITES). If a retransmission of a packet is occurring, then the
packet is removed from the scheduler and retrans_pkt is called. Meanwhile, if
a response is received from the packet as previously transmitted, then when we 
ACK the response, we will remove the packet from the scheduler and free the packet.

The problem is that both the ACK function and retrans_pkt attempt to acquire the
same lock at the beginning of the function call. This means that if the ACK function
acquires the lock first, then it will free the packet which retrans_pkt is about to
read from and write to. The result is a crash.

The solution:

1. If the ACK function fails to remove the packet from the scheduler and the retransmit
   id of the packet is not -1 (meaning that we have not reached the maximum number of 
   retransmissions) then release the lock and yield so that retrans_pkt may acquire the
   lock and operate.

2. Make absolutely certain that the ACK function does not recursively lock the lock in
   question. If it does, then releasing the lock will do no good, since retrans_pkt will
   still be unable to acquire the lock.

(closes issue #12098)
Reported by: wegbert
(closes issue #12089)
Reported by: PTorres
Patches:
      12098-putnopvutv3.patch uploaded by putnopvut (license 60)
Tested by: jvandal



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@108737 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-14 16:44:08 +00:00
Russell Bryant
a10f524dfb Make a tweak that gets the LEDs on polycom phones to blink when an extension that
has been subscribed to goes on hold.  Otherwise, they just stay on like it does
when an extension is in use.

(closes issue #11263)
Reported by: russell
Patches:
      notify_hold.rev1.txt uploaded by russell (license 2)
Tested by: russell


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@108530 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-13 21:06:33 +00:00
Mark Michelson
9ff74a2b0a Change AST_SCHED_DEL use to ast_sched_del for autocongestion in chan_sip.
The scheduler callback will always return 0. This means that this id 
is never rescheduled, so it makes no sense to loop trying to delete
the id from the scheduler queue. If we fail to remove the item from the
queue once, it will fail every single time.

(Yes I realize that in this case, the macro would exit early because the
id is set to -1 in the callback, but it still makes no sense to use
that macro in favor of calling ast_sched_del once and being done with it)

This is the first of potentially several such fixes.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@108288 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-12 21:53:46 +00:00
Kevin P. Fleming
988e55c13f if we receive an INVITE with a Content-Length that is not a valid number, or is zero, then don't process the rest of the message body looking for an SDP
closes issue #11475
Reported by: andrebarbosa



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@108086 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-12 19:16:07 +00:00
Terry Wilson
28423c15fc If we fail to alloc a channel, we should re-lock the pvt structure before returning.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@107290 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-11 00:59:18 +00:00
Joshua Colp
cd703523db Add a control frame to indicate the source of media has changed. Depending on the underlying technology it may need to change some things.
(closes issue #12148)
Reported by: jcomellas


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@106235 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-05 22:32:10 +00:00
Tilghman Lesher
b350a97937 Correctly initialize retransid in SIP, and ensure that the warning when failing to delete a schedule entry can actually hit the log.
(closes issue #12140)
 Reported by: slavon
 Patches: 
       sch2.patch uploaded by slavon (license 288)
(Patch slightly modified by me)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@106015 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-05 15:17:16 +00:00
Joshua Colp
36bb1f9d46 When a new source of audio comes in (such as music on hold) make sure the marker bit gets set.
(closes issue #10355)
Reported by: wdecarne
Patches:
      10355.diff uploaded by file (license 11)
(closes issue #11491)
Reported by: kanderson


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@105674 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-04 18:05:28 +00:00
Joshua Colp
70d43ff1d2 Add a comment to describe some logic.
(closes issue #12120)
Reported by: flefoll
Patches:
      chan_sip.c.br14.patch-just-a-comment uploaded by flefoll (license 244)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@105557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-03 15:15:39 +00:00
Joshua Colp
e6652d0a13 Make it so a users.conf user creates both a SIP peer and a SIP user. The user will be used for inbound authentication for the device, and peer will be used for placing calls to the device.
(closes issue #9044)
Reported by: queuetue
Patches:
      sip-gui-friend.diff uploaded by qwell (license 4)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@104095 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-25 21:37:20 +00:00
Joshua Colp
9b32204204 If a resubscription comes in for a dialog we no longer know about tell the remote side that the dialog does not exist so they subscribe again using a new dialog.
(closes issue #10727)
Reported by: s0l4rb03
Patches:
      10727-2.diff uploaded by file (license 11)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@104084 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-25 16:16:13 +00:00
Joshua Colp
2395b1a6f5 Due to recent changes tag will no longer be NULL if not present so we have to use ast_strlen_zero to see if it's actually blank.
(closes issue #12061)
Reported by: flefoll
Patches:
      chan_sip.c.br14.patch_pedantic_no_totag uploaded by flefoll (license 244)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@104082 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-25 15:17:18 +00:00
Tilghman Lesher
638ca62698 Backwards debug message.
(closes issue #12052)
 Reported by: flefoll
 Patches: 
       chan_sip.c.br14.patch_found-notfound uploaded by flefoll (license 244)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@104037 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-22 22:45:14 +00:00
Joshua Colp
7b6d391b76 Fix building of chan_sip.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@103807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-19 15:01:42 +00:00
Olle Johansson
7b72c89fb9 Make sure we send error replies correctly by checking the via header.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@103806 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-19 10:27:15 +00:00
Tilghman Lesher
4306df31b1 When a SIP channel is being auto-destroyed, it's possible for it to still be
in bridge code.  When that happens, we crash.  Delay the RTP destruction until
the bridge is ended.
(closes issue #11960)
 Reported by: norman
 Patches: 
       20080215__bug11960__2.diff.txt uploaded by Corydon76 (license 14)
 Tested by: norman


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@103780 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-18 17:31:52 +00:00
Joshua Colp
c8d5a65d35 Don't care if the extension given doesn't exist for subscription based MWI.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@103763 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-18 15:33:14 +00:00
Joshua Colp
f3f663d6fd Even if no CallerID name or number has been provided by the remote party still use the configured sip.conf ones.
(closes issue #11977)
Reported by: pj


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@103385 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-12 15:09:24 +00:00
Joshua Colp
f26bac62e6 Only consider a T.38-only INVITE compatible if we have both a joint capability between us and them and if they provided T.38.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@102725 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-06 17:59:23 +00:00
Joshua Colp
e9c59d95eb If a REGISTER attempt comes in that is a retransmission of a previous REGISTER do not create a new nonce value.
(issue #BE-381)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@102450 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-05 19:52:30 +00:00
Olle Johansson
649a083adb Use the same CSEQ on CANCEL as on INVITE (according to RFC 3261)
(closes issue #9492)
Reported by: kryptolus
Patches: 
      bug9492.txt uploaded by oej (license 306)
Tested by: oej


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@102142 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-03 16:38:12 +00:00
Olle Johansson
9a5d78c2c7 Handle ACK and CANCEL in an invite transaction - even if we get INFO transactions during the actual call setup.
(closes issue #10567)
Reported by: jacksch
Tested by: oej
Patch by: oej inspired by suggestions from neutrino88 in the bug tracker



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@102090 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-03 10:37:32 +00:00
Russell Bryant
26365fdeca Change the SDP_SAMPLE_RATE macro. It turns out that even though G.722 is 16 kHz,
it is supposed to specified as 8 kHz in the RTP, and RTP timestamps are supposed
to be calculated based on 8 kHz.  (Apparently this is due to a bug in a spec, but
people follow it anyway, because it's the spec ...)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@101989 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-01 23:06:32 +00:00
Jason Parker
9742fb53fe Solaris compat fixes for struct in_addr funkiness.
Issue #11885, patch by snuffy.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@101482 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-31 19:52:49 +00:00
Olle Johansson
5e02b0d76e Stop musiconhold on attended transfer.
(closes issue #11872)
Reported by: gareth
Patches: 
      svn-101018.patch uploaded by gareth (license 208)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@101152 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-30 11:20:31 +00:00
Olle Johansson
52cfa83d42 (closes issue #11736)
Reported by: MVF
Patches: 
      bug11736-2.diff uploaded by oej (license 306)
Tested by: oej, MVF, revolution

(russellb: This was the showstopper for the release.)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@100740 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-29 08:26:48 +00:00
Russell Bryant
fe50ae6de5 For some reason, the use of this strdupa() is leading to memory corruption on
freebsd sparc64.  This trivial workaround fixes it.

(closes issue #10300, closes issue #11857, reported by mattias04 and Home-of-the-Brave)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@100629 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-28 18:34:20 +00:00
Tilghman Lesher
7060a6888d When deleting a task from the scheduler, ignoring the return value could
possibly cause memory to be accessed after it is freed, which causes all
sorts of random memory corruption.  Instead, if a deletion fails, wait a
bit and try again (noting that another thread could change our taskid
value).
(closes issue #11386)
 Reported by: flujan
 Patches: 
       20080124__bug11386.diff.txt uploaded by Corydon76 (license 14)
 Tested by: Corydon76, flujan, stuarth`


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@100465 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-27 21:59:53 +00:00
Jason Parker
a70508ed3d This would have never been true, since we're passing (sizeof(req.data) - 1) as the len to recvfrom().
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@100378 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-25 21:24:49 +00:00
Olle Johansson
107c1c37b4 Second attempt. Don't change invitestate when receiving 18x messages in CANCEL state.
(issue #11736)
Reported by: MVF

Patch by oej.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@99978 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-23 21:07:16 +00:00
Olle Johansson
d95d9d7132 Make sure we don't cancel destruction on calls in CANCEL state, even if we
get 183 while waiting for answer on our CANCEL.

(issue #11736)
Reported by: MVF
Patches: 
      bug11736.txt uploaded by oej (license 306)
Tested by: MVF


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@99977 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-23 20:58:20 +00:00
Mark Michelson
3e54e684b2 These flag tests were illogical. They were testing sip_peer flags on a sip_pvt.
Thanks to Russell for helping to get this odd problem figured out.



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@99878 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-23 16:18:04 +00:00
Olle Johansson
f9cf98d4bf Thanks to Russell's education I realize that BUFSIZ has changed since I learned the C language
over 20 years ago... Resetting chan_sip to the size of BUFSIZ that I expected in my old 
head to avoid to heavy memory allocations on some systems.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@99652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-22 20:56:09 +00:00
Olle Johansson
33b77709a7 Cleaning up some documentation that led to confusion in a bug report
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@99501 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-22 15:08:14 +00:00
Joshua Colp
785f7da384 Bump the buffer size for Via headers up to 512. There are some exceptionally large Via headers out there.
(closes issue #11783)
Reported by: ofirroval


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@99301 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-21 16:01:00 +00:00
Joshua Colp
d35f5e39a2 Don't drop the old record route information when dealing with packets related to a reinvite.
(closes issue #11545)
Reported by: kebl0155
Patches:
      reinvite-patch.txt uploaded by kebl0155 (license 356)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@98955 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-16 03:07:24 +00:00
Russell Bryant
48a72bba86 Change a buffer in check_auth() to be a thread local dynamically allocated
buffer, instead of a massive buffer on the stack.  This fixes a crash reported
by Qwell due to running out of stack space when building with LOW_MEMORY defined.

On a very related note, the usage of BUFSIZ in various places in chan_sip is
arbitrary and careless.  BUFSIZ is a system specific define.  On my machine,
it is 8192, but by definition (according to google) could be as small as 256.  
So, this buffer in check_auth was 16 kB.  We don't even support SIP messages 
larger than 4 kB!  Further usage of this define should be avoided, unless it 
is used in the proper context.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@98946 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-15 23:50:10 +00:00
Joshua Colp
d355eb9c84 Based on the boundary found move over the correct amount.
(closes issue #11750)
Reported by: tasker


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@98934 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-15 20:08:43 +00:00
Joshua Colp
e3458a4976 Accept "; boundary=" not just ";boundary=" in the multipart mixed content type.
(closes issue #11750)
Reported by: tasker


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@98894 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-14 22:41:55 +00:00