[asterisk-users] Timeout func ignored if inside a macro and when Dial cmd has limit (L). Bug ?

mancyborg at gmail.com mancyborg at gmail.com
Tue Aug 25 22:07:36 CDT 2009


Hi All,

suppose this:

Dial(SIP/<somecarrier>/<somenumber>/60/L(3600000)M(td|${EPOCH})

where 60 is the seconds to wait for the callee (the called party) to answer

L(3600000) is the absolute limit of the call once it has been answered, in ms

M(td|${EPOCH}) is the macro to execute when the call gets answered. ${EPOCH} contains the current unixtime.

That's the macro:

[macro-td]
exten => s,1,Set(myDiff=${MATH(${EPOCH}-${ARG1},i)})
exten => s,n,NoOp(${myDiff})
exten => s,n,GotoIf($[${myDiff} < 4]?hu:he)
exten => s,n(hu),Set(TIMEOUT(absolute)=6)
exten => s,n(he),NoOp(${myDiff})

where:
exten => s,1,Set(myDiff=${MATH(${EPOCH}-${ARG1},i)})
sets the variable 'myDiff' to the difference, in seconds, between the start of the call and when it was answered.

exten => s,n,NoOp(${myDiff})
prints the variable 'myDiff'

exten => s,n,GotoIf($[${myDiff} < 4]?hu:he)
will invoke the 4th line of the macro if the call was answered in less than 4 seconds
else it will invoke the 5th line of the macro

exten => s,n(hu),Set(TIMEOUT(absolute)=6)
should set the absolute timeout of the call from 'now' to 6 seconds

exten => s,n(he),NoOp(${myDiff})
just prints again the 'myDiff'

Problem:
the Set(TIMEOUT(absolute)=6) function gets triggered if the call has been answered in less than 4 seconds,
the Asterisk console reports the correct hangup time prediction with a message like:
"Channel will hangup at " ...
but the call doesn't hangup.

If the L (limit) modifier of the Dial cmd is not used, the call hangups correctly.

Asterisk version: 1.4.26


Thanks for supporting,
have a nice day.
Mancy



More information about the asterisk-users mailing list