How to allow Incoming Calls from PSTN

Hey guys,

I have successfully established an Asterisk server that can make and receive internal calls as well as make outbound calls to the PSTN gateway. I now need to allow for incoming calls. I have been given two numbers by the PSTN gateway and need to tell Asterisk what to do when they are called. Asterisk is receiving the request but still doesn’t recognize what to do. I want it to dial SIP/phone1. The numbers I have been assigned are 1111111111 and 2222222222 (theoretically speaking). I have provided my files below. SWITCH is the PSTN gateway. Outbound calls this way are successful.

sip.conf:

[general]
bindport=5060
bindaddr=xx.xx.xx.xx
context=sip ;default
maxexpiry=3600
checkmwi=10
vmexten=voicemail
videosupport=yes
rtcachefriends=yes
disallow=all
allow=gsm
allow=ulaw
allow=alaw
allow=g729
rtptimeout=60
dtmfmode=auto
nat=yes

[SWITCH]
type=peer
host=xx.xx.xx.98
trustrpid=yes
context=SIP
insecure=very
dtmfmode=auto
;nat=yes
;qualify=yes

[phone1] ;snom
type=friend
username=phone1
secret=password
host=dynamic
dtmfmode=rfc2833
mailbox=0001
context=sip
insecure=very
canreinvite=yes
nat=yes
realm=test@test.com
collerid=“Phone 1” <1111111111>

extensions.conf:

[general]
static=yes
writeprotect=yes
autofallthrough=yes
clearglobalvars=no
priorityjumping=no

[sip]
;extension 0001=phone1
exten => 0001,1,Dial(SIP/phone1,20,tr)
exten => 0001,2,VoiceMail,u0001

;Outbound Calls (Must Dial ‘9’)
exten => _9.,1,Dial(SIP/SWITCH/${EXTEN},tr)

Getting this message when placing a call from PSTN phone to Asterisk (dialing 1111111111) So It reaches asterisk, Asterisk just doesn’t know what to do with it

Jan 11 18:53:48] NOTICE[11348]: chan_sip.c:13669 handle_request_invite: Call from ‘SWITCH’ to extension ‘1111111111’ rejected because extension not found.

You have to define the extension 1111111111 so in the sip context just add this:

exten=>1111111111,1,Dial(SIP/phone1) 

Antoher way to do this could be jump to extension 0001 with Goto:

exten=>1111111111,1,Goto(sip,00001,1)

Cheers.

Marco Bruni

It still doesn’t work. Even by adding the line:

exten=>1111111111,1,Dial(SIP/phone1)

in extensions.conf it still gives me an error message stating that the extensions cannot be found:

[Jan 15 14:28:26] NOTICE[11348]: chan_sip.c:13669 handle_request_invite: Call from ‘SWITCH’ to extension ‘6177152097’ rejected because extension not found.

You answered your won question.

The extension needs to be called 6177152097

Create an extension in extensions.conf like this:

exten=>6177152097,1,Dial(SIP/phone1)

Make sure this is in sip context in your extensions.conf file, and watch out you have context=SIP under the switch in sip.conf and you have sip as the context in extensions.conf. Fix one or the other.
[/quote]