Analog port routing to another asterisk via IAX trunk

Using asterisk 1.6.2.14, FreePBX 2.7 via AsteriskNOW 1.7.1

I’ve got a 24 port analog board and I want to be able to route a call coming in on it to another asterisk with a specfic callerid set.

I’ve install the Misc Destinations module and have it setup. The problem seems that FreePBX is setting it to “from-trunk” instead of “from-internal” when it writes out the “extensions_additional.conf”.

I’ve x’d out the actual number 800 number being dialed. If I change the last line from “from-trunk” to “from-internal”, it works until I do a change and apply updates and it gets re-written. Anything I can do to fix this?

snippet from “extensions_additional.conf”

[macro-from-zaptel-1]
include => macro-from-zaptel-1-custom
exten => s,1,Noop(Entering macro-from-zaptel-1 with DID = ${DID} and setting to: 8xxxxxxxxx)
exten => s,n,Set(__FROM_DID=8xxxxxxxxx)
exten => s,n,Goto(from-trunk,8xxxxxxxxx,1)

; end of [macro-from-zaptel-1]

Reading thru the “extensions_additional.conf” I saw this “from-zaptel-custom” before the “from-dahdi”. I copied the “from-dahdi” macro to the “extensions_custom.conf” and renamed what I needed to as below.

Now, on to post outbound calling problem…

[from-zaptel]
include => from-zaptel-custom
include => from-dahdi
exten => foo,1,Noop(bar)

; end of [from-zaptel]

;; Originally “from-dahdi” ;;
[from-zaptel-custom]
exten => _X.,1,Set(DID=${EXTEN})
exten => _X.,n,Goto(s,1)
exten => s,1,Noop(Entering from-zaptel-custom with DID == ${DID})
exten => s,n,Ringing()
exten => s,n,Set(DID=${IF($["${DID}"= “”]?s:${DID})})
exten => s,n,Noop(DID is now ${DID})
exten => s,n,GotoIf($["${CHANNEL:0:5}"=“DAHDI”]?dahdiok:checkzap)
exten => s,n(checkzap),GotoIf($["${CHANNEL:0:3}"=“Zap”]?zapok:neither)
exten => s,n(neither),Goto(from-pstn,${DID},1)
exten => s,n,Macro(Hangupcall,dummy)
exten => s,n(dahdiok),Noop(Is a DAHDI Channel)
exten => s,n,Set(CHAN=${CHANNEL:6})
exten => s,n,Set(CHAN=${CUT(CHAN,-,1)})
exten => s,n,Macro(from-dahdi-${CHAN}-custom,${DID},1)
exten => s,n,Noop(Returned from Macro from-dahdi-${CHAN}-custom)
exten => s,n,Goto(from-pstn,${DID},1)
exten => s,n(zapok),Noop(Is a Zaptel Channel)
exten => s,n,Set(CHAN=${CHANNEL:4})
exten => s,n,Set(CHAN=${CUT(CHAN,-,1)})
exten => s,n,Macro(from-dahdi-${CHAN}-custom,${DID},1)
exten => s,n,Noop(Returned from Macro from-dahdi-${CHAN}-custom)
exten => s,n,Goto(from-pstn,${DID},1)

; end of [from-zaptel-custom]

Still doesn’t work. Tried setting the inbound route to both the trunk and the misc destination. It’s the “from-trunk” that’s causing it not to work. If I change it to “from-internal” it works. I tried adding [from-dahdi-1-custom] and [dahdi-1-custom] in the custom and override files. It never calls them.

;;; From extensions_additional.conf
[macro-from-dahdi-1]
include => macro-from-dahdi-1-custom
exten => s,1,Noop(Entering macro1-from-dahdi-1 with DID = ${DID} and setting to: 8xxxxxxxxx)
exten => s,n,Set(__FROM_DID=8xxxxxxxxx)
exten => s,n,Goto(from-trunk,8xxxxxxxxx,1)

; end of [macro-from-dahdi-1]

;;; From extensions_custom.conf
;;;;;;;;;; This macro never gets executed ;;;;;;;;;;;;
[macro-from-dahdi-1-custom]
exten => s,1,Noop(Entering macro-from-dahdi-1-custom with DID = ${DID} and setting to: 8xxxxxxxxx)
exten => s,n,Set(__FROM_DID=8xxxxxxxxx)
exten => s,n,Goto(from-internal,8xxxxxxxxx,1)

; end of [macro-from-dahdi-1-custom]

-- Starting simple switch on 'DAHDI/1-1'
-- Executing [[email protected]:1] NoOp("DAHDI/1-1", "Entering from-dahdi with DID == ") in new stack
-- Executing [[email protected]:2] Ringing("DAHDI/1-1", "") in new stack
-- Executing [[email protected]:3] Set("DAHDI/1-1", "DID=s") in new stack
-- Executing [[email protected]:4] NoOp("DAHDI/1-1", "DID is now s") in new stack
-- Executing [[email protected]:5] GotoIf("DAHDI/1-1", "1?dahdiok:checkzap") in new stack
-- Goto (from-zaptel,s,9)
-- Executing [[email protected]:9] NoOp("DAHDI/1-1", "Is a DAHDI Channel") in new stack
-- Executing [[email protected]:10] Set("DAHDI/1-1", "CHAN=1-1") in new stack
-- Executing [[email protected]:11] Set("DAHDI/1-1", "CHAN=1") in new stack
-- Executing [[email protected]:12] Macro("DAHDI/1-1", "from-dahdi-1,s,1") in new stack
-- Executing [[email protected]:1] NoOp("DAHDI/1-1", "Entering macro-from-dahdi-1 with DID = s and setting to: 8xxxxxxxxx") in new stack
-- Executing [[email protected]:2] Set("DAHDI/1-1", "__FROM_DID=8xxxxxxxxx") in new stack
-- Executing [[email protected]:3] Goto("DAHDI/1-1", "from-trunk,8xxxxxxxxx,1") in new stack
-- Goto (from-trunk,8xxxxxxxxx,1)

== Channel ‘DAHDI/1-1’ jumping out of macro ‘from-dahdi-1’
– Executing [[email protected]:1] Set(“DAHDI/1-1”, “__FROM_DID=8xxxxxxxxx”) in new stack
– Executing [[email protected]:2] NoOp(“DAHDI/1-1”, “Received an unknown call with DID set to 8xxxxxxxxx”) in new stack
– Executing [[email protected]:3] Goto(“DAHDI/1-1”, “s,a2”) in new stack
– Goto (from-trunk,s,2)
– Executing [[email protected]:2] Answer(“DAHDI/1-1”, “”) in new stack
– Executing [[email protected]:3] Wait(“DAHDI/1-1”, “2”) in new stack
– Executing [[email protected]:4] Playback(“DAHDI/1-1”, “ss-noservice”) in new stack
– <DAHDI/1-1> Playing ‘ss-noservice.ulaw’ (language ‘en’)

oops, only saw the last part, not the part about upgrading to 2.8. I’ll give that a try.

Update to FreePBX 2.8, trunks are now destinations of routes.

Only modify files with the “custom” in the file name. Did you see the notes on that in the file?

Tried that too. I copied and pasted all of the [macro-from-zaptel-xx] macros
, replaced from-trunk with from-internal. It still runs the version (with the from-trunk) in the extensions_additional.conf instead of the version (with the from-internal) in extensions_custom.conf.

Is there anyway of telling FreePBX that it should set these up as from-internal?