[Home]

Summary:ASTERISK-26357: core: AMI binds to random port every Asterisk restart on FreeBSD
Reporter:Roman Petrov (PetrovR)Labels:
Date Opened:2016-09-11 11:28:09Date Closed:2018-07-11 04:39:33
Priority:MajorRegression?
Status:Closed/CompleteComponents:Core/ManagerInterface
Versions:11.23.1 13.10.0 13.11.2 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Appears if world installed with "WITHOUT_INET6=yes" in /etc/src.conf OS: FreeBSD 11.0-STABLE amd64 Asterisk 13.11.2 Also repeated on: Jailed FreeBSD 10.3-PRERELEASE #0 r295211 amd64 Asterisk 13.11.2Attachments:
Description:I'm setup simpliest asterisk system, and try to work with AMI.
That's my manager.conf:
----------------------------------------
[general]
enabled = yes
webenabled= no
debug   = no

port    = 5038
bindaddr= 127.0.0.1

[admin]
secret  = secret
deny    = 0.0.0.0/0.0.0.0
permit  = 127.0.0.1/255.255.255.0
read    = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
write   = system,call,agent,user,config,command,reporting,originate,message
-------------------------------------------------

When I start asterisk, and see: netstat -an | grep LISTEN
there is not 127.0.0.1:5038 socket.

But it has other record:
tcp4       0      0 127.0.0.1.54792        *.*                    LISTEN

And when I try to check that opened port with telnet, it is a AMI port:
telnet 127.0.0.1 54792
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Asterisk Call Manager/2.8.0

I can authorize on telnet with credentials which I setup in manager.conf.
When I see in asterisk console: manager show settings it gives me:
----------------------------------------
Global Settings:
----------------
 Manager (AMI):             Yes          
 Web Manager (AMI/HTTP):    No            
 TCP Bindaddress:           127.0.0.1:0  
 HTTP Timeout (minutes):    60            
 TLS Enable:                No            
 TLS Bindaddress:           Disabled      
 TLS Certfile:              asterisk.pem  
 TLS Privatekey:                          
 TLS Cipher:                              
 Allow multiple login:      Yes          
 Display connects:          Yes          
 Timestamp events:          No            
 Channel vars:                            
 Debug:                     Yes            
----------------------------------------

And other interesting info: When I restart asterisk, that port changes to other and that happens every asterisk restart.

Similar appears with 2 versions: 13.10.0 and 13.11.2

Repeat that on another PC, create new Jail on FreeBSD 10.3-PRERELEASE #0 r295211, install Asterisk 13 and edit only manager.conf to enabled=yes
Problem exists.
Comments:By: Asterisk Team (asteriskteam) 2016-09-11 11:28:10.205-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Rusty Newton (rnewton) 2016-09-14 17:06:01.903-0500

If I understand correctly, you've already verified this doesn't happen with your same configuration on recent Linux distros?  Only on FreeBSD?



By: Roman Petrov (PetrovR) 2016-09-14 23:25:00.955-0500

I have not Linux distro, but I can try it on virtual machine if it needs.

By: Rusty Newton (rnewton) 2016-09-16 06:55:47.925-0500

Yes please test it out. No one has reported it on Linux, but if you can reproduce it, that would be interesting.

By: Roman Petrov (PetrovR) 2016-09-17 16:20:30.703-0500

I found reason of that problem. My investigations shows that "WITHOUT_INET6=YES" option in /etc/src.conf and make buildworld + make installworld with that option causes that problem.
And also I found that "options INET6" in kernel config not impact to AMI. Only option from src.conf.

Is it normal situation or some bug in Asterisk?

By: Corey Farrell (coreyfarrell) 2018-02-20 06:03:36.196-0600

I do not believe this is a bug in Asterisk.  To troubleshoot further you will need to collect debug logs \[1\].  Once you've enabled debug then touch /etc/asterisk/manager.conf (to ensure it is seen as modified), then from Asterisk CLI run {{module reload manager}}.  I suspect you will get messages {{Not an IPv4 nor IPv6 address, cannot get port.}} and {{Not an IPv4 nor IPv6 address, cannot set port.}}.  If so this likely indicates an error in your BSD build, possibly {{getaddrinfo}} failing to set the correct {{ss_family}} to the {{struct sockaddr_storage}}.

\[1\] https://wiki.asterisk.org/wiki/display/AST/Collecting+Debug+Information

By: Joshua C. Colp (jcolp) 2018-07-11 04:39:33.391-0500

Suspended due to lack of activity. This issue will be automatically re-opened if the reporter posts a comment. If you are not the reporter and would like this re-opened please create a new issue instead. If the new issue is related to this one a link will be created during the triage process. Further information on issue tracker usage can be found in the Asterisk Issue Guidlines [1].

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines