-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Session Progress early media for outbound calls #41
Comments
Hi @serfreeman1337 . Yes I am aware of this. Creating media session is not completely closed, but I agree we need better control over this, and maybe even providing explicit func. I guess this is where you are targeting, but feel free to provide example how you would expect this. |
I think options := diago.InviteOptions{
Username: "test",
Password: "test",
OnResponse: func(res *sip.Response) error {
fmt.Println("--- SIP response", res.StartLine())
return nil
},
OnRTPSession: func(rtpSess *media.RTPSession) {
// Start receiving RTP packets as soon as SDP is received.
go func() {
var err error
pkt := &rtp.Packet{}
buf := make([]byte, media.RTPBufSize)
for {
_, err = rtpSess.ReadRTP(buf, pkt)
if err != nil {
break
}
...
}
}()
},
} Or it could be done with options := diago.InviteOptions{
Username: "test",
Password: "test",
OnResponse: func(res *sip.Response) error {
fmt.Println("--- SIP response", res.StartLine())
return nil
},
OnDialogMedia: func(dm *diago.DialogMedia) {
// Setup audio reader as soon as SDP is received.
go func() {
m := diago.MediaProps{}
r, err := dm.AudioReader(diago.WithAudioReaderMediaProps(&m))
if err != nil {
return
}
decoder, err := audio.NewPCMDecoderReader(m.Codec.PayloadType, r)
if err != nil {
return
}
...
}()
// Or use RTPSession to receive RTP packets.
rtpSess := dm.RTPSession()
rtpSess.ReadRTP(...)
...
},
} |
hi @serfreeman1337 there is very similar experimenting already. Where this gets problematic is probably that it could make API harder to grasp, but therefore I consider higher level API to stay as well. |
I don't need early media for outbound calls but I have been running into trouble trying to preemptively cancel an outbound call if an answer does not occur within a certain amount of time. I have tried to achieve this a few ways
I could attempt to set timers for the first approach but it seems to leave the remote sip server ringing which is undesirable. |
There should be a way to access an RTP session of outbound calls without waiting for 200 Answer.
During call setup other side can start sending audio with 183 Session Progress.
Currently, RTP session is only created after 200 Answer:
diago/diago.go
Lines 668 to 684 in 8a9f709
The text was updated successfully, but these errors were encountered: