[asterisk-users] Dialplan / AGI autoanswer question

Matthew Harrell lists-sender-6a8aaf at bittwiddlers.com
Fri Aug 17 10:41:40 CDT 2007


Thanks, I'll take a look at it and see what new tricks I can learn.  I did
use the astdb initally in my first version but at the time didn't see a good
way to add the state field that I wanted in there.  At the moment I have a 
number of external programs which use the postgres database - is it possible
to connect to the astdb from an external program?


In local.asterisk.users, you wrote:
> 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
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users

-- 
  Matthew Harrell                          All science is either physics or
  Bit Twiddlers, Inc.                       stamp collecting.
  mharrell at bittwiddlers.com     



More information about the asterisk-users mailing list