emiago / diago

Short of Dialog + GO. Library/Framework for building VOIP solutions in GO
Mozilla Public License 2.0
102 stars 10 forks source link

NewDiago replaces sipgo.Server's handlers #17

Closed Qjawko closed 4 weeks ago

Qjawko commented 1 month ago

Hi,

I am trying to customize the OPTIONS handler response to fit my specific requirements. However, when I call diago.NewDiago with my own sipgo.Server that has a defined OPTIONS handler, Diago overrides it with its own implementation.

I will submit a PR that modifies this behavior so that Diago checks for already registered methods and avoids replacing them.

Thank you!

SilvaMendes commented 1 month ago

but why didn't I add validation to server.OnInvite as well? Do you have an example of how you are customizing the methods?

Qjawko commented 1 month ago

but why didn't I add validation to server.OnInvite as well? Do you have an example of how you are customizing the methods?

I don't think that someone will need it, because diago already handles RTP streaming (inside sipgo handler) and other stuff.

Here is an example

srv, _ := sipgo.NewServer(ua)

srv.OnOptions(func(req *sip.Request, tx sip.ServerTransaction) {
    // do your stuff
})

dg := diago.NewDiago(ua, diago.WithServer(srv))
SilvaMendes commented 1 month ago

ok, i understand

emiago commented 4 weeks ago

works as intended. Thanks anyway for reporting this.