Re: [asterisk-users] Variable Scope Question

2008-11-06 Thread Atis Lezdins
On Thu, Nov 6, 2008 at 6:12 PM, Brent Davidson
[EMAIL PROTECTED] 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,
[EMAIL PROTECTED]
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Variable Scope Question

2008-11-06 Thread Tilghman Lesher
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

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Variable Scope Question

2008-11-06 Thread Brent Davidson
Tilghman Lesher wrote:
 [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)

   
I should probably also mention that I am using AEL for my dialplan.  
(i'm a programmer and the AEL syntax feels more natural to me) .  Does 
the Set command work the same way in AEL as it does in the regular 
.conf file?

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Variable Scope Question

2008-11-06 Thread Tilghman Lesher
On Thursday 06 November 2008 11:41:08 Brent Davidson wrote:
 Tilghman Lesher wrote:
  [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)

 I should probably also mention that I am using AEL for my dialplan.
 (i'm a programmer and the AEL syntax feels more natural to me) .  Does
 the Set command work the same way in AEL as it does in the regular
 .conf file?

AFAIK, yes, it does.

-- 
Tilghman

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users