Inbound Calls Not Call-Forwarding Correctly

I’m using Thirdlane PBXManager (Multi-tenant version), and wondered if anyone might be able to help me solve a problem with call forwarding. For some reason inbound calls are not seeing my call forward settings for extensions.

Here’s a test scenario.

  1. I have an inbound route for DID xxxxxxxxxx set to go to extension 100 using script tl-stdexten
    [from-outside-xxxxxxxxxx-tl-allhours-env]
    exten => s,1,Set(tenant=env)
    exten => s,2,SetAMAFlags(billing)
    exten => s,3,Set(CDR(userfield)=env)
    exten => s,4,Set(MOH=${DB(TL/MOH/default${TL_DASH}${tenant})})
    exten => s,n,GotoIf($["${MOH}" = “”]?nomoh)
    exten => s,n,SetMusicOnHold(${MOH})
    exten => s,n(nomoh),Macro(tl-stdexten,SIP/100-env,100@default-env,)

  2. Extension 100 is forwarded to extension 110
    voice*CLI> database show TL/env-100
    /TL/env-100/CFA : 1
    /TL/env-100/CFAN : 110
    /TL/env-100/CFB : 0
    /TL/env-100/CFNA : 0
    /TL/env-100/CFNAEXT : 0
    /TL/env-100/CFNASTRAT : 0
    /TL/env-100/CFNAT0 : 30
    /TL/env-100/CFNAT1 : 20
    /TL/env-100/CFNAT2 : 20
    /TL/env-100/CFNAT3 : 20
    /TL/env-100/CFNAT5 : 20
    /TL/env-100/CFNATALL : 20
    /TL/env-100/RECORD :
    /TL/env-100/VM : 1
    /TL/env-100/VMT0 : 30
    /TL/env-100/callerid :
    /TL/env-100/calleridname :

  3. If I call extension 100 from another inside extension (ie, 101) I am forwarded to extension 110.
    – Executing [s@macro-tl-userexten-base:122] GotoIf(“SIP/101-env-b7d1a980”, “1?forwarding”) in new stack
    – Goto (macro-tl-userexten-base,s,124)
    – Executing [s@macro-tl-userexten-base:124] Set(“SIP/101-env-b7d1a980”, “FORWARD=1”) in new stack
    – Executing [s@macro-tl-userexten-base:125] GotoIf(“SIP/101-env-b7d1a980”, “0?notforwarded”) in new stack
    – Executing [s@macro-tl-userexten-base:126] Set(“SIP/101-env-b7d1a980”, “FORWARD_NUM=110”) in new stack
    – Executing [s@macro-tl-userexten-base:127] GotoIf(“SIP/101-env-b7d1a980”, “0?notforwarded”) in new stack
    – Executing [s@macro-tl-userexten-base:128] Dial(“SIP/101-env-b7d1a980”, “Local/110@from-inside-env|30|rtT”) in new stack
    – Called 110@from-inside-env
    – Executing [110@from-inside-env:1] Macro(“Local/110@from-inside-env-0a78,2”, “tl-set-variables2|from-inside-redir-env|env”) in new stack
    – Executing [s@macro-tl-set-variables2:1] Set(“Local/110@from-inside-env-0a78,2”, “tenant=env”) in new stack
    – Executing [s@macro-tl-set-variables2:2] Set(“Local/110@from-inside-env-0a78,2”, “CDR(userfield)=env”) in new stack
    – Executing [s@macro-tl-set-variables2:3] Set(“Local/110@from-inside-env-0a78,2”, “MOH=default-env”) in new stack
    – Executing [s@macro-tl-set-variables2:4] GotoIf(“Local/110@from-inside-env-0a78,2”, “1 ?setmoh”) in new stack
    …I deleted a number of lines here…
    – Called 110-env
    – Local/110@from-inside-env-0a78,1 is ringing
    – SIP/110-env-09fc7430 is ringing

  4. If I call the DID xxxxxxxxxx I am not forwarded to 110.
    – Executing [s@macro-tl-userexten-base:122] GotoIf(“SIP/dozment-b7d1c4f0”, “1?forwarding”) in new stack
    – Goto (macro-tl-userexten-base,s,124)
    – Executing [s@macro-tl-userexten-base:124] Set(“SIP/dozment-b7d1c4f0”, “FORWARD=”) in new stack
    – Executing [s@macro-tl-userexten-base:125] GotoIf(“SIP/dozment-b7d1c4f0”, “1?notforwarded”) in new stack
    – Goto (macro-tl-userexten-base,s,130)
    – Executing [s@macro-tl-userexten-base:130] Set(“SIP/dozment-b7d1c4f0”, “FORWARD=”) in new stack
    – Executing [s@macro-tl-userexten-base:131] GotoIf(“SIP/dozment-b7d1c4f0”, “0?s-NA|1”) in new stack
    – Executing [s@macro-tl-userexten-base:132] GotoIf(“SIP/dozment-b7d1c4f0”, “1?dial”) in new stack
    – Goto (macro-tl-userexten-base,s,136)
    – Executing [s@macro-tl-userexten-base:136] Dial(“SIP/dozment-b7d1c4f0”, “SIP/100-env|30|rtT”) in new stack
    – Called 100-env
    – SIP/100-env-09ffa370 is ringing

It looks like the FORWARDED variable isn’t being set when the call comes in from the outside, but I can’t figure out where it should be set.

Any ideas?