Play a message before connecting call, is this the correct way to do this?

For the last few months I’ve had the following code play a file to any number which begins with a ‘9’.

[outrt-5] ; Advise about dialling a 9
include => outrt-5-custom
exten => _9X.,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _9X.,n,Playback(./custom/prefix-no-longer) ;insert this line to play your message
exten => _9X.,n,Gosub(sub-record-check,s,1(out,${EXTEN},dontcare))
exten => _9X.,n,ExecIf($[ "${CALLEE_ACCOUNCODE}" != "" ] ?Set(CDR(accountcode)=$
exten => _9X.,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _9X.,n,Set(_NODEST=)
exten => _9X.,n,Macro(dialout-trunk,1,${EXTEN:1},,off)
exten => _9X.,n,Macro(outisbusy,)

Basically it briefly lets users know they no longer need to dial ‘9’ for an outside line then calls the number they wanted to reach in the first place.

However, I noticed last week that it was also triggering on the very very rare but extant cases of numbers on our local BT exchange which begin with a 9! e.g 939824!

So I’ve modified the outbound route match from


to

and I’ve modified the code to:

[outrt-5] ; Advise about dialling a 9
include => outrt-5-custom
exten => _9XXXXXX,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _9XXXXXX,n,Playback(./custom/prefix-no-longer) ;insert this line to play your message
exten => _9XXXXXX,n,Gosub(sub-record-check,s,1(out,${EXTEN},dontcare))
exten => _9XXXXXX,n,ExecIf($[ "${CALLEE_ACCOUNCODE}" != "" ] ?Set(CDR(accountcode)=$
exten => _9XXXXXX,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _9XXXXXX,n,Set(_NODEST=)
exten => _9XXXXXX,n,Macro(dialout-trunk,1,${EXTEN:1},,off)
exten => _9XXXXXX,n,Macro(outisbusy,)


exten => _9XXXXXXXXXXX,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _9XXXXXXXXXXX,n,Playback(./custom/prefix-no-longer) ;insert this line to play your message
exten => _9XXXXXXXXXXX,n,Gosub(sub-record-check,s,1(out,${EXTEN},dontcare))
exten => _9XXXXXXXXXXX,n,ExecIf($[ "${CALLEE_ACCOUNCODE}" != "" ] ?Set(CDR(accountcode)=$
exten => _9XXXXXXXXXXX,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _9XXXXXXXXXXX,n,Set(_NODEST=)
exten => _9XXXXXXXXXXX,n,Macro(dialout-trunk,1,${EXTEN:1},,off)
exten => _9XXXXXXXXXXX,n,Macro(outisbusy,)

because I want to catch UK local and national numbers, e.g. (9)01234 443113 and (9)443113

does this look right to you guys?! I’m pretty new to this.

Thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.