Skip to content

Commit

Permalink
add dialog helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
ghettovoice committed Jun 24, 2018
1 parent c33a8ba commit cfdd2cc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sip/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func DefaultPort(protocol string) Port {
}
}

func MakeDialogID(msg Message) (string, error) {
func MakeDialogIdFromMessage(msg Message) (string, error) {
callID, ok := msg.CallID()
if !ok {
return "", fmt.Errorf("missing Call-ID header")
Expand All @@ -191,7 +191,9 @@ func MakeDialogID(msg Message) (string, error) {
return "", fmt.Errorf("missing tag param in From header")
}

id := strings.Join([]string{string(*callID), toTag.String(), fromTag.String()}, ":")
return MakeDialogId(string(*callID), toTag.String(), fromTag.String()), nil
}

return id, nil
func MakeDialogId(callId, toTag, fromTag string) string {
return strings.Join([]string{callId, toTag, fromTag}, ":")
}

0 comments on commit cfdd2cc

Please sign in to comment.