I want to configure Asterisk as SIP client. When a call is made towards the DID (from sipgate), I want to route the call to a local user (6000). I have configured sipgate.de and when I execute sip show registry in the console, it shows:
Host dnsmgr Username Refresh State
Reg.Time
sipgate.de:5060 N 2394288 1785 [color=red]Registered[/color]
Sun, 27 Sep 2009 16:21:34
1 SIP registrations.
When I look at the peers, I see 3:
Name/username Host Dyn Nat ACL Port Status
2394288/2394288 217.10.79.9 N 5060 Unmonitored
6000/xlite 10.164.4.46 D 50886 Unmonitored
incoming 217.10.79.9 5060 Unmonitored
3 sip peers [Monitored: 0 online, 0 offline Unmonitored: 3 online, 0 offline]
I have traced the SIP messages, and see the following, when I call my DID number:
<— SIP read from UDP://217.10.79.9:5060 —>
INVITE sip:2394288@10.131.1.0:5060 SIP/2.0
Record-Route: sip:217.10.79.9;lr=on;ftag=as2fe2de1e
Record-Route: sip:172.20.40.2;lr=on
Record-Route: sip:217.10.79.9;lr=on;ftag=as2fe2de1e
Via: SIP/2.0/UDP 217.10.79.9:5060;branch=z9hG4bK8659.b7356ef2.0
Via: SIP/2.0/UDP 172.20.40.2;branch=z9hG4bK8659.b7356ef2.0
Via: SIP/2.0/UDP 217.10.79.9:5060;received=217.10.68.226;branch=z9hG4bK6115a311
Via: SIP/2.0/UDP 217.10.67.13:5060;branch=z9hG4bK6115a311;rport=5060
From: “” <sip:@sipgate.de>;tag=as2fe2de1e
To: sip:004924153807890@sipgate.de
Contact: <sip:@217.10.67.13>
Call-ID: 6f21e9585b435f3c0a22ea8b0a7445ab@sipgate.de
CSeq: 102 INVITE
Max-Forwards: 67
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces
Content-Type: application/sdp
Content-Length: 363
v=0
o=root 22417 22417 IN IP4 217.10.67.13
s=session
c=IN IP4 217.10.67.13
t=0 0
m=audio 15022 RTP/AVP 8 0 3 97 112 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:112 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
<------------->
— (18 headers 17 lines) —
== Using SIP RTP CoS mark 5
Sending to 217.10.79.9 : 5060 (no NAT)
Using INVITE request as basis request - 6f21e9585b435f3c0a22ea8b0a7445ab@sipgate
.de
[color=red]Found peer ‘2394288’ for ‘’[/color] from 217.10.79.9:5060
ac-vm-brink-linux1*CLI>
<— Reliably Transmitting (NAT) to 217.10.79.9:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 217.10.79.9:5060;branch=z9hG4bK8659.b7356ef2.0;received=217.10.
79.9
Via: SIP/2.0/UDP 172.20.40.2;branch=z9hG4bK8659.b7356ef2.0
Via: SIP/2.0/UDP 217.10.79.9:5060;received=217.10.68.226;branch=z9hG4bK6115a311
Via: SIP/2.0/UDP 217.10.67.13:5060;branch=z9hG4bK6115a311;rport=5060
From: “” <sip:@sipgate.de>;tag=as2fe2de1e
To: sip:004924153807890@sipgate.de;tag=as0abe516b
Call-ID: 6f21e9585b435f3c0a22ea8b0a7445ab@sipgate.de
CSeq: 102 INVITE
Server: Asterisk PBX 1.6.1.6
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="34ff43e4"
Content-Length: 0
<------------>
Scheduling destruction of SIP dialog '6f21e9585b435f3c0a22ea8b0a7445ab@sipgate.d
e’ in 32000 ms (Method: INVITE)
ac-vm-brink-linux1*CLI>
<— SIP read from UDP://217.10.79.9:5060 —>
ACK sip:2394288@10.131.1.0:5060 SIP/2.0
Max-Forwards: 10
Via: SIP/2.0/UDP 217.10.79.9:5060;branch=z9hG4bK8659.b7356ef2.0
Via: SIP/2.0/UDP 172.20.40.2;branch=z9hG4bK8659.b7356ef2.0
From: “” <sip:@sipgate.de>;tag=as2fe2de1e
Call-ID: 6f21e9585b435f3c0a22ea8b0a7445ab@sipgate.de
To: sip:004924153807890@sipgate.de;tag=as0abe516b
CSeq: 102 ACK
Content-Length: 0
X-hint: rr-enforced
<------------->
— (10 headers 0 lines) —
My extensions.conf:
[code]
[general]
exten => _0.,1,NoOp(Call via sipgate.de)
exten => _0.,2, Ringing
exten => _0.,3,SetCallerID(Jan van den Brink)
exten => _0.,4,Dial(SIP/${EXTEN:1}@2394288,60)
exten => _0.,5,Hangup
[incoming]
exten => 2394288,1,NoOp(— ${CALLERID} calling on sipgate (${EXTEN}) —)
exten => 2394288,2,Ringing
exten => 2394288,3,Wait(1)
exten => 2394288,4,Dial(SIP/6000,30)
this context is specified in sip.conf:
[general]
port=5060
bindaddr=0.0.0.0
context=default
register=>2394288:<password>@sipgate.de/2394288
[2394288]
type=peer
username=2394288
fromuser=2394288
secret=<password>
context=default
host=sipgate.de
fromdomain=sipgate.de
insecure=port,invite
caninvite=no
canreinvite=no
nat=yes
externip=62.134.199.226
localnet=10.131.1.0/255.255.254.0
quality=yes
disallow=all
allow=ulaw
allow=alaw
[incoming]
type=peer
fromdomain=sipgate.de
host=sipgate.de
context=incoming
disallow=all
allow=ulaw
allow=alaw
Any idea?