[BUG] webhook on_play返回的id和接口查询的ID不一致
Author: SatoriNyaCreated Jul 5, 2026Updated Jul 7, 2026
Labelsbug
现象描述
使用whep拉流之后,webhook on_play的返回的id和接口中查询的ID对不上,比如webhook返回的数据是
{"mediaServerId":"jZTgLFl9Zk1NB5AG","app":"live","id":"668-46","ip":"192.168.50.100","params":"app=live&stream=df&viewerId=1db94209-78e9-41d7-b9db-dc766d0809a1&tabPlayId=71ab9f75-8ae3-4280-bece-94a19fe6d7d8&session=668-46","port":53214,"schema":"rtc","stream":"df","vhost":"__defaultVhost__"}但是通过api查询到的实际数据是
{
"identifier": "670-46",
"local_ip": "::",
"local_port": 8000,
"peer_ip": "138.2.67.134",
"peer_port": 45306,
"typeid": "mediakit::WebRtcSession"
}这两个的id就对不上,在需要根据id来踹session的时候就无法用webhook的id来踹
如何复现?
- 首先配置webhook,webhook返回的id为668-46
- 从API查询播放端,实际查询到的id为 670-46
- 期望得到webhook和api返回一样的id
相关日志或截图
展开查看详细日志#详细日志粘在这里!配置
展开查看详细配置#config.ini内容粘在这里!
[api]
apiDebug=1
defaultSnap=./www/logo.png
downloadRoot=./www
secret=
snapRoot=./www/snap/
[cluster]
origin_url=
retry_count=3
timeout_sec=15
[ffmpeg]
bin=/usr/bin/ffmpeg
cmd=%s -re -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s
log=./ffmpeg/ffmpeg.log
restart_sec=0
snap=%s -i %s -y -f mjpeg -frames:v 1 -an %s
[general]
broadcast_player_count_changed=0
check_nvidia_dev=1
enableVhost=0
enable_ffmpeg_log=0
flowThreshold=1024
listen_ip=::
maxStreamWaitMS=15000
mediaServerId=jZTgLFl9Zk1NB5AG
mergeWriteMS=0
resetWhenRePlay=1
streamNoneReaderDelayMS=20000
unready_frame_cache=100
wait_add_track_ms=3000
wait_audio_track_data_ms=1000
wait_track_ready_ms=10000
[hls]
broadcastRecordTs=0
deleteDelaySec=10
fastRegister=0
fileBufSize=65536
fmp4SegExt=.mp4
segDelay=0
segDur=2
segKeep=0
segNum=3
segRetain=5
[hook]
alive_interval=30.000000
enable=1
on_flow_report=
on_http_access=
on_play=http://192.168.50.129:8080/api/zlm/hooks/on_play
on_publish=
on_record_mp4=
on_record_ts=
on_rtp_server_timeout=
on_rtsp_auth=
on_rtsp_realm=
on_send_rtp_stopped=
on_server_exited=
on_server_keepalive=
on_server_started=
on_shell_login=
on_stream_changed=http://192.168.50.129:8080/api/zlm/hooks/on_stream_changed
on_stream_none_reader=
on_stream_not_found=
retry=1
retry_delay=3.000000
stream_changed_schemas=rtsp/rtmp/fmp4/ts/hls/hls.fmp4
timeoutSec=10
[http]
allow_cross_domains=1
allow_ip_range=::1,127.0.0.1,172.16.0.0-172.31.255.255,192.168.0.0-192.168.255.255,10.0.0.0-10.255.255.255
charSet=utf-8
dirMenu=1
forbidCacheSuffix=
forwarded_ip_header=
keepAliveSecond=15
maxReqSize=40960
notFound=<html><head><title>404 Not Found</title></head><body bgcolor="white"><center><h1>您访问的资源不存在!</h1></center><hr><center>ZLMediaKit(git hash:5f11d3b/2026-06-13T21:01:47-07:00,branch:master,build time:2026-06-14T04:11:14)</center></body></html>
port=8080
rootPath=/opt/media/bin/pymkui/frontend
sendBufSize=65536
sslport=66443
virtualPath=
[multicast]
addrMax=239.255.255.255
addrMin=239.0.0.0
udpTTL=64
[onvif]
port=3702
[protocol]
add_mute_audio=1
auto_close=0
continue_push_ms=15000
enable_audio=1
enable_fmp4=1
enable_hls=1
enable_hls_fmp4=0
enable_mp4=0
enable_rtmp=1
enable_rtsp=1
enable_ts=1
fmp4_demand=0
hls_demand=0
hls_save_path=./www
modify_stamp=2
mp4_as_player=0
mp4_max_second=3600
mp4_save_path=./www
paced_sender_ms=0
rtmp_demand=0
rtsp_demand=0
ts_demand=0
[python]
plugin=mk_plugin
[record]
appName=record
enableFmp4=0
fastStart=0
fileBufSize=65536
fileRepeat=0
sampleMS=500
[rtc]
bfilter=1
datachannel_echo=1
enableTurn=1
externIP=
icePort=3478
icePwd=ZLMediaKit
iceTcpPort=3478
iceTransportPolicy=0
iceUfrag=ZLMediaKit
interfaces=
maxRtpCacheMS=5000
maxRtpCacheSize=2048
max_bitrate=0
max_stun_retry=7
min_bitrate=0
nackAudioRtpSize=4
nackIntervalRatio=1.000000
nackMaxCount=15
nackMaxMS=3000
nackMaxSize=2048
nackRtpSize=8
port=8000
port_range=49152-65535
preferredCodecA=PCMA,PCMU,opus,mpeg4-generic
preferredCodecV=H264,H265,AV1,VP9,VP8
preferred_tcp=0
rembBitRate=0
signalingPort=3000
signalingSslPort=3001
start_bitrate=0
tcpPort=8000
timeoutSec=15
[rtmp]
directProxy=1
enhanced=1
handshakeSecond=15
keepAliveSecond=15
port=1935
sslport=19350
[rtp]
audioMtuSize=600
h264_stap_a=1
lowLatency=0
rtpMaxSize=10
videoMtuSize=1400
[rtp_proxy]
dumpDir=
gop_cache=1
h264_pt=98
h265_pt=99
merge_frame=1
opus_pt=100
port=10000
port_range=30000-35000
ps_pt=96
rtp_g711_dur_ms=100
timeoutSec=15
udp_recv_socket_buffer=4194304
[rtsp]
authBasic=0
directProxy=1
handshakeSecond=15
keepAliveSecond=15
lowLatency=0
port=8554
rtpTransportType=-1
sslport=332
[shell]
maxReqSize=1024
port=69000
[srt]
latencyMul=4
passPhrase=
pktBufSize=8192
port=69000
timeoutSec=5