Questions about dial-plan

hi,

i’m an asterisk newbie. i have some questions regarding completion of my dial-plan. i tried to read asterisk documents and manuals, but it was somehow too detailed and complicated for me and i couldn’t find my answers. i googled too but had no luck. so now i’m asking you guys:

i’m having two PBXes (PBX1 and PBX2) connected to my asterisk (AST) via E1 lines. i managed to setup my asterisk in a way that if any user from PBX2 calls an “_1.” number, asterisk sends call to PBX1. and if a user from PBX1 calls an “_2.” number, asterisk sends call to PBX2. and now it works OK and i can dial PBX1 clients from PBX2 and vice-versa.

this is my current asterisk configuration:

asterisk/dahdi-channels.conf :


group=0,11
context=line1
switchtype = qsig
signalling = pri_net
channel => 1-15,17-31

group=0,12
context=line2
switchtype = qsig
signalling = pri_net
channel => 32-46,48-62

asterisk/extensions.conf


[line1]
exten => _2.,1,Dial(DAHDI/i2/${EXTEN})
[line2]
exten => _1.,1,Dial(DAHDI/i1/${EXTEN})  

now i have two questions, regarding completion of dial-plans:

1- if i wanted to change dial-plan, so that if filters incoming calls, (similar to cisco’s “incoming-pattern” command) what changes should i make to my dialplan? (for example, suppose: i want only PBX2 clients which their numbers start with 222 could dial PBX1 clients. what changes should i do to my “exten => _1.,1,Dial(DAHDI/i1/${EXTEN})” dial-plan?)

2- suppose i want to add a specified prefix to dialed number. (for example, suppose: i want if a client of PBX2 called “12345”, router adds “999” to it and sends “99912345” to PBX1. what changes should i do in above dial-plan?)

thank you for your time.

  1. Google ex-girlfriend logic (or do explicit tests on ${CALLERID(num)}.

  2. Sorry that is too trivial. You need to go back and understand the documentation.

thank you for your reply,

i found what i should do to add incoming-pattern and prefix to dial-plan. your “ex-girlfriend logic” term helped me find what i was gonna do about the first matter.

so this is (what i think) the answer to my questions (i’m gonna test them later):

  1. to handle incoming pattern, if suppose i want to filter caller-numbers so that only users with “_100.” number patterns have access to call PBX2. i should change this line:
exten => _2.,1,Dial(DAHDI/i2/${EXTEN})

to something like this:

exten => _2./_100.,1,Dial(DAHDI/i2/${EXTEN})
  1. if i want to add a prefix like for example 999 to destination number, i should simply change this line:
exten => _2.,1,Dial(DAHDI/i2/${EXTEN})

to something like this:

exten => _2.,1,Dial(DAHDI/i2/999${EXTEN})