Asterisk 10 and nat=yes

I use Asterisk 10.7.0 and “nat=yes” (Force rport to always be on and perform comedia RTP handling).

asterisk -rx “sip show settings”[code]Parsing /etc/asterisk/extconfig.conf

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: Yes
Allow unknown access: No
Allow subscriptions: No
Allow overlap dialing: No
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 10.7.0
SDP Session Name: Asterisk 10.7.0
SDP Owner Name: root
Reg. context: (not set)
Regexten on Qualify: No
Trust RPID: No
Send RPID: No
Legacy userfield parse: No
Caller ID: asterisk
From: Domain:
Record SIP history: Off
Call Events: Off
Auth. Failure Events: Off
T.38 support: Yes
T.38 EC mode: Redundancy
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:
Externaddr: (null)
Externrefresh: 10

Global Signalling Settings:

Codecs: (gsm|ulaw|alaw|h263|testlaw)
Codec Order: none
Relax DTMF: No
RFC2833 Compensation: No
Symmetric RTP: Yes
Compact SIP headers: No
RTP Keepalive: 0 (Disabled)
RTP Timeout: 60
RTP Hold Timeout: 120
MWI NOTIFY mime type: application/simple-message-summary
DNS SRV lookup: No
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: closed
Max Call Bitrate: 384 kbps
Auto-Framing: No
Outb. proxy:
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: ru
MOH Interpret: default
MOH Suggest:
Voice Mail Extension: asterisk


Asterisk ending (0).[/code]

asterisk -rx “sip show peer r1234_line1”[code]Parsing /etc/asterisk/extconfig.conf

  • Name : r1234_line1
    Description :
    Secret :
    MD5Secret :
    Remote Secret:
    Context : from-ipclients
    Subscr.Cont. :
    Language : ru
    AMA flags : Unknown
    Transfer mode: closed
    CallingPres : Presentation Allowed, Not Screened
    Callgroup :
    Pickupgroup :
    MOH Suggest :
    Mailbox :
    VM Extension : asterisk
    LastMsgsSent : 0/0
    Call limit : 1
    Max forwards : 0
    Dynamic : Yes
    Callerid : “” <1234567890>
    MaxCallBR : 384 kbps
    Expire : 3218
    Insecure : no
    Force rport : Yes
    ACL : No
    DirectMedACL : No
    T.38 support : Yes
    T.38 EC mode : Redundancy
    T.38 MaxDtgrm: -1
    DirectMedia : No
    PromiscRedir : No
    User=Phone : No
    Video Support: No
    Text Support : No
    Ign SDP ver : No
    Trust RPID : No
    Send RPID : No
    Subscriptions: No
    Overlap dial : No
    DTMFmode : rfc2833
    Timer T1 : 500
    Timer B : 32000
    ToHost :
    Addr->IP : 95.138.160.45:62893
    Defaddr->IP : (null)
    Prim.Transp. : UDP
    Allowed.Trsp : UDP
    Def. Username: r1234_line1
    SIP Options :
    Codecs : (gsm|ulaw|alaw|g729)
    Codec Order : (alaw:20,ulaw:20,g729:20,gsm:20)
    Auto-Framing : No
    Status : OK (160 ms)
    Useragent : Linksys/SPA2102-3.3.6
    Reg. Contact : sip:r1234_line1@192.168.5.17:5060
    Qualify Freq : 60000 ms
    Sess-Timers : Accept
    Sess-Refresh : uas
    Sess-Expires : 1800 secs
    Min-Sess : 90 secs
    RTP Engine : asterisk
    Parkinglot :
    Use Reason : No
    Encryption : No

Asterisk ending (0)[/code]

tcpdump09:28:20.932560 IP 95.138.160.45.62893 > 88.80.1.50.5060: SIP, length: 422 09:28:24.681426 IP 88.80.1.50.5060 > 95.138.160.45.62893: SIP, length: 945 09:28:24.924838 IP 95.138.160.45.62893 > 88.80.1.50.5060: SIP, length: 322 09:28:24.925086 IP 95.138.160.45.62893 > 88.80.1.50.5060: SIP, length: 433 09:28:27.264832 IP 95.138.160.45.62893 > 88.80.1.50.5060: SIP, length: 814 09:28:27.268305 IP 88.80.1.50.5060 > 192.168.5.17.5060: SIP, length: 442 09:28:27.389518 IP 88.80.1.50.15200 > 192.168.5.17.16400: UDP, length 32 09:28:27.410068 IP 88.80.1.50.15200 > 192.168.5.17.16400: UDP, length 32

Why media traffic going to 192.168.5.17 ?

is not correct. I believe it should be
[code]nat=force_rport,comedia[/code]

is 192.168.5.17 the ip address of your asterisk server?
if yes, then use
[code]directmedia=yes[/code]
in your extensions

is not correct. I believe it should be

is 192.168.5.17 the ip address of your asterisk server?
if yes, then use

in your extensions

nat=yes is deprecated (possibly because it was being overused).

There was an issue on the issue tracker, recently, about the preferred replacement not behaving exactly the same.

Asterisk version 10 has not been supported, except for security fixes, since December.

For Asterisk 10, “nat=yes” is correctly and not deprecated for this version. Also Asterisk 10 does not support multiple options for NAT (as example nat=force_rport,comedia), only one.

My server address is 88.80.1.50
Client address is 95.138.160.45 (local is 192.168.5.17)