Commit Graph

6685 Commits

Author SHA1 Message Date
Mark Michelson e46325f18c Fix port parsing in check_via.
If a Via header contained an IPv6 address, we would not properly parse
the port. We would instead get the information after the first colon in
the address.

(closes issue #17614)
Reported by: oej
Patches: 
      diff uploaded by sperreault (license 252)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275308 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-09 19:46:20 +00:00
Mark Michelson 7e6f9b4e2d Fix an issue where the port for p->ourip was being set to 0.
This should fix all the CDR tests that were not passing. When they would
originate a call, all fields in the INVITE that contained the source port would
have the port set to 0. Most troubling of these was the Contact header. Tests
are passing locally now and should also pass on the bamboo build agents.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275294 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-09 19:29:30 +00:00
Paul Belanger d2872c60e4 Merged revisions 275241 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r275241 | pabelanger | 2010-07-09 15:20:00 -0400 (Fri, 09 Jul 2010) | 8 lines
  
  Fix logging message for stale nonce.
  
  (closes issue #17582)
  Reported by: kenner
  Patches:
        chan_sip.c.diff uploaded by kenner (license 1040)
  Tested by: lmadsen
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275249 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-09 19:21:27 +00:00
Tilghman Lesher d6011adab4 Weird, no output and Bamboo still fails...
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275227 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-09 18:55:02 +00:00
Tilghman Lesher 384681e182 Add some diagnostic feedback to our data tests
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275172 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-09 18:21:39 +00:00
Tilghman Lesher da8450323f Kill some startup warnings and errors and make some messages more helpful in tracking down the source.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-09 17:00:22 +00:00
Mark Michelson 5f92aed2ba Return logic of sip_debug_test_addr() to its original functionality.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275104 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-09 16:39:16 +00:00
Mark Michelson 0cc20f86ba Fix sip_uri_parse test comparison.
Part of the change with the IPv6 changes is to treat a host:port as
a single 'domain' entity. This test was not updated to have the correct
expectation after calling parse_uri().



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274984 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-09 14:27:07 +00:00
53071af180 Copy the address into the peer structure after we set the default port
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-09 13:30:37 +00:00
Richard Mudgett c0fd67750b Fix calls of ast_sockaddr_from_sin() from IPv6 integration.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274828 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-08 23:46:20 +00:00
Mark Michelson cd4ebd336f Add IPv6 to Asterisk.
This adds a generic API for accommodating IPv6 and IPv4 addresses
within Asterisk. While many files have been updated to make use of the
API, chan_sip and the RTP code are the files which actually support
IPv6 addresses at the time of this commit. The way has been paved for
easier upgrading for other files in the near future, though.

Big thanks go to Simon Perrault, Marc Blanchet, and Jean-Philippe Dionne
for their hard work on this.

(closes issue #17565)
Reported by: russell
Patches: 
      asteriskv6-test-report.pdf uploaded by russell (license 2)

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274783 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-08 22:08:07 +00:00
Eliel C. Sardanons a1b89a6a50 Implement AstData API data providers as part of the GSOC 2010 project,
midterm evaluation.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274727 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-08 14:48:42 +00:00
David Vossel 21f8c77934 Fixes some ref count issues introduced by r274539
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274686 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-07 20:09:00 +00:00
Richard Mudgett fd3297a272 Add missing conditional around chan_dahdi mfcr2_skip_category config parameter.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274639 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-07 18:32:35 +00:00
Richard Mudgett d20ca64e70 Merged revisions 274579 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r274579 | rmudgett | 2010-07-07 13:12:41 -0500 (Wed, 07 Jul 2010) | 1 line
  
  Close the DAHDI FD on error when processing chan_dahdi toneduration config parameter.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274595 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-07 18:20:00 +00:00
Mark Michelson d6f8dd67f7 Use the relatedpeer field of a sip_pvt during INVITE processing.
Review: https://reviewboard.asterisk.org/r/629



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-07 16:21:53 +00:00
Terry Wilson 745f4edbd5 Merged revisions 274280 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r274280 | twilson | 2010-07-06 17:08:20 -0500 (Tue, 06 Jul 2010) | 9 lines
  
  Add option to not do a call forward on 482 Loop Detected
  
  Asterisk has always set up a forwarded call when receiving a 482 Loop Detected.
  This prevents handling the call failure by just continuing on in the dialplan.
  Since this would be a change in behavior, the new option to disable this
  behavior is forwardloopdetected which defaults to 'yes'.
  
  Review: https://reviewboard.asterisk.org/r/764/
........

(no option for trunk, just changing the behavior)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274284 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-06 22:15:27 +00:00
Tilghman Lesher 5754933045 Status shows all non-CRC4 lines as "yellow", even if "yellow" was not in the bitfield.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@274281 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-06 22:09:23 +00:00
Tilghman Lesher f4d96da591 Merged revisions 273793 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r273793 | tilghman | 2010-07-02 16:36:39 -0500 (Fri, 02 Jul 2010) | 9 lines
  
  Have the DEADLOCK_AVOIDANCE macro warn when an unlock fails, to help catch potentially large software bugs.
  
  (closes issue #17407)
   Reported by: pdf
   Patches: 
         20100527__issue17407.diff.txt uploaded by tilghman (license 14)
   
  Review: https://reviewboard.asterisk.org/r/751/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@273830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-03 02:36:31 +00:00
Tzafrir Cohen c613897d1c Fix various typos reported by Lintian
(Also fix the typos in the comments)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@273641 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-02 15:57:02 +00:00
David Vossel 243d87038e correct handling of get_destination return values
A failure when calling the get_destination can mean multiple things.  If
the extension is not found, a 404 error is appropriate, but if the URI
scheme is incorrect, a 404 is not approperiate.  This patch adds the
get_destination_result enum to differentiate between these and other failure
types.  The only logical difference in this patch is that we now send a "416
Unsupported URI scheme" response instead of a "404" when the scheme is not
recognized.  This indicates to the initiator of the INVITE to retry the request
with a correct URI. 



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@273427 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-01 16:40:17 +00:00
Tilghman Lesher 62a3133df2 Merged revisions 273060 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r273060 | tilghman | 2010-06-29 18:15:28 -0500 (Tue, 29 Jun 2010) | 10 lines
  
  Allow the "useragent" value to be restored into memory from the realtime backend.
  
  This value is purely informational.  It does not alter configuration at all.
  
  (closes issue #16029)
   Reported by: Guggemand
   Patches: 
         realtime-useragent.patch uploaded by Guggemand (license 897)
   Tested by: Guggemand
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@273078 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-29 23:20:40 +00:00
David Vossel 64ae2e1e2a send a 400 Bad Request on malformed sip request
RFC 2361 section 24.4.1 send a 400 Bad Request if the request
can not be understood due to malformed syntax.  Currently we
simply ignore a packet with a missing callid, to, from, or
via header.  Instead of ignoring we now send the 400 Bad request.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272981 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-29 20:44:05 +00:00
David Vossel 8a07dbf95d rfc compliant sip option parsing + new unit test
RFC 3261 section 8.2.2.3 states that if any unsupported options
are found in the Require header field, a "420 (Bad Extension)"
response should be sent with an Unsupported header field containing
only the unsupported options.

This is not currently being done correctly.  Right now, if Asterisk
detects any unsupported sip options in a Require header the entire
list of options are returned in the Unsupported header even if some
of those options are in fact supported.  This patch fixes that by
building an unsupported options character buffer when parsing the
options that can be sent with the 420 response.  A unit test verifying
this functionality has been created.  Some code refactoring was required.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272880 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-28 18:38:47 +00:00
Mark Michelson dc877759cb Merged revisions 272804 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r272804 | mmichelson | 2010-06-28 12:31:40 -0500 (Mon, 28 Jun 2010) | 5 lines
  
  Decode URI in contact header of 302 response.
  
  ABE-2352
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272805 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-28 17:33:12 +00:00
David Vossel 43871a926b code guidelines cleanup for retrans_pkt() function
I am doing work in this function.  I noticed a large number of
coding guidline fixes that needed to be made.  Rather than have
those changes distract from my functional changes I decided
to separate these into a separate patch.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-28 14:55:25 +00:00
David Vossel aa428b8967 chan_sip: more accurate retransmissions
RFC3261 states that Timer A should start at 500ms (T1) by default.
In chan_sip this value initially started at 1000ms and I changed
it to 500ms recently. After doing that I noticed in my packet
captures that it still occasionally retransmitted starting at
1000ms instead of 500ms like I told it to.  This occurs because
the scheduler runs in the do_monitor thread.  If a new retransmission
is added while the do_monitor thread is sleeping then it may not
detect that retransmission for nearly 1000ms.  To fix this I just
poke the do_monitor thread to wake up when a new packet is sent
reliably requiring retransmits.  The thread then detects the new
scheduler entry and adjusts its sleep time to account for it.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-25 19:39:53 +00:00
Richard Mudgett 30888f913d Merged revisions 272446 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r272446 | rmudgett | 2010-06-24 16:58:49 -0500 (Thu, 24 Jun 2010) | 10 lines
  
  ss_thread calls pri_grab without lock during overlap dial
  
  Recent changes to chan_dahdi with relation to overlap dialing call
  pri_grab without first obtaining a lock.
  
  (closes issue #17414)
  Reported by: pdf
  Patches:
        bug17414.patch uploaded by jpeeler (license 325)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272447 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-24 22:11:26 +00:00
Russell Bryant 450f4ff2ee Resolve some errors produced during module unload of chan_iax2.
The external test suite stops Asterisk using the "core stop gracefully" command.
The logs from the tests show that there are a number of problems with Asterisk
trying to cleanly shut down.  This patch addresses the following type of error
that comes from chan_iax2:

[Jun 22 16:58:11] ERROR[29884]: lock.c:129 __ast_pthread_mutex_destroy:
                chan_iax2.c line 11371 (iax2_process_thread_cleanup):
                Error destroying mutex &thread->lock: Device or resource busy

For an example in the context of a build, see:

http://bamboo.asterisk.org/browse/AST-TRUNK-739/log

The primary purpose of this patch is to change the thread pool shutdown
procedure to be more explicit to ensure that the thread exits from a point
where it is not holding a lock.  While testing that, I encountered various
crashes due to the order of operations in unload_module() being problematic.
I reordered some things there, as well.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272370 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-23 23:09:28 +00:00
Tim Ringenbach c6b7eae5e6 Add new AMI command LocalOptimizeAway.
This command lets you request a "/n" local channel
optimize itself out of the way anyway.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272218 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-23 19:59:43 +00:00
Tilghman Lesher 48ae8ded89 D'oh! Defaultenabled FTL.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272150 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-23 18:45:18 +00:00
Tilghman Lesher cae6fa66ed Load all lines from realtime, not just the first one.
(closes issue #17144)
 Reported by: nahuelgreco
 Patches: 
       20100513__issue17144__trunk.diff.txt uploaded by tilghman (license 14)
 Tested by: tilghman


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272145 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-23 18:25:54 +00:00
Mark Michelson 2c798f321a Add extra protection for reinvite glare scenario.
Testing proved that if Asterisk sent a connected line reinvite, and
the endpoint to which the reinvite were being sent sent a reinvite, Asterisk
would not properly respond with a 491 response.

The reason is that on connected line reinvites, we set the dialog's invitestate
to INV_CALLING to prevent Asterisk from sending a rapid flurry of connected line
reinvites. For other reinvites we do not do this. Because of the current invitestate,
when Asterisk received the reinvite, we interpreted this as a spiraled INVITE, and thus
did not behave properly.

The fix for this is to not enter the loop detection or spiral logic in handle_request_invite
if the channel state is currently up. This way, no mid-call reinvites will be misinterpreted,
no matter what the nature of the reinvite may have been.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272090 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-23 17:08:34 +00:00
Russell Bryant 746d8e6013 Don't try to lock/unlock an uninitialized lock on a dahdi_pri.
This small changes prevents destroy_all_channels() from accessing a lock on an
unused dahdi_pri struct, resolving a ton of ERRORs that get spewed out when
shutting Asterisk down gracefully.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@272052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-22 23:20:37 +00:00
David Vossel 1509737580 ignore CANCEL request after having already received final response to INVITE
RFC 3261 section 9 states that a CANCEL has no effect on a
request to a UAS that has already given a final response.  This
patch checks to make sure there is a pending invite before
allowing a CANCEL request to be processed, otherwise it responds
to the CANCEL with a "481 Call/Transaction Does Not Exist".

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271977 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-22 20:37:05 +00:00
Matthew Nicholson 5f45ca4d50 Merged revisions 271902 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r271902 | mnicholson | 2010-06-22 12:31:57 -0500 (Tue, 22 Jun 2010) | 8 lines
  
  Decrease the module ref count in sip_hangup when SIP_DEFER_BYE_ON_TRANSFER is set.  This is necessary to keep the ref count correct.
  
  (closes issue #16815)
  Reported by: rain
  Patches:
        chan_sip-unref-fix.diff uploaded by rain (license 327) (modified)
  Tested by: rain
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271903 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-22 17:35:17 +00:00
Matthew Nicholson 9bbeb945e8 Merged revisions 271689 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r271689 | mnicholson | 2010-06-22 07:52:27 -0500 (Tue, 22 Jun 2010) | 8 lines
  
  Modify chan_sip's packet generation api to automatically calculate the Content-Length.  This is done by storing packet content in a buffer until it is actually time to send the packet, at which time the size of the packet is calculated.  This change was made to ensure that the Content-Length is always correct.
  
  (closes issue #17326)
  Reported by: kenner
  Tested by: mnicholson, kenner
  
  Review: https://reviewboard.asterisk.org/r/693/
........


This change also adds an ast_str_copy_string() function (similar to ast_copy_string), that copies one ast_str into another, properly handling embedded nulls.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271690 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-22 12:58:28 +00:00
David Vossel 462da0585e fixes crash when From header URI is missing "sip:"
(closes issue #17437)
Reported by: klaus3000
Patches:
      sip_crash uploaded by dvossel (license 671)
Tested by: klaus3000



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271553 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-21 20:46:22 +00:00
David Vossel 846050f698 fixes some coding guideline issue
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271300 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-17 21:23:41 +00:00
David Vossel a1fe641a38 retransmit response to BYE requests until timer J expires
According to RFC 3261 section 17.2.2, which describes non-INVITE server
transaction, when a dialog enters the Completed state it must destroy
the dialog after Timer J (T1*64) fires.  For a BYE transaction Asterisk
terminates the dialog immediately during sip_hangup() when it should be
waiting T1*64 ms.  This results in some odd behavior.  For instance if
Asterisk receives a BYE and transmits a 200ok in response, if the endpoint
never receives the 200ok it will retransmit the BYE to which Asterisk
responds with a "481 Call leg/transaction does not exist" because the
dialog is already gone.

To resolve this I made a function called sip_scheddestroy_final().  This
differs slightly from sip_schedestroy() in that it enables a flag that
will prevent the destruction from ever being rescheduled or canceled
afterwards.  It also prevents the pvt's needdestroy flag from being set
which triggers the destruction of the dialog within the do_monitor thread().
By using this function we are guaranteed destruction will not occur
until the scheduled time.  This allows Asterisk to respond to any possible
retransmits for a dialog after we process the initial BYE request for T1*64 ms.

Other changes: I removed two instances where sip_cancel_destroy is used
right before calling sip_scheddestroy.  sip_scheddestroy always calls
sip_cancel_destroy before scheduling the new destruction so it is completely
unnecessary.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271262 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-17 18:45:32 +00:00
Jeff Peeler 0ef5550742 Change expected operation from error to debug message
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271192 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-17 15:34:08 +00:00
David Vossel 2112418032 addition of more parse_uri test cases
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271056 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-16 22:37:45 +00:00
Jason Parker 01039c0465 Fix the actual place that was pointed out, for previous commit.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270983 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-16 21:12:25 +00:00
Jason Parker 8ef2c3100a Merged revisions 270980 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r270980 | qwell | 2010-06-16 16:10:09 -0500 (Wed, 16 Jun 2010) | 4 lines
  
  Need to lock the agent chan before access its internal bits.
  
  Pointed out by russellb on asterisk-dev mailing list.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270981 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-16 21:10:48 +00:00
David Vossel fcb055fb4e addition of G.719 pass-through support
(closes issue #16293)
Reported by: malcolmd
Patches:
      g719.passthrough.patch.7 uploaded by malcolmd (license 924)
      format_g719.c uploaded by malcolmd (license 924)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270940 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-16 19:03:24 +00:00
David Vossel 1da8159aa6 Merged revisions 270866 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r270866 | dvossel | 2010-06-16 12:35:29 -0500 (Wed, 16 Jun 2010) | 22 lines
  
  fixes chan_iax2 race condition
  
  There is code in chan_iax2.c that attempts to guarantee that only a single
  active thread will handle a call number at a time.  This code works once
  the thread is added to an active_list of threads, but we are not currently
  guaranteed that a newly activated thread will enter the active_list immediately
  because it is left up to the thread to add itself after frames have been
  queued to it.  This means that if two frames come in for the same call number
  at the same time, it is possible for them to grab two separate threads because
  the first thread did not add itself to the active_list fast enough.  This
  causes some pretty complex problems.
  
  This patch resolves this race condition by immediately adding an activated
  thread to the active_list within the network thread and only depending on
  the thread to remove itself once it is done processing the frames queued to
  it.  By doing this we are guaranteed that if another frame for the same call
  number comes in at the same time, that this thread will immediately be found
  in the active_list of threads.
  
  Review: https://reviewboard.asterisk.org/r/720/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270867 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-16 17:36:51 +00:00
Jeff Peeler 00433d60e6 Fix no call waiting caller ID
Clearing the callwaitcas flag in analog_call was causing the incoming D digit
to be ignored which triggers sending the caller ID.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270836 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-16 16:45:07 +00:00
Russell Bryant 3194c061a7 Don't blow up if an ast_channel doesn't get allocated.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270726 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-15 22:48:12 +00:00
Terry Wilson 480f412858 Make contactdeny apply to src ip when nat=yes
chan_sip's "contactdeny" feature screens the "to be registered contact".
In case of nat=yes it should not use the address information from the
Contact header (which is not used at all for routing), but the source
IP address of the request.

Thus, if nat=yes and a client sends a request from a denied IP address
(e.g. by spoofing the src-IP address) it can bypass the screening.

This commit makes contactdeny apply to the src ip when nat=yes instead.

(closes issue #17276)
Reported by: klaus3000
Patches: 
      patch-asterisk-trunk-contactdeny.txt uploaded by klaus3000 (license 65)
Tested by: klaus3000


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-15 20:18:04 +00:00
Richard Mudgett fb5fddd987 Extract sig_ss7_init_linkset() to sig_ss7.
Also found a place where sig_pri_init_pri() was inlined and called it
instead.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270298 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-14 20:51:09 +00:00
Jason Parker a806196f79 Add option to get untruncated channel name from AGENT function.
The "channel" option would chop the channel name at the last '-', which made
it useless for something like a channel transfer from the dialplan.  The
"fullchannel" option will return the channel name as-is.

ABE-2218


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270260 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-14 19:41:43 +00:00
Richard Mudgett 93a5e74e37 Add digit manipulation tag support to chan_dahdi/sig_pri like chan_misdn.
Add the append_msn_to_cid_tag option to chan_dahdi like chan_misdn.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@270219 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-14 15:55:35 +00:00
Russell Bryant 8f92f95530 Attempt to fix a FreeBSD build error by including sys/stat.h.
http://bamboo.asterisk.org/download/AST-TRUNKFREEBSD/build_logs/AST-TRUNKFREEBSD-187.log


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269602 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-10 00:32:31 +00:00
Russell Bryant 403f9df8d0 Merged revisions 269495 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r269495 | russell | 2010-06-09 17:18:37 -0500 (Wed, 09 Jun 2010) | 2 lines
  
  Don't stop Asterisk if chan_oss fails to register 'Console' (due to another channel driver already claiming it).
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-09 22:19:20 +00:00
Richard Mudgett 717570899c Add missing API function to sig_ss7: sig_ss7_fixup().
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269308 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-09 17:06:41 +00:00
Richard Mudgett 6c6260d4c7 Eliminate deadlock potential in dahdi_fixup().
Calling dahdi_indicate() within dahdi_fixup() while the owner pointers are
in a potentially inconsistent state is a potentially bad thing in
principle.

However, calling dahdi_indicate() when the channel private lock is already
held can cause a deadlock if the PRI lock is needed because
dahdi_indicate() will also get the channel private lock.  The pri_grab()
function assumes that the channel private lock is held once to avoid
deadlock.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-09 16:54:38 +00:00
Tzafrir Cohen 6d627b8c38 dial by name in chan_dahdi
* chan_dahdi supports dialing configuring and dialing by device file name.
  DAHDI/span-name!local!1 will use /dev/dahdi/span-name/local/1 . Likewise
  it may appear in chan_dahdi.conf as 'channel => span-name!local!1'.
* A new options for chan_dahdi.conf: 'ignore_failed_channels'. Boolean.
  False by default. If set, chan_dahdi will ignore failed 'channel' entries.
  Handy for the above name-based syntax as it does not depend on
  initialization order.
* have my_pri_make_cc_dialstring() only manupulate dial-strings of group
  (gGrR) dialing, which make it lsightly more complicated.

https://reviewboard.asterisk.org/r/535/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269238 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-09 13:17:43 +00:00
Leif Madsen c672763af8 Fix some doxygen warnings.
(closes issue #17336)
Reported by: snuffy
Patches:
      doxygen-fixes1.diff uploaded by snuffy (license 35)
Tested by: russell

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268969 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-08 14:38:18 +00:00
Terry Wilson 857814f435 Add SRTP support for Asterisk
After 5 years in mantis and over a year on reviewboard, SRTP support is finally
being comitted. This includes generic CHANNEL dialplan functions that work for
getting the status of whether a call has secure media or signaling as defined
by the underlying channel technology and for setting whether or not a new
channel being bridged to a calling channel should have secure signaling or
media. See doc/tex/secure-calls.tex for examples.

Original patch by mikma, updated for trunk and revised by me.

(closes issue #5413)
Reported by: mikma
Tested by: twilson, notthematrix, hemanshurpatel

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268894 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-08 05:29:08 +00:00
Richard Mudgett ebbf166c2d Make SIP tests compile again.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268857 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-08 00:45:13 +00:00
Tilghman Lesher bfdb973191 Use the mailbox destructor function, instead.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-07 22:56:53 +00:00
Tilghman Lesher 8b790e4f06 Mailbox list would previously grow at each reload, containing duplicates.
Also, optimize the allocation of mailboxes to avoid additional memory structures.

(closes issue #16320)
 Reported by: Marquis
 Patches: 
       20100525__issue16320.diff.txt uploaded by tilghman (license 14)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268817 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-07 22:47:13 +00:00
Richard Mudgett 0122ccd29c Extract sig_ss7 out of chan_dahdi.
Extract the SS7 specific code out of chan_dahdi like what was done to
ISDN/PRI and analog signaling.  The new SS7 structures were modeled on
sig_pri.

The changes to sig_pri are an enhancement and a bug fix made possible
because SS7 was extracted.

1) The sig_pri TRANSFERCAPABILITY channel variable should have been set
unconditionally in sig_pri_new_ast_channel().

2) SS7/PRI transfer capability interaction in dahdi_new() fixed because of
SS7 extraction.

3) Module ref count error in dahdi_new() if startpbx failed to start the
PBX for some reason.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268774 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-07 20:04:42 +00:00
Tilghman Lesher 17bd11b8aa Seems strange (and the code backs up) that if the max and min of a statistic is expressed as a double, the last value would not also need to be a double.
(closes issue #15807)
 Reported by: klaus3000


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268773 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-07 19:52:39 +00:00
Richard Mudgett 0c5bce53ad Moved AOC request code out of the middle of code parsing the dialed number.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268734 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-07 19:06:55 +00:00
Tilghman Lesher 7d18dd5394 Finally track down and eliminate the "FRACK! warnings from chan_iax2".
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268495 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-06 00:37:30 +00:00
David Vossel e32d9a1303 fixes compile error from uninitialized variable
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268281 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-04 22:37:13 +00:00
David Vossel 19d1cd04ba RFC3261 compliant sip unreliable retransmit timing + 'registerattempts' option tweak
Changes.
1. RFC 3261 states in section 17.1.2.2 and 17.1.1.2 that retransmission
timers should initially be set to timer T1.   T1 by default is 500ms.
Asterisk was starting the retransmission timers at T1*2 which shouldn't
cause any problems, but is not RFC compliant.

2. RFC 3261 states in section 17.1.2.2 that for a non-INVITE client transaction,
if the retransmit timer fires while in the proceeding state that
the request must be retransmitted.  Asterisk currently ack's
requests for both INVITE and non-INVITE transactions when a
1XX response is received, this patch changes this for non-INVITE requests.

3. The 'registerattempts' option in sip.conf is supposed to set
how many registry attempts will be made before giving up.  When
this option is set to 1, I would expect only one registry attempt
to be made before stopping because of a failure, but instead two are
made.  In my opinion this is not expected behavior.  This option does
not indicate that these are re-attempts.  The logic behind this option
has been changed to only attempt registers the exact number of times
this option is set to.  If this option is 0, it still continues to
re-attempt the registration forever.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@268205 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-04 21:55:14 +00:00
Richard Mudgett 10e2c47c75 Incoming overlap dialing no longer works after sig_pri extraction.
The problem would manifest itself if your dialplan matching could accept
more digits to match than were actually dialed.  The time out waiting for
overlap digits disconnected the call instead of matching any accumulated
digits to the dialplan.

Accidental conversion of a break out of loop as a break out of switch.

(closes issue #17401)
Reported by: avalentin
Patches:
      issue17401_digit_timeout.patch uploaded by rmudgett (license 664)
Tested by: avalentin, rmudgett


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267928 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-04 14:45:03 +00:00
Terry Wilson f06302755a Send an ACK for every final response received for an INVITE
From issue ABE-2247. RFC 3261 compliance for sections 13.2.24 and 17.1.1.2.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267863 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-04 03:11:31 +00:00
Russell Bryant 64e2c86426 Don't stop Asterisk if chan_usbradio isn't configured.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267537 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-03 17:31:41 +00:00
Russell Bryant d1aacea4e3 Remove a line that was killing Asterisk on startup.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267490 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-03 17:05:30 +00:00
Russell Bryant 63d10a1b1c Comment out a rule that likes to run implicitly unnecessarily, breaking builds
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267445 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-03 14:48:09 +00:00
Richard Mudgett 1c67f208a7 Add ETSI Message Waiting Indication (MWI) support.
Add the ability to report waiting messages to ISDN endpoints (phones).

Relevant specification: EN 300 650 and EN 300 745

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267399 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-03 00:02:14 +00:00
Russell Bryant bb4c55c347 try to fix some random chan_h323 compilation failures
After some debugging, the random chan_h323 build failures appear to be due
to complications introduced by some chan_h323 specific build stuff getting
triggered during a clean.  Simplify this by moving the h323 clean commands
down into channels/makefile.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267352 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 22:46:37 +00:00
Richard Mudgett 0760f4e70a Add ETSI Malicious Call ID support.
Add the ability to report malicious callers as an AMI event in the call
event class.

Relevant specification: EN 300 180

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 22:28:58 +00:00
Richard Mudgett afcbc93dae Add ETSI Call Waiting support.
Add the ability to announce a call to an endpoint when there are no B
channels available.  A call waiting call is a SETUP message with no B
channel selected.

Relevant specification: EN 300 056, EN 300 057, EN 300 058

For DAHDI/ISDN channels, the CHANNEL() dialplan function now supports the
"no_media_path" option.
* Returns "0" if there is a B channel associated with the call.
* Returns "1" if no B channel is associated with the call.  The call is
either on hold or is a call waiting call.

If you are going to allow incoming call waiting calls then you need to use
CHANNEL(no_media_path) do determine if you must drop a call to accept the
new call.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267261 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 21:05:32 +00:00
Mark Michelson b8d39db94d Prevent use of uninitialized values.
Two struct sockaddr_ins are created when applying directmedia
host access rules. The addresses of these are passed to the RTP
engine to be filled in. However, the RTP engine inspects the fields
of the structs before actually taking action. This inspection caused
valgrind to be a bit unhappy.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267097 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 18:13:18 +00:00
Richard Mudgett afd4454c44 Generic Advice of Charge.
Asterisk Generic AOC Representation
- Generic AOC encode/decode routines.
  (Generic AOC must be encoded to be passed on the wire in the AST_CONTROL_AOC frame)
- AST_CONTROL_AOC frame type to represent generic encoded AOC data
- Manager events for AOC-S, AOC-D, and AOC-E messages

Asterisk App Support
- app_dial AOC-S pass-through support on call setup
- app_queue AOC-S pass-through support on call setup

AOC Unit Tests
- AOC Unit Tests for encode/decode routines
- AOC Unit Test for manager event representation.

SIP AOC Support
- Pass-through of generic AOC-D and AOC-E messages to snom phones via the
  snom AOC specification.
- Creation of chan_sip page3 flags for the addition of the new
  'snom_aoc_enabled' sip.conf option.

IAX AOC Support
- Natively supports AOC pass-through through the use of the new
  AST_CONTROL_AOC frame type

DAHDI AOC Support
- ETSI PRI full AOC Pass-through support
- 'aoc_enable' chan_dahdi.conf option for independently enabling
  pass-through of AOC-S, AOC-D, AOC-E.
- 'aoce_delayhangup' option for retrieving AOC-E on disconnect.
- DAHDI A() dial string option for requesting AOC services.
  example usage:
  ;requests AOC-S, AOC-D, and AOC-E on call setup
  exten=>1111,1,Dial(DAHDI/g1/1112/A(s,d,e))

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267096 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 18:10:15 +00:00
Richard Mudgett 28264c52b9 Add ETSI Advice Of Charge (AOC) event reporting.
This feature generates AMI events in the new aoc event class from the
events passed up by libpri.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@267008 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 17:13:53 +00:00
Richard Mudgett 48dd4d1249 Add ETSI Explicit Call Transfer (ECT) support.
Added ability to send and receive ETSI Explicit Call Transfer (ECT)
messages to eliminate tromboned calls.

Note: Asterisk already supported initiating the transfer of calls to
eliminate tromboned calls to libpri so there was nothing to do for the
asterisk portion.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266926 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-02 16:14:12 +00:00
David Vossel 185f73d8b1 fixes crash when creation of UDPTL fails
(closes issue #17264)
Reported by: falves11
Patches:
      issue_17264_reviewboard_fix.diff uploaded by dvossel (license 671)
      issue_17264_1.6.2_reviewboard_fix.diff uploaded by dvossel (license 671)
Tested by: falves11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266292 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-28 17:55:38 +00:00
David Vossel 77a96c5a93 do all sip registry parsing before transmit_register
This patch breaks up every part of the sip registry string during
config parsing and removes all parsing from transmit_register().
Thanks to Nick_Lewis for contributing this patch!

(closes issue #14331)
Reported by: Nick_Lewis
Patches:
      chan_sip.c-domparse.patch uploaded by Nick Lewis (license 657)
      chan_sip.c.patch uploaded by Nick Lewis (license 657)
      chan_sip.c.domainparse3.patch uploaded by Nick Lewis (license 657)
      chan_sip.c-domparse4.patch uploaded by Nick Lewis (license 657)
      chan_sip.c-domparse5.patch uploaded by Nick Lewis (license 657)
      nicklewispatch.diff uploaded by dvossel (license 671)
Tested by: Nick_Lewis, dvossel

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266090 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-26 19:46:49 +00:00
David Vossel 07500098c1 fixes failed SIP Directed pickup resulting in dead channel
(closes issue #17339)
Reported by: one47
Patches:
      sip_magic_pickup2 uploaded by one47 (license 23)
Tested by: one47, dvossel


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266006 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-26 18:32:51 +00:00
Mark Michelson 822423adb8 .......
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@265844 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-26 14:45:47 +00:00
Mark Michelson 83ca84d9bd Re-enable "always" option for videosupport option in sip.conf.
(closes issue #17016)
Reported by: twilson
Patches:
      17016.patch uploaded by mmichelson (license 60)
	  Tested by: devmod



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@265842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-26 14:41:55 +00:00
Mark Michelson 01db62bdbe Properly use peer's outboundproxy for outbound REGISTERs.
The logic used in transmit_register to get the outboundproxy for a peer
was flawed since this value would be overridden shortly afterwards when
create_addr was called.

In addition, this also fixes some logic used when parsing users.conf so
that the peer name is placed in the internally-generated register string
so that an outboundproxy set in the Asterisk GUI will be used for outbound
REGISTERs.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@265698 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-25 20:59:04 +00:00
Mark Michelson c5be9d2247 Print openh323 log to the Asterisk console.
(closes issue #17109)
Reported by: under
Patches:
      logstream.diff uploaded by under (license 914)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@265451 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-24 22:05:15 +00:00
Mark Michelson f908dd984c Allow type=user SIP endpoints to be loaded properly from realtime.
(closes issue #16021)
Reported by: Guggemand
Patches:
      realtime-type-fix.patch uploaded by Guggemand (license 897)
	  (altered by me slightly to avoid ref leaks)
Tested by: Guggemand




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@265449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-24 21:44:30 +00:00
David Vossel 94de6f3cb8 reverses incorrect logic introduced by r243200
The decoding of the replace_id did not need to be broken
up in this instance.  This was brought to my attention
again because it caused a segfault when the from or to
tags were not present in the "Replaces" header.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@265366 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-24 19:42:54 +00:00
Mark Michelson ee60cb8d41 Be sure to set the sin_family on the proxy when allocating.
(closes issue #17157)
Reported by: stuarth




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@265087 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-21 20:38:14 +00:00
Terry Wilson fe9c315171 Take dup'd code for directmedia ACLs and make utility func
The same code was repeated in lots of different places, so I made a utility
fuction for it. This should make the merge in the v6-new branch easier.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264905 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-21 01:00:44 +00:00
Terry Wilson c7303d840e Add support for direct media ACLs
directmediapermit/directmediadeny support to restrict which peers can do
directmedia based on ip address. In some networks not all phones are fully
routed, i.e. not all phones can ping each other. This patch adds a way to
restrict directmedia for certain peers between certain networks.

(closes issue #16645)
Reported by: raarts
Patches: 
      directmediapermit.patch uploaded by raarts (license 937)
Tested by: raarts

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264626 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-20 17:54:02 +00:00
Mark Michelson 6bb45831eb Fix transcode_via_sln option with SIP calls and improve PLC usage.
From reviewboard:
The problem here is a bit complex, so try to bear with me...

It was noticed by a Digium customer that generic PLC (as configured in
codecs.conf) did not appear to actually be having any sort of benefit when
packet loss was introduced on an RTP stream. I reproduced this issue myself
by streaming a file across an RTP stream and dropping approx. 5% of the
RTP packets. I saw no real difference between when PLC was enabled or disabled
when using wireshark to analyze the RTP streams.

After analyzing what was going on, it became clear that one of the problems
faced was that when running my tests, the translation paths were being set
up in such a way that PLC could not possibly work as expected. To illustrate,
if packets are lost on channel A's read stream, then we expect that PLC will
be applied to channel B's write stream. The problem is that generic PLC can
only be done when there is a translation path that moves from some codec to
SLINEAR. When I would run my tests, I found that every single time, read
and write translation paths would be set up on channel A instead of channel
B. There appeared to be no real way to predict which channel the translation
paths would be set up on.

This is where Kevin swooped in to let me know about the transcode_via_sln
option in asterisk.conf. It is supposed to work by placing a read translation
path on both channels from the channel's rawreadformat to SLINEAR. It also
will place a write translation path on both channels from SLINEAR to the
channel's rawwriteformat. Using this option allows one to predictably set up
translation paths on all channels. There are two problems with this, though.
First and foremost, the transcode_via_sln option did not appear to be working
properly when I was placing a SIP call between two endpoints which did not
share any common formats. Second, even if this option were to work, for PLC
to be applied, there had to be a write translation path that would go from
some format to SLINEAR. It would not work properly if the starting format
of translation was SLINEAR.

The one-line change presented in this review request in chan_sip.c fixed the
first issue for me. The problem was that in sip_request_call, the
jointcapability of the outbound channel was being set to the format passed to
sip_request_call. This is nativeformats of the inbound channel. Because of this,
when ast_channel_make_compatible was called by app_dial, both channels already
had compatibly read and write formats. Thus, no translation path was set up at
the time. My change is to set the jointcapability of the sip_pvt created during
sip_request_call to the intersection of the inbound channel's nativeformats and
the configured peer capability that we determined during the earlier call to
create_addr. Doing this got the translation paths set up as expected when using
transcode_via_sln.

The changes presented in channel.c fixed the second issue for me. First and
foremost, when Asterisk is started, we'll read codecs.conf to see the value of
the genericplc option. If this option is set, and ast_write is called for a
frame with no data, then we will attempt to fill in the missing samples for
the frame. The implementation uses a channel datastore for maintaining the
PLC state and for creating a buffer to store PLC samples in. Even when we
receive a frame with data, we'll call plc_rx so that the PLC state will have
knowledge of the previous voice frame, which it can use as a basis for when
it comes time to actually do a PLC fill-in.

So, reviewers, now I ask for your help. First off, there's the one line change
in chan_sip that I have put in. Is it right? By my logic it seems correct, but
I'm sure someone can tell me why it is not going to work. This is probably the
change I'm least concerned about, though. What concerns me much more is the
set of changes in channel.c. First off, am I even doing it right? When I run
tests, I can clearly see that when PLC is activated, I see a significant increase
in RTP traffic where I would expect it to be. However, in my humble opinion, the
audio sounds kind of crappy whenever the PLC fill-in is done. It sounds worse to
me than when no PLC is used at all. I need someone to review the logic I have used
to be sure that I'm not misusing anything. As far as I can see my pointer arithmetic
is correct, and my use of AST_FRIENDLY_OFFSET should be correct as well, but I'm
sure someone can point out somewhere where I've done something incorrectly.

As I was writing this review request up, I decided to give the code a test run under
valgrind, and I find that for some reason, calls to plc_rx are causing some invalid
reads. Apparently I'm reading past the end of a buffer somehow. I'll have to dig around
a bit to see why that is the case. If it's obvious to someone reviewing, speak up!

Finally, I have one other proposal that is not reflected in my code review. Since
without transcode_via_sln set, one cannot predict or control where a translation
path will be up, it seems to me that the current practice of using PLC only when
transcoding to SLINEAR is not useful. I recommend that once it has been determined
that the method used in this code review is correct and works as expected, then
the code in translate.c that invokes PLC should be removed.

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264452 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-19 21:29:08 +00:00
David Vossel 0407208b6d fixes crash in check_rtp_timeout
During deadlock avoidance the sip dialog pvt is locked and
unlocked.  When this occurs we have no guarantee the pvt's owner
is still valid.  We were trying to access the pvt's owner after
this without checking to see if it still existed first. 

(closes issue #17271)
Reported by: under
Patches:
      check_rtp_timeout.diff uploaded by under (license 914)
Tested by: dvossel


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264331 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-19 19:21:04 +00:00
Mark Michelson 7814913d86 Be sure to heap-allocate the redirecting to tag so as not to cause crashiness.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263860 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-18 21:09:41 +00:00
Mark Michelson 2b2439dede Fix memory leaks in redirecting structures in chan_sip.c
Thanks to Richard for pointing this out.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263810 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-18 20:09:24 +00:00
Mark Michelson b5d5cc565f Enhancements to connected line and redirecting work.
From reviewboard:

Digium has a commercial customer who has made extensive use of the connected party and
redirecting information present in later versions of Asterisk Business Edition and which
is to be in the upcoming 1.8 release. Through their use of the feature, new problems and solutions
have come about. This patch adds several enhancements to maximize usage of the connected party
and redirecting information functionality.

First, Asterisk trunk already had connected line interception macros. These macros allow you to
manipulate connected line information before it was sent out to its target. This patch adds the
same feature except for redirecting information instead.

Second, the ast_callerid and ast_party_id structures have been enhanced to provide a "tag." This
tag can be set with func_callerid, func_connectedline, func_redirecting, and in the case of DAHDI,
mISDN, and SIP channels, can be set in a configuration file. The idea behind the callerid tag is
that it can be set to whatever value the administrator likes. Later, when running connected line
and redirecting macros, the admin can read the tag off the appropriate structure to determine what
action to take. You can think of this sort of like a channel variable, except that instead of having
the variable associated with a channel, the variable is associated with a specific identity within
Asterisk.

Third, app_dial has two new options, s and u. The s option lets a dialplan writer force a specific
caller ID tag to be placed on the outgoing channel. The u option allows the dialplan writer to force
a specific calling presentation value on the outgoing channel.

Fourth, there is a new control frame subclass called AST_CONTROL_READ_ACTION added. This was added
to correct a very specific situation. In the case of SIP semi-attended (blond) transfers, the party
being transferred would not have the opportunity to run a connected line interception macro to
possibly alter the transfer target's connected line information. The issue here was that during a
blond transfer, the SIP transfer code has no bridged channel on which to queue the connected line
update. The way this was corrected was to add this new control frame subclass. Now, we queue an
AST_CONTROL_READ_ACTION frame on the channel on which the connected line interception macro should
be run. When ast_read is called to read the frame, ast_read responds by calling a callback function
associated with the specific read action the control frame describes. In this case, the action taken
is to run the connected line interception macro on the transferee's channel.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-17 15:36:31 +00:00
David Vossel cddc244c97 fix iax_frame double free
Very unfortunate things happen if we add an iax_frame
to the frame queue and let go of the lock before scheduling
the frame's transmit... There is a race condition that
exists where the frame can be removed from the frame_queue
and freed before the transmit is scheduled if we do not
hold on to that lock.  This results in a freed frame
being scheduled for transmit later.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263151 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-14 18:53:55 +00:00
Richard Mudgett 274eb8960c Fix inverted logic in cli command: ss7 set debug on/off
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@263069 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-13 22:01:36 +00:00
Russell Bryant c26cd3aaac Fix an off by one error that causes a crash.
Thanks to Raymond Burke for pointing it out.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@262897 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-13 15:36:12 +00:00
Richard Mudgett 093dbfdd52 Don't crash when destroying chan_dahdi pseudo channels.
Must do a deep copy of the cc_params in duplicate_pseudo().  Otherwise,
when the duplicate pseudo channel is destroyed, it frees the original
pseudo channel cc_params.  The original pseudo channel is then left with a
dangling pointer for when the next duplicated pseudo channel is created.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@262743 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-12 17:57:31 +00:00
Richard Mudgett e2336b73ef Merged revisions 262657,262660 from
https://origsvn.digium.com/svn/asterisk/be/branches/C.3-bier

..........
  r262660 | rmudgett | 2010-05-12 11:46:47 -0500 (Wed, 12 May 2010) | 4 lines

  Forgot some conditionals around the callrerouting facility help text.

  JIRA ABE-2223
..........
  r262657 | rmudgett | 2010-05-12 11:26:49 -0500 (Wed, 12 May 2010) | 22 lines

  Add mISDN Call rerouting facility for point-to-point ISDN lines (exchange line)

  In the case of ISDN point-to-multipoint (multidevice) you can use the
  mISDN "facility calldeflect" application for call diversions from external
  (PSTN) to external (PSTN).  In that case this is the only way to get rid
  of the two call legs to the PBX and let the calling number at the C party
  become the number of the A party.  In the case of ISDN point-to-point
  (exchange line) the call deflection facility may not be used.  Instead a
  call rerouting facility has to be used.

  This patch for chan_misdn.c is an extension to realize this service
  (facility rerouting application).  It can accept either spelling:
  "callrerouting" or "callrerouteing".

  The patch is tested towards Deutsche Telekom and requires a modified
  version of mISDN from Digium, Inc.

  Patches:
        misdn_rerouteing_corrected.patch (Slightly modified.)

  JIRA ABE-2223


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@262661 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-12 16:51:03 +00:00
Paul Belanger 4b1d9f85a7 Convert to AST_CLI_YESNO and AST_CLI_ONOFF
Clean up chan_sip.c to use new AST_CLI functions

(closes issue #17287)
Reported by: pabelanger
Patches:
      issue17287.patch uploaded by pabelanger (license 224)
Tested by: russell


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@262613 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-12 01:00:55 +00:00
Richard Mudgett 9534f72cb0 Dialing an invalid extension causes incomplete hangup sequence.
Revision -r1489 of the libpri 1.4 branch corrected a deviation from Q.931
Section 5.3.2.  However, this resulted in an unexpected behaviour change
to the upper layer (Asterisk).

This change uses pri_hangup_fix_enable() to follow Q.931 Section 5.3.2
call hangup better if the version of libpri supports it.

(issue #17104)
Reported by: shawkris
Tested by: rmudgett


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@262569 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-11 23:18:53 +00:00
Paul Belanger 9c012b460f Improve logging information for misconfigured contexts
(closes issue #17238)
Reported by: pprindeville
Patches:
      chan_sip-bug17238.patch uploaded by pprindeville (license 347)
Tested by: pprindeville


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@262414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-11 19:26:17 +00:00
David Vossel 351e0e90c5 fixes crash in chan_console
There is a race condition between console_hangup()
and start_stream().  It is possible for console_hangup()
to be called and then the stream thread to begin after the hangup.
To avoid this a check in start_stream() to make sure the pvt-owner
still exists while the pvt lock is held is made.  If the owner
is gone that means the channel hung up and start_stream should
be aborted.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@262236 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-10 18:36:10 +00:00
Jeff Peeler 356b090875 Fix deadlock in sig_pri when hanging up.
The pri_dchannel thread currently violates locking order by locking the private
and then attempting to queue a frame, which needs to lock the channel. Queueing
a frame is unneccesary though and is actually a regression since sig_pri.
All the places that currently use ast_softhangup_nolock now will just set the
softhangup value directly as before.

(closes issue #17216)
Reported by: lmsteffan
Patches: 
      bug17216.patch uploaded by jpeeler (license 325)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261866 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-07 15:33:52 +00:00
Richard Mudgett 6f03bf4a42 Some code optimizations.
* Made more places use pri_queue_control() instead of pri_queue_frame()
and a local frame variable.

* Made pri_queue_frame() use sig_pri_lock_owner().  pri_queue_frame() no
longer releases the libpri access lock unless it is required.

* Made the pri_queue_frame() and pri_queue_control() parameter list
similar to sig_pri_lock_owner().


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261822 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-06 23:41:22 +00:00
Tilghman Lesher ba9b0d95e6 Permit more lines within a SIP body to be parsed.
The example given within the related issue showed 120 lines, which was mostly
a result of the body being XML.

(closes issue #17179)
 Reported by: khw


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261560 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-06 15:39:10 +00:00
Tzafrir Cohen 6b2e51b1ed When failing to configure, don't destroy 'cfg' twice
Fixes a crash when some config section had an incorrect channel config.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261451 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-06 07:27:31 +00:00
Richard Mudgett f0a7adb309 Avoid a crash on SS7 channels.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261405 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-05 22:22:14 +00:00
David Vossel f16625b7a0 fixes sip native transfer
The Refer-To header field containing the Replaces header in the URI
was not being decoded properly.  This caused invalid parsing between
the caller id field and the domain resulting in a failed transfer.

(closes issue #17284)
Reported by: dvossel



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261316 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-05 19:13:57 +00:00
Paul Belanger 35eeb71ead Merged revisions 261274 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r261274 | pabelanger | 2010-05-05 12:42:22 -0400 (Wed, 05 May 2010) | 12 lines
  
  Registration fix for SIP realtime.
  
  Make sure realtime fields are not empty.
  
  (closes issue #17266)
  Reported by: Nick_Lewis
  Patches:
        chan_sip.c-realtime.patch uploaded by Nick Lewis (license 657)
  Tested by: Nick_Lewis, sberney
  
  Review: https://reviewboard.asterisk.org/r/643/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-05 18:43:03 +00:00
Mark Michelson a6ea125e7c Prevent unnecessary warnings when getting rtpsource or rtpdest.
If a recognized media type was present, but the media type was not
enabled for the channel, then a warning would be emitted. For instance,
attempting to get CHANNEL(rtpsource,video) on a call with no video would
cause a warning message to appear.

With this change, the warning will only appear if the stream argument
is not recognized as being a media type that can be specified.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261313 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-05 18:28:05 +00:00
Richard Mudgett 159f0d4b24 The inalarm flag is not passed up from the sig_analog and sig_pri submodules.
The CLI "dahdi show channel" command was not correctly reporting the
InAlarm status.

The inalarm flag is now consistently passed between chan_dahdi and
submodules.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@261007 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-04 21:10:58 +00:00
Jeff Peeler 6dd80de93d Merged revisions 260434 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r260434 | jpeeler | 2010-04-30 17:22:46 -0500 (Fri, 30 Apr 2010) | 11 lines
  
  Ensure channel state is not incorrectly set in the case of a very early answer.
  
  The needringing bit was being read in dahdi_read after answering thereby
  setting the state to ringing from up. This clears needringing upon answering
  so that is no longer possible.
  
  (closes issue #17067)
  Reported by: tzafrir
  Patches: 
        needringing.diff uploaded by tzafrir (license 46)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@260437 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-30 22:36:49 +00:00
Richard Mudgett 00a1a96ff5 Separate the uses of NUM_DCHANS and MAX_CHANNELS into PRI, SS7, and MFCR2 users.
Created
SIG_PRI_MAX_CHANNELS, SIG_PRI_NUM_DCHANS
SIG_SS7_MAX_CHANNELS, SIG_SS7_NUM_DCHANS
SIG_MFCR2_MAX_CHANNELS

Also fixed the declaration of pollers[] in mfcr2_monitor().  It was
dimensioned to the number of bytes in struct dahdi_mfcr2.pvts[] and not to
the same dimension of the struct dahdi_mfcr2.pvts[].


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@260435 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-30 22:24:28 +00:00
Richard Mudgett a3ce3441bb Merged revisions 260195 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r260195 | rmudgett | 2010-04-29 17:11:47 -0500 (Thu, 29 Apr 2010) | 26 lines
  
  DTMF CallerID detection problems.
  
  The code handling DTMF CallerID drops digits on long CallerID numbers and
  may timeout waiting for the first ring with shorter numbers.
  
  The DTMF emulation mode was not turned off when processing DTMF CallerID.
  When the emulation code gets behind in processing the DTMF digits it can
  skip a digit.
  
  For shorter numbers, the timeout may have been too short.  I increased it
  from 2 seconds to 4 seconds.  Four seconds is a typical time between rings
  for many countries.
  
  (closes issue #16460)
  Reported by: sum
  Patches:
        issue16460.patch uploaded by rmudgett (license 664)
        issue16460_v1.6.2.patch uploaded by rmudgett (license 664)
  Tested by: sum, rmudgett
  
  Review: https://reviewboard.asterisk.org/r/634/
  
  JIRA SWP-562
  JIRA AST-334
  JIRA SWP-901
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@260231 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-29 22:44:14 +00:00
Mark Michelson 9e1b6c7236 Don't override peer context with domain context.
(closes issue #17040)
Reported by: pprindeville
Patches:
      asterisk-1.6-bugid17040.patch uploaded by pprindeville (license 347)
Tested by: pprindeville

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@259957 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-28 22:34:15 +00:00
David Vossel 6722251986 Merged revisions 259858 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r259858 | dvossel | 2010-04-28 16:16:03 -0500 (Wed, 28 Apr 2010) | 33 lines
  
  resolves deadlocks in chan_local
  
  Issue_1.
  In the local_hangup() 3 locks must be held at the same time... pvt, pvt->chan,
  and pvt->owner.  Proper deadlock avoidance is done when the channel to hangup
  is the outbound chan_local channel, but when it is not the outbound channel we
  have an issue... We attempt to do deadlock avoidance only on the tech pvt, when
  both the tech pvt and the pvt->owner are locked coming into that loop.  By
  never giving up the pvt->owner channel deadlock avoidance is not entirely possible.
  This patch resolves that by doing deadlock avoidance on both the pvt->owner and the pvt
  when trying to get the pvt->chan lock.
  
  Issue_2.
  ast_prod() is used in ast_activate_generator() to queue a frame on the channel
  and make the channel's read function get called.  This function is used in
  ast_activate_generator() while the channel is locked, which mean's the channel
  will have a lock both from the generator code and the frame_queue code by the
  time it gets to chan_local.c's local_queue_frame code... local_queue_frame
  contains some of the same crazy deadlock avoidance that local_hangup requires,
  and this recursive lock prevents that deadlock avoidance from happening correctly.
  This patch removes ast_prod() from the channel lock so only one lock is held during
  the local_queue_frame function.
  
  (closes issue #17185)
  Reported by: schmoozecom
  Patches:
        issue_17185_v1.diff uploaded by dvossel (license 671)
        issue_17185_v2.diff uploaded by dvossel (license 671)
  Tested by: schmoozecom, GameGamer43
  
  Review: https://reviewboard.asterisk.org/r/631/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@259870 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-28 21:20:03 +00:00
Jason Parker 0da0e3856c Be more explicit about field naming in a test.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@259587 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-27 22:28:16 +00:00
Richard Mudgett 4e3269c60d Merged revisions 259531 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r259531 | rmudgett | 2010-04-27 16:53:07 -0500 (Tue, 27 Apr 2010) | 11 lines
  
  DAHDI "WARNING" message is confusing and vague
  
  "WARNING[28406]: chan_dahdi.c:6873 ss_thread: CallerID feed failed: Success"
  
  Changed the warning to "Failed to decode CallerID on channel 'name'".  The
  message before it is likely more specific about why the CallerID decode
  failed.
  
  SWP-501
  AST-283
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@259538 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-27 22:18:09 +00:00
Richard Mudgett 3e04d6fe8e Merged revisions 259270 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r259270 | rmudgett | 2010-04-27 13:14:54 -0500 (Tue, 27 Apr 2010) | 14 lines
  
  hidecalleridname parameter in chan_dahdi.conf
  
  Issue #7321 implements a new chan_dahdi configuration option.  However, a
  change mentioned in the issue was never implemented.  This is the change
  that will allow the feature to work.
  
  I added a note to chan_dahdi.conf.sample about the feature.
  
  (closes issue #17143)
  Reported by: djensen99
  Patches:
        diff.txt uploaded by djensen99 (license NA) (One line change)
  Tested by: djensen99
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@259307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-27 18:29:33 +00:00
Richard Mudgett 3bda444f1e Re-fix dahdi_request() iflist locking since CCSS merged.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@259229 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-27 16:52:29 +00:00
Leif Madsen 1b62cf14e4 Small error in the T.140 RTP port verbose log.
(closes issue #16988)
Reported by: frawd
Patches: 
      chan_sip_sdp_verbose_fix.diff uploaded by frawd (license 610)
Tested by: russell

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@258934 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-26 15:59:34 +00:00
Leif Madsen bb2fa21ac1 IAXpeers output now matches SIPpeers format for manager (AMI).
(closes issue #17100)
Reported by: secesh
Tested by: pabelanger

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@258344 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-21 19:02:45 +00:00
David Vossel f2b8561a5a fixes issue with double "sip:" in header field
This is a clear mistake in logic.  Future discussions
about how to avoid having to handle uri's like this
should take place in the future, but this fix needs
to go in for now.

(closes issue #15847)
Reported by: ebroad
Patches:
      doublesip.patch uploaded by ebroad (license 878)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@258305 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-21 18:13:36 +00:00
Mark Michelson ba81ee6d28 Make sure to fail a monitor if we receive a negative response for a CC SUBSCRIBE.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@257646 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-16 19:50:43 +00:00
Dwayne M. Hubbard afedb856ae Enable PRI SERVICE message support in chan_dahdi for the 'national' switchtype
Revision 1072 of libpri added SERVICE message support for the 'national' 
switchtype. The attached patch enables the use of 'pri service' CLI commands 
on dahdi channels that are configured for the 'national' switchtype.

(closes issue #17142)
Reported by: dhubbard
Patches:
      dw-ni2.patch uploaded by dhubbard (license 733)
Tested by: elguero, dhubbard

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@257642 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-16 19:25:30 +00:00
Tilghman Lesher 84d0b95def Merged revisions 257467 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r257467 | tilghman | 2010-04-15 15:24:50 -0500 (Thu, 15 Apr 2010) | 13 lines
  
  Don't recreate peer, when responding to a repeated deregistration attempt.
  
  When a reply to a deregistration is lost in transmit, the client retries the
  deregistration.  Previously, this would cause a realtime/autocreate peer to be
  loaded back into memory, after it had already been correctly purged.  Instead,
  we just want to resend the reply without loading the peer.
  
  (closes issue #16908)
   Reported by: kkm
   Patches: 
         20100412__issue16908.diff.txt uploaded by tilghman (license 14)
   Tested by: kkm
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@257493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-15 20:30:15 +00:00
Tilghman Lesher e148ffc00f Also unref the pvt when we delete the provisional keepalive job.
(closes issue #16774)
 Reported by: kowalma
 Patches: 
       20100315__issue16774.diff.txt uploaded by tilghman (license 14)
 Tested by: falves11, jamicque

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@257191 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-13 19:17:48 +00:00
David Vossel bd53cbabcf gives channel reference before unlocking it and using setvar helper.
To guarantee the channel is valid when calling setvar on the MASTER_CHANNEL
dialplan function, a channel reference must be taken before unlocking. Thanks
to russell for pointing out the error.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256823 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-12 14:47:16 +00:00
Mark Michelson 9afa6af881 Remove status_response callbacks where they are not needed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256661 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-09 22:20:22 +00:00
Mark Michelson 7509949658 Prevent crash when originating a call to a local channel.
Call completion code tries to grab the call completion parameters
from the requesting channel during local_request. When originating
a call to a local channel, however, this channel is NULL. This
was causing an issue for me when trying to run a test script.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256646 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-09 21:41:30 +00:00
Richard Mudgett 537edff10f Remove PRI CCSS BUGBUG message and update configure script.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256569 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-09 16:43:30 +00:00
Mark Michelson 4b8f1c8cac Add routines for parsing SIP URIs consistently.
From the original issue report opened by Nick Lewis:
Many sip headers in many sip methods contain the ABNF structure
 name-andor-addr = name-addr / addr-spec
 Examples include the to-header, from-header, contact-header, replyto-header

 At the moment chan_sip.c makes various different attempts to parse this name-andor-addr structure for each header type and for each sip method with sometimes limited degrees of success.

 I recommend that this name-andor-addr structure be parsed by a dedicated function and that it be used irrespective of the specific method or header that contains the name-andor-addr structure

Nick has also included unit tests for verifying these routines as well, so...heck yeah.

(closes issue #16708)
Reported by: Nick_Lewis
Patches:
      reqresp_parser-nameandoraddr2.patch uploaded by Nick Lewis (license 657

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



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256530 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-09 16:04:16 +00:00
Mark Michelson ae7b76a1b9 Fix some compiler errors that popped up after the CCSS merge.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-09 15:56:55 +00:00
Mark Michelson e24661fd18 Merge Call completion support into trunk.
From Reviewboard:
CCSS stands for Call Completion Supplementary Services. An admittedly out-of-date
overview of the architecture can be found in the file doc/CCSS_architecture.pdf
in the CCSS branch. Off the top of my head, the big differences between what is
implemented and what is in the document are as follows:

1. We did not end up modifying the Hangup application at all.
2. The document states that a single call completion monitor may be used across
   multiple calls to the same device. This proved to not be such a good idea
   when implementing protocol-specific monitors, and so we ended up using one
   monitor per-device per-call.
3. There are some configuration options which were conceived after the document
   was written. These are documented in the ccss.conf.sample that is on this
   review request.
		      
For some basic understanding of terminology used throughout this code, see the
ccss.tex document that is on this review.

This implements CCBS and CCNR in several flavors.

First up is a "generic" implementation, which can work over any channel technology
provided that the channel technology can accurately report device state. Call
completion is requested using the dialplan application CallCompletionRequest and can
be canceled using CallCompletionCancel. Device state subscriptions are used in order
to monitor the state of called parties.

Next, there is a SIP-specific implementation of call completion. This method uses the
methods outlined in draft-ietf-bliss-call-completion-06 to implement call completion
using SIP signaling. There are a few things to note here:

* The agent/monitor terminology used throughout Asterisk sometimes is the reverse of
  what is defined in the referenced draft.

* Implementation of the draft required support for SIP PUBLISH. I attempted to write
  this in a generic-enough fashion such that if someone were to want to write PUBLISH
  support for other event packages, such as dialog-state or presence, most of the effort
  would be in writing callbacks specific to the event package.

* A subportion of supporting PUBLISH reception was that we had to implement a PIDF
  parser. The PIDF support added is a bit minimal. I first wrote a validation
  routine to ensure that the PIDF document is formatted properly. The rest of the
  PIDF reading is done in-line in the call-completion-specific PUBLISH-handling
  code. In other words, while there is PIDF support here, it is not in any state
  where it could easily be applied to other event packages as is.

Finally, there are a variety of ISDN-related call completion protocols supported. These
were written by Richard Mudgett, and as such I can't really say much about their
implementation. There are notes in the CHANGES file that indicate the ISDN protocols
over which call completion is supported.

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256528 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-09 15:31:32 +00:00
Mark Michelson 6cad0f1602 func_srv and explicit specification of a remote IP for SIP.
From Review Board:
There are two interrelated changes here.

First, there is the introduction of func_srv. This adds two new read-only
dialplan functions, SRVQUERY and SRVRESULT. They work very similarly to the
ENUMQUERY and ENUMRESULT functions, except that this allows one to query SRV
records instead. In order to facilitate this work, I added a couple of new API
calls to srv.h. ast_srv_get_record_count tells the number of records returned
by an SRV lookup. This number is calculated at the time of the SRV lookup.
ast_srv_get_nth_record allows one to get a numbered SRV record.

Second, there is the modification to chan_sip that allows one to specify a
hostname or IP address (along with a port) to send an outgoing INVITE to when
dialing a SIP peer. This goes hand-in-hand with func_srv. You can query SRV
records and then use the host and port from the results to dial via a specific
host instead of what is configured in sip.conf.

Review: https://reviewboard.asterisk.org/r/608
SWP-1200



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256485 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-09 14:37:50 +00:00
David Vossel d3f44c979c fixes deadlock in chan_sip caused by usage of MASTER_CHANNEL dialplan function
(closes issue #16767)
Reported by: lmsteffan
Patches:
      deadlock_16767v3.diff uploaded by dvossel (license 671)

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256319 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-06 14:42:10 +00:00
Richard Mudgett 1a2f96573a Merged revisions 256225 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r256225 | rmudgett | 2010-04-05 19:10:16 -0500 (Mon, 05 Apr 2010) | 5 lines
  
  DAHDI/PRI call to pri_channel_bridge() not protected by PRI lock.
  
  SWP-1231
  ABE-2163
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256265 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-06 00:39:44 +00:00
Richard Mudgett a5a0a5f867 Consolidate ast_channel.cid.cid_rdnis into ast_channel.redirecting.from.number.
SWP-1229
ABE-2161

* Ensure chan_local.c:local_call() will not leak cid.cid_dnid when
copying.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256104 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-03 02:12:33 +00:00
Russell Bryant df3fc304c9 Merged revisions 256014 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r256014 | russell | 2010-04-02 18:45:56 -0500 (Fri, 02 Apr 2010) | 9 lines
  
  Resolve a deadlock that occurs due to a pointless call to ast_bridged_channel()
  
  (closes issue #16840)
  Reported by: bzing2
  Patches:
        patch.txt uploaded by bzing2 (license 902)
        issue_16840.rev1.diff uploaded by russell (license 2)
  Tested by: bzing2, russell
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256015 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-02 23:46:45 +00:00
Michiel van Baak f4617ae2b5 Ignore Redial softkey when no previous dialed number is known
(closes issue #17126)
Reported by: wedhorn
Patches: 
      skinny79xx_redial1.diff uploaded by wedhorn (license 30)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@255851 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-02 06:45:54 +00:00
Michiel van Baak cc89bc0a27 Cleanup transmit_* functions
Bulk lot of generally trivial changes for cleaning up the transmit stuff. Line state request has been modified for line only responses.

(closes issue #16994)
Reported by: wedhorn
Patches: 
      skinny-clean07.diff uploaded by wedhorn (license 30)
Tested by: wedhorn


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@255850 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-02 06:43:31 +00:00
Mark Michelson 284ac3a4d9 Fix improper comaparison of anonymous URI when getting P-Asserted-Identity.
There was a bug where we split the URI on the @ sign and then attempted
to compare to "anonymous@anonymous.invalid" afterwards. This comparison
could never evaluate true. So now we keep a copy of the URI prior to the
split so that the comparison is valid.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@255701 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-31 22:35:20 +00:00
Russell Bryant c6a759fdfa Merged revisions 255409 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r255409 | russell | 2010-03-30 15:56:00 -0500 (Tue, 30 Mar 2010) | 2 lines
  
  Don't kill Asterisk if the H323 listener does not start.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@255410 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-30 20:56:26 +00:00
Russell Bryant 0703c27015 chan_usbradio depends on alsa.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@254718 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-25 20:08:40 +00:00
Mark Michelson 54f5e1f840 Add new rtpsource options to the CHANNEL function.
This adds rtpsource options analogous to the rtpdest
functions that already exist. In addition, this fixes
potential crashes which could result due to trying to
read values from nonexistent RTP streams.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@254551 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-25 17:29:47 +00:00