Hi, we’re running Asterisk 20(via MikoPBX) with a Stasis application connected via AudioSocket. When a call is routed into Stasis, the final AMI Hangup event comes from the AudioSocket channel instead of the original PJSIP channel — and as a result, CDR fields are empty.
Normal call (internal → internal), SQLite CDR:
src_chan = PJSIP/554-00000003
dst_chan = PJSIP/666-00000004
to_account = 666
dialstatus = ANSWERED
Call routed to Stasis (both internal and external), SQ Lite CDR:
src_chan = PJSIP/554-00000006
dst_chan = (empty)
to_account = (empty)
dialstatus = (empty)
dst_num = 123 ← this is filled
AMI Hangup — normal call:
Channel: PJSIP/554-00000003
CallerIDNum: 554
ConnectedLineNum: 666
CDR(lastapp)=Dial
CDR(src)=554
CDR(dst)=666
AMI Hangup — Stasis call:
Channel: AudioSocket/ 127.0.0.1:8090-b58fcafb-. ..
CallerIDNum:
ConnectedLineNum: 554
CDR(lastapp)=Stasis
CDR(src)=
CDR(dst)=s
Current dialplan:
exten => 123,1,NoOp(User calling AI)
same => n,Answer()
same => n,Set(CONNECTEDLINE(num)=ai_agent)
same => n,Gosub(dial_answer,s,1)
same => n,Stasis(asterisk-ai-voice-agent)
same => n,Hangup()
Questions:
1. Is this expected Asterisk behavior when routing to Stasis — that the final Hangup comes fro m the AudioSocket channel rather than PJSIP?
2. Is there any way to influence which channel generates the final Hangup event?
3. Is there a dialplan-level workaround to properly populate `dst_chan` , `CDR(src)`, `CDR(dst)` for Stasis scenarios?
We tried setting CDR variables and firing a UserEvent before Stasis — the UserEvent appeared in AMI with correct data, but the final Hangup still comes from AudioSocket with empty fields.
Thanks!