Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/net/sip/SipAudioCall#nestedclasses) \| [Ctors](https://developer.android.com/reference/android/net/sip/SipAudioCall#pubctors) \| [Methods](https://developer.android.com/reference/android/net/sip/SipAudioCall#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/sip/SipAudioCall#inhmethods)

# SipAudioCall

*** ** * ** ***


`
public


class
SipAudioCall
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.sip.SipAudioCall |

<br />

*** ** * ** ***


**This class was deprecated
in API level 31.**   

`https://developer.android.com/reference/android/net/sip/SipManager` and associated classes are no longer supported and
should not be used as the basis of future VOIP apps.

Handles an Internet audio call over SIP. You can instantiate this class with `https://developer.android.com/reference/android/net/sip/SipManager`,
using `https://developer.android.com/reference/android/net/sip/SipManager#makeAudioCall(android.net.sip.SipProfile,%20android.net.sip.SipProfile,%20android.net.sip.SipAudioCall.Listener,%20int)` and `https://developer.android.com/reference/android/net/sip/SipManager#takeAudioCall(android.content.Intent,%20android.net.sip.SipAudioCall.Listener)`.

**Note:** Using this class require the
`https://developer.android.com/reference/android/Manifest.permission#INTERNET` and
`https://developer.android.com/reference/android/Manifest.permission#USE_SIP` permissions. In addition, `https://developer.android.com/reference/android/net/sip/SipAudioCall#startAudio()` requires the
`https://developer.android.com/reference/android/Manifest.permission#RECORD_AUDIO`,
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_WIFI_STATE`, and
`https://developer.android.com/reference/android/Manifest.permission#WAKE_LOCK` permissions; and `https://developer.android.com/reference/android/net/sip/SipAudioCall#setSpeakerMode(boolean)` requires the
`https://developer.android.com/reference/android/Manifest.permission#MODIFY_AUDIO_SETTINGS` permission.

### Developer Guides

For more information about using SIP, read the
[Session Initiation Protocol](https://developer.android.com/guide/topics/network/sip)
developer guide.

<br />

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/net/sip/SipAudioCall.Listener` Listener for events relating to a SIP call, such as when a call is being received ("on ringing") or a call is outgoing ("on calling"). |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/net/sip/SipAudioCall#SipAudioCall(android.content.Context,%20android.net.sip.SipProfile)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/android/net/sip/SipProfile localProfile) ` Creates a call object with the local SIP profile. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#answerCall(int)(int timeout) ` Answers a call. |
| ` void` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#attachCall(android.net.sip.SipSession,%20java.lang.String)(https://developer.android.com/reference/android/net/sip/SipSession session, https://developer.android.com/reference/java/lang/String sessionDescription) ` Attaches an incoming call to this call object. |
| ` void` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#close()() ` Closes this object. |
| ` void` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#continueCall(int)(int timeout) ` Continues a call that's on hold. |
| ` void` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#endCall()() ` Ends a call. |
| ` https://developer.android.com/reference/android/net/sip/SipProfile` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#getLocalProfile()() ` Gets the local SIP profile. |
| ` https://developer.android.com/reference/android/net/sip/SipProfile` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#getPeerProfile()() ` Gets the peer's SIP profile. |
| ` int` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#getState()() ` Gets the state of the `https://developer.android.com/reference/android/net/sip/SipSession` that carries this call. |
| ` void` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#holdCall(int)(int timeout) ` Puts a call on hold. |
| ` boolean` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#isInCall()() ` Checks if the call is established. |
| ` boolean` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#isMuted()() ` Checks if the call is muted. |
| ` boolean` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#isOnHold()() ` Checks if the call is on hold. |
| ` void` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#makeCall(android.net.sip.SipProfile,%20android.net.sip.SipSession,%20int)(https://developer.android.com/reference/android/net/sip/SipProfile peerProfile, https://developer.android.com/reference/android/net/sip/SipSession sipSession, int timeout) ` Initiates an audio call to the specified profile. |
| ` void` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#sendDtmf(int)(int code) ` Sends a DTMF code. |
| ` void` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#sendDtmf(int,%20android.os.Message)(int code, https://developer.android.com/reference/android/os/Message result) ` Sends a DTMF code. |
| ` void` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#setListener(android.net.sip.SipAudioCall.Listener,%20boolean)(https://developer.android.com/reference/android/net/sip/SipAudioCall.Listener listener, boolean callbackImmediately) ` Sets the listener to listen to the audio call events. |
| ` void` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#setListener(android.net.sip.SipAudioCall.Listener)(https://developer.android.com/reference/android/net/sip/SipAudioCall.Listener listener) ` Sets the listener to listen to the audio call events. |
| ` void` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#setSpeakerMode(boolean)(boolean speakerMode) ` Puts the device to speaker mode. |
| ` void` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#startAudio()() ` Starts the audio for the established call. |
| ` void` | ` https://developer.android.com/reference/android/net/sip/SipAudioCall#toggleMute()() ` Toggles mute. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Public constructors

### SipAudioCall

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

```
public SipAudioCall (Context context, 
                SipProfile localProfile)
```

Creates a call object with the local SIP profile.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: the context for accessing system services such as ringtone, audio, WIFI etc <br /> |
| `localProfile` | `SipProfile` <br /> |

## Public methods

### answerCall

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

```
public void answerCall (int timeout)
```

Answers a call. The attempt will be timed out if the call is not
established within `timeout` seconds and
`https://developer.android.com/reference/android/net/sip/SipAudioCall.Listener#onError(android.net.sip.SipAudioCall,%20int,%20java.lang.String)`
will be called.

<br />

| Parameters ||
|---|---|
| `timeout` | `int`: the timeout value in seconds. Default value (defined by SIP protocol) is used if `timeout` is zero or negative. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/net/sip/SipException` | if the SIP service fails to answer the call |

**See also:**

- `https://developer.android.com/reference/android/net/sip/SipAudioCall.Listener#onError(android.net.sip.SipAudioCall,%20int,%20java.lang.String)`

### attachCall

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

```
public void attachCall (SipSession session, 
                String sessionDescription)
```

Attaches an incoming call to this call object.

<br />

| Parameters ||
|---|---|
| `session` | `SipSession`: the session that receives the incoming call <br /> |
| `sessionDescription` | `String`: the session description of the incoming call <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/net/sip/SipException` | if the SIP service fails to attach this object to the session or VOIP API is not supported by the device |

**See also:**

- `https://developer.android.com/reference/android/net/sip/SipManager#isVoipSupported(android.content.Context)`

### close

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

```
public void close ()
```

Closes this object. This object is not usable after being closed.

<br />

### continueCall

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

```
public void continueCall (int timeout)
```

Continues a call that's on hold. When succeeds,
`https://developer.android.com/reference/android/net/sip/SipAudioCall.Listener#onCallEstablished(android.net.sip.SipAudioCall)` is called. The attempt will be timed
out if the call is not established within `timeout` seconds and
`https://developer.android.com/reference/android/net/sip/SipAudioCall.Listener#onError(android.net.sip.SipAudioCall,%20int,%20java.lang.String)`
will be called.

<br />

| Parameters ||
|---|---|
| `timeout` | `int`: the timeout value in seconds. Default value (defined by SIP protocol) is used if `timeout` is zero or negative. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/net/sip/SipException` | if the SIP service fails to unhold the call |

**See also:**

- `https://developer.android.com/reference/android/net/sip/SipAudioCall.Listener#onError(android.net.sip.SipAudioCall,%20int,%20java.lang.String)`

### endCall

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

```
public void endCall ()
```

Ends a call.

<br />

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/net/sip/SipException` | if the SIP service fails to end the call |

### getLocalProfile

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

```
public SipProfile getLocalProfile ()
```

Gets the local SIP profile.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/sip/SipProfile` | the local SIP profile <br /> |

### getPeerProfile

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

```
public SipProfile getPeerProfile ()
```

Gets the peer's SIP profile.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/sip/SipProfile` | the peer's SIP profile <br /> |

### getState

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

```
public int getState ()
```

Gets the state of the `https://developer.android.com/reference/android/net/sip/SipSession` that carries this call.
The value returned must be one of the states in `https://developer.android.com/reference/android/net/sip/SipSession.State`.

<br />

| Returns ||
|---|---|
| `int` | the session state <br /> |

### holdCall

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

```
public void holdCall (int timeout)
```

Puts a call on hold. When succeeds, `https://developer.android.com/reference/android/net/sip/SipAudioCall.Listener#onCallHeld(android.net.sip.SipAudioCall)` is
called. The attempt will be timed out if the call is not established
within `timeout` seconds and
`https://developer.android.com/reference/android/net/sip/SipAudioCall.Listener#onError(android.net.sip.SipAudioCall,%20int,%20java.lang.String)`
will be called.

<br />

| Parameters ||
|---|---|
| `timeout` | `int`: the timeout value in seconds. Default value (defined by SIP protocol) is used if `timeout` is zero or negative. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/net/sip/SipException` | if the SIP service fails to hold the call |

**See also:**

- `https://developer.android.com/reference/android/net/sip/SipAudioCall.Listener#onError(android.net.sip.SipAudioCall,%20int,%20java.lang.String)`

### isInCall

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

```
public boolean isInCall ()
```

Checks if the call is established.

<br />

| Returns ||
|---|---|
| `boolean` | true if the call is established <br /> |

### isMuted

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

```
public boolean isMuted ()
```

Checks if the call is muted.

<br />

| Returns ||
|---|---|
| `boolean` | true if the call is muted <br /> |

### isOnHold

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

```
public boolean isOnHold ()
```

Checks if the call is on hold.

<br />

| Returns ||
|---|---|
| `boolean` | true if the call is on hold <br /> |

### makeCall

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

```
public void makeCall (SipProfile peerProfile, 
                SipSession sipSession, 
                int timeout)
```

Initiates an audio call to the specified profile. The attempt will be
timed out if the call is not established within `timeout` seconds
and `https://developer.android.com/reference/android/net/sip/SipAudioCall.Listener#onError(android.net.sip.SipAudioCall,%20int,%20java.lang.String)`
will be called.

<br />

| Parameters ||
|---|---|
| `peerProfile` | `SipProfile`: the SIP profile to make the call to <br /> |
| `sipSession` | `SipSession`: the `https://developer.android.com/reference/android/net/sip/SipSession` for carrying out the call <br /> |
| `timeout` | `int`: the timeout value in seconds. Default value (defined by SIP protocol) is used if `timeout` is zero or negative. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/net/sip/SipException` | if the SIP service fails to create a session for the call or VOIP API is not supported by the device |

**See also:**

- `https://developer.android.com/reference/android/net/sip/SipAudioCall.Listener#onError(android.net.sip.SipAudioCall,%20int,%20java.lang.String)`
- `https://developer.android.com/reference/android/net/sip/SipManager#isVoipSupported(android.content.Context)`

### sendDtmf

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

```
public void sendDtmf (int code)
```

Sends a DTMF code. According to [RFC 2883](http://tools.ietf.org/html/rfc2833),
event 0--9 maps to decimal
value 0--9, '\*' to 10, '#' to 11, event 'A'--'D' to 12--15, and event
flash to 16. Currently, event flash is not supported.

<br />

| Parameters ||
|---|---|
| `code` | `int`: the DTMF code to send. Value 0 to 15 (inclusive) are valid inputs. <br /> |

### sendDtmf

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

```
public void sendDtmf (int code, 
                Message result)
```

Sends a DTMF code. According to [RFC 2883](http://tools.ietf.org/html/rfc2833),
event 0--9 maps to decimal
value 0--9, '\*' to 10, '#' to 11, event 'A'--'D' to 12--15, and event
flash to 16. Currently, event flash is not supported.

<br />

| Parameters ||
|---|---|
| `code` | `int`: the DTMF code to send. Value 0 to 15 (inclusive) are valid inputs. <br /> |
| `result` | `Message`: the result message to send when done <br /> |

### setListener

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

```
public void setListener (SipAudioCall.Listener listener, 
                boolean callbackImmediately)
```

Sets the listener to listen to the audio call events. A
`https://developer.android.com/reference/android/net/sip/SipAudioCall` can only hold one listener at a time. Subsequent
calls to this method override the previous listener.

<br />

| Parameters ||
|---|---|
| `listener` | `SipAudioCall.Listener`: to listen to the audio call events of this object <br /> |
| `callbackImmediately` | `boolean`: set to true if the caller wants to be called back immediately on the current state <br /> |

### setListener

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

```
public void setListener (SipAudioCall.Listener listener)
```

Sets the listener to listen to the audio call events. The method calls
`https://developer.android.com/reference/android/net/sip/SipAudioCall#setListener(android.net.sip.SipAudioCall.Listener)`.

<br />

| Parameters ||
|---|---|
| `listener` | `SipAudioCall.Listener`: to listen to the audio call events of this object <br /> |

**See also:**

- `https://developer.android.com/reference/android/net/sip/SipAudioCall#setListener(android.net.sip.SipAudioCall.Listener,%20boolean)`

### setSpeakerMode

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

```
public void setSpeakerMode (boolean speakerMode)
```

Puts the device to speaker mode.

**Note:** Requires the
`https://developer.android.com/reference/android/Manifest.permission#MODIFY_AUDIO_SETTINGS` permission.

<br />

<br />

| Parameters ||
|---|---|
| `speakerMode` | `boolean`: set true to enable speaker mode; false to disable <br /> |

### startAudio

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

```
public void startAudio ()
```

Starts the audio for the established call. This method should be called
after `https://developer.android.com/reference/android/net/sip/SipAudioCall.Listener#onCallEstablished(android.net.sip.SipAudioCall)` is called.

**Note:** Requires the
`https://developer.android.com/reference/android/Manifest.permission#RECORD_AUDIO`,
`https://developer.android.com/reference/android/Manifest.permission#ACCESS_WIFI_STATE` and
`https://developer.android.com/reference/android/Manifest.permission#WAKE_LOCK` permissions.

<br />

<br />

### toggleMute

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

```
public void toggleMute ()
```

Toggles mute.

<br />