I installed Asterisk on my local Ubuntu 12.04 machine. After starting the asterisk [asterisk -c] I ran the command
netstat -nlpa | grep asterisk
and the output shown is this ->
tcp 0 0 127.0.0.1:5038 0.0.0.0:* LISTEN 2956/asterisk
tcp 0 0 192.168.32.181:8088 0.0.0.0:* LISTEN 2956/asterisk
udp 0 0 0.0.0.0:5000 0.0.0.0:* 2956/asterisk
udp 0 0 0.0.0.0:5060 0.0.0.0:* 2956/asterisk
udp 0 0 0.0.0.0:4520 0.0.0.0:* 2956/asterisk
udp 0 0 0.0.0.0:4569 0.0.0.0:* 2956/asterisk
unix 2 [ ACC ] STREAM LISTENING 25848 2956/asterisk /var/run/asterisk/asterisk.ctl
unix 2 [ ] DGRAM 25971 2956/asterisk
My queries are
- why asterisk is running on loopback address and not on 192.168.32.181:5038 ?
- Why SIP is not binding to any address? (just showing 0.0.0.0:5060)
- what file should I edit in order to work it as desire.
This is the output of command "sip show settings" on asterisk cli->
*CLI> sip show settings
Global Settings:
----------------
UDP Bindaddress: 0.0.0.0:5060
TCP SIP Bindaddress: Disabled
TLS SIP Bindaddress: Disabled
Videosupport: No
Textsupport: No
Ignore SDP sess. ver.: No
AutoCreate Peer: No
Match Auth Username: No
Allow unknown access: No
Allow subscriptions: Yes
Allow overlap dialing: Yes
Allow promisc. redir: No
Enable call counters: No
SIP domain support: No
Realm. auth: No
Our auth realm asterisk
Use domains as realms: No
Call to non-local dom.: Yes
URI user is phone no: No
Always auth rejects: Yes
Direct RTP setup: No
User Agent: Asterisk PBX 1.8.10.1~dfsg-1ubuntu1
SDP Session Name: Asterisk PBX 1.8.10.1~dfsg-1ubuntu1
SDP Owner Name: root
Reg. context: (not set)
Regexten on Qualify: No
Legacy userfield parse: No
Caller ID: asterisk
From: Domain:
Record SIP history: Off
Call Events: Off
Auth. Failure Events: Off
T.38 support: No
T.38 EC mode: Unknown
T.38 MaxDtgrm: -1
SIP realtime: Disabled
Qualify Freq : 60000 ms
Q.850 Reason header: No
Store SIP_CAUSE: No
Network QoS Settings:
---------------------------
IP ToS SIP: CS0
IP ToS RTP audio: CS0
IP ToS RTP video: CS0
IP ToS RTP text: CS0
802.1p CoS SIP: 4
802.1p CoS RTP audio: 5
802.1p CoS RTP video: 6
802.1p CoS RTP text: 5
Jitterbuffer enabled: No
Network Settings:
---------------------------
SIP address remapping: Disabled, no localnet list
Externhost: <none>
Externaddr: (null)
Externrefresh: 10
Global Signalling Settings:
---------------------------
Codecs: 0x80000008000e (gsm|ulaw|alaw|h263|testlaw)
Codec Order: none
Relax DTMF: No
RFC2833 Compensation: No
Symmetric RTP: No
Compact SIP headers: No
RTP Keepalive: 0 (Disabled)
RTP Timeout: 0 (Disabled)
RTP Hold Timeout: 0 (Disabled)
MWI NOTIFY mime type: application/simple-message-summary
DNS SRV lookup: Yes
Pedantic SIP support: Yes
Reg. min duration 60 secs
Reg. max duration: 3600 secs
Reg. default duration: 120 secs
Outbound reg. timeout: 20 secs
Outbound reg. attempts: 0
Notify ringing state: Yes
Include CID: No
Notify hold state: No
SIP Transfer mode: open
Max Call Bitrate: 384 kbps
Auto-Framing: No
Outb. proxy: <not set>
Session Timers: Accept
Session Refresher: uas
Session Expires: 1800 secs
Session Min-SE: 90 secs
Timer T1: 500
Timer T1 minimum: 100
Timer B: 32000
No premature media: Yes
Max forwards: 70
Default Settings:
-----------------
Allowed transports: UDP
Outbound transport: UDP
Context: default
Force rport: Yes
DTMF: rfc2833
Qualify: 0
Use ClientCode: No
Progress inband: Never
Language:
MOH Interpret: default
MOH Suggest:
Voice Mail Extension: asterisk
Note:
I am able to make a dummy call by registering a user (102) to default number 2006. But I am not able to register the same user from another machine in same LAN. It says "Fetching registration fails. 408 request time out". What could be the reason ?Is it because of the reason as in query 1.
Entry in sip.conf
[102]
type=friend
host=dynamic
secret=******
context=demo1
Entry in extensions.conf
[demo1]
exten => 2600,1,Dial(IAX2/guest@pbx.digium.com/s@default)
exten => 100,1,Dial(SIP/1060)
exten => 101,1,Dial(IAX2/guest@pbx.digium.com/s@default)
same => n,Hangup()
Output of command "sip show peers"
*CLI> sip show peers
Name/username Host Dyn Forcerport ACL Port Status
101 (Unspecified) D N 0 Unmonitored
102/102 192.168.32.181 D N 5071 Unmonitored
1060/1060 (Unspecified) D N 0 Unmonitored
1061/1061 (Unspecified) D N 0 Unmonitored
4 sip peers [Monitored: 0 online, 0 offline Unmonitored: 1 online, 3 offline]
Please let me know if more information is required. Thanks.
Best Answer
You ask multiple questions, I can answer some, but not all of them.
As far as I can tell from a few searches port 5038 is the asterisk management interface. So I assume it binds to 127.0.0.1:5038 for security reasons. You wouldn't want that to be accessible from everywhere.
Actually it is binding to any address, since 0.0.0.0 is the any address. By binding to that address, the socket will receive packets send to any of the IPv4 addresses assigned to that machine.
Using the any address for UDP and not for TCP is a bit odd though. The socket API will let a TCP server know which of its addresses was used, when the server has bound to the any address. But for UDP it has to bind separate sockets to each of the IPs in order to know which of the addresses a packet was sent to. Thus it is not unusual to see a process use the any address for TCP but not for UDP. No idea why asterisk does it the other way around.