# SipSession.Listener

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Listener

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/net/sip/SipSession.Listener "View this page in Java")  

```
class Listener
```

|---|----------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                             ||
| ↳ | [android.net.sip.SipSession.Listener](https://developer.android.com/reference/kotlin/android/net/sip/SipSession.Listener#) |

*** ** * ** ***

| **This class was deprecated in API level 31.**
|
| Deprecated in Java.

Listener for events relating to a SIP session, such as when a session is being registered ("on registering") or a call is outgoing ("on calling").

Many of these events are also received by[SipAudioCall.Listener](https://developer.android.com/reference/kotlin/android/net/sip/SipAudioCall.Listener).

## Summary

|                                                   Public constructors                                                   ||
|----------------------------------------------------------------------------------------------------------------------|---|
| [Listener](https://developer.android.com/reference/kotlin/android/net/sip/SipSession.Listener#Listener())`()` <br /> |

|                                                                                                                                                                                                                                                                                                                     Public methods                                                                                                                                                                                                                                                                                                                     ||
|----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onCallBusy](https://developer.android.com/reference/kotlin/android/net/sip/SipSession.Listener#onCallBusy(android.net.sip.SipSession))`(`session:` `[SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!`)` Called when the peer is busy during session initialization.                                                                                                                                                                                                                                                         |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onCallChangeFailed](https://developer.android.com/reference/kotlin/android/net/sip/SipSession.Listener#onCallChangeFailed(android.net.sip.SipSession,%20kotlin.Int,%20kotlin.String))`(`session:` `[SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!`, `errorCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `errorMessage:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Called when an error occurs during session modification negotiation. |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onCallEnded](https://developer.android.com/reference/kotlin/android/net/sip/SipSession.Listener#onCallEnded(android.net.sip.SipSession))`(`session:` `[SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!`)` Called when the session is terminated.                                                                                                                                                                                                                                                                            |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onCallEstablished](https://developer.android.com/reference/kotlin/android/net/sip/SipSession.Listener#onCallEstablished(android.net.sip.SipSession,%20kotlin.String))`(`session:` `[SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!`, `sessionDescription:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Called when the session is established.                                                                                                                                   |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onCalling](https://developer.android.com/reference/kotlin/android/net/sip/SipSession.Listener#onCalling(android.net.sip.SipSession))`(`session:` `[SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!`)` Called when an INVITE request is sent to initiate a new call.                                                                                                                                                                                                                                                         |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onError](https://developer.android.com/reference/kotlin/android/net/sip/SipSession.Listener#onError(android.net.sip.SipSession,%20kotlin.Int,%20kotlin.String))`(`session:` `[SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!`, `errorCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `errorMessage:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Called when an error occurs during session initialization and termination.                 |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onRegistering](https://developer.android.com/reference/kotlin/android/net/sip/SipSession.Listener#onRegistering(android.net.sip.SipSession))`(`session:` `[SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!`)` Called when a registration request is sent.                                                                                                                                                                                                                                                                   |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onRegistrationDone](https://developer.android.com/reference/kotlin/android/net/sip/SipSession.Listener#onRegistrationDone(android.net.sip.SipSession,%20kotlin.Int))`(`session:` `[SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!`, `duration:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called when registration is successfully done.                                                                                                                                              |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onRegistrationFailed](https://developer.android.com/reference/kotlin/android/net/sip/SipSession.Listener#onRegistrationFailed(android.net.sip.SipSession,%20kotlin.Int,%20kotlin.String))`(`session:` `[SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!`, `errorCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `errorMessage:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Called when the registration fails.                              |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onRegistrationTimeout](https://developer.android.com/reference/kotlin/android/net/sip/SipSession.Listener#onRegistrationTimeout(android.net.sip.SipSession))`(`session:` `[SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!`)` Called when the registration gets timed out.                                                                                                                                                                                                                                                  |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onRinging](https://developer.android.com/reference/kotlin/android/net/sip/SipSession.Listener#onRinging(android.net.sip.SipSession,%20android.net.sip.SipProfile,%20kotlin.String))`(`session:` `[SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!`, `caller:` `[SipProfile](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile)!`, `sessionDescription:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Called when an INVITE request is received.            |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onRingingBack](https://developer.android.com/reference/kotlin/android/net/sip/SipSession.Listener#onRingingBack(android.net.sip.SipSession))`(`session:` `[SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!`)` Called when a RINGING response is received for the INVITE request sent                                                                                                                                                                                                                                        |

## Public constructors

### Listener

```
Listener()
```

## Public methods

### onCallBusy

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onCallBusy(session: SipSession!): Unit
```

**Deprecated:** *Deprecated in Java.*

Called when the peer is busy during session initialization.

|                                                                       Parameters                                                                        ||
|-----------|----------------------------------------------------------------------------------------------------------------------------------------------|
| `session` | [SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!:the session object that carries out the transaction |

### onCallChangeFailed

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onCallChangeFailed(
    session: SipSession!, 
    errorCode: Int, 
    errorMessage: String!
): Unit
```

**Deprecated:** *Deprecated in Java.*

Called when an error occurs during session modification negotiation.

|                                                                                                 Parameters                                                                                                  ||
|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `session`      | [SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!:the session object that carries out the transaction                                                |
| `errorCode`    | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):error code defined in[SipErrorCode](https://developer.android.com/reference/kotlin/android/net/sip/SipErrorCode) |
| `errorMessage` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:error message                                                                                             |

### onCallEnded

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onCallEnded(session: SipSession!): Unit
```

**Deprecated:** *Deprecated in Java.*

Called when the session is terminated.

|                                                                        Parameters                                                                         ||
|-----------|------------------------------------------------------------------------------------------------------------------------------------------------|
| `session` | [SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!:the session object that is associated with the dialog |

### onCallEstablished

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onCallEstablished(
    session: SipSession!, 
    sessionDescription: String!
): Unit
```

**Deprecated:** *Deprecated in Java.*

Called when the session is established.

|                                                                              Parameters                                                                              ||
|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
| `session`            | [SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!:the session object that is associated with the dialog |
| `sessionDescription` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the peer's session description                               |

### onCalling

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onCalling(session: SipSession!): Unit
```

**Deprecated:** *Deprecated in Java.*

Called when an INVITE request is sent to initiate a new call.

|                                                                       Parameters                                                                        ||
|-----------|----------------------------------------------------------------------------------------------------------------------------------------------|
| `session` | [SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!:the session object that carries out the transaction |

### onError

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onError(
    session: SipSession!, 
    errorCode: Int, 
    errorMessage: String!
): Unit
```

**Deprecated:** *Deprecated in Java.*

Called when an error occurs during session initialization and termination.

|                                                                                                 Parameters                                                                                                  ||
|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `session`      | [SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!:the session object that carries out the transaction                                                |
| `errorCode`    | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):error code defined in[SipErrorCode](https://developer.android.com/reference/kotlin/android/net/sip/SipErrorCode) |
| `errorMessage` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:error message                                                                                             |

### onRegistering

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onRegistering(session: SipSession!): Unit
```

**Deprecated:** *Deprecated in Java.*

Called when a registration request is sent.

|                                                                       Parameters                                                                        ||
|-----------|----------------------------------------------------------------------------------------------------------------------------------------------|
| `session` | [SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!:the session object that carries out the transaction |

### onRegistrationDone

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onRegistrationDone(
    session: SipSession!, 
    duration: Int
): Unit
```

**Deprecated:** *Deprecated in Java.*

Called when registration is successfully done.

|                                                                        Parameters                                                                        ||
|------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| `session`  | [SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!:the session object that carries out the transaction |
| `duration` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):duration in second before the registration expires                |

### onRegistrationFailed

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onRegistrationFailed(
    session: SipSession!, 
    errorCode: Int, 
    errorMessage: String!
): Unit
```

**Deprecated:** *Deprecated in Java.*

Called when the registration fails.

|                                                                                                 Parameters                                                                                                  ||
|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `session`      | [SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!:the session object that carries out the transaction                                                |
| `errorCode`    | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):error code defined in[SipErrorCode](https://developer.android.com/reference/kotlin/android/net/sip/SipErrorCode) |
| `errorMessage` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:error message                                                                                             |

### onRegistrationTimeout

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onRegistrationTimeout(session: SipSession!): Unit
```

**Deprecated:** *Deprecated in Java.*

Called when the registration gets timed out.

|                                                                       Parameters                                                                        ||
|-----------|----------------------------------------------------------------------------------------------------------------------------------------------|
| `session` | [SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!:the session object that carries out the transaction |

### onRinging

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onRinging(
    session: SipSession!, 
    caller: SipProfile!, 
    sessionDescription: String!
): Unit
```

**Deprecated:** *Deprecated in Java.*

Called when an INVITE request is received.

|                                                                             Parameters                                                                             ||
|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| `session`            | [SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!:the session object that carries out the transaction |
| `caller`             | [SipProfile](https://developer.android.com/reference/kotlin/android/net/sip/SipProfile)!:the SIP profile of the caller                       |
| `sessionDescription` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the caller's session description                           |

### onRingingBack

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onRingingBack(session: SipSession!): Unit
```

**Deprecated:** *Deprecated in Java.*

Called when a RINGING response is received for the INVITE request sent

|                                                                       Parameters                                                                        ||
|-----------|----------------------------------------------------------------------------------------------------------------------------------------------|
| `session` | [SipSession](https://developer.android.com/reference/kotlin/android/net/sip/SipSession)!:the session object that carries out the transaction |