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? Thanks, Brent
On Thu, Nov 6, 2008 at 6:12 PM, Brent Davidson <brent at texascountrytitle.com> 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?Hello, there is not a definite best way, however variable approach sounds ok. All you need is "channel variable" as opposed to global variable. Whenever call starts (internal or external), you can match mask of DID or CallerID (for internal extensions) and just execute Set(__company=A). Two underscores means that this variable will be inherited in every child channel, so wherever the call will go (within Asterisk of course) you will have variable ${company} For more information please see http://www.voip-info.org/wiki-Asterisk+variables Regards, Atis -- Atis Lezdins, VoIP Project Manager / Developer, atis at iq-labs.net Skype: atis.lezdins Cell Phone: +371 28806004 Cell Phone: +1 800 7300689 Work phone: +1 800 7502835
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