salaheddine elharit
2011-Nov-25 15:32 UTC
[asterisk-users] hwo to stok variable wiith menu
hello list, i have created one menu like below all work without issue, what i want to do is , when the customer press 3 in menu context exten => 3,1,Goto(support,s,1) i want to stok this variable (3) in database or file instead to go to support context thanks for your help and support best regards [default] exten => 529,1,Ringing() exten => 529,2,Wait(4) exten => 529,3,Goto(accueil,s,1) [accueil] ; d?finition d?un contexte pour l?accueil exten => s,1,SetGlobalVar(sounds_path=/var/lib/asterisk/sounds/) exten => s,2,Background(${sounds_path}welcome) exten => s,3,goto(accueil,s,1) exten => #,1,Goto(menu,s,1) exten => i,1,Playback(${sounds_path}erreur-saisie) exten => i,2,goto(accueil,s,1) exten => t,1,Goto(accueil,s,1) [menu] exten => s,1,Background(${sounds_path}menu) exten => 0,1,Goto(menu,s,1) exten => 1,1,Goto(appel,s,1) exten => 2,1,Goto(message,s,1) exten => 3,1,Goto(support,s,1) exten => s,2,goto(menu,s,1) exten => i,1,Playback(${sounds_path}erreur-saisie) exten => i,2,Goto(menu,s,1) exten => t,1,Goto(menu,s,1) [appel] ; d?finition d?un contexte pour le menu d?appel exten => s,1,Background(${sounds_path}appel) exten => s,2,WaitExten(10) exten => 0,1,Goto(menu,s,1) exten => 223,1,Dial(SIP/${EXTEN},20,tr) exten => i,1,Playback(${sounds_path}erreur-saisie) exten => i,2,Goto(appel,s,1) exten => t,1,Goto(appel,s,1) [message] ; d?finition d?un contexte pour la messagerie exten => s,1,VoiceMailMain(${CALLERIDNUM}) exten => t,1,Hangup() [support] ; d?finition d?un contexte pour le support exten => s,1,GoToIfTime(09:00-17:00|mon-fri|*|*?s,4) exten => s,2,Playback(${sounds_path}no-relation-support) exten => s,3,Goto(menu,s,1) exten => s,4,Playback(${sounds_path}relation-support) exten => s,5,Queue(default) exten => t,1,Hangup() -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20111125/6bd1f05b/attachment.htm>
On 11/25/2011 09:32 AM, salaheddine elharit wrote:> hello list, > i have created one menu like below all work without issue, what i want > to do is , > when the customer press 3 in menu context exten => > 3,1,Goto(support,s,1) i want to stok this variable (3) in database or > file instead to go to support context >You can save a value to a global variable like you did within your sample dialplan, although I do not recommend this approach, you should read the note below as to why. You can save a value to a channel variable with the Set() command and use it later within the same call. You can save a value into the AstDB with the Set(${DB())) and access the value from any channel even after an Asterisk restart. You can setup ODBC, func_odbc and a database then access the variables via the functions defined within the func_odbc.conf The method you choose should be determined by your needs. Note: You set the global variable at the start of your dialplan. This global variable is available to ALL channels. If you set it for every call, you are doing so needlessly. If you have multiple applications accessing the same variable and each one sets it with a different value, you will have problems. Global variables should be used to store information needed in the majority of calls. The way you are using the global variable, I believe you may be better off removing the SetGlobalVar() call and instead set the variable in the [globals] section of extensions.conf. I hope that helps. Dale -- "The truth speaks for itself. I'm just the messenger." Lyta Alexander - Babylon 5