Set up two X100P cards in Asterisk@Home

Hi all,
I installed two x100P cards in my Asterisl@Home to get  POTS lines. Each card has connected a POT line with differents phone number.
The server is working good, I can make outbound calls and I can get incoming calls.

My questions is: how can I configure each x100p card like a trunk. I need to configure one Outbound Routing per X100P card / POT Line, because each line has a diferent rate with the provider.
and the second questions is: When I receive a call through first line how can I make to ring  o redirect the call to the second line?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Is there any functionality to do what you want within the asterisk@home web interface?

I have helped many people trying to use asterisk@home in the last few weeks and once they want to do anything more complex than is supported in the web interface you end up having to try and hack the customised asterisk configuration it uses which is very difficult, over complicated, and undocumented.

I would strongly advise that you reinstall a general version of lInux and then install asterisk manually. It will take a bit of time to get everything working and configured but you will have a much cleaner and more efficient asterisk system and will be able to make customised changes far more easily.

To answer your question have a look at zapata.conf. In here you can define groups. You woulf define g1 for one card and g2 for another. Then when you make an outgoing call you would decide whether to dial using ZAP/g1 or ZAP/g2 depending on the destination number. If its a case that one line is always cheaper than the other you could use a single group consisting of both telephone lines and just add the cheaper line to the group first so it gets used first.

Why would you want to redirect a call back out the 2nd interface?
I agree with the point of not using AMP to configure the asterisk config, but i wouldn't recommend using anything other than asterisk@home, as you can still customise it manually editing the conf files in /etc/asterisk using the SSH session. there is no reason to install asterisk manually unless you have an extreme aversion to CentOS and want to use a different Distro.

I have used asterisk for 3 years and recently i had to replace my config, and instead of building the system manually i used asterisk@home. and to me it is a fantastic way to get asterisk up & running. i have added my custom config which i have written from scratch and just overwritten completely the sip.conf & extensions.conf. I have then disabled apache from starting so i have disabled the web config. There is really no simpler way to get started.

but to clarify you need to as grblades has suggested use different ZAP groups with each line.

but moving on, as grblades stated why would you want to redirect a call to the second trunk? all that would do would be to tie up both lines for the one call. why would you want to do this?
fferdinanAuthor Commented:
The asterisk@home is very easy and it doesn't mean limited. From web interface the AAH (asterisk@home) i can change all configs files, or I can go to the server AAH log in it and make the chanches manually.

OK now, I can undertand that I need to create groups in the zapata.conf,  can you place some example.

Why would you want to redirect a call back out the 2nd interface?

OK imagine the following situation

Place A
      First Server AAH with two X100P and connected two POTS lines
      POTS Line 1 Number 1111
      POTS Line 2 Number 2222

Place B
      Second Server AAH with two X100P and connected two POTS lines
      POTS Line 3 Number 3333
      POTS Line 4 Number 4444

From place A make a call using my cellphone calling to number 1111 (line1), Line 1 has assigned a SIP extension to Second AAH Server, the Second Server use the number (3333) Line3 to call another cellphone.

How I implement this scenario in the AAH Servers.


Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

first off i would not use the pots lines for communicating with the two asterisk boxes, you have a to VoIP PBX's so i would use  the internet to forward calls between the two boxes either using IAX (NAT Friendly) or SIP. unless of course you do not have the boxes

The process of this is very simple, you just need to determine how you route the call.

do you want asterisk to forward your call based on the CLID of your mobile? you haven't stated how you want to call the second cell phone automatically or with your response.

you could specify that your asterisk box waits 15 seconds after the call has been answered for you to key in the SIP extension of your second asterisk box. and then have that AAH box wait for the digits of the mobile you want to call.

in your inbound pots section of your extensions.conf put include => local

and then put your local extensions and other AAHbox extension in the [local] context.

this would then ensure that noone else could dial other numbers.

you then put these commands in your inbound pots context

  include => local

  exten => s,1,Answer
  exten => s,2,Ringing
  exten => s,3,DigitTimeout,5
  exten => s,4,ResponseTimeout,10
  exten => s,5,Dial yada yada yada

step 1 answers the call, step 2 plays a ringing tone to the caller, but step 3 appends any other digits dialed, and step 4 waits for 10 seconds for more DTMF tones, so if when you hear the ringing tone you dial the SIP extension of the other AAH box you will be put through to that box if no digits are dialled the dial command in step 5 is executed, but be aware that it will dial step 5 immediately so if someone picks up that call before you input the extension you will be unable to route the call

you then need to do a similar thing on that AAH box, but you have to be carefull not to open up full access to inbound callers to dial any number as it would be open to abuse, but if you dial say 5 mobiles you could configure 5 local extensions in the local context of the second AAH box to dial these. i have a short extension for my mobile which is 1005 se my example below

; Dial My Mobile

this effectively tries dialling via VoIP and if that fails tries pots and failing that goes to voicemail or plays the congestion tone

i hope this gives you an idea, but without knowing if you want it manually routed or automatically i will be unable to help further


Stuart Buchanan
Here is a good document :-

So in your case you will want something like the following in zapata.conf :-
channel => 1
channel => 2

Then in extensions.conf you want incoming calls on the [line1] context to be routed out over the internet to the second asterisk box :-

exten => s,1,Dial(IAX2/[username]:[password]@[]/9[telephone-number-to-dial])

Then on the second box you would have an entry in extensions.conf to divert dialed numbers out an analogue interface :-

; we use the 9 prefix to indicate an external line
exten => _9X.,1,Dial,Zap/3/${EXTEN:1}
fferdinanAuthor Commented:
Ok I trying the configuration, but I can't  understand how I'll create 2 trunks, one per line.

You dont actually have to create two groups. As you only have two lines to can just specify the line to use.
fferdinanAuthor Commented:
Thank you for your answer grblades. Ok so no groups, but HOW do I specify the line that I want to use, in what file, HOW, could you give an example and be more specific.

Thank you
> fxsks=1-2
> signalling=fxs_ks
> context=line1
> channel => 1
> context=line2
> channel => 2
Here the 'channel' defines the line. Channel 1 will be the first card in the machine.
All incoming calls on line 1 will therefore go to the line1 context.

> [line1]
> exten => s,1,Dial(IAX2/[username]:[password]@[]/9[telephone-number-to-dial])
Here any calls coming into the line1 context (which will be incoming calls on line1) will be passed over to the other asterisk box.

> exten => _9X.,1,Dial,Zap/3/${EXTEN:1}
Here when 9 is used to get an external line the first digit is stripped off the dialed number and then the call is placed over the zaptel interface channel 3.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Voice Over IP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.