18 U.S.C. § 3121 : US Code - Section 3121: General prohibition on pen register and trap and trace device use; exception

      (a) In General. - Except as provided in this section, no person
    may install or use a pen register or a trap and trace device
    without first obtaining a court order under section 3123 of this
    title or under the Foreign Intelligence Surveillance Act of 1978
    (50 U.S.C. 1801 et seq.).
      (b) Exception. - The prohibition of subsection (a) does not apply
    with respect to the use of a pen register or a trap and trace
    device by a provider of electronic or wire communication service - 
        (1) relating to the operation, maintenance, and testing of a
      wire or electronic communication service or to the protection of
      the rights or property of such provider, or to the protection of
      users of that service from abuse of service or unlawful use of
      service; or
        (2) to record the fact that a wire or electronic communication
      was initiated or completed in order to protect such provider,
      another provider furnishing service toward the completion of the
      wire communication, or a user of that service, from fraudulent,
      unlawful or abusive use of service; or (3) where the consent of
      the user of that service has been obtained.

      (c) Limitation. - A government agency authorized to install and
    use a pen register or trap and trace device under this chapter or
    under State law shall use technology reasonably available to it
    that restricts the recording or decoding of electronic or other
    impulses to the dialing, routing, addressing, and signaling
    information utilized in the processing and transmitting of wire or
    electronic communications so as not to include the contents of any
    wire or electronic communications.
      (d) Penalty. - Whoever knowingly violates subsection (a) shall be
    fined under this title or imprisoned not more than one year, or