Help with Trunk config

Hello Guys I been using this forum for quite a while to fix previous issues with PBX and asterisk. I finally decided to post this thread because after weeks of looking around I figured I got nothing to lose.
The situation is we have incoming and outgoing calls on our local server and on our remote server we only have incoming and internal calls. The remote server is running FreePBX 2.6.0.6.
I included the configs and the CLI output when a call is attempted to an extension on the local server. This two servers are not in the same place and have the public IP as host.
If anything else is needed please let me know hope you guys can help.

Local:
[pbx002-LdEm]
host=1.1.1.1
username=pbx001-EpLA
secret=secret1
type=peer
qualify=yes
auth=md5
nat=no
context=from-trunk-iax2-pbx001-EpLA

[pbx002-LdEm]
host=1.1.1.1
username=pbx002-LdEm
secret=secret1
type=user
context=from-internal
auth=md5
nat=no


Remote:

[pbx002-LdEm]
host=2.2.2.2
username=pbx001-EpLA
secret=secret2
type=peer
qualify=yes
auth=md5
nat=no
context=from-trunk

[pbx001-EpLA]
host=2.2.2.2
username=pbx001-EpLA
secret=secret2
type=user
qualify=yes
context=from-internal
auth=md5

– Executing [201@from-internal:1] Macro(“SIP/1000-0928cff8”, “user-callerid|SKIPTTL|”) in new stack
– Executing [s@macro-user-callerid:1] Set(“SIP/1000-0928cff8”, “AMPUSER=1000”) in new stack
– Executing [s@macro-user-callerid:2] GotoIf(“SIP/1000-0928cff8”, “0?report”) in new stack
– Executing [s@macro-user-callerid:3] ExecIf(“SIP/1000-0928cff8”, “1|Set|REALCALLERIDNUM=1000”) in new stack
– Executing [s@macro-user-callerid:4] Set(“SIP/1000-0928cff8”, “AMPUSER=1000”) in new stack
– Executing [s@macro-user-callerid:5] Set(“SIP/1000-0928cff8”, “AMPUSERCIDNAME=Boni Morales”) in new stack
– Executing [s@macro-user-callerid:6] GotoIf(“SIP/1000-0928cff8”, “0?report”) in new stack
– Executing [s@macro-user-callerid:7] Set(“SIP/1000-0928cff8”, “AMPUSERCID=1000”) in new stack
– Executing [s@macro-user-callerid:8] Set(“SIP/1000-0928cff8”, “CALLERID(all)=“Boni Morales” <1000>”) in new stack
– Executing [s@macro-user-callerid:9] ExecIf(“SIP/1000-0928cff8”, “0|Set|CHANNEL(language)=”) in new stack
– Executing [s@macro-user-callerid:10] GotoIf(“SIP/1000-0928cff8”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,19)
– Executing [s@macro-user-callerid:19] Set(“SIP/1000-0928cff8”, “CALLERID(number)=1000”) in new stack
– Executing [s@macro-user-callerid:20] Set(“SIP/1000-0928cff8”, “CALLERID(name)=Boni Morales”) in new stack
– Executing [s@macro-user-callerid:21] NoOp(“SIP/1000-0928cff8”, “Using CallerID “Boni Morales” <1000>”) in new stack
– Executing [201@from-internal:2] Set(“SIP/1000-0928cff8”, “_NODEST=”) in new stack
– Executing [201@from-internal:3] Macro(“SIP/1000-0928cff8”, “record-enable|1000|OUT|”) in new stack
– Executing [s@macro-record-enable:1] GotoIf(“SIP/1000-0928cff8”, “1?check”) in new stack
– Goto (macro-record-enable,s,4)
– Executing [s@macro-record-enable:4] AGI(“SIP/1000-0928cff8”, “recordingcheck|20140422-103323|1398184403.154”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
recordingcheck|20140422-103323|1398184403.154: Outbound recording not enabled
– AGI Script recordingcheck completed, returning 0
– Executing [s@macro-record-enable:5] MacroExit(“SIP/1000-0928cff8”, “”) in new stack
– Executing [201@from-internal:4] Macro(“SIP/1000-0928cff8”, “dialout-trunk|2|201||”) in new stack
– Executing [s@macro-dialout-trunk:1] Set(“SIP/1000-0928cff8”, “DIAL_TRUNK=2”) in new stack
– Executing [s@macro-dialout-trunk:2] GosubIf(“SIP/1000-0928cff8”, “0?sub-pincheck|s|1”) in new stack
– Executing [s@macro-dialout-trunk:3] GotoIf(“SIP/1000-0928cff8”, “0?disabletrunk|1”) in new stack
– Executing [s@macro-dialout-trunk:4] Set(“SIP/1000-0928cff8”, “DIAL_NUMBER=201”) in new stack
– Executing [s@macro-dialout-trunk:5] Set(“SIP/1000-0928cff8”, “DIAL_TRUNK_OPTIONS=tr”) in new stack
– Executing [s@macro-dialout-trunk:6] Set(“SIP/1000-0928cff8”, “OUTBOUND_GROUP=OUT_2”) in new stack
– Executing [s@macro-dialout-trunk:7] GotoIf(“SIP/1000-0928cff8”, “1?nomax”) in new stack
– Goto (macro-dialout-trunk,s,9)
– Executing [s@macro-dialout-trunk:9] GotoIf(“SIP/1000-0928cff8”, “0?skipoutcid”) in new stack
– Executing [s@macro-dialout-trunk:10] Set(“SIP/1000-0928cff8”, “DIAL_TRUNK_OPTIONS=”) in new stack
– Executing [s@macro-dialout-trunk:11] Macro(“SIP/1000-0928cff8”, “outbound-callerid|2”) in new stack
– Executing [s@macro-outbound-callerid:1] ExecIf(“SIP/1000-0928cff8”, “0|SetCallerPres|”) in new stack
– Executing [s@macro-outbound-callerid:2] ExecIf(“SIP/1000-0928cff8”, “0|Set|REALCALLERIDNUM=1000”) in new stack
– Executing [s@macro-outbound-callerid:3] GotoIf(“SIP/1000-0928cff8”, “1?normcid”) in new stack
– Goto (macro-outbound-callerid,s,6)
– Executing [s@macro-outbound-callerid:6] Set(“SIP/1000-0928cff8”, “USEROUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:7] Set(“SIP/1000-0928cff8”, “EMERGENCYCID=”) in new stack
– Executing [s@macro-outbound-callerid:8] Set(“SIP/1000-0928cff8”, “TRUNKOUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:9] GotoIf(“SIP/1000-0928cff8”, “1?trunkcid”) in new stack
– Goto (macro-outbound-callerid,s,12)
– Executing [s@macro-outbound-callerid:12] ExecIf(“SIP/1000-0928cff8”, “0|Set|CALLERID(all)=”) in new stack
– Executing [s@macro-outbound-callerid:13] ExecIf(“SIP/1000-0928cff8”, “0|Set|CALLERID(all)=”) in new stack
– Executing [s@macro-outbound-callerid:14] ExecIf(“SIP/1000-0928cff8”, “0|SetCallerPres|prohib_passed_screen”) in new stack
– Executing [s@macro-dialout-trunk:12] ExecIf(“SIP/1000-0928cff8”, “0|AGI|fixlocalprefix”) in new stack
– Executing [s@macro-dialout-trunk:13] Set(“SIP/1000-0928cff8”, “OUTNUM=201”) in new stack
– Executing [s@macro-dialout-trunk:14] Set(“SIP/1000-0928cff8”, “custom=”) in new stack
– Executing [s@macro-dialout-trunk:15] ExecIf(“SIP/1000-0928cff8”, “0|Set|DIAL_TRUNK_OPTIONS=M(setmusic^)”) in new stack
– Executing [s@macro-dialout-trunk:16] Macro(“SIP/1000-0928cff8”, “dialout-trunk-predial-hook|”) in new stack
– Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit(“SIP/1000-0928cff8”, “”) in new stack
– Executing [s@macro-dialout-trunk:17] GotoIf(“SIP/1000-0928cff8”, “0?bypass|1”) in new stack
– Executing [s@macro-dialout-trunk:18] GotoIf(“SIP/1000-0928cff8”, “0?customtrunk”) in new stack
– Executing [s@macro-dialout-trunk:19] Dial(“SIP/1000-0928cff8”, “/201|300|”) in new stack
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [s@macro-dialout-trunk:20] Goto(“SIP/1000-0928cff8”, “s-CHANUNAVAIL|1”) in new stack
– Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
– Executing [s-CHANUNAVAIL@macro-dialout-trunk:1] GotoIf(“SIP/1000-0928cff8”, “1?noreport”) in new stack
– Goto (macro-dialout-trunk,s-CHANUNAVAIL,3)
– Executing [s-CHANUNAVAIL@macro-dialout-trunk:3] NoOp(“SIP/1000-0928cff8”, “TRUNK Dial failed due to CHANUNAVAIL (hangupcause: 66) - failing through to other trunks”) in new stack
– Executing [201@from-internal:5] Macro(“SIP/1000-0928cff8”, “dialout-trunk|1|201||”) in new stack
– Executing [s@macro-dialout-trunk:1] Set(“SIP/1000-0928cff8”, “DIAL_TRUNK=1”) in new stack
– Executing [s@macro-dialout-trunk:2] GosubIf(“SIP/1000-0928cff8”, “0?sub-pincheck|s|1”) in new stack
– Executing [s@macro-dialout-trunk:3] GotoIf(“SIP/1000-0928cff8”, “0?disabletrunk|1”) in new stack
– Executing [s@macro-dialout-trunk:4] Set(“SIP/1000-0928cff8”, “DIAL_NUMBER=201”) in new stack
– Executing [s@macro-dialout-trunk:5] Set(“SIP/1000-0928cff8”, “DIAL_TRUNK_OPTIONS=tr”) in new stack
– Executing [s@macro-dialout-trunk:6] Set(“SIP/1000-0928cff8”, “OUTBOUND_GROUP=OUT_1”) in new stack
– Executing [s@macro-dialout-trunk:7] GotoIf(“SIP/1000-0928cff8”, “1?nomax”) in new stack
– Goto (macro-dialout-trunk,s,9)
– Executing [s@macro-dialout-trunk:9] GotoIf(“SIP/1000-0928cff8”, “0?skipoutcid”) in new stack
– Executing [s@macro-dialout-trunk:10] Set(“SIP/1000-0928cff8”, “DIAL_TRUNK_OPTIONS=”) in new stack
– Executing [s@macro-dialout-trunk:11] Macro(“SIP/1000-0928cff8”, “outbound-callerid|1”) in new stack
– Executing [s@macro-outbound-callerid:1] ExecIf(“SIP/1000-0928cff8”, “0|SetCallerPres|”) in new stack
– Executing [s@macro-outbound-callerid:2] ExecIf(“SIP/1000-0928cff8”, “0|Set|REALCALLERIDNUM=1000”) in new stack
– Executing [s@macro-outbound-callerid:3] GotoIf(“SIP/1000-0928cff8”, “1?normcid”) in new stack
– Goto (macro-outbound-callerid,s,6)
– Executing [s@macro-outbound-callerid:6] Set(“SIP/1000-0928cff8”, “USEROUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:7] Set(“SIP/1000-0928cff8”, “EMERGENCYCID=”) in new stack
– Executing [s@macro-outbound-callerid:8] Set(“SIP/1000-0928cff8”, “TRUNKOUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:9] GotoIf(“SIP/1000-0928cff8”, “1?trunkcid”) in new stack
– Goto (macro-outbound-callerid,s,12)
– Executing [s@macro-outbound-callerid:12] ExecIf(“SIP/1000-0928cff8”, “0|Set|CALLERID(all)=”) in new stack
– Executing [s@macro-outbound-callerid:13] ExecIf(“SIP/1000-0928cff8”, “0|Set|CALLERID(all)=”) in new stack
– Executing [s@macro-outbound-callerid:14] ExecIf(“SIP/1000-0928cff8”, “0|SetCallerPres|prohib_passed_screen”) in new stack
– Executing [s@macro-dialout-trunk:12] ExecIf(“SIP/1000-0928cff8”, “1|AGI|fixlocalprefix”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/fixlocalprefix
– AGI Script fixlocalprefix completed, returning 0
– Executing [s@macro-dialout-trunk:13] Set(“SIP/1000-0928cff8”, “OUTNUM=201”) in new stack
– Executing [s@macro-dialout-trunk:14] Set(“SIP/1000-0928cff8”, “custom=ZAP/g0”) in new stack
– Executing [s@macro-dialout-trunk:15] ExecIf(“SIP/1000-0928cff8”, “0|Set|DIAL_TRUNK_OPTIONS=M(setmusic^)”) in new stack
– Executing [s@macro-dialout-trunk:16] Macro(“SIP/1000-0928cff8”, “dialout-trunk-predial-hook|”) in new stack
– Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit(“SIP/1000-0928cff8”, “”) in new stack
– Executing [s@macro-dialout-trunk:17] GotoIf(“SIP/1000-0928cff8”, “0?bypass|1”) in new stack
– Executing [s@macro-dialout-trunk:18] GotoIf(“SIP/1000-0928cff8”, “0?customtrunk”) in new stack
– Executing [s@macro-dialout-trunk:19] Dial(“SIP/1000-0928cff8”, “ZAP/g0/201|300|”) in new stack
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [s@macro-dialout-trunk:20] Goto(“SIP/1000-0928cff8”, “s-CHANUNAVAIL|1”) in new stack
– Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
– Executing [s-CHANUNAVAIL@macro-dialout-trunk:1] GotoIf(“SIP/1000-0928cff8”, “1?noreport”) in new stack
– Goto (macro-dialout-trunk,s-CHANUNAVAIL,3)
– Executing [s-CHANUNAVAIL@macro-dialout-trunk:3] NoOp(“SIP/1000-0928cff8”, “TRUNK Dial failed due to CHANUNAVAIL (hangupcause: 0) - failing through to other trunks”) in new stack
– Executing [201@from-internal:6] Macro(“SIP/1000-0928cff8”, “dialout-trunk|5|201||”) in new stack
– Executing [s@macro-dialout-trunk:1] Set(“SIP/1000-0928cff8”, “DIAL_TRUNK=5”) in new stack
– Executing [s@macro-dialout-trunk:2] GosubIf(“SIP/1000-0928cff8”, “0?sub-pincheck|s|1”) in new stack
– Executing [s@macro-dialout-trunk:3] GotoIf(“SIP/1000-0928cff8”, “0?disabletrunk|1”) in new stack
– Executing [s@macro-dialout-trunk:4] Set(“SIP/1000-0928cff8”, “DIAL_NUMBER=201”) in new stack
– Executing [s@macro-dialout-trunk:5] Set(“SIP/1000-0928cff8”, “DIAL_TRUNK_OPTIONS=tr”) in new stack
– Executing [s@macro-dialout-trunk:6] Set(“SIP/1000-0928cff8”, “OUTBOUND_GROUP=OUT_5”) in new stack
– Executing [s@macro-dialout-trunk:7] GotoIf(“SIP/1000-0928cff8”, “1?nomax”) in new stack
– Goto (macro-dialout-trunk,s,9)
– Executing [s@macro-dialout-trunk:9] GotoIf(“SIP/1000-0928cff8”, “0?skipoutcid”) in new stack
– Executing [s@macro-dialout-trunk:10] Set(“SIP/1000-0928cff8”, “DIAL_TRUNK_OPTIONS=”) in new stack
– Executing [s@macro-dialout-trunk:11] Macro(“SIP/1000-0928cff8”, “outbound-callerid|5”) in new stack
– Executing [s@macro-outbound-callerid:1] ExecIf(“SIP/1000-0928cff8”, “0|SetCallerPres|”) in new stack
– Executing [s@macro-outbound-callerid:2] ExecIf(“SIP/1000-0928cff8”, “0|Set|REALCALLERIDNUM=1000”) in new stack
– Executing [s@macro-outbound-callerid:3] GotoIf(“SIP/1000-0928cff8”, “1?normcid”) in new stack
– Goto (macro-outbound-callerid,s,6)
– Executing [s@macro-outbound-callerid:6] Set(“SIP/1000-0928cff8”, “USEROUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:7] Set(“SIP/1000-0928cff8”, “EMERGENCYCID=”) in new stack
– Executing [s@macro-outbound-callerid:8] Set(“SIP/1000-0928cff8”, “TRUNKOUTCID=”) in new stack
– Executing [s@macro-outbound-callerid:9] GotoIf(“SIP/1000-0928cff8”, “1?trunkcid”) in new stack
– Goto (macro-outbound-callerid,s,12)
– Executing [s@macro-outbound-callerid:12] ExecIf(“SIP/1000-0928cff8”, “0|Set|CALLERID(all)=”) in new stack
– Executing [s@macro-outbound-callerid:13] ExecIf(“SIP/1000-0928cff8”, “0|Set|CALLERID(all)=”) in new stack
– Executing [s@macro-outbound-callerid:14] ExecIf(“SIP/1000-0928cff8”, “0|SetCallerPres|prohib_passed_screen”) in new stack
– Executing [s@macro-dialout-trunk:12] ExecIf(“SIP/1000-0928cff8”, “0|AGI|fixlocalprefix”) in new stack
– Executing [s@macro-dialout-trunk:13] Set(“SIP/1000-0928cff8”, “OUTNUM=201”) in new stack
– Executing [s@macro-dialout-trunk:14] Set(“SIP/1000-0928cff8”, “custom=”) in new stack
– Executing [s@macro-dialout-trunk:15] ExecIf(“SIP/1000-0928cff8”, “0|Set|DIAL_TRUNK_OPTIONS=M(setmusic^)”) in new stack
– Executing [s@macro-dialout-trunk:16] Macro(“SIP/1000-0928cff8”, “dialout-trunk-predial-hook|”) in new stack
– Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit(“SIP/1000-0928cff8”, “”) in new stack
– Executing [s@macro-dialout-trunk:17] GotoIf(“SIP/1000-0928cff8”, “0?bypass|1”) in new stack
– Executing [s@macro-dialout-trunk:18] GotoIf(“SIP/1000-0928cff8”, “0?customtrunk”) in new stack
– Executing [s@macro-dialout-trunk:19] Dial(“SIP/1000-0928cff8”, “/201|300|”) in new stack
== Everyone is busy/congested at this time (1:0/0/1)
– Executing [s@macro-dialout-trunk:20] Goto(“SIP/1000-0928cff8”, “s-CHANUNAVAIL|1”) in new stack
– Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
– Executing [s-CHANUNAVAIL@macro-dialout-trunk:1] GotoIf(“SIP/1000-0928cff8”, “1?noreport”) in new stack
– Goto (macro-dialout-trunk,s-CHANUNAVAIL,3)
– Executing [s-CHANUNAVAIL@macro-dialout-trunk:3] NoOp(“SIP/1000-0928cff8”, “TRUNK Dial failed due to CHANUNAVAIL (hangupcause: 66) - failing through to other trunks”) in new stack
– Executing [201@from-internal:7] Macro(“SIP/1000-0928cff8”, “outisbusy|”) in new stack
– Executing [s@macro-outisbusy:1] GotoIf(“SIP/1000-0928cff8”, “0?emergency|1”) in new stack
– Executing [s@macro-outisbusy:2] GotoIf(“SIP/1000-0928cff8”, “0?intracompany|1”) in new stack
– Executing [s@macro-outisbusy:3] Playback(“SIP/1000-0928cff8”, “all-circuits-busy-now&pls-try-call-later| noanswer”) in new stack
– <SIP/1000-0928cff8> Playing ‘all-circuits-busy-now’ (language ‘en’)
– <SIP/1000-0928cff8> Playing ‘pls-try-call-later’ (language ‘en’)
== Spawn extension (macro-outisbusy, s, 3) exited non-zero on ‘SIP/1000-0928cff8’ in macro ‘outisbusy’
== Spawn extension (macro-outisbusy, s, 3) exited non-zero on ‘SIP/1000-0928cff8’

– Executing [s@macro-dialout-trunk:19] Dial(“SIP/1000-0928cff8”, “/201|300|”) in new stack

is suspicious, there is no “technology” specified

what do you mean? should there be more values on that line?

what “technology” did you expect dialing /201 to use

extension 201 is on a cisco 7940 … is that what your asking? im sorry if I misunderstood the question

look at line 19 in the dial-out macro expansion , it would work if you had a working dahdi trunk on failing trunk 2.

our freePBX box doesnt have the option of DAHDi, it only has ZAP and ofcourse IAX2. We only have an IAX2 trunk set up.

Sorry for the double post but we do have a ZAP/g0 set up … it says its in use by 1 route… unlike our local trixbox that says in use by 2 routes

Zap was renamed to DAHDi eight years ago. You should read your post, your call fails the first try because /201 should probably be iax2/trunk-name/201, the second time because ZAP/g0/ is busy for such a call, I suggest you update your software to something newer, then start over again with your IAX2 tie-line trunk setup, you have apparently done it incorrectly, IAX2 tie-lines should normally have from-internal context. There are many recipes out there to do it successfully.

This was a working system a few weeks ago but it stopped working from one day to the other. So by what you mentioned and are suggesting im guessing a file or something must of gotten corrupted. No changed were made when it stopped working. Now we only been able to recover incoming calls on the remote server.

Then restore your latest good backup.

we had the Config files restored to a time they were working but even then the calling was not working

Then I suggest my reply #9 again.

Thanks in case the config files are corrupted would removing them only cause the software to rebuild them?
and I looked at line 19 on the CLI output from my local trixbox and it did specify the technology “iax2”

No, you will need to restore them from a WORKING backup, if you do that then it will be the same as it was before, all things being equal and no significant changes made to the machine between times. That your other system works confirms my post #2, you need to fix that or redo your work.

Yea I will have to look into how to start over with the remote server since we do not have any IT at the remote location.
I was hoping we can change a few things in the configs and get it back up but we tried many things by now and we were only able to recover the incoming calls

I should qualify that by saying some but not all of the conf files are generated from the asterisk mysql database when you press the “apply bar” there is also some state date maintained in the internal asterisk db (berkley in your case) corruption of either databases can cause unpredictable results.