[asterisk-users] Macro Overlap

2007-08-07 Thread Nicholas Blasgen
I've got 4 SIP phone lines with a call-limit of 2 for each.  I've written a
handy macro to allow my users to dial a phone number and the macro will
figure out the next available line to use by first checking if the GROUP()
is over 2 and then checking to see if ChanIsAvail() as a backup, and if it
can't use the line for either reason it goes to the next line.  The problem
is that there are enough situations that the Macro gets called twice without
much time seperation.  Both macros check the group() number, it comes back
as free, they check the line availability and it's open, and they try
dialing.  But because they both started at more or less the same instant,
they've both at the same stage in the macro and sometimes (maybe 10% of the
time) a macro will try dialing on a line that's already in use.

My question is this.  Is it possible to tell Asterisk to execute part of a
macro as a block without allowing any other commands to be processed during
that time?  Some way to LOCK the dialplan (as you'd do in SQL).  I want my
macro to be able to execute the part of the code that checks line status and
then sets the GROUP() without allowing any other dialplans from running
during that time.  Anyone know if this is a current feature?

-- 
/Nick
___
--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] Macro Overlap

2007-08-07 Thread Jared Smith
On Tue, 2007-08-07 at 11:13 -0700, Nicholas Blasgen wrote:
> My question is this.  Is it possible to tell Asterisk to execute part
> of a macro as a block without allowing any other commands to be
> processed during that time?  

You'll want to check out the MacroExclusive() application.  It does
exactly what you're looking for.  If I remember correctly, it's new in
Asterisk 1.4.


-- 
Jared Smith
Community Relations Manager
Digium, Inc.


___
--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] Macro Overlap

2007-08-07 Thread Mojo with Horan & Company, LLC
set your own mutex using astdb?  It may just be atomic enough for you to 
get by.

Nicholas Blasgen wrote:
> I've got 4 SIP phone lines with a call-limit of 2 for each.  I've 
> written a handy macro to allow my users to dial a phone number and the 
> macro will figure out the next available line to use by first checking 
> if the GROUP() is over 2 and then checking to see if ChanIsAvail() as a 
> backup, and if it can't use the line for either reason it goes to the 
> next line.  The problem is that there are enough situations that the 
> Macro gets called twice without much time seperation.  Both macros check 
> the group() number, it comes back as free, they check the line 
> availability and it's open, and they try dialing.  But because they both 
> started at more or less the same instant, they've both at the same stage 
> in the macro and sometimes (maybe 10% of the time) a macro will try 
> dialing on a line that's already in use.
>  
> My question is this.  Is it possible to tell Asterisk to execute part of 
> a macro as a block without allowing any other commands to be processed 
> during that time?  Some way to LOCK the dialplan (as you'd do in SQL).  
> I want my macro to be able to execute the part of the code that checks 
> line status and then sets the GROUP() without allowing any other 
> dialplans from running during that time.  Anyone know if this is a 
> current feature?
> 
> -- 
> /Nick
> 
> 
> 
> 
> ___
> --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

___
--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] Macro Overlap

2007-08-07 Thread Nicholas Blasgen
I'm going to try it out, but I'm not very hopefull although it's exactly
what's needed.  My macro contains a Dial() command and my concern is that
the dialplan isn't considered done untill Dial() returns.  But I'm going to
try it.  Will report back shortly.

On 8/7/07, Jared Smith <[EMAIL PROTECTED]> wrote:
>
> On Tue, 2007-08-07 at 11:13 -0700, Nicholas Blasgen wrote:
> > My question is this.  Is it possible to tell Asterisk to execute part
> > of a macro as a block without allowing any other commands to be
> > processed during that time?
>
> You'll want to check out the MacroExclusive() application.  It does
> exactly what you're looking for.  If I remember correctly, it's new in
> Asterisk 1.4.
>
___
--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] Macro Overlap

2007-08-09 Thread Philipp Kempgen
Mojo with Horan & Company, LLC wrote:

> set your own mutex using astdb?  It may just be atomic enough for you to 
> get by.

"atomic enough" - that's a nice term :-)


Regards,
  Philipp Kempgen

-- 
amooma GmbH - Bachstr. 126 - 56566 Neuwied - http://www.amooma.de
Let's use IT to solve problems and not to create new ones.
  Asterisk? -> http://www.das-asterisk-buch.de
  My pick of the month: rfc 2822 3.6.5

Geschäftsführer: Stefan Wintermeyer
Handelsregister: Neuwied B 14998

___
--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] Macro Overlap

2007-08-14 Thread Mojo with Horan & Company, LLC
yeah, 'enough' adds back the gray area that the black-and-white 'atomic' 
obscures...   :P

Moj

Philipp Kempgen wrote:
> Mojo with Horan & Company, LLC wrote:
> 
>> set your own mutex using astdb?  It may just be atomic enough for you to 
>> get by.
> 
> "atomic enough" - that's a nice term :-)
> 
> 
> Regards,
>   Philipp Kempgen
> 

___
--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