How to handle 2 toll-frees in different contexts?

I think i’ve got the basics down for asterisk. However, I’m a bit confused how to handle this.

I have 2 companies in the same office that will share the same phone system. Each company will have its own toll-free. Each toll-free will ring the asterisk box, but I want to configure asterisk so that each company has its own menu system. I get my SIP trunks for both companies from one provider. They have given me one pilot number.

How do i distinguish the calls from the 2 different toll-free numbers so that they can be handled in different contexts?

The called number will be different, so is important that when you register your number with “registry” you should put the number at the end of registration, because you will have just one provider, so all the calls will go into the same context, to different extensions.
Here is a sample sip.conf:

...
register=>012345678:qwerty@voip.eutelia.it/012345678
register=>012345679:asdfgh@voip.eutelia.it/012345679
...
[eutelia]
type=friend
context=main
secret=xxxxxxx
host=voip.eutelia.it
insecure=port,invite
disallow=all
allow=g729,alaw,ulaw

The calls from “eutelia” (voip.eutelia.it) go to the “main” context, in this context just define the 012345678 and the 012345679 extensions (extensions.conf):

...
[main]
exten=>012345678,1,Goto(company1_context,s,1)

exten=>012345679,1,Goto(company2_context,s,1)
...

Hope it helps you.

Cheers.

Marco Bruni

Thanks, Marco. Thank helped a lot and I think I get it now. I’ll give it a try once i get my second toll-free ordered.

edit: Actually, just to clairfy one thing, the pilot number is irrelevant and if someone dials one of my toll-frees asterisk will still recognize that toll-free as the called number and not the pilot number?

My trunk provider asked me whether i wanted to point the toll-frees at the pilot number or some other number, and that is where my confusion arises. I guess I don’t understand the point of a pilot number when using SIP trunks…

I am not sure what they mean by pilot number. The reason why they are asking where you want to point the two numbers is so that they can point them to different URI’s so you can split it up. As you can see in mbruni’s example based on the set up they will send it to different URI’s so you can split it up and do with it as you wish.