Matching incoming SIP call to peer - Found no matching peer

Hi, I’m trying to configure asterisk to accept incoming calls from 2 providers, unfortunately both originate calls from multiple hosts and so my single peer definition for each doesn’t match. So either I want to match on a range of IPs/Hosts or match on some other parameter.

I saw the following on voip-info:

When Asterisk receives an incoming SIP call, the SIP Channel Module
  • first tries to find a [user] section matching the caller name
    (From: username),
  • then tries to find a [peer] section matching the caller’s IP address.
  • If no matching user or peer is found, the call is sent to the
    context defined in the [general] section of sip.conf.

I tried to work out how to match using a username but there is no clear documentation on how to do this, a portion of my SIP debug is below, I’m really not sure what asterisk is meant to match on; the INVITE is sent to the DDI number @ our IP and as there are a range of numbers we can’t match upon that, the From field just contains the number which the call is coming from which obviously changes call by call, as I said the 0845 DDI number in the TO field could be any of a range, is this TO address or INVITE number what asterisk is matching on when it matches the “user”?

Is there not a way to match a range of IPs or hosts (without defining a peer for each host!) or if I should be matching on user can someone explain how I can do that in sip.conf?

Thanks in advance for your help!
Rich

<--- SIP read from 195.60.170.33:53998 ---> INVITE sip:084524132**@82.1**.5.74:5060 SIP/2.0 Via: SIP/2.0/UDP 195.60.170.33:5060;branch=z9hG4bK296B1180 From: ;tag=B172E214-21A To: Date: Mon, 04 Feb 2008 18:55:41 GMT Call-ID: 9DF4A2A8-D28911DC-88EF9BE4-272717D4@195.60.170.33 Supported: 100rel,timer Min-SE: 1800 Cisco-Guid: 2649975385-3532198364-2627993614-3619253552 User-Agent: Cisco-SIPGateway/IOS-12.x Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO, UPDATE, REGISTER CSeq: 101 INVITE Max-Forwards: 70 Remote-Party-ID: ;party=calling;screen=yes;privacy=off Timestamp: 1202151341 Contact: Expires: 180 Allow-Events: telephone-event Content-Type: application/sdp Content-Length: 217

v=0
o=CiscoSystemsSIP-GW-UserAgent 1037 861 IN IP4 195.60.170.33
s=SIP Call
c=IN IP4 195.60.170.33
t=0 0
m=audio 16810 RTP/AVP 0 19
c=IN IP4 195.60.170.33
a=rtpmap:0 PCMU/8000
a=rtpmap:19 CN/8000
a=ptime:20

<------------->
— (20 headers 10 lines) —
Sending to 195.60.170.33 : 5060 (no NAT)
Using INVITE request as basis request - 9DF4A2A8-D28911DC-88EF9BE4-272717D4@195.60.170.33
Found no matching peer or user for '195.60.170.33:53998’
Found RTP audio format 0
Found RTP audio format 19
Peer audio RTP is at port 195.60.170.33:16810
Found audio description format PCMU for ID 0
Found audio description format CN for ID 19
Capabilities: us - 0x8000e (gsm|ulaw|alaw|h263), peer - audio=0x4 (ulaw)/video=0x0 (nothing), combined - 0x4 (ulaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x2 (CN), combined - 0x0 (nothing)
Peer audio RTP is at port 195.60.170.33:16810
Looking for 084524132** in default (domain 82.136.50.74)
list_route: hop: sip:7791655227@195.60.170.33:5060