Skip to content

Commit

Permalink
Add InviteWithContext for UserAgent.
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwebrtc committed Aug 10, 2021
1 parent ef095f7 commit 19f646c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/ua/ua.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ func (ua *UserAgent) SendRegister(profile *account.Profile, recipient sip.SipUri
}

func (ua *UserAgent) Invite(profile *account.Profile, target sip.Uri, recipient sip.SipUri, body *string) (*session.Session, error) {
return ua.InviteWithContext(context.TODO(), profile, target, recipient, body)
}

func (ua *UserAgent) InviteWithContext(ctx context.Context, profile *account.Profile, target sip.Uri, recipient sip.SipUri, body *string) (*session.Session, error) {

from := &sip.Address{
DisplayName: sip.String{Str: profile.DisplayName},
Expand Down Expand Up @@ -156,7 +160,7 @@ func (ua *UserAgent) Invite(profile *account.Profile, target sip.Uri, recipient
authorizer = auth.NewClientAuthorizer(profile.AuthInfo.AuthUser, profile.AuthInfo.Password)
}

resp, err := ua.RequestWithContext(context.TODO(), *request, authorizer, false, 1)
resp, err := ua.RequestWithContext(ctx, *request, authorizer, false, 1)
if err != nil {
ua.Log().Errorf("INVITE: Request [INVITE] failed, err => %v", err)
return nil, err
Expand Down

0 comments on commit 19f646c

Please sign in to comment.