Simple but effective Dial Plan

Catalog of dial plans
Post Reply
paulies
Posts: 97
Joined: Mon Jul 28, 2008 11:09 am

Simple but effective Dial Plan

Post by paulies » Wed Apr 08, 2009 7:48 pm

Hi,

I am posting my dial plan here hoping it will help others get started with Mysipswitch. I have kept all my providers in ie voxalot, sipbroker and not renamed them provider1 and provider2. This plan is setup for the UK but can be easily modified for other countrys. I have tried to comment on each line what each does, I'm sure some will find it useful

My dial plan includes,

1: Forwards to voicemail after a set amount of time
2: Redundancy if the internet fails to will forward to another number
3: Caller blocking and can be set to forward to voicemail or message of your choosing.
4: I have included some international numbers more can be added.
5: Setup some USA and Canada freephone numbers through sipbroker
6: Automatically adds your local dialing code so when calling local you dont have to dial it.
7: The dial plan automatically adds 0044 if your in the UK.
8: Added some speed dial numbers.

Code: Select all

#Ruby
# Dial Plan Generated by Rubyzard v0.1 
# If you need help, please post in our forum under
# the Getting Started section

# SIP tracing : true or false 
sys.Trace = false 

sys.Log("call from #{req.Header.From.FromURI.ToString()} to #{req.URI.User}.")


if sys.In then
 # Do your INCOMING call processing customisations here.

 caller = req.Header.From.FromURI.User
 case caller
  when /^(01422249611|08454166927)$/     #Swinton and Unknown Callers Blocks numbers you dont want
   sys.Log("Rejecting call from #{caller}")
   sys.Dial("xxxxxx@us.voxalot.com") # Forwards to a seperate voicemail with a message of your choosing

  else
    sys.Log("Accepting call from #{caller}") 
	 if sys.IsAvailable() then
		 sys.Dial("#{sys.Username}@local",25)
		 sys.Dial("xxxxxx@us.voxalot.com") # Goes to voicemail after 25 seconds
	 else
		 sys.Dial("xxxxxxxxxxxx@voxalot",25) # Forwards to a number of your choosing if internet is down
		 sys.Respond(480, "#{sys.Username} Not available")
	 end
 end
else
  # Do your OUTGOING call processing customisations here.

case req.URI.User.Length
when 6 then
sys.Dial("6 char : local")
sys.Dial("01422${dst}@voxalot") # Put your local dial prefix here so you can dial local number like a normal telephone
else
sys.Log("number length : #{req.URI.User.Length}")
end



	 case req.URI.User
		 when /^(34|33|1|61|49|852|353|60|64|65|46|33|47)/ then sys.Dial("voxalot") # A selection of international numbers
                 when /^(1800|1866|1877|1888)/ then sys.Dial("sipbroker") # USA freephones number
                 when /^0(80(0|8).+)/ then sys.Dial("44#{$1}@Coms") # UK calls to 0800 or 0808 without the need for 0044. 
                 when /^0(.+)/ then sys.Dial("44#{$1}@voxalot") # UK calls without the need for 0044. 
                 when /^44(1|2|7)/ then sys.Dial("voxalot") 
                 when /^00/ then sys.Dial("voxalot")
                 when /^4480(0|8)/ then sys.Dial("Coms")  # UK freephone numbers
                 
                 when /^\*500$/ then sys.Dial("xxxxxx,xxxxxx,*500@us.voxalot.com") #voicemail for normal callers
                 when /^\*555$/ then sys.Dial("xxxxxx,xxxxxx,*500@us.voxalot.com") #voicemail for block callers
                 when /^\*1$/ then sys.Dial("xxxxxx@sip.mysipswitch.com") # Speed Dial Number
                 when /^\*2$/ then sys.Dial("xxxxxx@sip.mysipswitch.com") # Speed Dial Number
                 when /^\*3$/ then sys.Dial("xxxxxx@sip.mysipswitch.com") # Speed Dial Number
                 when /^\*4$/ then sys.Dial("xxxxxxx@sip.mysipswitch.com") # Speed Dial Number
                 when /^\*123$/ then sys.Dial("303@sip.blueface.ie")  # Blueface speaking clock.
                 
                 
                 
		 else sys.Dial("voxalot")
	
end
end
Paul

Post Reply