Ahhh, so yes, you are correct regarding passing the web socket URL in transportOptions when configuring the UserAgentOptions, like this:
const transportOptions: TransportOptions = {
};
const userAgentOptions: UserAgentOptions = {
authorizationPassword: pass,
authorizationUsername: username,
contactName: username,
viaHost: userDomain,
transportOptions,
uri
};
But the above is not enough.
When you're making a SIP request (like an INVITE) towards your SIP server itself, you just create the target URI with your SIP domain / IP address and port and pass it to the Inviter object (for example), and Kamailio must know how to relay the request according to your request URI.
Because the WSS URL is not related to the SIP domain / IP of your server that you want to contact to make a REGISTER or place an INVITE.
Hope I explained better now.