diff --git a/pkg/ua/ua.go b/pkg/ua/ua.go index e56c8e3..38726ba 100644 --- a/pkg/ua/ua.go +++ b/pkg/ua/ua.go @@ -492,7 +492,7 @@ func (ua *UserAgent) RequestWithContext(ctx context.Context, request sip.Request case provisional := <-provisionals: callID, ok := provisional.CallID() if ok { - branchID := utils.GetBranchID(provisional.(sip.Request)) + branchID := utils.GetBranchID(provisional) if v, found := ua.iss.Load(NewSessionKey(*callID, branchID)); found { is := v.(*session.Session) is.StoreResponse(provisional) @@ -527,7 +527,7 @@ func (ua *UserAgent) RequestWithContext(ctx context.Context, request sip.Request case response := <-responses: callID, ok := response.CallID() if ok { - branchID := utils.GetBranchID(response.(sip.Request)) + branchID := utils.GetBranchID(response) if v, found := ua.iss.Load(NewSessionKey(*callID, branchID)); found { if request.IsInvite() { is := v.(*session.Session) diff --git a/pkg/utils/util.go b/pkg/utils/util.go index 37aa175..73647c7 100644 --- a/pkg/utils/util.go +++ b/pkg/utils/util.go @@ -16,8 +16,8 @@ var ( ErrPort = errors.New("invalid port") ) -func GetBranchID(request sip.Request) sip.MaybeString { - if viaHop, ok := request.ViaHop(); ok { +func GetBranchID(msg sip.Message) sip.MaybeString { + if viaHop, ok := msg.ViaHop(); ok { if branch, ok := viaHop.Params.Get("branch"); ok { return branch }