[outbound-allroutes-custom] hook

Hi, all

I’m implimenting outbound direct SIP/URI dialling.
This is fairly straightforward, there are plenty of guides on the interweb.
example: http://www.blyon.com/sip_uri/
They all follow roughly the same methodolgy.

-set ‘srvlookup = yes’ in sip.conf;
-Create a [macro-uridial];
-Create a [outrt-uri] which will match URI patterns and call the macro.

I’m trying to impliment it in a freePBX-friendly manner, using the custom hooks thoughtfully provided at the beginning of every freePBX-generated context. In this way, freePBX won’t stamp all over my custom [outrt-uri] inclusion.

My problem is this…
The sensible place to include [outrt-uri] is at the end of [outbound-allroutes]
But the custom hook is at the start of [outbound-allroutes].

Why do I want it at the end?
Because [outrt-uri] contains a bit of a catch-all, and it would catch stuff intended for the other routes…

[outrt-uri]
exten => _[a-z].,1,Macro(uridial,${EXTEN}@${SIPDOMAIN})
exten => _[A-Z].,1,Macro(uridial,${EXTEN}@${SIPDOMAIN})
exten => _X.,1,Macro(uridial,${EXTEN}@${SIPDOMAIN})

First line to match lower-case, eg [email protected]
Second line to match uppercase, eg [email protected]
Third line to catch numeric extensions, eg [email protected]

There are several possible solutions.
I could check for the other defined routes again at the start of [outbound-allroutes-custom] before I include [outrt-uri], and goto them .
I could re-include all the existing routes again at the start of [outbound-allroutes-custom] before I include [outrt-uri].
Both of these are ugly hacks.

A cleaner way would be for freePBX to recognise that users may well want to impliment outbound SIP/URI, and have a further custom hook at the end of [outbound-allroutes]: “include => outrt-uri”. The [outrt-uri] need not be implimented by yourselves. You could leave it as an exercise for the reader to impliment it in extensions_custom.conf.

Any thoughts on this?


Ron