Hi. I've got a working dial plan on my home system but there are problems with it and I was hoping someone more comfortable with dial plans might be able to help. In a nutshell here's what I'm currently doing on an incoming outside phone call [default] Set(TIMEOUT(digit)=3 Set(TIMEOUT(response)=60 exten => s,1,NoOp(Answering in default context) exten => s,2,Wait(1) ; look up the callerid name and state in the database exten => s,3,AGI(cid_fix.php) ; print callerid exten => s,4,NoOp(${CALLERID(name)} ${CALLERID(number)} ${CALLSTATE} ${DATETIME}) ; short circuit the sequence if this is a blacklisted or whitelisted entry exten => s,5,GotoIf($["${CALLSTATE}" = "black"]?blacklisted,s,1) exten => s,6,GotoIf($["${CALLSTATE}" = "white"]?50) ; send a sit tone if we don't have a callerid ; exten => s,7,Zapateller(nocallerid) ; after a certain time I don't want phone calls ; exten => s,8,GotoIfTime(${AFTER_HOURS}|*|*|*?voicemail,s,1) ; no callerid ; exten => s,9,GotoIf($["${CALLERID(number)}" = ""]?voicemail,s,1) ; If 800 number ; exten => s,10,GotoIf($["${CALLERID(number):0:3}" = "866"]?voicemail,s,1) exten => s,11,GotoIf($["${CALLERID(number):0:3}" = "877"]?voicemail,s,1) exten => s,12,GotoIf($["${CALLERID(number):0:3}" = "888"]?voicemail,s,1) exten => s,13,GotoIf($["${CALLERID(number):0:3}" = "800"]?voicemail,s,1:50) ; ring the phones and go to voicemail if nobody answers ; exten => s,50,Dial(${LOCAL_LINES},20,tT) exten => s,51,Goto(voicemail,s,1) The intent of this sequence is to take the incoming callerid, replace it if known with something in the database, and branch on the state from the DB and time of the day. One issue I'm having is that the AGI call seems to cause it to answer the line. Normally that wouldn't be an issue but that answer seems to trip up a number of automated systems and some people in addition to leaving a half second pause in the ringing. Is there a way I can do the call to my lookup script without answering the line yet? Or is there a better way to do what I'm trying to do? I'm working with asterisk 1.4.10 Thanks -- Matthew Harrell Managers are like cats in a litter Bit Twiddlers, Inc. box. They're always rearranging mharrell at bittwiddlers.com trying to cover up what they've done
Matthew Harrell wrote:> Hi. I've got a working dial plan on my home system but there are problems > with it and I was hoping someone more comfortable with dial plans might be > able to help. In a nutshell here's what I'm currently doing on an incoming > outside phone call > > [default] > Set(TIMEOUT(digit)=3 > Set(TIMEOUT(response)=60 >These are missing closing brackets for one thing... -- Warm Regards, Lee
Nicholas Blasgen
2007-Aug-15 20:14 UTC
[asterisk-users] Dialplan / AGI autoanswer question
So besides the missing ) on line 1, I have some other comments: 1) You should replace your priority numbers with 'n'. Just so much easier to know that the issue isn't with priority numbers. And typing 'dialplan show <context>' is a nice way to see if everything is setup correctly. The 'n' is a personal choice, but the longer your application the better. 2) I thought I read somewhere that AGI was now auto-answering the channel. But I guess that's not right. AGI will auto-answer the channel if something causes it to do so. If you want to post your AGI code without any database commands, I'll glance at it. humm, I guess that's all I see. Everything else seems fine. It may be good to check the ChannelStatus once in a while just to debug where the channel is getting answered. http://gundy.org/asterisk/agi.html -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20070815/2b465050/attachment.htm
Gordon Henderson
2007-Aug-15 22:47 UTC
[asterisk-users] Dialplan / AGI autoanswer question
On Wed, 15 Aug 2007, Matthew Harrell wrote:> The intent of this sequence is to take the incoming callerid, replace it if > known with something in the database, and branch on the state from the DB > and time of the day.FWIW: I do something similar, but purely in dial-plan using the astdb - here's an extract, it demos jumping to named labels too: exten => incoming,1,Noop(New incoming call. CallerId is ${CALLERID(all)}) ; See if we have a name: exten => incoming,n,GotoIf($["${CALLERID(name)}" != ""]?gotName) ; OK. No Name. Set a default name exten => incoming,n,Set(CALLERID(name)=Unknown) exten => incoming,n(gotName),Noop(Carrying on after name check) ; See if we have a number: exten => incoming,n,GotoIf($["${CALLERID(number)}" != ""]?gotNumber) ; OK. No Number. Set a default number exten => incoming,n,Set(CALLERID(number)=Withheld) exten => incoming,n(gotNumber),Noop(Carrying on after number check) ; Now see if the number is the our internal database which will override any ; name we might have. exten => incoming,n,Set(name=${DB(cid/${CALLERID(number)})}) exten => incoming,n,GotoIf($["${name}" = ""]?doneCIDprocessing) exten => incoming,n,Set(CALLERID(name)=${name}) exten => incoming,n,Noop(We set our name to ${name} from the database) exten => incoming,n(doneCIDprocessing),Noop(Done with incoming CID processing - we have a call from ${CALLERID(all)}) You could keep a separate list of number "states" in the database too, and extract this. Eg. above the line where we get the name out of the astdb above: exten => incoming,n,Set(CALLSTATE=${DB(state/${CALLERID(number)})}) and so on... I'm not sure what (if any!) benefit this might have over running an external PHP application... I'd like to think it might actually be quicker for simple cases like this, but I've never benchmarked it. Gordon