Hi,
Websocket module documentation has a code reference to use aliases for SIP routing. However, aliases will not work in the following setup and situation.
1. Kamailio is configured with active and standby node
2. Ping is implemented from webclient and kamailio responds with pong.
3. Two clients ClinetA and ClientB registered themselves to Kamailio.
4. After SIP negotiation (INVITE-200OK) each client learnt about below aliases.
Alias of ClientA:
alias=172.27.6.98~58336
Alias of ClientB:
alias=172.27.6.98~58342
 
So normally if ClientB wants to send SIP message to ClientA, SIP URI from ClientB looks like below
ACK sip:v9d0gtl6@q0lrdlj63pik.invalid;alias=172.27.6.98~58336~5;transport=ws SIP/2.0
 4. Call is in a connected state.

Following is the issue.
i.  Switchover (or network lost or reboot) at Kamailio happened
ii.  Due to ping pong both the clients detected network loss individually and re-registered themselves.
iii.  Aliases of both the clients got changed.
New Alias of ClientA:
alias=172.27.6.98~ 58346
 
New Alias of ClientB:
alias=172.27.6.98~ 58348
 
iv.   But ClientB doesn’t know that ClientA also re-registered and ClientA’s alias got changed and vice-versa
v.    Because of this ClientB still sends BYE with Initial alias
BYE sip:v9d0gtl6@q0lrdlj63pik.invalid;alias=172.27.6.98~58336~5;transport=ws SIP/2.0

Would like to know what is the recommended solution for this problem using alias or is it a limitation of using alias?

Thanks & Regards,
Shahid