Routing call from IP address

Hello friends
Need big help please…
My DID provider routing call in to my public IP address. The problem is when I call that DID number phone get cut off right away. I’m getting error in CLI> chan_sip.c:22646 handle_request_invite: Call from ‘’ (XXX.XX.XX.XXX:5060) to extension ‘44179XXXXXXX’ rejected because extension not found in context ‘default’.
Provider aql.com
Can somebody please point me in the right direction

Sip.conf
register => XXXXXXX:XXXXX@sip.aql.com/XXXXXX

[44179XXXXXXX]
context=pstn-in
type=user
insecure=invite
secret=XXXXX
username=XXXXXX
host=sip.aql.com

extensions.conf
[pstn-in]
exten => 44179XXXXXXX,1,Dial(SIP/2001)
exten => 44179XXXXXXX,n,Hangup

type should be peer. allowguest should be no.

Still Same problem

You haven’t correctly disabled allowguest. It needs to go in the general section. Did you do sip reload, or restart Asterisk?

You are going to the default context because the INVITE is not matching, and you are allowing anonymous callers.

At least one reason for it not matching is that you were trying to match a value that only appears in the To header, using a mechanism that matches the From one.

You may need to make some more changes, but those can wait until the error changes.

Sorry to bother you
I have reload asterisk
Now I’m getting this error.
chan_sip.c:22542 handle_request_invite: Sending fake auth rejection for device sip:0772XXXXXXX@194.XXX.XXX.XXX;tag=8S8P051IJW30000E1D00001u0UIG4EO1M9C3OA

You didn’t change the type to peer, or the source address of the INVITE isn’t one of the addresses returned by a DNS lookup on sip.aql.com. Actually, I am not sure that Asterisk can cope with more than one IP address. What address does sip show peer show for the 44179XXXXXXX?

I did change type to peer
This is the info for “sip show peers”
44179XXXXXXX/XXXXXX 194.145.190.143 N 5060 Unmonitored

What is the source IP address on the INVITE packet?

Sorry to ask you this silly question? How do I find out? “source IP address on the INVITE packet?”

sip set debug on

(or wireshark, or tcpdump).

sorry for late replay this is my sip debug file

<------------>
Really destroying SIP dialog '1122140111-5068-2@BJC.BGI.B.CAA’ Method: SUBSCRIBE

<— SIP read from UDP:109.239.96.133:5060 —>
INVITE sip:4417XXXXXXXX@87.XXX.XX.XXX SIP/2.0
Record-Route: sip:109.239.96.133;lr=on;ftag=8S8P051IJW30000E1D00001u0URW1OK0T80RRU;did=661.15641181
Via: SIP/2.0/UDP 109.239.96.133;branch=z9hG4bK8d12.216d4021.0
Via: SIP/2.0/UDP 194.145.191.131:5060;branch=z9hG4bK000423E166BE3242D230A6364BF8
From: sip:077XXXXXXXX@194.145.191.131;tag=8S8P051IJW30000E1D00001u0URW1OK0T80RRU
To: sip:4417XXXXXXXX@109.239.96.133
Call-ID: bee104006623-4f981f7f-33e04ea7-9edfe00-5accdb7@127.0.0.1
CSeq: 8969 INVITE
Contact: sip:194.145.191.131:5060
Allow-Events: refer
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, INFO, REFER, NOTIFY, SUBSCRIBE, UPDATE
Content-Type: application/sdp
Max-Forwards: 69
Supported: 100rel, timer, replaces
User-Agent: TELES.MGC
Content-Length: 435

v=0
o=- 1963143389 0 IN IP4 194.145.191.142
s=session
c=IN IP4 194.145.191.142
t=0 0
m=audio 9090 RTP/AVP 8 0 18 97 2 99 4 80 96
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=rtpmap:97 G726-16/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:99 G726-40/8000
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=no
a=fmtp:4 bitrate=6.3
a=rtpmap:80 G723/8000
a=fmtp:80 bitrate=5.3
a=rtpmap:96 telephone-event/8000
a=sendrecv
<------------->
— (16 headers 19 lines) —
Sending to 109.239.96.133:5060 (NAT)
Using INVITE request as basis request - bee104006623-4f981f7f-33e04ea7-9edfe00-5accdb7@127.0.0.1
No matching peer for ‘077XXXXXXXX’ from ‘109.239.96.133:5060’
[Apr 25 16:59:30] NOTICE[24232]: chan_sip.c:22542 handle_request_invite: Sending fake auth rejection for device sip:077XXXXXXX@194.145.191.131;tag=8S8P051IJW30000E1D00001u0URW1OK0T80RRU

The packet is arriving from 109.239.96.133. You have told Asterisk to expect them from 194.145.190.143.

I didn’t set any IP address
How to I change this please explain more about it

I don’t know your network topology. I know that the second address is sip.aql.com, but I don’t know what the first address is. If it belongs to you, you will probably have to reconfigure one of your routers. If it belongs to aql.com, you will need to get more complete inforrmation about the topology of their SIP service network.

You should probably start by asking them their recommended configuration for Asterisk, but note that many service providers haven’t accounted for changes since version 1.4, or even 1.2, and many specify insecure values that are more insecure than they need to be.

My guess is that you will end up with different peer entries for incoming and outgoing calls, but you shouldn’t be doing this by stabbing in the dark, you should be understanding the system you are trying to interface to.

Thanks david55
I managed to sort the problem out by finding some information on other site. These are the configuration in sip.conf. It may help others. How do I find out more about this function? I want to learn more about it please.

[general]
context=Default
port=5060
bindaddr=XX.XX.XX.XX <= my server address (public)
srvlookup=yes
dtmfmode=rfc2833
relaxdtmf=no
disallow=all
allow=ulaw
allow=alaw
allow=gsm
maxexpirey=30
defaultexpirey=180
canreinvite=yes
UserAgent= Asterisk
echocancel=yes
echocancelwhenbridge=yes
registertimeout=1
registerattempts=0
nat=yes

If bindaddr makes a difference, it means that your PC has more than one IP address and at least one of them is not fully routable. bindaddr forces you to use only one of the addresses. You didn’t tell us about the incomplete dual homing.

canreinvite is deprecated and may cease to be effective in later versions. Use directmedia.

Although Asterisk does actually recognize the mis-spelling of expiry that you used, I’d suggest correcting it, as people may think it is a typo.

Thanks for the advice.
Sorry for short information, I’m learning as I go along. I just cut and paste this information from some other website. That’s why I ask if I can find definition of this setting, so I can learn more about sip settings.