Code

Read different asterisk context definition from file:
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 5 Oct 2009 13:19:44 +0000 (13:19 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 5 Oct 2009 13:19:44 +0000 (13:19 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14516 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc
gosa-plugins/gofon/gofon/phoneaccount/generic.tpl

index fd9adf20e9695fa9ff23a930778dc6d82c9ceba6..5d8c6f2b219c9a7e67e7cc4949bbcb4318000109 100644 (file)
@@ -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);
index 27b824231e47e87a27322e080e30d67374513a25..f92a3075115139b43b273a4990695497bb32be59 100644 (file)
@@ -71,7 +71,7 @@
      <td>
 {render acl=$goFonContextACL checkbox=$multiple_support checked=$use_goFonContext}
       <select name='context' title='{t}Select the accounts context{/t}'>
-        {html_options values=$contexts output=$contexts selected=$context}
+        {html_options values=$sip_contexts output=$sip_contexts selected=$context}
       </select>
 {/render}
      </td>
@@ -82,7 +82,7 @@
      <td>
 {render acl=$goFonVoiceMailContextACL checkbox=$multiple_support checked=$use_goFonVoiceMailContext}
       <select name='voice_context' title='{t}Select the accounts context{/t}'>
-        {html_options values=$contexts output=$contexts selected=$voice_context}
+        {html_options values=$voicemail_contexts output=$voicemail_contexts selected=$voice_context}
       </select>
 {/render}
      </td>