The INVITE captured from the router isn’t going to the expected port on Asterisk, and the OK from Asterisk isn’t coming from the correct port. I’d assume a broken SIP ALG, although I don’t understand how the downstream capture is showing the correct port.
Sorry for error: in external capture, word “ASTERISK” must be read as “FIREWALL”.
Being a NATed device, Asterisk server cannot be visible, directly from firewall external interface, where capture was done.
No ALG in place. OPNsense was installed without ALG plugin.
You need to change the router configuration so that it doesn’t change the port number, 5060, when forwarding from the Asterisk machine. Asterisk includes the port number in the Contact header, and won’t know that the router mangled it.
If there is a conflict for 5060, you can change that. Preferably that is done in Asterisk, but you can also add an explicit NAT rule, but in the latter case, you must configure the external port number in Asterisk.
I don’t understand how the router learned the translated number for the incoming request.
Sorry for very long delay in update the topic.
Relying on fact that OpenSIPS 1.9.x was sending an ACK not as asterisk expect it, being in release 22.8.0, I’ve set ignore_uri_user_options=yes in asterisk config.
This has solved the problem.
Now, after update asterisk from 22.8.0 to 22.8.2, looks like that setting isn’t anymore usable, even if it’s described as deprecated only from release 23.x
I’m still not able to understand why asterisk is not accepting ACK from OpenSIPS, but considering that ignore_uri_user_options=yes has “temporary” fixed the issue, what could be the real issue ?
Digging into wireshark trace, I’ve found these (real numbers and data are obfuscated):
In 200 OK frame, To: header field: sip:085123456789@1.2.3.4;tag=603f9263-ea23-4c6d-b445-cf1cc9723cef
In ACK frame, To: header field: sip:085123456789@1.2.3.4:5060;tag=603f9263-ea23-4c6d-b445-cf1cc9723cef
all other header fields are the same between 200 OK and ACK:
I can’t find anything called OpenSIP. Are you sure this is not OpenSIPs?
I will point out that MicroSIP supposedly uses OpenSIPs and it seems to run fine with my FreePBX install. Are you absolutely sure this is an OpenSIPs issue and not coming from the application you wrote that is using it?
I’ve used OpenSIPS with Asterisk extensively in the past and they work perfectly together. I am guessing that Asterisk can’t find which call this ACK is for and silently drops it. I think that if you enable debug on the asterisk side you’ll probably see it. It’s something wrong on the configuration on the opensips side