How to force an extension to use a particualr trunk?

ghurty

Senior Member
Joined
Jan 13, 2009
Messages
852
Reaction score
4
Using pre-dial hook, I am able to force an extension to use a particular trunk.

However, how can I set it that if that trunk is unavailable, it should use a particular different trunk.



Thank you
 
Hi

on a dev box, take a look at FreePBX 2.8, and possibly custom contexts.

Joe
 
Good evening,

I had this problem where we wanted to stear an extension to a speciic trunk / channel that was also mapped back to thier desk as thier "DID". This way if they called someone and "thier" line was open, the other party received there Caller Id and could call back easily.

With philippe's help at one of the classes we worked out a way to do this..

First add an entry to the asterisk database we used PRIVCHANS. So to get Exension 2110 to use Channel 3 first we did ;
CLI> database put PRIVCHANS 1210 3

Then in extensions_custom.conf
[macro-dialout-trunk-predial-hook]
;
; - check if the trunk is a fake trunk we configure
; - if not, just exit (do nothing)
; - if so, lookup in a maintained astdb structure for a specific channel, e.g.
;
; - PRIVCHANS/<exten_num> : <zapchan>
;
; If that channel exists, then try dialing on that specific channel
; in either case, return BYPASS
;
exten => s,1,Set(PREDIAL_HOOK_RET=)
exten => s,n,GotoIf($["${OUT_${DIAL_TRUNK}}" != "AMP:Local/faketrunk"]?continue)
exten => s,n,GotoIf($["${DB(PRIVCHANS/${AMPUSER})}" = ""]?leave)
exten => s,n,Set(OUT_${DIAL_TRUNK}=ZAP/${DB(PRIVCHANS/${AMPUSER})})
exten => s,n,Set(custom=)
exten => s,n(continue),MacroExit()
exten => s,n(leave),Set(PREDIAL_HOOK_RET=BYPASS)

Finally in Out Routes..

We sent the call to first Local/faketrunk and Then to Zap/G0..

Has worked this way for a couple of years with no issues.

Of course your mileage may vary..
 

Members online

No members online now.

Forum statistics

Threads
26,688
Messages
174,412
Members
20,259
Latest member
Fadeek86
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Back
Top