[asterisk-users] Variable Scope Question
Tilghman Lesher
tilghman at mail.jeffandtilghman.com
Thu Nov 6 11:27:23 CST 2008
On Thursday 06 November 2008 10:12:11 Brent Davidson wrote:
> If I have a global variable in my dialplan and I change it, does that
> change immediately take affect for all calls that are active?
>
> Here is my situation. The company I work for has two office groups that
> share a building. The two offices are separate companies but support
> one another and want to be able to transfer calls as if they were all on
> the same phone system. Each company has 4 incoming voice lines and
> calls on those lines should be sent to the appropriate main menu.
>
> As it stands I have a context called internal that defines all of the
> internal extensions for both offices then I have two virtually operator
> contexts, two virtually identical mainmenu contexts and two virtually
> identical admin contexts that allow them to record the appropriate
> mainmenu greetings.
>
> What I'd like to do would be to consolidate the mainmenu and operator
> contexts and create a CompanyA and CompanyB context that sets a variable
> for the appropriate company then jumps into the mainmenu or operator
> context carrying that value so the correct greetings are played and the
> correct operator extension is used. The variable would need to be one
> that only affects the current call and no others since there is the
> potential to have 4 calls coming in to each office at the same time.
>
> Any ideas on the best way to handle this?
[companyA]
exten => _X.,1,Set(company=A)
exten => _X.,n,Goto(maincontext,${EXTEN},1)
[companyB]
exten => _X.,1,Set(company=B)
exten => _X.,n,Goto(maincontext,${EXTEN},1)
--
Tilghman
More information about the asterisk-users
mailing list