Hello. Happy New Year to everyone. I have a small WISP and would like to have customers to call our number to check their balance. I am planning on writing an AGI with php so it can get the customer info from the customer database. I don't know how to interact with the caller while in the agi script so this is what I have in mind: [test-agi] exten => 33,1,Answer() exten => 33,n,Wait(0.5) exten => 33,n,BackGround(please-enter) exten => 33,n,BackGround(customer-account) exten => 33,n, ---- I would like to set a variable here but don't know how ----- exten => 33,n,BackGround(enter-password) exten => 33,n, ---- I would like to set a variable here but don't know how ----- exten => 33,n,AGI(testphp.agi,${ACCOUNT},${PASSWORD}) ---- receive the balance here from agi ---- exten => 33,n,Verbose(".... This is agi status ...${AGISTATUS}...") exten => 33,n,hangup() I've never worked with agi but, I'm reading some documents I found online but, need more help trying to get this working. Thanks in advanced for your help.
--- On Sat, 1/2/10, Landy Landy <landysaccount at yahoo.com> wrote:> From: Landy Landy <landysaccount at yahoo.com> > Subject: [asterisk-users] Help getting info from caller > To: asterisk-users at lists.digium.com > Date: Saturday, January 2, 2010, 9:01 AM > Hello. Happy New Year to everyone. > > I have a small WISP and would like to have customers to > call our number to check their balance. I am planning on > writing an AGI with php so it can get the customer info from > the customer database. I don't know how to interact with the > caller while in the agi script so this is what I have in > mind: > > > [test-agi] > exten => 33,1,Answer() > exten => 33,n,Wait(0.5) > exten => 33,n,BackGround(please-enter) > exten => 33,n,BackGround(customer-account) > exten => 33,n, ---- I would like to set a variable here > but don't know how ----- > exten => 33,n,BackGround(enter-password) > exten => 33,n, ---- I would like to set a variable here > but don't know how ----- > exten => 33,n,AGI(testphp.agi,${ACCOUNT},${PASSWORD}) > ---- receive the balance here from agi ---- > > exten => 33,n,Verbose(".... This is agi status > ...${AGISTATUS}...") > exten => 33,n,hangup() > > I've never worked with agi but, I'm reading some documents > I found online but, need more help trying to get this > working. > > Thanks in advanced for your help. >Can I use: exten => 33,n,Set(ACCOUNT=waitexten()) ???
> Can I use: > > exten => 33,n,Set(ACCOUNT=waitexten()) ???No. Something like exten => 33,n,Read(ACCOUNT,,10) See http://www.voip-info.org/wiki/view/Asterisk+cmd+Read hth and happy new year to everyone
On Sat, Jan 2, 2010 at 9:01 AM, Landy Landy <landysaccount at yahoo.com> wrote:> Hello. Happy New Year to everyone. > > I have a small WISP and would like to have customers to call our number to > check their balance. I am planning on writing an AGI with php so it can get > the customer info from the customer database. I don't know how to interact > with the caller while in the agi script so this is what I have in mind: > > > [test-agi] > exten => 33,1,Answer() > exten => 33,n,Wait(0.5) > exten => 33,n,BackGround(please-enter) > exten => 33,n,BackGround(customer-account) > exten => 33,n, ---- I would like to set a variable here but don't know how > ----- > exten => 33,n,BackGround(enter-password) > exten => 33,n, ---- I would like to set a variable here but don't know how > ----- > exten => 33,n,AGI(testphp.agi,${ACCOUNT},${PASSWORD}) > ---- receive the balance here from agi ---- > > exten => 33,n,Verbose(".... This is agi status ...${AGISTATUS}...") > exten => 33,n,hangup() > > I've never worked with agi but, I'm reading some documents I found online > but, need more help trying to get this working. > > Thanks in advanced for your help. > >I suggest checking out both ASTCC and ASTCC. I learned a great deal by dissecting the AGI scripts and dialplan pieces. It is very helpful to watch an AGI run on the console with AGI debugging turned on. Thanks, Steve T -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100102/ca0b01fa/attachment.htm
On Sat, 2 Jan 2010, Landy Landy wrote:> I have a small WISP and would like to have customers to call our number > to check their balance. I am planning on writing an AGI with php so it > can get the customer info from the customer database. I don't know how > to interact with the caller while in the agi script so this is what I > have in mind.There are 3 approaches you could take for this: 1) You could do the entire task in dialplan. Personally, I find database access in dialplan unwieldy and ugly. 2) You could do the user interaction in dialplan and the database access in an AGI. 3) You could do the entire task in an AGI. This would be my choice because it wraps everything up into a nice little black box with a seasonal bow on top. Your dialplan then just looks like: exten = 33,n,agi(say-balance) I have nightmares about "fat-fingering" an impossible to find syntactical error into a previously working ream of dialplan with my boss watching impatiently over my shoulder, constantly reminding me how much money he is loosing per minute :)> [test-agi] > exten => 33,1,Answer() > exten => 33,n,Wait(0.5)You could "merge" these as "answer(500)."> exten => 33,n,BackGround(please-enter) > exten => 33,n,BackGround(customer-account) > exten => 33,n, ---- I would like to set a variable here but don't know how ----- > exten => 33,n,BackGround(enter-password) > exten => 33,n, ---- I would like to set a variable here but don't know how -----You could use read() or authenticate() here.> exten => 33,n,AGI(testphp.agi,${ACCOUNT},${PASSWORD}) > ---- receive the balance here from agi ----The AGI would use "set variable" to create and set the channel variable.> I've never worked with agi but, I'm reading some documents I found > online but, need more help trying to get this working.Use somebody's established and debugged library. Nobody gets it right the first time. -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000