Skip to content

Commit

Permalink
fix: remove tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
emiago committed Feb 19, 2024
1 parent 5fee81e commit f7c1ab8
Showing 1 changed file with 43 additions and 43 deletions.
86 changes: 43 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,52 +35,52 @@ Phone is wrapper that can make you easy build phone, create/receive SIP call, ha
### Dialer

```go
ua, _ := sipgo.NewUA()
defer ua.Close()

// Create a phone
phone := sipgox.NewPhone(ua)

// Run dial
ctx, _ := context.WithTimeout(context.Background(), 60*time.Second)
dialog, err := phone.Dial(ctx, sip.Uri{User:"bob", Host: "localhost", Port:5060}, sipgox.DialOptions{})
if err != nil {
// handle error
return
}
defer dialog.Close() // Close dialog for cleanup

select {
case <-dialog.Done():
return
case <-time.After(5 *time.Second):
dialog.Hangup(context.TODO())
}
ua, _ := sipgo.NewUA()
defer ua.Close()

// Create a phone
phone := sipgox.NewPhone(ua)

// Run dial
ctx, _ := context.WithTimeout(context.Background(), 60*time.Second)
dialog, err := phone.Dial(ctx, sip.Uri{User:"bob", Host: "localhost", Port:5060}, sipgox.DialOptions{})
if err != nil {
// handle error
return
}
defer dialog.Close() // Close dialog for cleanup

select {
case <-dialog.Done():
return
case <-time.After(5 *time.Second):
dialog.Hangup(context.TODO())
}
```

### Receiver

```go
ua, _ := sipgo.NewUA()
defer ua.Close()

// Create a phone
phone := sipgox.NewPhone(ua)

ctx, _ := context.WithCancel(context.Background())
dialog, err := phone.Answer(ctx, sipgox.AnswerOptions{
Ringtime: 5* time.Second,
})
if err != nil {
//handle error
return
}
defer dialog.Close() // Close dialog for cleanup

select {
case <-dialog.Done():
return
case <-time.After(10 *time.Second):
dialog.Hangup(context.TODO())
}
ua, _ := sipgo.NewUA()
defer ua.Close()

// Create a phone
phone := sipgox.NewPhone(ua)

ctx, _ := context.WithCancel(context.Background())
dialog, err := phone.Answer(ctx, sipgox.AnswerOptions{
Ringtime: 5* time.Second,
})
if err != nil {
//handle error
return
}
defer dialog.Close() // Close dialog for cleanup

select {
case <-dialog.Done():
return
case <-time.After(10 *time.Second):
dialog.Hangup(context.TODO())
}
```

0 comments on commit f7c1ab8

Please sign in to comment.