microsoft-foundry.rest.security.o-auth2-auth
Realtime
End a Realtime call
POST
/openai/v1/realtime/calls/{call_id}/hangup
Ends an active Realtime API call initiated over SIP or WebRTC.
Path parameters
call_id
string
required
The identifier for the call. For SIP calls, use the value provided in the
realtime.call.incoming
webhook. For WebRTC sessions, reuse the call ID returned in the Location
header when creating the call with
POST /openai/v1/realtime/calls.
Responses
The request has succeeded.
Request
curl -X POST https://api.openai.com/v1/realtime/calls/$CALL_ID/hangup \
-H "Authorization: Bearer $OPENAI_API_KEY"
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});
await client.realtime.calls.hangup('call_id');
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
client.realtime.calls.hangup(
"call_id",
)
package main
import (
"context"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.Realtime.Calls.Hangup(context.TODO(), "call_id")
if err != nil {
panic(err.Error())
}
}
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.realtime.calls.CallHangupParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
client.realtime().calls().hangup("call_id");
}
}
require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
result = openai.realtime.calls.hangup("call_id")
puts(result)