Browse code

py_sems can be used with AmSession, AmB2BSession, and AmB2ABSession now: AmSession -> derive in Python from PySemsDialog AmB2BSession -> PySemsB2BDialog AmB2ABSession -> PySemsB2ABDialog

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@290 8eb893ce-cfd4-0310-b710-fb5ebe64c474

Stefan Sayer authored on 28/03/2007 21:03:22
Showing 39 changed files
... ...
@@ -108,6 +108,7 @@ install_python_files: $(modules-prefix)/$(modules-dir)
108 108
 clean_py_sems_lib:
109 109
 	$(MAKE) -C sip/ clean
110 110
 	rm -f sip/py_sems_lib.a
111
+	rm -f py/*.pyc
111 112
 
112 113
 sip/py_sems_lib.a: 
113 114
 	$(MAKE) -C sip/ py_sems_lib.a
... ...
@@ -1,5 +1,6 @@
1 1
 /*
2 2
  * $Id: PySems.cpp,v 1.26.2.1 2005/09/02 13:47:46 rco Exp $
3
+ * 
3 4
  * Copyright (C) 2002-2003 Fhg Fokus
4 5
  *
5 6
  * This file is part of sems, a free SIP media server.
... ...
@@ -29,8 +30,14 @@
29 30
 #include "AmUtils.h"
30 31
 #include "AmPlugIn.h"
31 32
 
33
+#include "PySemsDialog.h"
34
+#include "PySemsB2BDialog.h"
35
+#include "PySemsUtils.h"
36
+
32 37
 #include "sip/sipAPIpy_sems_lib.h"
33 38
 #include "sip/sippy_sems_libPySemsDialog.h"
39
+#include "sip/sippy_sems_libPySemsB2BDialog.h"
40
+#include "sip/sippy_sems_libPySemsB2ABDialog.h"
34 41
 
35 42
 #include <unistd.h>
36 43
 #include <pthread.h>
... ...
@@ -201,7 +208,7 @@ void PySemsFactory::init_python_interpreter()
201 208
     PyEval_ReleaseLock();
202 209
 }
203 210
 
204
-PySemsDialog* PySemsFactory::newDlg(const string& name)
211
+AmSession* PySemsFactory::newDlg(const string& name)
205 212
 {
206 213
     PYLOCK;
207 214
 
... ...
@@ -231,24 +238,90 @@ PySemsDialog* PySemsFactory::newDlg(const string& name)
231 238
     }
232 239
 
233 240
     int err=0;
234
-    PySemsDialog* dlg = (PySemsDialog*)sipForceConvertTo_PySemsDialog(dlg_inst,&err);
235
-    if(!dlg || err){
236
-	
237
-	PyErr_Print();
238
-	ERROR("PySemsFactory: while loading \"%s\": could not retrieve PySemsDialog ptr.\n",
239
-	      name.c_str());
240
-	throw AmSession::Exception(500,"Internal error in PY_SEMS plug-in.");
241
-	Py_DECREF(dlg_inst);
242 241
 
243
-	return NULL;
242
+    AmSession* sess = NULL;
243
+    PySemsDialogBase* dlg_base  = NULL;
244
+
245
+    switch(mod_desc.dt) {
246
+    case PySemsScriptDesc::None: {
247
+      ERROR("wrong script type: None.\n");
248
+    }; break;
249
+    case PySemsScriptDesc::Dialog: {
250
+      PySemsDialog* dlg = (PySemsDialog*)
251
+	sipForceConvertTo_PySemsDialog(dlg_inst,&err);
252
+      sess = dlg;
253
+      dlg_base = dlg;
254
+    }; break;
255
+
256
+    case PySemsScriptDesc::B2BDialog: {
257
+      PySemsB2BDialog* b2b_dlg = (PySemsB2BDialog*)
258
+	sipForceConvertTo_PySemsB2BDialog(dlg_inst,&err);
259
+      sess = b2b_dlg;
260
+      dlg_base = b2b_dlg;
261
+    }; break;
262
+
263
+    case PySemsScriptDesc::B2ABDialog: {
264
+	PySemsB2ABDialog* b2ab_dlg = (PySemsB2ABDialog*)
265
+	  sipForceConvertTo_PySemsB2ABDialog(dlg_inst,&err);      
266
+	sess = b2ab_dlg;
267
+	dlg_base = b2ab_dlg;
268
+
269
+    }; break;
270
+    }
271
+
272
+    if (err || !dlg_base) {
273
+	  // no luck
274
+	  PyErr_Print();
275
+	  ERROR("PySemsFactory: while loading \"%s\": could not retrieve a PySems*Dialog ptr.\n",
276
+		name.c_str());
277
+	  throw AmSession::Exception(500,"Internal error in PY_SEMS plug-in.");
278
+	  Py_DECREF(dlg_inst);
279
+	  return NULL;
244 280
     }
245 281
 
282
+
283
+//     // TODO: find some way to guess the type without trying... 
284
+//     // try Dialog...
285
+//     PySemsDialog* dlg = (PySemsDialog*)sipForceConvertTo_PySemsDialog(dlg_inst,&err);
286
+//     if (dlg && (!err)) {
287
+//       DBG("OK, got PySemsDialog.\n");
288
+//       sess = dlg;
289
+//       dlg_base = dlg;
290
+//     } else {
291
+//       // try B2BDialog...
292
+//       err = 0;
293
+//       PySemsB2BDialog* b2b_dlg = (PySemsB2BDialog*)sipForceConvertTo_PySemsB2BDialog(dlg_inst,&err);
294
+//       if (b2b_dlg && (!err)) {
295
+// 	DBG("OK, got PySemsB2BDialog.\n");      
296
+// 	sess = b2b_dlg;
297
+// 	dlg_base = b2b_dlg;
298
+//       }  else {
299
+
300
+// 	// try B2ABDialog...
301
+// 	err=0;
302
+// 	PySemsB2ABDialog* b2ab_dlg = (PySemsB2ABDialog*)sipForceConvertTo_PySemsB2ABDialog(dlg_inst,&err);
303
+
304
+// // 	if (b2ab_dlg && (!err)) {
305
+// // 	  DBG("OK, got PySemsB2ABDialog.\n");      
306
+// // 	  sess = b2ab_dlg;
307
+// // 	  dlg_base = b2ab_dlg;
308
+// // 	}  else {
309
+// 	  // no luck
310
+// 	  PyErr_Print();
311
+// 	  ERROR("PySemsFactory: while loading \"%s\": could not retrieve a PySems*Dialog ptr.\n",
312
+// 		name.c_str());
313
+// 	  throw AmSession::Exception(500,"Internal error in PY_SEMS plug-in.");
314
+// 	  Py_DECREF(dlg_inst);
315
+// 	  return NULL;
316
+// 	}
317
+//       }
318
+//     }
319
+
246 320
     // take the ownership over dlg
247 321
     sipTransferTo(dlg_inst,dlg_inst);
248 322
     Py_DECREF(dlg_inst);
249
-    dlg->setPyPtrs(NULL,dlg_inst);
250
-    
251
-    return dlg;
323
+    dlg_base->setPyPtrs(NULL,dlg_inst);
324
+    return sess;
252 325
 }
253 326
 
254 327
 bool PySemsFactory::loadScript(const string& path)
... ...
@@ -256,6 +329,8 @@ bool PySemsFactory::loadScript(const string& path)
256 329
     PYLOCK;
257 330
     
258 331
     PyObject *modName,*mod,*dict, *dlg_class, *config=NULL;
332
+    PySemsScriptDesc::DialogType dt = PySemsScriptDesc::None;
333
+
259 334
 
260 335
     modName = PyString_FromString(path.c_str());
261 336
     mod     = PyImport_Import(modName);
... ...
@@ -288,9 +363,17 @@ bool PySemsFactory::loadScript(const string& path)
288 363
     }
289 364
 
290 365
     Py_INCREF(dlg_class);
291
-
292
-    if(!PyObject_IsSubclass(dlg_class,(PyObject *)sipClass_PySemsDialog)){
293
-
366
+    
367
+    if(PyObject_IsSubclass(dlg_class,(PyObject *)sipClass_PySemsDialog)) {
368
+      dt = PySemsScriptDesc::Dialog;
369
+      DBG("Loaded a Dialog Script.\n");
370
+    } else if (PyObject_IsSubclass(dlg_class,(PyObject *)sipClass_PySemsB2BDialog)) {
371
+      DBG("Loaded a B2BDialog Script.\n");
372
+      dt = PySemsScriptDesc::B2BDialog;
373
+    } else if (PyObject_IsSubclass(dlg_class,(PyObject *)sipClass_PySemsB2ABDialog)) {
374
+      DBG("Loaded a B2ABDialog Script.\n");
375
+      dt = PySemsScriptDesc::B2ABDialog;
376
+    } else {
294 377
 	WARN("PySemsFactory: in \"%s\": PySemsScript is not a "
295 378
 	     "subtype of PySemsDialog\n", path.c_str());
296 379
 
... ...
@@ -319,7 +402,7 @@ bool PySemsFactory::loadScript(const string& path)
319 402
     PyObject_SetAttrString(mod,"config",config);
320 403
 
321 404
     mod_reg.insert(make_pair(path,
322
-			     PySemsScriptDesc(mod,dlg_class)));
405
+			     PySemsScriptDesc(mod,dlg_class, dt)));
323 406
 
324 407
     return true;
325 408
 
... ...
@@ -427,100 +510,26 @@ AmSession* PySemsFactory::onInvite(const AmSipRequest& req)
427 510
 	return newDlg(req.user);
428 511
 }
429 512
 
430
-PySemsDialog::PySemsDialog()
431
-    : py_mod(NULL),
432
-      py_dlg(NULL),
433
-      playlist(this),
434
-      user_timer(NULL)
513
+// PySemsDialogBase - base class for all possible PySemsDialog classes
514
+PySemsDialogBase::PySemsDialogBase() 
515
+  :  py_mod(NULL), 
516
+     py_dlg(NULL)
435 517
 {
436
-    sip_relay_only = false;
437 518
 }
438 519
 
439
-PySemsDialog::PySemsDialog(AmDynInvoke* user_timer)
440
-    : py_mod(NULL), 
441
-      py_dlg(NULL),
442
-      playlist(this),
443
-      user_timer(user_timer)
444
-{
445
-    sip_relay_only = false;
446
-}
447
-
448
-
449
-PySemsDialog::~PySemsDialog()
450
-{
520
+PySemsDialogBase::~PySemsDialogBase() {
451 521
     PYLOCK;
452 522
     Py_XDECREF(py_dlg);
453 523
 }
454 524
 
455
-void PySemsDialog::setPyPtrs(PyObject *mod, PyObject *dlg)
525
+void PySemsDialogBase::setPyPtrs(PyObject *mod, PyObject *dlg)
456 526
 {
457 527
     PYLOCK;
458 528
     Py_XDECREF(py_dlg);
459 529
     py_dlg = dlg;
460 530
 }
461 531
 
462
-static PyObject *
463
-type_error(const char *msg)
464
-{
465
-        PyErr_SetString(PyExc_TypeError, msg);
466
-        return NULL;
467
-}
468
-
469
-static PyObject *
470
-null_error(void)
471
-{
472
-        if (!PyErr_Occurred())
473
-                PyErr_SetString(PyExc_SystemError,
474
-                                "null argument to internal routine");
475
-        return NULL;
476
-}
477
-
478
-PyObject *
479
-PyObject_VaCallMethod(PyObject *o, char *name, char *format, va_list va)
480
-{
481
-        PyObject *args, *func = 0, *retval;
482
-
483
-        if (o == NULL || name == NULL)
484
-                return null_error();
485
-
486
-        func = PyObject_GetAttrString(o, name);
487
-        if (func == NULL) {
488
-                PyErr_SetString(PyExc_AttributeError, name);
489
-                return 0;
490
-        }
491
-
492
-        if (!PyCallable_Check(func))
493
-                return type_error("call of non-callable attribute");
494
-
495
-        if (format && *format) {
496
-                args = Py_VaBuildValue(format, va);
497
-        }
498
-        else
499
-                args = PyTuple_New(0);
500
-
501
-        if (!args)
502
-                return NULL;
503
-
504
-        if (!PyTuple_Check(args)) {
505
-                PyObject *a;
506
-
507
-                a = PyTuple_New(1);
508
-                if (a == NULL)
509
-                        return NULL;
510
-                if (PyTuple_SetItem(a, 0, args) < 0)
511
-                        return NULL;
512
-                args = a;
513
-        }
514
-
515
-        retval = PyObject_Call(func, args, NULL);
516
-
517
-        Py_DECREF(args);
518
-        Py_DECREF(func);
519
-
520
-        return retval;
521
-}
522
-
523
-bool PySemsDialog::callPyEventHandler(char* name, char* fmt, ...)
532
+bool PySemsDialogBase::callPyEventHandler(char* name, char* fmt, ...)
524 533
 {
525 534
     bool ret=false;
526 535
     va_list va;
... ...
@@ -552,35 +561,3 @@ bool PySemsDialog::callPyEventHandler(char* name, char* fmt, ...)
552 561
     
553 562
     return ret;
554 563
 }
555
-
556
-void PySemsDialog::onSessionStart(const AmSipRequest& req)
557
-{
558
-    DBG("PySemsDialog::onSessionStart\n");
559
-    setInOut(&playlist,&playlist);
560
-    AmB2BCallerSession::onSessionStart(req);
561
-}
562
-
563
-void PySemsDialog::process(AmEvent* event) 
564
-{
565
-    DBG("PySemsDialog::process\n");
566
-
567
-    AmAudioEvent* audio_event = dynamic_cast<AmAudioEvent*>(event);
568
-    if(audio_event && audio_event->event_id == AmAudioEvent::noAudio){
569
-
570
-	callPyEventHandler("onEmptyQueue", NULL);
571
-	event->processed = true;
572
-    }
573
-    
574
-    AmPluginEvent* plugin_event = dynamic_cast<AmPluginEvent*>(event);
575
-    if(plugin_event && plugin_event->name == "timer_timeout") {
576
-
577
-	callPyEventHandler("onTimer", "i", plugin_event->data.get(0).asInt());
578
-	event->processed = true;
579
-    }
580
-
581
-    if (!event->processed)
582
-      AmB2BCallerSession::process(event);
583
-
584
-    return;
585
-}
586
-
... ...
@@ -1,5 +1,6 @@
1 1
 /*
2 2
  * $Id: PySems.h,v 1.15.2.1 2005/09/02 13:47:46 rco Exp $
3
+ * 
3 4
  * Copyright (C) 2002-2003 Fhg Fokus
4 5
  *
5 6
  * This file is part of sems, a free SIP media server.
... ...
@@ -38,27 +39,39 @@
38 39
 using std::string;
39 40
 using std::map;
40 41
 
41
-class PySemsDialog;
42
+class PySemsDialogBase;
42 43
 
43 44
 struct PySemsScriptDesc
44 45
 {
46
+    enum DialogType {
47
+      None = 0,
48
+      Dialog,
49
+      B2BDialog,
50
+      B2ABDialog
51
+    };
52
+
45 53
     PyObject* mod;
46 54
     PyObject* dlg_class;
55
+    DialogType dt;
47 56
 
48 57
     PySemsScriptDesc()
49 58
 	: mod(0), 
50
-	  dlg_class(0)
59
+          dlg_class(0),
60
+          dt(None)
51 61
     {}
52 62
 
53 63
     PySemsScriptDesc(const PySemsScriptDesc& d)
54 64
 	: mod(d.mod), 
55
-	  dlg_class(d.dlg_class)
65
+       dlg_class(d.dlg_class),
66
+       dt(d.dt)
56 67
     {}
57 68
 
58 69
     PySemsScriptDesc(PyObject* mod, 
59
-		  PyObject* dlg_class)
70
+		     PyObject* dlg_class,
71
+		     DialogType dt)
60 72
 	: mod(mod),
61
-	  dlg_class(dlg_class)
73
+          dlg_class(dlg_class),
74
+          dt(dt)
62 75
     {}
63 76
 };
64 77
 
... ...
@@ -87,7 +100,7 @@ class PySemsFactory: public AmSessionFactory
87 100
     void setScriptPath(const string& path);
88 101
     bool checkCfg();
89 102
 
90
-    PySemsDialog* newDlg(const string& name);
103
+    AmSession* newDlg(const string& name);
91 104
     
92 105
  public:
93 106
     PySemsFactory(const string& _app_name);
... ...
@@ -96,30 +109,19 @@ class PySemsFactory: public AmSessionFactory
96 109
     AmSession* onInvite(const AmSipRequest& req);
97 110
 };
98 111
 
99
-
100
-class PySemsDialog : public AmB2BCallerSession
101
-{
112
+class PySemsDialogBase {
102 113
     PyObject  *py_mod;
103 114
     PyObject  *py_dlg;
104 115
 
116
+ protected:
105 117
     bool callPyEventHandler(char* name, char* fmt, ...);
106 118
 
107
-public:
108
-    AmDynInvoke* user_timer;
109
-    AmPlaylist playlist;
110
-
111
-    PySemsDialog();
112
-    PySemsDialog(AmDynInvoke* user_timer);
113
-    ~PySemsDialog();
119
+ public:
120
+    PySemsDialogBase();
121
+    ~PySemsDialogBase();
114 122
 
115 123
     // must be called before everything else.
116 124
     void setPyPtrs(PyObject *mod, PyObject *dlg);
117
-    
118
-    void onSessionStart(const AmSipRequest& req);
119
-
120
-    // @see AmEventHandler
121
-    void process(AmEvent* event);
122
-
123 125
 };
124 126
 
125 127
 #endif
126 128
new file mode 100644
... ...
@@ -0,0 +1,70 @@
1
+/*
2
+ * $Id: PySemsDialog.h,v 1.26.2.1 2005/09/02 13:47:46 rco Exp $
3
+ * 
4
+ * Copyright (C) 2006 iptego GmbH
5
+ *
6
+ * This file is part of sems, a free SIP media server.
7
+ *
8
+ * This program is free software; you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation; either version 2 of the License, or
11
+ * (at your option) any later version
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
+ */
22
+#include "PySemsB2ABDialog.h"
23
+#include "PySemsUtils.h"
24
+PySemsB2ABDialog::PySemsB2ABDialog()
25
+    : playlist(this),
26
+      user_timer(NULL)
27
+{
28
+}
29
+
30
+PySemsB2ABDialog::PySemsB2ABDialog(AmDynInvoke* user_timer)
31
+    : playlist(this),
32
+      user_timer(user_timer)
33
+{
34
+}
35
+
36
+PySemsB2ABDialog::~PySemsB2ABDialog()
37
+{
38
+}
39
+
40
+void PySemsB2ABDialog::onSessionStart(const AmSipRequest& req)
41
+{
42
+    DBG("PySemsB2ABDialog::onSessionStart\n");
43
+    setInOut(&playlist,&playlist);
44
+    AmB2ABCallerSession::onSessionStart(req);
45
+}
46
+
47
+void PySemsB2ABDialog::process(AmEvent* event) 
48
+{
49
+    DBG("PySemsB2ABDialog::process\n");
50
+
51
+    AmAudioEvent* audio_event = dynamic_cast<AmAudioEvent*>(event);
52
+    if(audio_event && audio_event->event_id == AmAudioEvent::noAudio){
53
+
54
+	callPyEventHandler("onEmptyQueue", NULL);
55
+	event->processed = true;
56
+    }
57
+    
58
+    AmPluginEvent* plugin_event = dynamic_cast<AmPluginEvent*>(event);
59
+    if(plugin_event && plugin_event->name == "timer_timeout") {
60
+
61
+	callPyEventHandler("onTimer", "i", plugin_event->data.get(0).asInt());
62
+	event->processed = true;
63
+    }
64
+
65
+    if (!event->processed)
66
+      AmB2ABCallerSession::process(event);
67
+
68
+    return;
69
+}
70
+
0 71
new file mode 100644
... ...
@@ -0,0 +1,47 @@
1
+/*
2
+ * $Id: PySemsDialog.h,v 1.26.2.1 2005/09/02 13:47:46 rco Exp $
3
+ * 
4
+ * Copyright (C) 2006 iptego GmbH
5
+ *
6
+ * This file is part of sems, a free SIP media server.
7
+ *
8
+ * This program is free software; you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation; either version 2 of the License, or
11
+ * (at your option) any later version
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
+ */
22
+#ifndef PY_SEMSB2ABDIALOG_H
23
+#define PY_SEMSB2ABDIALOG_H
24
+
25
+#include "AmApi.h"
26
+#include "AmB2ABSession.h"
27
+#include "AmPlaylist.h"
28
+#include "PySems.h"
29
+
30
+class PySemsB2ABDialog : public AmB2ABCallerSession, 
31
+  public PySemsDialogBase
32
+{
33
+public:
34
+    AmDynInvoke* user_timer;
35
+    AmPlaylist playlist;
36
+
37
+    PySemsB2ABDialog();
38
+    PySemsB2ABDialog(AmDynInvoke* user_timer);
39
+    ~PySemsB2ABDialog();
40
+
41
+    void onSessionStart(const AmSipRequest& req);
42
+
43
+    // @see AmEventHandler
44
+    void process(AmEvent* event);
45
+};
46
+
47
+#endif
0 48
new file mode 100644
... ...
@@ -0,0 +1,73 @@
1
+/*
2
+ * $Id: PySemsDialog.h,v 1.26.2.1 2005/09/02 13:47:46 rco Exp $
3
+ * 
4
+ * Copyright (C) 2002-2003 Fhg Fokus
5
+ * Copyright (C) 2006 iptego GmbH
6
+ *
7
+ * This file is part of sems, a free SIP media server.
8
+ *
9
+ * This program is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program; if not, write to the Free Software
21
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
+ */
23
+#include "PySemsB2BDialog.h"
24
+#include "PySemsUtils.h"
25
+PySemsB2BDialog::PySemsB2BDialog()
26
+    : playlist(this),
27
+      user_timer(NULL)
28
+{
29
+    sip_relay_only = false;
30
+}
31
+
32
+PySemsB2BDialog::PySemsB2BDialog(AmDynInvoke* user_timer)
33
+    : playlist(this),
34
+      user_timer(user_timer)
35
+{
36
+    sip_relay_only = false;
37
+}
38
+
39
+PySemsB2BDialog::~PySemsB2BDialog()
40
+{
41
+}
42
+
43
+void PySemsB2BDialog::onSessionStart(const AmSipRequest& req)
44
+{
45
+    DBG("PySemsB2BDialog::onSessionStart\n");
46
+    setInOut(&playlist,&playlist);
47
+    AmB2BCallerSession::onSessionStart(req);
48
+}
49
+
50
+void PySemsB2BDialog::process(AmEvent* event) 
51
+{
52
+    DBG("PySemsB2BDialog::process\n");
53
+
54
+    AmAudioEvent* audio_event = dynamic_cast<AmAudioEvent*>(event);
55
+    if(audio_event && audio_event->event_id == AmAudioEvent::noAudio){
56
+
57
+	callPyEventHandler("onEmptyQueue", NULL);
58
+	event->processed = true;
59
+    }
60
+    
61
+    AmPluginEvent* plugin_event = dynamic_cast<AmPluginEvent*>(event);
62
+    if(plugin_event && plugin_event->name == "timer_timeout") {
63
+
64
+	callPyEventHandler("onTimer", "i", plugin_event->data.get(0).asInt());
65
+	event->processed = true;
66
+    }
67
+
68
+    if (!event->processed)
69
+      AmB2BCallerSession::process(event);
70
+
71
+    return;
72
+}
73
+
0 74
new file mode 100644
... ...
@@ -0,0 +1,48 @@
1
+/*
2
+ * $Id: PySemsDialog.h,v 1.26.2.1 2005/09/02 13:47:46 rco Exp $
3
+ * 
4
+ * Copyright (C) 2002-2003 Fhg Fokus
5
+ * Copyright (C) 2006 iptego GmbH
6
+ *
7
+ * This file is part of sems, a free SIP media server.
8
+ *
9
+ * This program is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program; if not, write to the Free Software
21
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
+ */
23
+#ifndef PY_SEMSB2BDIALOG_H
24
+#define PY_SEMSB2BDIALOG_H
25
+
26
+#include "AmApi.h"
27
+#include "AmB2BSession.h"
28
+#include "AmPlaylist.h"
29
+#include "PySems.h"
30
+
31
+class PySemsB2BDialog : public AmB2BCallerSession, 
32
+  public PySemsDialogBase
33
+{
34
+public:
35
+    AmDynInvoke* user_timer;
36
+    AmPlaylist playlist;
37
+
38
+    PySemsB2BDialog();
39
+    PySemsB2BDialog(AmDynInvoke* user_timer);
40
+    ~PySemsB2BDialog();
41
+
42
+    void onSessionStart(const AmSipRequest& req);
43
+
44
+    // @see AmEventHandler
45
+    void process(AmEvent* event);
46
+};
47
+
48
+#endif
0 49
new file mode 100644
... ...
@@ -0,0 +1,75 @@
1
+/*
2
+ * $Id: PySemsDialog.cpp,v 1.26.2.1 2005/09/02 13:47:46 rco Exp $
3
+ * 
4
+ * Copyright (C) 2002-2003 Fhg Fokus
5
+ * Copyright (C) 2006 iptego GmbH
6
+ *
7
+ * This file is part of sems, a free SIP media server.
8
+ *
9
+ * This program is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program; if not, write to the Free Software
21
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
+ */
23
+#include "PySemsDialog.h"
24
+#include "PySemsUtils.h"
25
+
26
+PySemsDialog::PySemsDialog()
27
+    : playlist(this),
28
+      user_timer(NULL)
29
+{
30
+}
31
+
32
+PySemsDialog::PySemsDialog(AmDynInvoke* user_timer)
33
+    : playlist(this),
34
+      user_timer(user_timer)
35
+{
36
+}
37
+
38
+
39
+PySemsDialog::~PySemsDialog()
40
+{
41
+}
42
+
43
+
44
+
45
+void PySemsDialog::onSessionStart(const AmSipRequest& req)
46
+{
47
+    DBG("PySemsDialog::onSessionStart\n");
48
+    setInOut(&playlist,&playlist);
49
+    AmSession::onSessionStart(req);
50
+}
51
+
52
+void PySemsDialog::process(AmEvent* event) 
53
+{
54
+    DBG("PySemsDialog::process\n");
55
+
56
+    AmAudioEvent* audio_event = dynamic_cast<AmAudioEvent*>(event);
57
+    if(audio_event && audio_event->event_id == AmAudioEvent::noAudio){
58
+
59
+	callPyEventHandler("onEmptyQueue", NULL);
60
+	event->processed = true;
61
+    }
62
+    
63
+    AmPluginEvent* plugin_event = dynamic_cast<AmPluginEvent*>(event);
64
+    if(plugin_event && plugin_event->name == "timer_timeout") {
65
+
66
+	callPyEventHandler("onTimer", "i", plugin_event->data.get(0).asInt());
67
+	event->processed = true;
68
+    }
69
+
70
+    if (!event->processed)
71
+      AmSession::process(event);
72
+
73
+    return;
74
+}
75
+
0 76
new file mode 100644
... ...
@@ -0,0 +1,52 @@
1
+/*
2
+ * $Id: PySemsDialog.h,v 1.26.2.1 2005/09/02 13:47:46 rco Exp $
3
+ * 
4
+ * Copyright (C) 2002-2003 Fhg Fokus
5
+ * Copyright (C) 2006 iptego GmbH
6
+ *
7
+ * This file is part of sems, a free SIP media server.
8
+ *
9
+ * This program is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program; if not, write to the Free Software
21
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
+ */
23
+#ifndef PY_SEMS_DIALOG_H
24
+#define PY_SEMS_DIALOG_H
25
+
26
+#include <Python.h>
27
+
28
+#include "AmSession.h"
29
+#include "AmApi.h"
30
+#include "AmPlaylist.h"
31
+#include "PySems.h"
32
+
33
+class PySemsDialog  :  public AmSession, 
34
+		       public PySemsDialogBase
35
+{
36
+
37
+public:
38
+    AmDynInvoke* user_timer;
39
+    AmPlaylist playlist;
40
+
41
+    PySemsDialog();
42
+    PySemsDialog(AmDynInvoke* user_timer);
43
+    ~PySemsDialog();
44
+
45
+    void onSessionStart(const AmSipRequest& req);
46
+
47
+    // @see AmEventHandler
48
+    void process(AmEvent* event);
49
+
50
+};
51
+
52
+#endif
0 53
new file mode 100644
... ...
@@ -0,0 +1,84 @@
1
+/*
2
+ * $Id: PySemsUtils.h,v 1.26.2.1 2005/09/02 13:47:46 rco Exp $
3
+ * 
4
+ * Copyright (C) 2002-2003 Fhg Fokus
5
+ *
6
+ * This file is part of sems, a free SIP media server.
7
+ *
8
+ * This program is free software; you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation; either version 2 of the License, or
11
+ * (at your option) any later version
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
+ */
22
+
23
+#include "PySemsUtils.h"
24
+
25
+PyObject *
26
+type_error(const char *msg)
27
+{
28
+        PyErr_SetString(PyExc_TypeError, msg);
29
+        return NULL;
30
+}
31
+
32
+PyObject *
33
+null_error(void)
34
+{
35
+        if (!PyErr_Occurred())
36
+                PyErr_SetString(PyExc_SystemError,
37
+                                "null argument to internal routine");
38
+        return NULL;
39
+}
40
+
41
+PyObject *
42
+PyObject_VaCallMethod(PyObject *o, char *name, char *format, va_list va)
43
+{
44
+        PyObject *args, *func = 0, *retval;
45
+
46
+        if (o == NULL || name == NULL)
47
+                return null_error();
48
+
49
+        func = PyObject_GetAttrString(o, name);
50
+        if (func == NULL) {
51
+                PyErr_SetString(PyExc_AttributeError, name);
52
+                return 0;
53
+        }
54
+
55
+        if (!PyCallable_Check(func))
56
+                return type_error("call of non-callable attribute");
57
+
58
+        if (format && *format) {
59
+                args = Py_VaBuildValue(format, va);
60
+        }
61
+        else
62
+                args = PyTuple_New(0);
63
+
64
+        if (!args)
65
+                return NULL;
66
+
67
+        if (!PyTuple_Check(args)) {
68
+                PyObject *a;
69
+
70
+                a = PyTuple_New(1);
71
+                if (a == NULL)
72
+                        return NULL;
73
+                if (PyTuple_SetItem(a, 0, args) < 0)
74
+                        return NULL;
75
+                args = a;
76
+        }
77
+
78
+        retval = PyObject_Call(func, args, NULL);
79
+
80
+        Py_DECREF(args);
81
+        Py_DECREF(func);
82
+
83
+        return retval;
84
+}
0 85
new file mode 100644
... ...
@@ -0,0 +1,31 @@
1
+/*
2
+ * $Id: PySemsUtils.h,v 1.26.2.1 2005/09/02 13:47:46 rco Exp $
3
+ * 
4
+ * Copyright (C) 2002-2003 Fhg Fokus
5
+ *
6
+ * This file is part of sems, a free SIP media server.
7
+ *
8
+ * This program is free software; you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation; either version 2 of the License, or
11
+ * (at your option) any later version
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
+ */
22
+#ifndef PY_SEMS_UTILS_H
23
+#define PY_SEMS_UTILS_H
24
+
25
+#include <Python.h>
26
+
27
+PyObject * type_error(const char *msg);
28
+PyObject * null_error(void);
29
+PyObject * PyObject_VaCallMethod(PyObject *o, char *name, char *format, va_list va);
30
+
31
+#endif
... ...
@@ -1,6 +1,6 @@
1 1
 TARGET = py_sems_lib.so
2
-OFILES = sippy_sems_libcmodule.o sippy_sems_libPySemsDialog.o sippy_sems_libAmAudioFile.o sippy_sems_libAmAudioEvent.o sippy_sems_libAmEvent.o sippy_sems_libAmSipDialog.o sippy_sems_libAmSipReply.o sippy_sems_libAmSipRequest.o sippy_sems_libstring.o
3
-HFILES = sipAPIpy_sems_lib.h sippy_sems_libPySemsDialog.h sippy_sems_libAmAudioFile.h sippy_sems_libAmAudioEvent.h sippy_sems_libAmEvent.h sippy_sems_libAmSipDialog.h sippy_sems_libAmSipReply.h sippy_sems_libAmSipRequest.h sippy_sems_libstring.h 
2
+OFILES = sippy_sems_libcmodule.o sippy_sems_libPySemsB2ABDialog.o sippy_sems_libPySemsB2BDialog.o sippy_sems_libPySemsDialog.o sippy_sems_libAmAudioFile.o sippy_sems_libAmAudioEvent.o sippy_sems_libAmEvent.o sippy_sems_libAmSipDialog.o sippy_sems_libAmSipReply.o sippy_sems_libAmSipRequest.o sippy_sems_libstring.o
3
+HFILES = sipAPIpy_sems_lib.h sippy_sems_libPySemsB2ABDialog.h sippy_sems_libPySemsB2BDialog.h sippy_sems_libPySemsDialog.h sippy_sems_libAmAudioFile.h sippy_sems_libAmAudioEvent.h sippy_sems_libAmEvent.h sippy_sems_libAmSipDialog.h sippy_sems_libAmSipReply.h sippy_sems_libAmSipRequest.h sippy_sems_libstring.h 
4 4
 
5 5
 CC = gcc
6 6
 CXX = g++
... ...
@@ -42,6 +42,8 @@ install: $(TARGET)
42 42
 clean:
43 43
 	-rm -f $(TARGET)
44 44
 	-rm -f sippy_sems_libcmodule.o
45
+	-rm -f sippy_sems_libPySemsB2ABDialog.o
46
+	-rm -f sippy_sems_libPySemsB2BDialog.o
45 47
 	-rm -f sippy_sems_libPySemsDialog.o
46 48
 	-rm -f sippy_sems_libAmAudioFile.o
47 49
 	-rm -f sippy_sems_libAmAudioEvent.o
48 50
new file mode 100644
... ...
@@ -0,0 +1,43 @@
1
+
2
+
3
+class PySemsB2ABDialog
4
+{
5
+%TypeHeaderCode
6
+#include "../PySemsB2ABDialog.h"
7
+%End
8
+
9
+public:
10
+
11
+    AmSipDialog dlg;
12
+
13
+    PySemsB2ABDialog();
14
+
15
+    virtual ~PySemsB2ABDialog();
16
+%MethodCode
17
+    fprintf(stderr,"------------- dealloc_PySemsB2ABDialog ----------\n");
18
+%End
19
+
20
+    int acceptAudio(const string& /* body */,
21
+		    const string& /* hdrs */,
22
+		    string* /Out/ /* sdp_reply */);
23
+
24
+    void setStopped();
25
+
26
+    virtual void onInvite(const AmSipRequest& /* req */);
27
+    virtual void onSessionStart(const AmSipRequest& /* req */);
28
+    virtual void onCancel();
29
+
30
+    virtual void onBye(const AmSipRequest& /* req */);
31
+    virtual void onDtmf(int /* event */, int /* duration_msec */);
32
+
33
+
34
+    void setInput(AmAudioFile* /In/ /*in*/);
35
+    void setOutput(AmAudioFile* /In/ /*out*/);
36
+    void setInOut(AmAudioFile* /In/ /*in*/, AmAudioFile* /*out*/);
37
+
38
+    virtual void process(AmEvent* /*In,Out*/);
39
+
40
+
41
+private:
42
+    PySemsB2ABDialog(const PySemsB2ABDialog&);
43
+};
0 44
new file mode 100644
... ...
@@ -0,0 +1,43 @@
1
+
2
+
3
+class PySemsB2BDialog
4
+{
5
+%TypeHeaderCode
6
+#include "../PySemsB2BDialog.h"
7
+%End
8
+
9
+public:
10
+
11
+    AmSipDialog dlg;
12
+
13
+    PySemsB2BDialog();
14
+
15
+    virtual ~PySemsB2BDialog();
16
+%MethodCode
17
+    fprintf(stderr,"------------- dealloc_PySemsB2BDialog ----------\n");
18
+%End
19
+
20
+    int acceptAudio(const string& /* body */,
21
+		    const string& /* hdrs */,
22
+		    string* /Out/ /* sdp_reply */);
23
+
24
+    void setStopped();
25
+
26
+    virtual void onInvite(const AmSipRequest& /* req */);
27
+    virtual void onSessionStart(const AmSipRequest& /* req */);
28
+    virtual void onCancel();
29
+
30
+    virtual void onBye(const AmSipRequest& /* req */);
31
+    virtual void onDtmf(int /* event */, int /* duration_msec */);
32
+
33
+
34
+    void setInput(AmAudioFile* /In/ /*in*/);
35
+    void setOutput(AmAudioFile* /In/ /*out*/);
36
+    void setInOut(AmAudioFile* /In/ /*in*/, AmAudioFile* /*out*/);
37
+
38
+    virtual void process(AmEvent* /*In,Out*/);
39
+
40
+
41
+private:
42
+    PySemsB2BDialog(const PySemsB2BDialog&);
43
+};
... ...
@@ -3,7 +3,7 @@
3 3
 class PySemsDialog
4 4
 {
5 5
 %TypeHeaderCode
6
-#include "../PySems.h"
6
+#include "../PySemsDialog.h"
7 7
 %End
8 8
 
9 9
 public:
... ...
@@ -1,3 +1,3 @@
1 1
 target = py_sems_lib
2
-sources = sippy_sems_libcmodule.cpp sippy_sems_libPySemsDialog.cpp sippy_sems_libAmAudioFile.cpp sippy_sems_libAmAudioEvent.cpp sippy_sems_libAmEvent.cpp sippy_sems_libAmSipDialog.cpp sippy_sems_libAmSipReply.cpp sippy_sems_libAmSipRequest.cpp sippy_sems_libstring.cpp
3
-headers = sipAPIpy_sems_lib.h sippy_sems_libPySemsDialog.h sippy_sems_libAmAudioFile.h sippy_sems_libAmAudioEvent.h sippy_sems_libAmEvent.h sippy_sems_libAmSipDialog.h sippy_sems_libAmSipReply.h sippy_sems_libAmSipRequest.h sippy_sems_libstring.h
2
+sources = sippy_sems_libcmodule.cpp sippy_sems_libPySemsB2ABDialog.cpp sippy_sems_libPySemsB2BDialog.cpp sippy_sems_libPySemsDialog.cpp sippy_sems_libAmAudioFile.cpp sippy_sems_libAmAudioEvent.cpp sippy_sems_libAmEvent.cpp sippy_sems_libAmSipDialog.cpp sippy_sems_libAmSipReply.cpp sippy_sems_libAmSipRequest.cpp sippy_sems_libstring.cpp
3
+headers = sipAPIpy_sems_lib.h sippy_sems_libPySemsB2ABDialog.h sippy_sems_libPySemsB2BDialog.h sippy_sems_libPySemsDialog.h sippy_sems_libAmAudioFile.h sippy_sems_libAmAudioEvent.h sippy_sems_libAmEvent.h sippy_sems_libAmSipDialog.h sippy_sems_libAmSipReply.h sippy_sems_libAmSipRequest.h sippy_sems_libstring.h
... ...
@@ -6,4 +6,6 @@
6 6
 %Include AmSipDialog.sip
7 7
 %Include AmAudio.sip
8 8
 %Include PySemsDialog.sip
9
+%Include PySemsB2BDialog.sip
10
+%Include PySemsB2ABDialog.sip
9 11
 %Include AmUtils.sip
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Internal module API header file.
3 3
  *
4
- * Generated by SIP 4.5.2 (4.5.2) on Tue Feb 20 15:24:56 2007
4
+ * Generated by SIP 4.5.2 (4.5.2) on Wed Mar 28 22:59:14 2007
5 5
  */
6 6
 
7 7
 #ifndef _py_sems_libAPI_H
... ...
@@ -19,6 +19,8 @@
19 19
  * These are part of the public API.
20 20
  */
21 21
 
22
+#define sipName_PySemsB2ABDialog  sipNm_py_sems_lib_PySemsB2ABDialog
23
+#define sipName_PySemsB2BDialog  sipNm_py_sems_lib_PySemsB2BDialog
22 24
 #define sipName_PySemsDialog  sipNm_py_sems_lib_PySemsDialog
23 25
 #define sipName_AmAudioFile  sipNm_py_sems_lib_AmAudioFile
24 26
 #define sipName_AmAudioEvent  sipNm_py_sems_lib_AmAudioEvent
... ...
@@ -107,6 +109,8 @@
107 109
 
108 110
 /* The strings used by this module. */
109 111
 extern char sipNm_py_sems_lib_get_header_param[];
112
+extern char sipNm_py_sems_lib_PySemsB2ABDialog[];
113
+extern char sipNm_py_sems_lib_PySemsB2BDialog[];
110 114
 extern char sipNm_py_sems_lib_process[];
111 115
 extern char sipNm_py_sems_lib_setInOut[];
112 116
 extern char sipNm_py_sems_lib_setOutput[];
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Interface wrapper code.
3 3
  *
4
- * Generated by SIP 4.5.2 (4.5.2) on Tue Feb 20 15:24:56 2007
4
+ * Generated by SIP 4.5.2 (4.5.2) on Wed Mar 28 22:59:14 2007
5 5
  */
6 6
 
7 7
 #include "sipAPIpy_sems_lib.h"
... ...
@@ -126,7 +126,7 @@ static void *forceConvertTo_AmAudioEvent(PyObject *valobj,int *iserrp)
126 126
 
127 127
 
128 128
 /* Define this type's super-types. */
129
-static sipEncodedClassDef supers_AmAudioEvent[] = {{2, 255, 1}};
129
+static sipEncodedClassDef supers_AmAudioEvent[] = {{4, 255, 1}};
130 130
 
131 131
 static sipEnumMemberDef enummembers_AmAudioEvent[] = {
132 132
     {sipNm_py_sems_lib_cleared, AmAudioEvent::cleared, 1},
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Interface header file.
3 3
  *
4
- * Generated by SIP 4.5.2 (4.5.2) on Tue Feb 20 15:24:56 2007
4
+ * Generated by SIP 4.5.2 (4.5.2) on Wed Mar 28 22:59:14 2007
5 5
  */
6 6
 
7 7
 #ifndef _py_sems_libAmAudioEvent_h
... ...
@@ -11,7 +11,7 @@
11 11
 #include "../../../core/AmAudio.h"
12 12
 #line 13 "sippy_sems_libAmAudioEvent.h"
13 13
 
14
-#define sipClass_AmAudioEvent             sipModuleAPI_py_sems_lib.em_types[3]
14
+#define sipClass_AmAudioEvent             sipModuleAPI_py_sems_lib.em_types[5]
15 15
 #define sipCast_AmAudioEvent              sipType_py_sems_lib_AmAudioEvent.td_cast
16 16
 #define sipForceConvertTo_AmAudioEvent    sipType_py_sems_lib_AmAudioEvent.td_fcto
17 17
 
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Interface wrapper code.
3 3
  *
4
- * Generated by SIP 4.5.2 (4.5.2) on Tue Feb 20 15:24:56 2007
4
+ * Generated by SIP 4.5.2 (4.5.2) on Wed Mar 28 22:59:14 2007
5 5
  */
6 6
 
7 7
 #include "sipAPIpy_sems_lib.h"
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Interface header file.
3 3
  *
4
- * Generated by SIP 4.5.2 (4.5.2) on Tue Feb 20 15:24:56 2007
4
+ * Generated by SIP 4.5.2 (4.5.2) on Wed Mar 28 22:59:14 2007
5 5
  */
6 6
 
7 7
 #ifndef _py_sems_libAmAudioFile_h
... ...
@@ -11,7 +11,7 @@
11 11
 #include "../../../core/AmAudio.h"
12 12
 #line 13 "sippy_sems_libAmAudioFile.h"
13 13
 
14
-#define sipClass_AmAudioFile             sipModuleAPI_py_sems_lib.em_types[1]
14
+#define sipClass_AmAudioFile             sipModuleAPI_py_sems_lib.em_types[3]
15 15
 #define sipCast_AmAudioFile              sipType_py_sems_lib_AmAudioFile.td_cast
16 16
 #define sipForceConvertTo_AmAudioFile    sipType_py_sems_lib_AmAudioFile.td_fcto
17 17
 
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Interface wrapper code.
3 3
  *
4
- * Generated by SIP 4.5.2 (4.5.2) on Tue Feb 20 15:24:56 2007
4
+ * Generated by SIP 4.5.2 (4.5.2) on Wed Mar 28 22:59:14 2007
5 5
  */
6 6
 
7 7
 #include "sipAPIpy_sems_lib.h"
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Interface header file.
3 3
  *
4
- * Generated by SIP 4.5.2 (4.5.2) on Tue Feb 20 15:24:56 2007
4
+ * Generated by SIP 4.5.2 (4.5.2) on Wed Mar 28 22:59:14 2007
5 5
  */
6 6
 
7 7
 #ifndef _py_sems_libAmEvent_h
... ...
@@ -11,7 +11,7 @@
11 11
 #include "../../../core/AmEvent.h"
12 12
 #line 13 "sippy_sems_libAmEvent.h"
13 13
 
14
-#define sipClass_AmEvent             sipModuleAPI_py_sems_lib.em_types[2]
14
+#define sipClass_AmEvent             sipModuleAPI_py_sems_lib.em_types[4]
15 15
 #define sipCast_AmEvent              sipType_py_sems_lib_AmEvent.td_cast
16 16
 #define sipForceConvertTo_AmEvent    sipType_py_sems_lib_AmEvent.td_fcto
17 17
 
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Interface wrapper code.
3 3
  *
4
- * Generated by SIP 4.5.2 (4.5.2) on Tue Feb 20 15:24:56 2007
4
+ * Generated by SIP 4.5.2 (4.5.2) on Wed Mar 28 22:59:14 2007
5 5
  */
6 6
 
7 7
 #include "sipAPIpy_sems_lib.h"
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Interface header file.
3 3
  *
4
- * Generated by SIP 4.5.2 (4.5.2) on Tue Feb 20 15:24:56 2007
4
+ * Generated by SIP 4.5.2 (4.5.2) on Wed Mar 28 22:59:14 2007
5 5
  */
6 6
 
7 7
 #ifndef _py_sems_libAmSipDialog_h
... ...
@@ -11,7 +11,7 @@
11 11
 #include "../../../core/AmSipDialog.h"
12 12
 #line 13 "sippy_sems_libAmSipDialog.h"
13 13
 
14
-#define sipClass_AmSipDialog             sipModuleAPI_py_sems_lib.em_types[4]
14
+#define sipClass_AmSipDialog             sipModuleAPI_py_sems_lib.em_types[6]
15 15
 #define sipCast_AmSipDialog              sipType_py_sems_lib_AmSipDialog.td_cast
16 16
 #define sipForceConvertTo_AmSipDialog    sipType_py_sems_lib_AmSipDialog.td_fcto
17 17
 
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Interface wrapper code.
3 3
  *
4
- * Generated by SIP 4.5.2 (4.5.2) on Tue Feb 20 15:24:56 2007
4
+ * Generated by SIP 4.5.2 (4.5.2) on Wed Mar 28 22:59:14 2007
5 5
  */
6 6
 
7 7
 #include "sipAPIpy_sems_lib.h"
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Interface header file.
3 3
  *
4
- * Generated by SIP 4.5.2 (4.5.2) on Tue Feb 20 15:24:56 2007
4
+ * Generated by SIP 4.5.2 (4.5.2) on Wed Mar 28 22:59:14 2007
5 5
  */
6 6
 
7 7
 #ifndef _py_sems_libAmSipReply_h
... ...
@@ -11,7 +11,7 @@
11 11
 #include "../../../core/AmSipReply.h"
12 12
 #line 13 "sippy_sems_libAmSipReply.h"
13 13
 
14
-#define sipClass_AmSipReply             sipModuleAPI_py_sems_lib.em_types[5]
14
+#define sipClass_AmSipReply             sipModuleAPI_py_sems_lib.em_types[7]
15 15
 #define sipCast_AmSipReply              sipType_py_sems_lib_AmSipReply.td_cast
16 16
 #define sipForceConvertTo_AmSipReply    sipType_py_sems_lib_AmSipReply.td_fcto
17 17
 
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Interface wrapper code.
3 3
  *
4
- * Generated by SIP 4.5.2 (4.5.2) on Tue Feb 20 15:24:56 2007
4
+ * Generated by SIP 4.5.2 (4.5.2) on Wed Mar 28 22:59:14 2007
5 5
  */
6 6
 
7 7
 #include "sipAPIpy_sems_lib.h"
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Interface header file.
3 3
  *
4
- * Generated by SIP 4.5.2 (4.5.2) on Tue Feb 20 15:24:56 2007
4
+ * Generated by SIP 4.5.2 (4.5.2) on Wed Mar 28 22:59:14 2007
5 5
  */
6 6
 
7 7
 #ifndef _py_sems_libAmSipRequest_h
... ...
@@ -11,7 +11,7 @@
11 11
 #include "../../../core/AmSipRequest.h"
12 12
 #line 13 "sippy_sems_libAmSipRequest.h"
13 13
 
14
-#define sipClass_AmSipRequest             sipModuleAPI_py_sems_lib.em_types[6]
14
+#define sipClass_AmSipRequest             sipModuleAPI_py_sems_lib.em_types[8]
15 15
 #define sipCast_AmSipRequest              sipType_py_sems_lib_AmSipRequest.td_cast
16 16
 #define sipForceConvertTo_AmSipRequest    sipType_py_sems_lib_AmSipRequest.td_fcto
17 17
 
18 18
new file mode 100644
... ...
@@ -0,0 +1,622 @@
1
+/*
2
+ * Interface wrapper code.
3
+ *
4
+ * Generated by SIP 4.5.2 (4.5.2) on Wed Mar 28 22:59:14 2007
5
+ */
6
+
7
+#include "sipAPIpy_sems_lib.h"
8
+#include "sippy_sems_libPySemsB2ABDialog.h"
9
+
10
+#include "sippy_sems_libAmSipDialog.h"
11
+#include "sippy_sems_libPySemsB2ABDialog.h"
12
+#include "sippy_sems_libAmEvent.h"
13
+#include "sippy_sems_libAmAudioFile.h"
14
+#include "sippy_sems_libAmSipRequest.h"
15
+#include "sippy_sems_libstring.h"
16
+
17
+
18
+sipPySemsB2ABDialog::sipPySemsB2ABDialog(): PySemsB2ABDialog(), sipPySelf(0)
19
+{
20
+    sipTrace(SIP_TRACE_CTORS,"sipPySemsB2ABDialog::sipPySemsB2ABDialog() (this=0x%08x)\n",this);
21
+
22
+    sipCommonCtor(sipPyMethods,6);
23
+}
24
+
25
+sipPySemsB2ABDialog::~sipPySemsB2ABDialog()
26
+{
27
+    sipTrace(SIP_TRACE_DTORS,"sipPySemsB2ABDialog::~sipPySemsB2ABDialog() (this=0x%08x)\n",this);
28
+
29
+    sipCommonDtor(sipPySelf);
30
+}
31
+
32
+void sipPySemsB2ABDialog::onInvite(const AmSipRequest& a0)
33
+{
34
+    sipTrace(SIP_TRACE_CATCHERS,"void sipPySemsB2ABDialog::onInvite(const AmSipRequest&) (this=0x%08x)\n",this);
35
+
36
+    extern void sipVH_py_sems_lib_2(sip_gilstate_t,PyObject *,const AmSipRequest&);
37
+
38
+    sip_gilstate_t sipGILState;
39
+    PyObject *meth;
40
+
41
+    meth = sipIsPyMethod(&sipGILState,&sipPyMethods[0],sipPySelf,NULL,sipNm_py_sems_lib_onInvite);
42
+
43
+    if (!meth)
44
+    {
45
+        PySemsB2ABDialog::onInvite(a0);
46
+        return;
47
+    }
48
+
49
+    sipVH_py_sems_lib_2(sipGILState,meth,a0);
50
+}
51
+
52
+void sipPySemsB2ABDialog::onSessionStart(const AmSipRequest& a0)
53
+{
54
+    sipTrace(SIP_TRACE_CATCHERS,"void sipPySemsB2ABDialog::onSessionStart(const AmSipRequest&) (this=0x%08x)\n",this);
55
+
56
+    extern void sipVH_py_sems_lib_2(sip_gilstate_t,PyObject *,const AmSipRequest&);
57
+
58
+    sip_gilstate_t sipGILState;
59
+    PyObject *meth;
60
+
61
+    meth = sipIsPyMethod(&sipGILState,&sipPyMethods[1],sipPySelf,NULL,sipNm_py_sems_lib_onSessionStart);
62
+
63
+    if (!meth)
64
+    {
65
+        PySemsB2ABDialog::onSessionStart(a0);
66
+        return;
67
+    }
68
+
69
+    sipVH_py_sems_lib_2(sipGILState,meth,a0);
70
+}
71
+
72
+void sipPySemsB2ABDialog::onCancel()
73
+{
74
+    sipTrace(SIP_TRACE_CATCHERS,"void sipPySemsB2ABDialog::onCancel() (this=0x%08x)\n",this);
75
+
76
+    extern void sipVH_py_sems_lib_3(sip_gilstate_t,PyObject *);
77
+
78
+    sip_gilstate_t sipGILState;
79
+    PyObject *meth;
80
+
81
+    meth = sipIsPyMethod(&sipGILState,&sipPyMethods[2],sipPySelf,NULL,sipNm_py_sems_lib_onCancel);
82
+
83
+    if (!meth)
84
+    {
85
+        PySemsB2ABDialog::onCancel();
86
+        return;
87
+    }
88
+
89
+    sipVH_py_sems_lib_3(sipGILState,meth);
90
+}
91
+
92
+void sipPySemsB2ABDialog::onBye(const AmSipRequest& a0)
93
+{
94
+    sipTrace(SIP_TRACE_CATCHERS,"void sipPySemsB2ABDialog::onBye(const AmSipRequest&) (this=0x%08x)\n",this);
95
+
96
+    extern void sipVH_py_sems_lib_2(sip_gilstate_t,PyObject *,const AmSipRequest&);
97
+
98
+    sip_gilstate_t sipGILState;
99
+    PyObject *meth;
100
+
101
+    meth = sipIsPyMethod(&sipGILState,&sipPyMethods[3],sipPySelf,NULL,sipNm_py_sems_lib_onBye);
102
+
103
+    if (!meth)
104
+    {
105
+        PySemsB2ABDialog::onBye(a0);
106
+        return;
107
+    }
108
+
109
+    sipVH_py_sems_lib_2(sipGILState,meth,a0);
110
+}
111
+
112
+void sipPySemsB2ABDialog::onDtmf(int a0,int a1)
113
+{
114
+    sipTrace(SIP_TRACE_CATCHERS,"void sipPySemsB2ABDialog::onDtmf(int,int) (this=0x%08x)\n",this);
115
+
116
+    extern void sipVH_py_sems_lib_1(sip_gilstate_t,PyObject *,int,int);
117
+
118
+    sip_gilstate_t sipGILState;
119
+    PyObject *meth;
120
+
121
+    meth = sipIsPyMethod(&sipGILState,&sipPyMethods[4],sipPySelf,NULL,sipNm_py_sems_lib_onDtmf);
122
+
123
+    if (!meth)
124
+    {
125
+        PySemsB2ABDialog::onDtmf(a0,a1);
126
+        return;
127
+    }
128
+
129
+    sipVH_py_sems_lib_1(sipGILState,meth,a0,a1);
130
+}
131
+
132
+void sipPySemsB2ABDialog::process(AmEvent *a0)
133
+{
134
+    sipTrace(SIP_TRACE_CATCHERS,"void sipPySemsB2ABDialog::process(AmEvent *) (this=0x%08x)\n",this);
135
+
136
+    extern void sipVH_py_sems_lib_0(sip_gilstate_t,PyObject *,AmEvent *);
137
+
138
+    sip_gilstate_t sipGILState;
139
+    PyObject *meth;
140
+
141
+    meth = sipIsPyMethod(&sipGILState,&sipPyMethods[5],sipPySelf,NULL,sipNm_py_sems_lib_process);
142
+
143
+    if (!meth)
144
+    {
145
+        PySemsB2ABDialog::process(a0);
146
+        return;
147
+    }
148
+
149
+    sipVH_py_sems_lib_0(sipGILState,meth,a0);
150
+}
151
+
152
+
153
+extern "C" {static PyObject *meth_PySemsB2ABDialog_acceptAudio(PyObject *, PyObject *);}
154
+static PyObject *meth_PySemsB2ABDialog_acceptAudio(PyObject *sipSelf,PyObject *sipArgs)
155
+{
156
+    sipTrace(SIP_TRACE_METHODS,"meth_PySemsB2ABDialog_acceptAudio()\n");
157
+
158
+    int sipArgsParsed = 0;
159
+
160
+    {
161
+        const string * a0;
162