Skip to content

OnCancel callback are not getting called. #107

Answered by pavanputhra
pavanputhra asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, CANCEL belongs to the same INVITE.

After experimenting, I found the following:

By modifying the OnInvite handler as shown below and adding a select with the case <-tx.Cancels(), I receive the CANCEL message via the tx.Cancels() channel, but not through the OnCancel callback. I believe this is the intended behavior.

	server.OnInvite(func(req *sip.Request, tx sip.ServerTransaction) {
		log.Info().Msg("INVITE received")
		tx.Respond(sip.NewResponseFromRequest(req, sip.StatusTrying, "Trying", nil))
		select {
		case <-tx.Cancels():
			log.Info().Msg("CANCEL received in transaction")
			return
		}
	})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pavanputhra
Comment options

Answer selected by emiago
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants