SpyBara
Go Premium

go/resources/realtime/subresources/calls/index.md 2026-05-02 05:57 UTC to 2026-05-05 23:00 UTC

186 added, 0 removed.

2026
Wed 27 06:42 Fri 22 06:33 Wed 20 06:35 Tue 19 06:34 Mon 18 22:01 Mon 11 18:00 Thu 7 21:57 Tue 5 23:00 Sat 2 05:57
Data Information:
  • After 2026-05-05 06:03 UTC, this monitor no longer uses markdownified HTML/MDX. Comparisons across that boundary can therefore show more extensive diffs.

Calls

Accept call

client.Realtime.Calls.Accept(ctx, callID, body) error

post /realtime/calls/{call_id}/accept

Accept an incoming SIP call and configure the realtime session that will handle it.

Parameters

  • callID string

  • body CallAcceptParams

    • RealtimeSessionCreateRequest param.Field[RealtimeSessionCreateRequest]

      Realtime session object configuration.

Example

package main

import (
  "context"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
  "github.com/openai/openai-go/realtime"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  err := client.Realtime.Calls.Accept(
    context.TODO(),
    "call_id",
    realtime.CallAcceptParams{
      RealtimeSessionCreateRequest: realtime.RealtimeSessionCreateRequestParam{

      },
    },
  )
  if err != nil {
    panic(err.Error())
  }
}

Hang up call

client.Realtime.Calls.Hangup(ctx, callID) error

post /realtime/calls/{call_id}/hangup

End an active Realtime API call, whether it was initiated over SIP or WebRTC.

Parameters

  • callID string

Example

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())
  }
}

Refer call

client.Realtime.Calls.Refer(ctx, callID, body) error

post /realtime/calls/{call_id}/refer

Transfer an active SIP call to a new destination using the SIP REFER verb.

Parameters

  • callID string

  • body CallReferParams

    • TargetUri param.Field[string]

      URI that should appear in the SIP Refer-To header. Supports values like tel:+14155550123 or sip:agent@example.com.

Example

package main

import (
  "context"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
  "github.com/openai/openai-go/realtime"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  err := client.Realtime.Calls.Refer(
    context.TODO(),
    "call_id",
    realtime.CallReferParams{
      TargetUri: "tel:+14155550123",
    },
  )
  if err != nil {
    panic(err.Error())
  }
}

Reject call

client.Realtime.Calls.Reject(ctx, callID, body) error

post /realtime/calls/{call_id}/reject

Decline an incoming SIP call by returning a SIP status code to the caller.

Parameters

  • callID string

  • body CallRejectParams

    • StatusCode param.Field[int64]

      SIP response code to send back to the caller. Defaults to 603 (Decline) when omitted.

Example

package main

import (
  "context"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
  "github.com/openai/openai-go/realtime"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  err := client.Realtime.Calls.Reject(
    context.TODO(),
    "call_id",
    realtime.CallRejectParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
}