summaryrefslogtreecommitdiff
path: root/pjsip-apps/src/python/_pjsua.c
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2013-10-02 03:19:54 +0000
committerNanang Izzuddin <nanang@teluu.com>2013-10-02 03:19:54 +0000
commit420902fd4b501515600a6971c5b895d44121124c (patch)
treee39d7e4f35aa8befdaa9bd2665f53b7ae5fd5344 /pjsip-apps/src/python/_pjsua.c
parentc4bb0988a2d3217eec302cd743b7690c7e940064 (diff)
Close #1701: added received message info into incoming call callback
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4609 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps/src/python/_pjsua.c')
-rw-r--r--pjsip-apps/src/python/_pjsua.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/pjsip-apps/src/python/_pjsua.c b/pjsip-apps/src/python/_pjsua.c
index 91d86041..dffd3b86 100644
--- a/pjsip-apps/src/python/_pjsua.c
+++ b/pjsip-apps/src/python/_pjsua.c
@@ -131,25 +131,26 @@ static void cb_on_call_state(pjsua_call_id call_id, pjsip_event *e)
* declares method on_incoming_call for callback struct
*/
static void cb_on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id,
- pjsip_rx_data *rdata)
+ pjsip_rx_data *rdata)
{
- PJ_UNUSED_ARG(rdata);
-
if (PyCallable_Check(g_obj_callback->on_incoming_call)) {
- PyObject *obj;
-
+ PyObj_pjsip_rx_data *obj;
+
ENTER_PYTHON();
-
- obj = Py_BuildValue("");
-
- PyObject_CallFunction(
- g_obj_callback->on_incoming_call,
- "iiO",
- acc_id,
- call_id,
- obj,
- NULL
- );
+
+ obj = (PyObj_pjsip_rx_data*)
+ PyObj_pjsip_rx_data_new(&PyTyp_pjsip_rx_data,
+ NULL, NULL);
+ PyObj_pjsip_rx_data_import(obj, rdata);
+
+ PyObject_CallFunction(
+ g_obj_callback->on_incoming_call,
+ "iiO",
+ acc_id,
+ call_id,
+ obj,
+ NULL
+ );
Py_DECREF(obj);
@@ -4453,6 +4454,9 @@ init_pjsua(void)
PyTyp_pjsip_cred_info.tp_new = PyType_GenericNew;
if (PyType_Ready(&PyTyp_pjsip_cred_info) < 0)
return;
+ PyTyp_pjsip_rx_data.tp_new = PyType_GenericNew;
+ if (PyType_Ready(&PyTyp_pjsip_rx_data) < 0)
+ return;
/* LIB TRANSPORT */
@@ -4537,6 +4541,11 @@ init_pjsua(void)
(PyObject *)&PyTyp_pjsip_cred_info
);
+ Py_INCREF(&PyTyp_pjsip_rx_data);
+ PyModule_AddObject(m, "Pjsip_Rx_Data",
+ (PyObject *)&PyTyp_pjsip_rx_data
+ );
+
/* LIB TRANSPORT */
Py_INCREF(&PyTyp_pjsua_transport_config);