Dial rules
The reason I tried to utilized 9 was because I have other ITSP in play. On the other hand, considering that it is free long distance on the PSTN, I could just do simple rules across the board.
What I am currently getting when I dial out is:
-- Executing [916195157234@from-internal:1] Macro("SIP/500-09abcc80", "user-callerid|SKIPTTL|") in new stack
-- Executing [s@macro-user-callerid:1] NoOp("SIP/500-09abcc80", "user-callerid: device 500") in new stack
-- Executing [s@macro-user-callerid:2] Set("SIP/500-09abcc80", "AMPUSER=500") in new stack
-- Executing [s@macro-user-callerid:3] GotoIf("SIP/500-09abcc80", "0?report") in new stack
-- Executing [s@macro-user-callerid:4] ExecIf("SIP/500-09abcc80", "1|Set|REALCALLERIDNUM=500") in new stack
-- Executing [s@macro-user-callerid:5] NoOp("SIP/500-09abcc80", "REALCALLERIDNUM is 500") in new stack
-- Executing [s@macro-user-callerid:6] Set("SIP/500-09abcc80", "AMPUSER=500") in new stack
-- Executing [s@macro-user-callerid:7] Set("SIP/500-09abcc80", "AMPUSERCIDNAME=House") in new stack
-- Executing [s@macro-user-callerid:8] GotoIf("SIP/500-09abcc80", "0?report") in new stack
-- Executing [s@macro-user-callerid:9] Set("SIP/500-09abcc80", "AMPUSERCID=500") in new stack
-- Executing [s@macro-user-callerid:10] Set("SIP/500-09abcc80", "CALLERID(all)="House" <500>") in new stack
-- Executing [s@macro-user-callerid:11] Set("SIP/500-09abcc80", "REALCALLERIDNUM=500") in new stack
-- Executing [s@macro-user-callerid:12] ExecIf("SIP/500-09abcc80", "0|Set|CHANNEL(language)=") in new stack
-- Executing [s@macro-user-callerid:13] NoOp("SIP/500-09abcc80", "TTL: ARG1: SKIPTTL") in new stack
-- Executing [s@macro-user-callerid:14] GotoIf("SIP/500-09abcc80", "1?continue") in new stack
-- Goto (macro-user-callerid,s,23)
-- Executing [s@macro-user-callerid:23] NoOp("SIP/500-09abcc80", "Using CallerID "House" <500>") in new stack
-- Executing [916195157234@from-internal:2] Set("SIP/500-09abcc80", "_NODEST=") in new stack
-- Executing [916195157234@from-internal:3] Macro("SIP/500-09abcc80", "record-enable|500|OUT|") in new stack
-- Executing [s@macro-record-enable:1] GotoIf("SIP/500-09abcc80", "0?2:4") in new stack
-- Goto (macro-record-enable,s,4)
-- Executing [s@macro-record-enable:4] AGI("SIP/500-09abcc80", "recordingcheck|20080419-194459|1208659499.0") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
recordingcheck|20080419-194459|1208659499.0: Outbound recording not enabled
-- AGI Script recordingcheck completed, returning 0
-- Executing [s@macro-record-enable:5] NoOp("SIP/500-09abcc80", "No recording needed") in new stack
-- Executing [916195157234@from-internal:4] Macro("SIP/500-09abcc80", "dialout-trunk|11|916195157234||") in new stack
-- Executing [s@macro-dialout-trunk:1] Set("SIP/500-09abcc80", "DIAL_TRUNK=11") in new stack
-- Executing [s@macro-dialout-trunk:2] ExecIf("SIP/500-09abcc80", "0|Authenticate|") in new stack
-- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/500-09abcc80", "0?disabletrunk|1") in new stack
-- Executing [s@macro-dialout-trunk:4] Set("SIP/500-09abcc80", "DIAL_NUMBER=916195157234") in new stack
-- Executing [s@macro-dialout-trunk:5] Set("SIP/500-09abcc80", "DIAL_TRUNK_OPTIONS=tr") in new stack
-- Executing [s@macro-dialout-trunk:6] Set("SIP/500-09abcc80", "GROUP()=OUT_11") in new stack
-- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/500-09abcc80", "0?nomax") in new stack
-- Executing [s@macro-dialout-trunk:8] GotoIf("SIP/500-09abcc80", "0?chanfull") in new stack
-- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/500-09abcc80", "0?skipoutcid") in new stack
-- Executing [s@macro-dialout-trunk:10] Set("SIP/500-09abcc80", "DIAL_TRUNK_OPTIONS=") in new stack
-- Executing [s@macro-dialout-trunk:11] Macro("SIP/500-09abcc80", "outbound-callerid|11") in new stack
-- Executing [s@macro-outbound-callerid:1] GotoIf("SIP/500-09abcc80", "1?start") in new stack
-- Goto (macro-outbound-callerid,s,3)
-- Executing [s@macro-outbound-callerid:3] NoOp("SIP/500-09abcc80", "REALCALLERIDNUM is 500") in new stack
-- Executing [s@macro-outbound-callerid:4] GotoIf("SIP/500-09abcc80", "1?normcid") in new stack
-- Goto (macro-outbound-callerid,s,9)
-- Executing [s@macro-outbound-callerid:9] Set("SIP/500-09abcc80", "USEROUTCID=") in new stack
-- Executing [s@macro-outbound-callerid:10] Set("SIP/500-09abcc80", "EMERGENCYCID=") in new stack
-- Executing [s@macro-outbound-callerid:11] Set("SIP/500-09abcc80", "TRUNKOUTCID="K. Callis" <9282195181>") in new stack
-- Executing [s@macro-outbound-callerid:12] GotoIf("SIP/500-09abcc80", "1?trunkcid") in new stack
-- Goto (macro-outbound-callerid,s,16)
-- Executing [s@macro-outbound-callerid:16] GotoIf("SIP/500-09abcc80", "0?usercid") in new stack
-- Executing [s@macro-outbound-callerid:17] Set("SIP/500-09abcc80", "CALLERID(all)=K. Callis <9282195181>") in new stack
-- Executing [s@macro-outbound-callerid:18] GotoIf("SIP/500-09abcc80", "1?report") in new stack
-- Goto (macro-outbound-callerid,s,22)
-- Executing [s@macro-outbound-callerid:22] NoOp("SIP/500-09abcc80", "CallerID set to "K. Callis" <9282195181>") in new stack
-- Executing [s@macro-dialout-trunk:12] AGI("SIP/500-09abcc80", "fixlocalprefix") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/fixlocalprefix
> fixlocalprefix: Using pattern 9|.
== fixlocalprefix: Dialpattern 9|. matched. 916195157234 -> 16195157234
-- AGI Script fixlocalprefix completed, returning 0
-- Executing [s@macro-dialout-trunk:13] Set("SIP/500-09abcc80", "OUTNUM=16195157234") in new stack
-- Executing [s@macro-dialout-trunk:14] Set("SIP/500-09abcc80", "custom=SIP/PSTN") in new stack
-- Executing [s@macro-dialout-trunk:15] GotoIf("SIP/500-09abcc80", "1?gocall") in new stack
-- Goto (macro-dialout-trunk,s,17)
-- Executing [s@macro-dialout-trunk:17] Macro("SIP/500-09abcc80", "dialout-trunk-predial-hook|") in new stack
-- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/500-09abcc80", "0?bypass|1") in new stack
-- Executing [s@macro-dialout-trunk:19] GotoIf("SIP/500-09abcc80", "0?customtrunk") in new stack
-- Executing [s@macro-dialout-trunk:20] Dial("SIP/500-09abcc80", "SIP/PSTN/16195157234|300|") in new stack
-- Couldn't call PSTN/16195157234
== Everyone is busy/congested at this time (0:0/0/0)
-- Executing [s@macro-dialout-trunk:21] Goto("SIP/500-09abcc80", "s-CHANUNAVAIL|1") in new stack
-- Goto (macro-dialout-trunk,s-CHANUNAVAIL,1)
-- Executing [s-CHANUNAVAIL@macro-dialout-trunk:1] GotoIf("SIP/500-09abcc80", "1?noreport") in new stack
-- Goto (macro-dialout-trunk,s-CHANUNAVAIL,3)
-- Executing [s-CHANUNAVAIL@macro-dialout-trunk:3] NoOp("SIP/500-09abcc80", "TRUNK Dial failed due to CHANUNAVAIL - failing through to other trunks") in new stack
-- Executing [916195157234@from-internal:5] Macro("SIP/500-09abcc80", "outisbusy|") in new stack
-- Executing [s@macro-outisbusy:1] Playback("SIP/500-09abcc80", "all-circuits-busy-now|noanswer") in new stack
-- <SIP/500-09abcc80> Playing 'all-circuits-busy-now' (language 'en')
-- Executing [s@macro-outisbusy:2] Playback("SIP/500-09abcc80", "pls-try-call-later|noanswer") in new stack
-- <SIP/500-09abcc80> Playing 'pls-try-call-later' (language 'en')
-- Executing [s@macro-outisbusy:3] Macro("SIP/500-09abcc80", "hangupcall") in new stack
-- Executing [s@macro-hangupcall:1] ResetCDR("SIP/500-09abcc80", "w") in new stack
-- Executing [s@macro-hangupcall:2] NoCDR("SIP/500-09abcc80", "") in new stack
-- Executing [s@macro-hangupcall:3] GotoIf("SIP/500-09abcc80", "1?skiprg") in new stack
-- Goto (macro-hangupcall,s,6)
-- Executing [s@macro-hangupcall:6] GotoIf("SIP/500-09abcc80", "1?skipblkvm") in new stack
-- Goto (macro-hangupcall,s,9)
-- Executing [s@macro-hangupcall:9] GotoIf("SIP/500-09abcc80", "1?theend") in new stack
-- Goto (macro-hangupcall,s,11)
-- Executing [s@macro-hangupcall:11] Hangup("SIP/500-09abcc80", "") in new stack
== Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/500-09abcc80' in macro 'hangupcall'
== Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/500-09abcc80' in macro 'outisbusy'
== Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/500-09abcc80'
pbx*CLI> sip show peers
Name/username Host Dyn Nat ACL Port Status
PSTN/PSTN 192.168.1.150 D 5071 OK (8 ms)
500/500 192.168.1.150 D N 5070 OK (8 ms)
599/599 192.168.1.150 5071 OK (8 ms)
18 sip peers [Monitored: 13 online, 5 offline Unmonitored: 0 online, 0 offline]