Background
Issue #41 extracts a callCtx struct to remove the long parameter lists in the B2BUA response loops. Once that is complete, handleTrunk200OK and handleBob200OK still contain nearly identical logic for:
- parsing Bob's SDP and extracting the RTP address,
- building and sending the ACK to Bob,
- constructing the 200 OK answer to Alice,
- creating
media.Session, media.Bridge, sip.Dialog, and Call objects,
- starting the bridge (early vs delayed offer).
Goal
Extract a shared helper that finalizes a successful B2BUA call for both internal and trunk legs:
func (h *Handler) finalizeCall(ctx context.Context, cc *callCtx, resp *proto.SIPMessage, bobTo *proto.SIPAddress) *Call
The helper should accept the trunk-specific data it needs (e.g. trunkName, bobReqURI, sessionExpires) as additional parameters, or via optional fields in a small trunk-specific wrapper.
Acceptance criteria
Background
Issue #41 extracts a
callCtxstruct to remove the long parameter lists in the B2BUA response loops. Once that is complete,handleTrunk200OKandhandleBob200OKstill contain nearly identical logic for:media.Session,media.Bridge,sip.Dialog, andCallobjects,Goal
Extract a shared helper that finalizes a successful B2BUA call for both internal and trunk legs:
The helper should accept the trunk-specific data it needs (e.g.
trunkName,bobReqURI,sessionExpires) as additional parameters, or via optional fields in a small trunk-specific wrapper.Acceptance criteria
handleTrunk200OKandhandleBob200OKdelegate the common finalization tofinalizeCall.make testandmake lintpass.