[OpenSIPS-Users] cluster configuration for dialogs

2023-05-02 Thread Alberto
Hi,
do you ever get the feeling you are going nuts? Anyways...
I have 2 opensips servers, both version 3.2.12, on debian 11
they both share the same configuration, and start opensips using m4 as
follows: `opensips -F -f /etc/opensips/opensips.cfg -p "m4
/etc/opensips/env.m4 -"`


m4 server1:divert(-1)
define(`M4_LAN_IP', `10.0.0.124')
define(`M4_WAN_IP', `10.0.0.124')
define(`M4_CLUSTER_NODE_ID', `1')
define(`M4_SHARING_TAG', `node_1')
define(`M4_CLUSTER_ID', `1')
divert(0)dnl


m4 server 2:divert(-1)
define(`M4_LAN_IP', `10.0.0.125')
define(`M4_WAN_IP', `10.0.0.125')
define(`M4_CLUSTER_NODE_ID', `2')
define(`M4_SHARING_TAG', `node_2')
define(`M4_CLUSTER_ID', `1')
divert(0)dnl


configuration:
debug_mode=no

log_level=2
xlog_level=2
log_stdout=yes
log_stderror=yes
log_facility=LOG_LOCAL0

auto_aliases=no

server_signature=yes

socket=udp:0.0.0.0:5060 as M4_WAN_IP:5060
socket=tcp:0.0.0.0:5060 as M4_WAN_IP:5060
socket=tls:0.0.0.0:5061 as M4_WAN_IP:5061
socket=bin:0.0.0.0: as M4_WAN_IP:

tcp_connect_timeout=300

mpath="/usr/lib64/opensips/modules/"

loadmodule "tls_openssl.so"

loadmodule "tls_mgm.so"
modparam("tls_mgm", "tls_library", "openssl")

modparam("tls_mgm", "server_domain", "sd_1")
modparam("tls_mgm", "ca_list", "[sd_1]/opt/letsencrypt/fullchain.pem")
modparam("tls_mgm", "ca_dir", "[sd_1]/etc/ssl/certs")
modparam("tls_mgm", "certificate", "[sd_1]/opt/letsencrypt/cert.pem")
modparam("tls_mgm", "private_key", "[sd_1]/opt/letsencrypt/privkey.pem")
modparam("tls_mgm", "require_cert", "[sd_1]0")
modparam("tls_mgm", "tls_method", "[sd_1]TLSv1-")
modparam("tls_mgm", "verify_cert", "[sd_1]0")
modparam("tls_mgm", "ec_curve", "[sd_1]secp521r1")

modparam("tls_mgm", "client_domain", "cd_1")
modparam("tls_mgm", "ca_list", "[cd_1]/opt/letsencrypt/fullchain.pem")
modparam("tls_mgm", "ca_dir", "[cd_1]/etc/ssl/certs")
modparam("tls_mgm", "certificate", "[cd_1]/opt/letsencrypt/cert.pem")
modparam("tls_mgm", "private_key", "[cd_1]/opt/letsencrypt/privkey.pem")
modparam("tls_mgm", "require_cert", "[cd_1]0")
modparam("tls_mgm", "tls_method", "[cd_1]TLSv1-")
modparam("tls_mgm", "verify_cert", "[cd_1]0")
modparam("tls_mgm", "ec_curve", "[cd_1]secp521r1")
modparam("tls_mgm", "match_sip_domain", "[cd_1]*")
modparam("tls_mgm", "match_ip_address", "[cd_1]*")

loadmodule "cachedb_mongodb.so"

loadmodule "db_mysql.so"
modparam("db_mysql", "exec_query_threshold", 0)
modparam("db_mysql", "timeout_interval", 5)
modparam("db_mysql", "max_db_queries", 5)
modparam("db_mysql", "max_db_retries", 5)

loadmodule "clusterer.so"
modparam("clusterer", "db_url", "mysql://opensips:opensipsrw@localhost
/opensips")
modparam("clusterer", "my_node_id", M4_CLUSTER_NODE_ID)
modparam("clusterer", "seed_fallback_interval", 5)
modparam("clusterer", "sharing_tag", "M4_SHARING_TAG/M4_CLUSTER_ID=active")

loadmodule "signaling.so"

loadmodule "sl.so"

loadmodule "tm.so"
modparam("tm", "auto_100trying", 0)
modparam("tm", "fr_inv_timeout", 120)
modparam("tm", "fr_timeout", 30)
modparam("tm", "onreply_avp_mode", 1)
modparam("tm", "restart_fr_on_each_reply", 0)

loadmodule "rr.so"
modparam("rr", "append_fromtag", 1)

loadmodule "dialog.so"
modparam("dialog", "cachedb_url", "mongodb://
10.0.0.120:27017/opensipsDB.dialog")
modparam("dialog", "default_timeout", 14400) # 4 hours
modparam("dialog", "dialog_replication_cluster", M4_CLUSTER_ID)
modparam("dialog", "dlg_match_mode", 1)
modparam("dialog", "enable_stats", 1)
modparam("dialog", "profile_replication_cluster", M4_CLUSTER_ID)
modparam("dialog", "profiles_no_value", "shared/s")
modparam("dialog", "profiles_with_value", "caller")

loadmodule "topology_hiding.so"
modparam("topology_hiding", "force_dialog", 1)

loadmodule "uac.so"
modparam("uac", "restore_mode", "auto")
modparam("uac", "force_dialog", yes)

loadmodule "permissions.so"
modparam("permissions", "db_url", "mysql://opensips:opensipsrw@localhost
/opensips")

loadmodule "sipmsgops.so"

loadmodule "textops.so"

loadmodule "callops.so"

loadmodule "usrloc.so"
modparam("usrloc", "cachedb_url", "mongodb://
10.0.0.120:27017/opensipsDB.usrloc")
modparam("usrloc", "location_cluster", M4_CLUSTER_ID)
modparam("usrloc", "nat_bflag", "NAT")
modparam("usrloc", "use_domain", 1)
modparam("usrloc", "working_mode_preset", "federation-cachedb-cluster")

loadmodule "registrar.so"
modparam("registrar", "max_contacts", 1)
modparam("registrar", "tcp_persistent_flag", "TCP_PERSIST_DURATION")

loadmodule "mid_registrar.so"
modparam("mid_registrar", "max_contacts", 1)
modparam("mid_registrar", "mode", 0)
modparam("mid_registrar", "tcp_persistent_flag",
"TCP_PERSIST_REGISTRATIONS")

loadmodule "proto_bin.so"

loadmodule "proto_udp.so"

loadmodule "proto_tcp.so"

loadmodule "proto_tls.so"

route {
  if (has_totag()) {
if (topology_hiding_match("DID_FALLBACK")) {
} else if (loose_route()) {
  if ($DLG_status != NULL && !validate_dialog()) {
exit;
  }
} else {
  if (is_method("ACK")) {
if (t_check_trans()) {
  t_relay();

Re: [OpenSIPS-Users] The contact value related issue

2023-05-02 Thread Răzvan Crainea

Hi, Anton!

Calling fix_nated_contact() in the on_reply route is the way to do it, 
no other work around. Try to make sure the function is actually called 
for your reply, perhaps the route is not actual executed for that reply. 
You can double check by printing some xlogs "guarding" the 
fix_nated_contact() and check if they appear in your logs.


Best regards,

Răzvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com

On 4/19/23 15:28, Anton Danilov wrote:

Hello, everyone.

I've faced a strange issue: incorrect port number in the contact
header of 200 Ok reply causes ACK loss and dialog termination.

Here is the UML diagram in svg format (also in the attach):
https://drive.google.com/file/d/1ti5SjpV3H8SM6rHovAbBOL86ZSu9N2x2/view?usp=share_link

I've tried to fix this with the fix_nated_contact() function in the
on_reply route, but it seems like it doesn't work - the port number is
still unchanged.

Is there a way to fix it without manual manipulation with regular expressions?

--
Anton Danilov.


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] 3.2.12 upgrade >> fifo_reply permission denied error

2023-05-02 Thread Răzvan Crainea

Hi, James!

The problem seems to have been in OpenSIPS CLI and it was fixed by 
this[1] commit. Please update opensips cli and test again.


[1] 
https://github.com/OpenSIPS/opensips-cli/commit/114ee4d91ab970f59126b1568e2eec4c9abaadd6


Best regards,

Răzvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com

On 4/21/23 16:40, James Seer wrote:

Hello,
After an upgrade to OpenSIPS 3.2.12 , I cant run opensips-cli -x mi 
using root. It's been working with the previous versions.


Apr 21 14:02:51 test-opensips/usr/sbin/opensips[705536]: 
ERROR:mi_fifo:mi_open_reply_pipe: open error 
(/tmp/opensips_fifo_reply_705551_1682078571_0451558): Permission denied
Apr 21 14:02:51 test-opensips  /usr/sbin/opensips[705536]: 
NOTICE:mi_fifo:mi_fifo_callback: cannot open reply pipe 
/tmp/opensips_fifo_reply_705551_1682078571_0451558


changing reply folder from tmp to another non sticky bit one , with full 
rights (for test purposes) does not change anything :


root@test-opensips:~# ls -dl /var/run/fiforeply/
drwsrwsrwt 2 opensips opensips 60 Apr 21 14:11 /var/run/fiforeply/

Apr 21 14:11:11 test-opensips /usr/sbin/opensips[705725]: 
ERROR:mi_fifo:mi_open_reply_pipe: open error 
(/var/run/fiforeply/opensips_fifo_reply_705741_1682079071_2581842): 
Permission denied
Apr 21 14:11:11 test-opensips /usr/sbin/opensips[705725]: 
NOTICE:mi_fifo:mi_fifo_callback: cannot open reply pipe 
/var/run/fiforeply/opensips_fifo_reply_705741_1682079071_2581842


Opensips-cli version is the same before and after the upgrade : OpenSIPS 
CLI 0.2.0


As a current workaround i'm running it through opensips user :
runuser -u opensips -- opensips-cli -x mi uptime




opensips-cli config :

[default]
log_level: WARNING
prompt_name: opensips-cli
prompt_intro: Welcome to OpenSIPS Command Line Interface!
prompt_emptyline_repeat_cmd: False
history_file: ~/.opensips-cli.history
history_file_size: 1000
output_type: pretty-print
communication_type: fifo
fifo_file: /var/run/opensips/opensips_fifo

Opensips config file  :

 FIFO Management Interface
loadmodule "mi_fifo.so"
modparam("mi_fifo", "fifo_name", "/var/run/opensips/opensips_fifo")
modparam("mi_fifo", "fifo_mode", 0666)

root@test-opensips:~# ps aux |grep opensips
opensips  705724  0.0  0.6 541560 13984 ?        S    14:11   0:00 
/usr/sbin/opensips -P /run/opensips/opensips.pid -f 
/etc/opensips/opensips.cfg -m 500 -M 8
opensips  705725  0.0  0.3 542060  6780 ?        S    14:11   0:00 
/usr/sbin/opensips -P /run/opensips/opensips.pid -f 
/etc/opensips/opensips.cfg -m 500 -M 8

...
...

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users