outplan with rubywizard.

Catalog of dial plans
Post Reply
mnipp
Posts: 192
Joined: Sat Oct 03, 2009 9:48 am
Location: NSW Australia

outplan with rubywizard.

Post by mnipp » Fri Apr 16, 2010 11:32 am

This is my latest outplan with a easy to edit speed dial section.
I also wrote a RubyWizard to make it easy to customize the plan to your needs.

RubyWizard
http://free2call.me/rubywizard.html

USE copy and paste on the rubywizard output to copy the plan, a save of the page may not work and you lose the results.
Keyboard shortcuts work; use Ctrl-C to copy and Ctrl-V to paste.
Ctrl-A to 'select all' of the plan to copy.

just make sure the provider names in SIP Providers are the same ones you set in the dial plan.

Code: Select all

      # your OUTGOING call processing.

sys.SetFromHeader("#{req.Header.From.FromName}", nil, nil)  # Set Display Name from phone in CallerID 

#**************************************************
# Advanced outplan generated using mnipp-RubyWizard
# Fri, 16 Apr 2010 04:16:22 +0000 GMT/UTC
#**************************************************
#**************************************************
# >> ptel << is the name I used in my SIP Provider settings for calls to fixed phones and mobiles.
#**************************************************
SPEED_DIAL = [  #  SPEED DIAL Entries with 01 or 02 etc.. dialled number
#**************************************************
'Number Dialled' ,    'Number or SIP to Send       ' , # Label Contact

  ' 01  ' ,            ' buddy1                    ' , # dial buddy1 on sipsorcery 
  ' 02  ' ,            ' buddy2@iptel.org          ' , # buddy2 on iptel.org 
  ' 03  ' ,            '  (02) 8765 4321           ' , # speed dial 02 8765 4321 phone number with pennytel account 

 # Radio Podcasts on phone, use (*) to skip forward and (#) back in 1 minute jumps. 
  ' 30  ' ,            ' 5595534621 @ podlinez .net' , # Dr Karl on triplej 
  ' 31  ' ,            ' 6414539840@podlinez.net   ' , # ABC NewsRadio Senate Question Time 
  ' 32  ' ,            ' 6414539852@podlinez.net   ' , # ABC NewsRadio House of Representatives Question Time
  ' 33  ' ,            ' 6414530997@podlinez.net   ' , # All in the Mind 
  ' 34  ' ,            ' 6414531005@podlinez.net   ' , # Radio National, The Science Show
  ' 35  ' ,            ' 6414531002@podlinez.net   ' , # Innovations www.radioaustralia.net.au
  ' 36  ' ,            ' 6414531004@podlinez.net   ' , # StarStuff takes us on a weekly journey across the universe
  ' 37  ' ,            ' 4152234133@podlinez.net   ' , # AM program
  ' 38  ' ,            ' 6502939113@podlinez.net   ' , # PM program 

 # This is a gizmo5 1222 dialled conference room, room number 0000000
  ' 50  ' ,            ' 12220000000@proxy01.sipphone.com ' , # 

 # Try these test numbers on speed dial
  ' 97  ' ,            ' 1234@loligo.com           ' , # 
  ' 98  ' ,            ' 904@mouselike.org         ' , # 
  ' 99  ' ,            ' +1800 555 8355            ' , # TELL ME, USA +1800 are free calls on Enum Lookup
  '100  ' ,            ' skype_echo123@proxy01.sipphone.com ' , # echo test on SKYPE

 # Send these small numbers to MyNetFone
  '151  ' ,            ' @mynet                    ' , # MyNetFone acc balance 
  '121  ' ,            ' @ mynet                   ' , # MyNetFone voicemail 

 # Send these small numbers to pennytel
  '771  ' ,            ' @ ptel                    ' , #  ptel acc balance
  '778  ' ,            ' @ptel                     ' , #  ptel voicemail 

  '*500 ' ,            ' @voxalot                  ' , #  voxalot voicemail 

  ' 131314 ' ,         ' (03) 9683 9999            ' , # ANZ BANK 131314 to 03 9683 9999 cheaper number

]#*************************************************
# The following section is to define functions to be used later in the plan such as 
# How to do an Enum lookup.
#**************************************************

# International Enum database list from sipbroker
EnumSuffix = %w[  e164.arpa e164.org e164.info e164.televolution.net enum.org   ]

# Only these likely for local numbers for faster lookup
EnumLocal  = %w[  e164.arpa e164.org          ]

def E164num(nume164)    # turn number into full international E164 format.
                        # this section uses (61)country code (02)area code and (0011)international prefix
   if nume164 =~ /^0011/ then 
      nume164 = nume164[4..50]  # remove international prefix (0011) 4 digits from front of number 
   else 
     nume164 = "61"  + nume164[1..50] if nume164 =~ /^0/      # national number remove leading 0 add 61. 
     nume164 = "612" + nume164        if nume164.length == 8  #  local number 8 digits add 612.
     nume164 = "61"  + nume164        if !(nume164 =~ /^61/)  # add 61 to remaining numbers
     EnumSuffix = EnumLocal      # Use local Enum database list only
   end
  sys.Log("Number in Enum E164 format +#{nume164}")
  return nume164
end

# ENUM lookup of number for possible sip address
def EnumCall(num) 
  nume164 = E164num(num)  # first turn number into full international e164 format using above rules for your country.
  sys.Log("Entering enumCall")
   EnumSuffix.each do |suffix|                         # check each Enum database
    sys.Log("Searching #{suffix} for #{nume164}")      # log Enum check
    if enumuri = sys.ENUMLookup("#{nume164}.#{suffix}") # if true dial returned sip
       sys.Log("Attempting call to #{enumuri}")
       sys.Dial("#{enumuri}")   # dialling returned sip address
       sys.Log("Failed to call #{enumuri}")
    end
   end
end

#******************************************
     SPEED_DIAL.map!{ |SDnum| SDnum.to_s.strip} # remove spacing around Speed-dial entries.
     SD = Hash[*SPEED_DIAL]
     num = SD[req.URI.User.to_s] || req.URI.User.to_s    # Get dialled number Substitute with speed dial entry, if any
     num = num.gsub(/\ /,'')       # delete all spaces.

case num
     when /^@/  then sys.Dial("#{req.URI.User}#{num}")       #  Dial number to selected @provider in SPEED_DIAL
     when /@/   then sys.Dial(num)                           #  Dial if sip:address from SPEED_DIAL
     when /%40/ then sys.Dial("#{req.URI.User.to_s.gsub(/%(..)/){$1.hex.chr}}[rm=a]") # (user%40host@sipsorcery.com) to (user@host)

 # Select dialout provider
    when /^1747/ then sys.Dial("gizmo5")             # with number prefix
    when /^1222/ then sys.Dial("gizmo5")             # with number prefix
 
 # Select dialout provider with 1* 2* etc.. in front of number, ${dst:2} will remove the 1* prefix
    when /^1\*/ then sys.Dial("${dst:2}@ptel")       # dial (1*number) for (number@ptel).
    when /^2\*/ then sys.Dial("${dst:2}@mynet")      # dial (2*number) for (number@mynet).
    when /^3\*/ then sys.Dial("${dst:2}@gizmo5")     # dial (3*number) for (number@gizmo5).

# 9*+sipbroker number dialling (eg 9*234..to *234..@sipbroker.com)
    when /^9\*/ then sys.Dial("${dst:1}@sipbroker.com[rm=a]")

# Add 0* in front of the number for sipsorcery only dial.
    when /^0\*/ then sys.Dial("${dst:2}@local")       # 0* + number for sipsorcery.com

# freenum.org style dialling eg (1234*256) for (sip:1234@loligo.com)
    when /^(\d{2,})\*(\d{2,})$/ then sys.Dial(sys.ENUMLookup("#{$1}.#{$2}.freenum.org"))

# end of speed dial list
# ****************************************
else
    # **************************************** 
    # if a full sip dial, dial here and quit. 
    # skip to number dial if sipsorcery host 
    # **************************************** 
     if sys.GetCanonicalDomain(req.URI.Host.to_s) == "sipsorcery.com"
      sys.Dial("#{num}@local")             if num =~ /[a-zA-Z]/ # if dialled sipsorcery name not number from softphone or SPEED DIAL
      sys.Respond(480, "failed sip dial.") if num =~ /[a-zA-Z]/ # A failed sip dial, quit dial plan
     else
      sys.Log("Sip Number in #{req.URI.User}@#{req.URI.Host}") 
      sys.Dial("#{req.URI.User}@" << "#{req.URI.Host}".downcase) # dial full sip address entered 
      sys.Respond(480, "failed sip dial.")                      # A failed sip dial, quit dial plan
     end 
    # end of sip dial. 

      num = num.gsub(/[^0-9*#+]/,'') # delete all but digits and ( # * + ) on numbers.
      num = num.gsub(/^\+/,'0011')    # replace leading + with international prefix on numbers.
      num = num.gsub(/\+/,'')
      num = num[0..14]     if num =~ /^00111[2-9]/ # trim USA numbers longer than +(11 digits) to be valid.
      numarea = num
      numarea = "02" + num    if num.length == 8  #  local number 8 digits add (02)areacode.
      nume164 = E164num(num)      # number in full international e164 format

     # ****************************************
     # Do an Enum check on number.
     # ****************************************
     # If number greater than or equal to 8 digits try an Enum check
        EnumCall(num) if num.length >= 8  

     # if ENUM failed on USA TollFree try this directly.
        sys.Dial("164164#{nume164}@sip.tollfreegateway.com")  if nume164 =~ /^1(800|866|877|888)\d{7}/

     # ****************************************
     # If no above matches,
     # The default main provider account
     # ****************************************

       sys.Dial("#{numarea}@ptel")      # default provider. local numbers dialled with (02)areacode

       sys.Dial("#{numarea}@mynet")     # backup provider.  local numbers dialled with (02)areacode
end
Last edited by mnipp on Mon Sep 20, 2010 12:53 pm, edited 4 times in total.
billion 7404VGP
dialplan (<9*:*>[0-9*][0-9*].T<:@sipbroker>|[0-9*].T)

mnipp
Posts: 192
Joined: Sat Oct 03, 2009 9:48 am
Location: NSW Australia

Re: outplan with rubywizard.

Post by mnipp » Fri Jul 16, 2010 10:54 pm

Simple outPlan wizard

I have now added a simple dialplan wizard

http://free2call.me/simple/rubywizard.html

Code: Select all

      # your OUTGOING call processing.

sys.SetFromHeader("#{req.Header.From.FromName}", nil, nil)  # Set Display Name from phone in CallerID 

#**************************************************
# Simple outplan generated using mnipp-RubyWizard
# Sat, 17 Jul 2010 06:16:39 +0000 GMT/UTC
#**************************************************
#**************************************************
# >> ptel << is the name I used in my SIP Provider settings for calls to fixed phones and mobiles.
#**************************************************

case req.URI.User

 # Select by number prefix
    when /^77[1578]$/ then sys.Dial("ptel")      # with number prefix, 771, 775, 777 and 778 for ptel
    when /^1[258]1$/ then sys.Dial("mynet")      # with number prefix, 121, 151 and 181 for mynet
    when /^04/ then sys.Dial("ptel")             # with number prefix, 04... mobile numbers for ptel
 
 # Select dialout provider with 1* 2* etc.. in front of number, ${dst:2} will remove the 1* prefix
    when /^1\*/ then sys.Dial("${dst:2}@ptel")          # dial (1*number) for (number@ptel).
    when /^2\*/ then sys.Dial("${dst:2}@mynet")         # dial (2*number) for (number@mynet).
    when /^3\*/ then sys.Dial("${dst:2}@podlinez.net")  # dial (3*number) for (number@podlinez.net).

 # 9*+sipbroker number dialling (eg 9*234..to *234..@sipbroker.com)
    when /^9\*/ then sys.Dial("${dst:1}@sipbroker.com[rm=a]")     # dial (9*number) for (*number@sipbroker.com)

 # Add 0* in front of the number for sipsorcery only dial.
    when /^0\*/ then sys.Dial("${dst:2}@local")       # dial (0*number) for (number@sipsorcery.com)

else
    sys.Dial("ptel")  # default output provider if no matches above.
end
billion 7404VGP
dialplan (<9*:*>[0-9*][0-9*].T<:@sipbroker>|[0-9*].T)

mnipp
Posts: 192
Joined: Sat Oct 03, 2009 9:48 am
Location: NSW Australia

Re: outplan with rubywizard.

Post by mnipp » Fri Aug 06, 2010 1:34 pm

I just added a GoogleVoice option to my simple DialPlan rubywizard. I dont use GoogleVoice so if there is a problem and you see a solution post it here.
http://free2call.me/simple/rubywizard.html
billion 7404VGP
dialplan (<9*:*>[0-9*][0-9*].T<:@sipbroker>|[0-9*].T)

mnipp
Posts: 192
Joined: Sat Oct 03, 2009 9:48 am
Location: NSW Australia

Re: outplan with rubywizard.

Post by mnipp » Mon Aug 09, 2010 11:40 pm

I just added a GoogleVoice option to my "Advanced DialPlan" rubywizard. I dont use GoogleVoice so if there is a problem and you see a solution post it here.

http://free2call.me/rubywizard.html
billion 7404VGP
dialplan (<9*:*>[0-9*][0-9*].T<:@sipbroker>|[0-9*].T)

mnipp
Posts: 192
Joined: Sat Oct 03, 2009 9:48 am
Location: NSW Australia

Re: outplan with rubywizard.

Post by mnipp » Mon Sep 20, 2010 3:32 am

I improved the first page of my "Advanced DialPlan" rubywizard. With some javascript helpers to help fill the page correctly on your first go.

http://free2call.me/rubywizard.html
billion 7404VGP
dialplan (<9*:*>[0-9*][0-9*].T<:@sipbroker>|[0-9*].T)

mnipp
Posts: 192
Joined: Sat Oct 03, 2009 9:48 am
Location: NSW Australia

Re: outplan with rubywizard.

Post by mnipp » Thu May 05, 2011 1:06 pm

I have update the simple outplan ruby wizard with a filter the number option on the default provider if needed
http://free2call.me/simple/rubywizard.html

This post shows why you may need it on your dialplan.
viewtopic.php?f=6&t=3568
billion 7404VGP
dialplan (<9*:*>[0-9*][0-9*].T<:@sipbroker>|[0-9*].T)

User avatar
Flip
Posts: 82
Joined: Sun Aug 19, 2012 3:53 am

Re: outplan with rubywizard.

Post by Flip » Sun Mar 27, 2016 4:47 am

Hi, Great work with the Simple and Advanced Ruby Wizards! :D

Why does "podlinez.net" not work any more?
Just went back to use it for testing a few years later, and it's gone!

Can anyone recommend any alternate methods for accessing these types of resources? e.g. Senate / House of Reps etc...?

.
I would highly recommend, people add these test numbers to their dial plan, so they can dial *201,*202, etc.

Code: Select all

 # TEST AUDIO CHANNELS | CALLS & MUSIC
    when /^200/ then sys.Dial("music@iptel.org")       # Audio Test
    when /^201/ then sys.Dial("early_music@iptel.org") # Audio Test [Early Media]
    when /^203/ then sys.Dial("wbdemo@conf.zipdx.com") # Audio Test [Wide Band]
    when /^205/ then sys.Dial("6414539840@podlinez.net") # Parliament Question Time - Senate [OFFLINE]

    when /^211/ then sys.Dial("0871271201@PTL_3") # Two-way Audio Echo Test.
    when /^212/ then sys.Dial("0871271202@PTL_3") # Plays Music from Radio Paradise.
    when /^213/ then sys.Dial("0871271203@PTL_3") # Announce CLI / CID.
    when /^214/ then sys.Dial("0871271204@PTL_3") # Speaking Day/Date/Time.
    when /^215/ then sys.Dial("0871271205@PTL_3") # Test DTMF Key Tones.
ISP: Exetel ADSL2+ $60 Bundle. 22.4/1.2Mbps, 200/∞ GB [AAPT] + PSTN Bundle [Telstra].
VSP: Telecube¹, SIPTalk², MyNetFone³ via SIPSorcery & Ol' Voxalot. [OMG! Ewww Yuck!! Avoid DIDLogic!!!
H/W: Asus RT-AC66U; Cisco SPA232D, 3 x SPA302's, 2 x SPA901's, SPA3102; Yealink SIP-T46G.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest