AMPUSER empty in outbound-cid macro

Hi, I’m using FreePBX 2.7 with Asterisk 1.6.2.6. I got a problem with setting extension’s CID, with empty Outgoing route & Trunk CIDs set.

Here’s what I get:

-- Executing [[email protected]:3] Macro("SIP/XXXX-000000b7", "record-enable,,OUT,") in new stack -- Executing [[email protected]:1] GotoIf("SIP/XXXX-000000b7", "1?check") in new stack -- Goto (macro-record-enable,s,4) -- Executing [[email protected]:4] ExecIf("SIP/XXXX-000000b7", "1?MacroExit()") in new stack -- Executing [[email protected]:4] Macro("SIP/XXXX-000000b7", "dialout-trunk,6,XXXXXXXXX,,") in new stack -- Executing [[email protected]:1] Set("SIP/XXXX-000000b7", "DIAL_TRUNK=6") in new stack -- Executing [[email protected]:2] GosubIf("SIP/XXXX-000000b7", "0?sub-pincheck,s,1") in new stack -- Executing [[email protected]:3] GotoIf("SIP/XXXX-000000b7", "0?disabletrunk,1") in new stack -- Executing [[email protected]:4] Set("SIP/XXXX-000000b7", "DIAL_NUMBER=XXXXXXXXX") in new stack -- Executing [[email protected]:5] Set("SIP/XXXX-000000b7", "DIAL_TRUNK_OPTIONS=tTrwW") in new stack -- Executing [[email protected]:6] Set("SIP/XXXX-000000b7", "OUTBOUND_GROUP=OUT_6") in new stack -- Executing [[email protected]:7] GotoIf("SIP/XXXX-000000b7", "1?nomax") in new stack -- Goto (macro-dialout-trunk,s,9) -- Executing [[email protected]:9] GotoIf("SIP/XXXX-000000b7", "0?skipoutcid") in new stack -- Executing [[email protected]:10] Set("SIP/XXXX-000000b7", "DIAL_TRUNK_OPTIONS=tTwW") in new stack -- Executing [[email protected]:11] Macro("SIP/XXXX-000000b7", "outbound-callerid,6") in new stack -- Executing [[email protected]:1] ExecIf("SIP/XXXX-000000b7", "0?Set(CALLERPRES()=)") in new stack -- Executing [[email protected]:2] ExecIf("SIP/XXXX-000000b7", "1?Set(REALCALLERIDNUM=XXXX)") in new stack -- Executing [[email protected]:3] GotoIf("SIP/XXXX-000000b7", "1?normcid") in new stack -- Goto (macro-outbound-callerid,s,6) -- Executing [[email protected]:6] Set("SIP/XXXX-000000b7", "USEROUTCID=") in new stack -- Executing [[email protected]:7] Set("SIP/XXXX-000000b7", "EMERGENCYCID=") in new stack -- Executing [[email protected]:8] Set("SIP/XXXX-000000b7", "TRUNKOUTCID=") in new stack -- Executing [[email protected]:9] GotoIf("SIP/XXXX-000000b7", "1?trunkcid") in new stack -- Goto (macro-outbound-callerid,s,12) -- Executing [[email protected]:12] ExecIf("SIP/XXXX-000000b7", "0?Set(CALLERID(all)=)") in new stack -- Executing [[email protected]:13] ExecIf("SIP/XXXX-000000b7", "0?Set(CALLERID(all)=)") in new stack -- Executing [[email protected]:14] ExecIf("SIP/XXXX-000000b7", "0?Set(CALLERID(all)=)") in new stack -- Executing [[email protected]:15] ExecIf("SIP/XXXX-000000b7", "0?Set(CALLERPRES()=prohib_passed_screen)") in new stack

So, I checked AstDB and found all necessary entries for AMPUSER/${AMPUSER}/outboundcid

And if I put ${REALCALLERIDNUM} instead of ${AMPUSER} - everything works fine. I have found how ${AMPUSER} is set - its done in macro-user-callerid by issuing:

exten => s,n,Set(AMPUSER=${DB(DEVICE/${REALCALLERIDNUM}/user)})

But that macro is never called in outgoing call. I don’t know if that’s a bug, but I believe it may be. Any ideas?