1.8.7.2: wrong transport for outgoing INVITE?


#1

Hello!

Minimal CentOS 5.7, Asterisk 1.8.7.0 from repo, updated to 1.8.7.2, behind the NAT.

REGISTERing to external provider via TCP - Ok.
But outgoing INVITE to the same provider is sent via UDP, despite TCP being (I hope) configured primary outgoing transport, 403 Forbidden as result.
1.8.7.0 - the same.

1.6.2.21 - working as expected (INVITE via TCP)

sip.conf:

[code][general]
context=default
allowguest=no
allowoverlap=no
alwaysauthreject=yes
udpbindaddr = 0.0.0.0

tcpenable = yes
tcpbindaddr = 0.0.0.0
transport=tcp,udp

srvlookup=yes
nat = yes
disallow=all
allow=alaw
allow=g729
allow=g723
allow=ulaw
dtmfmode=inband
canreinvite=no
externip=AAA.BBB.CCC.DDD
register = tcp://7AAAAAAAAAA@multifon.ru:password:7AAAAAAAAAA@sbc.megafon.ru/7AAAAAAAAAA

[2provider]
type=peer
host = multifon.ru
username = 7AAAAAAAAAA
secret = password
context = default
outboundproxy = sbc.megafon.ru
fromdomain = multifon.ru
fromuser = 7AAAAAAAAAA
authuser = 7AAAAAAAAAA
insecure = port,invite
;transport=tcp,udp[/code]

extensions.conf:

[code][general]
static = yes
writeprotect = no
clearglobalvars = no

[default]
exten=>_7XXXXXXXXXX,1,Dial(SIP/${EXTEN}@2provider,30,r)
[/code]
show’s:

[code]localhostCLI> core show version
Asterisk 1.8.7.2 built by root @ localhost.localdomain on a i686 running Linux on 2011-12-09 17:52:28 UTC
localhost
CLI>

localhost*CLI> sip show settings

Global Settings:

UDP Bindaddress: 0.0.0.0:5060
TCP SIP Bindaddress: 0.0.0.0:5060
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: 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 PBX 1.8.7.2
SDP Session Name: Asterisk PBX 1.8.7.2
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:
Externaddr: AAA.BBB.CCC.DDD:0
Externrefresh: 10

Global Signalling Settings:

Codecs: 0x10d (g723|ulaw|alaw|g729)
Codec Order: alaw:20,g729:20,g723:30,ulaw:20
Relax DTMF: No
RFC2833 Compensation: No
Symmetric RTP: Yes
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:
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: TCP,UDP
Outbound transport: TCP
Context: default
Force rport: Yes
DTMF: inband
Qualify: 0
Use ClientCode: No
Progress inband: Never
Language:
MOH Interpret: default
MOH Suggest:
Voice Mail Extension: asterisk


localhost*CLI> sip show peer 2provider

  • Name : 2provider
    Secret :
    MD5Secret :
    Remote Secret:
    Context : default
    Subscr.Cont. :
    Language :
    AMA flags : Unknown
    Transfer mode: open
    CallingPres : Presentation Allowed, Not Screened
    FromUser : 7AAAAAAAAAA
    FromDomain : multifon.ru Port 5060
    Callgroup :
    Pickupgroup :
    MOH Suggest :
    Mailbox :
    VM Extension : asterisk
    LastMsgsSent : 32767/65535
    Call limit : 0
    Max forwards : 0
    Dynamic : No
    Callerid : “” <>
    MaxCallBR : 384 kbps
    Expire : -1
    Insecure : port,invite
    Force rport : Yes
    ACL : No
    DirectMedACL : No
    T.38 support : No
    T.38 EC mode : Unknown
    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: Yes
    Overlap dial : No
    Outb. proxy : sbc.megafon.ru
    DTMFmode : inband
    Timer T1 : 500
    Timer B : 32000
    ToHost : multifon.ru
    Addr->IP : 193.201.229.35:5060
    Defaddr->IP : (null)
    Prim.Transp. : TCP
    Allowed.Trsp : TCP,UDP
    Def. Username: 7AAAAAAAAAA
    SIP Options : (none)
    Codecs : 0x10d (g723|ulaw|alaw|g729)
    Codec Order : (alaw:20,g729:20,g723:30,ulaw:20)
    Auto-Framing : No
    100 on REG : No
    Status : Unmonitored
    Useragent :
    Reg. Contact :
    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

localhost*CLI>[/code]

debug:

[code]localhost*CLI> sip set debug peer 2provider

localhost*CLI>
SIP Debugging Enabled for IP: 193.201.229.35

localhost*CLI>
[Dec 14 16:20:19] NOTICE[3535]: chan_sip.c:12596 sip_reregister: – Re-registration for 7AAAAAAAAAA@sbc.megafon.ru

localhost*CLI>
REGISTER 11 headers, 0 lines
Reliably Transmitting (NAT) to 193.201.229.35:5060:
REGISTER sip:multifon.ru SIP/2.0

Via: SIP/2.0/TCP 10.128.1.225:5060;branch=z9hG4bK3cedc749;rport

Max-Forwards: 70

From: sip:7AAAAAAAAAA@multifon.ru;tag=as176e1f32

To: sip:7AAAAAAAAAA@multifon.ru

Call-ID: 20861aac7e7569e62c3608ff7d62cd9e@127.0.0.1

CSeq: 105 REGISTER

User-Agent: Asterisk PBX 1.8.7.2

Authorization: Digest username=“7AAAAAAAAAA”, realm=“BREDBAND”, algorithm=MD5, uri=“sip:multifon.ru”, nonce=“MTMyMzgzNjIzNDpfLjfk775Bd2kMNs4bxIr3”, response=“2fdc731e5f472d43843edc9d95b8ea9e”, opaque=“MTMyMzgzNjIzNDpfLjfk775Bd2kMNs4bxIr3”, qop=auth, cnonce=“74cc256c”, nc=00000003

Expires: 120

Contact: sip:7AAAAAAAAAA@10.128.1.225:5060;transport=TCP

Content-Length: 0


localhost*CLI>

<— SIP read from TCP:193.201.229.35:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/TCP 10.128.1.225:5060;received=AAA.BBB.CCC.DDD;branch=z9hG4bK3cedc749;rport=36591
From: sip:7AAAAAAAAAA@multifon.ru;tag=as176e1f32
To: sip:7AAAAAAAAAA@multifon.ru;tag=2CB932463135364126DE1600
Call-ID: 20861aac7e7569e62c3608ff7d62cd9e@127.0.0.1
CSeq: 105 REGISTER
Contact: sip:7AAAAAAAAAA@10.128.1.225:5060;transport=TCP;expires=130
Content-Length: 0
Service-Route: sip:7AAAAAAAAAA@193.201.229.35:5060;transport=tcp;lr

<------------->
— (9 headers 0 lines) —
Scheduling destruction of SIP dialog ‘20861aac7e7569e62c3608ff7d62cd9e@127.0.0.1’ in 32000 ms (Method: REGISTER)
[Dec 14 16:20:19] NOTICE[3547]: chan_sip.c:20155 handle_response_register: Outbound Registration: Expiry for sbc.megafon.ru is 130 sec (Scheduling reregistration in 115 s)

localhost*CLI> console dial 7BBBBBBBBBB

localhost*CLI>
Audio is at 5060

localhost*CLI>
Adding codec 0x8 (alaw) to SDP

localhost*CLI>
Adding codec 0x4 (ulaw) to SDP

localhost*CLI>
Reliably Transmitting (NAT) to 193.201.229.35:5060:
INVITE sip:7BBBBBBBBBB@multifon.ru SIP/2.0

Via: SIP/2.0/UDP 10.128.1.225:5060;branch=z9hG4bK2d2b39d7;rport

Max-Forwards: 70

From: “asterisk” sip:7AAAAAAAAAA@multifon.ru;tag=as653efae6

To: sip:7BBBBBBBBBB@multifon.ru

Contact: sip:7AAAAAAAAAA@10.128.1.225:5060

Call-ID: 21bd2e403656248b19d83565196334ea@multifon.ru

CSeq: 102 INVITE

User-Agent: Asterisk PBX 1.8.7.2

Date: Wed, 14 Dec 2011 10:20:43 GMT

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH

Supported: replaces, timer

Content-Type: application/sdp

Content-Length: 202

v=0

o=root 518834463 518834463 IN IP4 10.128.1.225

s=Asterisk PBX 1.8.7.2

c=IN IP4 10.128.1.225

t=0 0

m=audio 16650 RTP/AVP 8 0

a=rtpmap:8 PCMA/8000

a=rtpmap:0 PCMU/8000

a=ptime:20

a=sendrecv


localhost*CLI>

<— SIP read from UDP:193.201.229.35:5060 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.128.1.225:5060;received=AAA.BBB.CCC.DDD;branch=z9hG4bK2d2b39d7;rport=1027
From: “asterisk” sip:7AAAAAAAAAA@multifon.ru;tag=as653efae6
To: sip:7BBBBBBBBBB@multifon.ru
Call-ID: 21bd2e403656248b19d83565196334ea@multifon.ru
CSeq: 102 INVITE

<------------->
— (6 headers 0 lines) —

<— SIP read from UDP:193.201.229.35:5060 —>
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 10.128.1.225:5060;received=AAA.BBB.CCC.DDD;branch=z9hG4bK2d2b39d7;rport=1027
From: “asterisk” sip:7AAAAAAAAAA@multifon.ru;tag=as653efae6
To: sip:7BBBBBBBBBB@multifon.ru;tag=aprqngfrt-k04r2m20000c6
Call-ID: 21bd2e403656248b19d83565196334ea@multifon.ru
CSeq: 102 INVITE
Reason: Q.850;cause=55;text=“Call Terminated”

<------------->
— (7 headers 0 lines) —
Transmitting (NAT) to 193.201.229.35:5060:
ACK sip:7BBBBBBBBBB@multifon.ru SIP/2.0

Via: SIP/2.0/UDP 10.128.1.225:5060;branch=z9hG4bK2d2b39d7;rport

Max-Forwards: 70

From: “asterisk” sip:7AAAAAAAAAA@multifon.ru;tag=as653efae6

To: sip:7BBBBBBBBBB@multifon.ru;tag=aprqngfrt-k04r2m20000c6

Contact: sip:7AAAAAAAAAA@10.128.1.225:5060

Call-ID: 21bd2e403656248b19d83565196334ea@multifon.ru

CSeq: 102 ACK

User-Agent: Asterisk PBX 1.8.7.2

Content-Length: 0


localhost*CLI>
[Dec 14 16:20:43] WARNING[3535]: chan_sip.c:19680 handle_response_invite: Received response: “Forbidden” from ‘“asterisk” sip:7AAAAAAAAAA@multifon.ru;tag=as653efae6’

localhost*CLI>
Really destroying SIP dialog ‘21bd2e403656248b19d83565196334ea@multifon.ru’ Method: INVITE

localhost*CLI>
Really destroying SIP dialog ‘20861aac7e7569e62c3608ff7d62cd9e@127.0.0.1’ Method: OPTIONS

localhost*CLI>
Really destroying SIP dialog ‘20861aac7e7569e62c3608ff7d62cd9e@127.0.0.1’ Method: REGISTER

localhost*CLI>
<< Hangup on console >>

localhost*CLI>
[/code]


#2

transport is commented out.


#3

It is announced in [general], and TCP is on as one can see from "sip show …"
And it works for REGISTER.

The commented out line just in memory of the fact that all combinations of “transport=tcp” or “transport=tcp,udp” in general or peer section or in both - behave the same .


#4

Workaround:

and voila - INVITE via TCP