RFC 3581 compliance


I was trying to build a setup with Asterisk as a SIP server and Kamailio as a proxy, however, I couldn’t make SIP calls to be routed in a symmetric way via the proxy, despite configuring the proxy to add “rport” to SIP requests.

Looking at the Asterisk trunk code I could find a reference to symmetric routing, however, the code doesn’t seem to handle it correctly. Following is the patch that made the Asterisk work as expected.

Index: channels/chan_sip.c
--- channels/chan_sip.c	(revision 434725)
+++ channels/chan_sip.c	(working copy)
@@ -17148,7 +17148,8 @@
 			set_peer_nat(p, peer);
-			ast_copy_flags(&p->flags[0], &peer->flags[0], SIP_NAT_FORCE_RPORT);
+ 			ast_copy_flags(&peer->flags[0], &p->flags[0], SIP_NAT_FORCE_RPORT);
+ 			ast_copy_flags(&peer->flags[0], &p->flags[0], SIP_NAT_RPORT_PRESENT);
 			if (!(res = check_auth(p, req, peer->name, peer->secret, peer->md5secret, SIP_REGISTER, uri2, XMIT_UNRELIABLE))) {
 				if (sip_cancel_destroy(p))

Am I missing something?


Please do not post patches as anything other than a code attachment to a bug report. Without the licence grant that you give when you go through that route, the developers cannot even look at your patch code and you risk making it difficult for someone to submit an equivalent patch in future, as there will be uncertainty as to whether they really developed it independently.

Thanks for the clarification. Filed a bug report ASTERISK-25071 for this issue.