TsgcTURNClientEvents › OnSTUNBeforeSend

OnSTUNBeforeSend Event

Fires just before a STUN/TURN message is sent to the server, allowing last-minute inspection or modification.

Syntax

property OnSTUNBeforeSend: TsgcSTUNBeforeSendEvent;
// TsgcSTUNBeforeSendEvent = procedure(Sender: TObject; const aMessage: TsgcSTUN_Message) of object

Default Value

Remarks

Called after the STUN/TURN message has been built but before it is serialized to the wire. Use aMessage to inspect the method (Binding, Allocate, Refresh, CreatePermission, ChannelBind, Send or Data Indication), the transaction id and the attribute list, or to add/remove custom attributes. This is the ideal hook for protocol tracing or to enforce policies such as stripping or adding a SOFTWARE attribute.

Example

procedure TForm1.oTURNSTUNBeforeSend(Sender: TObject; const aMessage: TsgcSTUN_Message);
begin
  DoLog('Sending TURN message, transaction id: ' + aMessage.TransactionID);
end;

Back to Events