I'm having a little problem to update the database after a call was
placed. I have several PSTN lines and I need to split the calls between
them.
The approach I used didn't work:
[sipphone]
include => trunktest
; other rules here blah blah blah
[trunktest]
exten => _1800NXXXXXX,1,DBget(LAST=lastused/trunk)
exten => _1800NXXXXXX,2,GotoIf($[${LAST} = 1]?20:3)
exten => _1800NXXXXXX,3,GotoIf($[${LAST} = 2]?30:4)
exten => _1800NXXXXXX,4,GotoIf($[${LAST} = 3]?40:10)
;
exten => _1800NXXXXXX,10,Set(used=1)
exten => _1800NXXXXXX,11,Dial(${TRK1}/${EXTEN})
exten => _1800NXXXXXX,12,DBput(lastused/trunk=1)
exten => _1800NXXXXXX,13,Hangup
;
exten => _1800NXXXXXX,20,Set(used=2)
exten => _1800NXXXXXX,21,Dial(${TRK2}/${EXTEN})
exten => _1800NXXXXXX,22,DBput(lastused/trunk=2)
exten => _1800NXXXXXX,23,Hangup
[........]
; I also tried
exten => h,1,Set(DB(lastused/trunk)=${used})
exten => h,2,Hangup
Any idea?