summaryrefslogtreecommitdiff
path: root/pjsip-apps/src/python/_pjsua.h
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-07-18 23:00:56 +0000
committerBenny Prijono <bennylp@teluu.com>2008-07-18 23:00:56 +0000
commita331abeec9382f40293a5b3c7e4dc2163f6ad734 (patch)
treef130641ab7dfac5b00518f1eee8eabedad817242 /pjsip-apps/src/python/_pjsua.h
parent63ba5ff8c3c834b685b4e5f41833f77737008193 (diff)
Implemented ticket #192 for Python: Add callback to notify application about incoming SUBSCRIBE request, and add subscription state and termination reason in buddy info
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2156 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps/src/python/_pjsua.h')
-rw-r--r--pjsip-apps/src/python/_pjsua.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/pjsip-apps/src/python/_pjsua.h b/pjsip-apps/src/python/_pjsua.h
index 269c30df..8c16c0f9 100644
--- a/pjsip-apps/src/python/_pjsua.h
+++ b/pjsip-apps/src/python/_pjsua.h
@@ -507,6 +507,7 @@ typedef struct PyObj_pjsua_callback
PyObject * on_call_replace_request;
PyObject * on_call_replaced;
PyObject * on_reg_state;
+ PyObject * on_incoming_subscribe;
PyObject * on_buddy_state;
PyObject * on_pager;
PyObject * on_pager_status;
@@ -529,6 +530,7 @@ static void PyObj_pjsua_callback_delete(PyObj_pjsua_callback* self)
Py_XDECREF(self->on_call_replace_request);
Py_XDECREF(self->on_call_replaced);
Py_XDECREF(self->on_reg_state);
+ Py_XDECREF(self->on_incoming_subscribe);
Py_XDECREF(self->on_buddy_state);
Py_XDECREF(self->on_pager);
Py_XDECREF(self->on_pager_status);
@@ -616,6 +618,8 @@ static PyObject * PyObj_pjsua_callback_new(PyTypeObject *type,
Py_DECREF(Py_None);
return NULL;
}
+ Py_INCREF(Py_None);
+ self->on_incoming_subscribe = Py_None;
Py_INCREF(Py_None);
self->on_buddy_state = Py_None;
if (self->on_buddy_state == NULL)
@@ -719,6 +723,11 @@ static PyMemberDef PyObj_pjsua_callback_members[] =
"may then query the account info to get the registration details."
},
{
+ "on_incoming_subscribe", T_OBJECT_EX,
+ offsetof(PyObj_pjsua_callback, on_incoming_subscribe), 0,
+ "Notification when incoming SUBSCRIBE request is received."
+ },
+ {
"on_buddy_state", T_OBJECT_EX,
offsetof(PyObj_pjsua_callback, on_buddy_state), 0,
"Notify application when the buddy state has changed. Application may "
@@ -2768,6 +2777,8 @@ typedef struct
PyObject *status_text;
int monitor_pres;
int activity;
+ int sub_state;
+ PyObject *sub_term_reason;
} PyObj_pjsua_buddy_info;
@@ -2781,6 +2792,7 @@ static void PyObj_pjsua_buddy_info_delete(PyObj_pjsua_buddy_info* self)
Py_XDECREF(self->uri);
Py_XDECREF(self->contact);
Py_XDECREF(self->status_text);
+ Py_XDECREF(self->sub_term_reason);
self->ob_type->tp_free((PyObject*)self);
}
@@ -2800,6 +2812,10 @@ static void PyObj_pjsua_buddy_info_import(PyObj_pjsua_buddy_info *obj,
info->status_text.slen);
obj->monitor_pres = info->monitor_pres;
obj->activity = info->rpid.activity;
+ obj->sub_state = info->sub_state;
+ Py_XDECREF(obj->sub_term_reason);
+ obj->sub_term_reason = PyString_FromStringAndSize(info->sub_term_reason.ptr,
+ info->sub_term_reason.slen);
}
@@ -2823,7 +2839,7 @@ static PyObject * PyObj_pjsua_buddy_info_new(PyTypeObject *type,
if (self->uri == NULL) {
Py_DECREF(self);
return NULL;
- }
+ }
self->contact = PyString_FromString("");
if (self->contact == NULL) {
Py_DECREF(self);
@@ -2834,7 +2850,7 @@ static PyObject * PyObj_pjsua_buddy_info_new(PyTypeObject *type,
Py_DECREF(self);
return NULL;
}
-
+ self->sub_term_reason = PyString_FromString("");
}
return (PyObject *)self;
}
@@ -2882,6 +2898,16 @@ static PyMemberDef PyObj_pjsua_buddy_info_members[] =
offsetof(PyObj_pjsua_buddy_info, activity), 0,
"Activity type. "
},
+ {
+ "sub_state", T_INT,
+ offsetof(PyObj_pjsua_buddy_info, sub_state), 0,
+ "Subscription state."
+ },
+ {
+ "sub_term_reason", T_INT,
+ offsetof(PyObj_pjsua_buddy_info, sub_term_reason), 0,
+ "Subscription termination reason."
+ },
{NULL} /* Sentinel */