i receive this Error when trying to sip transfer a...
# ask-ai
s
i receive this Error when trying to sip transfer a call: SIP_STATUS_METHOD_NOT_ALLOWED code 405,
t
Thanks for reaching out, Youssef. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I’m sorry you hit that 405 when trying a SIP transfer — I can help troubleshoot. A 405 (SIP_STATUS_METHOD_NOT_ALLOWED) means the transfer method (usually SIP REFER) is being rejected. To narrow this down, please tell me: • Which SIP trunk/provider are you dialing through (e.g., Twilio, Telnyx, Vicidial, other)? • Are you transferring to a PSTN number or another SIP endpoint? • Did you enable SIP REFER / Call Transfer (and PSTN Transfer if applicable) in your provider’s trunk settings? • Are you using LiveKit’s
TransferSIPParticipant
API call? If so, does the access token include the SIP
call
permission? • Any provider error logs or SIP traces (the INVITE/REFER/response) you can share? If you prefer, share the provider name and I’ll list the exact settings to check for that provider. Sources: SIP troubleshooting guide | LiveKit docs | Call forwarding | LiveKit docs | How Vicidial Handles Bridging, Transfers, and SIP Calls | SIP APIs | LiveKit docs
s
other, PSTN number, transfer_request = proto_sip.TransferSIPParticipantRequest( _participant_identity_=participant_identity, _room_name_=room_name, _transfer_to_=transfer_to, _play_dialtone_=False ) and i am using livekit locally hosted
t
Thanks — this helps. A 405 when transferring to a PSTN number usually means the provider is rejecting the transfer method (typically SIP REFER). To troubleshoot I need two quick details and will give targeted checks: 1) Which SIP trunk/provider are you sending the transfer through? (You said “other” — provider name matters: many require explicit REFER/call-transfer settings or don’t support REFER.) 2) Does the access token used to call
TransferSIPParticipant
include the SIP
call
permission? While you reply, please check these on your side: • Provider settings: Ensure SIP REFER / Call Transfer and PSTN transfer are enabled for that trunk (or confirm the provider supports REFER). If the provider doesn’t support REFER, use a bridging/warm-transfer workflow instead. • SIP traces/logs: Capture the REFER request and the provider’s 405 response (or full SIP dialog). The exact response header/body often shows why the method was disallowed. • LiveKit local config: Confirm your LiveKit SIP gateway is routing the REFER to your provider and not modifying the method. • Token permissions: Verify the token used to invoke
TransferSIPParticipant
includes the SIP
call
grant. If you can share the provider name and either the SIP trace (INVITE/REFER + response) or the provider settings screenshots, I’ll give the exact settings and next steps.
s
shoe me an example of the call permission,
t
Thanks — here are concise examples showing how to include the SIP
call
permission in the access token used for
TransferSIPParticipant
. Pick the language you use. Node.js (TypeScript)
Copy code
import { AccessToken, SIPGrant, VideoGrant } from "livekit-server-sdk";

const at = new AccessToken("API_KEY", "API_SECRET", { identity: "transfer-agent" });

const sipGrant: SIPGrant = { call: true }; // <— required
const videoGrant: VideoGrant = { roomJoin: true, room: "my-room" };

at.addGrant(sipGrant);
at.addGrant(videoGrant);

const token = await at.toJwt();
console.log(token);
Go
Copy code
import (
  "time"
  "github.com/livekit/protocol/auth"
)

at := auth.NewAccessToken("API_KEY", "API_SECRET")
sipGrant := &auth.SIPGrant{ Call: true } // <— required
videoGrant := &auth.VideoGrant{ RoomJoin: true, Room: "my-room" }

at.SetSIPGrant(sipGrant).
  SetVideoGrant(videoGrant).
  SetIdentity("transfer-identity").
  SetValidFor(time.Hour)

jwt, _ := at.ToJWT()
fmt.Println(jwt)
Python
Copy code
from livekit import api
import os

token = api.AccessToken(os.getenv("LIVEKIT_API_KEY"), os.getenv("LIVEKIT_API_SECRET")) \
    .with_identity("transfer-identity") \
    .with_grants(api.VideoGrants(room_join=True, room="my-room")) \
    .with_sip_grants(api.SIPGrants(call=True)) \  # <— required
    .to_jwt()

print(token)
What to check after creating the token: • Use this token when calling
TransferSIPParticipant
. • Confirm the token’s JWT contains a
sip
claim with
"call": true
. • If you still get 405, tell me the SIP trunk provider name and a SIP trace of the REFER/response and I’ll help further. Sources: Authentication | LiveKit docs | sip | livekit/livekit_composite | DeepWiki