diff --git a/options.go b/options.go index f2b2591..8656d0b 100644 --- a/options.go +++ b/options.go @@ -7,8 +7,12 @@ type RequestWithContextOption interface { } type RequestWithContextOptions struct { - ResponseHandler func(res sip.Response, request sip.Request) - Authorizer sip.Authorizer + ResponseHandler func(res sip.Response, request sip.Request) + Authorizer sip.Authorizer + ClientTransactionCallbacks +} + +type ClientTransactionCallbacks struct { OnAckFn, OnCancelFn func(sip.Request) } @@ -36,15 +40,15 @@ func WithAuthorizer(authorizer sip.Authorizer) RequestWithContextOption { return withAuthorizer{authorizer} } -type withCallbacks struct { +type withClientTxCallbacks struct { onAckFn, onCancFn func(sip.Request) } -func WithCallbacks(onAckFn, onCancFn func(sip.Request)) RequestWithContextOption { - return withCallbacks{onAckFn, onCancFn} +func WithClientTransactionCallbacks(callbacks ClientTransactionCallbacks) RequestWithContextOption { + return withClientTxCallbacks{callbacks.OnAckFn, callbacks.OnCancelFn} } -func (o withCallbacks) ApplyRequestWithContext(options *RequestWithContextOptions) { +func (o withClientTxCallbacks) ApplyRequestWithContext(options *RequestWithContextOptions) { options.OnAckFn = o.onAckFn options.OnCancelFn = o.onCancFn }