FreePBX as a Proxy

Tags: #<Tag:0x00007f24c3d24648>

(Anton Satskiy) #1

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

(Lorne Gaetz) #2

No you would have to create this context yourself.

(Peter Fox) #3

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

(Anton Satskiy) #4

OH i see i need function DIALPLAN_EXISTS