[asterisk-users] How to use MYSQL(Set timeout x)

F B ffbb80 at rocketmail.com
Fri Sep 3 08:23:29 CDT 2010


I use Asterisk 1.6.2.11 and this is my dialplan:

[test]
     exten => 9999,1,NoOp(${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
exten => 9999,n,Answer()
     exten => 9999,n,NoOp(${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
exten => 9999,n,PlayBack(hello-world)
     exten => 9999,n,NoOp(${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
exten => 9999,n,MYSQL(Set timeout 2)
     exten => 9999,n,NoOp(${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
exten => 9999,n,MYSQL(Connect connid localhost user pass asterisk)
     exten => 9999,n,NoOp(${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
exten => 9999,n,MYSQL(Query resultid ${connid} SELECT SLEEP(10))
     exten => 9999,n,NoOp(${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
exten => 9999,n,MYSQL(Fetch fetchid ${resultid} RESULT)
     exten => 9999,n,NoOp(${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
exten => 9999,n,MYSQL(Clear ${resultid})
     exten => 9999,n,NoOp(${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
exten => 9999,n,MYSQL(Disconnect ${connid})
     exten => 9999,n,NoOp(${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
exten => 9999,n,NoOp(Result: ${RESULT})
     exten => 9999,n,NoOp(${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
exten => 9999,n,Hangup()




When i call to 9999 this is the CLI output:

Connected to Asterisk 1.6.2.11 currently running on Asterisk (pid = 2092)
Verbosity is at least 2147483647
Asterisk*CLI>
  == Using SIP RTP CoS mark 5
    -- Executing [9999 at test:1] NoOp("SIP/test-00000000", "2010-09-03 14:57:35") 
in new stack
    -- Executing [9999 at test:2] Answer("SIP/test-00000000", "") in new stack
    -- Executing [9999 at test:3] NoOp("SIP/test-00000000", "2010-09-03 14:57:35") 
in new stack
    -- Executing [9999 at test:4] Playback("SIP/test-00000000", "hello-world") in 
new stack
    -- <SIP/test-00000000> Playing 'hello-world.gsm' (language 'en')
    -- Executing [9999 at test:5] NoOp("SIP/test-00000000", "2010-09-03 14:57:36") 
in new stack
    -- Executing [9999 at test:6] MYSQL("SIP/test-00000000", "Set timeout 2") in 
new stack
    -- Executing [9999 at test:7] NoOp("SIP/test-00000000", "2010-09-03 14:57:36") 
in new stack
    -- Executing [9999 at test:8] MYSQL("SIP/test-00000000", "Connect connid 
localhost user pass asterisk") in new stack
    -- Executing [9999 at test:9] NoOp("SIP/test-00000000", "2010-09-03 14:57:37") 
in new stack
    -- Executing [9999 at test:10] MYSQL("SIP/test-00000000", "Query resultid 1 
SELECT SLEEP(10)") in new stack
    -- Executing [9999 at test:11] NoOp("SIP/test-00000000", "2010-09-03 14:57:47") 
in new stack
    -- Executing [9999 at test:12] MYSQL("SIP/test-00000000", "Fetch fetchid 2 
RESULT") in new stack
    -- Executing [9999 at test:13] NoOp("SIP/test-00000000", "2010-09-03 14:57:47") 
in new stack
    -- Executing [9999 at test:14] MYSQL("SIP/test-00000000", "Clear 2") in new 
stack
    -- Executing [9999 at test:15] NoOp("SIP/test-00000000", "2010-09-03 14:57:47") 
in new stack
    -- Executing [9999 at test:16] MYSQL("SIP/test-00000000", "Disconnect 1") in 
new stack
    -- Executing [9999 at test:17] NoOp("SIP/test-00000000", "2010-09-03 14:57:47") 
in new stack
    -- Executing [9999 at test:18] NoOp("SIP/test-00000000", "Result: 0") in new 
stack
    -- Executing [9999 at test:19] NoOp("SIP/test-00000000", "2010-09-03 14:57:47") 
in new stack
    -- Executing [9999 at test:20] Hangup("SIP/test-00000000", "") in new stack
  == Spawn extension (test, 9999, 20) exited non-zero on 'SIP/test-00000000'
Asterisk*CLI>



According to "Asterisk*CLI> core show application MYSQL":
  MYSQL(Set timeout <num>)
    Set the connection timeout, in seconds.



As you see the "SELECT SLEEP(10)" query took 10 seconds and the MySQL timeout 
was set to 2 seconds.
I think the timeout should have ended the execution of the query.
Does anyone know why it didn't?



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100903/a9e9ec0a/attachment.htm 


More information about the asterisk-users mailing list