Using Asterisk as a Proxy/LCR System..

Introduction.

asterisk-by-digiumThis post is going to briefly cover how to use asterisk to be a proxy between an old ISDN System and a SIP Trunk. This example also shows how to modify the dialed number to add in the area code you are dialing, for example if your users are used to just dialling 6 digits to get to a local business etc.

Example Explained.

In our example we have an ISDN PBX and we want to¬†integrate¬†a SIP trunks, so that we can take advantage of lower calling costs, IE you might have a SIP trunk from a USA provider and one from the UK, you would send all USA numbers out to the USA trunk and they would forward the call at the cost of a Local call, while still being able to dial UK numbers via the UK trunk etc etc…

This is called LCR or Least Cost Routing, and could save you some money on your telephone bill.

Right back to our example, we have an ISDN PBX, a ISDN to SIP convertor, and an asterisk server to perform both LCR and a simple dial plan.

Inbound:
SIP Provider > Asterisk > ISDN Gateway > PBX

Outbound:
PBX > ISDN Gateway > Asterisk > SIP Provider

In the example all we are doing is taking the call from the ISDN gateway checking to see if we need to add the local area code if calling locally and forward the call on to the SIP provider.

We could have a few SIP providers and get very granular on how we want the call to be routed and to where.

Example Config.

sip.conf

    ; Provider SIP Trunk

        [Trunk-Provider]
        type=friend
        context=from-provider
        deny=0.0.0.0/0.0.0.0
        permit=IP-ADDRESS
        host=IP-ADDRESS
        username=USERNAME
        secret=PASSWORD
        language=en_GB
        disallow=all
        allow=alaw
        dtmfmode=rfc2833

    ; ISDN SIP Trunk

        [ISND-Trunk]
        type=friend
        context=from-isdn
        deny=0.0.0.0/0.0.0.0
        permit=IP-ADDRESS
        host=IP-ADDRESS
        username=USERNAME
        secret=PASSWORD
        language=en_GB
        disallow=all
        allow=alaw
        dtmfmode=rfc2833

extensions.conf

    [from-isdn]

        ; from isdn with area code
            exten => _X.,1,Dial(SIP/${EXTEN}@Trunk-Provider,1000)
            exten => _X.,2,hangup

        ; from isdn, no area code, six digit, prepending area code
            exten => _NXX.,1,Dial(SIP/+0115${EXTEN}@Trunk-Provider,1000)
            exten => _NXX.,2,hangup

    [from-provider]

        ; from SIP Provider, send to ISDN
            exten => _X.,1,Dial(SIP/${EXTEN}@ISND-Trunk,1000)
            exten => _X.,2,hangup

lll

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
This entry was posted in How To Guides, Little Guides and tagged , , , . Bookmark the permalink.

Comments are closed.