PSTN's and Call Forwarding

I’m looking to set up a VOIP network that allows VOIP calls to be received and then forwarded to a PSTN network. More specifically I’d like to be able to see who is calling and based on that SID forward the call to an appropriate PSTN number.

Am I able in Asterisk to receive these VOIP calls analyse them and forward out to the proper PSTN number? For example Joe Blow calls on his VOIP phone, it comes to me and Asterisk, I then see who the SIP is and know that Joe Blow’s calls should be forwarded to 401-555-1212?

Also, I’m new to all of this, what do I need on the PSTN side of things? Do I just plug the PSTN line into my gateway and the gateway places the call on the PSTN network? Is there a special type of service I need or is a regular phone line all I need?

Thanks in advance to whoever decides to take the time and write a response. It’s very much appreciated.

Myk

Well I wouldn’t be totally sure how to setup extensions.conf for your case, but it sounds like you’d probably have to do a database tie in (if there were more than just a few people capable of calling in). As for hardware setup, some regular phone lines and Digium or other Zaptel compatible card should do the trick just fine. Something like the below might work for your extensions.conf setup (but don’t copy and paste, its just a rough example)

[code][mainmenu]
exten => s,n,GotoIf($["${CALLERID(number)}" = “5551231234”]?JoeOut,s,1)
exten => s,n,GotoIf($["${CALLERID(number)}" = “5559879876”]?JillOut,s,1)

[JoeOut]
exten => s,1,Answer
exten => s,n,Dial(zap/g0/www9991231234)
exten => s,n,Hangup

[JillOut]
exten => s,1,Answer
exten => s,n,Dial(zap/g0/www9991231234)
exten => s,n,Hangup[/code]

Hopefully the above sample makes enough sense. In the above I change locations by CallerID incoming. Again - would not want to use something like this for more than a few people.

[quote=“ShakataGaNai”][mainmenu] exten => s,n,GotoIf($["${CALLERID(number)}" = "5551231234"]?JoeOut,s,1)
[/quote]

An simpler way to handle a handful of ID is

[mainmenu] exten => s/5551231234,1, Dial(zap/g0/www9991231234) exten => s/5559879876,1, Dial(zap/g0/www9991231234)

When you are simply forwarding a call, no need to worry about hang-up. You’d need to set up your timeout extension and such. (Not exemplified.) For numerous ID’s, use AstDB should suffice, e.g.,

[mainmenu] exten => s,1,Set(PSTN=${DB(CIDMAP/${CALLERID(number)})}) exten => s,n,Dial(zap/g0/${PSTN})

Asterisk dial plan applications and functions make this very simple and easy. You just need to learn a little about the dial plan “language”. (Here, CIDMAP is an AstDB family you have to populate yourself, using function DB.)

Roger that,

I’ll start studying the dial plan language and research using the DB functions. Now that I know it’s possible I’ll see if I can get this working. I’ll keep you posted and am sure I’ll have a question or two along the way.

Thanks again!