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