***
id: 2d55b135-7ff9-430e-b110-dcdb8ac50fbd
title: connectPhone
slug: /node/reference/voice/call/connect-phone
description: connectPhone method for the Call class.
max-toc-depth: 3
----------------
[call]: /docs/server-sdk/v4/node/reference/voice/call
[callstate]: /docs/server-sdk/v4/node/reference/voice/call-state
[disconnected]: /docs/server-sdk/v4/node/reference/voice/call/disconnected
[voiceplaylist]: /docs/server-sdk/v4/node/reference/voice/playlist
### connectPhone
* **connectPhone**(`params`): `Promise`\<[`Call`][call]>
Attempt to connect an existing call to a new outbound phone call. The two devices will hear each other. You can wait until the new peer is disconnected by calling [disconnected][disconnected].
#### Parameters
Object containing the parameters for connecting the call to a phone number.
The party you are attempting to call.
The party the call is coming from. Must be a SignalWire number or SIP endpoint that you own.
The time, in seconds, the call will ring before it is considered unanswered.
The maximum price in USD acceptable for the call to be created. If the rate for the call is greater than this value, the call will not be created. If not set, all calls will be created. Price can have a maximum of four decimal places, i.e. `0.0075`.
Ringback audio to play to the call leg. You can play audio, TTS, silence or ringtone. See [`VoicePlaylist`][voiceplaylist].
Webhook URL to which SignalWire will send call status change notifications. See the payload specifications under [`CallState`][callstate].
An array of event names to be notified about. Allowed values are `created`, `ringing`, `answered`, and `ended`.
#### Returns
`Promise`\<[`Call`][call]>
A promise that resolves to a [`Call`][call] object that you can use to control the new peer.
The promise resolves only after the new peer picks up the call.
#### Example
In this example, we connect an inbound call to an outbound phone number. We play a ringback tone
to the inbound call leg while waiting for the outbound phone number to answer.
Once the outbound phone number answers, we wait for the peer to hangup and then hangup
the inbound leg of the call.
```js
import { SignalWire, Voice} from "@signalwire/realtime-api";
const client = await SignalWire({ project: "ProjectID Here", token: "Token Here" })
const voiceClient = client.voice;
// Ringback tone
const ringback = new Voice.Playlist().add(
Voice.Playlist.Ringtone({
name: "it"
})
);
await voiceClient.listen({
topics: ["office"],
onCallReceived: async (call) => {
// Answer the call
call.answer();
// Connect the call to the device builder plan
let peer = await call.connectPhone({
// Replace the to parameter with a valid phone number
to: "+1XXXXXXXXXX",
from: call.from,
ringback: ringback
});
// Listen to peer state changes
await peer.listen({
onStateChanged: (state) => {
console.log("Peer state changed:", state.state);
}
})
// wait for peer to hangup
await peer.disconnected();
console.log("The peer hungup");
// hangup the call
call.hangup();
}
});
```