// Constructor
static PyObject* IvrDialogBase_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
  static char *kwlist[] = {(char*)"ivr_dlg", NULL};
  IvrDialogBase *self;

  self = (IvrDialogBase *)type->tp_alloc(type, 0);
  if (self != NULL) {
	
    PyObject* o_dlg = NULL;
    if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", kwlist, &o_dlg)){
	    
      Py_DECREF(self);
      return NULL;
    }
    
    if ((NULL == o_dlg) || !PyCObject_Check(o_dlg)){
	    
      Py_DECREF(self);
      return NULL;
    }
	
    self->p_dlg = (IvrDialog*)PyCObject_AsVoidPtr(o_dlg);
	
    // initialize self.dialog
    self->dialog = IvrSipDialog_FromPtr(self->p_dlg->dlg);
    if(!self->dialog){
      PyErr_Print();
      ERROR("IvrDialogBase: while creating IvrSipDialog instance\n");
      Py_DECREF(self);
      return NULL;
    }

    // initialize self.invite_req - AmSipRequest is not owned!
    self->invite_req = IvrSipRequest_BorrowedFromPtr(self->p_dlg->getInviteReq());
    if(!self->invite_req){
      PyErr_Print();
      ERROR("IvrDialogBase: while creating IvrSipRequest instance for invite_req\n");
      Py_DECREF(self);
      return NULL;
    }

  }

  DBG("IvrDialogBase_new\n");
  return (PyObject *)self;
}
// Constructor
static PyObject* IvrDialogBase_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
  static char *kwlist[] = {"ivr_dlg", NULL};
  IvrDialogBase *self;

  self = (IvrDialogBase *)type->tp_alloc(type, 0);
  if (self != NULL) {
	
    PyObject* o_dlg = NULL;
    if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", kwlist, &o_dlg)){
	    
      Py_DECREF(self);
      return NULL;
    }
    
    if (!PyCObject_Check(o_dlg)){
	    
      Py_DECREF(self);
      return NULL;
    }
	
    self->p_dlg = (IvrDialog*)PyCObject_AsVoidPtr(o_dlg);
	
    // initialize self.dialog
    self->dialog = IvrSipDialog_FromPtr(&self->p_dlg->dlg);

    if(!self->dialog){
      PyErr_Print();
      ERROR("IvrDialogBase: while creating IvrSipDialog instance\n");
      Py_DECREF(self);
      return NULL;
    }
  }

  DBG("IvrDialogBase_new\n");
  return (PyObject *)self;
}