Skip to content

Commit

Permalink
fix: Use sip.Message instead of sip.Request for GetBranchID, close #76.
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwebrtc committed Jan 12, 2022
1 parent 60d040f commit 1b0f995
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/ua/ua.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions pkg/utils/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 1b0f995

Please sign in to comment.