FreePbx Custom Context for internal extensions

Hi everyone

I want extension 1000 to only accept calls from extension 1001. I know this is done with custom context, but since I’m new I don’t know how to do it. I would be grateful if someone could help.

İ tried the following code, but i didn’t work. It says no response and reject

[from-internal-custom]
exten => _9914,1,GotoIf($[“${CALLERID(num)}” = “9911”]?accept:reject)
exten => _9914,n,Hangup()

You haven’t defined either the accept or reject labels.

The problem here is that you want to call 9914 without having from-internal do all the work for you. That means you are going to have to actually call Dial(). Something like this may work:

Assuming the caller ID is correct at this point, and on the understanding that this is untested:

[from-internal-custom]
exten => 9914/9911,1,Noop
exten => 9914,s,Hangup(XXXX)
exten _X.,s,Goto(from-internal,${EXTEN},1)
exten => 9914,n,Dial(PJSIP/$EXTEN})

where XXXX is the most appropriate value taken from https://ftp.sangoma.com/vega/docs/IN_18-Q850_cleardown_cause_codes_10.pdf although leaving it blank will still reject the call. I’ve assumed you are using SIP and up to date on your channel drivers. I’m also assuming that the correct caller ID is set at this point

You could also use ExecIf with a not equals tests and with Hangup(XXXX) after the ?.

1 Like

Thank you very much, it worked

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