-----Original Message-----
From: asterisk-users-boun...@lists.digium.com 
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Edwards
Sent: Wednesday, August 20, 2014 9:01 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Dispatching calls question

>On Wed, 20 Aug 2014, Jerry Geis wrote:
>
>> I have a question about dispatching calls...
>> If I try to dispatch a call on line 1 using the AMI
>> and I check in my table to see if line 1 is available and it is....
>> So I have done my checking now I dispatch my call 
>> and at that same time a call comes in on line 1 and now its no longer 
>> available 
>> for me to make a call, I connect on AMI and my call fails....
>> 
>> How do I prevent this from happening? Sure I can start at 23 instead of 1 
>> and work down
>> instead of up  but eventually the same thing may happen.
>
>If you're using something like MySQL, use 'get_lock/release_lock.'
>
>If you're using some other database, see what locking features you have 
>available.

Asterisk 1.8 and later have lock functions available in the dialplan.   This 
might be better if you have a single Asterisk server.

pbx*CLI> core show functions like LOCK
Matching Custom Functions:
--------------------------------------------------------------------------------
LOCK                  LOCK(lockname)                       Attempt to obtain a 
named mutex.
TRYLOCK               TRYLOCK(lockname)                    Attempt to obtain a 
named mutex.
UNLOCK                UNLOCK(lockname)                     Unlocks a named 
mutex.
3 matching custom functions installed.


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

Reply via email to