ahbresaa created an issue (kamailio/kamailio#4772)

<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature 
requests. Please use this template only for feature requests.

If you have questions about using Kamailio or related to its configuration 
file, ask on sr-users mailing list:

  * 
https://lists.kamailio.org/mailman3/postorius/lists/sr-users.lists.kamailio.org/

If you have questions about developing extensions to Kamailio or its existing C 
code, ask on sr-dev mailing list:

  * 
https://lists.kamailio.org/mailman3/postorius/lists/sr-dev.lists.kamailio.org/

Please try to fill this template as much as possible for any issue. It helps 
the developers to troubleshoot the issue.

If you submit a feature request (or enhancement) add the description of what 
you would like to be added.

If there is no content to be filled in a section, the entire section can be 
removed.

Note that a feature request may be closed automatically after about 2 months
if there is no interest from developers or community users to implement it, 
being
considered expired. In such case can be reopened by writing a comment that 
includes
the token `/notexpired`. About two weeks before considered expired, the item is
marked with the label `stale`, trying to notify the submitter and everyone else
that might be interested in it. To remove the label `stale`, write a comment 
that
includes the token `/notstale`. Also, any comment postpone the `expire` 
timeline,
being considered that there is interest in the proposed feature request.

You can delete the comments from the template sections when filling.

You can delete next line and everything above before submitting (it is a 
comment).
-->

### Description
Kamailio currently requires a restart when adding new transport listeners 
(listen= lines). This makes dynamic operational changes in production 
environments difficult or risky.

This feature request proposes enabling runtime addition of SIP listen sockets 
via kamcmd, without restarting Kamailio or disrupting existing traffic.

Proposed command example:
``` text
kamcmd core.add_listen 192.168.10.10 5070 udp
```
Use Cases

This capability would be useful in production environments where downtime is 
unacceptable or where SIP topology changes frequently. 


Other examples include:

- Dynamic SIP trunk onboarding
- Moving traffic gradually from one IP to another without restart.
- Dynamically assigning per-customer SIP listeners.
- Cloud / autoscaling environments
- Maintenance operations
- Temporarily adding listeners for testing or debugging without reload cycles.

<!--
Explain what you did, what you expected to happen, and what actually happened.
-->

### Expected behavior
- Kamailio accepts a runtime command via kamcmd.
-  A new listener is created and bound immediately.
-  All worker processes become aware of the new socket and are able to send SIP 
traffic on it.
-  No restart or full reload is required.
-  Existing traffic is unaffected.

### Actual observed behavior
Kamailio does not currently support runtime modification of listening sockets.

Changes to 'listen=' require restart.

### Possible Solutions

<!--
If you found a solution or workaround for the issue, describe it. Ideally, 
provide a pull request with a improvement.
-->
To support runtime addition of listeners, a coordinated multi-process update 
mechanism is required:

1. IPC mechanism
    - Introduce IPC between main process and workers (e.g., Unix domain socket).
    - Workers must be notified when a new endpoint added(e.g. epoll, singal, 
...).
2. Socket distribution
    - Main process creates new socket.
    - File descriptor is passed to worker processes using SCM_RIGHTS.
3. Runtime state update
    - Update internal structures(udp_listen, tcp_listen, ...)

While investigating the TCP transport implementation, I observed that Kamailio 
already uses a multi-process TCP architecture with a dedicated TCP main process 
and worker processes, communicating via Unix domain sockets and SCM_RIGHTS file 
descriptor passing(src/core/pass_fd).
### Concerns
Modules and parts such as:

- counters/stats(dns, blocklist, ...)
- topoh
- rr
- path
- NAT handling logic
- ...

may assume static transport bindings.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4772
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/[email protected]>
_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to