IAX2 Show Registry Incorrect in 12.0.0

Hi,

Just an fyi that there is an issue with the IAX2 show registry cli command. It is consistenly showing the ip address address of the host in the perceived column. I am up and running on version 12.0.0 and can receive and place calls. Because of this I know my public IP is registered ok at the remote host. However, I’ve had issues in the past with the perceived port number changing for no reason with my voip vendor so I have a script that checks the ip and port every hour. That scrip is now failing because the percieved ip address does not match my public ip address in the show registry.

[color=#BFBF00]Host dnsmgr Username Perceived Refresh State
69.71.222.196:4569 Y 499999 69.71.222.196:4569 60 Registered
1 IAX2 registrations.
[/color]
The startup log for IAX2 confirms that public ip address is being registered:

[color=#BFBF00]chan_iax2.c: [Dec 23 05:05:05] – Registered IAX2 to ‘69.71.222.196’, who sees us as 76.168.x.x:4569 with no messages waiting[/color]

In looking at the code for the cli command in chan_iax2.c, it looks like a simple typo in two places where the wrong field is copied. I’m including the change from the commit with the problem and also incldued below is the fix I did locally to get around the problem. My fix may not be complete as I was only interested in getting ‘iax2 show registery’ working. :wink:

Thanks
riley

Commit 3d6a73e398d7889c8754de1acd14221b351ca905
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 77fd442..1bbf18e 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c

@@ -7075,13 +7171,12 @@
 	AST_LIST_LOCK(&registrations);
 	AST_LIST_TRAVERSE(&registrations, reg, entry) {
 		snprintf(host, sizeof(host), "%s", ast_sockaddr_stringify(&reg->addr));
-		if (reg->us.sin_addr.s_addr)
-			snprintf(perceived, sizeof(perceived), "%s:%d", ast_inet_ntoa(reg->us.sin_addr), ntohs(reg->us.sin_port));
-		else
-			ast_copy_string(perceived, "<Unregistered>", sizeof(perceived));
+
+		snprintf(perceived, sizeof(perceived), "%s", ast_sockaddr_isnull(&reg->addr) ? "<Unregistered>" : ast_sockaddr_stringify(&reg->addr));
+
@@ -7109,11 +7204,7 @@
 	AST_LIST_TRAVERSE(&registrations, reg, entry) {
 		snprintf(host, sizeof(host), "%s", ast_sockaddr_stringify(&reg->addr));
 
-		if (reg->us.sin_addr.s_addr) {
-			snprintf(perceived, sizeof(perceived), "%s:%d", ast_inet_ntoa(reg->us.sin_addr), ntohs(reg->us.sin_port));
-		} else {
-			ast_copy_string(perceived, "<Unregistered>", sizeof(perceived));
-		}
+		snprintf(perceived, sizeof(perceived), "%s", ast_sockaddr_isnull(&reg->addr) ? "<Unregistered>" : ast_sockaddr_stringify(&reg->addr));

My Local Fix

[code]diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index dcbd210…316a170 100644
— a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -7175,7 +7175,7 @@
AST_LIST_TRAVERSE(&registrations, reg, entry) {
snprintf(host, sizeof(host), “%s”, ast_sockaddr_stringify(&reg->addr));

  •   snprintf(perceived, sizeof(perceived), "%s", ast_sockaddr_isnull(&reg->addr) ? "<Unregistered>" : ast_sockaddr_stringify(&reg->addr));
    
  •   snprintf(perceived, sizeof(perceived), "%s", ast_sockaddr_isnull(&reg->us) ? "<Unregistered>" : ast_sockaddr_stringify(&reg->us));
    
      ast_cli(a->fd, FORMAT, host,
      		(reg->dnsmgr) ? "Y" : "N",
    

@@ -7207,8 +7207,8 @@
AST_LIST_TRAVERSE(&registrations, reg, entry) {
snprintf(host, sizeof(host), “%s”, ast_sockaddr_stringify(&reg->addr));

  •   snprintf(perceived, sizeof(perceived), "%s", ast_sockaddr_isnull(&reg->addr) ? "<Unregistered>" : ast_sockaddr_stringify(&reg->addr));
    
  •   snprintf(perceived, sizeof(perceived), "%s", ast_sockaddr_isnull(&reg->us) ? "<Unregistered>" : ast_sockaddr_stringify(&reg->us));
    
  •   astman_append(s,
      	"Event: RegistryEntry\r\n"
      	"%s"
    

[/code]

Howdy,

wiki.asterisk.org/wiki/display/ … reportabug

:smile:

In particular, note that patches posted on this forum will not be used as there is no evidence that the submitter has executed the contributor agreement.

Sorry bout that. wasn’t setup to submit issues but wanted to make sure people were aware of it. I am now setup in jira and received my acknowledgment email so I will formally get it submitted today! :smile:

thanks
rb

Awesome, thank you :smile: