in asterisk

Change in syntax and functionality in Asterisk AstDB functions

Since Asterisk 1.2+, the methods to access the AstDB database (a berkeley local database) were changed from DBGet,DBPut,DBDel to the merged “simpler” one named Set (except for DbDel which seems to still exist). There was a functionnality that when a key was not found in AstDB, a jump would be done to n+101. So the following would be OK:

exten = s,1,Set(forward_number=${DB(FORWARD/1234)})
exten = s,2,Background(one_local/forward/forward_number_is)
exten = s,3,sayalpha(${forward_number})
exten = s,4,Goto(s-report_mode,1)
exten = s,102,NoOp(Pas de valeur ce qui est normal)
exten = s,103,Goto(s-not_set,1)

But with my newly installed Asterisk 1.4.4, it doesn’t jump anymore. It continues to s,2 :-(.
So I guess I need to add a supplementary line to explicitely test the presence of the key:

exten = s,1,GotoIf(${DB_EXISTS(FORWARD/${F_EXT})}?:102)
exten = s,2,Set(forward_number=${DB_RESULT})
exten = s,3,Background(one_local/forward/forward_number_is)
exten = s,4,sayalpha(${forward_number})

exten = s,102,NoOp(Pas de valeur ce qui est normal)

FacebooktwitterredditpinterestlinkedinmailNo tags for this post.

Write a Comment