Skip to content

Commit

Permalink
feat: add client Do request and doc #88
Browse files Browse the repository at this point in the history
  • Loading branch information
emiago committed May 30, 2024
1 parent c05c212 commit 15ebd00
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ select {
}

```

## Client Do request

Unless you need more control over [Client Transaction](#client-transaction) you can simply go with client `Do` request and wait final response.

```go
req := sip.NewRequest(sip.INVITE, sip.Uri{User:"bob", Host: "example.com"})
res, err := client.Do(req)
```

## Client stateless request

```go
Expand Down
4 changes: 2 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ func (c *Client) TransactionRequest(ctx context.Context, req *sip.Request, optio
// It returns on final response.
// Canceling ctx sends Cancel Request but it still returns ctx error
// For more control use TransactionRequest
func (c *Client) Do(ctx context.Context, req *sip.Request, options ...ClientRequestOption) (*sip.Response, error) {
tx, err := c.TransactionRequest(ctx, req, options...)
func (c *Client) Do(ctx context.Context, req *sip.Request) (*sip.Response, error) {
tx, err := c.TransactionRequest(ctx, req)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 15ebd00

Please sign in to comment.