> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Outgoing Call

> The screen a 1:1 call shows while it rings: the callee's name and avatar, a Calling… / Ringing… status line and an end button. It becomes the call when it is answered.

`CometChatOutgoingCall` is the screen a 1:1 call shows while it rings: the callee's name, a
status line — "Calling…", then "Ringing…" — their avatar, and a red end button. When the
callee answers, the same screen becomes the call; when the call ends unanswered, it says why
and comes down.

![CometChatOutgoingCall showing the callee's avatar, name, a ringing status and an end-call button](https://mintcdn.com/cometchat-22654f5b/pWDsskjSUHgot30F/images/ui-kit/ios/v6/docs-overview-outgoing-call.png?fit=max\&auto=format\&n=pWDsskjSUHgot30F\&q=85\&s=9a2425bc765b7c69282914dcacbbf2fe)

***

## Where It Fits

```
CometChatCallButtons ─ placed call ─▶ ┌────────────────────────────┐
call log's call-back ───────────────▶ │ CometChatOutgoingCall ← here│ ─ answered ─▶ the call (same screen)
                                      └────────────────────────────┘ ─ over ─────▶ dismissed
```

You rarely build it yourself. A tap on the [call buttons](https://www.cometchat.com/docs/ui-kit/ios/v6/call-buttons.md)
or on a call log's call-back button places the call and shows this screen. See
[Call Features](https://www.cometchat.com/docs/ui-kit/ios/v6/call-features.md).

> [tab] SwiftUI
>
> The screen is shown through `.cometChatCallPresenter()` when your app installs it at its root,
> otherwise from the component that placed the call.

> [tab] UIKit
>
> The screen is presented through `CometChatCallPresenter` when your app has started it,
> otherwise from the component that placed the call.

Group calls do not ring: a group tap joins a meeting on
[`CometChatOngoingCall`](https://www.cometchat.com/docs/ui-kit/ios/v6/ongoing-call).

***

## Quick Start

When you take `onCallInitiated` yourself, present the screen for the call.

> [tab] SwiftUI
>
> ```swift theme={null}
> struct ChatHeaderCalls: View {
>     @State private var ringing: Call?
>
>     var body: some View {
>         CometChatCallButtons(user: user, onCallInitiated: { call in ringing = call })
>             .fullScreenCover(isPresented: Binding(get: { ringing != nil },
>                                                   set: { if !$0 { ringing = nil } }),
>                              onDismiss: { CallCoordinator.shared.outgoingDismissed() }) {
>                 if let ringing { CometChatOutgoingCall(call: ringing) }
>             }
>     }
> }
> ```
>
> The ring timer, the cancel and the answer belong to the Kit's `CallCoordinator`, so the
> screen picks up the call the buttons placed rather than placing another.
>
> When you present the screen yourself, withdraw the call from your own dismissal, as `onDismiss`
> does above: `CallCoordinator.shared.outgoingDismissed()` withdraws a call that still rings and
> does nothing once it is over. The screen does not withdraw a call just because it went off
> screen — a push over it or a tab switch leaves the call ringing.

> [tab] UIKit
>
> ```swift theme={null}
> buttons.set(onCallInitiated: { call in
>     let ringing = CometChatOutgoingCall().set(call: call)
>     ringing.modalPresentationStyle = .fullScreen
>     present(ringing, animated: true)
> })
> ```
>
> `CometChatOutgoingCall` is a `UIViewController`. The ring timer, the cancel and the answer
> belong to the Kit's `CallCoordinator`, so the screen picks up the call the buttons placed
> rather than placing another.
>
> `set(user:)` with no call places a voice call to that user from this screen — the one case in
> which `set(callSettingsBuilder:)` applies. With a call, the user only names the callee.

***

## What Happens

| Moment | The screen |
| - | - |
| placing | "Calling…" |
| the callee's device rings | "Ringing…" |
| the callee answers | becomes the call — [`CometChatOngoingCall`](https://www.cometchat.com/docs/ui-kit/ios/v6/ongoing-call)'s content, in place |
| 45 s with no answer | "No answer", then it comes down |
| the call could not be placed | "Call failed", then it comes down |
| the callee rejects, is busy, or the call closes | "Call ended", then it comes down |
| you tap the end button | the call is withdrawn and the screen comes down |

The end button works only while the callee's device rings.

> [tab] SwiftUI
>
> The end button works once per call: the first tap disables it, whatever `onEndCallClick`
> does. The screen stays on while the call is placed and rings; in the call, the Calls SDK
> keeps it on.

> [tab] UIKit
>
> The answered call is embedded in place — not a second modal. A screen that goes away while the
> call still rings withdraws it.

The Kit plays no ring-back tone.

***

## Actions and Events

### Callback Methods

> [tab] SwiftUI
>
> | Callback | Fires when | Default |
> | - | - | - |
> | `onEndCallClick` | the end button is tapped | cancel the call |
> | `onCallAccepted` | the callee answered | the screen becomes the call |
> | `onBack` | the call is over | dismiss |
> | `onError` | the call could not be placed or joined, or `callSettingsBuilder` came too late | — |
>
> `onEndCallClick` replaces the cancel entirely — the call keeps ringing until you end it.
> With `onCallAccepted` set you take the answered call: the Kit's join keeps running, and a
> [`CometChatOngoingCall`](https://www.cometchat.com/docs/ui-kit/ios/v6/ongoing-call) for the call's session picks it up.
>
> ```swift theme={null}
> CometChatOutgoingCall(
>     call: placedCall,
>     onError: { error in report(error) },
>     onBack: { log("ringing screen closed") }
> )
> ```

> [tab] UIKit
>
> | Callback | Fires when | Default |
> | - | - | - |
> | `set(onCancelClick:)` | the end button is tapped | cancel the call |
> | `set(onBack:)` | the call is over | dismiss |
> | `set(onError:)` | the call could not be placed or joined, or a settings builder came too late | — |
>
> `set(onCancelClick:)` replaces the cancel entirely — the call keeps ringing until you end it.
> The screen always becomes the call when it is answered.
>
> ```swift theme={null}
> let ringing = CometChatOutgoingCall()
>     .set(call: placedCall)
>     .set(onError: { error in log(error) })
>     .set(onBack: { log("ringing screen closed") })
> ```

### Global Events

> [tab] SwiftUI
>
> The Kit emits `outgoingCall`, `callAccepted` and `callRejected` on
> [`CometChatEvents`](https://www.cometchat.com/docs/ui-kit/ios/v6/events) — `.onCometChatCallEvents { … }` hears them.

> [tab] UIKit
>
> The Kit emits `ccOutgoingCall`, `ccCallAccepted` and `ccCallRejected` to your
> [`CometChatCallEventListener`](https://www.cometchat.com/docs/ui-kit/ios/v6/events).

***

## Functionality

> [tab] SwiftUI
>
> | Parameter | Type | Default |
> | - | - | - |
> | `call` | `Call` | required — the placed call |
> | `store` | `OutgoingCallStore?` | the coordinator's for this call |
> | `style` | `CometChatOutgoingCallStyle` | `.init()` |
> | `callSettingsBuilder` | `Any?` | `nil` — too late for a placed call; reported through `onError` |
> | `imageSource` | `any ImageSource` | the shared cached loader |
>
> `CometChatOutgoingCall` shows a placed call. It does not place one.

> [tab] UIKit
>
> | Method | Does |
> | - | - |
> | `set(call:)` | the placed call |
> | `set(user:)` | the callee; alone, the screen places a voice call to them |
> | `set(callSettingsBuilder:)` | applies only to a call this screen places |
> | `set(style:)` | sets the `OutgoingCallStyle` |
>
> `disable(soundForCalls:)` and `set(customSoundForCalls:)` are deprecated and do nothing.

***

## Custom View Slots

Each slot receives the placed `Call`.

> [tab] SwiftUI
>
> ```swift theme={null}
> CometChatOutgoingCall(
>     call: placedCall,
>     titleView: { call in AnyView(MyRingingName(call)) },
>     endCallView: { _ in AnyView(MyHangUpButton()) }
> )
> ```
>
> | Slot | Replaces |
> | - | - |
> | `titleView` | the name |
> | `subtitleView` | the status line |
> | `avatarView` | the 120-pt avatar |
> | `endCallView` | the end button's look — a tap on it still ends the call |

> [tab] UIKit
>
> Each slot returns a `UIView`:
>
> ```swift theme={null}
> let ringing = CometChatOutgoingCall()
>     .set(call: placedCall)
>     .set(titleView: { call in MyRingingNameView(call: call) })
>     .set(cancelView: { _ in MyHangUpView() })
> ```
>
> | Slot | Replaces |
> | - | - |
> | `set(titleView:)` | the name |
> | `set(subtitleView:)` | the status line |
> | `set(avatarView:)` | the 120-pt avatar |
> | `set(cancelView:)` | the end button's look — a tap on it still ends the call |

***

## Advanced Methods

### Store Access

> [tab] SwiftUI
>
> `OutgoingCallStore` is the ringing call: its `state` (`initiating`, `ringing`, `joined`,
> `ended`), `statusText`, `callee` and `kind`. A seeded store shows a fixed state, for a preview:
>
> ```swift theme={null}
> #Preview {
>     CometChatOutgoingCall(
>         call: placedCall,
>         store: OutgoingCallStore(seeded: .ringing(sessionID: "s1", remoteConnected: true),
>                                  callee: ChatCallParty(id: "alice", name: "Alice Kim"), kind: .voice))
> }
> ```

> [tab] UIKit
>
> The screen's views are `nameLabel`, `callingLabel` and `declineButton`; `avatarStyle` styles
> the avatar.

### Subclassing

> [tab] SwiftUI
>
> `CometChatOutgoingCall` is a `View` struct. Customise it with its slots and style.

> [tab] UIKit
>
> `buildUI()`, `setupStyle()` and `onDeclineButtonTapped()` are the override points.

***

## Style

> [tab] SwiftUI
>
> `CometChatOutgoingCallStyle` is sparse: set only what you change.
>
> ```swift theme={null}
> CometChatOutgoingCall(call: placedCall,
>                       style: CometChatOutgoingCallStyle(backgroundColor: .black, titleColor: .white,
>                                                         endCallButtonBackgroundColor: .orange))
> ```
>
> | Property | Default |
> | - | - |
> | `backgroundColor` | `background3` |
> | `cornerRadius`, `strokeWidth`, `strokeColor` | none |
> | `titleColor`, `titleFont` | `textPrimary`, `heading1Bold` |
> | `subtitleColor`, `subtitleFont` | `textSecondary`, `bodyRegular` |
> | `endCallIcon`, `endCallIconTint`, `endCallButtonBackgroundColor` | `phone.down.fill`, `white`, `error` |
> | `avatarStyle` | 120 pt |

> [tab] UIKit
>
> Set the static default, or one screen's `style`:
>
> ```swift theme={null}
> CometChatOutgoingCall.style.declineButtonBackgroundColor = .systemOrange
>
> let ringing = CometChatOutgoingCall().set(call: placedCall)
> ringing.style.nameTextColor = .white
> ringing.style.backgroundColor = .black
> ringing.avatarStyle.backgroundColor = .systemIndigo
> ```
>
> | Property | Default |
> | - | - |
> | `backgroundColor` | `background3` |
> | `borderColor`, `borderWidth`, `cornerRadius` | none |
> | `nameTextColor`, `nameTextFont` | `textPrimary`, `heading1Bold` |
> | `callTextColor`, `callTextFont` | `textSecondary`, `bodyRegular` — the status line |
> | `declineButtonBackgroundColor`, `declineButtonIconTint`, `declineButtonIcon` | `error`, `white`, `phone.down.fill` |
> | `declineButtonCornerRadius`, `declineButtonBorderWidth`, `declineButtonBorderColor` | round, none |

***

## Next Steps

> [card] [Call Buttons](https://www.cometchat.com/docs/ui-kit/ios/v6/call-buttons.md)
>
> Place a call that opens this screen

> [card] [Ongoing Call](https://www.cometchat.com/docs/ui-kit/ios/v6/ongoing-call.md)
>
> The call this screen becomes

> [card] [Call Logs](https://www.cometchat.com/docs/ui-kit/ios/v6/call-logs.md)
>
> Call back from the call history

> [card] [Call Features](https://www.cometchat.com/docs/ui-kit/ios/v6/call-features.md)
>
> How calls ring and are presented


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.