Function LOCK and UNLOCK

Hi. I use Asterisk 1.6.2.23. This is my simple IVR dialplan. WHen i try with function LOCK and UNLOCK IVR does not work, but when i try without LOCk and UNLOCK IVR work perfect. What is the problem?

[code][menu-level1-press1]
exten => s,1,Background(ivr/menu_1_az)
exten => s,2,WaitExten(3)

exten => 1,1,Goto(menu-level2,1,1)
exten => 2,1,Goto(menu-level2,2,1)
exten => 3,1,Goto(menu-level2,3,1)

exten => 4,1,SetMusicOnHold(u_moh)
exten => 4,n,LOCK(testlock)
exten => 4,n,Set(fileName=/var/ftp/wav/monitor/az/${STRFTIME(${EPOCH},%Y_%m_%d-%H:%M:%S)}_${PREFIX}.wav)
exten => 4,n,Set(GLOBAL(PREFIX)=$[${PREFIX} + 1])
exten => 4,n,UNLOCK(testlock)
exten => 4,n,MixMonitor(${fileName},b)
exten => 4,n,Dial(SIP/1001,60,m)[/code]

[code][menu-level1-press1]
exten => s,1,Background(ivr/menu_1_az)
exten => s,2,WaitExten(3)

exten => 1,1,Goto(menu-level2,1,1)
exten => 2,1,Goto(menu-level2,2,1)
exten => 3,1,Goto(menu-level2,3,1)

exten => 4,1,SetMusicOnHold(u_moh)
;exten => 4,n,LOCK(testlock)
exten => 4,n,Set(fileName=/var/ftp/wav/monitor/az/${STRFTIME(${EPOCH},%Y_%m_%d-%H:%M:%S)}_${PREFIX}.wav)
exten => 4,n,Set(GLOBAL(PREFIX)=$[${PREFIX} + 1])
;exten => 4,n,UNLOCK(testlock)
exten => 4,n,MixMonitor(${fileName},b)
exten => 4,n,Dial(SIP/1001,60,m)[/code]

may be function LOCK and UNLOCK disabled

What do the logfiles say?

== Spawn extension (from-internal, 123, 2) exited non-zero on ‘SIP/1001-00000004’

Please provide the contents of the from-internal context.

The last step executed was not in the context you provided and involved an extension that is not in that context, either.

Exited non-zero normally means that the one of the parties hung up.

Also, traces with verbosity less than about 3 tend to be of limited use (as are ones with only the last message).

this is my full context

[code][default]
exten => s,1,Answer()
exten => s,2,Background(ivr/menu_0)
exten => s,3,WaitExten(3)

exten => 1,1,Goto(menu-level1-press1,s,1)
exten => 2,1,Goto(menu-level1-press2,s,1)
exten => 3,1,Goto(menu-level1-press3,s,1)

[menu-level1-press1]
exten => s,1,Background(ivr/menu_1_az)
exten => s,2,WaitExten(3)

exten => 1,1,Goto(menu-level2,1,1)
exten => 2,1,Goto(menu-level2,2,1)
exten => 3,1,Goto(menu-level2,3,1)

exten => 4,1,SetMusicOnHold(u_moh)
exten => 4,n,LOCK(testlock)
exten => 4,n,Set(fileName=/var/ftp/wav/monitor/az/${STRFTIME(${EPOCH},%Y_%m_%d-%H:%M:%S)}_${PREFIX}.wav)
exten => 4,n,Set(GLOBAL(PREFIX)=$[${PREFIX} + 1])
exten => 4,n,UNLOCK(testlock)
exten => 4,n,MixMonitor(${fileName},b)
exten => 4,n,Dial(SIP/1001,60,m)
[/code]

Maybe i have syntax error

[quote=“ramin”]this is my full context
[/quote]

Reading “context” as “dialplan”, that is not possible, given the diagnotic message you quoted.

what do you mean? You want see debug information or what? excuse me i do not understand completely

To be able to see what is going on, you need to provide the part of hte dial plan that includes the highlighted context and matches the highlighted extension number. These obviously exist, as those values wouldn’t appear in the message, otherwise.

i think problem with recognizing function LOCK and UNLOCK. Because when i try simple dialplan where use function LOCK dialplan does not work but where do not use work fine

[from-internal] exten => 123,1,Background(marryme) exten => 123,n,LOCK() exten => 123,n,Playback(ss-noservice) exten => 123,n,UNLOCK() exten => 123,n,Hungup

Thsi is my debug information with LOCK and without using LOCK
-with LOCK

-- Executing [123@from-internal:1] BackGround("SIP/1001-00000000", "marryme") in new stack -- <SIP/1001-00000000> Playing 'marryme.ulaw' (language 'en') == Spawn extension (from-internal, 123, 2) exited non-zero on 'SIP/1001-00000000'

-without LOCK

-- Executing [123@from-internal:1] BackGround("SIP/1001-00000001", "marryme") in new stack -- <SIP/1001-00000001> Playing 'marryme.ulaw' (language 'en') -- Executing [123@from-internal:2] Playback("SIP/1001-00000001", "ss-noservice") in new stack -- <SIP/1001-00000001> Playing 'ss-noservice.gsm' (language 'en') == Spawn extension (from-internal, 123, 3) exited non-zero on 'SIP/1001-00000001'

it is simple example, i just don’t know where is problem.

Someone do not know what is the problem?

I used the wrong, this is correctly

[from-internal] exten => 123,1,Background(marryme) exten => 123,n,GotoIf(LOCK(mutex_lock) = 1?continue:stop) exten => 123,n(continue),Playback(ss-noservice) exten => 123,n(stop),Hungup

[quote=“ramin”]
exten => 123,n(stop),Hungup[/quote]

Should be Hangup() instead of Hungup()

For easier debugging I would add some NoOp lines. Maybe now you just went to Stop and got an error there because of the typo.