Function LOCK and UNLOCK

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

Function LOCK and UNLOCK

Postby ramin » Tue May 29, 2012 2:11 pm

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: Select all
[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: Select all
[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)
ramin
Oldsterisk
 
Posts: 66
Joined: Thu Jun 24, 2010 3:37 am

Re: Function LOCK and UNLOCK

Postby ramin » Wed May 30, 2012 3:12 am

may be function LOCK and UNLOCK disabled
ramin
Oldsterisk
 
Posts: 66
Joined: Thu Jun 24, 2010 3:37 am

Re: Function LOCK and UNLOCK

Postby tomdemoor » Wed May 30, 2012 4:50 am

What do the logfiles say?
tomdemoor
Oldsterisk
 
Posts: 103
Joined: Mon Jan 16, 2012 4:24 am

Re: Function LOCK and UNLOCK

Postby ramin » Wed May 30, 2012 6:50 am

== Spawn extension (from-internal, 123, 2) exited non-zero on 'SIP/1001-00000004'
ramin
Oldsterisk
 
Posts: 66
Joined: Thu Jun 24, 2010 3:37 am

Re: Function LOCK and UNLOCK

Postby david55 » Wed May 30, 2012 7:22 am

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).
david55
Moves Like Spencer
 
Posts: 7739
Joined: Fri Sep 26, 2008 5:03 am

Re: Function LOCK and UNLOCK

Postby ramin » Wed May 30, 2012 12:21 pm

this is my full context
Code: Select all
[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)
ramin
Oldsterisk
 
Posts: 66
Joined: Thu Jun 24, 2010 3:37 am

Re: Function LOCK and UNLOCK

Postby ramin » Wed May 30, 2012 1:17 pm

Maybe i have syntax error
ramin
Oldsterisk
 
Posts: 66
Joined: Thu Jun 24, 2010 3:37 am

Re: Function LOCK and UNLOCK

Postby david55 » Wed May 30, 2012 3:07 pm

ramin wrote:this is my full context


Reading "context" as "dialplan", that is not possible, given the diagnotic message you quoted.
david55
Moves Like Spencer
 
Posts: 7739
Joined: Fri Sep 26, 2008 5:03 am

Re: Function LOCK and UNLOCK

Postby ramin » Wed May 30, 2012 10:19 pm

what do you mean? You want see debug information or what? excuse me i do not understand completely
ramin
Oldsterisk
 
Posts: 66
Joined: Thu Jun 24, 2010 3:37 am

Re: Function LOCK and UNLOCK

Postby david55 » Thu May 31, 2012 12:50 am

ramin wrote:== Spawn extension (from-internal, 123, 2) exited non-zero on 'SIP/1001-00000004'


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.
david55
Moves Like Spencer
 
Posts: 7739
Joined: Fri Sep 26, 2008 5:03 am

Re: Function LOCK and UNLOCK

Postby ramin » Thu May 31, 2012 4:48 am

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

Code: Select all
[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
Code: Select all
-- 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
Code: Select all
-- 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'
ramin
Oldsterisk
 
Posts: 66
Joined: Thu Jun 24, 2010 3:37 am

Re: Function LOCK and UNLOCK

Postby ramin » Sat Jun 02, 2012 3:57 am

it is simple example, i just don't know where is problem.
ramin
Oldsterisk
 
Posts: 66
Joined: Thu Jun 24, 2010 3:37 am

Re: Function LOCK and UNLOCK

Postby ramin » Tue Jun 05, 2012 10:53 pm

Someone do not know what is the problem?
ramin
Oldsterisk
 
Posts: 66
Joined: Thu Jun 24, 2010 3:37 am

Re: Function LOCK and UNLOCK

Postby ramin » Wed Jun 06, 2012 12:17 am

I used the wrong, this is correctly

Code: Select all
[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
ramin
Oldsterisk
 
Posts: 66
Joined: Thu Jun 24, 2010 3:37 am

Re: Function LOCK and UNLOCK

Postby tomdemoor » Wed Jun 06, 2012 1:47 pm

ramin wrote:exten => 123,n(stop),Hungup


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.
tomdemoor
Oldsterisk
 
Posts: 103
Joined: Mon Jan 16, 2012 4:24 am


Return to Asterisk Support

Who is online

Users browsing this forum: No registered users and 16 guests