Help with incoming SIP calls

I need some help understanding how incoming SIP connections are handled.

I am trying to handle SIP calls (inwards) from a DID.
The DID directs the call to Philip@xx.xx.xx.xx (that is all I can specify, no username password etc.)

The incoming connection looks like this:

<--- SIP read from --->
INVITE sip:Philip@ SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK04a36259;rport
From: "15035380499" <sip:15035380499@>;tag=as19c8ba3b
To: <sip:Philip@>
Contact: <sip:15035380499@>
Call-ID: 353a9cf00678d243580d46575898d305@
CSeq: 102 INVITE
User-Agent: DIDWW
Max-Forwards: 70
Remote-Party-ID: "15035380499" <sip:15035380499@>;privacy=off;screen=no
Date: Mon, 07 Sep 2009 20:04:41 GMT
Supported: replaces
Content-Type: application/sdp
Content-Length: 409

o=root 8919 8919 IN IP4
c=IN IP4
t=0 0
m=audio 13330 RTP/AVP 0 8 18 4 111 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=no
a=rtpmap:111 G726-32/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -

--- (15 headers 19 lines) ---
Sending to : 5060 (NAT)
Using INVITE request as basis request - 353a9cf00678d243580d46575898d305@
Found no matching peer or user for ''
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 18
Found RTP audio format 4
Found RTP audio format 111
Found RTP audio format 3
Found RTP audio format 101
Peer audio RTP is at port
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Found audio description format G729 for ID 18
Found audio description format G723 for ID 4
Found audio description format G726-32 for ID 111
Found audio description format GSM for ID 3
Found audio description format telephone-event for ID 101
Capabilities: us - 0x8000e (gsm|ulaw|alaw|h263), peer - audio=0x90f (g723|gsm|ulaw|alaw|g726|g729)/video=0x0 (nothing), combined - 0xe (gsm|ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1 (telephone-event), combined - 0x1 (telephone-event)
Peer audio RTP is at port
Looking for Philip in default (domain
list_route: hop: <sip:15035380499@>

If I put an extension for ‘Philip’ in extensions.conf under [default] it works.
But I actually want to deliver the call to a different context.

The part that I don’t understand, even after reading all the documentation I can find on it is this:

Found no matching peer or user for '' 

I have tried putting an entry in sip.conf:


It makes no difference.

Where is it looking for a match???
How do I set up incoming anonymous SIP calls to be delivered to a specific context?

That is a peer, not a user. The bit in [] is just a local name for peers. You need to specify the remote IP address for peers.

Not according to the book:

That describes perfectly what we have here - an inbound call, no outbound calling to this SIP system.

Also, the diagnostic output show exactly what Asterisk is looking for.
My question is where should this be defined so that it finds it.

Your inbound calls are anonymous; that’s why there is no user. You need a peer to override any block you have on anonymous calls.

user is used when the other side actively registers.

Ok …

There is no block on anonymous calls.
They actually do work, but end up in the [general] context of sip.conf.
I can put a context= line there to pass them to the correct context in extensions.conf – it just doesn’t seem to be the clean way to do it.

If this is the only way if the incoming call doesn’t authenticate, then I guess I have to live with it :confused:

Using peers also allows you to set custom contexts, but you have to identify the peer, by IP address, in the body of the defnition.

I suspect that they have multiple servers, so I would need to add several entries … probably ok.

What name do I use to specify the IP?
I think I tried host=, but that wanted a domain name.

Quite happy, here, with an IP address, on They are actually set as friends, but I don’t think that is strictly necessary.

Working happily now - thanks!

I thought I tried this config … but then I tried so many :unamused: