pjsip_transport_events: handle multiple addresses for a domain

The key used for transport monitors was the remote host name for the
transport and not the remote address resolved for this domain.

This was problematic for domains returning multiple addresses as several
transport monitors were created with the same key.

Whenever a subsystem wanted to register a callback it would always end
up attached to the first transport monitor with a matching key.

The key used for transport monitors is now the remote address and port
the transport actually connected to.

Fixes: #932
This commit is contained in:
Thomas Guebels
2024-10-29 15:32:33 +01:00
parent b01a3cfdcb
commit 2ee258b0fc
2 changed files with 10 additions and 10 deletions

View File

@@ -88,10 +88,7 @@
* \param _dest The destination buffer of at least IP6ADDR_COLON_PORT_BUFLEN bytes
*/
#define AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR(_transport, _dest) \
snprintf(_dest, IP6ADDR_COLON_PORT_BUFLEN, \
PJSTR_PRINTF_SPEC ":%d", \
PJSTR_PRINTF_VAR(_transport->remote_name.host), \
_transport->remote_name.port);
pj_sockaddr_print(&_transport->key.rem_addr, _dest, sizeof(_dest), 1);
/* Forward declarations of PJSIP stuff */
struct pjsip_rx_data;