[asterisk-users] Submenus

Mojo with Horan & Company, LLC mojo at horanappraisals.com
Wed Sep 6 10:17:46 MST 2006


Try breaking up the contexts. Contexts are what you call 'submenus'. 
For example:

[MetarMain]
exten => 1,1,answer
exten => 1,n,Background(Met_welcome)
exten => 1,n,Background(Met_Instructions)

exten => 3575,1,set(airport=ekrk) ; non-ambiguous
exten => 3575,n,goto(Metar_Process,s,1)

exten => 3524,1,goto(Metar_ekch_ekah,s,1) ; ambiguous, so submenu

[Metar_ekch_ekah]
exten => s,1,Background(Metar_ekch_or_ekah)
exten => s,n,WaitExten(3000)
exten => s,n,goto(1)

exten => 1,1,set(airport=ekch)
exten => 1,n,goto(Metar_Process,s,1)

exten => 2,1,set(airport=ekah)
exten => 2,n,goto(Metar_Process,s,1)

[Metar_Process]
exten => s,1,NoOP(Airport code chosen: ${airport})
exten => s,n,...

Made it up as it went along, so it could be strewn with bugs... but it 
should lead you in the right direction.

Moj

Mir wrote:
> Hello
> I'm doing an IVR-service, where pilot can check metar (airport weather
> information), they enter the 4 letter airport code on their phone, and
> get the metar read back by text-to-speech.
> 
> 
> [Metar]
> 
> exten => 1,1,answer
> 
> exten => 1,2,Background(Met_welcome)
> 
> exten => 1,3,set(airport="")2,Background(Met_welcome)
> 
> exten => 1,3,set(airport="")3,set(airport="")
> 
> exten => 1,n,Background(Met_Instructions)
> 
> (When they press an airportcode, I set a variable)
> 
> exten => 3575,1,set(airport=ekrk)
> 
> exten => 3575,n,goto(Metar,s,1)
> 
> exten => 3598,1,set(airport=ekyt)
> 
> and so on
> 
> exten => 3575,n,goto(Metar,s,1)
> 
> exten => 3598,1,set(airport=ekyt)
> 
> and so on
> 
> exten => 3598,1,set(airport=ekyt)
> 
> and so on
> In the S extension, I do all of the processing .
> My problem is that some of the airports has the same code, for
> instance EKCH wich is entered by pressing 3524, but EKAH has the same
> digits, so I need to make a sub-menu, where I can ask the caller to
> press 1 for EKCH or 2 for EKAH.
> Right now, I do like this:
> 
> 
> exten => 3524,1,background(Met_ch_bi_ah)background(Met_ch_bi_ah)
> 
> exten => 4,1,set(airport=ekch)
> 
> exten => 4,n,goto(Metar,s,1)
> 
> exten => 6,1,set(airport=ekbi)
> 
> exten => 6,n,goto(Metar,s,1)1,set(airport=ekch)
> 
> exten => 4,n,goto(Metar,s,1)
> 
> exten => 6,1,set(airport=ekbi)
> 
> exten => 6,n,goto(Metar,s,1)6,1,set(airport=ekbi)
> 
> exten => 6,n,goto(Metar,s,1)6,n,goto(Metar,s,1)
> 
> This is not a very good solution, if a user by mistake press 4 in the
> main loop, it goes right to EKCH metar, instead of informing the user
> that it is an invalid code.
> 
> So what I need is a way to make a submenu, that is only "visible" when
> needed, and can set the airport variable.
> 
> How do I do this?
> 
> 
> 
> Michael
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
> 
> !DSPAM:500,44fc4a7d289876491211187!
> 

-- 
Mojo <mojo at horanappraisals.com>
Office Manager, Horan & Company, LLC
(907) 747-6666 x112


More information about the asterisk-users mailing list