Asterisk / Realtime API with SPI : Getting a "BYE" after a few seconds

Hello there!

I’m trying to set up OpenAI with the new SIP module from my own Asterisk server. My goal is to call the AI agent and put it on a conference using CONFBRIDGE.

I have the following set up on Asterisk:

; -------- transport TLS client --------
[transport-tls]
type=transport
protocol=tls
bind=0.0.0.0:0

; TLS
method=tlsv1_2
verify_server=yes
allow_wildcard_certs=yes
require_client_cert=no

; Trust store (Debian/Ubuntu) :
ca_list_file=/etc/ssl/certs/ca-certificates.crt
; (RHEL/Alma/CentOS : /etc/pki/tls/certs/ca-bundle.crt)

; NAT
external_signaling_address=XXX.XXX.XXX.XXX
external_media_address=XXX.XXX.XXX.XXX
local_net=XXX.XXX.XXX.XXX
local_net=XXX.XXX.XXX.XXX

; QoS
tos=cs3
cos=3
allow_reload=yes

[openai-sip-aor]
type=aor
contact=<SIP-URI-A>:5061;transport=tls

[openai-sip]
type=endpoint
transport=transport-tls
aors=openai-sip-aor

from_domain=<SIP-DOMAIN>
from_user=anonymous

send_pai=no
send_rpid=no
trust_id_outbound=no

; Media/SDP
disallow=all
allow=ulaw,alaw
direct_media=no
force_rport=yes
rewrite_contact=yes
rtp_symmetric=yes
rtp_keepalive=20
context=from-internal

I have the following dialplan:

[ai-originate]

exten => _X.,1,NoOp([AI] Originate OpenAI leg to conf ${EXTEN})

same => n,Set(CHANNEL(hangup_handler_push)=ai-hangup,s,1(EXTEN,{UNIQUEID}))
same => n,Set(CALLERID(name)=Anonymous)
same => n,Set(CALLERID(num)=anonymous)
same => n,Originate(PJSIP/openai-sip/URI:<PROJECT_ID>@<SIP-URI-A>:5061;transport=tls,exten,ai-join,${EXTEN},1)

same => n,Hangup()

[ai-join]

exten => _X.,1,NoOp([AI] Join ConfBridge EXTEN);same=>n,Answer()same=>n,ConfBridge({EXTEN},CB-bridge,CB-user_ai,CB-menu)

same => n,Hangup()

I run the following command to start the test:

channel originate Local/1234@ai-originate application NoOp start

I also have the webhook set up with Ngrok and a Node App.

I do receive the webhook call and the /accept is done.

{
"id": "evt_68e6407f8ed08190ac7a2a7f6ca48a4f",
"object": "event",
"created_at": 1759920255,
"type": "realtime.call.incoming",
"data": {
"call_id": "rtc_10b3fb58e02e4850bae217c5b4f64349",
"sip_headers": [
{
"name": "Via",
"value": "SIP/2.0/TLS XXX.XXX.XXX.XXX:5061;branch=z9hG4bKPjc57d7f01-b222-4b26-abb7-22a8019315d3;alias;rport"
},
{
"name": "From",
"value": ""Anonymous" <URI:anonymous@<SIP-DOMAIN>>;tag=92994ba3-3d55-4f47-8650-0bc37523f609"
},
{
"name": "To",
"value": "<URI:proj_ID@<SIP-DOMAIN>>;tag=f4cb362b-ebf7-4a3c-932c-9a1f847e6ae9"
},
{
"name": "Contact",
"value": "URI:anonymous@XXX.XXX.XXX.XXX:5061;transport=TLS"
},
{
"name": "Call-ID",
"value": "fa39866e-ad57-4ff2-98ab-515ace8d0143"
},
{
"name": "CSeq",
"value": "1395 INVITE"
},
{
"name": "Allow",
"value": "OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER"
},
{
"name": "Supported",
"value": "100rel, timer, replaces, norefersub, histinfo"
},
{
"name": "Session-Expires",
"value": "1800"
},
{
"name": "Min-SE",
"value": "90"
},
{
"name": "Max-Forwards",
"value": "70"
},
{
"name": "User-Agent",
"value": "FPBX-16.0.41(20.5.2)"
},
{
"name": "Content-Type",
"value": "application/sdp"
},
{
"name": "Content-Length",
"value": "259"
}
]
}
}

However, after a few secs, I’m getting a “BYE” as if OpenIA was shutting down the call. Here’s some logs:

2496624[2025-10-08 12:44:18] DEBUG[537186] res_pjsip/pjsip_distributor.c: Found serializer pjsip/outsess/openai-sip-00000263 associated with dialog dlg0x7f4c0c05cd88

2496625[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d Method: INVITE Status: 200

2496627[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d Event: TSX_STATE Inv State: CONNECTING

2496629[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: The state change pertains to the endpoint 'openai-sip(PJSIP/openai-sip-0000004d)'

2496633[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d: Source of transaction state change is RX_MSG

2496634[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d: Received response

2496635[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d: Response is 200 OK

2496636[2025-10-08 12:44:18] DEBUG[559548] chan_pjsip.c: PJSIP/openai-sip-0000004d: Status: 200

2496637[2025-10-08 12:44:18] DEBUG[559548] chan_pjsip.c: PJSIP/openai-sip-0000004d

2496638[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d

2496640[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d

2496641[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d

2496642[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d

2496643[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d: Applying negotiated SDP media stream 'audio' using audio SDP handler

2496644[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_sdp_rtp.c: PJSIP/openai-sip-0000004d Stream: 0:audio-0:audio:sendrecv (ulaw|alaw)

2496651[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_sdp_rtp.c: PJSIP/openai-sip-0000004d ANSWER

2496652[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_sdp_rtp.c: PJSIP/openai-sip-0000004d

2496657[2025-10-08 12:44:18] DEBUG[559548] channel_internal_api.c: PJSIP/openai-sip-0000004d: MultistreamFormats: (ulaw)

2496659[2025-10-08 12:44:18] DEBUG[559548] channel.c: Channel PJSIP/openai-sip-0000004d setting read format path: ulaw -> ulaw

2496660[2025-10-08 12:44:18] DEBUG[559548] channel.c: Channel PJSIP/openai-sip-0000004d setting write format path: ulaw -> ulaw

2496666[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d: Applied negotiated SDP media stream 'audio' using audio SDP handler

2496667[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d: Applied negotiated SDP media stream 'audio' using audio SDP handler

2496668[2025-10-08 12:44:18] DEBUG[559548] channel_internal_api.c: PJSIP/openai-sip-0000004d: <0:audio-0:audio:sendrecv (ulaw)>

2496671[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d

2496677[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d Event: TX_MSG Inv State: CONFIRMED

2496679[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: The state change pertains to the endpoint 'openai-sip(PJSIP/openai-sip-0000004d)'

2496684[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d TSX State: Terminated Inv State: CONFIRMED

2496686[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: The state change pertains to the endpoint 'openai-sip(PJSIP/openai-sip-0000004d)'

2496692[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d: Response is 200 OK

2496693[2025-10-08 12:44:18] DEBUG[559548] chan_pjsip.c: PJSIP/openai-sip-0000004d: Status: 200

2496694[2025-10-08 12:44:18] DEBUG[559548] chan_pjsip.c: PJSIP/openai-sip-0000004d: Queueing ANSWER

2496695[2025-10-08 12:44:18] DEBUG[559548] chan_pjsip.c: PJSIP/openai-sip-0000004d

2496696[2025-10-08 12:44:18] DEBUG[559548] chan_pjsip.c: PJSIP/openai-sip-0000004d: Status: 200

2496697[2025-10-08 12:44:18] DEBUG[559548] chan_pjsip.c: PJSIP/openai-sip-0000004d

2496698[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d

2497600[2025-10-08 12:44:18] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d TSX State: Terminated Inv State: CONFIRMED

And the “BYE” part:

2497204[2025-10-08 12:44:18] DEBUG[990548][C-00000070] app_confbridge.c: User PJSIP/openai-sip-0000004d is unmuted: user:0 system:0.

2497387[2025-10-08 12:44:18] DEBUG[990548][C-00000070] bridge_channel.c: Bridge 3183d46b-8aa5-4e75-ba52-2605170fd221: 0x7f4c1022d300(PJSIP/openai-sip-0000004d) is joining

2497388[2025-10-08 12:44:18] DEBUG[990548][C-00000070] bridge_channel.c: Bridge 3183d46b-8aa5-4e75-ba52-2605170fd221: pushing 0x7f4c1022d300(PJSIP/openai-sip-0000004d)

2497389[2025-10-08 12:44:18] VERBOSE[990548][C-00000070] bridge_channel.c: Channel PJSIP/openai-sip-0000004d joined 'softmix' base-bridge <3183d46b-8aa5-4e75-ba52-2605170fd221>

2497393[2025-10-08 12:44:18] DEBUG[990548][C-00000070] bridge.c: Bridge 3183d46b-8aa5-4e75-ba52-2605170fd221: 0x7f4c1022d300(PJSIP/openai-sip-0000004d) is leaving softmix technology

2497394[2025-10-08 12:44:18] DEBUG[990548][C-00000070] bridge_softmix.c: PJSIP/openai-sip-0000004d:

2497395[2025-10-08 12:44:18] DEBUG[990548][C-00000070] channel.c: Channel PJSIP/openai-sip-0000004d setting read format path: ulaw -> slin

2497396[2025-10-08 12:44:18] DEBUG[990548][C-00000070] channel.c: Channel PJSIP/openai-sip-0000004d setting write format path: slin -> ulaw

2497407[2025-10-08 12:44:18] DEBUG[990548][C-00000070] bridge_softmix.c: PJSIP/openai-sip-0000004d:

2497408[2025-10-08 12:44:18] DEBUG[990548][C-00000070] bridge_softmix.c: PJSIP/openai-sip-0000004d: Not in SFU mode

2497418[2025-10-08 12:44:18] DEBUG[990548][C-00000070] chan_pjsip.c: PJSIP/openai-sip-0000004d: Indicated Media source update

2497419[2025-10-08 12:44:18] DEBUG[990548][C-00000070] chan_pjsip.c: PJSIP/openai-sip-0000004d

2497430Channel: PJSIP/openai-sip-0000004d

2497447[2025-10-08 12:44:18] DEBUG[990548][C-00000070] chan_pjsip.c: PJSIP/openai-sip-0000004d: Indicated Media source update

2497448[2025-10-08 12:44:18] DEBUG[990548][C-00000070] chan_pjsip.c: PJSIP/openai-sip-0000004d

2497452Channel: PJSIP/openai-sip-0000004d

2497470[2025-10-08 12:44:18] DEBUG[537166] cdr.c: Finalized CDR for PJSIP/openai-sip-0000004d - start 1759920255.439376 answer 1759920258.625533 end 1759920258.629094 dur 3.189 bill 0.003 dispo ANSWERED

2497482Channel: PJSIP/openai-sip-0000004d

2497567[2025-10-08 12:44:18] DEBUG[537186] res_pjsip/pjsip_distributor.c: Found serializer pjsip/outsess/openai-sip-00000263 associated with dialog dlg0x7f4c0c05cd88

2497568[2025-10-08 12:44:18] DEBUG[552079] res_pjsip_session.c: PJSIP/openai-sip-0000004d: Method is BYE, Response is 200 OK

2497569[2025-10-08 12:44:18] DEBUG[552079] res_pjsip_session.c: PJSIP/openai-sip-0000004d

2497572[2025-10-08 12:44:18] DEBUG[552079] res_pjsip_session.c: PJSIP/openai-sip-0000004d TSX State: Completed Inv State: CONFIRMED

2497574[2025-10-08 12:44:18] DEBUG[552079] res_pjsip_session.c: The state change pertains to the endpoint 'openai-sip(PJSIP/openai-sip-0000004d)'

2497581[2025-10-08 12:44:18] DEBUG[552079] res_pjsip_session.c: PJSIP/openai-sip-0000004d TSX State: Completed Inv State: CONFIRMED

2497584[2025-10-08 12:44:18] DEBUG[552079] res_pjsip_session.c: PJSIP/openai-sip-0000004d Event: TSX_STATE Inv State: DISCONNCTD

2497586[2025-10-08 12:44:18] DEBUG[552079] res_pjsip_session.c: The state change pertains to the endpoint 'openai-sip(PJSIP/openai-sip-0000004d)'

2497590[2025-10-08 12:44:18] DEBUG[552079] res_pjsip_session.c: PJSIP/openai-sip-0000004d: Source of transaction state change is RX_MSG

2497591[2025-10-08 12:44:18] DEBUG[552079] res_pjsip_session.c: PJSIP/openai-sip-0000004d: Received request

2497592[2025-10-08 12:44:18] DEBUG[552079] res_pjsip_session.c: PJSIP/openai-sip-0000004d: Method is BYE

2497593[2025-10-08 12:44:18] DEBUG[552079] res_pjsip_session.c: PJSIP/openai-sip-0000004d

2497595[2025-10-08 12:44:18] DEBUG[552079] res_pjsip_session.c: PJSIP/openai-sip-0000004d TSX State: Completed Inv State: DISCONNCTD

2497597[2025-10-08 12:44:18] DEBUG[552079] res_pjsip_session.c: The state change pertains to the endpoint 'openai-sip(PJSIP/openai-sip-0000004d)'

2497604[2025-10-08 12:44:18] DEBUG[552079] res_pjsip_session.c: PJSIP/openai-sip-0000004d TSX State: Completed Inv State: DISCONNCTD

2497607[2025-10-08 12:44:18] DEBUG[552079] chan_pjsip.c: PJSIP/openai-sip-0000004d

2497612Channel: PJSIP/openai-sip-0000004d

2497630[2025-10-08 12:44:18] DEBUG[990548][C-00000070] bridge_channel.c: Setting 0x7f4c1022d300(PJSIP/openai-sip-0000004d) state from:0 to:1

2497631[2025-10-08 12:44:18] DEBUG[990548][C-00000070] bridge_channel.c: Bridge 3183d46b-8aa5-4e75-ba52-2605170fd221: pulling 0x7f4c1022d300(PJSIP/openai-sip-0000004d)

2497632[2025-10-08 12:44:18] VERBOSE[990548][C-00000070] bridge_channel.c: Channel PJSIP/openai-sip-0000004d left 'softmix' base-bridge <3183d46b-8aa5-4e75-ba52-2605170fd221>

2497633[2025-10-08 12:44:18] DEBUG[990548][C-00000070] bridge_channel.c: Bridge 3183d46b-8aa5-4e75-ba52-2605170fd221: 0x7f4c1022d300(PJSIP/openai-sip-0000004d) is leaving softmix technology

2497639Channel: PJSIP/openai-sip-0000004d

2497660Channel: PJSIP/openai-sip-0000004d

2497682Channel: PJSIP/openai-sip-0000004d

2497704Channel: PJSIP/openai-sip-0000004d

2497722[2025-10-08 12:44:18] DEBUG[990548][C-00000070] bridge_channel.c: Bridge is returning 0x7f4c1022d300(PJSIP/openai-sip-0000004d) to read format ulaw

2497726Channel: PJSIP/openai-sip-0000004d

2497743[2025-10-08 12:44:18] DEBUG[990548][C-00000070] channel.c: Channel PJSIP/openai-sip-0000004d setting read format path: ulaw -> ulaw

2497744[2025-10-08 12:44:18] DEBUG[990548][C-00000070] bridge_channel.c: Bridge is returning 0x7f4c1022d300(PJSIP/openai-sip-0000004d) to write format ulaw

2497745[2025-10-08 12:44:18] DEBUG[990548][C-00000070] channel.c: Channel PJSIP/openai-sip-0000004d setting write format path: ulaw -> ulaw

2497757Channel: PJSIP/openai-sip-0000004d

2497777Channel: PJSIP/openai-sip-0000004d

2497805Channel: PJSIP/openai-sip-0000004d

2497824Channel: PJSIP/openai-sip-0000004d

2497865[2025-10-08 12:44:18] DEBUG[537186] res_pjsip_session.c: PJSIP/openai-sip-0000004d TSX State: Terminated Inv State: DISCONNCTD

2497867[2025-10-08 12:44:18] DEBUG[537186] res_pjsip_session.c: The state change pertains to the endpoint 'openai-sip(PJSIP/openai-sip-0000004d)'

2497930[2025-10-08 12:44:19] DEBUG[990548][C-00000070] channel.c: Soft-Hanging (0x10) up channel 'PJSIP/openai-sip-0000004d'

2497933[2025-10-08 12:44:19] DEBUG[990548][C-00000070] channel.c: Channel 0x7f4b98008920 'PJSIP/openai-sip-0000004d' hanging up. Refs: 2

2497934[2025-10-08 12:44:19] DEBUG[990548][C-00000070] chan_pjsip.c: PJSIP/openai-sip-0000004d

2497951[2025-10-08 12:44:19] DEBUG[559548] chan_pjsip.c: PJSIP/openai-sip-0000004d

2497955Channel: PJSIP/openai-sip-0000004d

2497972[2025-10-08 12:44:19] DEBUG[559548] res_pjsip_session.c: PJSIP/openai-sip-0000004d Response 0

2497983Channel: PJSIP/openai-sip-0000004d

Am I doing something wrong here?

@Communication_JobPho Thank you so much for checking out Realtime API!

Are you able to get a pcap/watch traffic in Wireshark? Do you see RTP packets flowing both ways?

If we don’t get a constant stream of RTP packets we hang up the call/send a BYE. That would be my first guess.

1 Like

Thanks for coming back to me, I’ll check that and get back to you but I’m not sure I have the mean to check that.

I’m not intentionally not sending RTP packets so I’m a bit puzzled as to why that would be the case.

Is establishing a websocket connection after the /anwer (with GET wss://api.openai.com/v1/realtime?call_id={call_id}) mandatory to keep the call alive ?

I’ve gathered some RTP logs, it seems to confirm that OpenIA is receiving something :

[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Sent RTP packet to 52.247.126.244:53017 (type 00, seq 025706, ts 000160, len 000160)
[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Sent RTP packet to 52.247.126.244:53017 (type 00, seq 025707, ts 000320, len 000160)
[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Sent RTP packet to 52.247.126.244:53017 (type 00, seq 025708, ts 000480, len 000160)

[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Sent RTP packet to 52.247.126.244:53017 (type 00, seq 025719, ts 002240, len 000160)
[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Sent RTP packet to 52.247.126.244:53017 (type 00, seq 025720, ts 002400, len 000160)
[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Sent RTP packet to 52.247.126.244:53017 (type 00, seq 025721, ts 002560, len 000160)
[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Sent RTP packet to 52.247.126.244:53017 (type 00, seq 025722, ts 002720, len 000160)
[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Sent RTP packet to 52.247.126.244:53017 (type 00, seq 025723, ts 002880, len 000160)
[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Sent RTP packet to 52.247.126.244:53017 (type 00, seq 025724, ts 003040, len 000160)
[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Sent RTP packet to 52.247.126.244:53017 (type 00, seq 025725, ts 003200, len 000160)
[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Sent RTP packet to 52.247.126.244:53017 (type 00, seq 025726, ts 003360, len 000160)
[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Sent RTP packet to 52.247.126.244:53017 (type 00, seq 025727, ts 003520, len 000160)
[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Sent RTP packet to 52.247.126.244:53017 (type 00, seq 025728, ts 003680, len 000160)

And

[2025-10-15 12:16:13] DEBUG[537194] manager.c: Examining AMI event:
Variable: RTPAUDIOQOS
Value: ssrc=46398162;themssrc=5000;lp=0;rxjitter=0.000000;rxcount=2;txjitter=0.000000;txcount=23;rlp=0;rtt=0.000000;rxmes=0.000000;txmes=0.000000

[2025-10-15 12:16:13] DEBUG[537194] manager.c: Examining AMI event:
Variable: RTPAUDIOQOSJITTER
Value: minrxjitter=000.000000;maxrxjitter=000.000000;avgrxjitter=000.000000;stdevrxjitter=000.000000;mintxjitter=000.000000;maxtxjitter=000.000000;avgtxjitter=000.000000;stdevtxjitter=000.000000;

[2025-10-15 12:16:13] DEBUG[537194] manager.c: Examining AMI event:
Variable: RTPAUDIOQOSLOSS
Value: minrxlost=000.000000; maxrxlost=000.000000; avgrxlost=000.000000; stdevrxlost=000.000000; mintxlost=000.000000; maxtxlost=000.000000; avgtxlost=000.000000; stdevtxlost=000.000000;

[2025-10-15 12:16:13] DEBUG[537194] manager.c: Examining AMI event:
Variable: RTPAUDIOQOSRTT
Value: minrtt=000.000000; maxrtt=000.000000; avgrtt=000.000000; stdevrtt=000.000000;

I’m also receiving packets :

[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Got RTP packet from 52.247.126.244:53017 (type 00, seq 000000, ts 000000, len 000160)
[2025-10-15 12:16:13] VERBOSE[1559144][C-0000008e] res_rtp_asterisk.c: Got RTP packet from 52.247.126.244:53017 (type 00, seq 000001, ts 000160, len 000160)

1 Like

could you try again and post your call id? we added some more logging to make it easier to diagnose these issues.

1 Like

I feel like I’ve got the same / similar issue here - Realtime API using SIP - Call dropping after 1 second - BYE from OpenAI - API - OpenAI Developer Community

Happy to generate some test calls for you if you could help please?

yes, please do. Also let us know what you’re sending to the accept endpoint.

Thanks for coming back to me. I’ve done a couple of different attempts, with them all failing in the same manner. CallIds and /accept payloads are below.

Example 1 - Callid rtc_d9c598097fa14f63974ca8648621cab0

{
“type”: “realtime”,
“model”: “gpt-realtime”,
“instructions”: “You are a friendly receptionist”
}

Example 2 - Callid rtc_9c17c664b4d24f6a8f54d3d5286bd2a2

{
“type”: “realtime”,
“model”: “gpt-realtime”,
“instructions”: “You are a friendly receptionist”,
“audio”: {
“input”: {
“format”: { “type”: “audio/pcma”}
},
“output”: {
“format”: { “type”: “audio/pcma”}
}
}
}

Example 3 - Callid rtc_a516ea6cef574af8873dbcd9c6244e5c

{
“type”: “realtime”,
“model”: “gpt-realtime”,
“output_modalities”: [“audio”],
“instructions”: “You are a friendly receptionist”,
“audio”: {
“input”: {
“format”: { “type”: “audio/pcma”}
},
“output”: {
“format”: { “type”: “audio/pcma”}
}
}
}

Example 4 - Callid - rtc_9cc0dd29e8814e859a33aa2544ad6c51

{
“type”: “realtime”,
“model”: “gpt-realtime”,
“output_modalities”: [“audio”],
“instructions”: “You are a friendly receptionist”
}

I can confirm that I’m sending an alaw RTP stream (at least to Twilio) and receive an RTP stream with a payload of 55555555555555555555555555555…. in the packets I receive.

1 Like

ok, found the first call. It’s failing authentication for some reason. Can you confirm you are sending a valid Authorization header, and indicate whether you’re using the openai-beta header or not?

2 Likes

That’s sorted it - I realised I was using the webhook secret rather than than a API key associated with the project.

Really appreciate you looking at this, curious if the other person of this thread has made the same mistake!

It may be helpful to update the /accept endpoint to give a 401 as I’ve been getting 200s during all my tests which meant I never looked at authentication at all.

Thanks!

1 Like

Agreed. This will be fixed soon.

1 Like

Hi,

On my side I’m using the right API key for the project used.

Here’s a sample query :

OUTGOING /accept → url: https:// api .openai.com/v1/realtime/calls/rtc_2b7aae96c3e24bb8a96e3a1b4831a7bb/accept
OUTGOING /accept → headers: {
Authorization: ‘Bearer sk-proj-XXXX’,
‘OpenAI-Project’: ‘proj_XXXX’,
‘OpenAI-Beta’: ‘realtime=v1’,
‘Content-Type’: ‘application/json’
}
OUTGOING /accept → body: {“type”:“realtime”,“model”:“gpt-realtime”,“voice”:“verse”,“instructions”:“Assistant vocal FR, bref et utile.”}
INCOMING /accept ← status: 200 OK ( +1029ms )
INCOMING /accept ← headers: {
‘alt-svc’: ‘h3=“:443”; ma=86400’,
‘cf-cache-status’: ‘DYNAMIC’,
‘cf-ray’: ‘98f720c9a9b5d39b-CDG’,
connection: ‘keep-alive’,
‘content-length’: ‘0’,
date: ‘Thu, 16 Oct 2025 11:13:39 GMT’,
server: ‘cloudflare’,
‘set-cookie’: ‘_cfuvid=1K6GPvotHk3PPcwxqKaOR44jWrzanDit67P7Cky8rRw-1760613219648-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None’,
‘strict-transport-security’: ‘max-age=31536000; includeSubDomains; preload’,
‘x-content-type-options’: ‘nosniff’,
‘x-envoy-upstream-service-time’: ‘328’,
‘x-openai-proxy-wasm’: ‘v0.1’
}
INCOMING /accept ← body:
[2025-10-16T11:13:39.335Z] [/accept] status= 200 (+1029ms)

when using the beta header, don’t include type

Thanks ! It has actually solved the issue, no more “BYE” thing, the IA stay on the conference.

But now I have another issue : I can’t hear the IA despite being in the same conference.

The dialplan is pretty simple :

[ai-join]
exten => _X.,1,NoOp([AI] Join ConfBridge {EXTEN}) same => n,ConfBridge({EXTEN},testbridge,usercalled,testmenu)

And the confbridge settings :

[testbridge]
type=bridge
internal_sample_rate=16000
mixing_interval=20
record_conference=no
video_mode=follow_talker

[usercalled]
type=user
end_marked=yes
announce_only_user=no
dsp_drop_silence=no
quiet=yes

[testmenu]
type=menu

Maybe this has something to do with the internal_sample_rate ?

Alright it was an audio issue on my side, it’s working now, thanks !

1 Like