Re: [asterisk-users] outbound SIP trunk hunting (or any fxo for that matter)

2010-08-27 Thread Philipp von Klitzing
Hi!

 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?
 
 What would be a correct way to do this in 1.4.x?

*CLI show application MacroExclusive

Philipp


-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

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


Re: [asterisk-users] outbound SIP trunk hunting (or any fxo for that matter)

2010-08-23 Thread Motiejus Jakštys
On Mon, Aug 23, 2010 at 5:06 PM, Infra m...@waste.org wrote:

 On Aug 7, 2007 'Mojo' wrote:

 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

 What would be a correct way to do this in 1.4.x?

I suppose AGI is synchronous, you can implement the dialplan locking in AGI.
AGI(lock.pl)
do your GROUP() things
AGI(unlock.pl)
To make the locking atomic you may use posix semaphores. Look for APIs
in Perl, C, Python...

Motiejus

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

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