Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add filter_registrar option #1160

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

maximilianfridrich
Copy link
Contributor

@maximilianfridrich maximilianfridrich commented Jul 22, 2024

transp.c: add sip_transp_add_sock

to add SIP transport protocol without opening a listening socket (UDP socket is always opened).

Related:

@sreimers sreimers added this to the v3.15.0 milestone Jul 22, 2024
src/sip/transp.c Outdated
&transp->laddr,
sip_transp_name(transp->tp));
sip_transp_name(transp->tp),
sa_port(&transp->laddr) ? "" : "not ");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use positive logic?

  • print "(listening)" only if listening is enabled
  • print nothing if it is not enabled

Copy link
Contributor Author

@maximilianfridrich maximilianfridrich Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this function should be adapted in general. Currently, if no listening socket is open for a transport, this function will print e.g.

172.21.0.1:0 (TCP) (not listening)

Not sure if that makes sense since there is no socket option. Maybe we should print something like:

transports:
  UDP, TCP

transport sockets:
  172.21.0.1:5060 (TCP)

and only list actually open sockets

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated it. Now only listening sockets are listed and at the beginning the enabled transport protocols are listed. E.g.:

transports:
  UDP
  TCP
transport sockets:
  10.0.0.5:5060 (TCP) (listening)
  10.0.0.5:46080 (UDP) (listening)
connections:
connection configurations:
client transactions:
  REGISTER   COMPLETED   3s (z9hG4bK4053721133a7884a)
  REGISTER   COMPLETED   3s (z9hG4bK4914acbc12294034)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why then print "(listening)" on each line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Removed the "(listening)".

@maximilianfridrich maximilianfridrich force-pushed the transp_no_listen branch 3 times, most recently from 001c714 to ecef413 Compare July 23, 2024 05:45
src/sip/transp.c Outdated
if (!transp->sock) {
err = udp_listen((struct udp_sock **)
&transp->sock, &transp->laddr,
udp_recv_handler, transp);
Copy link
Collaborator

@cspiel1 cspiel1 Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid to open the UDP listen socket if listen=false?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like discussed: Please remove the changes 1518-1534. For UDP it makes no difference if the listen socket is opened at startup or at first REGISTER.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, with UDP a listening socket has to be opened regardless, so there's not really a point in not opening the socket when adding the transport. Done.

src/sip/transp.c Outdated Show resolved Hide resolved
to add SIP transport protocol without opening a listening socket and
adapt sip_transp_send accordingly to make UDP work.
@cspiel1 cspiel1 merged commit 80baf46 into baresip:main Jul 26, 2024
36 checks passed
@maximilianfridrich maximilianfridrich deleted the transp_no_listen branch July 26, 2024 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants