Author: sayer
Date: 2010-03-05 17:40:47 +0100 (Fri, 05 Mar 2010)
New Revision: 1653

Modified:
   trunk/apps/dsm/mods/mod_py/ModPy.h
   trunk/apps/dsm/mods/mod_py/PyDSMSession.cpp
   trunk/apps/dsm/mods/mod_py/Readme.mod_py.txt
Log:
added a session.select(name) function to access select of a session.



Modified: trunk/apps/dsm/mods/mod_py/ModPy.h
===================================================================
--- trunk/apps/dsm/mods/mod_py/ModPy.h  2010-03-05 12:27:58 UTC (rev 1652)
+++ trunk/apps/dsm/mods/mod_py/ModPy.h  2010-03-05 16:40:47 UTC (rev 1653)
@@ -1,7 +1,7 @@
 /*
  * $Id$
  *
- * Copyright (C) 2009 TelTech Systems
+ * Copyright (C) 2009 IPTEGO GmbH
  *
  * This file is part of SEMS, a free SIP media server.
  *

Modified: trunk/apps/dsm/mods/mod_py/PyDSMSession.cpp
===================================================================
--- trunk/apps/dsm/mods/mod_py/PyDSMSession.cpp 2010-03-05 12:27:58 UTC (rev 
1652)
+++ trunk/apps/dsm/mods/mod_py/PyDSMSession.cpp 2010-03-05 16:40:47 UTC (rev 
1653)
@@ -29,6 +29,7 @@
 #include "PyDSMSession.h"
 #include "log.h"
 #include "DSMSession.h"
+#include "AmSession.h"
 
 extern "C" {
 
@@ -75,6 +76,42 @@
     return PyString_FromString(sess->var[varname].c_str());
   }
 
+  static PyObject* mod_py_getselect(PyObject*, PyObject* args)
+  {
+    char *varname;
+    if(!PyArg_ParseTuple(args,"s",&varname))
+      return NULL;
+
+    GET_SESS_PTR;
+
+    string res;
+
+    AmSession* sc_sess = dynamic_cast<AmSession*>(sess);
+    if (NULL == sc_sess) {
+      ERROR("Not possible to cast to session object.\n");
+      return NULL;
+    }
+  
+    if (!strcmp("local_tag", varname))
+      res = sc_sess->getLocalTag();    
+    else if (!strcmp("user", varname))
+      res = sc_sess->dlg.user;
+    else if (!strcmp("domain", varname))
+      res = sc_sess->dlg.domain;
+    else if (!strcmp("remote_tag", varname))
+      res = sc_sess->getRemoteTag();
+    else if (!strcmp("callid", varname))
+      res = sc_sess->getCallID();
+    else if (!strcmp("local_uri", varname))
+      res = sc_sess->dlg.local_uri;
+    else if (!strcmp("remote_uri", varname))
+      res = sc_sess->dlg.remote_uri;
+
+    DBG("returning '%s'\n", res.c_str());
+
+    return PyString_FromString(res.c_str());
+  }
+
   static PyObject* mod_py_seterror(PyObject*, PyObject* args)
   {
     int errno;    
@@ -301,6 +338,7 @@
   PyMethodDef session_methods[] = {
     {"setvar",   (PyCFunction)mod_py_setvar, METH_VARARGS,"set a session's 
variable"},
     {"var",      (PyCFunction)mod_py_getvar, METH_VARARGS,"get a session's 
variable"},
+    {"select",   (PyCFunction)mod_py_getselect, METH_VARARGS,"get a session's 
select"},
     {"setError", (PyCFunction)mod_py_seterror, METH_VARARGS,"set error 
(errno)"},
 
     {"playPrompt",       (PyCFunction)playPrompt, METH_VARARGS,"play a 
prompt"},

Modified: trunk/apps/dsm/mods/mod_py/Readme.mod_py.txt
===================================================================
--- trunk/apps/dsm/mods/mod_py/Readme.mod_py.txt        2010-03-05 12:27:58 UTC 
(rev 1652)
+++ trunk/apps/dsm/mods/mod_py/Readme.mod_py.txt        2010-03-05 16:40:47 UTC 
(rev 1653)
@@ -142,6 +142,9 @@
     recordFile(string name)
         start recording to a file
 
+    select(string name)
+        get a session's select
+
     setError(int errno)
         set error (errno)
 

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to