what is the best way to write dynamic menus using the agi commands. like if i want to have something like:
exten => s,n, Background(one) ; press one if you want
exten => s,n, Festival(’$joe’);
exten => s,n, Background(two) ; press 2 if you want
exten => s,n, Festival(’$jane’)
etc…
exten => 1,1,Dial($joes_number)
exten => 2.1,Dial($janes_number)
the reason for this is that the options for the menu are always different amount and it is desired to avoid writing sound files on the fly which takes seconds and it might result in a weird pause and cpu usage on a heavly used machine, wheres files like ‘one’ and ‘two’ can be predone and use festival to spell out the names…
i can write the Background/Festival sequence using the agi EXEC i guess but how do i write the options (1,1…, 2,1…, 3,1… etc)? and if i use EXEC would those Background/Festival be executed in the order they were placed by the script?!
thanks… how is that going to help compared to the agi script that already connects to mysql and gets the results back?..
i just need them presented to the dial plan in an order and put after that the possible DTMF options… how would that be done using the mysql addon - something i dont thing this particular machine has installed…
say you have your DB table look like this
company_id | menu_level | option | announcement
for the first level in the auto-attendant you may have
1001 | top | 1 | sales
1001 | top | 2 | accounts
1001 | top | 3 | service
1001 | sales-1 | 1 | quotes (sales)
1001 | sales-1 | 2 | tracking (sales)
1001 | accounts-1 | 1 | receivable (accounts)
1001 | accounts-1 | 2 | payable (accounts)
1001 | service-1 | 1 | enter your account id (service)
something like that where each tree in your auto-attendant/IVR would be the “menu_level”.
you’ll probably also need to set the channel variable for the current menu the caller is up to for the next query etc…
As for the AGI script vs dialplan MYSQL command. I’ve done work with both - i’m not a strong perl programmer yet (java & php for me) so when the job needs to be done quickly I just stick to my strengths.
I’m presuming quite a bit of what you are trying to do and it could have gone in the wrong direction slightly
this is for a list of possible numbers to dial. like if i have a db with names and numbers for a particular caller. the agi script finds them and it needs to present them to the context in the dial plan that called it so that the user will hear all the options - lets say (this time) you have 5 possible numbers to dial. so it will basically give you the five options and the opportunity to dial 1 - 5 to get to one of them. the issue is that every time you call/are been called the number of those options might change and there is no a preset.
maybe i’m not undersatnding your examples… can you elabora te please?
So, in the dialplan
exten => s,1,festival(to speak with)
exten => s,2,festival(${RESULT FROM MYSQL}) ; e.g. toshog
exten => s,3,festival(press)
exten => s,4,festival(${RESULT FROM MYSQL}) ; e.g. one
somehow loop this little part for the amount of options that you have.
you can set a variable, and check it with the $[] expressions using a GotoIf statement.
Look in the doc directory of the asterisk source. There is a file called README.variables.
It is a VERY GOOD read.
e.g.
GotoIf( $[do_your_test]?exten,pri:exten,pri)
Check out the GotoIf command on the wiki - it’s quite a handy command.
I’ve got a busy morning, so read through that and experiment for a couple of hours.
What’s your background? Programming, sys admin, or just tinkering?
not just tinkering. but i’m fiarly new to asterisk and it’s logic. i have 2 jobs and sometimes helping a friend with asterisk for the last month or so - not always have time to read through all the documentation - if it wasn’t for voip-info i’ll be totally in the dark…