Block outgoing calls

Hi.
I wonder if I can block outgoing calls to certain pattern ?

I also wonder how its possible for a stranger in another country to make calls trough my asterisk ?
Dosent the extension he use match my sip.conf ?
I see in the cdr logfile (mysql actually) that the call was made from “sip/xxx.xxx.xxx.xxx-xxxxxx” instead of one of my phones/extensions. How is it possible ?
And, how do I prevent that in the future ?

Lets say I want to allow all call except the one that starts with 44, how will i write that in my extensions.conf ?

Edit: Forgot, the version i run is: Asterisk 1.6.0.5
Run it on Ubuntu server

[code]SIP.CONF:

[general]
context=default
port=5060 ; UDP port for Asterisk
bindaddr=0.0.0.0
externip=<MY_DOMAIN>
localnet=192.168.1.0/255.255.255.0
srvlookup=yes ; Enable DNS SRV server
nat=no
disallow=all
allow=ulaw
register => USER:PASSWD@<MY_VOIP_PROVIDER>/200

[call_out]
type=friend
host=<VOIP_PROVIDER_SERVER>
fromdomain=<VOIP_PROVIDER_DOMAIN>
progressinband=yes
nat=no
canreinvite=no
qualify=yes
insecure=port,invite
username=
fromuser=
secret=
dtmfmode=inband
disallow=all
allow=ulaw

[200]
type=friend
secret=
nat=no ; Telephone without NAT
insecure=port,invite
host=dynamic ; the devices can be registered with different IPs each time
canreinvite=no ; Asterisk by default redirects
disallow=all
allow=ulaw



.
---------------------------------------------------------------[/code]

[code]

EXTENSIONS.CONF

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

[default]

include => day,10:31-23:59,mon,,
include => day,,tue-thu,,*
include => day,07:00-14:29,fri,,
include => helg,,sat-sun,,*
include => helg,00:01-10:30,mon,,
include => helg,14:30-23:59,fri,,

; Computer basement
exten => 200,1,Wait(1)
exten => 200,2,Dial(SIP/200,60)
exten => 200,3,Hangup

; Call out
; exten => _044X.,1,Hangup
exten => _0X.,1,Dial(SIP/${EXTEN:1}@call_out,r)
exten => _0X.,n,Hangup

[day]
exten => 200,1,Wait(1)
exten => 200,2,Dial(SIP/400,60)
exten => 200,3,Hangup

[helg]
exten => 200,1,Wait(1)
exten => 200,2,Dial(SIP/200,60)
exten => 200,3,Hangup
---------------------------------------------------------------[/code]

See the “Howto Allow Only One SIP Trunk” for pointers to information on locking down Asterisk.

See Asterisk The Future of Telephony for how to write dial plans.

[quote=“david55”]See the “Howto Allow Only One SIP Trunk” for pointers to information on locking down Asterisk.

See Asterisk The Future of Telephony for how to write dial plans.[/quote]

Ahh, thanks.
Hopefully that will hold the chinese people out for a while.
I’ve missed allowguest, also my firewall was open on 5060 from ALL because i used to travel alot before, and i never know what address i had. Now it’s open only to my VOIP-provider.

About the dialplan, i now has something to read tonight. Thanks

Hello… did you solve the issue?? about blocking outgoing calls that starts with 06 for exapmle??

Blocking calls that begin wtih 06 is a trivial bit of dialplan programming. If you don’t know how to do it, you need to re-read the dialplan section in the Definitive Guide.

Lets say I want to allow all call except the one that starts with 44, how will i write that in my extensions.conf ?
=>
Add following in your dialplan before you dial out,
same =>n,GotoIf($["${EXTEN:0:2}" = “44”]?:block,s,1)
… …
[block]
exten => s,1, Hangup()

–Satish Barot

Define an extension, using a pattern than matches more specifically for the unwanted number block, than the pattern that matches for outgoing calls, and have it dispose of the call as you see fit. Again, if you need to know how, you do not understand dialplans well enough to be writing them.