Harri Hakala,
                                                        Leena Mattila
INTERNET-DRAFT                                          Ericsson,
Draft:<draft-hakala-diameter-credit-control-06.txt>     Juha-Pekka
Expires: August 2003                                    Koskinen,
                                                        Marco Stura,
                                                        John Loughney,
                                                        Nokia

                                                        February 2003




                  Diameter Credit Control Application


Status of this memo



   This document is an Internet-Draft and is subject to all provisions
   of Section 10 of RFC2026.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups. Note that
   other groups may also distribute working documents as Internet-
   Drafts.

   Internet-Drafts are draft documents valid for a maximum of six
   months and may be updated, replaced, or obsoleted by other documents
   at any time. It is inappropriate to use Internet-Drafts as reference
   material or cite them other than as "work in progress".

   The list of current Internet-Drafts can be accessed at
   http://www.ietf.org/ietf/lid-abstracts.txt

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html

   This document is an individual submission to the IETF. Comments
   should be directed to the authors.


Abstract

   This document specifies a Diameter application that is used for real-
   time cost and credit control between a service element and a credit
   control server in service environment.

   Diameter accounting messages with additional AVPs are used to
   transfer service and credit control information between the service
   element and the credit control server.




Hakala et al.               expires August 2003              [Page 1]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

TABLE OF CONTENTS

    1   Introduction
        1.1  Requirements language
        1.2  Terminology
        1.3  Advertising application support

    2   Architecture Model

    3   Service Credit Control
        3.1 Session Based Credit Control
           3.1.1 First Interrogation
           3.1.2 Interim Interrogation
           3.1.3 Final Interrogation
           3.1.4 Failure Procedures
        3.2 One Time Event
           3.2.1 Service Price Enquiry
           3.2.2 Balance Check
           3.2.3 Direct Debiting
           3.2.4 Refund
           3.2.5 Failure Procedures
        3.3 Credit Control Session State Machine

    4   Accounting AVPs
        4.1 Abnormal-Termination-Reason AVP
        4.2 Accounting-Correlation-Id AVP
        4.3 Check-Balance-Result AVP
        4.4 Cost-Information AVP
        4.5 Credit-Control-Failure-Handling AVP
        4.6 Currency-Code AVP
        4.7 Direct-Debiting-Failure-Handling AVP
        4.8 Exponent AVP
        4.9 Final-Unit-Indication AVP
        4.10 Granted-Service-Unit AVP
        4.11 Requested-Action AVP
        4.12 Requested-Service-Unit AVP
        4.13 Service-Parameter-Info AVP
        4.14 Service-Parameter-type AVP
        4.15 Service-Parameter-Value AVP
        4.16 Subscription-Id AVP
        4.17 Subscription-Id-Data AVP
        4.18 Subscription-Id-Type AVP
        4.19 Unit-Type AVP
        4.20 Unit-Value AVP
        4.21 Used-Service-Unit AVP
        4.22 Value-Digits AVP

    5   Result-Code AVP Values
        5.1 Transient Failures
        5.2 Permanent Failures

    6   AVP Occurrence Table
        6.1 Accounting AVP Table

Hakala et al.              expires August 2003                 [Page 2]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003


    7   IANA Considerations
        7.1 Application Identifier
        7.2 Command Codes
        7.3 AVP Codes
        7.4 Result-Code AVP Values
        7.5 Abnormal-Termination-Reason AVP
        7.6 Check-Balance-Result AVP
        7.7 Credit-Control-Failure-Handling AVP
        7.8 Direct-Debiting-Failure-Handling AVP
        7.9 Requested-Service-Unit AVP
        7.10 Subscription-Id-Type AVP
        7.11 Unit-Type AVP

    8   Credit Control Application related configurable parameter

    9   Security Considerations

    10  References
        10.1  Normative
        10.2  Non-Normative

    11   Acknowledgements

    12   Authors addresses

    13   Full Copyright Statement

    14   Expiration Date

1 Introduction

   This Diameter application, combined with the Diameter base protocol
   [DIAMBASE], describes the accounting protocol that can be used for
   real time cost and credit control in the service environment.

   The next generation wireless networks specify (e.g. 3G Charging and
   Billing requirements [3GPPCHARG]) more critical requirements for the
   accounting applications. The accounting application must be able to
   rate accounting information in real-time. For example, for the
   service environment it is vital to be able to rate service event
   information instantly.

   There also exists a demand for the end user credit control. The
   accounting application must be able to check the end user's account
   for coverage for the requested service event charge prior to
   execution of that service event. All the chargeable events related to
   a specific account must be prevented from the end user when the
   credit of that account is exhausted or expired.

   Also a mechanism should be provided to indicate to the end user of
   the charges to be levied for a chargeable event.


Hakala et al.              expires August 2003                   [Page 3]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

   There are as well services such as gaming or advertising that in some
   situations rather refund than deduct the end user's account.

   To fulfill all these needs a new type of accounting application is
   needed, the credit control application. This application is used for
   real-time delivery of service event information in the service
   environment from the service element to the credit control server to
   minimize the financial risk.

1.1. Requirements language

   In this document, the key words "MAY", "MUST, "MUST NOT", "optional",
   "recommended", "SHOULD", and "SHOULD NOT", are to be interpreted as
   described in [KEYWORDS].

1.2  Terminology

   AAA
    Authentication, Authorization and Accounting

   Accounting
     The act of collection of information on resource usage for the
     purposes of trend analysis, auditing, billing or cost allocation.

   Accounting Server
     The accounting server receives accounting data from the service
     elements and other devices and translates it into session records.
     It acts as an interface to back-end rating, billing, and operations
     support systems.

   Charging
     In the telecom world charging is synonym to accounting. A function
     whereby information related to a chargeable event is transferred in
     order to make it possible to determine usage for which the charged
     party may be billed.

   Credit Control
     Credit control is a mechanism, which directly interacts in real-
     time with an account and controls or monitors the charges, related
     to the service usage. Credit control is a process of checking if
     credit is available, credit-reservation, reduction of credit from
     the end user account when service is completed and refunding of
     reserved credit not used.

   Credit Control Server
     It is located in the home environment and is accessed by service
     elements in real-time for purpose of price determination and credit
     control before the service event is delivered to the end-user. It
     may also interact with business support systems.

   Diameter Credit Control Client
     A Diameter credit control client is an entity that interacts with a
     credit control server.

Hakala et al.              expires August 2003                   [Page 4]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003


   Diameter Credit Control Server
     A Diameter credit control server is an entity that handles credit
     control request.

   Rating
     The act of determining the cost of the service event.

   Service
     A type of task that is performed by a service element for an end
     user.

   Service Element
     A network element that provides a service to end user. A service
     element itself can include the application service providers or
     application service providers can be located in an other domain.

   Service Event
     Any event which creates value for the end-user.

1.3 Advertising application support

   Diameter nodes conforming to this specification MAY advertise support
   by including the value of TBD (X) in the Acct-Application-Id AVP of
   the Capabilities-Exchange-Request and Capabilities-Exchange-Answer
   command [DIAMBASE].

2 Architecture Model

   A service element provides services to end-users. When accounting is
   used a service element collects service event information and reports
   it while and/or after services are provided to an accounting server
   by using an accounting protocol. Alternatively the accounting server
   may query the service element for service event information.

   The accounting protocol can for example be RADIUS accounting protocol
   or the Diameter base protocol with a Diameter application.

   If real-time credit control is required, the service element (credit
   control client) contacts the credit control server with service event
   information included before the service is provided. The credit
   control server, depending on the service event information, MAY
   perform the rating of the service event, pricing of the service
   event, credit check and credit-reservation from the account. The
   service element monitors the service execution according to the
   instructions returned by the credit control server. After the service
   completion the credit control server deducts the money from the
   account.

   If direct debiting/refunding is requested, the credit control server
   deducts/increases the end user's account, respectively. The service
   element can also enquire the price of the service or the account
   balance status from the credit control server.

Hakala et al.              expires August 2003                   [Page 5]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003


   In a multi-service environment it might happen that an end user with
   already ongoing service (e.g. voice call) issues a new service
   request (e.g. data service) towards same account or during an active
   multimedia session an additional media type is added to the session
   causing a new simultaneous request towards same account. Consequently
   this SHOULD be considered when units are granted to the services.

   There MAY be multiple credit control servers in the system for
   reasons of redundancy and load balancing. The system MAY also contain
   separate rating server(s) and accounts MAY locate in a centralized
   database. System internal interfaces can exist to relay messages
   between servers and an account manager. However the detailed
   architecture of credit control system and its interfaces are
   implementation specific and are out of scope of this specification.

   The credit control protocol is the Diameter base protocol with the
   Diameter credit control application.


                                        accounting
     +------------+       +-----------+ protocol     +--------------+
     |  End       |<----->|  Service  |<------------>| Accounting   |
     |  User      |   +-->|  Element  |<-----+       |   Server     |
     +------------+   |   +-----------+      |       +--------------+
                      |                      |
     +------------+   |                      |
     |  End       |<--+                      |       +--------------+
     |  User      |                          +------>|Credit Control|
     +------------+                  credit control  |   Server     |
                                        protocol     +--------------+


   The credit control server and accounting server in this architecture
   model are logical entities. The real configuration MAY combine them
   into a single host.

   There MAY exist protocol transparent Diameter relays and redirect
   agents between credit control client and credit control server. These
   agents transparently support the Diameter credit control application.

   If Diameter credit control proxies exist between the credit control
   client and the credit control server, they MUST advertise the
   Diameter credit control application support.

3 Service Control

   When an end user requests a service the request is forwarded to a
   service element in the home domain, that is the same administrative
   domain, in which the end user's credit control server is located. In
   some cases it might be possible that the service element in the
   visited domain can offer service event to the end user, but in that


Hakala et al.              expires August 2003                   [Page 6]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

   case a commercial agreement must exist between the service element in
   the visited domain and in the home domain.

   The service element SHOULD authenticate and authorize the end user
   before any request is sent to the credit control server. The way how
   the authentication and/or authorization are performed in the service
   element and the authentication and/or authorization messages that are
   used are not defined in this application. The methods defined in
   other Diameter applications or other legacy authentication and
   authorization methods can be used.

   Each credit control session MUST have globally unique Session-Id as
   defined in [DIAMBASE] and it MUST NOT be changed during the life time
   of a credit control session.

   The Diameter credit control client in the service element MAY get
   information from the authorization server regarding the way
   accounting data shall be forwarded (accounting protocol, credit
   control protocol or both) based on its knowledge of the end user.
   This means that the accounting information is forwarded to the
   accounting server as defined in [DIAMBASE], or the credit control
   server SHOULD be contacted before the service event is offered to the
   end user or both the accounting protocol and the credit control
   protocol MAY be used in parallel.

   The authorization server MAY include the Accounting-Realtime-Required
   AVP to determine what to do if the sending of accounting records to
   the accounting server has been temporarily prevented as defined in
   [DIAMBASE]. The Accounting-Realtime-Required AVP is not used by this
   application. Instead of or in addition to the Accounting-Realtime-
   Required AVP the authorization server MAY include the Credit-Control-
   Failure-Handling AVP and Direct-Debiting-Failure-Handling AVP to
   determine what to do if the sending of credit control messages to the
   credit control server has been temporarily prevented. The usage of
   Credit-Control-Failure-Handling AVP and the Direct-Debiting-Failure-
   Handling AVP gives flexibility to have different failure handling for
   credit control session and one time event direct debiting. The credit
   control server MAY override the failure handling for credit control
   session by including the Credit-Control-Failure-Handling AVP in the
   Accounting-Answer.

   The usage of separate AVPs makes it possible to have different
   failure handling towards accounting servers and credit control
   servers, in case both should be used parallel. It is recommended that
   the client complements the credit control failure procedures with
   backup accounting flow towards an accounting server. With different
   combinations of above AVPs different safety levels can be built.
   For example by choosing the Credit-Control-Failure-Handling AVP equal
   to CONTINUE and Accounting-Realtime-Required AVP equal to
   DELIVER_AND_GRANT the service can be granted to the end user even if
   the connection to the credit control server is down but the
   accounting server is able to collect the accounting information,


Hakala et al.              expires August 2003                   [Page 7]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

   provided that there is information exchange taking place between the
   accounting server and credit control server.

   If authentication and authorization is done based on Diameter
   application the authorization server MAY include the Acct-Interim-
   Interval AVP to control the operation of the device in the service
   element operating as a client as defined in [DIAMBASE]. If the Acct-
   Interim-Interval AVP is included then the interim interval MAY be
   present in the request message sent to the credit control server.

   The Diameter credit control server MAY override the interim interval.
   It is up to the credit control server to determine, even
   independently from the requested value, the allowed interim interval
   to be used for consumption of the granted service units. The credit
   control server MAY return the interim interval in the Answer message
   to the credit control client. It can be included in the Answer
   message even in case it is not present in the Request message.
   Alternatively the accounting interim interval can be omitted from the
   Answer message. However, since interim records are also produced at
   the expiry of granted service units and/or for mid-session service
   events the omission of Acct-Interim-Interval does not mean that
   interim records are not produced.

   During authorization, the authorization server MAY return the
   Accounting-Multi-Session-Id, which the Diameter credit control client
   MAY include in all subsequent accounting messages. The Accounting-
   Multi-Session-Id AVP MAY include the value of the original Session-
   Id. It's contents are implementation specific, but MUST be globally
   unique across other Accounting-Multi-Session-Id, and MUST NOT be
   changed during the life time of a credit control session.
   There are certain applications that require multiple accounting sub-
   sessions. Such applications would send messages with a constant
   Session-Id AVP, but a different Accounting Sub-Session-Id AVP.
   If several credit sub-sessions will be used, all sub-sessions MUST be
   closed separately before the closing the main session. The absence of
   this AVP implies no sub-sessions are in use.

   If the credit control client wants to perform credit-reservation
   before granting service to the end user it MUST use several
   interrogations towards the credit control server. In this case the
   credit control server MUST maintain the accounting session state.

   A one time event MAY be used when there is no need to maintain any
   state in the Diameter credit control server, for example enquiring
   the price of the service.

3.1 Session Based Credit Control

   For a session based credit control several interrogations are needed:
   the first, intermediate (optional) and the final interrogation.

3.1.1 First Interrogation


Hakala et al.              expires August 2003                   [Page 8]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

   The first interrogation MUST be sent before the Diameter credit
   control client in a service element allows any service event to the
   end user. The Accounting-Record-Type is set to the value START_RECORD
   in the first request message. The Subscription-Id-Data AVP SHOULD be
   included to identify the end-user in the credit control server.

   If the Diameter credit control client knows the cost of the service
   event the monetary amount to be charged is included in the Requested-
   Service-Unit AVP. If the Diameter credit control client does not know
   the cost of the service event, the Requested-Service-Unit AVP MAY
   contain the number of requested service events and the Service-
   Parameter-Info AVP SHOULD contain the service event information to be
   rated by the credit control server. The Service-Parameter-Info AVP
   always refers to the requested service units.

   The Event-Timestamp AVP contains the time when the service event is
   requested in the service element.

   The credit control server SHOULD rate the service event and make a
   credit-reservation from the end user's account that covers the cost
   of the service event. If the type of the Requested-Service-Unit AVP
   is money, no rating is needed but the corresponding monetary amount
   is reserved from end user's account.

   The credit control server returns the Granted-Service-Unit AVP in the
   Answer message to the Diameter credit control client. The Granted-
   Service-Unit AVP contains the amount of service units that the
   Diameter credit control client can provide to the end user until a
   new Accounting-Request MUST be sent to the credit control server. If
   several unit types are sent in the Answer message the credit control
   client MUST handle each unit type separately. However there MUST be
   maximum one instance of the same unit type in one Answer message.
   When the granted service units for one unit type have been spent a
   new Accounting-Request MUST be sent to the credit control server even
   though there would be service units left for other units types. The
   type of the Granted-Service-Unit AVP can be time, volume, service
   specific or money depending on the type of service event. It is not
   allowed to change the unit type(s) within the session.

   If the credit control server determines that no further control is
   needed for the service it MAY include the result code indicating that
   the credit control is not applicable (e.g. service is free of charge)
   and terminate the credit control session.

   The Accounting-Answer message can MAY include the Final-Unit-
   Indication AVP to indicate that the Answer message contains the final
   units for the service session. After the end user has used these
   units, the Diameter credit control client is responsible for
   terminating the service session and the credit control session by
   sending the final interrogation to the credit control server.

3.1.2 Intermediate Interrogation


Hakala et al.              expires August 2003                   [Page 9]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

   When all the granted service units for one unit type are spent by the
   end user or the interim interval is expired the Diameter credit
   control client MUST send a new Accounting-Request to the credit
   control server. In case the Acct-Interim-Interval is used it is
   always up to the Diameter credit control client to send a new request
   well in advance before the expiration of the previous request in
   order to avoiding interruption in the service element. Even if the
   granted service units reserved by the credit control server have not
   been spent upon expiration of the accounting interim interval, the
   Diameter credit control client MUST send a new Accounting-Request to
   the credit control server.

   There can be also mid-session service events, which might affect the
   rating of the current service events. In this case a spontaneous
   updating (a new Accounting-Request) SHOULD be sent including
   information related to the service event even if all the granted
   service units have not been spent or the accounting interim interval
   has not expired.

   When the used units are reported to the credit control server the
   credit control client will not have any units in its possession
   before new granted units are received from the credit control server.
   When the new granted units are received from the credit control
   server these units apply from the point where the measurement of the
   reported used units stopped.

   The Accounting-Record-Type AVP is set to the value INTERIM_RECORD in
   the intermediate request message. The Subscription-Id-Data AVP SHOULD
   also be included in the intermediate message to identify the end user
   in the credit control server.

   The Requested-Service-Unit AVP contains the new amount of requested
   service units. The Used-Service-Unit AVP contains the amount of used
   service units measured from the point when the service became active
   or, in case of interim interrogations are used during the session,
   from the point when the previous measurement ended. The same unit
   types that are used in the previous message MUST be used. If several
   unit types were included in the previous Answer message the used
   service units for each unit type MUST be reported.

   The Event-Timestamp AVP contains the time of the event that triggered
   the sending of the new Accounting-Request.

   The credit control server MUST deduct the used monetary amount from
   the end user's account. It MAY rate the new request and make a new
   credit-reservation from the end user's account that covers the cost
   of the requested service event.

   The Accounting-Answer message with the Accounting-Record-Type AVP set
   to the value INTERIM_RECORD MAY include the Cost-Information AVP
   containing the accumulated cost estimation for the session without
   taking any credit-reservation into account.


Hakala et al.              expires August 2003                  [Page 10]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

   There MAY be several intermediate interrogations within a session.

3.1.3 Final Interrogation

   When the end user terminates the service session or when all the
   granted units are used after a Final-Unit-Indication AVP has been
   received from the credit control server, the Diameter credit control
   client MUST send a final Accounting-Request message to the credit
   control server. The Accounting-Record-Type AVP is set to the value
   STOP_RECORD.

   The Event-Timestamp AVP MAY contain the time of the session was
   terminated.

   The Used-Service-Unit AVP contains the amount of used service units
   measured from the point when the service became active or, in case of
   interim interrogations are used during the session, from the point
   when the previous measurement ended. If several unit types were
   included in the previous answer message the used service units for
   each unit type MUST be reported.

   After final interrogation the credit control server MUST refund the
   reserved credit amount not used to the end user's account and deduct
   the used monetary amount from the end user's account.

   The Accounting-Answer message with the Accounting-Record-Type set to
   the value STOP_RECORD SHOULD include the Cost-Information AVP
   containing the estimated total cost for the session in question.

3.1.4 Failure Procedures

   Since the credit control application is based on real-time bi-
   directional communication between the credit control client and the
   credit control server alternative destinations and buffering of
   messages are not sufficient in the event of communication failures.
   Since the credit control server has to maintain a session state the
   credit control message stream MUST not be moved to a backup credit
   control server during an ongoing credit control session. However,
   Diameter agents MAY perform failover to an alternative agent when
   they detect a transport failure. As a consequence the credit control
   server MAY receive duplicate messages. These duplicates or out of
   sequence messages can be detected in the credit control server based
   on the credit control server session state machine (section 3.3),
   Session-Id AVP and Accounting-Record-Number AVP.

   If a communication failure occurs during an ongoing credit control
   session the credit control client will terminate or continue the
   service depending on the value set in the Credit-Control-Failure-
   Handling AVP. The Credit-Control-Failure-Handling AVP MAY be sent
   from the authorization server and in the Accounting-Answer from the
   credit control server. For new credit control sessions failover to
   alternative credit control server SHOULD be performed, if possible.


Hakala et al.              expires August 2003                  [Page 11]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

   The timer Tx (as defined in section 8) is used in the credit control
   client to supervise the communication with the credit control server.

   If the credit control server detects a failure during an ongoing
   credit control session it will terminate the credit control session
   and return the reserved units back to the end user's account.

   The supervision session timer Ts as defined in [DIAMBASE] is used in
   the credit control server.

3.2 One Time Event

   The one time event is used when there is no need to maintain
   accounting session state in the credit control server.

   The one time event can be used when the service element wants to know
   the cost of the service event without any credit-reservation or to
   check the account balance without any credit-reservation. It can be
   used also for refunding service units on the user's account or direct
   debiting without any credit-reservation.

3.2.1 Service Price Enquiry

   Sometimes the service element needs to know the price of the service
   event. There might exist services offered by application service
   providers, whose prices are not known in the service element. End
   user might also want to get an estimation of the price of a service
   event before requesting it.

   A Diameter credit control client requesting the cost information MUST
   set the Accounting-Record-Type AVP equal to EVENT_RECORD, include the
   Requested-Action AVP set to PRICE_ENQUIRY and set the requested
   service event information into the Service-Parameter-Info AVP in the
   Accounting-Request message.

   The credit control server calculates the cost of the requested
   service event, but it does not perform any account balance check or
   credit-reservation from the account.

   The estimated price of the requested service event is returned to the
   credit control client in the Cost-Information AVP in the Accounting-
   Answer message.

3.2.2 Balance Check

   Sometimes Diameter credit control client needs only to verify that
   the end user's account balance covers the cost for a certain service
   without reserving any units from the account at the time of the
   enquiry. This method does not guarantee that there would be credit
   left when the Diameter credit control client requests the debiting of
   the account with a separate request.



Hakala et al.              expires August 2003                  [Page 12]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

   A Diameter credit control client requesting the balance check MUST
   set the Accounting-Record-Type AVP equal to EVENT_RECORD, include
   Requested-Action AVP set to CHECK_BALANCE and include the
   Subscription-Id-Data to identify the End-User in the credit control
   server.

   The credit control server makes the balance check, but it does not do
   any credit-reservation from the account.

   The result of balance check (Credit/No Credit) is returned to the
   credit control client in the Check-Balance-Result AVP in the
   Accounting-Answer message.

3.2.3 Direct Debiting

   There are certain one time events for which service execution is
   always successful in the service environment. Sometimes the delay
   between the service invocation and the actual service delivery to the
   end user can be so long that the use of the session based credit
   control would lead to unreasonable long credit control sessions.
   In these cases the Diameter credit control client can use the one
   time event scenario for direct debiting. The Diameter credit control
   client SHOULD be sure that the requested service event execution will
   be successful, when this scenario is used.

   The Accounting-Record-Type is set to the value EVENT_RECORD and the
   Requested-Action AVP set to DIRECT_DEBITING in the Accounting-Request
   message. The Subscription-Id-Data AVP SHOULD be included to identify
   the End-User in the credit control server. The Event-Timestamp AVP
   contains the time when the service event is requested in the service
   element.

   The Diameter credit control client MAY include the monetary amount to
   be charged in the Request-Service-Unit AVP, if it knows the cost of
   the service event. If the Diameter credit control client does not
   know the cost of the service event, then the Service-Parameter-Info
   AVP SHOULD contain the service event information to be rated by the
   credit control server. The Service-Parameter-Info AVP always refers
   to the requested service unit.

   The credit control server SHOULD rate the service event and deduct
   the corresponding monetary amount from end user's account. If the
   type of the Requested-Service-Unit AVP is money, no rating is needed
   but the corresponding monetary amount is deducted from the End User's
   account.

   The credit control server returns the Granted-Service-Unit AVP in the
   Answer message to the Diameter credit control client. The Granted-
   Service-Unit AVP contains the amount of service units that the
   Diameter credit control client can provide to the end user. The type
   of the Granted-Service-Unit can be time, volume, service specific or
   money depending on the type of service event.


Hakala et al.              expires August 2003                  [Page 13]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

   If the credit control server determines that no credit control is
   needed for the service it MAY include the result code indicating that
   the credit control is not applicable (e.g. service is free of
   charge).

   For informative purposes, the Accounting-Answer message SHOULD also
   include the Cost-Information AVP containing the estimated total cost
   of the requested service.

3.2.4 Refund

   There MAY be a need to refund service units on the end user's
   account, for example gaming services.

   The credit control client MUST set Accounting-Record-Type AVP to the
   value EVENT_RECORD and the Requested-Action AVP to REFUND in the
   Accounting-Request message. The Subscription-Id-Data AVP SHOULD be
   included to identify the End-User in the credit control server.

   The Diameter credit control client MAY include the monetary amount to
   be refunded in the Request-Service-Unit AVP, if it knows the cost of
   the service event. If the Diameter credit control client does not
   know the cost of the service event, then the Service-Parameter-Info
   AVP SHOULD contain the service event information to be rated by the
   credit control server. The Service-Parameter-Info AVP always refers
   to the requested service unit.

   For informative purposes, the Accounting-Answer message MAY also
   include the Cost-Information AVP containing the estimated monetary
   amount of refunded unit.

3.2.5 Failure Procedure

   There MAY exist protocol transparent Diameter relays and redirect
   agents or Diameter credit control proxies between credit control
   client and credit control server. These agents MAY perform failover
   procedures if they detect transport failure as described in
   [DIAMBASE].

   When the credit control client detects a communication failure to the
   credit control server its behavior depends on the requested action.
   The timer Tx (as defined in section 8) is used in the credit control
   client to supervise the communication with the credit control server.

   In case the requested action is Service Price Enquiry or Balance
   Check and communication failure is detected the credit control client
   MAY forward the request messages to an alternative credit control
   server, if possible.

  If the requested action is DIRECT_DEBITING and the Direct-Debiting-
  Failure-Handling AVP is set to TERMINATE_OR_BUFFER the credit control
  client SHOULD terminate the service if it can determine from the
  result code or error code in the answer message that units have not

Hakala et al.              expires August 2003                  [Page 14]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

  been debited. Otherwise the credit control client SHOULD grant the
  service to the end user and store the record in the credit control
  application level non-volatile storage. The credit control client
  MUST mark these request messages as possible duplicate by setting the
  T-flag in the command header as described in [DIAMBASE] section 3. If
  the Direct-Debiting-Failure-Handling AVP is set to CONTINUE the
  service SHOULD be granted even if credit control messages can't be
  delivered. If the timer Tx expires the credit control client MUST
  continue the service and eventually buffer the request according to
  the value of the Direct-Debiting-Failure-Handling AVP.

   The Accounting-Request with requested action REFUND should always be
   stored in the credit control application level non-volatile storage
   in case of temporary failure. The credit control client MUST mark the
   re-transmitted request message as possible duplicate by setting the
   T-flag in the command header as described in [DIAMBASE] section 3.

   The implementation MAY choose to limit the number of re-transmission
   attempts and define a re-transmission interval.

   Because there can appear duplicate request for various reason the
   credit control server is therefore responsible for the real time
   duplicate detection. Implementation issues for duplicate detection
   are discussed in [DIAMBASE] Appendix C. When the credit control
   client re-sends messages from its application level non-volatile
   storage it MUST mark these request messages as possible duplicate by
   setting the T-flag in the command headers as described in [DIAMBASE]
   section 3.

   Only one place in the credit control system SHOULD be responsible for
   duplicate detection. If there is only one credit control server
   within the given realm the credit control server MAY perform
   duplicate detection. In case when more than one credit control server
   are supporting the credit control application the accounting manager
   controlling the account database MAY be responsible for duplicate
   detection.

3.3 Credit Control Session State Machine

  The following state machines MUST be supported for credit control
  applications.

  The first two state machines are to be observed by credit control
  clients. The first one describes the session based credit control and
  the second one event based credit control. The third state machine
  describes the credit control session from a credit control server
  perspective.

  Any event not listed in the state machines MUST be considered as an
  error condition, and a corresponding answer, if applicable, MUST be
  returned to the originator of the message.

  In the state table, the event 'Failure to send' means that the

Hakala et al.              expires August 2003                  [Page 15]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

  Diameter credit control client is unable to communicate with the
  desired destination (i.e. the answer message is not received within
  the validity time of the request). This could be due to the peer
  being down, or due to a physical link failure in the path to/from the
  credit control server.

  The event 'Temporary error' means that the Diameter credit control
  client received a transient failure notification in the Accounting
  Answer command (i.e. the peer sending back a transient failure or
  temporary protocol error notification DIAMETER_TOO_BUSY, or
  DIAMETER_LOOP_DETECTED in the Result-Code AVP).

  The event 'Failed answer' means that the Diameter credit control
  client received non-transient failure (permanent failure)
  notification in the Accounting Answer command.

  The action 'store record' means that a record is stored in the credit
  control application level non-volatile storage.

  The event 'Not successfully processed' means that the credit control
  server could not process the message, e.g. due to unknown end user,
  account being empty or due to errors defined in [DIAMBASE].

  The states PendingS, PendingI, PendingL PendingE and PendingB stand
  for pending states to wait for an answer to an accounting request
  related to a Start, Interim, Stop, Event or Buffered record
  respectively.

                         CLIENT, SESSION BASED
   State     Event                          Action       New State
   ---------------------------------------------------------------
  Idle      Client or device requests      Send         PendingS
            access                         accounting
                                           start req.,
                                           start Tx.

  PendingS  Successful accounting          Stop Tx      Open
            start answer received

  PendingS  Failure to send, or            Grant        Idle
            temporary error and            service to
            credit control fault           end user
            handling equal to CONTINUE

  PendingS  Failure to send, or            Disconnect   Idle
            temporary error and            user/dev
            credit control fault
            handling equal to TERMINATE

  PendingS  Tx expired and credit          Disconnect   Idle
            Control fault handling         user/dev
            equal to TERMINATE


Hakala et al.              expires August 2003                  [Page 16]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003


  PendingS  Tx expired and credit control  Grant
            fault handling equal to        service to   Idle
            CONTINUE                       end user

  PendingS  Accounting start answer        Disconnect   Idle
            received with result code      user/dev
            SERVICE_ DENIED or
            USER_NOT_FOUND

  PendingS  Accounting start answer        Grant        Idle
            received with result code      service
            equal to credit control N/A    to end user

  PendingS  Failed accounting start answer Grant        Idle
            received and credit control    Service to
            fault handling                 end user
            equal to CONTINUE

  PendingS  Failed accounting start answer Disconnect   Idle
            received and credit control    user/dev
            failure handling equal to
            TERMINATE

  PendingS  User service terminated        Queue        PendingS
                                           termination
                                           event

  PendingS  Change in rating condition     Queue        PendingS
                                           changed
                                           rating
                                           condition
                                           event

  Open      Granted unit elapses           Send         PendingI
            and no final unit              accounting
            indication received            interim req.,
                                           start Tx.

  Open      Granted unit elapses           Disconnect   PendingL
            and final unit indication      send
            received                       accounting
                                           stop req.,
                                           start Tx.

  Open      Change in rating condition     Send         PendingI
            in queue                       accounting
                                           interim req.,
                                           Start Tx.

  Open      Service terminated in queue    Send         PendingL
                                           accounting

Hakala et al.              expires August 2003                  [Page 17]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

                                           stop req.,
                                           start Tx

  Open      Change in rating condition     Send         PendingI
            or interim interval elapses    accounting
                                           interim req.,
                                           Start Tx.

  Open      User service terminated        Send         PendingL
                                           accounting
                                           stop req.,
                                           start Tx

  PendingI  Successful accounting interim  Stop Tx      Open
            answer received

  PendingI  Failure to send, or            Grant        Idle
            temporary error and            service to
            credit control fault           end user
            handling equal to CONTINUE

  PendingI  Failure to send, or            Disconnect   Idle
            temporary error and            user/dev
            credit control fault
            handling equal to TERMINATE

  PendingI  Tx expired and credit control  Disconnect   Idle
            fault handling equal to        user/dev
            TERMINATE

  PendingI  Tx expired and credit control  Grant
            fault handling equal to        service to   Idle
            CONTINUE                       end user.

  PendingI  Accounting interim answer      Disconnect   Idle
            received with result code      user/dev
            SERVICE_DENIED

  PendingI  Accounting interim answer      Grant        Idle
            received with result code      service
            equal to credit control N/A    to end user

  PendingI  Failed accounting interim      Grant        Idle
            answer received and credit     service to
            control fault handling equal   end user.
            to CONTINUE

  PendingI  Failed accounting interim      Disconnect   Idle
            answer received and credit     user/dev
            control fault handling
            equal to TERMINATE


Hakala et al.              expires August 2003                  [Page 18]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

  PendingI  User service terminated        Queue        PendingI
                                           termination
                                           event

  PendingI  Change in rating               Queue        PendingI
            condition                      changed
                                           rating
                                           condition
                                           event

  PendingL  Successful accounting stop                  Idle
            answer received

  PendingL  Tx expired                                  Idle

  PendingL  Failure to send, or temporary               Idle
            error or failed answer

  PendingL  Change in rating condition                  PendingL


                            CLIENT, EVENT BASED
  State     Event                          Action        New State
  ----------------------------------------------------------------

  Idle      Client or device requests      Send          PendingE
            a one-time service             accounting
                                           event req.,
                                           Start Tx.

  Idle      Records in storage             Send          PendingB
                                           stored
                                           records

  PendingE  Successful accounting                        Idle
            event answer received

  PendingE  Failure to send, temporary     Indicate      Idle
            error or failed accounting     service
            event answer received, or      error
            Tx expired, requested
            action GET_BALANCE or
            PRICE_ENQUIRY

  PendingE  Accounting event answer        Disconnect    Idle
            received with result code      user/dev
            SERVICE_ DENIED or
            USER_NOT_FOUND

  PendingE  Accounting event answer        Grant         Idle
            received with result code      service
            credit control N/A, requested  to end

Hakala et al.              expires August 2003                  [Page 19]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

            action DIRECT_DEBITING         user

  PendingE  Failure to send, temporary     Grant         Idle
            error or failed accounting     service
            event answer received, or Tx   to end
            expired, requested             user
            action DIRECT_DEBITING and
            fault handling equal to
            CONTINUE

  PendingE  Failed accounting event        Disconnect    Idle
            answer received, requested     user/dev
            action DIRECT_DEBITING and
            fault handling equal to
            TERMINATE_OR_BUFFER

  PendingE  Failure to send or Tx          Grant         Idle
            expired, requested             service
            action DIRECT_DEBITING and     to end user
            fault handling equal to        and store
            TERMINATE_OR_BUFFER            record with
                                           T-flag

  PendingE  Temporary error, requested     Disconnect    Idle
            action DIRECT_DEBITING and     user/dev
            fault handling equal to
            TERMINATE_OR_BUFFER

  PendingE  Failed accounting event        Indicate      Idle
            answer received, requested     service
            action REFUND                  error and
                                           delete record

  PendingE  Failure to send or             Store record  Idle
            Tx expired, requested          with T-flag
             action REFUND

  PendingE  Temporary error                Store record  Idle
            and requested action
            REFUND

  PendingB  Successful accounting answer   Delete        Idle
            received                       record

  PendingB  Failed accounting answer       Delete        Idle
            received                       record

  PendingB  Failure to send or                           Idle
            temporary error


                   SERVER, SESSION AND EVENT BASED
  State     Event                          Action        New State

Hakala et al.              expires August 2003                  [Page 20]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

  ----------------------------------------------------------------

  Idle      Accounting start request       Send          Open
            received and successfully      accounting
            processed.                     start
                                           answer,
                                           reserve units,
                                           start Ts

  Idle      Accounting start request       Send          Idle
            received, but not              accounting
            successfully processed.        start
                                           Answer with
                                           Result-Code
                                           != SUCCESS

  Idle      Accounting event request       Send          Idle
            received and successfully      accounting
            processed.                     event
                                           answer,
                                           debit units

  Idle      Accounting event request       Send          Idle
            received, but not              accounting
            successfully processed.        event
                                           Answer with
                                           Result-Code
                                           != SUCCESS

  Open      Accounting Interim request     Send          Open
            received and successfully      accounting
            processed                      answer,
                                           debit used
                                           units and
                                           reserve
                                           new units,
                                           Restart Ts

  Open      Accounting interim request     Send          Idle
            received, but not              accounting
            successfully processed.        interim
                                           Answer with
                                           Result-Code
                                           != SUCCESS,
                                           debit used
                                           units

  Open      Accounting stop request        Send          Idle
            received, and successfully     accounting
            processed                      stop answer,
                                           Stop Ts,
                                           debit used

Hakala et al.              expires August 2003                  [Page 21]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

                                           units

  Open      Accounting stop request        Send          Idle
            received, but not              accounting
            successfully processed.        stop
                                           Answer with
                                           Result-Code
                                           != SUCCESS,
                                           debit used
                                           units

  Open      Session supervision timer Ts   Stop Ts,      Idle
            expired                        release
                                           reserved
                                           units

4 Accounting AVPs

   This section defines the accounting AVPs that are specific to
   Diameter Credit Control Application and MAY be included in the
   Diameter accounting messages [DIAMBASE].

   Accounting-Request command MAY include the following additional AVPS:
     [ Subscription-Id ]
     [ Requested-Action ]
    *[ Requested-Service Unit ]
    *[ Used-Service-Unit ]
    *[ Service-Parameter-Info ]
     [ Abnormal-Termination-Reason]
    *[ Accounting-Correlation-Id ]
     [ Credit-Control-Failure-Handling ]

   Accounting-Answer command MAY include a following additional AVPS:
     [ Subscription-Id ]
    *[ Granted-Service-Unit ]
     [ Cost-Information]
     [ Final-Unit-Indication ]
     [ Check-Balance-Result ]
     [ Credit-Control-Failure-Handling ]

   The following table describes the Diameter AVPs defined in Credit
   Control application, their AVP Code values, types, possible flag
   values and whether the AVP MAY be encrypted.

                                            +---------------------+
                                            |    AVP Flag rules   |
                                            |----+-----+----+-----|----+
                     AVP  Section           |    |     |SHLD| MUST|MAY |
   Attribute Name    Code Defined Data Type |MUST| MAY | NOT|  NOT|Encr|
   -----------------------------------------|----+-----+----+-----|----|
   Abnormal-         XXX  4.1    Enumerated | -  |  P  |    |  V  | Y  |
     Termination-Reason                     |    |     |    |     |    |

Hakala et al.              expires August 2003                  [Page 22]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

   Accounting-       XXX  4.2    OctetString| -  |  P  |    |  V  | Y  |
     Correlation-Id                         |    |     |    |     |    |
   Check-Balance-    XXX  4.3    Enumerated | M  |  P  |    |  V  | Y  |
     Result                                 |    |     |    |     |    |
   Cost-Information  XXX  4.5    Grouped    | -  |  P  |    |  V  | Y  |
   Credit-Control-   XXX  4.6    Enumerated | M  |  P  |    |  V  | Y  |
     Failure-Handling                       |    |     |    |     |    |
   Direct-Debiting   XXX  4.8    Enumerated | M  |  P  |    |  V  | Y  |
     Failure-Handling                       |    |     |    |     |    |
   Final-Unit-       XXX  4.9    Unsigned32 | M  |  P  |    |  V  | Y  |
   Indicator                                |    |     |    |     |    |
   Granted-Service-  XXX  4.10   Grouped    | M  |  P  |    |  V  | Y  |
     Unit                                   |    |     |    |     |    |
   Requested-Action  XXX  4.11   Enumerated | M  |  P  |    |  V  | Y  |
   Requested-Service XXX  4.12   Grouped    | M  |  P  |    |  V  | Y  |
     Unit                                   |    |     |    |     |    |
   Service-Parameter XXX  4.14   Grouped    | M  |  P  |    |  V  | Y  |
     Info                                   |    |     |    |     |    |
   Subscription-Id   XXX  4.17   Grouped    | M  |  P  |    |  V  | Y  |
   Used-Service-Unit XXX  4.22   Grouped    | M  |  P  |    |  V  | Y  |
   -----------------------------------------+----+-----+----+-----+----+

4.1 Abnormal-Termination-Reason AVP

  The Abnormal-Termination-Reason AVP (AVP Code TBD) is of type
  Enumerated and contains information about the reason for an abnormal
  service termination in a service element.

   The following reasons are defined:

       SERVICE_ELEMENT_TERMINATION                         0
            An error occurred in the service element.

       CONNECTION_TO_END-USER_BROKEN                       1
            The connection to the end-user is broken.

4.2 Accounting-Correlation-Id AVP

  The Accounting-Correlation-Id AVP (AVP Code TBD) is type of
  OctetString and contains information to correlate accounting data
  generated for different components of the service, e.g. transport and
  service level.

4.3 Check-Balance-Result AVP

  The Check Balance Result AVP (AVP code TBD) is of type Enumerated and
  contains the result of the balance check. This AVP is applicable only
  when the Requested-Action AVP indicates CHECK_BALANCE in the
  Accounting-Request command.

  The following values are defined for the Check-Balance-Result AVP.

      ENOUGH_CREDIT                                       0

Hakala et al.              expires August 2003                  [Page 23]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

           There is enough credit in the account to cover the requested
           service.

      NO_CREDIT                                           1
            There isnÆt enough credit in the account to cover the
            requested service.

4.4 Cost-Information AVP

   The Cost-Information AVP (AVP Code TBD) is of type Grouped and is
   used to return the cost information of a service in the Accounting-
   Answer command. The included Unit-Value AVP contains the cost
   estimate (always type of money) of the service in case of price
   enquiry or the accumulated cost estimation in the case of credit
   control session.
   The Currency-Code specifies in which currency the cost was given.

   When the Requested-Action AVP with value PRICE_ENQUIRY is included in
   the Accounting-Request command the Cost-Information AVP sent in the
   succeeding Accounting-Answer command contains the cost estimation of
   the requested service, without any reservation being made.

   The Cost-Information AVP included in the Accounting-Answer command
   with the Accounting-Record-Type set to INTERIM_RECORD contains the
   accumulated cost estimation for the session without taking any
   credit-reservation into account.

   The Cost-Information AVP included in the Accounting-Answer command
   with the Accounting-Record-Type set to EVENT_RECORD or STOP_RECORD
   contains the estimated total cost for the requested service.

   It has the following ABNF grammar:

          <Cost-Information>::=< AVP Header: TBD >
                            { Unit-Value }
                             { Currency-Code }

4.5 Credit-Control-Failure-Handling AVP

   The Credit-Control-Failure-Handling AVP (AVP Code TBD) is of type
   Enumerated. The credit control client uses information in this AVP to
   decide what to do if the sending of credit control messages to the
   credit control server has been for instance temporarily prevented due
   to a network problem.

       TERMINATE                                                0
       When the Credit-Control-Failure-Handling AVP is set to TERMINATE
       the service MUST only be granted as long as there is a
       connection to the credit control server. If the credit control
       client does not receive any Accounting-Answer message within the
       Tx timer (as defined in section 8) the credit control request
       is regarded failed. The moving of already started credit control
       session to alternative server is not allowed.

Hakala et al.              expires August 2003                  [Page 24]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003


       This is the default behaviour if the AVP isn't included in the
       reply from the authorization or credit control server.

       CONTINUE                                                 1
       When the Credit-Control-Failure-Handling AVP is set to CONTINUE
       the service SHOULD be granted even if credit control messages
       can't be delivered.

4.6 Currency-Code AVP

   The Currency-Code AVP (AVP Code TBD) is of type Unsigned32 and
   contains a currency code that specifies in which currency the values
   of AVPs containing monetary units were given. It is specified using
   the numeric values defined in the ISO 4217 standard.

4.7 Direct-Debiting-Failure-Handling AVP

   The Direct-Debiting-Failure-Handling AVP (AVP Code TBD) is of type
   Enumerated. The credit control client uses information in this AVP to
   decide what to do if the sending of credit control messages
   (Requested-Action AVP set to Direct Debiting) to the credit control
   server has been for instance temporarily prevented due to a network
   problem.

       TERMINATE_OR_BUFFER                                      0
       When the Direct-Debiting-Failure-Handling AVP is set to
       TERMINATE_OR_BUFFER the service MUST be granted as long as there
       is a connection to the credit control server. If the credit
       control client does not receive any Accounting-Answer message
       within the Tx timer (as defined in section 8) the credit control
       request is regarded failed. The client SHOULD terminate the
       service if it can determine from the failed answer that units
       have not been debited. Otherwise the credit control client
       SHOULD grant the service, store the request to application level
       non-volatile storage and try to re-send the request.  These
       requests MUST be marked as possible duplicate by setting the T-
       flag in the command header as described in [DIAMBASE] section 3.

       This is the default behaviour if the AVP isn't included in the
       reply from the authorization server.

       CONTINUE                                                1
       When the Direct-Debiting-Failure-Handling AVP is set to CONTINUE
       the service SHOULD be granted even if credit control messages
       can't be delivered.

4.8 Exponent AVP

   Exponent AVP is of type Integer32 (AVP code TBD) and contains the
   exponent value to be applied for the Value-Digit AVP within the Unit-
   Value AVP.


Hakala et al.              expires August 2003                  [Page 25]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

4.9 Final-Unit-Indication AVP

   The Final-Unit-Indication AVP (AVP Code TBD) is of type Unsigned32
   and indicates that the Granted-Service-Unit AVP in the accounting
   command contains the final units for the service. After these units
   have expired, the Diameter credit control client in a service element
   is responsible for terminating the service and sending the
   STOP_RECORD to the credit control server.
   If more than one unit types are received in the Accounting-Answer,
   the Unit type which first expired SHOULD cause the termination.
   If included in a command, the value of this AVP is always 1.

4.10 Granted-Service-Unit AVP

   Granted-Service-Unit AVP (AVP Code TBD) is of type Grouped and
   contains the amount of units that the Diameter credit control client
   can provide to the end user until the service must be released or the
   new Accounting-Request must be sent. The Unit-Value AVP contains the
   granted units and the Unit-Type AVP defines the type of the unit.

   If the Unit-Type AVP is set to time in the Accounting-Answer command,
   the Unit Value AVP specifies the granted time in seconds.

   If the Unit-Type AVP is set to volume in the Accounting-Answer
   command, the Unit-Value AVP specifies the granted volume in bytes.

   If the Unit-Type AVP is set to service specific in the Accounting-
   Answer command, the Unit-Value AVP specifies the granted number of
   service specific units (e.g. number of events, points) given in a
   selected service.

   If the Unit-Type AVP is set to money in the Accounting-Answer
   command, the Unit-Value AVP specifies the granted monetary amount in
   the given currency. If the unit type is money, a Currency-Code AVP
   SHOULD be included.

   It has the following ABNF grammar:

          <Granted-Service-Unit>::=< AVP Header: TBD >
                                       { Unit-Type }
                                       { Unit-Value }
                                       [ Currency-Code ]
4.11 Requested-Action AVP

   The Requested-Action AVP (AVP Code TBD) is type of Enumerated and
   contains the requested action being sent by Accounting-Request
   command where the Accounting-Record-Type is set to EVENT_RECORD.
   The following values are defined for the Requested-Action AVP:

       DIRECT DEBITING                              0




Hakala et al.              expires August 2003                  [Page 26]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

       Direct debiting indicates that the request is to decrease the
       end user's account according to information specified in the
       Requested-Service-Unit AVP and/or Service-Parameter-Info AVP.
       The Granted-Service Unit AVP in the Accounting-Answer command
       contains the debited units.

       REFUND ACCOUNT                               1
       Refund account indicates that the request is to increase the end
       user's account according to information specified in the
       Requested-Service-Unit AVP and/or Service-Parameter-Info AVP.
       The Granted-Service Unit AVP in the Accounting-Answer command
       contains the refunded units.

       CHECK_BALANCE                                2
       Check balance indicates that the request is a balance check
       request. In this case the checking of the account balance is
       done without any credit reservation from the account. The Check-
       Balance-Result AVP in the Accounting-Answer command contains the
       result of the Balance Check.

       PRICE_ENQUIRY                                3
       Price Enquiry indicates that the request is a price enquiry
       request. In this case neither checking of the account balance
       nor reservation from the account will be done, only the price of
       the service will be returned in the Cost-Information AVP in the
       Accounting-Answer Command.

4.12 Requested-Service-Unit AVP

   The Requested-Service-Unit AVP (AVP Code TBD) is of type Grouped and
   contains the amount of requested units specified by the Diameter
   credit control client. The included Unit-Value AVP contains the
   requested Unit-Value and the Unit-Type AVP defines the type of the
   unit. A server is not required to implement all of the unit types,
   and must treat unknown or unsupported unit types as invalid AVP
   values.

   If the Unit Type AVP is set to time in the Accounting-Request
   command, the Unit-Value AVP specifies the requested time in seconds.

   If the Unit-type AVP is set to volume in the Accounting-Request
   command, the Unit-Value AVP specifies the requested volume in bytes.

   If the Unit-type AVP is set to service specific in the Accounting-
   Request command, the Unit-Value AVP specifies the requested
   number of service specific units (e.g. number of events) given in a
   selected service.

   If the Unit-Type AVP is set to money in the Accounting-Request
   command, the Unit-Value AVP specifies the monetary amount in the
   given currency. If the unit type is money, a Currency-Code AVP SHOULD
   be included.

   It has the following ABNF grammar:


Hakala et al.              expires August 2003                  [Page 27]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

          <Requested-Service-Unit>::=< AVP Header: TBD >
                                   { Unit-Type }
                                   { Unit-Value }
                                   [ Currency-Code ]


4.13 Service-Parameter-Info AVP

   The Service-Parameter-Info AVP (AVP Code TBD) is of type Grouped and
   contains a service specific information used for price calculation
   or rating. The Service-Parameter-Type AVP defines the service
   parameter type and the Service-Parameter-Value AVP contains the
   parameter value. The actual contents of these AVPs are not within
   the scope of this document and SHOULD be defined in another Diameter
   application, standards written by other standardization bodies, or
   service specific documentation.

   In case of unknown service request (e.g. unknown Service-Parameter-
   Type), the corresponding answer message MUST contain the error code
   DIAMETER_RATING_FAILED. An Accounting Answer message with this error
   MUST contain one or more Failed-AVP AVPs containing the Service-
   Parameter-Info AVPs that caused the failure.

   It has the following ABNF grammar:

          <Service-Parameter-Info>::=< AVP Header: TBD >
                                   [ Service-Parameter-Type ]
                                   [ Service-Parameter-Value ]

4.14 Service-Parameter-Type AVP

   The Service-Parameter-Type AVP is of type Unsigned32 (AVP Code TBD)
   and defines the type of the service event specific parameter (e.g. it
   can be end-user location, service name). The different parameters and
   their types are service specific and the meanings of these parameters
   are not defined in this document. The Service-Parameter-Value AVP
   contains the service parameter type.

4.15 Service-Parameter-Value AVP

   The Service-Parameter-Value AVP is of type UTF8String (AVP Code TBD)
   and contains the value of the service parameter type.

4.16 Subscription-Id AVP

   The Subscription-Id AVP (AVP Code TBD) is used to identify the end
   user's subscription and is of type Grouped.  The Subscription-Id AVP
   includes a Subscription-Id-Data AVP that hold the identifier and a
   Subscription-Id-Type AVP that defines the identifier type.

   It has the following ABNF grammar:

Hakala et al.              expires August 2003                  [Page 28]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003


                 <Subscription-Id>::=< AVP Header: TBD >
                                   { Subscription-Id-Data }
                                   { Subscription-Id-Type }

4.17 Subscription-Id-Data AVP

   The Subscription-Id-Data AVP (AVP Code TBD) is used to identify the
   end-user and is of type UTF8String. The Subscription-Id-Type AVP
   defines which type of identifier is used.

4.18 Subscription-Id-Type AVP

   The Subscription-Id-Type AVP (AVP Code TBD) is of type Enumerated and
   it is used to determine which type of identifier that is carried by
   the Subscription-Id AVP. A server is not required to implement all
   of the Subscription-Id-Types, and MUST treat unknown or unsupported
   Subscription-Id-Types as invalid AVP values.

   The identifier can be one of the following:

      END_USER_MSISDN                                              0
           The identifier is in international MSISDN format, according
           to the ITU-T E.164 numbering plan as defined in [E164] and
           [CE164].

       END_USER_IMSI                                                1
           The identifier is in international IMSI format, according to
           the ITU-T E.212 numbering plan as defined in [E121] and
           [CE121].

       END_USER_SIP_URL                                             2
          The identifier is in the form of a SIP URL as defined in
          [SIP].

       END_USER_NAI                                                 3
           The identifier is in the form of a Network Access Identifier
           as defined in [NAI].

       END_USER_PRIVATE                                             4
           The Identifier is a credit control server private identifier.

4.19 Unit-Type AVP

   The Unit-Type AVP is of type Enumerated (AVP Code TBD) and contains
   the type of the unit.
   The unit type can be one of the following:

       CREDIT_TYPE_TIME                                             0
       The unit is of type time, given in seconds.

       CREDIT_TYPE_VOLUME                                           1
       The unit is of type volume, given in bytes.



Hakala et al.              expires August 2003                  [Page 29]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

       CREDIT_TYPE_SERVICE_SPECIFIC                                 2
       The unit is service specific (e.g. number of events,
       points, chips, services etc), given in a selected service.

       CREDIT_TYPE_MONEY                                            3
       The unit is of type money, given as a monetary value, whose
       currency SHOULD be specified by the Currency-Code AVP.

4.20 Unit-Value AVP

   Unit-Value AVP is of type Grouped (AVP Code TBD). The value can be
   time in seconds, volume in bytes, number of service specific units or
   monetary amount depending on the given unit type. The Unit-Value is a
   value together with an exponent, i.e. Unit-Value = Value-Digits AVP *
   10^Exponent. This representation avoids unwanted rounding off. For
   example the value of 2,3 is represented as Value-Digits = 23 and
   Exponent = -1. The absence of exponent part MUST be interpreted as
   exponent being equal to zero.

   It has the following ABNF grammar:

                <Unit-Value>::=< AVP Header: TBD >
                             { Value-Digits }
                             [ Exponent ]

4.21 Used-Service-Unit AVP

   The Used-Service-Unit AVP is of type Grouped AVP (AVP Code TBD) and
   contains the amount of used units measured from the point when the
   service became active or, in case of interim interrogations are used
   during the session, from the point when the previous measurement
   ended. The included Unit-Type AVP defines the type of the unit and
   the Unit-Value AVP contains the used amount.

   If the Unit Type AVP is set to time in the Accounting-Request
   command, the Unit-Value AVP specifies the used time in seconds.

   If the Unit-Type AVP is set to volume in the Accounting-Request
   command, the Unit-Value AVP specifies the used volume in bytes.

   If the Unit-type AVP is set to service specific in the Accounting-
   Request command, the Unit-Value AVP specifies the used number of
   service specific units (e.g. number of events) given in a selected
   service.

   If the Unit-Type AVP is set to money in the Accounting-Request
   command, the Unit-Value AVP specifies the used monetary amount in the
   given currency. If the unit type is money, a Currency-Code AVP SHOULD
   be included.

   It has the following ABNF grammar:



Hakala et al.              expires August 2003                  [Page 30]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

              <Used-Service-Unit>::=< AVP Header: TBD >
                                   { Unit-Type }
                                   { Unit-Value }
                                   [ Currency-Code ]

4.22 Value-Digits AVP

   The Value-Digits AVP is of type Unsigned64 (AVP code TBD) and
   contains the number of seconds, volume in bytes, number of service
   specific units or monetary amount depending on the given Unit-Type
   AVP. If decimal values are needed to present the units, the scaling
   MUST be indicated with the related Exponent AVP. For example for the
   monetary amount $ 0,05 the value of Value-Digits AVP MUST be set to 5
   and the scaling MUST be indicated with the Exponent AVP set to û2.

5 Result Code AVP values

   This section defines new Result-Code AVP [DIAMBASE] values that must
   be supported by all Diameter implementations that conform to this
   specification.

   The Accounting-Answer message includes the Result-Code AVP, which MAY
   indicate that an error was present in the Accounting-Request message.
   A rejected Accounting-Request message SHOULD cause the userÆs session
   to be terminated.

5.1 Transient Failure

   Errors that fall within the transient failures category are used to
   inform a peer that the request could not be satisfied at the time it
   was received, but MAY be able to satisfy the request in the future.

     DIAMETER_END_USER_SERVICE_DENIED                         40XX
     The credit control server denies the service request due to
     service restrictions or limitations related to the end-user,
     for example the end-user's account could not cover the requested
     service. The possibly reported used-service-units with the ACR
     are deducted.

     DIAMETER_CREDIT_CONTROL_NOT_APPLICABLE                   40XX
     The credit control server determines that the service can be
     granted to the end user but no further credit control is needed
     for the service (e.g. service is free of charge).

5.2 Permanent Failures

   Errors that fall within permanent failure category are used to inform
   the peer that the request failed, and should not be attempted again.

      DIAMETER_USER_UNKNOWN                                    50XX
      The specified end user is unknown in the credit control server.

      DIAMETER_RATING_FAILED                                   50xx
      This error code is used to inform the credit control client that
      the credit control server cannot rate the service request due to
      insufficient rating input, incorrect AVP combination or due to
      an AVP or an AVP value that is not recognized or supported in the
      rating. The Failed-AVP AVP MUST be included and contain a copy of
      the entire AVP(s) that could not be processed successfully or an
      example of the missing AVP complete with the Vendor-Id if applicable.
      The value field of the missing AVP should be of correct minimum
      length and contain zeroes.


6 AVP Occurrence Table


Hakala et al.              expires August 2003                  [Page 31]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003


   The following table presents the AVPs defined in this document, and
   specifies in which Diameter messages they MAY, or MAY NOT be present.
   Note that AVPs that can only be present within a Grouped AVP are not
   represented in this table.

   The table uses the following symbols:
         0     The AVP MUST NOT be present in the message.
         0+    Zero or more instances of the AVP MAY be present in the
               message.
         0-1   Zero or one instance of the AVP MAY be present in the
               message. It is considered an error if there are more than
               once instance of the AVP.
         1     One instance of the AVP MUST be present in the message.
         1+    At least one instance of the AVP MUST be present in the
               message.

6.1 Accounting AVP Table

   The table in this section is used to represent which Credit Control
   applications specific AVPs defined in this document are to be present
   in the accounting messages.

                                    +-----------+
                                    |  Command  |
                                    |    Code   |
                                    |-----+-----+
      Attribute Name                | ACR | ACA |
      ------------------------------|-----+-----+
      Abnormal-Termination-Reason   | 0-1 | 0   |
      Accounting-Correlation-Id     | 0-1 | 0   |
      Credit-Control-Failure-       | 0-1 | 0-1 |
      Handling                      |     |     |
      Check-Balance-Result          | 0   | 0-1 |
      Cost-Information              | 0   | 0-1 |
      Direct-Debiting-Failure-      | 0   | 0   |
      Handling AVP                  |     |     |
      Final-Unit-Indication         | 0   | 0-1 |
      Granted-Service-Unit          | 0   | 0+  |
      Requested-Action              | 0-1 | 0   |
      Requested-Service-Unit        | 0-1 | 0   |
      Service-Parameter-Info        | 0+  | 0   |
      Subscription-Id               | 0-1 | 0-1 |
      Used-Service-Unit             | 0+  | 0   |
      ------------------------------|-----+-----+

7 IANA Considerations

   This section contains the namespaces that have either been created in
   this specification, or the values assigned to existing namespaces
   managed by IANA.

7.1 Application Identifier

Hakala et al.              expires August 2003                  [Page 32]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003


   This specification assigns the value TBD to the Application
   Identifier namespace defined in [DIAMBASE]. See section 1.3 for more
   information.

7.2 Command Codes

   This specification uses the value 271 from the Command code namespace
   defined in [DIAMBASE].

7.3 AVP Codes

   This specification assigns the values TBD - TBD from the AVP code
   namespace defined in [DIAMBASE] See section 4.0 for the assignment of
   the namespace in this specification.

7.4 Result-Code AVP Values

   This specification assigns the values 40XX and 50XX from the Result-
   Code AVP (AVP Code 268) value namespace defined in [DIAMBASE]. See
   section 5.0 for the assignment of the namespace in this
   specification.

7.5 Abnormal-Termination-Reason AVP

   As defined in Section 4.1, the Abnormal-Termination-Reason AVP (AVP
   Code TBD) defines the values 0-1. All remaining values are available
   for assignment via Designated Expert [IANA].

7.6 Check-Balance-Result AVP

   As defined in Section 4.3, the Check-Balance-Result AVP (AVP Code
   TBD) defines the values 0-1. All remaining values are available for
   assignment via Designated Expert [IANA].

7.7 Credit-Control-Failure-Handling AVP

   As defined in Section 4.6, the Credit-Control-Failure-Handling AVP
   (AVP Code TBD) defines the values 0-1. All remaining values are
   available for assignment via Designated Expert [IANA].

7.8 Direct-Debiting-Failure-Handling AVP

   As defined in Section 4.8, the Direct-Debiting-Failure-Handling AVP
   (AVP Code TBD) defines the values 0-1. All remaining values are
   available for assignment via Designated Expert [IANA].

7.9 Requested-Action AVP

   As defined in Section 4.11, the Requested-Action AVP (AVP Code TBD)
   defines the values 0-3. All remaining values are available for
   assignment via Designated Expert [IANA].


Hakala et al.              expires August 2003                  [Page 33]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

7.10 Subscription-Id-Type AVP

   As defined in Section 4.17, the Subscription-Id-Type AVP (AVP Code
   TBD) defines the values 0-4. All remaining values are available for
   assignment via Designated Expert [IANA].

7.11 Unit-Type AVP

   As defined in Section 4.20, the Unit-Type AVP (AVP Code TBD) defines
   the values 0-3. All remaining values are available for assignment via
   Designated Expert [IANA].

8  Credit Control Application related parameter

   Tx timer
     When real-time credit control is required, the credit control
     client contacts the credit control server before and during the
     service is provided to an end user. Due to real-time nature of
     application the communication delays SHOULD be minimized, e.g. to
     avoid too long service set up time experienced by the end user. The
     Tx timer is introduced to control the waiting time in the client in
     the PENDING state.

    The recommended value is 10 seconds.

9  Security Considerations

   The security models as defined in the Diameter base protocol
   [DIAMBASE] applies to this application too.

10 References

10.1 Normative

[DIAMBASE]  P. Calhoun, J. Arkko, E. Guttman, G. Zorn, J. Loughney
            "Diameter Base Protocol", draft-ietf-aaa-diameter-17.txt,
            IETF work in progress, December 2003.

[3GPPCHARG]  3rd Generation Partnership Project; Technical Specification
            Group Services and System Aspects, Service aspects;
            Charging and Billing, (release 5), 3GPP TS 22.115 v. 5.2.1,
            2003-03

[SIP]       M. Handley, H. Schulzrinne, E. Schooler, J. Rosenberg, G.
            Camarillo, A. Johnston, J. Peterson, R. Sparks
            "SIP: Session Initiation Protocol", RFC 3261. June 2003.

[NAI]       Aboba, Beadles "The Network Access Identifier." RFC 2486.
            January 1999.

[E164]      Recommendation E.164/I.331 (05/97): The International
            Public Telecommunication Numbering Plan. 1997.


Hakala et al.              expires August 2003                  [Page 34]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

[CE164]     Complement to ITU-T Recommendation E.164 (05/1997):"List of
            ITU-T Recommendation E.164 assigned country codes", June
            2000.

[E212]      Recommendation E.212 (11/98): The international
            identification plan for mobile terminals and mobile users.
            1998.

[CE212]     Complement to ITU-T Recommendation E.212 (11/1997):" List
            of mobile country or geographical area codes ", February
            1999.

[IANA]      Narten, Alvestrand, "Guidelines for Writing an IANA
            Considerations Section in RFCs", BCP 26, RFC 2434, October
            1998

10.2 Non-Normative

[KEYWORDS]  S.Bradner, "Key words for use in RFCs to Indicate
            Requirement Levelsö, BCP 14, RFC 2119, August 1997.

[ACCMGMT]   B.Aboba, J.Arkko, D.Harrington. "Introduction to Accounting
            Management", RFC 2975, October 2000.

11 Acknowledgement

   The authors would like to thank Paco Marin at Vodafone R&D and our
   colleagues with Ericsson and Nokia for their comments and
   suggestions.

12 Author's Address

     Harri Hakala
     Oy L M Ericsson Ab
     Joukahaisenkatu 1
     20520 Turku
     Finland

     Phone: +358 2 265 3722
     EMail: Harri.Hakala@ericsson.fi

     Leena Mattila
     Oy L M Ericsson Ab
     Joukahaisenkatu 1
     20520 Turku
     Finland

    Phone: +358 2 265 3731
    EMail: Leena.Mattila@ericsson.fi

    Juha-Pekka Koskinen
    Nokia Networks
    Hatanpaanvaltatie 30

Hakala et al.              expires August 2003                  [Page 35]


INTERNET-DRAFT    Diameter Credit Control Application    February, 2003

    33100 Tampere
    Finlad

    Phone: +358 7180 74027
    Email: juha-pekka.koskinen@nokia.com

    Marco Stura
    Nokia Networks
    Valimotie 21
    00380 Helsinki

    Phone: +358 7180 64308
    Email: marco.stura@nokia.com

    John Loughney
    Nokia Research Center
    Itamerenkatu 11-13
    00180 Helsinki

    Phone: +358 50 483 642
    Email: john.Loughney@nokia.com


13 Full Copyright Statement

   Copyright (C) The Internet Society (2003). All Rights Reserved.

   This document and translations of it MAY be copied and furnished to
   others, and derivative works that comment on or otherwise explain it
   or assist in its implementation MAY be prepared, copied, published
   and distributed, in whole or in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph are
   included on all such copies and derivative works. However, this docu-
   ment itself MAY not be modified in any way, such as by removing the
   copyright notice or references to the Internet Society or other
   Internet organizations, except as needed for the purpose of
   developing Internet standards in which case the procedures for
   copyrights defined in the Internet Standards process must be
   followed, or as required to translate it into languages other than
   English. The limited permissions granted above are perpetual and will
   not be revoked by the Internet Society or its successors or assigns.
   This document and the information contained herein is provided on an
   "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
   TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
   BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
   HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

14 Expiration Date

   This memo is filed as <draft-hakala-diameter-credit-control-06.txt>
   and expires in August 2003.










Hakala et al.              expires August 2003                  [Page 36]