REST ClientCalling

refer

View as MarkdownOpen in Claude

Send a SIP REFER on an active call. This initiates a SIP-level transfer, asking the remote endpoint to connect to a new destination. Unlike transfer(), which is handled by SignalWire, a SIP REFER delegates the transfer to the remote SIP endpoint.

SIP REFER is only applicable to SIP calls. It will not work on PSTN calls.

Request

dialobjectRequired
OR
updateobjectRequired
OR
calling.endobjectRequired
OR
calling.disconnectobjectRequired
OR
calling.ai_holdobjectRequired
OR
calling.ai_unholdobjectRequired
OR
calling.ai_messageobjectRequired
OR
calling.ai.stopobjectRequired
OR
calling.playobjectRequired
OR
calling.play.pauseobjectRequired
OR
calling.play.resumeobjectRequired
OR
calling.play.stopobjectRequired
OR
calling.play.volumeobjectRequired
OR
calling.recordobjectRequired
OR
calling.record.pauseobjectRequired
OR
calling.record.resumeobjectRequired
OR
calling.record.stopobjectRequired
OR
calling.collectobjectRequired
OR
calling.collect.stopobjectRequired
OR
calling.collect.start_input_timersobjectRequired
OR
calling.detectobjectRequired
OR
calling.detect.stopobjectRequired
OR
calling.tapobjectRequired
OR
calling.tap.stopobjectRequired
OR
calling.streamobjectRequired
OR
calling.stream.stopobjectRequired
OR
calling.denoiseobjectRequired
OR
calling.denoise.stopobjectRequired
OR
calling.transcribeobjectRequired
OR
calling.transcribe.stopobjectRequired
OR
calling.live_transcribeobjectRequired
OR
calling.live_translateobjectRequired
OR
calling.transferobjectRequired
OR
calling.send_fax.stopobjectRequired
OR
calling.receive_fax.stopobjectRequired
OR
calling.referobjectRequired
OR
calling.user_eventobjectRequired

Response

Call LegobjectRequired
OR
Fabric Subscriber Device LegobjectRequired

Response Example

Response
1{
2 "id": "0e9c80d7-a149-4917-892d-420043709f45",
3 "from": "+12069708643",
4 "to": "+15550198765",
5 "direction": "outbound-api",
6 "source": "realtime_api",
7 "charge": 0,
8 "created_at": "2024-05-06T12:20:00Z",
9 "charge_details": [
10 {
11 "description": "Outbound Voice",
12 "charge": 0.004
13 }
14 ],
15 "status": "queued",
16 "type": "relay_pstn_call"
17}

Example

1from signalwire.rest import RestClient
2
3client = RestClient(
4 project="your-project-id",
5 token="your-api-token",
6 host="your-space.signalwire.com",
7)
8
9client.calling.refer(
10 call_id="call-id-xxx",
11 device={"type": "sip", "params": {"to": "sip:sales@example.com"}},
12)