- Timestamp:
- Jan 29, 2007 5:07:41 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.c
r870 r914 3173 3173 } 3174 3174 3175 free(id);3175 3176 3176 return Py_BuildValue("O",list); 3177 3177 } … … 4128 4128 } 4129 4129 4130 free(id);4130 4131 4131 return Py_BuildValue("O",list); 4132 4132 } … … 4176 4176 } 4177 4177 4178 free(info);4178 4179 4179 return Py_BuildValue("O",list); 4180 4180 } … … 4701 4701 } 4702 4702 4703 free(id);4703 4704 4704 return Py_BuildValue("O",list); 4705 4705 } … … 5826 5826 } 5827 5827 5828 free(id);5828 5829 5829 return Py_BuildValue("O",list); 5830 5830 } … … 6125 6125 PyObject *list; 6126 6126 6127 pjmedia_snd_dev_info *info;6127 pjmedia_snd_dev_info info[64]; 6128 6128 int c, i; 6129 if (!PyArg_ParseTuple(pArgs, " i", &c))6129 if (!PyArg_ParseTuple(pArgs, "")) 6130 6130 { 6131 6131 return NULL; 6132 6132 } 6133 6133 6134 info = (pjmedia_snd_dev_info *)malloc(c * sizeof(pjmedia_snd_dev_info));6134 c = PJ_ARRAY_SIZE(info); 6135 6135 status = pjsua_enum_snd_devs(info, &c); 6136 6136 … … 6161 6161 } 6162 6162 6163 free(info);6163 6164 6164 return Py_BuildValue("O",list); 6165 6165 } … … 6330 6330 } 6331 6331 6332 free(info);6332 6333 6333 return Py_BuildValue("O",list); 6334 6334 } … … 6969 6969 } 6970 6970 6971 free(id);6971 6972 6972 return Py_BuildValue("O",list); 6973 6973 } … … 7585 7585 /* END OF LIB CALL */ 7586 7586 7587 /* For testing purpose only */ 7588 7589 struct call_data 7590 { 7591 pj_timer_entry timer; 7592 }; 7593 7594 /* 7595 * call_data_Object 7596 */ 7597 typedef struct 7598 { 7599 PyObject_HEAD 7600 /* Type-specific fields go here. */ 7601 struct call_data * data; 7602 } call_data_Object; 7603 7604 7605 /* 7606 * call_data_Type 7607 */ 7608 static PyTypeObject call_data_Type = 7609 { 7610 PyObject_HEAD_INIT(NULL) 7611 0, /*ob_size*/ 7612 "py_pjsua.Call_Data", /*tp_name*/ 7613 sizeof(call_data_Object), /*tp_basicsize*/ 7614 0, /*tp_itemsize*/ 7615 0, /*tp_dealloc*/ 7616 0, /*tp_print*/ 7617 0, /*tp_getattr*/ 7618 0, /*tp_setattr*/ 7619 0, /*tp_compare*/ 7620 0, /*tp_repr*/ 7621 0, /*tp_as_number*/ 7622 0, /*tp_as_sequence*/ 7623 0, /*tp_as_mapping*/ 7624 0, /*tp_hash */ 7625 0, /*tp_call*/ 7626 0, /*tp_str*/ 7627 0, /*tp_getattro*/ 7628 0, /*tp_setattro*/ 7629 0, /*tp_as_buffer*/ 7630 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 7631 "call_data objects", /*tp_doc*/ 7632 }; 7633 7634 static void call_timeout_callback(pj_timer_heap_t *timer_heap, 7635 struct pj_timer_entry *entry, unsigned duration) 7636 { 7637 pjsua_call_id call_id = entry->id; 7638 pjsua_msg_data msg_data; 7639 pjsip_generic_string_hdr warn; 7640 pj_str_t hname = pj_str("Warning"); 7641 pj_str_t hvalue = pj_str("399 pjsua \"Call duration exceeded\""); 7642 7643 PJ_UNUSED_ARG(timer_heap); 7644 7645 if (call_id == PJSUA_INVALID_ID) { 7646 PJ_LOG(1,(THIS_FILE, "Invalid call ID in timer callback")); 7647 return; 7648 } 7649 7650 /* Add warning header */ 7651 pjsua_msg_data_init(&msg_data); 7652 pjsip_generic_string_hdr_init2(&warn, &hname, &hvalue); 7653 pj_list_push_back(&msg_data.hdr_list, &warn); 7654 7655 /* Call duration has been exceeded; disconnect the call */ 7656 PJ_LOG(3,(THIS_FILE, "Duration (%d seconds) has been exceeded " 7657 "for call %d, disconnecting the call", 7658 duration, call_id)); 7659 entry->id = PJSUA_INVALID_ID; 7660 pjsua_call_hangup(call_id, 200, NULL, &msg_data); 7661 } 7662 7663 /*static PyObject *py_pjsua_call_timeout_callback 7664 (PyObject *pSelf, PyObject *pArgs) 7665 { 7666 7667 if (!PyArg_ParseTuple(pArgs, "")) 7668 { 7669 return NULL; 7670 } 7671 7672 call_timeout_callback(); 7673 7674 Py_INCREF(Py_None); 7675 return Py_None; 7676 }*/ 7677 7678 static void on_call_state_1() { 7679 /* if app_config.call_data[call_id].timer.id != PJSUA_INVALID_ID) { 7680 struct call_data *cd = &app_config.call_data[call_id]; 7681 pjsip_endpoint *endpt = pjsua_get_pjsip_endpt(); 7682 7683 cd->timer.id = PJSUA_INVALID_ID; 7684 pjsip_endpt_cancel_timer(endpt, &cd->timer); 7685 } 7686 7687 PJ_LOG(3,(THIS_FILE, "Call %d is DISCONNECTED [reason=%d (%s)]", 7688 call_id, 7689 call_info.last_status, 7690 call_info.last_status_text.ptr));*/ 7691 } 7692 7693 /* END OF Testing section */ 7694 7587 7695 /* 7588 7696 * Map of function names to functions
Note: See TracChangeset
for help on using the changeset viewer.