Asterisk redirect calls to external number

asterisksipvoip

We have a phone system created on pure Asterisk (no web GUI) and there are the usual Day/Night mode.
In the day mode it calls a ring group. However we have a call centre that we use to pick up our calls when we can not for some reason.

To redirect the incoming calls to this call centre I'm currently send them all to my extension and from my phone I set a forward to the call centre.

The code is:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;This one is to send anyone who rings main line
;to [dial-groups] context
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
exten => 999999999990000,1,Goto(dial-groups-daynight,daynight,1)
exten => 999999999990000,n,Voicemail(7000,u)
exten => 999999999990000,n,Hangup
;;;;;;;;;;;;;;;;;;;;;;;;;;END;;;;;;;;;;;;;;;;;;;;;;;

Then:

[dial-groups-daynight]
exten => daynight,1,Set(COUNT=${DB(mir/daynight)})
exten => daynight,2,Set(CALLERID(name)=${CALLERID(num)} to:${CALLERID(dnid):-8})
exten => daynight,n,Gotoif($["${COUNT}" = "0"]?day)
exten => daynight,n,Gotoif($["${COUNT}" = "1"]?night)

;exten => daynight,n(day),Dial(${RINGGROUP600},6)
;exten => daynight,n,Dial(${RINGGROUP601},10)
;exten => daynight,n,Voicemail(7000,b)
;exten => daynight,n,Hangup()
exten => daynight,n(day),Dial(SIP/7006,6)
exten => daynight,n,Dial(SIP/7006,10)

So I just comment the lines that makes the call go to the ring group and force it to go to my extension and from my phone I set the forward call.

How could I make it instead of call my extension to call the external number?
For example, a number such as: +44 77 8900 899890

I mean the: "exten =>" line to do that.

Best Answer

Presuming you have a dial-plan with all your outgoing call stuff in a context called [outgoing] you could do something like this:

exten => daynight,n,Dial(LOCAL/0044778900899890@outgoing)

This takes advantage of whatever LCR you have, TOD routing, fail-over routes, etc.

Recommended reading: https://wiki.asterisk.org/wiki/display/AST/Local+Channel