- Timestamp:
- Oct 29, 2009 8:16:46 AM (15 years ago)
- Location:
- pjproject/trunk/pjsip-apps/src/python
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/python/_pjsua.c
r2394 r2976 631 631 632 632 633 /* 634 * on_mwi_info 635 */ 636 static void cb_on_mwi_info(pjsua_acc_id acc_id, pjsua_mwi_info *mwi_info) 637 { 638 if (PyCallable_Check(g_obj_callback->on_mwi_info)) { 639 PyObject *param_acc_id, *param_body; 640 pj_str_t body; 641 642 ENTER_PYTHON(); 643 644 body.ptr = mwi_info->rdata->msg_info.msg->body->data; 645 body.slen = mwi_info->rdata->msg_info.msg->body->len; 646 647 PyObject_CallFunctionObjArgs( 648 g_obj_callback->on_mwi_info, 649 param_acc_id = Py_BuildValue("i",acc_id), 650 param_body = PyString_FromPJ(&body), 651 NULL 652 ); 653 654 Py_DECREF(param_acc_id); 655 Py_DECREF(param_body); 656 657 LEAVE_PYTHON(); 658 } 659 } 633 660 634 661 /* … … 902 929 cfg_ua.cb.on_pager_status2 = &cb_on_pager_status; 903 930 cfg_ua.cb.on_typing2 = &cb_on_typing; 931 cfg_ua.cb.on_mwi_info = &cb_on_mwi_info; 904 932 905 933 p_cfg_ua = &cfg_ua; -
pjproject/trunk/pjsip-apps/src/python/_pjsua.h
r2859 r2976 236 236 PyObject * on_pager_status; 237 237 PyObject * on_typing; 238 PyObject * on_mwi_info; 238 239 } PyObj_pjsua_callback; 239 240 … … 259 260 Py_XDECREF(self->on_pager_status); 260 261 Py_XDECREF(self->on_typing); 262 Py_XDECREF(self->on_mwi_info); 261 263 self->ob_type->tp_free((PyObject*)self); 262 264 } … … 292 294 self->on_pager_status = Py_BuildValue(""); 293 295 self->on_typing = Py_BuildValue(""); 296 self->on_mwi_info = Py_BuildValue(""); 294 297 } 295 298 … … 394 397 offsetof(PyObj_pjsua_callback, on_typing), 0, 395 398 "Notify application about typing indication." 399 }, 400 { 401 "on_mwi_info", T_OBJECT_EX, 402 offsetof(PyObj_pjsua_callback, on_mwi_info), 0, 403 "Notify application about MWI indication." 396 404 }, 397 405 {NULL} /* Sentinel */ … … 1646 1654 PyObject *reg_uri; 1647 1655 int publish_enabled; 1656 int mwi_enabled; 1648 1657 PyObject *force_contact; 1649 1658 PyListObject *proxy; … … 1699 1708 obj->reg_uri = PyString_FromPJ(&cfg->reg_uri); 1700 1709 obj->publish_enabled = cfg->publish_enabled; 1710 obj->mwi_enabled = cfg->mwi_enabled; 1701 1711 Py_XDECREF(obj->force_contact); 1702 1712 obj->force_contact = PyString_FromPJ(&cfg->force_contact); … … 1754 1764 cfg->reg_uri = PyString_ToPJ(obj->reg_uri); 1755 1765 cfg->publish_enabled = obj->publish_enabled; 1766 cfg->mwi_enabled = obj->mwi_enabled; 1756 1767 cfg->force_contact = PyString_ToPJ(obj->force_contact); 1757 1768 … … 1857 1868 offsetof(PyObj_pjsua_acc_config, publish_enabled), 0, 1858 1869 "Publish presence? " 1870 }, 1871 { 1872 "mwi_enabled", T_INT, 1873 offsetof(PyObj_pjsua_acc_config, mwi_enabled), 0, 1874 "Enable MWI subscription " 1859 1875 }, 1860 1876 { -
pjproject/trunk/pjsip-apps/src/python/pjsua.py
r2910 r2976 994 994 pass 995 995 996 def on_mwi_info(self, body): 997 """ 998 Notification about change in Message Summary / Message Waiting 999 Indication (RFC 3842) status. MWI subscription must be enabled 1000 in the account config to receive this notification. 1001 1002 Keyword arguments: 1003 body -- String containing message body as received in the 1004 NOTIFY request. 1005 1006 """ 1007 pass 1008 996 1009 997 1010 … … 2114 2127 py_ua_cfg.cb.on_pager_status = _cb_on_pager_status 2115 2128 py_ua_cfg.cb.on_typing = _cb_on_typing 2129 py_ua_cfg.cb.on_mwi_info = _cb_on_mwi_info; 2116 2130 2117 2131 err = _pjsua.init(py_ua_cfg, log_cfg._cvt_to_pjsua(), … … 2764 2778 acc._cb.on_typing(from_uri, contact, is_typing) 2765 2779 2780 def _cb_on_mwi_info(self, acc_id, body): 2781 acc = self._lookup_account(acc_id) 2782 if acc: 2783 return acc._cb.on_mwi_info(body) 2784 2766 2785 def _cb_on_buddy_state(self, buddy_id): 2767 2786 buddy = self._lookup_buddy(buddy_id) … … 2817 2836 _lib._cb_on_typing(call_id, from_uri, to, contact, is_typing, acc_id) 2818 2837 2838 def _cb_on_mwi_info(acc_id, body): 2839 _lib._cb_on_mwi_info(acc_id, body) 2819 2840 2820 2841 # Worker thread
Note: See TracChangeset
for help on using the changeset viewer.