How to use lock/unlock in dialplan asterisk 13?


#1

Please explain me how to use lock/unlock in asterisk dialplan (extension.conf)?
Proof-link function LOCK/UNCLOCK: https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_LOCK
Example of using: Function LOCK and UNLOCK
Thanks.


#2

What is “lock/unlock”? What do you mean by that?


#3

I have a dialplan.
I want to lock some calls, where exists a call a agi script and unlock their after leave section.

e.g.:

exten => _X!,2,Set(CALLERID(ANI-all)=${HIDDENNUMB})
exten => _X!,3,Set(CHANNUM=${CHANNEL(dahdi_channel)})
exten => _X!,4,LOCK(mtx)
exten => _X!,5,AGI(agi-script.sh)
exten => _X!,6,UNLOCK(mtx)
exten => _X!,7,Dial(DAHDI/$[${CHANNUM}]/${EXTEN},60)

But in runtime when ran command, asterisk wrote me:

CLI> pbx_extension_helper: No application ‘LOCK’ for extension

BTW module func_lock.so is loaded.

> CLI> module show like lock
func_lock.so  Dialplan mutexes Running core
1 module loaded

What I did wrong?


#4

never used it, but if it’s a function, it should be something like
exten => _X!,n,Set(MyVar=${LOCK(mtx)})

You are using the syntax for an application
core show function LOCK
should work also