Asterisk Last Number Repeat
If you use this setup a phone can dial *5 to repeat the last number you dialed (from that callerid).
The configuration is based upon a few steps:
Step 1: Separate the dialling context for phones/users from the ‘actual dialling’ from the macro we will define in Step 2:
[pbx]
include = apps
include = dialpbx
[dialpbx]
exten = _X.,1,Macro(dial)
[router]
include = local
include = apps
include = outbound
exten = t,1,Busy
Step 2: Route all dialling (except for applications/vertical service codes) through a Macro:
If you already had your extensions going to context ‘pbx’, you are already doing this (see Step 1)
[macro-dial]
exten = s,1,DBput(RepeatDial/${CALLERIDNUM}=${MACRO_EXTEN})
exten = s,2,Dial(Local/${MACRO_EXTEN}@router)
exten = s,3,Busy
Notes
- This macro reads variables stored in the Asterisk database
- The macro executes ‘Dial(Local/<number>@router)’. This implies the number that was selected is dialable from the [router] context, as shown in Step 1. You may need to change this. (If you only want outbound redirect this could be Dial(Zap/1/<number>) for instance)
- If the DBget does not find a key, it exists with the result code 101, making the next step in the dial plan the current priority+101
Step 3: Adding the redial shortcode
[apps]
; Repeat last dialled number
exten = *5,1,DBget(temp=RepeatDial/${CALLERIDNUM})
exten = *5,2,Dial(Local/${temp}@router) ; Last known
; No RepeatDial key
exten = *5,102,Congestion
Notes
- This context implements the functionality to activate the redial. It should be accessible for users as defined in Step 1.
- This programming does not confirm the setting with an audio prompt. Add this if you want the user to get a confirmation of the new status.