I am very new to Asterisk so this is undoubtedly a misconfiguration on my end.
Right now my test setup behaves as follows: When I make an incoming call to an FXO port on my analog card, Asterisk sends the call to an analog telephone in an FXS port and it rings. I can answer the call just fine. I can also make calls from the analog extension to a softphone (ext 301) and vise versa.
However when I try to call out, the system routes it as if it is an incoming call and rings the analog extension.
The following logging detail shows in the Asterisk console:
-- Executing [01026@from-internal:1] Macro("SIP/301-00000005", "user-callerid,LIMIT,") in new stack
-- Executing [s@macro-user-callerid:1] Set("SIP/301-00000005", "AMPUSER=301") in new stack
-- Executing [s@macro-user-callerid:2] GotoIf("SIP/301-00000005", "0?report") in new stack
-- Executing [s@macro-user-callerid:3] ExecIf("SIP/301-00000005", "1?Set(REALCALLERIDNUM=301)") in new stack
-- Executing [s@macro-user-callerid:4] Set("SIP/301-00000005", "AMPUSER=301") in new stack
-- Executing [s@macro-user-callerid:5] Set("SIP/301-00000005", "AMPUSERCIDNAME=Douglas Crole") in new stack
-- Executing [s@macro-user-callerid:6] GotoIf("SIP/301-00000005", "0?report") in new stack
-- Executing [s@macro-user-callerid:7] Set("SIP/301-00000005", "AMPUSERCID=301") in new stack
-- Executing [s@macro-user-callerid:8] Set("SIP/301-00000005", "CALLERID(all)="Douglas Crole" <301>") in new stack
-- Executing [s@macro-user-callerid:9] GotoIf("SIP/301-00000005", "0?limit") in new stack
-- Executing [s@macro-user-callerid:10] ExecIf("SIP/301-00000005", "1?Set(GROUP(concurrency_limit)=301)") in new stack
-- Executing [s@macro-user-callerid:11] GotoIf("SIP/301-00000005", "1?continue") in new stack
-- Goto (macro-user-callerid,s,24)
-- Executing [s@macro-user-callerid:24] Set("SIP/301-00000005", "CALLERID(number)=301") in new stack
-- Executing [s@macro-user-callerid:25] Set("SIP/301-00000005", "CALLERID(name)=Douglas Crole") in new stack
-- Executing [s@macro-user-callerid:26] Set("SIP/301-00000005", "CHANNEL(language)=en") in new stack
-- Executing [01026@from-internal:2] Set("SIP/301-00000005", "MOHCLASS=default") in new stack
-- Executing [01026@from-internal:3] Set("SIP/301-00000005", "_NODEST=") in new stack
-- Executing [01026@from-internal:4] Gosub("SIP/301-00000005", "sub-record-check,s,1(out,01026,)") in new stack
-- Executing [s@sub-record-check:1] GotoIf("SIP/301-00000005", "1?check") in new stack
-- Goto (sub-record-check,s,6)
-- Executing [s@sub-record-check:6] Set("SIP/301-00000005", "__MON_FMT=wav") in new stack
-- Executing [s@sub-record-check:7] GotoIf("SIP/301-00000005", "1?next") in new stack
-- Goto (sub-record-check,s,10)
-- Executing [s@sub-record-check:10] ExecIf("SIP/301-00000005", "0?Return()") in new stack
-- Executing [s@sub-record-check:11] GotoIf("SIP/301-00000005", "0?out,1") in new stack
-- Executing [s@sub-record-check:12] Set("SIP/301-00000005", "__REC_STATUS=INITIALIZED") in new stack
-- Executing [s@sub-record-check:13] ExecIf("SIP/301-00000005", "0?Set(__REC_POLICY_MODE=)") in new stack
-- Executing [s@sub-record-check:14] Set("SIP/301-00000005", "NOW=1362573586") in new stack
-- Executing [s@sub-record-check:15] Set("SIP/301-00000005", "__DAY=06") in new stack
-- Executing [s@sub-record-check:16] Set("SIP/301-00000005", "__MONTH=03") in new stack
-- Executing [s@sub-record-check:17] Set("SIP/301-00000005", "__YEAR=2013") in new stack
-- Executing [s@sub-record-check:18] Set("SIP/301-00000005", "__TIMESTR=20130306-143946") in new stack
-- Executing [s@sub-record-check:19] Set("SIP/301-00000005", "__FROMEXTEN=301") in new stack
-- Executing [s@sub-record-check:20] Set("SIP/301-00000005", "__CALLFILENAME=out-01026-301-20130306-143946-1362573586.15") in new stack
-- Executing [s@sub-record-check:21] Goto("SIP/301-00000005", "out,1") in new stack
-- Goto (sub-record-check,out,1)
-- Executing [out@sub-record-check:1] ExecIf("SIP/301-00000005", "1?Set(__REC_POLICY_MODE=dontcare)") in new stack
-- Executing [out@sub-record-check:2] GosubIf("SIP/301-00000005", "0?record,1(exten,01026,301)") in new stack
-- Executing [out@sub-record-check:3] Return("SIP/301-00000005", "") in new stack
-- Executing [01026@from-internal:5] Macro("SIP/301-00000005", "dialout-trunk,1,01026,") in new stack
-- Executing [s@macro-dialout-trunk:1] Set("SIP/301-00000005", "DIAL_TRUNK=1") in new stack
-- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/301-00000005", "0?sub-pincheck,s,1()") in new stack
-- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/301-00000005", "0?disabletrunk,1") in new stack
-- Executing [s@macro-dialout-trunk:4] Set("SIP/301-00000005", "DIAL_NUMBER=01026") in new stack
-- Executing [s@macro-dialout-trunk:5] Set("SIP/301-00000005", "DIAL_TRUNK_OPTIONS=tr") in new stack
-- Executing [s@macro-dialout-trunk:6] Set("SIP/301-00000005", "OUTBOUND_GROUP=OUT_1") in new stack
-- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/301-00000005", "0?nomax") in new stack
-- Executing [s@macro-dialout-trunk:8] GotoIf("SIP/301-00000005", "0?chanfull") in new stack
-- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/301-00000005", "0?skipoutcid") in new stack
-- Executing [s@macro-dialout-trunk:10] Set("SIP/301-00000005", "DIAL_TRUNK_OPTIONS=") in new stack
-- Executing [s@macro-dialout-trunk:11] Macro("SIP/301-00000005", "outbound-callerid,1") in new stack
-- Executing [s@macro-outbound-callerid:1] ExecIf("SIP/301-00000005", "0?Set(CALLERPRES()=)") in new stack
-- Executing [s@macro-outbound-callerid:2] ExecIf("SIP/301-00000005", "0?Set(REALCALLERIDNUM=301)") in new stack
-- Executing [s@macro-outbound-callerid:3] GotoIf("SIP/301-00000005", "1?normcid") in new stack
-- Goto (macro-outbound-callerid,s,6)
-- Executing [s@macro-outbound-callerid:6] Set("SIP/301-00000005", "USEROUTCID=301") in new stack
-- Executing [s@macro-outbound-callerid:7] Set("SIP/301-00000005", "EMERGENCYCID=") in new stack
-- Executing [s@macro-outbound-callerid:8] Set("SIP/301-00000005", "TRUNKOUTCID=<0117047821>") in new stack
-- Executing [s@macro-outbound-callerid:9] GotoIf("SIP/301-00000005", "1?trunkcid") in new stack
-- Goto (macro-outbound-callerid,s,12)
-- Executing [s@macro-outbound-callerid:12] ExecIf("SIP/301-00000005", "1?Set(CALLERID(all)=<0117047821>)") in new stack
-- Executing [s@macro-outbound-callerid:13] ExecIf("SIP/301-00000005", "1?Set(CALLERID(all)=301)") in new stack
-- Executing [s@macro-outbound-callerid:14] ExecIf("SIP/301-00000005", "0?Set(CALLERID(all)=)") in new stack
-- Executing [s@macro-outbound-callerid:15] ExecIf("SIP/301-00000005", "0?Set(CALLERPRES()=prohib_passed_screen)") in new stack
-- Executing [s@macro-dialout-trunk:12] GosubIf("SIP/301-00000005", "0?sub-flp-1,s,1()") in new stack
-- Executing [s@macro-dialout-trunk:13] Set("SIP/301-00000005", "OUTNUM=01026") in new stack
-- Executing [s@macro-dialout-trunk:14] Set("SIP/301-00000005", "custom=DAHDI/g1") in new stack
-- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/301-00000005", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default))") in new stack
-- Executing [s@macro-dialout-trunk:16] ExecIf("SIP/301-00000005", "0?Set(DIAL_TRUNK_OPTIONS=M(confirm))") in new stack
-- Executing [s@macro-dialout-trunk:17] Macro("SIP/301-00000005", "dialout-trunk-predial-hook,") in new stack
-- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("SIP/301-00000005", "") in new stack
-- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/301-00000005", "0?bypass,1") in new stack
-- Executing [s@macro-dialout-trunk:19] ExecIf("SIP/301-00000005", "1?Set(CONNECTEDLINE(num,i)=01026)") in new stack
-- Executing [s@macro-dialout-trunk:20] ExecIf("SIP/301-00000005", "1?Set(CONNECTEDLINE(name,i)=CID:301)") in new stack
-- Executing [s@macro-dialout-trunk:21] GotoIf("SIP/301-00000005", "0?customtrunk") in new stack
-- Executing [s@macro-dialout-trunk:22] Dial("SIP/301-00000005", "DAHDI/g1/01026,300,") in new stack
-- Called DAHDI/g1/01026
-- DAHDI/1-1 is ringing
-- DAHDI/1-1 is ringing
-- DAHDI/1-1 is ringing
-- Hanging up on 'DAHDI/1-1'
-- Hungup 'DAHDI/1-1'
== Spawn extension (macro-dialout-trunk, s, 22) exited non-zero on 'SIP/301-00000005' in macro 'dialout-trunk'
== Spawn extension (from-internal, 01026, 5) exited non-zero on 'SIP/301-00000005'
-- Executing [h@from-internal:1] Hangup("SIP/301-00000005", "") in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/301-00000005'
I have grouped all my FXO ports into a single group (1) with context "from-zaptel"
I have set up a Zap channel DID for port 5 with DID 105 (channel 5 is the only one with a line connected for testing at this point)
My ZAP Trunk (name=ZAP Channel g1) uses identifier g1 and has no number manipulation rules (this might be it?)
I have an incoming route set up with blank DID and CallerID number (catch all calls) with destination Extension 303 - this is my analog phone's extension
I have a single outbound route set to match pattern 0X. (any number prefixed with zero) set to use the trunk ZAP Channel g1 (all channels in group 1)
I am using the AsteriskNOW 2.0.2 distro with FreePBX installed.
I am almost exclusively using FreePBX to make config changes at this point (just changed zapata.conf as recommended for South African telephony settings.
Well I managed to solve the problem, but sadly I was in too much of a hurry to pinpoint which particular setting change solved it. Various things I did were:
Somewhere during this process I got outgoing and incoming calls working. I wish I could be more helpful.