The first question is, what is the CORRECT way to handle an incoming call that comes in like this? This is with NO extensions set up to match the called number:
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 000 Type: IAX Subclass: NEW
Timestamp: 00001ms SCall: 00005 DCall: 00000 [<Caller's IP>:4569]
VERSION : 2
CALLED NUMBER : <called number>
CODEC_PREFS : (ulaw|ilbc|gsm|adpcm)
CALLING NUMBER : <calling number>
CALLING PRESNTN : 0
CALLING TYPEOFN : 0
CALLING TRANSIT : 0
LANGUAGE : en
FORMAT : 4
CAPABILITY : 64550
ADSICPE : 2
DATE TIME : 2006-04-25 18:17:58
Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 001 Type: IAX Subclass: REJECT
Timestamp: 00017ms SCall: 00002 DCall: 00005 [<Caller's IP>:4569]
CAUSE : No such context/extension
CAUSE CODE : 3
Now if I create a CUSTOM extension with a number matching the called number and in the Dial area I put Local/s@ivr-2 (which always worked in the past) I now get this (combination IAX2 debug and screen readout):
Rx-Frame Retry[ No] -- OSeqno: 000 ISeqno: 000 Type: IAX Subclass: NEW
Timestamp: 00004ms SCall: 00001 DCall: 00000 [<Caller's IP>:4569]
VERSION : 2
CALLED NUMBER : <called number>
CODEC_PREFS : (ulaw|ilbc|gsm|adpcm)
CALLING NUMBER : <calling number>
CALLING PRESNTN : 0
CALLING TYPEOFN : 0
CALLING TRANSIT : 0
LANGUAGE : en
FORMAT : 4
CAPABILITY : 64550
ADSICPE : 2
DATE TIME : 2006-04-25 18:29:40
-- Accepting UNAUTHENTICATED call from <Caller's IP>:
> requested format = ulaw,
> requested prefs = (ulaw|ilbc|gsm|adpcm),
> actual format = ulaw,
> host prefs = (ulaw|alaw|gsm),
> priority = mine
Tx-Frame Retry[000] -- OSeqno: 000 ISeqno: 001 Type: IAX Subclass: ACCEPT
Timestamp: 00018ms SCall: 00001 DCall: 00001 [<Caller's IP>:4569]
FORMAT : 4
-- Executing Macro("IAX2/SystemName-1", "exten-vm|novm|<called number>") in new stack
-- Executing Macro("IAX2/SystemName-1", "user-callerid") in new stack
-- Executing GotoIf("IAX2/SystemName-1", "0?start") in new stack
-- Executing Set("IAX2/SystemName-1", "REALCALLERIDNUM=<calling number>") in new stack
-- Executing NoOp("IAX2/SystemName-1", "REALCALLERIDNUM is <calling number>") in new stack
-- Executing Set("IAX2/SystemName-1", "AMPUSER=") in new stack
-- Executing Set("IAX2/SystemName-1", "AMPUSERCIDNAME=") in new stack
-- Executing GotoIf("IAX2/SystemName-1", "1?report") in new stack
-- Goto (macro-user-callerid,s,8)
-- Executing NoOp("IAX2/SystemName-1", "Using CallerID "" <<calling number>>") in new stack
-- Executing Set("IAX2/SystemName-1", "FROMCONTEXT=exten-vm") in new stack
-- Executing Set("IAX2/SystemName-1", "VMBOX=novm") in new stack
-- Executing Set("IAX2/SystemName-1", "EXTTOCALL=<called number>") in new stack
-- Executing Set("IAX2/SystemName-1", "CFUEXT=") in new stack
Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 001 Type: IAX Subclass: ACK
Timestamp: 00018ms SCall: 00001 DCall: 00001 [<Caller's IP>:4569]
-- Executing Set("IAX2/SystemName-1", "RT=") in new stack
-- Executing Macro("IAX2/SystemName-1", "record-enable|<called number>|IN") in new stack
-- Executing GotoIf("IAX2/SystemName-1", "0 > 0?2:4") in new stack
-- Goto (macro-record-enable,s,4)
-- Executing AGI("IAX2/SystemName-1", "recordingcheck|20060425-182940|1146004180.3") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
Rx-Frame Retry[ No] -- OSeqno: 001 ISeqno: 001 Type: VOICE Subclass: 4
Timestamp: 00053ms SCall: 00001 DCall: 00001 [<Caller's IP>:4569]
Tx-Frame Retry[-01] -- OSeqno: 001 ISeqno: 002 Type: IAX Subclass: ACK
Timestamp: 00053ms SCall: 00001 DCall: 00001 [<Caller's IP>:4569]
recordingcheck|20060425-182940|1146004180.3: Inbound recording not enabled
-- AGI Script recordingcheck completed, returning 0
-- Executing NoOp("IAX2/SystemName-1", "No recording needed") in new stack
-- Executing GotoIf("IAX2/SystemName-1", "0?dolocaldial|1") in new stack
-- Executing Macro("IAX2/SystemName-1", "dial||tr|<called number>") in new stack
-- Executing AGI("IAX2/SystemName-1", "dialparties.agi") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
dialparties.agi: Starting New Dialparties.agi
-- dialparties.agi: priority is 1
dialparties.agi: Caller ID name is 'unknown' number is '<calling number>'
dialparties.agi: Methodology of ring is 'none'
-- dialparties.agi: Added extension <called number> to extension map
-- dialparties.agi: Extension <called number> cf is disabled
-- dialparties.agi: Extension <called number> do not disturb is disabled
> dialparties.agi: extnum: <called number>
> dialparties.agi: exthascw: 0
> dialparties.agi: exthascfb: 0
> dialparties.agi: extcfb:
> dialparties.agi: exthascfu: 0
> dialparties.agi: extcfu:
== Parsing '/etc/asterisk/manager.conf': Found
== Parsing '/etc/asterisk/manager_custom.conf': Found
== Manager 'admin' logged on from 127.0.0.1
> dialparties.agi: ExtensionState: 0
-- dialparties.agi: Checking CW and CFB status for extension <called number>
== Manager 'admin' logged off from 127.0.0.1
-- dialparties.agi: DbSet CALLTRACE/<called number> to <calling number>
-- AGI Script dialparties.agi completed, returning 0
-- Executing NoOp("IAX2/SystemName-1", "Returned from dialparties with no extensions to call") in new stack
-- Executing NoOp("IAX2/SystemName-1", "DIALSTATUS is ") in new stack
-- Executing GosubIf("IAX2/SystemName-1", "0?docfu|1") in new stack
-- Executing NoOp("IAX2/SystemName-1", "Voicemail is novm") in new stack
-- Executing GotoIf("IAX2/SystemName-1", "1?s-|1") in new stack
-- Goto (macro-exten-vm,s-,1)
-- Executing Congestion("IAX2/SystemName-1", "") in new stack
Tx-Frame Retry[000] -- OSeqno: 001 ISeqno: 002 Type: CONTROL Subclass: (8?)
Timestamp: 00317ms SCall: 00001 DCall: 00001 [<Caller's IP>:4569]
Rx-Frame Retry[ No] -- OSeqno: 002 ISeqno: 002 Type: IAX Subclass: ACK
Timestamp: 00317ms SCall: 00001 DCall: 00001 [<Caller's IP>:4569]
Rx-Frame Retry[ No] -- OSeqno: 002 ISeqno: 002 Type: IAX Subclass: HANGUP
Timestamp: 00349ms SCall: 00001 DCall: 00001 [<Caller's IP>:4569]
CAUSE CODE : 0
Tx-Frame Retry[-01] -- OSeqno: 002 ISeqno: 003 Type: IAX Subclass: ACK
Timestamp: 00349ms SCall: 00001 DCall: 00001 [<Caller's IP>:4569]
== Spawn extension (macro-exten-vm, s-, 1) exited non-zero on 'IAX2/SystemName-1' in macro 'exten-vm'
== Spawn extension (macro-exten-vm, s-, 1) exited non-zero on 'IAX2/SystemName-1'
-- Hungup 'IAX2/SystemName-1'
One other comment: As it happens, SystemName matches the name of one of my trunks that I use for outgoing only. I'm not sure if it's getting that from the calling system or somehow associating this call with that trunk, though there's no reason it should do the latter becuase there's nothing in the incoming context for that trunk. However I've tried putting some lines in the incoming on that trunk (context=from-trunk, etc) but those just seem to get ignored. Note that this is not a system that I have any sort of passworded session with.