FreePBX as a Proxy

Hi there
i know if i do not use context Freepbx automatically create a from-trunk-sip-TRUNKNAME context
that gives posibbility to get a calls from trunk using INBOUND RULES and direct calls if destination EXTEN exist.
But my question is thee any context that will give posibbility to
-get a call based on INBOUND routes
-if EXTEN exist get a direct call
-if there are no INBOUND routes use OUTBOUND routes and call outside

No you would have to create this context yourself.

You can start from here:

exten => _X.,1,Set(RDID=${SIP_HEADER(TO)})
same => n,Set(CALLERID(name)=${CALLERID(number)})
same => n,Set(CALLERID(number)=0${CALLERID(number)})
same => n,Set(RDID=${CUT(RDID,:,2)})
same => n,Set(RDID=${CUT(RDID,@,1)})
same => n,Set(RDIDLEN=${LEN(${RDID})})
same => n,GotoIf($[${RDIDLEN} < 10]?from-pstn,${RDID},1)
same => n,Set(INTERNO=${RDID:-3})
same => n,Set(CHECKINTERNO=${DIALPLAN_EXISTS(ext-local,${INTERNO},1)}) ; check if ext exists
same => n,GotoIf($["${CHECKINTERNO}" = “1”]?from-internal,${INTERNO},1:from-pstn,${RDID},1) ; if exists go to the extension else to from-pstn context

OH i see i need function DIALPLAN_EXISTS

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