Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to allow inbound calls in pjsip and Asterisk 13?

I have configured Asterisk 13.13.1 with PJProject 2.5.5 and enable PJSIP as SIP driver (without compiling chan_sip).

I have the fully configured system and it's working but I have some problems with incoming calls. I have few numbers connected with my host and when I calling from any public number I noticed this info on asterisk remote console:

[Feb 24 14:27:16] NOTICE[5291]: res_pjsip/pjsip_distributor.c:525 log_failed_request: Request 'INVITE' from '"zzzzz" <sip:[email protected]>' failed for '192.168.34.1:5062' (callid: [email protected]:5062) - No matching endpoint found

And if I add the number which is calling to my Asterisk to endpoints then it's working - I can pick up this call.

How to add the possibility to allow all inbound calls?

like image 423
user3025978 Avatar asked Feb 06 '23 00:02

user3025978


2 Answers

You need to create an anonymous endpoint to accept inbound calls from unknown endpoints.

Be aware that adding an anonymous endpoint opens the system to extension scanning attacks where scanners try to find out which extensions you have configured in your system. They do this either to spam you with advertising calls, or exploit call transferring to call long distance numbers, or for some other ulterior motive.

After creating an anonymous endpoint, associate it with a context different from that used by your extensions. This prevents them from dialing long-distance through your trunks.

To add an anonymous endpoint in pjsip.conf, add the following lines:

[anonymous]
type=endpoint
context=anonymous
disallow=all
allow=speex,g726,g722,ilbc,gsm,alaw

In the dialplan extensions.conf:

[anonymous]
exten => _XXXXX,1,GotoIf(${DIALPLAN_EXISTS(local-extensions,${EXTEN},1)}?local-extensions,${EXTEN},1)
 same => n,Hangup(1)

local-extensions is the context listing your local extensions.

like image 156
S. H. Totakura Avatar answered Feb 19 '23 23:02

S. H. Totakura


It looks like your missing something from you pjsip config. My basic config is as follows and is based on a sipgate setup with an internal extension. This config has been extracted from a running box (though usernames & passwords have been removed);

pjsip.conf

[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0


[reg_sipgate_premium]
type = registration
retry_interval = 20
max_retries = 10
contact_user = 0000000
expiration = 120
transport = transport-udp
outbound_auth = auth_sipgate_premium
client_uri = sip:[email protected]:5060
server_uri = sip:sipgate.co.uk:5060

[auth_sipgate_premium]
type = auth
username = 0000000
password = password

[sipgate_aor_premium]
type = aor
contact = sip:[email protected]

[sipgate-preimum]
type = endpoint
context = incomingsipgate
dtmf_mode = rfc4733
disallow = all
allow = alaw
rtp_symmetric = yes
force_rport = yes
rewrite_contact = yes
timers = yes
from_user = 0000000
from_domain = sipgate.co.uk
language = en
outbound_auth = auth_sipgate_premium
aors = sipgate_aor_premium

extensions.conf

[incomingsipgate]
exten => 0000000,1,Goto(sipgate-in-premium,0000000,1)

[sipgate-in-premium]
exten => 0000000,1,Verbose(Incoming call from Sipgate line CallerID=${CALLERID(all)})
exten => 0000000,2,Goto(internal-ext,120,1)

[internal-ext]
exten => 120,1,Dial(SCCP/120,20,o,CallerID=${CALLERID(all)})

This line is used to catch any free phone (0500) number and route it via sipgate when a user internally dials 90500xxxxxxx;

exten => _90500.,1,Dial(PJSIP/${EXTEN:1}@sipgate-preimum)
like image 22
user3788685 Avatar answered Feb 19 '23 23:02

user3788685