I’m do the ‘teach yourself asterisk’ thing by running asterisk behind our PBX with a TDM400P FXO port for incoming calls so, sorry if this is a dumb question but I have already searched the forum and not found an answer.
Our PBX generates UK style CallerID and I’m trying to route calls based on that but having real difficulties.
The TDM400P seems to get the CallerID (I’m running telnet to the * manager to watch it do things) but asterisk just doesn’t seem to pattern match on it
The bit from my extensions.conf looks like:
[incoming]
exten => s,1,Wait(1)
exten => s/.Russell.Extn39.,2,Goto(Weasels,s,1)
exten => s,2,Dial(SIP/1111,20,Trt)
exten => s,3,Voicemail,u1111
exten => s,4,Hangup
exten => s,103,Voicemail
exten => s,104,Hangup
[Weasels]
exten => s,1,Answer
exten => s,2,wait(1)
exten => s,3,Playback(tt-somethingwrong)
exten => s,4,Playback(tt-weasels)
exten => s,5,Hangup
I think that should be saying; if a call comes in from RussellExtn39* then route to [Weasels] else route to SIP/1111
However, the log from *manager shows that the call is routed before the Caller ID is known
Here’s a snip from the manager log:
Event: Newchannel
Channel: Zap/4-1
State: Unknown (9)
CallerID:
Uniqueid: asterisk-20950-1129138345.0
Event: Newstate
Channel: Zap/4-1
State: Ring
CallerID:
Uniqueid: asterisk-20950-1129138345.0
Event: Newexten
Channel: Zap/4-1
Context: incoming
Extension: s
Priority: 1
Application: Wait
AppData: 1
Uniqueid: asterisk-20950-1129138345.0
Event: Newexten
Channel: Zap/4-1
Context: incoming
Extension: s
Priority: 2
Application: Dial
AppData: SIP/1111|20|Trt
Uniqueid: asterisk-20950-1129138345.0
Event: Newchannel
Channel: SIP/1111-011e
State: Down
CallerID:
Uniqueid: asterisk-20950-1129138348.1
Event: Newchannel
Channel: SIP/1111-011e
State: Ringing
CallerID: “Russell-Extn39” <12>
Uniqueid: asterisk-20950-1129138348.1
If I change the pattern match to:
exten => s/_.Russell.Extn39.,2,Goto(Weasels,s,1)
Then all Caller-ID’s get routed to [Weasels]
Here’s the manager log for such a call
Event: Newstate
Channel: Zap/4-1
State: Ring
CallerID:
Uniqueid: asterisk-25280-1129139880.40
Event: Newexten
Channel: Zap/4-1
Context: incoming
Extension: s
Priority: 1
Application: Wait
AppData: 1
Uniqueid: asterisk-25280-1129139880.40
Event: Newexten
Channel: Zap/4-1
Context: incoming
Extension: s
Priority: 2
Application: Goto
AppData: Weasels|s|1
Uniqueid: asterisk-25280-1129139880.40
Event: Newexten
Channel: Zap/4-1
Context: Weasels
Extension: s
Priority: 1
Application: Answer
AppData:
Uniqueid: asterisk-25280-1129139880.40
Event: Newstate
Channel: Zap/4-1
State: Up
CallerID: “Meeting Room-Extn39” <10>
Uniqueid: asterisk-25280-1129139880.40
Event: Newexten
Channel: Zap/4-1
Context: Weasels
Extension: s
Priority: 2
Application: Wait
AppData: 1
Uniqueid: asterisk-25280-1129139880.40
I’m sure it’s something that I’m doing wrong but I’ve read the docs, searched the forums and can’t work out what.
Can anyone help?