From 962e2996995cf9e80e1deca052a12171111ae0f2 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 5 Oct 2009 13:19:44 +0000 Subject: [PATCH] Read different asterisk context definition from file: git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14516 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../gofon/phoneaccount/class_phoneAccount.inc | 21 ++++++++++++------- .../gofon/gofon/phoneaccount/generic.tpl | 4 ++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc b/gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc index fd9adf20e..5d8c6f2b2 100644 --- a/gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc +++ b/gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc @@ -1094,7 +1094,8 @@ class phoneAccount extends plugin $smarty->assign("macro", $this->macro); /* Assign contexts */ - $smarty->assign("contexts",$this->get_asterisk_contexts()); + $smarty->assign("voicemail_contexts",$this->get_asterisk_voicemail_contexts()); + $smarty->assign("sip_contexts",$this->get_asterisk_sip_contexts()); $smarty->assign("context" ,$this->context); $smarty->assign("voice_context" ,$this->voice_context); @@ -1913,18 +1914,24 @@ class phoneAccount extends plugin /* Return asterisk contexts * Additionaly read contexts from file. */ - function get_asterisk_contexts() + function get_asterisk_voicemail_contexts() + { + return($this->get_asterisk_contexts(CONFIG_DIR."/asterisk/voicemail_context.conf")); + } + function get_asterisk_sip_contexts() + { + return($this->get_asterisk_contexts(CONFIG_DIR."/asterisk/sip_context.conf")); + } + function get_asterisk_contexts($file) { $contexts = array(); - $contexts[] = "default"; - $contexts[] = "parkedcalls"; - $contexts[] = "from-sip"; - $contexts[] = "from-capi"; - $file = "/etc/gosa/asterisk_contexts.conf"; if(file_exists($file) && is_readable($file)){ foreach(file($file) as $context){ $contexts[] = trim($context); } + }else{ + msg_dialog::display(_("Warning"), msgPool::cannotReadFile($file),WARNING_DIALOG); + $contexts[] = "default"; } array_unique($contexts); return($contexts); diff --git a/gosa-plugins/gofon/gofon/phoneaccount/generic.tpl b/gosa-plugins/gofon/gofon/phoneaccount/generic.tpl index 27b824231..f92a30751 100644 --- a/gosa-plugins/gofon/gofon/phoneaccount/generic.tpl +++ b/gosa-plugins/gofon/gofon/phoneaccount/generic.tpl @@ -71,7 +71,7 @@ {render acl=$goFonContextACL checkbox=$multiple_support checked=$use_goFonContext} {/render} @@ -82,7 +82,7 @@ {render acl=$goFonVoiceMailContextACL checkbox=$multiple_support checked=$use_goFonVoiceMailContext} {/render} -- 2.30.2