Connecting to Asterisk - modules, port issues

Hello ,

I am new to asterisk but not to the IT industry. I installed Asterisk and I having a number of issues. Maybe they are related so I will list them here.

  1. Port 5060 is NOT open - when I testing using nmap I get the following

sudo nmap -p 5060 -sU -P0 192.168.1.185

Nmap scan report for 192.168.1.185
Host is up (0.011s latency).
PORT STATE SERVICE
5060/udp closed sip
MAC Address: 00:15:C5:5E:EE:D8 (Dell)

My router has port 5060 open and it passes the nmap quere I just cannot communicate to my server running Asterisk.

  1. I configured the asterisk.conf so that it runs as asteriskpbx and I configured module.conf to show all modules.

For some reason there are NO modules being displayed.

I am using the book Asterisk - The definitive guide (4th edition) to help me with the install. The book assumes everything is working well. … Which of course it is not.

Here is my module.conf

[modules]
autoload=yes

  1. I cannot open asterisk with asterisk -r. I always get the following error.

sudo asterisk - r

Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)

Maybe I should just reinstall Asterisk. Any idea how I can remove and install asterisk ?

Staarting with Your 3rd bulletpoint it seems to me, that Your asterisk instance isn’t running.
Try to execute

and look what happens.
Normaly You should see asterisk starting and generating output.
If You still encounter problems 1 and 2 just post the output of the recommended command.

I was able fix number 3. I just needed to sign in as the root before using sudo asterisk -r.

Issue # 2.

I am still not able to see the modules. I think once I get the modules to load again I can look at the port issue.

Here is what the output is when I log in using " sudo asterisk -cvvvvv "

[code]root@ubuntu-server2:~$ sudo asterisk -cvvvvv
Asterisk 11.4.0, Copyright © 1999 - 2012 Digium, Inc. and others.
Created by Mark Spencer markster@digium.com
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.

Running as user 'asteriskpbx’
Running under group ‘asteriskpbx’
== Parsing ‘/etc/asterisk/extconfig.conf’: Found
== Parsing ‘/etc/asterisk/logger.conf’: Found
== Parsing ‘/etc/asterisk/asterisk.conf’: Found
== Manager registered action DBGet
== Manager registered action DBPut
== Manager registered action DBDel
== Manager registered action DBDelTree
== Registered custom function ‘MESSAGE’
== Registered custom function ‘MESSAGE_DATA’
== Registered application ‘MessageSend’
== Manager registered action MessageSend
== Manager registered action DataGet
== Parsing ‘/etc/asterisk/codecs.conf’: Found
Asterisk Dynamic Loader Starting:
== Parsing ‘/etc/asterisk/modules.conf’: Found
== Parsing ‘/etc/asterisk/dnsmgr.conf’: Found
== Parsing ‘/etc/asterisk/acl.conf’: Found
== Parsing ‘/etc/asterisk/http.conf’: Found
== Manager registered action Ping
== Manager registered action Events
== Manager registered action Logoff
== Manager registered action Login
== Manager registered action Challenge
== Manager registered action Hangup
== Manager registered action Status
== Manager registered action Setvar
== Manager registered action Getvar
== Manager registered action GetConfig
== Manager registered action GetConfigJSON
== Manager registered action UpdateConfig
== Manager registered action CreateConfig
== Manager registered action ListCategories
== Manager registered action Redirect
== Manager registered action Atxfer
== Manager registered action Originate
== Manager registered action Command
== Manager registered action ExtensionState
== Manager registered action PresenceState
== Manager registered action AbsoluteTimeout
== Manager registered action MailboxStatus
== Manager registered action MailboxCount
== Manager registered action ListCommands
== Manager registered action SendText
== Manager registered action UserEvent
== Manager registered action WaitEvent
== Manager registered action CoreSettings
== Manager registered action CoreStatus
== Manager registered action Reload
== Manager registered action CoreShowChannels
== Manager registered action ModuleLoad
== Manager registered action ModuleCheck
== Manager registered action AOCMessage
== Manager registered action Filter
== Registered custom function ‘AMI_CLIENT’
== Parsing ‘/etc/asterisk/manager.conf’: Found
== Parsing ‘/etc/asterisk/users.conf’: Found
== Parsing ‘/etc/asterisk/cdr.conf’: Found
[Jul 3 06:22:54] NOTICE[2289]: cdr.c:1623 do_reload: CDR simple logging enabled.
== Parsing ‘/etc/asterisk/cel.conf’: Found
– CEL logging disabled.
== Parsing ‘/etc/asterisk/dsp.conf’: Found
== Parsing ‘/etc/asterisk/udptl.conf’: Found
Asterisk PBX Core Initializing
Registering builtin applications:
== Registered custom function ‘EXCEPTION’
== Registered custom function ‘TESTTIME’
[Answer]
== Registered application ‘Answer’
[BackGround]
== Registered application ‘BackGround’
[Busy]
== Registered application ‘Busy’
[Congestion]
== Registered application ‘Congestion’
[ExecIfTime]
== Registered application ‘ExecIfTime’
[Goto]
== Registered application ‘Goto’
[GotoIf]
== Registered application ‘GotoIf’
[GotoIfTime]
== Registered application ‘GotoIfTime’
[ImportVar]
== Registered application ‘ImportVar’
[Hangup]
== Registered application ‘Hangup’
[Incomplete]
== Registered application ‘Incomplete’
[NoOp]
== Registered application ‘NoOp’
[Proceeding]
== Registered application ‘Proceeding’
[Progress]
== Registered application ‘Progress’
[RaiseException]
== Registered application ‘RaiseException’
[ResetCDR]
== Registered application ‘ResetCDR’
[Ringing]
== Registered application ‘Ringing’
[SayAlpha]
== Registered application ‘SayAlpha’
[SayDigits]
== Registered application ‘SayDigits’
[SayNumber]
== Registered application ‘SayNumber’
[SayPhonetic]
== Registered application ‘SayPhonetic’
[Set]
== Registered application ‘Set’
[MSet]
== Registered application ‘MSet’
[SetAMAFlags]
== Registered application ‘SetAMAFlags’
[Wait]
== Registered application ‘Wait’
[WaitExten]
== Registered application ‘WaitExten’
== Manager registered action ShowDialPlan
== Parsing ‘/etc/asterisk/indications.conf’: Found
– Registered indication country ‘at’
– Registered indication country ‘au’
– Registered indication country ‘bg’
– Registered indication country ‘br’
– Registered indication country ‘be’
– Registered indication country ‘ch’
– Registered indication country ‘cl’
– Registered indication country ‘cn’
– Registered indication country ‘cz’
– Registered indication country ‘de’
– Registered indication country ‘dk’
– Registered indication country ‘ee’
– Registered indication country ‘es’
– Registered indication country ‘fi’
– Registered indication country ‘fr’
– Registered indication country ‘gr’
– Registered indication country ‘hu’
– Registered indication country ‘il’
– Registered indication country ‘in’
– Registered indication country ‘it’
– Registered indication country ‘lt’
– Registered indication country ‘jp’
– Registered indication country ‘mx’
– Registered indication country ‘my’
– Registered indication country ‘nl’
– Registered indication country ‘no’
– Registered indication country ‘nz’
– Registered indication country ‘ph’
– Registered indication country ‘pl’
– Registered indication country ‘pt’
– Registered indication country ‘ru’
– Registered indication country ‘se’
– Registered indication country ‘sg’
– Registered indication country ‘th’
– Registered indication country ‘uk’
– Registered indication country ‘us’
– Registered indication country ‘us-old’
– Registered indication country ‘tw’
– Registered indication country ‘ve’
– Registered indication country ‘za’
– Setting default indication country to ‘us’
== Parsing ‘/etc/asterisk/features.conf’: Found
– Registered extension context ‘parkedcalls’; registrar: features
– Added extension ‘700’ priority 1 to parkedcalls
== Registered application ‘Bridge’
== Registered application ‘ParkedCall’
== Registered application ‘Park’
== Manager registered action ParkedCalls
== Manager registered action Parkinglots
== Manager registered action Park
== Manager registered action Bridge
== Registered custom function ‘FEATURE’
== Registered custom function ‘FEATUREMAP’
== Parsing ‘/etc/asterisk/enum.conf’: Found
== Registered application ‘CallCompletionRequest’
== Registered application ‘CallCompletionCancel’
== Parsing ‘/etc/asterisk/ccss.conf’: Found
== Parsing ‘/etc/asterisk/ccss.conf’: Found
Asterisk Dynamic Loader Starting:
== Parsing ‘/etc/asterisk/modules.conf’: Found
== Parsing ‘/etc/asterisk/cli_permissions.conf’: Found
Asterisk Ready.
== Parsing ‘/etc/asterisk/cli.conf’: Found
*CLI> [/code]

Looking at the output above I can see that the modules.conf has been found and recognized but nothing appears in the list of modules. i am expecting to see “195 modules loaded” according to the book.


Module                         Description                              Use Count 
0 modules loaded
*CLI> 

If you are already root, you don 't need to use sudo!

This all sounds like a permissions problem. I’d suggest getting Asterisk working as root, then worry about trying to reduce its privileges.

OK. That is reasonable. I did have it working as root when I was playing around with the port issue. The whole thing stopped working when I updated UFW.

I changed the permissions of the following:

/var/lib/asterisk/
/var/spool/asterisk/
/var/log/asterisk/
/var/run/asterisk/
etc/asterisk

and I modified the asterisk.conf file so the lines for runuser and rungroup are commented out.

All of these are now root:root But the modules are still not being listed.

I also attempted to reinstall asterisk with the same version but that did not automatically change anything. So I am fairly sure this is a configuration or … it could be a permission issue if I missed something.

What else could I check?

Look in /var/log/asterisk.

Also try loading the modules from the CLI.

I do not see anything in the log files. When I look at /var/log I see messages queue_log , which are empty. The other folders are empty as well.

I am able to manually load a module. I typed the following:

module load res_timing_timerfd.so

And then checked using “module show” and the module appeared. So I am assuming module.conf is not getting loaded. I double checked by changing the modules.conf to contain only a few modules.

Here is my test modules.conf file.

[modules] autoload=no load=pbx_config.so load=chan_sip.so load=chan_iax2.so load=res_rtp_asterisk.so load=app_hangup.so load=app_dial.so load=codec_ulaw.so load=codec_gsm.so

None of these modules got loaded automatically when I start Asterisk. I was able to get all of these loaded except app_hangup.so. That file does not exist in my install. (work on that later)

So I solved my issues by removing asterisk then re-installing. It always takes a bit of learning and retrying to get though installing something new.

Here is the article I used to help me remove and re-install asterisk.

viewtopic.php?f=1&t=81149

Thanks everyone. I go all three issues resolved.