Пример #1
0
 /** Evaluate a boolean expression. */
 protected synchronized boolean evalBoolean(String expression) {
   try {
     this.exec("retval = " + expression);
     PyObject pyObj = this.get("retval");
     String retString = pyObj.toString();
     Debug.println("retString = " + retString);
     if (retString.equals("1")) return true;
     else return false;
   } catch (PyException ex) {
     ex.printStackTrace();
     System.exit(0);
     return false;
   }
 }
Пример #2
0
 /**
  * Run this filter on the given SIP message (represented as an array canonical headers) and return
  * true or false.
  */
 protected synchronized boolean match(SIPMessage sipMsg) {
   this.set("sipMessage", sipMsg);
   try {
     this.exec("retval = match(sipMessage)");
     PyObject pyObj = this.get("retval");
     String retString = pyObj.toString();
     if (retString.equals("1")) return true;
     else return false;
   } catch (PyException ex) {
     ex.printStackTrace();
     System.out.println("Error in filter spec. " + ex.getMessage());
     System.exit(0);
   }
   return false;
 }