Trapping all dialed numbers to a specific extension

This is probably a no-brainer for you guys, however for me, I get confused by the documentation.

I have an Asterisk box, and 2 iax atas connected to cheap drugstore handsets. Their is no external VOIP service at this time. Currently they are able to dial each other and connect just fine.

What I’m wanting to do is ‘trap’ anything dialed from one of the phones to ALWAYS dial the other phone.

For instance:
Phone A is extension 1000
Phone B is extension 2000

I want phone B to automatically call phone A no matter what numbers are pressed on it’s keypad, or how many are pressed. In other words, as soon as ANY number is pressed, it automatically calls phone A.

But I want phone A to work just as it is now, or in other words, the user actually has to correctly enter a valid extension.

Any advice on this?
Thanks is advance!

~Cappa.

Hi

Its late here so this may not be too accurate

but give exten B a context of say hotline

then the extensions.conf has

[hotline]

exten => _.,1,Dial(SIP/1000)

or some thing similar

so _. will trap all numbers or what?

Hi,

The dot character is a wildcard character:

voip-info.org/wiki/index.php … n+Patterns

the devs warn against using ‘_.’ these days, and suggest ‘_X.’ so that the extension doesn’t catch the non-numeric extensions, e.g. s, t, h, o etc

The problem with _X. is that it wont match * # or even A,B,C,D.

and as long as the sets context only has the single entry and no includes it should be fairly safe and catching t and i in this case wouldnt be a bad thing.

Ian

ian,

true, i had forgotten about the # and * :blush:

So this is my iax.conf:

[1000]
type=friend
context=from-iax
host=dynamic
defaultip=192.168.1.102
deny=0.0.0.0/0.0.0.0
permit=192.168.1.102/255.255.255.0
allow=all
callerid="phoneA" <1000>
;regexten=1000
auth=plaintext
username=1000
secret=somesecret
register => 1000:phoneA@192.168.1.1
qualitfy=no
peercontext=from-iax

[2000]
type=friend
context=from-iax
host=dynamic
defaultip=192.168.1.103
deny=0.0.0.0/0.0.0.0
permit=192.168.1.103
allow=all
callerid="phoneB" <2000>
;regexten=2000
auth=plaintext
username=2000
secret=somesecrert
register => 2000:phoneB@192.168.1.1
qualify=no
peercontext=from-iax

And this is my extensions.conf:

[from-sip]
exten => 1000,1,Dial(SIP/2000,20)
exten => 2000,1,Dial(SIP/2000,20)

include => from-iax

[from-iax]
exten => 1000,1,Dial(IAX2/1000,20)
exten => 2000,1,Dial(IAX2/2000,20)

include => from-sip

This is my sip.conf:

[1000]
type=friend
context=from-iax                ; Where to start in the dialplan when this phone calls
callerid=phoneA <1>     ; Full caller ID, to override the phones config
host=192.168.1.102              ; we have a static but private IP address
mask=255.255.255.0
defaultip=192.168.1.102
username=1000
secret=somesecret
;regexten=1000                          ; No registration allowed 
nat=no                          ; there is not NAT between phone and Asterisk
canreinvite=no                  ; allow RTP voice traffic to bypass Asterisk
dtmfmode=inband                 ; either RFC2833 or INFO for the BudgeTone

[2000]
type=friend
regexten=2000                   ; When they register, create extension 2
callerid="phoneB" <2>
context=from-iax
dtmfmode=inband
host=192.168.1.103              
mask=255.255.255.0              ; This device needs to register
defaultip=192.168.1.103
username=2000
secret=somesecret                   
nat=no                          ; X-Lite is behind a NAT router 
canreinvite=no                  ; Typically set to NO if behind NAT
disallow=all
allow=gsm
;allow=alaw
allow=ulaw

Do I need to make another context or can I just modify the one context in my extensions.conf?

Thanks for the help!

Hi

I think you need to think a little ore about your numbering, you seem to have 2 x1000 and 2 x2000, Even though they are in different contexts this will cause problems in the furure. As to the hotdial yes the set would need its own context and use a Goto