SpyBara
Go Premium

go/resources/realtime/subresources/calls/index.md 2026-07-07 08:02 UTC to 2026-07-09 20:58 UTC

184 added, 0 removed.

2026
Fri 31 21:03 Thu 30 23:58 Wed 29 15:02 Sat 25 05:59 Thu 23 18:00 Wed 22 20:02 Mon 20 20:00 Fri 17 17:00 Thu 16 20:57 Wed 15 02:58 Tue 14 06:58 Mon 13 15:59 Sun 12 06:58 Fri 10 23:02 Thu 9 20:58 Tue 7 08:02

Calls

Accept call

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

post /realtime/calls/{call_id}/accept

Accept call

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

Hang up call

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

Refer call

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

Reject call

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