Help with custom extension to change the context, can anyone help?

I have custom contexts installed and now I need to dial ext 9112 and switch the sip context to deny outside calls, and its counterpart being ext 9111 with allows outside calls

It is item#3 I cannot seem to figure out the correct syntax / command structure

exten => 9112,1,Answer()
exten => 9112,2,Authenticate(2158) ;get the password 2158
exten => 9112,3,Set(DB(SIP/${CALLERID(number)/context)=outrt-001-Dummy) ; now change context to prevent anything but internal ext calls
exten => 9112,4,System(/usr/sbin/asterisk -rx “module reload”) ;refresh all settings
exten => 9112,5,Playback(goodbye)
exten => 9112,6,Hangup

exten => 9111,1,Answer()
exten => 9111,2,Authenticate(2158) ;get the password 2158
exten => 9111,3,Set(DB(SIP/${CALLERID(number)/context)=outrt-002-AllowLD) ; now change context to prevent anything but internal ext calls
exten => 9112,4,System(/usr/sbin/asterisk -rx “module reload”) ;refresh all settings
exten => 9111,5,Playback(goodbye)
exten => 9111,6,Hangup

The best place to get a understanding of dialplans is by reading a book on asterisk as that is what FreePBX is running on. (see chapter 5)

Try this
Asterisk: The Future of Telephony 2nd Edition (ISBN 0-596-51048-9) — Order yours at http://www.oreilly.com/catalog/9780596510480/ — Downloadable PDF http://downloads.oreilly.com/books/9780596510480.pdf

While I will not dispute this pointing me to going and buying a book and
in a couple weeks or so, would be an ultimate solution… however

It seemed to me the very purpose of a forum is to ask other users and hopefully
others with an understanding of these things to offer their input. I guess my concept
of a help forum was terribly misguided.

You can download the book inPDF form for free.

No it is not but as you have stated "“I cannot seem to figure out the correct syntax / command structure” you have a scripting problem which is outside of the scope of FreePBX as it’s purpose is to do the scripting of the dialplan for you. To start scripting you need to understand how dialplans work and somebasic scripting guidelines and those commands. The ultimate best source for scripting is that book as it explains all of the commands, how they work and how to assemble them. Knowledge is power.

The point with FreePBX is to be able to do it without the end admin needing to do scripting if possible, if the user needs to the door for scripting is always open to do it. Yes you seem to have a specific case where it looks like you need to do something via scripting (I thought the custom context mod did this without scripting but I don’t use that mod to be sure).

since you said “I cannot seem to figure out the correct syntax / command structure”, and this is not a Asterisk Scripting site, I thought I provided you with good information so that you could look it up reasonably quickly. Down to the chapter to start looking at.