- Timestamp:
- Sep 10, 2007 4:54:22 PM (17 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/build/py_pjsua.dsp
r1128 r1430 71 71 # PROP Target_Dir "" 72 72 # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PY_PJSUA_EXPORTS" /YX /FD /GZ /c 73 # ADD CPP /nologo /MTd /W 3/Gm /GX /ZI /Od /I "..\..\pjlib\include" /I "..\..\pjlib-util\include" /I "..\..\pjmedia\include" /I "..\..\pjsip\include" /I "../../pjnath/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PY_PJSUA_EXPORTS" /FR /YX /FD /GZ /c73 # ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "..\..\pjlib\include" /I "..\..\pjlib-util\include" /I "..\..\pjmedia\include" /I "..\..\pjsip\include" /I "../../pjnath/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PY_PJSUA_EXPORTS" /FR /YX /FD /GZ /c 74 74 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 75 75 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 … … 114 114 115 115 # PROP Default_Filter "h;hpp;hxx;hm;inl" 116 # Begin Source File 117 118 SOURCE=..\src\py_pjsua\py_pjsua.h 119 # End Source File 116 120 # End Group 117 121 # Begin Group "Resource Files" -
pjproject/trunk/pjsip-apps/src/py_pjsua/pjsua_app.py
r1128 r1430 18 18 19 19 # STUN config. 20 # Set C_STUN_SRV to the address of the STUN server to enable STUN 21 # 22 C_STUN_SRV = "" 20 # Set C_STUN_HOST to the address:port of the STUN server to enable STUN 21 # 22 #C_STUN_HOST = "" 23 C_STUN_HOST = "192.168.0.2" 24 #C_STUN_HOST = "stun.iptel.org:3478" 25 26 # SIP port 23 27 C_SIP_PORT = 5060 24 C_STUN_PORT = 347825 28 26 29 … … 41 44 def err_exit(title, rc): 42 45 py_pjsua.perror(THIS_FILE, title, rc) 46 py_pjsua.destroy() 43 47 exit(1) 44 48 … … 197 201 ua_cfg.cb.on_call_transfer_request = on_call_transfer_request 198 202 203 # Configure STUN setting 204 if C_STUN_HOST != "": 205 ua_cfg.stun_host = C_STUN_HOST; 206 199 207 # Create and initialize media config 200 208 med_cfg = py_pjsua.media_config_default() … … 208 216 err_exit("pjsua init() error", status) 209 217 210 # Configure STUN config211 #stun_cfg = py_pjsua.stun_config_default()212 #stun_cfg.stun_srv1 = C_STUN_SRV213 #stun_cfg.stun_srv2 = C_STUN_SRV214 #stun_cfg.stun_port1 = C_STUN_PORT215 #stun_cfg.stun_port2 = C_STUN_PORT216 217 218 # Configure UDP transport config 218 219 transport_cfg = py_pjsua.transport_config_default() 219 220 transport_cfg.port = C_SIP_PORT 220 #transport_cfg.stun_config = stun_cfg221 if C_STUN_SRV != "":222 transport_cfg.use_stun = 1223 221 224 222 # Create UDP transport … … 226 224 py_pjsua.transport_create(py_pjsua.PJSIP_TRANSPORT_UDP, transport_cfg) 227 225 if status != 0: 228 py_pjsua.destroy()229 226 err_exit("Error creating UDP transport", status) 227 230 228 231 229 # Create initial default account 232 230 status, acc_id = py_pjsua.acc_add_local(transport_id, 1) 233 231 if status != 0: 234 py_pjsua.destroy()235 232 err_exit("Error creating account", status) 236 233 … … 497 494 status = py_pjsua.start() 498 495 if status != 0: 499 py_pjsua.destroy()500 496 err_exit("Error starting pjsua!", status) 501 497 -
pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.c
r1128 r1430 17 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 18 */ 19 #include <Python.h> 20 #include "structmember.h" 21 #include <pjsua-lib/pjsua.h> 19 #include "py_pjsua.h" 22 20 23 21 #define THIS_FILE "main.c" … … 61 59 62 60 63 /*64 * pjsip_event_Object65 * C/python typewrapper for event struct66 */67 typedef struct68 {69 PyObject_HEAD70 /* Type-specific fields go here. */71 pjsip_event * event;72 } pjsip_event_Object;73 74 75 /*76 * pjsip_event_Type77 * event struct signatures78 */79 static PyTypeObject pjsip_event_Type =80 {81 PyObject_HEAD_INIT(NULL)82 0, /*ob_size*/83 "py_pjsua.PJSIP_Event", /*tp_name*/84 sizeof(pjsip_event_Object), /*tp_basicsize*/85 0, /*tp_itemsize*/86 0, /*tp_dealloc*/87 0, /*tp_print*/88 0, /*tp_getattr*/89 0, /*tp_setattr*/90 0, /*tp_compare*/91 0, /*tp_repr*/92 0, /*tp_as_number*/93 0, /*tp_as_sequence*/94 0, /*tp_as_mapping*/95 0, /*tp_hash */96 0, /*tp_call*/97 0, /*tp_str*/98 0, /*tp_getattro*/99 0, /*tp_setattro*/100 0, /*tp_as_buffer*/101 Py_TPFLAGS_DEFAULT, /*tp_flags*/102 "pjsip_event objects", /*tp_doc */103 };104 105 106 /*107 * pjsip_rx_data_Object108 * C/python typewrapper for RX data struct109 */110 typedef struct111 {112 PyObject_HEAD113 /* Type-specific fields go here. */114 pjsip_rx_data * rdata;115 } pjsip_rx_data_Object;116 117 118 /*119 * pjsip_rx_data_Type120 */121 static PyTypeObject pjsip_rx_data_Type =122 {123 PyObject_HEAD_INIT(NULL)124 0, /*ob_size*/125 "py_pjsua.PJSIP_RX_Data", /*tp_name*/126 sizeof(pjsip_rx_data_Object), /*tp_basicsize*/127 0, /*tp_itemsize*/128 0, /*tp_dealloc*/129 0, /*tp_print*/130 0, /*tp_getattr*/131 0, /*tp_setattr*/132 0, /*tp_compare*/133 0, /*tp_repr*/134 0, /*tp_as_number*/135 0, /*tp_as_sequence*/136 0, /*tp_as_mapping*/137 0, /*tp_hash */138 0, /*tp_call*/139 0, /*tp_str*/140 0, /*tp_getattro*/141 0, /*tp_setattro*/142 0, /*tp_as_buffer*/143 Py_TPFLAGS_DEFAULT, /*tp_flags*/144 "pjsip_rx_data objects", /*tp_doc*/145 };146 147 148 /*149 * callback_Object150 * C/python typewrapper for callback struct151 */152 typedef struct153 {154 PyObject_HEAD155 /* Type-specific fields go here. */156 PyObject * on_call_state;157 PyObject * on_incoming_call;158 PyObject * on_call_media_state;159 PyObject * on_call_transfer_request;160 PyObject * on_call_transfer_status;161 PyObject * on_call_replace_request;162 PyObject * on_call_replaced;163 PyObject * on_reg_state;164 PyObject * on_buddy_state;165 PyObject * on_pager;166 PyObject * on_pager_status;167 PyObject * on_typing;168 169 } callback_Object;170 171 61 172 62 /* 173 63 * The global callback object. 174 64 */ 175 static callback_Object* g_obj_callback;65 static PyObj_pjsua_callback * g_obj_callback; 176 66 177 67 … … 184 74 if (PyCallable_Check(g_obj_callback->on_call_state)) 185 75 { 186 pjsip_event_Object * obj;76 PyObj_pjsip_event * obj; 187 77 188 78 ENTER_PYTHON(); 189 79 190 obj = ( pjsip_event_Object *)PyType_GenericNew(&pjsip_event_Type,80 obj = (PyObj_pjsip_event *)PyType_GenericNew(&PyTyp_pjsip_event, 191 81 NULL, NULL); 192 82 … … 194 84 195 85 PyObject_CallFunctionObjArgs( 196 g_obj_callback->on_call_state,Py_BuildValue("i",call_id),obj,NULL 86 g_obj_callback->on_call_state, 87 Py_BuildValue("i",call_id), 88 obj, 89 NULL 197 90 ); 198 91 … … 211 104 if (PyCallable_Check(g_obj_callback->on_incoming_call)) 212 105 { 213 pjsip_rx_data_Object* obj;106 PyObj_pjsip_rx_data * obj; 214 107 215 108 ENTER_PYTHON(); 216 109 217 obj = ( pjsip_rx_data_Object *)PyType_GenericNew(&pjsip_rx_data_Type,110 obj = (PyObj_pjsip_rx_data *)PyType_GenericNew(&PyTyp_pjsip_rx_data, 218 111 NULL, NULL); 219 112 obj->rdata = rdata; … … 242 135 ENTER_PYTHON(); 243 136 244 PyObject_CallFunction(g_obj_callback->on_call_media_state,"i",call_id); 137 PyObject_CallFunction( 138 g_obj_callback->on_call_media_state, 139 "i", 140 call_id, 141 NULL 142 ); 143 144 LEAVE_PYTHON(); 145 } 146 } 147 148 149 /* 150 * cb_on_dtmf_digit() 151 * Callback from PJSUA-LIB on receiving DTMF digit 152 */ 153 static void cb_on_dtmf_digit(pjsua_call_id call_id, int digit) 154 { 155 if (PyCallable_Check(g_obj_callback->on_call_media_state)) 156 { 157 char digit_str[10]; 158 159 ENTER_PYTHON(); 160 161 pj_ansi_snprintf(digit_str, sizeof(digit_str), "%c", digit); 162 163 PyObject_CallFunctionObjArgs( 164 g_obj_callback->on_call_media_state, 165 Py_BuildValue("i",call_id), 166 PyString_FromString(digit_str), 167 NULL 168 ); 245 169 246 170 LEAVE_PYTHON(); … … 341 265 PyObject * txt; 342 266 int cd; 343 pjsip_rx_data_Object* obj;267 PyObj_pjsip_rx_data * obj; 344 268 345 269 ENTER_PYTHON(); 346 270 347 obj = ( pjsip_rx_data_Object *)PyType_GenericNew(&pjsip_rx_data_Type,271 obj = (PyObj_pjsip_rx_data *)PyType_GenericNew(&PyTyp_pjsip_rx_data, 348 272 NULL, NULL); 349 273 obj->rdata = rdata; … … 387 311 g_obj_callback->on_call_replaced, 388 312 Py_BuildValue("i",old_call_id), 389 Py_BuildValue("i", old_call_id),313 Py_BuildValue("i",new_call_id), 390 314 NULL 391 315 ); … … 406 330 ENTER_PYTHON(); 407 331 408 PyObject_CallFunction(g_obj_callback->on_reg_state,"i",acc_id); 332 PyObject_CallFunction( 333 g_obj_callback->on_reg_state, 334 "i", 335 acc_id, 336 NULL 337 ); 409 338 410 339 LEAVE_PYTHON(); … … 423 352 ENTER_PYTHON(); 424 353 425 PyObject_CallFunction(g_obj_callback->on_buddy_state,"i",buddy_id); 354 PyObject_CallFunction( 355 g_obj_callback->on_buddy_state, 356 "i", 357 buddy_id, 358 NULL 359 ); 426 360 427 361 LEAVE_PYTHON(); … … 447 381 PyString_FromStringAndSize(contact->ptr, contact->slen), 448 382 PyString_FromStringAndSize(mime_type->ptr, mime_type->slen), 449 PyString_FromStringAndSize(body->ptr, body->slen), NULL 383 PyString_FromStringAndSize(body->ptr, body->slen), 384 NULL 450 385 ); 451 386 … … 505 440 PyString_FromStringAndSize(to->ptr, to->slen), 506 441 PyString_FromStringAndSize(contact->ptr, contact->slen), 507 Py_BuildValue("i",is_typing),NULL 442 Py_BuildValue("i",is_typing), 443 NULL 508 444 ); 509 445 … … 513 449 514 450 515 /*516 * callback_dealloc517 * destructor function for callback struct518 */519 static void callback_dealloc(callback_Object* self)520 {521 Py_XDECREF(self->on_call_state);522 Py_XDECREF(self->on_incoming_call);523 Py_XDECREF(self->on_call_media_state);524 Py_XDECREF(self->on_call_transfer_request);525 Py_XDECREF(self->on_call_transfer_status);526 Py_XDECREF(self->on_call_replace_request);527 Py_XDECREF(self->on_call_replaced);528 Py_XDECREF(self->on_reg_state);529 Py_XDECREF(self->on_buddy_state);530 Py_XDECREF(self->on_pager);531 Py_XDECREF(self->on_pager_status);532 Py_XDECREF(self->on_typing);533 self->ob_type->tp_free((PyObject*)self);534 }535 536 537 /*538 * callback_new539 * * declares constructor for callback struct540 */541 static PyObject * callback_new(PyTypeObject *type, PyObject *args,542 PyObject *kwds)543 {544 callback_Object *self;545 546 self = (callback_Object *)type->tp_alloc(type, 0);547 if (self != NULL)548 {549 Py_INCREF(Py_None);550 self->on_call_state = Py_None;551 if (self->on_call_state == NULL)552 {553 Py_DECREF(Py_None);554 return NULL;555 }556 Py_INCREF(Py_None);557 self->on_incoming_call = Py_None;558 if (self->on_incoming_call == NULL)559 {560 Py_DECREF(Py_None);561 return NULL;562 }563 Py_INCREF(Py_None);564 self->on_call_media_state = Py_None;565 if (self->on_call_media_state == NULL)566 {567 Py_DECREF(Py_None);568 return NULL;569 }570 Py_INCREF(Py_None);571 self->on_call_transfer_request = Py_None;572 if (self->on_call_transfer_request == NULL)573 {574 Py_DECREF(Py_None);575 return NULL;576 }577 Py_INCREF(Py_None);578 self->on_call_transfer_status = Py_None;579 if (self->on_call_transfer_status == NULL)580 {581 Py_DECREF(Py_None);582 return NULL;583 }584 Py_INCREF(Py_None);585 self->on_call_replace_request = Py_None;586 if (self->on_call_replace_request == NULL)587 {588 Py_DECREF(Py_None);589 return NULL;590 }591 Py_INCREF(Py_None);592 self->on_call_replaced = Py_None;593 if (self->on_call_replaced == NULL)594 {595 Py_DECREF(Py_None);596 return NULL;597 }598 Py_INCREF(Py_None);599 self->on_reg_state = Py_None;600 if (self->on_reg_state == NULL)601 {602 Py_DECREF(Py_None);603 return NULL;604 }605 Py_INCREF(Py_None);606 self->on_buddy_state = Py_None;607 if (self->on_buddy_state == NULL)608 {609 Py_DECREF(Py_None);610 return NULL;611 }612 Py_INCREF(Py_None);613 self->on_pager = Py_None;614 if (self->on_pager == NULL)615 {616 Py_DECREF(Py_None);617 return NULL;618 }619 Py_INCREF(Py_None);620 self->on_pager_status = Py_None;621 if (self->on_pager_status == NULL)622 {623 Py_DECREF(Py_None);624 return NULL;625 }626 Py_INCREF(Py_None);627 self->on_typing = Py_None;628 if (self->on_typing == NULL)629 {630 Py_DECREF(Py_None);631 return NULL;632 }633 }634 635 return (PyObject *)self;636 }637 638 639 /*640 * callback_members641 * declares available functions for callback object642 */643 static PyMemberDef callback_members[] =644 {645 {646 "on_call_state", T_OBJECT_EX, offsetof(callback_Object, on_call_state),647 0, "Notify application when invite state has changed. Application may "648 "then query the call info to get the detail call states."649 },650 {651 "on_incoming_call", T_OBJECT_EX,652 offsetof(callback_Object, on_incoming_call), 0,653 "Notify application on incoming call."654 },655 {656 "on_call_media_state", T_OBJECT_EX,657 offsetof(callback_Object, on_call_media_state), 0,658 "Notify application when media state in the call has changed. Normal "659 "application would need to implement this callback, e.g. to connect "660 "the call's media to sound device."661 },662 {663 "on_call_transfer_request", T_OBJECT_EX,664 offsetof(callback_Object, on_call_transfer_request), 0,665 "Notify application on call being transfered. "666 "Application can decide to accept/reject transfer request "667 "by setting the code (default is 200). When this callback "668 "is not defined, the default behavior is to accept the "669 "transfer."670 },671 {672 "on_call_transfer_status", T_OBJECT_EX,673 offsetof(callback_Object, on_call_transfer_status), 0,674 "Notify application of the status of previously sent call "675 "transfer request. Application can monitor the status of the "676 "call transfer request, for example to decide whether to "677 "terminate existing call."678 },679 {680 "on_call_replace_request", T_OBJECT_EX,681 offsetof(callback_Object, on_call_replace_request), 0,682 "Notify application about incoming INVITE with Replaces header. "683 "Application may reject the request by setting non-2xx code."684 },685 {686 "on_call_replaced", T_OBJECT_EX,687 offsetof(callback_Object, on_call_replaced), 0,688 "Notify application that an existing call has been replaced with "689 "a new call. This happens when PJSUA-API receives incoming INVITE "690 "request with Replaces header."691 " "692 "After this callback is called, normally PJSUA-API will disconnect "693 "old_call_id and establish new_call_id."694 },695 {696 "on_reg_state", T_OBJECT_EX,697 offsetof(callback_Object, on_reg_state), 0,698 "Notify application when registration status has changed. Application "699 "may then query the account info to get the registration details."700 },701 {702 "on_buddy_state", T_OBJECT_EX,703 offsetof(callback_Object, on_buddy_state), 0,704 "Notify application when the buddy state has changed. Application may "705 "then query the buddy into to get the details."706 },707 {708 "on_pager", T_OBJECT_EX, offsetof(callback_Object, on_pager), 0,709 "Notify application on incoming pager (i.e. MESSAGE request). "710 "Argument call_id will be -1 if MESSAGE request is not related to an "711 "existing call."712 },713 {714 "on_pager_status", T_OBJECT_EX,715 offsetof(callback_Object, on_pager_status), 0,716 "Notify application about the delivery status of outgoing pager "717 "request."718 },719 {720 "on_typing", T_OBJECT_EX, offsetof(callback_Object, on_typing), 0,721 "Notify application about typing indication."722 },723 {NULL} /* Sentinel */724 };725 726 727 /*728 * callback_Type729 * callback class definition730 */731 static PyTypeObject callback_Type =732 {733 PyObject_HEAD_INIT(NULL)734 0, /*ob_size*/735 "py_pjsua.Callback", /*tp_name*/736 sizeof(callback_Object), /*tp_basicsize*/737 0, /*tp_itemsize*/738 (destructor)callback_dealloc, /*tp_dealloc*/739 0, /*tp_print*/740 0, /*tp_getattr*/741 0, /*tp_setattr*/742 0, /*tp_compare*/743 0, /*tp_repr*/744 0, /*tp_as_number*/745 0, /*tp_as_sequence*/746 0, /*tp_as_mapping*/747 0, /*tp_hash */748 0, /*tp_call*/749 0, /*tp_str*/750 0, /*tp_getattro*/751 0, /*tp_setattro*/752 0, /*tp_as_buffer*/753 Py_TPFLAGS_DEFAULT, /*tp_flags*/754 "Callback objects", /* tp_doc */755 0, /* tp_traverse */756 0, /* tp_clear */757 0, /* tp_richcompare */758 0, /* tp_weaklistoffset */759 0, /* tp_iter */760 0, /* tp_iternext */761 0, /* tp_methods */762 callback_members, /* tp_members */763 0, /* tp_getset */764 0, /* tp_base */765 0, /* tp_dict */766 0, /* tp_descr_get */767 0, /* tp_descr_set */768 0, /* tp_dictoffset */769 0, /* tp_init */770 0, /* tp_alloc */771 callback_new, /* tp_new */772 773 };774 775 776 /*777 * media_config_Object778 * C/Python wrapper for media_config object779 */780 typedef struct781 {782 PyObject_HEAD783 /* Type-specific fields go here. */784 unsigned clock_rate;785 unsigned max_media_ports;786 int has_ioqueue;787 unsigned thread_cnt;788 unsigned quality;789 unsigned ptime;790 int no_vad;791 unsigned ilbc_mode;792 unsigned tx_drop_pct;793 unsigned rx_drop_pct;794 unsigned ec_options;795 unsigned ec_tail_len;796 } media_config_Object;797 798 799 /*800 * media_config_members801 * declares attributes accessible from both C and Python for media_config file802 */803 static PyMemberDef media_config_members[] =804 {805 {806 "clock_rate", T_INT, offsetof(media_config_Object, clock_rate), 0,807 "Clock rate to be applied to the conference bridge. If value is zero, "808 "default clock rate will be used (16KHz)."809 },810 {811 "max_media_ports", T_INT,812 offsetof(media_config_Object, max_media_ports), 0,813 "Specify maximum number of media ports to be created in the "814 "conference bridge. Since all media terminate in the bridge (calls, "815 "file player, file recorder, etc), the value must be large enough to "816 "support all of them. However, the larger the value, the more "817 "computations are performed."818 },819 {820 "has_ioqueue", T_INT, offsetof(media_config_Object, has_ioqueue), 0,821 "Specify whether the media manager should manage its own ioqueue for "822 "the RTP/RTCP sockets. If yes, ioqueue will be created and at least "823 "one worker thread will be created too. If no, the RTP/RTCP sockets "824 "will share the same ioqueue as SIP sockets, and no worker thread is "825 "needed."826 },827 {828 "thread_cnt", T_INT, offsetof(media_config_Object, thread_cnt), 0,829 "Specify the number of worker threads to handle incoming RTP packets. "830 "A value of one is recommended for most applications."831 },832 {833 "quality", T_INT, offsetof(media_config_Object, quality), 0,834 "The media quality also sets speex codec quality/complexity to the "835 "number."836 },837 {838 "ptime", T_INT, offsetof(media_config_Object, ptime), 0,839 "Specify default ptime."840 },841 {842 "no_vad", T_INT, offsetof(media_config_Object, no_vad), 0,843 "Disable VAD?"844 },845 {846 "ilbc_mode", T_INT, offsetof(media_config_Object, ilbc_mode), 0,847 "iLBC mode (20 or 30)."848 },849 {850 "tx_drop_pct", T_INT, offsetof(media_config_Object, tx_drop_pct), 0,851 "Percentage of RTP packet to drop in TX direction (to simulate packet "852 "lost)."853 },854 {855 "rx_drop_pct", T_INT, offsetof(media_config_Object, rx_drop_pct), 0,856 "Percentage of RTP packet to drop in RX direction (to simulate packet "857 "lost)."},858 {859 "ec_options", T_INT, offsetof(media_config_Object, ec_options), 0,860 "Echo canceller options (see #pjmedia_echo_create())"861 },862 {863 "ec_tail_len", T_INT, offsetof(media_config_Object, ec_tail_len), 0,864 "Echo canceller tail length, in miliseconds."865 },866 {NULL} /* Sentinel */867 };868 869 870 /*871 * media_config_Type872 */873 static PyTypeObject media_config_Type =874 {875 PyObject_HEAD_INIT(NULL)876 0, /*ob_size*/877 "py_pjsua.Media_Config", /*tp_name*/878 sizeof(media_config_Object), /*tp_basicsize*/879 0, /*tp_itemsize*/880 0, /*tp_dealloc*/881 0, /*tp_print*/882 0, /*tp_getattr*/883 0, /*tp_setattr*/884 0, /*tp_compare*/885 0, /*tp_repr*/886 0, /*tp_as_number*/887 0, /*tp_as_sequence*/888 0, /*tp_as_mapping*/889 0, /*tp_hash */890 0, /*tp_call*/891 0, /*tp_str*/892 0, /*tp_getattro*/893 0, /*tp_setattro*/894 0, /*tp_as_buffer*/895 Py_TPFLAGS_DEFAULT, /*tp_flags*/896 "Media Config objects", /*tp_doc*/897 0, /*tp_traverse*/898 0, /*tp_clear*/899 0, /*tp_richcompare*/900 0, /* tp_weaklistoffset */901 0, /* tp_iter */902 0, /* tp_iternext */903 0, /* tp_methods */904 media_config_members, /* tp_members */905 906 };907 908 909 /*910 * config_Object911 * attribute list for config object912 */913 typedef struct914 {915 PyObject_HEAD916 /* Type-specific fields go here. */917 unsigned max_calls;918 unsigned thread_cnt;919 unsigned outbound_proxy_cnt;920 pj_str_t outbound_proxy[4];921 PyObject *stun_domain;922 PyObject *stun_host;923 PyObject *stun_relay_host;924 unsigned cred_count;925 pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES];926 callback_Object * cb;927 PyObject * user_agent;928 } config_Object;929 930 931 /*932 * config_dealloc933 * deallocates a config object934 */935 static void config_dealloc(config_Object* self)936 {937 Py_XDECREF(self->cb);938 Py_XDECREF(self->user_agent);939 self->ob_type->tp_free((PyObject*)self);940 }941 942 /*943 * config_new944 * config object constructor945 */946 static PyObject *config_new(PyTypeObject *type, PyObject *args, PyObject *kwds)947 {948 config_Object *self;949 950 self = (config_Object *)type->tp_alloc(type, 0);951 if (self != NULL)952 {953 self->user_agent = PyString_FromString("");954 if (self->user_agent == NULL)955 {956 Py_DECREF(self);957 return NULL;958 }959 self->cb = (callback_Object *)PyType_GenericNew(960 &callback_Type, NULL, NULL961 );962 if (self->cb == NULL)963 {964 Py_DECREF(Py_None);965 return NULL;966 }967 }968 return (PyObject *)self;969 }970 971 972 /*973 * config_members974 * attribute list accessible from Python/C975 */976 static PyMemberDef config_members[] =977 {978 {979 "max_calls", T_INT, offsetof(config_Object, max_calls), 0,980 "Maximum calls to support (default: 4) "981 },982 {983 "thread_cnt", T_INT, offsetof(config_Object, thread_cnt), 0,984 "Number of worker threads. Normally application will want to have at "985 "least one worker thread, unless when it wants to poll the library "986 "periodically, which in this case the worker thread can be set to "987 "zero."988 },989 {990 "outbound_proxy_cnt", T_INT,991 offsetof(config_Object, outbound_proxy_cnt), 0,992 "Number of outbound proxies in the array."993 },994 {995 "cred_count", T_INT, offsetof(config_Object, cred_count), 0,996 "Number of credentials in the credential array."997 },998 {999 "user_agent", T_OBJECT_EX, offsetof(config_Object, user_agent), 0,1000 "User agent string (default empty)"1001 },1002 {1003 "cb", T_OBJECT_EX, offsetof(config_Object, cb), 0,1004 "Application callback."1005 },1006 {NULL} /* Sentinel */1007 };1008 1009 1010 /*1011 * config_Type1012 * type wrapper for config class1013 */1014 static PyTypeObject config_Type =1015 {1016 PyObject_HEAD_INIT(NULL)1017 0, /*ob_size*/1018 "py_pjsua.Config", /*tp_name*/1019 sizeof(config_Object), /*tp_basicsize*/1020 0, /*tp_itemsize*/1021 (destructor)config_dealloc,/*tp_dealloc*/1022 0, /*tp_print*/1023 0, /*tp_getattr*/1024 0, /*tp_setattr*/1025 0, /*tp_compare*/1026 0, /*tp_repr*/1027 0, /*tp_as_number*/1028 0, /*tp_as_sequence*/1029 0, /*tp_as_mapping*/1030 0, /*tp_hash */1031 0, /*tp_call*/1032 0, /*tp_str*/1033 0, /*tp_getattro*/1034 0, /*tp_setattro*/1035 0, /*tp_as_buffer*/1036 Py_TPFLAGS_DEFAULT, /*tp_flags*/1037 "Config objects", /* tp_doc */1038 0, /* tp_traverse */1039 0, /* tp_clear */1040 0, /* tp_richcompare */1041 0, /* tp_weaklistoffset */1042 0, /* tp_iter */1043 0, /* tp_iternext */1044 0, /* tp_methods */1045 config_members, /* tp_members */1046 0, /* tp_getset */1047 0, /* tp_base */1048 0, /* tp_dict */1049 0, /* tp_descr_get */1050 0, /* tp_descr_set */1051 0, /* tp_dictoffset */1052 0, /* tp_init */1053 0, /* tp_alloc */1054 config_new, /* tp_new */1055 1056 };1057 1058 1059 /*1060 * logging_config_Object1061 * configuration class for logging_config object1062 */1063 typedef struct1064 {1065 PyObject_HEAD1066 /* Type-specific fields go here. */1067 int msg_logging;1068 unsigned level;1069 unsigned console_level;1070 unsigned decor;1071 PyObject * log_filename;1072 PyObject * cb;1073 } logging_config_Object;1074 1075 1076 /*1077 * logging_config_dealloc1078 * deletes a logging config from memory1079 */1080 static void logging_config_dealloc(logging_config_Object* self)1081 {1082 Py_XDECREF(self->log_filename);1083 Py_XDECREF(self->cb);1084 self->ob_type->tp_free((PyObject*)self);1085 }1086 1087 1088 /*1089 * logging_config_new1090 * constructor for logging_config object1091 */1092 static PyObject * logging_config_new(PyTypeObject *type, PyObject *args,1093 PyObject *kwds)1094 {1095 logging_config_Object *self;1096 1097 self = (logging_config_Object *)type->tp_alloc(type, 0);1098 if (self != NULL)1099 {1100 self->log_filename = PyString_FromString("");1101 if (self->log_filename == NULL)1102 {1103 Py_DECREF(self);1104 return NULL;1105 }1106 Py_INCREF(Py_None);1107 self->cb = Py_None;1108 if (self->cb == NULL)1109 {1110 Py_DECREF(Py_None);1111 return NULL;1112 }1113 }1114 1115 return (PyObject *)self;1116 }1117 1118 1119 /*1120 * logging_config_members1121 */1122 static PyMemberDef logging_config_members[] =1123 {1124 {1125 "msg_logging", T_INT, offsetof(logging_config_Object, msg_logging), 0,1126 "Log incoming and outgoing SIP message? Yes!"1127 },1128 {1129 "level", T_INT, offsetof(logging_config_Object, level), 0,1130 "Input verbosity level. Value 5 is reasonable."1131 },1132 {1133 "console_level", T_INT, offsetof(logging_config_Object, console_level),1134 0, "Verbosity level for console. Value 4 is reasonable."1135 },1136 {1137 "decor", T_INT, offsetof(logging_config_Object, decor), 0,1138 "Log decoration"1139 },1140 {1141 "log_filename", T_OBJECT_EX,1142 offsetof(logging_config_Object, log_filename), 0,1143 "Optional log filename"1144 },1145 {1146 "cb", T_OBJECT_EX, offsetof(logging_config_Object, cb), 0,1147 "Optional callback function to be called to write log to application "1148 "specific device. This function will be called forlog messages on "1149 "input verbosity level."1150 },1151 {NULL} /* Sentinel */1152 };1153 1154 1155 1156 1157 /*1158 * logging_config_Type1159 */1160 static PyTypeObject logging_config_Type =1161 {1162 PyObject_HEAD_INIT(NULL)1163 0, /*ob_size*/1164 "py_pjsua.Logging_Config", /*tp_name*/1165 sizeof(logging_config_Object), /*tp_basicsize*/1166 0, /*tp_itemsize*/1167 (destructor)logging_config_dealloc,/*tp_dealloc*/1168 0, /*tp_print*/1169 0, /*tp_getattr*/1170 0, /*tp_setattr*/1171 0, /*tp_compare*/1172 0, /*tp_repr*/1173 0, /*tp_as_number*/1174 0, /*tp_as_sequence*/1175 0, /*tp_as_mapping*/1176 0, /*tp_hash */1177 0, /*tp_call*/1178 0, /*tp_str*/1179 0, /*tp_getattro*/1180 0, /*tp_setattro*/1181 0, /*tp_as_buffer*/1182 Py_TPFLAGS_DEFAULT, /*tp_flags*/1183 "Logging Config objects", /* tp_doc */1184 0, /* tp_traverse */1185 0, /* tp_clear */1186 0, /* tp_richcompare */1187 0, /* tp_weaklistoffset */1188 0, /* tp_iter */1189 0, /* tp_iternext */1190 0, /* tp_methods */1191 logging_config_members, /* tp_members */1192 0, /* tp_getset */1193 0, /* tp_base */1194 0, /* tp_dict */1195 0, /* tp_descr_get */1196 0, /* tp_descr_set */1197 0, /* tp_dictoffset */1198 0, /* tp_init */1199 0, /* tp_alloc */1200 logging_config_new, /* tp_new */1201 1202 };1203 1204 1205 /*1206 * msg_data_Object1207 * typewrapper for MessageData class1208 * !modified @ 0612061209 */1210 typedef struct1211 {1212 PyObject_HEAD1213 /* Type-specific fields go here. */1214 /*pjsip_hdr hdr_list;*/1215 PyObject * hdr_list;1216 PyObject * content_type;1217 PyObject * msg_body;1218 } msg_data_Object;1219 1220 1221 /*1222 * msg_data_dealloc1223 * deletes a msg_data1224 * !modified @ 0612061225 */1226 static void msg_data_dealloc(msg_data_Object* self)1227 {1228 Py_XDECREF(self->hdr_list);1229 Py_XDECREF(self->content_type);1230 Py_XDECREF(self->msg_body);1231 self->ob_type->tp_free((PyObject*)self);1232 }1233 1234 1235 /*1236 * msg_data_new1237 * constructor for msg_data object1238 * !modified @ 0612061239 */1240 static PyObject * msg_data_new(PyTypeObject *type, PyObject *args,1241 PyObject *kwds)1242 {1243 msg_data_Object *self;1244 1245 self = (msg_data_Object *)type->tp_alloc(type, 0);1246 if (self != NULL)1247 {1248 Py_INCREF(Py_None);1249 self->hdr_list = Py_None;1250 if (self->hdr_list == NULL)1251 {1252 Py_DECREF(self);1253 return NULL;1254 }1255 self->content_type = PyString_FromString("");1256 if (self->content_type == NULL)1257 {1258 Py_DECREF(self);1259 return NULL;1260 }1261 self->msg_body = PyString_FromString("");1262 if (self->msg_body == NULL)1263 {1264 Py_DECREF(self);1265 return NULL;1266 }1267 }1268 1269 return (PyObject *)self;1270 }1271 1272 1273 /*1274 * msg_data_members1275 * !modified @ 0612061276 */1277 static PyMemberDef msg_data_members[] =1278 {1279 {1280 "hdr_list", T_OBJECT_EX, offsetof(msg_data_Object, hdr_list),1281 0, "Additional message headers as linked list."1282 },1283 {1284 "content_type", T_OBJECT_EX, offsetof(msg_data_Object, content_type),1285 0, "MIME type of optional message body."1286 },1287 {1288 "msg_body", T_OBJECT_EX, offsetof(msg_data_Object, msg_body), 0,1289 "Optional message body."1290 },1291 {NULL} /* Sentinel */1292 };1293 1294 1295 /*1296 * msg_data_Type1297 */1298 static PyTypeObject msg_data_Type =1299 {1300 PyObject_HEAD_INIT(NULL)1301 0, /*ob_size*/1302 "py_pjsua.Msg_Data", /*tp_name*/1303 sizeof(msg_data_Object), /*tp_basicsize*/1304 0, /*tp_itemsize*/1305 (destructor)msg_data_dealloc,/*tp_dealloc*/1306 0, /*tp_print*/1307 0, /*tp_getattr*/1308 0, /*tp_setattr*/1309 0, /*tp_compare*/1310 0, /*tp_repr*/1311 0, /*tp_as_number*/1312 0, /*tp_as_sequence*/1313 0, /*tp_as_mapping*/1314 0, /*tp_hash */1315 0, /*tp_call*/1316 0, /*tp_str*/1317 0, /*tp_getattro*/1318 0, /*tp_setattro*/1319 0, /*tp_as_buffer*/1320 Py_TPFLAGS_DEFAULT, /*tp_flags*/1321 "msg_data objects", /* tp_doc */1322 0, /* tp_traverse */1323 0, /* tp_clear */1324 0, /* tp_richcompare */1325 0, /* tp_weaklistoffset */1326 0, /* tp_iter */1327 0, /* tp_iternext */1328 0, /* tp_methods */1329 msg_data_members, /* tp_members */1330 0, /* tp_getset */1331 0, /* tp_base */1332 0, /* tp_dict */1333 0, /* tp_descr_get */1334 0, /* tp_descr_set */1335 0, /* tp_dictoffset */1336 0, /* tp_init */1337 0, /* tp_alloc */1338 msg_data_new, /* tp_new */1339 1340 };1341 451 1342 452 /* … … 1419 529 1420 530 /* 1421 * pj_pool_Object1422 */1423 typedef struct1424 {1425 PyObject_HEAD1426 /* Type-specific fields go here. */1427 pj_pool_t * pool;1428 } pj_pool_Object;1429 1430 1431 /*1432 * pj_pool_Type1433 */1434 static PyTypeObject pj_pool_Type =1435 {1436 PyObject_HEAD_INIT(NULL)1437 0, /*ob_size*/1438 "py_pjsua.PJ_Pool", /*tp_name*/1439 sizeof(pj_pool_Object), /*tp_basicsize*/1440 0, /*tp_itemsize*/1441 0, /*tp_dealloc*/1442 0, /*tp_print*/1443 0, /*tp_getattr*/1444 0, /*tp_setattr*/1445 0, /*tp_compare*/1446 0, /*tp_repr*/1447 0, /*tp_as_number*/1448 0, /*tp_as_sequence*/1449 0, /*tp_as_mapping*/1450 0, /*tp_hash */1451 0, /*tp_call*/1452 0, /*tp_str*/1453 0, /*tp_getattro*/1454 0, /*tp_setattro*/1455 0, /*tp_as_buffer*/1456 Py_TPFLAGS_DEFAULT, /*tp_flags*/1457 "pj_pool_t objects", /* tp_doc */1458 1459 };1460 1461 1462 /*1463 * pjsip_endpoint_Object1464 */1465 typedef struct1466 {1467 PyObject_HEAD1468 /* Type-specific fields go here. */1469 pjsip_endpoint * endpt;1470 } pjsip_endpoint_Object;1471 1472 1473 /*1474 * pjsip_endpoint_Type1475 */1476 static PyTypeObject pjsip_endpoint_Type =1477 {1478 PyObject_HEAD_INIT(NULL)1479 0, /*ob_size*/1480 "py_pjsua.PJSIP_Endpoint", /*tp_name*/1481 sizeof(pjsip_endpoint_Object),/*tp_basicsize*/1482 0, /*tp_itemsize*/1483 0, /*tp_dealloc*/1484 0, /*tp_print*/1485 0, /*tp_getattr*/1486 0, /*tp_setattr*/1487 0, /*tp_compare*/1488 0, /*tp_repr*/1489 0, /*tp_as_number*/1490 0, /*tp_as_sequence*/1491 0, /*tp_as_mapping*/1492 0, /*tp_hash */1493 0, /*tp_call*/1494 0, /*tp_str*/1495 0, /*tp_getattro*/1496 0, /*tp_setattro*/1497 0, /*tp_as_buffer*/1498 Py_TPFLAGS_DEFAULT, /*tp_flags*/1499 "pjsip_endpoint objects", /* tp_doc */1500 };1501 1502 1503 /*1504 * pjmedia_endpt_Object1505 */1506 typedef struct1507 {1508 PyObject_HEAD1509 /* Type-specific fields go here. */1510 pjmedia_endpt * endpt;1511 } pjmedia_endpt_Object;1512 1513 1514 /*1515 * pjmedia_endpt_Type1516 */1517 static PyTypeObject pjmedia_endpt_Type =1518 {1519 PyObject_HEAD_INIT(NULL)1520 0, /*ob_size*/1521 "py_pjsua.PJMedia_Endpt", /*tp_name*/1522 sizeof(pjmedia_endpt_Object), /*tp_basicsize*/1523 0, /*tp_itemsize*/1524 0, /*tp_dealloc*/1525 0, /*tp_print*/1526 0, /*tp_getattr*/1527 0, /*tp_setattr*/1528 0, /*tp_compare*/1529 0, /*tp_repr*/1530 0, /*tp_as_number*/1531 0, /*tp_as_sequence*/1532 0, /*tp_as_mapping*/1533 0, /*tp_hash */1534 0, /*tp_call*/1535 0, /*tp_str*/1536 0, /*tp_getattro*/1537 0, /*tp_setattro*/1538 0, /*tp_as_buffer*/1539 Py_TPFLAGS_DEFAULT, /*tp_flags*/1540 "pjmedia_endpt objects", /* tp_doc */1541 1542 };1543 1544 1545 /*1546 * pj_pool_factory_Object1547 */1548 typedef struct1549 {1550 PyObject_HEAD1551 /* Type-specific fields go here. */1552 pj_pool_factory * pool_fact;1553 } pj_pool_factory_Object;1554 1555 1556 1557 /*1558 * pj_pool_factory_Type1559 */1560 static PyTypeObject pj_pool_factory_Type =1561 {1562 PyObject_HEAD_INIT(NULL)1563 0, /*ob_size*/1564 "py_pjsua.PJ_Pool_Factory",/*tp_name*/1565 sizeof(pj_pool_factory_Object), /*tp_basicsize*/1566 0, /*tp_itemsize*/1567 0, /*tp_dealloc*/1568 0, /*tp_print*/1569 0, /*tp_getattr*/1570 0, /*tp_setattr*/1571 0, /*tp_compare*/1572 0, /*tp_repr*/1573 0, /*tp_as_number*/1574 0, /*tp_as_sequence*/1575 0, /*tp_as_mapping*/1576 0, /*tp_hash */1577 0, /*tp_call*/1578 0, /*tp_str*/1579 0, /*tp_getattro*/1580 0, /*tp_setattro*/1581 0, /*tp_as_buffer*/1582 Py_TPFLAGS_DEFAULT, /*tp_flags*/1583 "pj_pool_factory objects", /* tp_doc */1584 1585 };1586 1587 1588 /*1589 * pjsip_cred_info_Object1590 */1591 typedef struct1592 {1593 PyObject_HEAD1594 /* Type-specific fields go here. */1595 PyObject * realm;1596 PyObject * scheme;1597 PyObject * username;1598 int data_type;1599 PyObject * data;1600 1601 } pjsip_cred_info_Object;1602 1603 /*1604 * cred_info_dealloc1605 * deletes a cred info from memory1606 */1607 static void pjsip_cred_info_dealloc(pjsip_cred_info_Object* self)1608 {1609 Py_XDECREF(self->realm);1610 Py_XDECREF(self->scheme);1611 Py_XDECREF(self->username);1612 Py_XDECREF(self->data);1613 self->ob_type->tp_free((PyObject*)self);1614 }1615 1616 1617 /*1618 * cred_info_new1619 * constructor for cred_info object1620 */1621 static PyObject * pjsip_cred_info_new(PyTypeObject *type, PyObject *args,1622 PyObject *kwds)1623 {1624 pjsip_cred_info_Object *self;1625 1626 self = (pjsip_cred_info_Object *)type->tp_alloc(type, 0);1627 if (self != NULL)1628 {1629 self->realm = PyString_FromString("");1630 if (self->realm == NULL)1631 {1632 Py_DECREF(self);1633 return NULL;1634 }1635 self->scheme = PyString_FromString("");1636 if (self->scheme == NULL)1637 {1638 Py_DECREF(self);1639 return NULL;1640 }1641 self->username = PyString_FromString("");1642 if (self->username == NULL)1643 {1644 Py_DECREF(self);1645 return NULL;1646 }1647 self->data = PyString_FromString("");1648 if (self->data == NULL)1649 {1650 Py_DECREF(self);1651 return NULL;1652 }1653 }1654 1655 return (PyObject *)self;1656 }1657 1658 1659 /*1660 * pjsip_cred_info_members1661 */1662 static PyMemberDef pjsip_cred_info_members[] =1663 {1664 {1665 "realm", T_OBJECT_EX,1666 offsetof(pjsip_cred_info_Object, realm), 0,1667 "Realm"1668 },1669 {1670 "scheme", T_OBJECT_EX,1671 offsetof(pjsip_cred_info_Object, scheme), 0,1672 "Scheme"1673 },1674 {1675 "username", T_OBJECT_EX,1676 offsetof(pjsip_cred_info_Object, username), 0,1677 "User name"1678 },1679 {1680 "data", T_OBJECT_EX,1681 offsetof(pjsip_cred_info_Object, data), 0,1682 "The data, which can be a plaintext password or a hashed digest. "1683 },1684 {1685 "data_type", T_INT, offsetof(pjsip_cred_info_Object, data_type), 0,1686 "Type of data"1687 },1688 1689 {NULL} /* Sentinel */1690 };1691 1692 /*1693 * pjsip_cred_info_Type1694 */1695 static PyTypeObject pjsip_cred_info_Type =1696 {1697 PyObject_HEAD_INIT(NULL)1698 0, /*ob_size*/1699 "py_pjsua.PJSIP_Cred_Info", /*tp_name*/1700 sizeof(pjsip_cred_info_Object), /*tp_basicsize*/1701 0, /*tp_itemsize*/1702 (destructor)pjsip_cred_info_dealloc,/*tp_dealloc*/1703 0, /*tp_print*/1704 0, /*tp_getattr*/1705 0, /*tp_setattr*/1706 0, /*tp_compare*/1707 0, /*tp_repr*/1708 0, /*tp_as_number*/1709 0, /*tp_as_sequence*/1710 0, /*tp_as_mapping*/1711 0, /*tp_hash */1712 0, /*tp_call*/1713 0, /*tp_str*/1714 0, /*tp_getattro*/1715 0, /*tp_setattro*/1716 0, /*tp_as_buffer*/1717 Py_TPFLAGS_DEFAULT, /*tp_flags*/1718 "PJSIP Cred Info objects", /* tp_doc */1719 0, /* tp_traverse */1720 0, /* tp_clear */1721 0, /* tp_richcompare */1722 0, /* tp_weaklistoffset */1723 0, /* tp_iter */1724 0, /* tp_iternext */1725 0, /* tp_methods */1726 pjsip_cred_info_members, /* tp_members */1727 0, /* tp_getset */1728 0, /* tp_base */1729 0, /* tp_dict */1730 0, /* tp_descr_get */1731 0, /* tp_descr_set */1732 0, /* tp_dictoffset */1733 0, /* tp_init */1734 0, /* tp_alloc */1735 pjsip_cred_info_new, /* tp_new */1736 1737 };1738 1739 /*1740 531 * py_pjsua_thread_register 1741 532 * !added @ 061206 1742 533 */ 1743 static PyObject *py_pjsua_thread_register(PyObject *pSelf, PyObject 1744 *pArgs) 534 static PyObject *py_pjsua_thread_register(PyObject *pSelf, PyObject *pArgs) 1745 535 { 1746 536 … … 1756 546 #endif 1757 547 548 PJ_UNUSED_ARG(pSelf); 549 1758 550 if (!PyArg_ParseTuple(pArgs, "sO", &name, &py_desc)) 1759 551 { … … 1788 580 PyObject *pArgs) 1789 581 { 1790 logging_config_Object*obj;582 PyObj_pjsua_logging_config *obj; 1791 583 pjsua_logging_config cfg; 1792 584 585 PJ_UNUSED_ARG(pSelf); 586 1793 587 if (!PyArg_ParseTuple(pArgs, "")) 1794 588 { … … 1797 591 1798 592 pjsua_logging_config_default(&cfg); 1799 obj = (logging_config_Object *) logging_config_new 1800 (&logging_config_Type,NULL,NULL); 1801 obj->msg_logging = cfg.msg_logging; 1802 obj->level = cfg.level; 1803 obj->console_level = cfg.console_level; 1804 obj->decor = cfg.decor; 593 obj = (PyObj_pjsua_logging_config *) PyObj_pjsua_logging_config_new 594 (&PyTyp_pjsua_logging_config,NULL,NULL); 595 PyObj_pjsua_logging_config_import(obj, &cfg); 1805 596 1806 597 return (PyObject *)obj; … … 1814 605 static PyObject *py_pjsua_config_default(PyObject *pSelf, PyObject *pArgs) 1815 606 { 1816 config_Object*obj;607 PyObj_pjsua_config *obj; 1817 608 pjsua_config cfg; 1818 609 610 PJ_UNUSED_ARG(pSelf); 611 1819 612 if (!PyArg_ParseTuple(pArgs, "")) 1820 613 { … … 1822 615 } 1823 616 pjsua_config_default(&cfg); 1824 obj = ( config_Object *) config_new(&config_Type, NULL, NULL);1825 obj->max_calls = cfg.max_calls;1826 obj->thread_cnt = cfg.thread_cnt; 617 obj = (PyObj_pjsua_config *) PyObj_pjsua_config_new(&PyTyp_pjsua_config, NULL, NULL); 618 PyObj_pjsua_config_import(obj, &cfg); 619 1827 620 return (PyObject *)obj; 1828 621 } … … 1836 629 PyObject *pArgs) 1837 630 { 1838 media_config_Object*obj;631 PyObj_pjsua_media_config *obj; 1839 632 pjsua_media_config cfg; 633 634 PJ_UNUSED_ARG(pSelf); 635 1840 636 if (!PyArg_ParseTuple(pArgs, "")) 1841 637 { … … 1843 639 } 1844 640 pjsua_media_config_default(&cfg); 1845 obj = (media_config_Object *)PyType_GenericNew 1846 (&media_config_Type, NULL, NULL); 1847 obj->clock_rate = cfg.clock_rate; 1848 obj->ec_options = cfg.ec_options; 1849 obj->ec_tail_len = cfg.ec_tail_len; 1850 obj->has_ioqueue = cfg.has_ioqueue; 1851 obj->ilbc_mode = cfg.ilbc_mode; 1852 obj->max_media_ports = cfg.max_media_ports; 1853 obj->no_vad = cfg.no_vad; 1854 obj->ptime = cfg.ptime; 1855 obj->quality = cfg.quality; 1856 obj->rx_drop_pct = cfg.rx_drop_pct; 1857 obj->thread_cnt = cfg.thread_cnt; 1858 obj->tx_drop_pct = cfg.tx_drop_pct; 641 obj = (PyObj_pjsua_media_config *) 642 PyType_GenericNew(&PyTyp_pjsua_media_config, NULL, NULL); 643 PyObj_pjsua_media_config_import(obj, &cfg); 1859 644 return (PyObject *)obj; 1860 645 } … … 1867 652 static PyObject *py_pjsua_msg_data_init(PyObject *pSelf, PyObject *pArgs) 1868 653 { 1869 msg_data_Object*obj;654 PyObj_pjsua_msg_data *obj; 1870 655 pjsua_msg_data msg; 1871 656 657 PJ_UNUSED_ARG(pSelf); 658 1872 659 if (!PyArg_ParseTuple(pArgs, "")) 1873 660 { … … 1875 662 } 1876 663 pjsua_msg_data_init(&msg); 1877 obj = ( msg_data_Object *)msg_data_new(&msg_data_Type, NULL, NULL);664 obj = (PyObj_pjsua_msg_data *)PyObj_pjsua_msg_data_new(&PyTyp_pjsua_msg_data, NULL, NULL); 1878 665 Py_XDECREF(obj->content_type); 1879 666 obj->content_type = PyString_FromStringAndSize( … … 1897 684 { 1898 685 PyObject * logObj; 1899 logging_config_Object*log;686 PyObj_pjsua_logging_config *log; 1900 687 pjsua_logging_config cfg; 1901 688 pj_status_t status; 1902 689 690 PJ_UNUSED_ARG(pSelf); 691 1903 692 if (!PyArg_ParseTuple(pArgs, "O", &logObj)) 1904 693 { … … 1907 696 if (logObj != Py_None) 1908 697 { 1909 log = ( logging_config_Object*)logObj;698 log = (PyObj_pjsua_logging_config *)logObj; 1910 699 cfg.msg_logging = log->msg_logging; 1911 700 cfg.level = log->level; … … 1935 724 const char * name; 1936 725 pj_pool_t *p; 1937 pj_pool_Object *pool; 726 PyObj_pj_pool *pool; 727 728 PJ_UNUSED_ARG(pSelf); 1938 729 1939 730 if (!PyArg_ParseTuple(pArgs, "sII", &name, &init_size, &increment)) … … 1943 734 1944 735 p = pjsua_pool_create(name, init_size, increment); 1945 pool = ( pj_pool_Object *)PyType_GenericNew(&pj_pool_Type, NULL, NULL);736 pool = (PyObj_pj_pool *)PyType_GenericNew(&PyTyp_pj_pool_t, NULL, NULL); 1946 737 pool->pool = p; 1947 738 return (PyObject *)pool; … … 1955 746 static PyObject *py_pjsua_get_pjsip_endpt(PyObject *pSelf, PyObject *pArgs) 1956 747 { 1957 pjsip_endpoint_Object *endpt;748 PyObj_pjsip_endpoint *endpt; 1958 749 pjsip_endpoint *e; 1959 750 751 PJ_UNUSED_ARG(pSelf); 752 1960 753 if (!PyArg_ParseTuple(pArgs, "")) 1961 754 { … … 1963 756 } 1964 757 e = pjsua_get_pjsip_endpt(); 1965 endpt = ( pjsip_endpoint_Object *)PyType_GenericNew(1966 & pjsip_endpoint_Type, NULL, NULL758 endpt = (PyObj_pjsip_endpoint *)PyType_GenericNew( 759 &PyTyp_pjsip_endpoint, NULL, NULL 1967 760 ); 1968 761 endpt->endpt = e; … … 1976 769 static PyObject *py_pjsua_get_pjmedia_endpt(PyObject *pSelf, PyObject *pArgs) 1977 770 { 1978 pjmedia_endpt_Object *endpt;771 PyObj_pjmedia_endpt *endpt; 1979 772 pjmedia_endpt *e; 1980 773 774 PJ_UNUSED_ARG(pSelf); 775 1981 776 if (!PyArg_ParseTuple(pArgs, "")) 1982 777 { … … 1984 779 } 1985 780 e = pjsua_get_pjmedia_endpt(); 1986 endpt = ( pjmedia_endpt_Object *)PyType_GenericNew(1987 & pjmedia_endpt_Type, NULL, NULL781 endpt = (PyObj_pjmedia_endpt *)PyType_GenericNew( 782 &PyTyp_pjmedia_endpt, NULL, NULL 1988 783 ); 1989 784 endpt->endpt = e; … … 1997 792 static PyObject *py_pjsua_get_pool_factory(PyObject *pSelf, PyObject *pArgs) 1998 793 { 1999 pj_pool_factory_Object*pool;794 PyObj_pj_pool_factory *pool; 2000 795 pj_pool_factory *p; 2001 796 797 PJ_UNUSED_ARG(pSelf); 798 2002 799 if (!PyArg_ParseTuple(pArgs, "")) 2003 800 { … … 2005 802 } 2006 803 p = pjsua_get_pool_factory(); 2007 pool = ( pj_pool_factory_Object*)PyType_GenericNew(2008 & pj_pool_factory_Type, NULL, NULL804 pool = (PyObj_pj_pool_factory *)PyType_GenericNew( 805 &PyTyp_pj_pool_factory, NULL, NULL 2009 806 ); 2010 807 pool->pool_fact = p; … … 2021 818 const char *title; 2022 819 pj_status_t status; 820 821 PJ_UNUSED_ARG(pSelf); 822 2023 823 if (!PyArg_ParseTuple(pArgs, "ssi", &sender, &title, &status)) 2024 824 { … … 2038 838 { 2039 839 pj_status_t status; 840 841 PJ_UNUSED_ARG(pSelf); 842 2040 843 if (!PyArg_ParseTuple(pArgs, "")) 2041 844 { … … 2061 864 { 2062 865 pj_status_t status; 2063 PyObject * ua_cfgObj; 2064 config_Object * ua_cfg; 2065 PyObject * log_cfgObj; 2066 logging_config_Object * log_cfg; 2067 PyObject * media_cfgObj; 2068 media_config_Object * media_cfg; 2069 pjsua_config cfg_ua; 2070 pjsua_config * p_cfg_ua; 2071 pjsua_logging_config cfg_log; 2072 pjsua_logging_config * p_cfg_log; 2073 pjsua_media_config cfg_media; 2074 pjsua_media_config * p_cfg_media; 2075 unsigned i; 2076 2077 if (!PyArg_ParseTuple(pArgs, "OOO", &ua_cfgObj, &log_cfgObj,&media_cfgObj)) 2078 { 2079 return NULL; 2080 } 2081 866 PyObject *o_ua_cfg, *o_log_cfg, *o_media_cfg; 867 pjsua_config cfg_ua, *p_cfg_ua; 868 pjsua_logging_config cfg_log, *p_cfg_log; 869 pjsua_media_config cfg_media, *p_cfg_media; 870 871 PJ_UNUSED_ARG(pSelf); 872 873 if (!PyArg_ParseTuple(pArgs, "OOO", &o_ua_cfg, &o_log_cfg, &o_media_cfg)) 874 { 875 return NULL; 876 } 2082 877 2083 878 pjsua_config_default(&cfg_ua); … … 2085 880 pjsua_media_config_default(&cfg_media); 2086 881 2087 if (ua_cfgObj != Py_None) 2088 { 2089 ua_cfg = (config_Object *)ua_cfgObj; 2090 cfg_ua.cred_count = ua_cfg->cred_count; 2091 for (i = 0; i < 4; i++) 2092 { 2093 cfg_ua.cred_info[i] = ua_cfg->cred_info[i]; 2094 } 2095 cfg_ua.max_calls = ua_cfg->max_calls; 2096 for (i = 0; i < PJSUA_ACC_MAX_PROXIES; i++) 2097 { 2098 cfg_ua.outbound_proxy[i] = ua_cfg->outbound_proxy[i]; 2099 } 2100 2101 g_obj_callback = ua_cfg->cb; 882 if (o_ua_cfg != Py_None) 883 { 884 PyObj_pjsua_config *obj_ua_cfg = (PyObj_pjsua_config*)o_ua_cfg; 885 886 PyObj_pjsua_config_export(&cfg_ua, obj_ua_cfg); 887 888 g_obj_callback = obj_ua_cfg->cb; 2102 889 Py_INCREF(g_obj_callback); 2103 890 … … 2105 892 cfg_ua.cb.on_incoming_call = &cb_on_incoming_call; 2106 893 cfg_ua.cb.on_call_media_state = &cb_on_call_media_state; 894 cfg_ua.cb.on_dtmf_digit = &cb_on_dtmf_digit; 2107 895 cfg_ua.cb.on_call_transfer_request = &cb_on_call_transfer_request; 2108 896 cfg_ua.cb.on_call_transfer_status = &cb_on_call_transfer_status; … … 2115 903 cfg_ua.cb.on_typing = &cb_on_typing; 2116 904 2117 cfg_ua.outbound_proxy_cnt = ua_cfg->outbound_proxy_cnt;2118 cfg_ua.thread_cnt = ua_cfg->thread_cnt;2119 cfg_ua.user_agent.ptr = PyString_AsString(ua_cfg->user_agent);2120 cfg_ua.user_agent.slen = strlen(cfg_ua.user_agent.ptr);2121 2122 905 p_cfg_ua = &cfg_ua; 906 2123 907 } else { 2124 908 p_cfg_ua = NULL; 2125 909 } 2126 910 2127 if (log_cfgObj != Py_None) 2128 { 2129 log_cfg = (logging_config_Object *)log_cfgObj; 2130 cfg_log.msg_logging = log_cfg->msg_logging; 2131 cfg_log.level = log_cfg->level; 2132 cfg_log.console_level = log_cfg->console_level; 2133 cfg_log.decor = log_cfg->decor; 2134 cfg_log.log_filename.ptr = PyString_AsString(log_cfg->log_filename); 2135 cfg_log.log_filename.slen = strlen(cfg_log.log_filename.ptr); 911 if (o_log_cfg != Py_None) 912 { 913 PyObj_pjsua_logging_config * obj_log; 914 915 obj_log = (PyObj_pjsua_logging_config *)o_log_cfg; 916 917 PyObj_pjsua_logging_config_export(&cfg_log, obj_log); 918 2136 919 Py_XDECREF(obj_log_cb); 2137 obj_log_cb = log_cfg->cb;920 obj_log_cb = obj_log->cb; 2138 921 Py_INCREF(obj_log_cb); 922 2139 923 cfg_log.cb = &cb_log_cb; 2140 924 p_cfg_log = &cfg_log; 925 2141 926 } else { 2142 927 p_cfg_log = NULL; 2143 928 } 2144 929 2145 if (media_cfgObj != Py_None) 2146 { 2147 media_cfg = (media_config_Object *)media_cfgObj; 2148 cfg_media.clock_rate = media_cfg->clock_rate; 2149 cfg_media.ec_options = media_cfg->ec_options; 2150 cfg_media.ec_tail_len = media_cfg->ec_tail_len; 2151 cfg_media.has_ioqueue = media_cfg->has_ioqueue; 2152 cfg_media.ilbc_mode = media_cfg->ilbc_mode; 2153 cfg_media.max_media_ports = media_cfg->max_media_ports; 2154 cfg_media.no_vad = media_cfg->no_vad; 2155 cfg_media.ptime = media_cfg->ptime; 2156 cfg_media.quality = media_cfg->quality; 2157 cfg_media.rx_drop_pct = media_cfg->rx_drop_pct; 2158 cfg_media.thread_cnt = media_cfg->thread_cnt; 2159 cfg_media.tx_drop_pct = media_cfg->tx_drop_pct; 2160 p_cfg_media = &cfg_media; 930 if (o_media_cfg != Py_None) 931 { 932 PyObj_pjsua_media_config_export(&cfg_media, 933 (PyObj_pjsua_media_config*)o_media_cfg); 934 p_cfg_media = &cfg_media; 935 2161 936 } else { 2162 937 p_cfg_media = NULL; … … 2174 949 { 2175 950 pj_status_t status; 951 952 PJ_UNUSED_ARG(pSelf); 953 2176 954 if (!PyArg_ParseTuple(pArgs, "")) 2177 955 { … … 2190 968 { 2191 969 pj_status_t status; 970 971 PJ_UNUSED_ARG(pSelf); 972 2192 973 if (!PyArg_ParseTuple(pArgs, "")) 2193 974 { … … 2207 988 int ret; 2208 989 unsigned msec; 990 991 PJ_UNUSED_ARG(pSelf); 992 2209 993 if (!PyArg_ParseTuple(pArgs, "i", &msec)) 2210 994 { … … 2232 1016 pj_status_t status; 2233 1017 const char *url; 1018 1019 PJ_UNUSED_ARG(pSelf); 1020 2234 1021 if (!PyArg_ParseTuple(pArgs, "s", &url)) 2235 1022 { … … 2264 1051 2265 1052 static char pjsua_init_doc[] = 2266 "int py_pjsua.init (py_pjsua.Config ua_cfg, "1053 "int py_pjsua.init (py_pjsua.Config obj_ua_cfg, " 2267 1054 "py_pjsua.Logging_Config log_cfg, py_pjsua.Media_Config media_cfg) " 2268 1055 "Initialize pjsua with the specified settings. All the settings are " 2269 1056 "optional, and the default values will be used when the config is not " 2270 1057 "specified. Parameters: " 2271 " ua_cfg : User agent configuration; "1058 "obj_ua_cfg : User agent configuration; " 2272 1059 "log_cfg : Optional logging configuration; " 2273 1060 "media_cfg : Optional media configuration."; … … 2300 1087 2301 1088 static char pjsua_pool_create_doc[] = 2302 "py_pjsua.P J_Pool py_pjsua.pool_create (string name, int init_size, "1089 "py_pjsua.Pj_Pool py_pjsua.pool_create (string name, int init_size, " 2303 1090 "int increment) " 2304 1091 "Create memory pool Parameters: " … … 2308 1095 2309 1096 static char pjsua_get_pjsip_endpt_doc[] = 2310 "py_pjsua.P JSIP_Endpoint py_pjsua.get_pjsip_endpt (void) "1097 "py_pjsua.Pjsip_Endpoint py_pjsua.get_pjsip_endpt (void) " 2311 1098 "Internal function to get SIP endpoint instance of pjsua, which is needed " 2312 1099 "for example to register module, create transports, etc. Probably is only " … … 2314 1101 2315 1102 static char pjsua_get_pjmedia_endpt_doc[] = 2316 "py_pjsua.P JMedia_Endpt py_pjsua.get_pjmedia_endpt (void) "1103 "py_pjsua.Pjmedia_Endpt py_pjsua.get_pjmedia_endpt (void) " 2317 1104 "Internal function to get media endpoint instance. Only valid after " 2318 1105 "pjsua_init() is called."; 2319 1106 2320 1107 static char pjsua_get_pool_factory_doc[] = 2321 "py_pjsua.P J_Pool_Factory py_pjsua.get_pool_factory (void) "1108 "py_pjsua.Pj_Pool_Factory py_pjsua.get_pool_factory (void) " 2322 1109 "Internal function to get PJSUA pool factory. Only valid after " 2323 1110 "pjsua_init() is called."; … … 2351 1138 2352 1139 /* 2353 * transport_config_Object2354 * Transport configuration for creating UDP transports for both SIP2355 * and media.2356 */2357 typedef struct2358 {2359 PyObject_HEAD2360 /* Type-specific fields go here. */2361 unsigned port;2362 PyObject * public_addr;2363 PyObject * bound_addr;2364 } transport_config_Object;2365 2366 2367 /*2368 * transport_config_dealloc2369 * deletes a transport config from memory2370 */2371 static void transport_config_dealloc(transport_config_Object* self)2372 {2373 Py_XDECREF(self->public_addr);2374 Py_XDECREF(self->bound_addr);2375 self->ob_type->tp_free((PyObject*)self);2376 }2377 2378 2379 /*2380 * transport_config_new2381 * constructor for transport_config object2382 */2383 static PyObject * transport_config_new(PyTypeObject *type, PyObject *args,2384 PyObject *kwds)2385 {2386 transport_config_Object *self;2387 2388 self = (transport_config_Object *)type->tp_alloc(type, 0);2389 if (self != NULL)2390 {2391 self->public_addr = PyString_FromString("");2392 if (self->public_addr == NULL)2393 {2394 Py_DECREF(self);2395 return NULL;2396 }2397 self->bound_addr = PyString_FromString("");2398 if (self->bound_addr == NULL)2399 {2400 Py_DECREF(self);2401 return NULL;2402 }2403 }2404 2405 return (PyObject *)self;2406 }2407 2408 2409 /*2410 * transport_config_members2411 */2412 static PyMemberDef transport_config_members[] =2413 {2414 {2415 "port", T_INT, offsetof(transport_config_Object, port), 0,2416 "UDP port number to bind locally. This setting MUST be specified "2417 "even when default port is desired. If the value is zero, the "2418 "transport will be bound to any available port, and application "2419 "can query the port by querying the transport info."2420 },2421 {2422 "public_addr", T_OBJECT_EX,2423 offsetof(transport_config_Object, public_addr), 0,2424 "Optional address to advertise as the address of this transport. "2425 "Application can specify any address or hostname for this field, "2426 "for example it can point to one of the interface address in the "2427 "system, or it can point to the public address of a NAT router "2428 "where port mappings have been configured for the application."2429 },2430 {2431 "bound_addr", T_OBJECT_EX,2432 offsetof(transport_config_Object, bound_addr), 0,2433 "Optional address where the socket should be bound to. This option "2434 "SHOULD only be used to selectively bind the socket to particular "2435 "interface (instead of 0.0.0.0), and SHOULD NOT be used to set the "2436 "published address of a transport (the public_addr field should be "2437 "used for that purpose)."2438 },2439 {NULL} /* Sentinel */2440 };2441 2442 2443 2444 2445 /*2446 * transport_config_Type2447 */2448 static PyTypeObject transport_config_Type =2449 {2450 PyObject_HEAD_INIT(NULL)2451 0, /*ob_size*/2452 "py_pjsua.Transport_Config", /*tp_name*/2453 sizeof(transport_config_Object), /*tp_basicsize*/2454 0, /*tp_itemsize*/2455 (destructor)transport_config_dealloc,/*tp_dealloc*/2456 0, /*tp_print*/2457 0, /*tp_getattr*/2458 0, /*tp_setattr*/2459 0, /*tp_compare*/2460 0, /*tp_repr*/2461 0, /*tp_as_number*/2462 0, /*tp_as_sequence*/2463 0, /*tp_as_mapping*/2464 0, /*tp_hash */2465 0, /*tp_call*/2466 0, /*tp_str*/2467 0, /*tp_getattro*/2468 0, /*tp_setattro*/2469 0, /*tp_as_buffer*/2470 Py_TPFLAGS_DEFAULT, /*tp_flags*/2471 "Transport Config objects", /* tp_doc */2472 0, /* tp_traverse */2473 0, /* tp_clear */2474 0, /* tp_richcompare */2475 0, /* tp_weaklistoffset */2476 0, /* tp_iter */2477 0, /* tp_iternext */2478 0, /* tp_methods */2479 transport_config_members, /* tp_members */2480 0, /* tp_getset */2481 0, /* tp_base */2482 0, /* tp_dict */2483 0, /* tp_descr_get */2484 0, /* tp_descr_set */2485 0, /* tp_dictoffset */2486 0, /* tp_init */2487 0, /* tp_alloc */2488 transport_config_new, /* tp_new */2489 2490 };2491 2492 /*2493 * host_port_Object2494 * C/Python wrapper for host_port object2495 */2496 typedef struct2497 {2498 PyObject_HEAD2499 /* Type-specific fields go here. */2500 PyObject * host;2501 int port;2502 } host_port_Object;2503 2504 /*2505 * host_port_dealloc2506 * deletes a host_port from memory2507 */2508 static void host_port_dealloc(host_port_Object* self)2509 {2510 Py_XDECREF(self->host);2511 self->ob_type->tp_free((PyObject*)self);2512 }2513 2514 2515 /*2516 * host_port_new2517 * constructor for host_port object2518 */2519 static PyObject * host_port_new(PyTypeObject *type, PyObject *args,2520 PyObject *kwds)2521 {2522 host_port_Object *self;2523 2524 self = (host_port_Object *)type->tp_alloc(type, 0);2525 if (self != NULL)2526 {2527 self->host = PyString_FromString("");2528 if (self->host == NULL)2529 {2530 Py_DECREF(self);2531 return NULL;2532 }2533 2534 }2535 2536 return (PyObject *)self;2537 }2538 2539 2540 /*2541 * host_port_members2542 * declares attributes accessible from both C and Python for host_port object2543 */2544 static PyMemberDef host_port_members[] =2545 {2546 {2547 "port", T_INT,2548 offsetof(host_port_Object, port), 0,2549 "Port number."2550 },2551 {2552 "host", T_OBJECT_EX,2553 offsetof(host_port_Object, host), 0,2554 "Host part or IP address."2555 },2556 {NULL} /* Sentinel */2557 };2558 2559 2560 /*2561 * host_port_Type2562 */2563 static PyTypeObject host_port_Type =2564 {2565 PyObject_HEAD_INIT(NULL)2566 0, /*ob_size*/2567 "py_pjsua.Host_Port", /*tp_name*/2568 sizeof(host_port_Object), /*tp_basicsize*/2569 0, /*tp_itemsize*/2570 (destructor)host_port_dealloc,/*tp_dealloc*/2571 0, /*tp_print*/2572 0, /*tp_getattr*/2573 0, /*tp_setattr*/2574 0, /*tp_compare*/2575 0, /*tp_repr*/2576 0, /*tp_as_number*/2577 0, /*tp_as_sequence*/2578 0, /*tp_as_mapping*/2579 0, /*tp_hash */2580 0, /*tp_call*/2581 0, /*tp_str*/2582 0, /*tp_getattro*/2583 0, /*tp_setattro*/2584 0, /*tp_as_buffer*/2585 Py_TPFLAGS_DEFAULT, /*tp_flags*/2586 "Host_port objects", /*tp_doc*/2587 0, /*tp_traverse*/2588 0, /*tp_clear*/2589 0, /*tp_richcompare*/2590 0, /* tp_weaklistoffset */2591 0, /* tp_iter */2592 0, /* tp_iternext */2593 0, /* tp_methods */2594 host_port_members, /* tp_members */2595 0, /* tp_getset */2596 0, /* tp_base */2597 0, /* tp_dict */2598 0, /* tp_descr_get */2599 0, /* tp_descr_set */2600 0, /* tp_dictoffset */2601 0, /* tp_init */2602 0, /* tp_alloc */2603 host_port_new, /* tp_new */2604 };2605 2606 2607 2608 2609 /*2610 * transport_info_Object2611 * Transport info2612 */2613 typedef struct2614 {2615 PyObject_HEAD2616 /* Type-specific fields go here. */2617 int id;2618 int type;2619 PyObject * type_name;2620 PyObject * info;2621 unsigned flag;2622 unsigned addr_len;2623 host_port_Object * local_name;2624 unsigned usage_count;2625 } transport_info_Object;2626 2627 2628 /*2629 * transport_info_dealloc2630 * deletes a transport info from memory2631 */2632 static void transport_info_dealloc(transport_info_Object* self)2633 {2634 Py_XDECREF(self->type_name);2635 Py_XDECREF(self->info);2636 Py_XDECREF(self->local_name);2637 self->ob_type->tp_free((PyObject*)self);2638 }2639 2640 2641 /*2642 * transport_info_new2643 * constructor for transport_info object2644 */2645 static PyObject * transport_info_new(PyTypeObject *type, PyObject *args,2646 PyObject *kwds)2647 {2648 transport_info_Object *self;2649 2650 self = (transport_info_Object *)type->tp_alloc(type, 0);2651 if (self != NULL)2652 {2653 self->type_name = PyString_FromString("");2654 if (self->type_name == NULL)2655 {2656 Py_DECREF(self);2657 return NULL;2658 }2659 self->info = PyString_FromString("");2660 if (self->info == NULL)2661 {2662 Py_DECREF(self);2663 return NULL;2664 }2665 self->local_name =2666 (host_port_Object *)host_port_new(&host_port_Type,NULL,NULL);2667 if (self->local_name == NULL)2668 {2669 Py_DECREF(self);2670 return NULL;2671 }2672 }2673 2674 return (PyObject *)self;2675 }2676 2677 2678 /*2679 * transport_info_members2680 */2681 static PyMemberDef transport_info_members[] =2682 {2683 {2684 "id", T_INT, offsetof(transport_info_Object, id), 0,2685 "PJSUA transport identification."2686 },2687 {2688 "type", T_INT, offsetof(transport_info_Object, id), 0,2689 "Transport type."2690 },2691 {2692 "type_name", T_OBJECT_EX,2693 offsetof(transport_info_Object, type_name), 0,2694 "Transport type name."2695 },2696 {2697 "info", T_OBJECT_EX,2698 offsetof(transport_info_Object, info), 0,2699 "Transport string info/description."2700 },2701 {2702 "flag", T_INT, offsetof(transport_info_Object, flag), 0,2703 "Transport flag (see ##pjsip_transport_flags_e)."2704 },2705 {2706 "addr_len", T_INT, offsetof(transport_info_Object, addr_len), 0,2707 "Local address length."2708 },2709 {2710 "local_name", T_OBJECT_EX,2711 offsetof(transport_info_Object, local_name), 0,2712 "Published address (or transport address name)."2713 },2714 {2715 "usage_count", T_INT, offsetof(transport_info_Object, usage_count), 0,2716 "Current number of objects currently referencing this transport."2717 },2718 {NULL} /* Sentinel */2719 };2720 2721 2722 2723 2724 /*2725 * transport_info_Type2726 */2727 static PyTypeObject transport_info_Type =2728 {2729 PyObject_HEAD_INIT(NULL)2730 0, /*ob_size*/2731 "py_pjsua.Transport_Info", /*tp_name*/2732 sizeof(transport_info_Object), /*tp_basicsize*/2733 0, /*tp_itemsize*/2734 (destructor)transport_info_dealloc,/*tp_dealloc*/2735 0, /*tp_print*/2736 0, /*tp_getattr*/2737 0, /*tp_setattr*/2738 0, /*tp_compare*/2739 0, /*tp_repr*/2740 0, /*tp_as_number*/2741 0, /*tp_as_sequence*/2742 0, /*tp_as_mapping*/2743 0, /*tp_hash */2744 0, /*tp_call*/2745 0, /*tp_str*/2746 0, /*tp_getattro*/2747 0, /*tp_setattro*/2748 0, /*tp_as_buffer*/2749 Py_TPFLAGS_DEFAULT, /*tp_flags*/2750 "Transport Info objects", /* tp_doc */2751 0, /* tp_traverse */2752 0, /* tp_clear */2753 0, /* tp_richcompare */2754 0, /* tp_weaklistoffset */2755 0, /* tp_iter */2756 0, /* tp_iternext */2757 0, /* tp_methods */2758 transport_info_members, /* tp_members */2759 0, /* tp_getset */2760 0, /* tp_base */2761 0, /* tp_dict */2762 0, /* tp_descr_get */2763 0, /* tp_descr_set */2764 0, /* tp_dictoffset */2765 0, /* tp_init */2766 0, /* tp_alloc */2767 transport_info_new, /* tp_new */2768 2769 };2770 2771 /*2772 * pjsip_transport_Object2773 * C/python typewrapper for pjsip_transport2774 */2775 typedef struct2776 {2777 PyObject_HEAD2778 /* Type-specific fields go here. */2779 pjsip_transport *tp;2780 } pjsip_transport_Object;2781 2782 2783 /*2784 * pjsip_transport_Type2785 */2786 static PyTypeObject pjsip_transport_Type =2787 {2788 PyObject_HEAD_INIT(NULL)2789 0, /*ob_size*/2790 "py_pjsua.PJSIP_Transport", /*tp_name*/2791 sizeof(pjsip_transport_Object), /*tp_basicsize*/2792 0, /*tp_itemsize*/2793 0, /*tp_dealloc*/2794 0, /*tp_print*/2795 0, /*tp_getattr*/2796 0, /*tp_setattr*/2797 0, /*tp_compare*/2798 0, /*tp_repr*/2799 0, /*tp_as_number*/2800 0, /*tp_as_sequence*/2801 0, /*tp_as_mapping*/2802 0, /*tp_hash */2803 0, /*tp_call*/2804 0, /*tp_str*/2805 0, /*tp_getattro*/2806 0, /*tp_setattro*/2807 0, /*tp_as_buffer*/2808 Py_TPFLAGS_DEFAULT, /*tp_flags*/2809 "pjsip_transport objects", /*tp_doc*/2810 };2811 2812 2813 /*2814 1140 * py_pjsua_transport_config_default 2815 1141 * !modified @ 051206 2816 1142 */ 2817 static PyObject *py_pjsua_transport_config_default 2818 (PyObject *pSelf,PyObject *pArgs)2819 { 2820 transport_config_Object*obj;1143 static PyObject *py_pjsua_transport_config_default(PyObject *pSelf, 1144 PyObject *pArgs) 1145 { 1146 PyObj_pjsua_transport_config *obj; 2821 1147 pjsua_transport_config cfg; 2822 1148 2823 if (!PyArg_ParseTuple(pArgs, "")) 2824 { 2825 return NULL; 2826 } 1149 PJ_UNUSED_ARG(pSelf); 1150 1151 if (!PyArg_ParseTuple(pArgs, "")) { 1152 return NULL; 1153 } 1154 2827 1155 pjsua_transport_config_default(&cfg); 2828 obj = (transport_config_Object *)transport_config_new 2829 (&transport_config_Type,NULL,NULL); 2830 obj->public_addr = 2831 PyString_FromStringAndSize(cfg.public_addr.ptr, cfg.public_addr.slen); 2832 obj->bound_addr = 2833 PyString_FromStringAndSize(cfg.bound_addr.ptr, cfg.bound_addr.slen); 2834 obj->port = cfg.port; 1156 obj = (PyObj_pjsua_transport_config*) 1157 PyObj_pjsua_transport_config_new(&PyTyp_pjsua_transport_config, 1158 NULL, NULL); 1159 PyObj_pjsua_transport_config_import(obj, &cfg); 1160 2835 1161 return (PyObject *)obj; 2836 1162 } … … 2844 1170 pj_status_t status; 2845 1171 int type; 2846 2847 1172 PyObject * tmpObj; 2848 transport_config_Object *obj;2849 1173 pjsua_transport_config cfg; 2850 1174 pjsua_transport_id id; 2851 if (!PyArg_ParseTuple(pArgs, "iO", &type, &tmpObj)) 2852 { 2853 return NULL; 2854 } 2855 if (tmpObj != Py_None) 2856 { 2857 obj = (transport_config_Object *)tmpObj; 2858 cfg.public_addr.ptr = PyString_AsString(obj->public_addr); 2859 cfg.public_addr.slen = strlen(PyString_AsString(obj->public_addr)); 2860 cfg.bound_addr.ptr = PyString_AsString(obj->bound_addr); 2861 cfg.bound_addr.slen = strlen(PyString_AsString(obj->bound_addr)); 2862 cfg.port = obj->port; 1175 1176 PJ_UNUSED_ARG(pSelf); 1177 1178 if (!PyArg_ParseTuple(pArgs, "iO", &type, &tmpObj)) { 1179 return NULL; 1180 } 1181 1182 if (tmpObj != Py_None) { 1183 PyObj_pjsua_transport_config *obj; 1184 obj = (PyObj_pjsua_transport_config*)tmpObj; 1185 PyObj_pjsua_transport_config_export(&cfg, obj); 2863 1186 status = pjsua_transport_create(type, &cfg, &id); 2864 1187 } else { … … 2867 1190 2868 1191 2869 return Py_BuildValue("ii",status,id); 2870 } 2871 2872 /* 2873 * py_pjsua_transport_register 2874 * !modified @ 051206 2875 */ 2876 static PyObject *py_pjsua_transport_register(PyObject *pSelf, PyObject *pArgs) 2877 { 2878 pj_status_t status; 2879 PyObject * tmpObj; 2880 pjsip_transport_Object *obj; 2881 pjsua_transport_id id; 2882 if (!PyArg_ParseTuple(pArgs, "O", &tmpObj)) 2883 { 2884 return NULL; 2885 } 2886 if (tmpObj != Py_None) 2887 { 2888 obj = (pjsip_transport_Object *)tmpObj; 2889 status = pjsua_transport_register(obj->tp, &id); 2890 } else { 2891 status = pjsua_transport_register(NULL, &id); 2892 } 2893 2894 return Py_BuildValue("ii",status, id); 1192 return Py_BuildValue("ii", status, id); 2895 1193 } 2896 1194 … … 2906 1204 pjsua_transport_id id[PJSIP_MAX_TRANSPORTS]; 2907 1205 unsigned c, i; 1206 1207 PJ_UNUSED_ARG(pSelf); 1208 2908 1209 if (!PyArg_ParseTuple(pArgs, "")) 2909 1210 { … … 2935 1236 pj_status_t status; 2936 1237 int id; 2937 transport_info_Object *obj;2938 1238 pjsua_transport_info info; 2939 1239 2940 2941 if (!PyArg_ParseTuple(pArgs, "i", &id)) 2942 {1240 PJ_UNUSED_ARG(pSelf); 1241 1242 if (!PyArg_ParseTuple(pArgs, "i", &id)) { 2943 1243 return NULL; 2944 1244 } … … 2946 1246 status = pjsua_transport_get_info(id, &info); 2947 1247 if (status == PJ_SUCCESS) { 2948 obj = (transport_info_Object *) transport_info_new 2949 (&transport_info_Type,NULL,NULL); 2950 obj->addr_len = info.addr_len; 2951 obj->flag = info.flag; 2952 obj->id = info.id; 2953 obj->info = PyString_FromStringAndSize(info.info.ptr, info.info.slen); 1248 PyObj_pjsua_transport_info *obj; 1249 obj = (PyObj_pjsua_transport_info *) 1250 PyObj_pjsua_transport_info_new(&PyTyp_pjsua_transport_info, 1251 NULL, NULL); 1252 PyObj_pjsua_transport_info_import(obj, &info); 2954 1253 return Py_BuildValue("O", obj); 2955 1254 } else { … … 2968 1267 int id; 2969 1268 int enabled; 1269 1270 PJ_UNUSED_ARG(pSelf); 1271 2970 1272 if (!PyArg_ParseTuple(pArgs, "ii", &id, &enabled)) 2971 1273 { … … 2985 1287 int id; 2986 1288 int force; 1289 1290 PJ_UNUSED_ARG(pSelf); 1291 2987 1292 if (!PyArg_ParseTuple(pArgs, "ii", &id, &force)) 2988 1293 { … … 3001 1306 "py_pjsua.Transport_Config cfg) " 3002 1307 "Create SIP transport."; 3003 static char pjsua_transport_register_doc[] =3004 "int, int py_pjsua.transport_register "3005 "(py_pjsua.PJSIP_Transport tp) "3006 "Register transport that has been created by application.";3007 1308 static char pjsua_enum_transports_doc[] = 3008 1309 "int[] py_pjsua.enum_transports () " … … 3033 1334 /* LIB ACCOUNT */ 3034 1335 3035 /*3036 * acc_config_Object3037 * Acc Config3038 */3039 typedef struct3040 {3041 PyObject_HEAD3042 /* Type-specific fields go here. */3043 int priority;3044 PyObject * id;3045 PyObject * reg_uri;3046 int publish_enabled;3047 PyObject * force_contact;3048 unsigned proxy_cnt;3049 /*pj_str_t proxy[8];*/3050 PyListObject * proxy;3051 unsigned reg_timeout;3052 unsigned cred_count;3053 /*pjsip_cred_info cred_info[8];*/3054 PyListObject * cred_info;3055 } acc_config_Object;3056 3057 3058 /*3059 * acc_config_dealloc3060 * deletes a acc_config from memory3061 */3062 static void acc_config_dealloc(acc_config_Object* self)3063 {3064 Py_XDECREF(self->id);3065 Py_XDECREF(self->reg_uri);3066 Py_XDECREF(self->force_contact);3067 Py_XDECREF(self->proxy);3068 Py_XDECREF(self->cred_info);3069 self->ob_type->tp_free((PyObject*)self);3070 }3071 3072 3073 /*3074 * acc_config_new3075 * constructor for acc_config object3076 */3077 static PyObject * acc_config_new(PyTypeObject *type, PyObject *args,3078 PyObject *kwds)3079 {3080 acc_config_Object *self;3081 3082 self = (acc_config_Object *)type->tp_alloc(type, 0);3083 if (self != NULL)3084 {3085 self->id = PyString_FromString("");3086 if (self->id == NULL)3087 {3088 Py_DECREF(self);3089 return NULL;3090 }3091 self->reg_uri = PyString_FromString("");3092 if (self->reg_uri == NULL)3093 {3094 Py_DECREF(self);3095 return NULL;3096 }3097 self->force_contact = PyString_FromString("");3098 if (self->force_contact == NULL)3099 {3100 Py_DECREF(self);3101 return NULL;3102 }3103 self->proxy = (PyListObject *)PyList_New(8);3104 if (self->proxy == NULL)3105 {3106 Py_DECREF(self);3107 return NULL;3108 }3109 self->cred_info = (PyListObject *)PyList_New(8);3110 if (self->cred_info == NULL)3111 {3112 Py_DECREF(self);3113 return NULL;3114 }3115 }3116 3117 return (PyObject *)self;3118 }3119 3120 3121 3122 /*3123 * acc_config_members3124 */3125 static PyMemberDef acc_config_members[] =3126 {3127 {3128 "priority", T_INT, offsetof(acc_config_Object, priority), 0,3129 "Account priority, which is used to control the order of matching "3130 "incoming/outgoing requests. The higher the number means the higher "3131 "the priority is, and the account will be matched first. "3132 },3133 {3134 "id", T_OBJECT_EX,3135 offsetof(acc_config_Object, id), 0,3136 "The full SIP URL for the account. "3137 "The value can take name address or URL format, "3138 "and will look something like 'sip:account@serviceprovider'. "3139 "This field is mandatory."3140 },3141 {3142 "reg_uri", T_OBJECT_EX,3143 offsetof(acc_config_Object, reg_uri), 0,3144 "This is the URL to be put in the request URI for the registration, "3145 "and will look something like 'sip:serviceprovider'. "3146 "This field should be specified if registration is desired. "3147 "If the value is empty, no account registration will be performed. "3148 },3149 {3150 "publish_enabled", T_INT,3151 offsetof(acc_config_Object, publish_enabled), 0,3152 "Publish presence? "3153 },3154 {3155 "force_contact", T_OBJECT_EX,3156 offsetof(acc_config_Object, force_contact), 0,3157 "Optional URI to be put as Contact for this account. "3158 "It is recommended that this field is left empty, "3159 "so that the value will be calculated automatically "3160 "based on the transport address. "3161 },3162 {3163 "proxy_cnt", T_INT, offsetof(acc_config_Object, proxy_cnt), 0,3164 "Number of proxies in the proxy array below. "3165 },3166 {3167 "proxy", T_OBJECT_EX,3168 offsetof(acc_config_Object, proxy), 0,3169 "Optional URI of the proxies to be visited for all outgoing requests "3170 "that are using this account (REGISTER, INVITE, etc). Application need "3171 "to specify these proxies if the service provider requires "3172 "that requests destined towards its network should go through certain "3173 "proxies first (for example, border controllers)."3174 },3175 {3176 "reg_timeout", T_INT, offsetof(acc_config_Object, reg_timeout), 0,3177 "Optional interval for registration, in seconds. "3178 "If the value is zero, default interval will be used "3179 "(PJSUA_REG_INTERVAL, 55 seconds). "3180 },3181 {3182 "cred_count", T_INT, offsetof(acc_config_Object, cred_count), 0,3183 "Number of credentials in the credential array. "3184 },3185 {3186 "cred_info", T_OBJECT_EX,3187 offsetof(acc_config_Object, cred_info), 0,3188 "Array of credentials. If registration is desired, normally there "3189 "should be at least one credential specified, to successfully "3190 "authenticate against the service provider. More credentials can "3191 "be specified, for example when the requests are expected to be "3192 "challenged by the proxies in the route set."3193 },3194 {NULL} /* Sentinel */3195 };3196 3197 3198 3199 3200 /*3201 * acc_config_Type3202 */3203 static PyTypeObject acc_config_Type =3204 {3205 PyObject_HEAD_INIT(NULL)3206 0, /*ob_size*/3207 "py_pjsua.Acc_Config", /*tp_name*/3208 sizeof(acc_config_Object), /*tp_basicsize*/3209 0, /*tp_itemsize*/3210 (destructor)acc_config_dealloc,/*tp_dealloc*/3211 0, /*tp_print*/3212 0, /*tp_getattr*/3213 0, /*tp_setattr*/3214 0, /*tp_compare*/3215 0, /*tp_repr*/3216 0, /*tp_as_number*/3217 0, /*tp_as_sequence*/3218 0, /*tp_as_mapping*/3219 0, /*tp_hash */3220 0, /*tp_call*/3221 0, /*tp_str*/3222 0, /*tp_getattro*/3223 0, /*tp_setattro*/3224 0, /*tp_as_buffer*/3225 Py_TPFLAGS_DEFAULT, /*tp_flags*/3226 "Acc Config objects", /* tp_doc */3227 0, /* tp_traverse */3228 0, /* tp_clear */3229 0, /* tp_richcompare */3230 0, /* tp_weaklistoffset */3231 0, /* tp_iter */3232 0, /* tp_iternext */3233 0/*acc_config_methods*/, /* tp_methods */3234 acc_config_members, /* tp_members */3235 0, /* tp_getset */3236 0, /* tp_base */3237 0, /* tp_dict */3238 0, /* tp_descr_get */3239 0, /* tp_descr_set */3240 0, /* tp_dictoffset */3241 0, /* tp_init */3242 0, /* tp_alloc */3243 acc_config_new, /* tp_new */3244 3245 };3246 3247 /*3248 * acc_info_Object3249 * Acc Info3250 */3251 typedef struct3252 {3253 PyObject_HEAD3254 /* Type-specific fields go here. */3255 int id;3256 int is_default;3257 PyObject * acc_uri;3258 int has_registration;3259 int expires;3260 int status;3261 PyObject * status_text;3262 int online_status;3263 char buf_[PJ_ERR_MSG_SIZE];3264 } acc_info_Object;3265 3266 3267 /*3268 * acc_info_dealloc3269 * deletes a acc_info from memory3270 */3271 static void acc_info_dealloc(acc_info_Object* self)3272 {3273 Py_XDECREF(self->acc_uri);3274 Py_XDECREF(self->status_text);3275 self->ob_type->tp_free((PyObject*)self);3276 }3277 3278 3279 /*3280 * acc_info_new3281 * constructor for acc_info object3282 */3283 static PyObject * acc_info_new(PyTypeObject *type, PyObject *args,3284 PyObject *kwds)3285 {3286 acc_info_Object *self;3287 3288 self = (acc_info_Object *)type->tp_alloc(type, 0);3289 if (self != NULL)3290 {3291 self->acc_uri = PyString_FromString("");3292 if (self->acc_uri == NULL)3293 {3294 Py_DECREF(self);3295 return NULL;3296 }3297 self->status_text = PyString_FromString("");3298 if (self->status_text == NULL)3299 {3300 Py_DECREF(self);3301 return NULL;3302 }3303 3304 }3305 3306 return (PyObject *)self;3307 }3308 3309 static PyObject * acc_info_get_buf3310 (acc_info_Object *self, PyObject * args)3311 {3312 int idx;3313 char elmt;3314 if (!PyArg_ParseTuple(args,"i",&idx))3315 {3316 return NULL;3317 }3318 if ((idx >= 0) && (idx < PJ_ERR_MSG_SIZE))3319 {3320 elmt = self->buf_[idx];3321 }3322 else3323 {3324 return NULL;3325 }3326 return PyString_FromStringAndSize(&elmt, 1);3327 }3328 3329 static PyObject * acc_info_set_buf3330 (acc_info_Object *self, PyObject * args)3331 {3332 int idx;3333 PyObject * str;3334 char * s;3335 if (!PyArg_ParseTuple(args,"iO",&idx, &str))3336 {3337 return NULL;3338 }3339 if ((idx >= 0) && (idx < PJ_ERR_MSG_SIZE))3340 {3341 s = PyString_AsString(str);3342 if (s[0])3343 {3344 self->buf_[idx] = s[0];3345 }3346 else3347 {3348 return NULL;3349 }3350 }3351 else3352 {3353 return NULL;3354 }3355 Py_INCREF(Py_None);3356 return Py_None;3357 }3358 3359 static PyMethodDef acc_info_methods[] = {3360 {3361 "get_buf", (PyCFunction)acc_info_get_buf, METH_VARARGS,3362 "Return buf char at specified index"3363 },3364 {3365 "set_buf", (PyCFunction)acc_info_set_buf, METH_VARARGS,3366 "Set buf at specified index"3367 },3368 3369 {NULL} /* Sentinel */3370 };3371 3372 3373 3374 /*3375 * acc_info_members3376 */3377 static PyMemberDef acc_info_members[] =3378 {3379 {3380 "id", T_INT, offsetof(acc_info_Object, id), 0,3381 "The account ID."3382 },3383 {3384 "is_default", T_INT, offsetof(acc_info_Object, is_default), 0,3385 "Flag to indicate whether this is the default account. "3386 },3387 {3388 "acc_uri", T_OBJECT_EX,3389 offsetof(acc_info_Object, acc_uri), 0,3390 "Account URI"3391 },3392 {3393 "has_registration", T_INT, offsetof(acc_info_Object, has_registration),3394 0,3395 "Flag to tell whether this account has registration setting "3396 "(reg_uri is not empty)."3397 },3398 {3399 "expires", T_INT, offsetof(acc_info_Object, expires), 0,3400 "An up to date expiration interval for account registration session."3401 },3402 {3403 "status", T_INT, offsetof(acc_info_Object, status), 0,3404 "Last registration status code. If status code is zero, "3405 "the account is currently not registered. Any other value indicates "3406 "the SIP status code of the registration. "3407 },3408 {3409 "status_text", T_OBJECT_EX,3410 offsetof(acc_info_Object, status_text), 0,3411 "String describing the registration status."3412 },3413 {3414 "online_status", T_INT, offsetof(acc_info_Object, online_status), 0,3415 "Presence online status for this account. "3416 },3417 {NULL} /* Sentinel */3418 };3419 3420 3421 3422 3423 /*3424 * acc_info_Type3425 */3426 static PyTypeObject acc_info_Type =3427 {3428 PyObject_HEAD_INIT(NULL)3429 0, /*ob_size*/3430 "py_pjsua.Acc_Info", /*tp_name*/3431 sizeof(acc_info_Object), /*tp_basicsize*/3432 0, /*tp_itemsize*/3433 (destructor)acc_info_dealloc,/*tp_dealloc*/3434 0, /*tp_print*/3435 0, /*tp_getattr*/3436 0, /*tp_setattr*/3437 0, /*tp_compare*/3438 0, /*tp_repr*/3439 0, /*tp_as_number*/3440 0, /*tp_as_sequence*/3441 0, /*tp_as_mapping*/3442 0, /*tp_hash */3443 0, /*tp_call*/3444 0, /*tp_str*/3445 0, /*tp_getattro*/3446 0, /*tp_setattro*/3447 0, /*tp_as_buffer*/3448 Py_TPFLAGS_DEFAULT, /*tp_flags*/3449 "Acc Info objects", /* tp_doc */3450 0, /* tp_traverse */3451 0, /* tp_clear */3452 0, /* tp_richcompare */3453 0, /* tp_weaklistoffset */3454 0, /* tp_iter */3455 0, /* tp_iternext */3456 acc_info_methods, /* tp_methods */3457 acc_info_members, /* tp_members */3458 0, /* tp_getset */3459 0, /* tp_base */3460 0, /* tp_dict */3461 0, /* tp_descr_get */3462 0, /* tp_descr_set */3463 0, /* tp_dictoffset */3464 0, /* tp_init */3465 0, /* tp_alloc */3466 acc_info_new, /* tp_new */3467 3468 };3469 3470 3471 1336 3472 1337 /* … … 3474 1339 * !modified @ 051206 3475 1340 */ 3476 static PyObject *py_pjsua_acc_config_default 3477 (PyObject *pSelf, PyObject *pArgs) 3478 { 3479 acc_config_Object *obj; 1341 static PyObject *py_pjsua_acc_config_default(PyObject *pSelf, PyObject *pArgs) 1342 { 1343 PyObj_pjsua_acc_config *obj; 3480 1344 pjsua_acc_config cfg; 3481 int i; 3482 3483 if (!PyArg_ParseTuple(pArgs, "")) 3484 { 3485 return NULL; 3486 } 1345 1346 PJ_UNUSED_ARG(pSelf); 1347 1348 if (!PyArg_ParseTuple(pArgs, "")) { 1349 return NULL; 1350 } 1351 3487 1352 pjsua_acc_config_default(&cfg); 3488 obj = (acc_config_Object *)acc_config_new(&acc_config_Type, NULL, NULL); 3489 obj->cred_count = cfg.cred_count; 3490 for (i = 0; i < PJSUA_MAX_ACC; i++) 3491 { 3492 /*obj->cred_info[i] = cfg.cred_info[i];*/ 3493 int ret; 3494 pjsip_cred_info_Object * ci = 3495 (pjsip_cred_info_Object *)pjsip_cred_info_new 3496 (&pjsip_cred_info_Type,NULL,NULL); 3497 ci->data = PyString_FromStringAndSize(cfg.cred_info[i].data.ptr, 3498 cfg.cred_info[i].data.slen); 3499 ci->realm = PyString_FromStringAndSize(cfg.cred_info[i].realm.ptr, 3500 cfg.cred_info[i].realm.slen); 3501 ci->scheme = PyString_FromStringAndSize(cfg.cred_info[i].scheme.ptr, 3502 cfg.cred_info[i].scheme.slen); 3503 ci->username = PyString_FromStringAndSize(cfg.cred_info[i].username.ptr, 3504 cfg.cred_info[i].username.slen); 3505 ci->data_type = cfg.cred_info[i].data_type; 3506 ret = PyList_SetItem((PyObject *)obj->cred_info,i,(PyObject *)ci); 3507 if (ret == -1) { 3508 return NULL; 3509 } 3510 } 3511 3512 Py_XDECREF(obj->force_contact); 3513 obj->force_contact = 3514 PyString_FromStringAndSize(cfg.force_contact.ptr, 3515 cfg.force_contact.slen); 3516 obj->priority = cfg.priority; 3517 Py_XDECREF(obj->id); 3518 obj->id = 3519 PyString_FromStringAndSize(cfg.id.ptr, cfg.id.slen); 3520 Py_XDECREF(obj->reg_uri); 3521 obj->reg_uri = 3522 PyString_FromStringAndSize(cfg.reg_uri.ptr, cfg.reg_uri.slen); 3523 obj->proxy_cnt = cfg.proxy_cnt; 3524 for (i = 0; i < PJSUA_MAX_ACC; i++) 3525 { 3526 PyObject * str; 3527 int ret; 3528 /*obj->proxy[i] = cfg.proxy[i];*/ 3529 str = PyString_FromStringAndSize(cfg.proxy[i].ptr, cfg.proxy[i].slen); 3530 ret = PyList_SetItem((PyObject *)obj->proxy,i,str); 3531 if (ret == -1) { 3532 return NULL; 3533 } 3534 } 3535 obj->publish_enabled = cfg.publish_enabled; 3536 obj->reg_timeout = cfg.reg_timeout; 3537 1353 obj = (PyObj_pjsua_acc_config *) 1354 PyObj_pjsua_acc_config_new(&PyTyp_pjsua_acc_config, 1355 NULL, NULL); 1356 PyObj_pjsua_acc_config_import(obj, &cfg); 3538 1357 return (PyObject *)obj; 3539 1358 } … … 3542 1361 * py_pjsua_acc_get_count 3543 1362 */ 3544 static PyObject *py_pjsua_acc_get_count 3545 (PyObject *pSelf, PyObject *pArgs) 1363 static PyObject *py_pjsua_acc_get_count(PyObject *pSelf, PyObject *pArgs) 3546 1364 { 3547 1365 int count; 3548 if (!PyArg_ParseTuple(pArgs, "")) 3549 { 3550 return NULL; 3551 } 1366 1367 PJ_UNUSED_ARG(pSelf); 1368 1369 if (!PyArg_ParseTuple(pArgs, "")) { 1370 return NULL; 1371 } 1372 3552 1373 count = pjsua_acc_get_count(); 3553 1374 return Py_BuildValue("i",count); … … 3557 1378 * py_pjsua_acc_is_valid 3558 1379 */ 3559 static PyObject *py_pjsua_acc_is_valid 3560 (PyObject *pSelf, PyObject *pArgs) 1380 static PyObject *py_pjsua_acc_is_valid(PyObject *pSelf, PyObject *pArgs) 3561 1381 { 3562 1382 int id; 3563 1383 int is_valid; 3564 1384 3565 if (!PyArg_ParseTuple(pArgs, "i", &id)) 3566 { 3567 return NULL; 3568 } 3569 is_valid = pjsua_acc_is_valid(id); 3570 1385 PJ_UNUSED_ARG(pSelf); 1386 1387 if (!PyArg_ParseTuple(pArgs, "i", &id)) { 1388 return NULL; 1389 } 1390 1391 is_valid = pjsua_acc_is_valid(id); 3571 1392 return Py_BuildValue("i", is_valid); 3572 1393 } … … 3575 1396 * py_pjsua_acc_set_default 3576 1397 */ 3577 static PyObject *py_pjsua_acc_set_default 3578 (PyObject *pSelf, PyObject *pArgs) 1398 static PyObject *py_pjsua_acc_set_default(PyObject *pSelf, PyObject *pArgs) 3579 1399 { 3580 1400 int id; 3581 1401 int status; 3582 1402 3583 if (!PyArg_ParseTuple(pArgs, "i", &id)) 3584 { 1403 PJ_UNUSED_ARG(pSelf); 1404 1405 if (!PyArg_ParseTuple(pArgs, "i", &id)) { 3585 1406 return NULL; 3586 1407 } … … 3593 1414 * py_pjsua_acc_get_default 3594 1415 */ 3595 static PyObject *py_pjsua_acc_get_default 3596 (PyObject *pSelf, PyObject *pArgs) 1416 static PyObject *py_pjsua_acc_get_default(PyObject *pSelf, PyObject *pArgs) 3597 1417 { 3598 1418 int id; 3599 1419 3600 if (!PyArg_ParseTuple(pArgs, "")) 3601 { 3602 return NULL; 3603 } 1420 PJ_UNUSED_ARG(pSelf); 1421 1422 if (!PyArg_ParseTuple(pArgs, "")) { 1423 return NULL; 1424 } 1425 3604 1426 id = pjsua_acc_get_default(); 3605 1427 … … 3611 1433 * !modified @ 051206 3612 1434 */ 3613 static PyObject *py_pjsua_acc_add 3614 (PyObject *pSelf, PyObject *pArgs) 1435 static PyObject *py_pjsua_acc_add(PyObject *pSelf, PyObject *pArgs) 3615 1436 { 3616 1437 int is_default; 3617 1438 PyObject * acObj; 3618 acc_config_Object * ac; 3619 pjsua_acc_config cfg; 3620 3621 int p_acc_id; 1439 PyObj_pjsua_acc_config * ac; 1440 int acc_id; 3622 1441 int status; 3623 int i; 3624 3625 if (!PyArg_ParseTuple(pArgs, "Oi", &acObj, &is_default)) 3626 { 3627 return NULL; 3628 } 3629 3630 pjsua_acc_config_default(&cfg); 3631 if (acObj != Py_None) 3632 { 3633 ac = (acc_config_Object *)acObj; 3634 cfg.cred_count = ac->cred_count; 3635 for (i = 0; i < PJSUA_MAX_ACC; i++) 3636 { 3637 /*cfg.cred_info[i] = ac->cred_info[i];*/ 3638 pjsip_cred_info_Object * ci = (pjsip_cred_info_Object *) 3639 PyList_GetItem((PyObject *)ac->cred_info,i); 3640 cfg.cred_info[i].data.ptr = PyString_AsString(ci->data); 3641 cfg.cred_info[i].data.slen = strlen(PyString_AsString(ci->data)); 3642 cfg.cred_info[i].realm.ptr = PyString_AsString(ci->realm); 3643 cfg.cred_info[i].realm.slen = strlen(PyString_AsString(ci->realm)); 3644 cfg.cred_info[i].scheme.ptr = PyString_AsString(ci->scheme); 3645 cfg.cred_info[i].scheme.slen = strlen 3646 (PyString_AsString(ci->scheme)); 3647 cfg.cred_info[i].username.ptr = PyString_AsString(ci->username); 3648 cfg.cred_info[i].username.slen = strlen 3649 (PyString_AsString(ci->username)); 3650 cfg.cred_info[i].data_type = ci->data_type; 3651 } 3652 cfg.force_contact.ptr = PyString_AsString(ac->force_contact); 3653 cfg.force_contact.slen = strlen(PyString_AsString(ac->force_contact)); 3654 cfg.id.ptr = PyString_AsString(ac->id); 3655 cfg.id.slen = strlen(PyString_AsString(ac->id)); 3656 cfg.priority = ac->priority; 3657 for (i = 0; i < PJSUA_MAX_ACC; i++) 3658 { 3659 /*cfg.proxy[i] = ac->proxy[i];*/ 3660 cfg.proxy[i].ptr = PyString_AsString 3661 (PyList_GetItem((PyObject *)ac->proxy,i)); 3662 } 3663 cfg.proxy_cnt = ac->proxy_cnt; 3664 cfg.publish_enabled = ac->publish_enabled; 3665 cfg.reg_timeout = ac->reg_timeout; 3666 cfg.reg_uri.ptr = PyString_AsString(ac->reg_uri); 3667 cfg.reg_uri.slen = strlen(PyString_AsString(ac->reg_uri)); 3668 3669 status = pjsua_acc_add(&cfg, is_default, &p_acc_id); 1442 1443 PJ_UNUSED_ARG(pSelf); 1444 1445 if (!PyArg_ParseTuple(pArgs, "Oi", &acObj, &is_default)) { 1446 return NULL; 1447 } 1448 1449 if (acObj != Py_None) { 1450 pjsua_acc_config cfg; 1451 1452 pjsua_acc_config_default(&cfg); 1453 ac = (PyObj_pjsua_acc_config *)acObj; 1454 PyObj_pjsua_acc_config_export(&cfg, ac); 1455 status = pjsua_acc_add(&cfg, is_default, &acc_id); 3670 1456 } else { 3671 status = pjsua_acc_add(NULL, is_default, &p_acc_id); 3672 } 3673 3674 return Py_BuildValue("ii", status, p_acc_id); 1457 status = PJ_EINVAL; 1458 acc_id = PJSUA_INVALID_ID; 1459 } 1460 1461 return Py_BuildValue("ii", status, acc_id); 3675 1462 } 3676 1463 … … 3679 1466 * !modified @ 051206 3680 1467 */ 3681 static PyObject *py_pjsua_acc_add_local 3682 (PyObject *pSelf, PyObject *pArgs) 1468 static PyObject *py_pjsua_acc_add_local(PyObject *pSelf, PyObject *pArgs) 3683 1469 { 3684 1470 int is_default; 3685 1471 int tid; 3686 3687 1472 int p_acc_id; 3688 1473 int status; 3689 1474 3690 3691 if (!PyArg_ParseTuple(pArgs, "ii", &tid, &is_default)) 3692 {1475 PJ_UNUSED_ARG(pSelf); 1476 1477 if (!PyArg_ParseTuple(pArgs, "ii", &tid, &is_default)) { 3693 1478 return NULL; 3694 1479 } … … 3703 1488 * py_pjsua_acc_del 3704 1489 */ 3705 static PyObject *py_pjsua_acc_del 3706 (PyObject *pSelf, PyObject *pArgs) 1490 static PyObject *py_pjsua_acc_del(PyObject *pSelf, PyObject *pArgs) 3707 1491 { 3708 1492 int acc_id; 3709 1493 int status; 1494 1495 PJ_UNUSED_ARG(pSelf); 3710 1496 3711 1497 if (!PyArg_ParseTuple(pArgs, "i", &acc_id)) … … 3722 1508 * py_pjsua_acc_modify 3723 1509 */ 3724 static PyObject *py_pjsua_acc_modify 3725 (PyObject *pSelf, PyObject *pArgs) 1510 static PyObject *py_pjsua_acc_modify(PyObject *pSelf, PyObject *pArgs) 3726 1511 { 3727 1512 PyObject * acObj; 3728 acc_config_Object * ac; 3729 pjsua_acc_config cfg; 1513 PyObj_pjsua_acc_config * ac; 3730 1514 int acc_id; 3731 1515 int status; 3732 int i; 3733 3734 if (!PyArg_ParseTuple(pArgs, "iO", &acc_id, &acObj)) 3735 { 3736 return NULL; 3737 } 3738 if (acObj != Py_None) 3739 { 3740 ac = (acc_config_Object *)acObj; 3741 cfg.cred_count = ac->cred_count; 3742 for (i = 0; i < PJSUA_MAX_ACC; i++) 3743 { 3744 /*cfg.cred_info[i] = ac->cred_info[i];*/ 3745 pjsip_cred_info_Object * ci = (pjsip_cred_info_Object *) 3746 PyList_GetItem((PyObject *)ac->cred_info,i); 3747 cfg.cred_info[i].data.ptr = PyString_AsString(ci->data); 3748 cfg.cred_info[i].data.slen = strlen(PyString_AsString(ci->data)); 3749 cfg.cred_info[i].realm.ptr = PyString_AsString(ci->realm); 3750 cfg.cred_info[i].realm.slen = strlen(PyString_AsString(ci->realm)); 3751 cfg.cred_info[i].scheme.ptr = PyString_AsString(ci->scheme); 3752 cfg.cred_info[i].scheme.slen = strlen 3753 (PyString_AsString(ci->scheme)); 3754 cfg.cred_info[i].username.ptr = PyString_AsString(ci->username); 3755 cfg.cred_info[i].username.slen = strlen 3756 (PyString_AsString(ci->username)); 3757 } 3758 cfg.force_contact.ptr = PyString_AsString(ac->force_contact); 3759 cfg.force_contact.slen = strlen(PyString_AsString(ac->force_contact)); 3760 cfg.id.ptr = PyString_AsString(ac->id); 3761 cfg.id.slen = strlen(PyString_AsString(ac->id)); 3762 cfg.priority = ac->priority; 3763 for (i = 0; i < PJSUA_MAX_ACC; i++) 3764 { 3765 /*cfg.proxy[i] = ac->proxy[i];*/ 3766 cfg.proxy[i].ptr = PyString_AsString 3767 (PyList_GetItem((PyObject *)ac->proxy,i)); 3768 } 3769 cfg.proxy_cnt = ac->proxy_cnt; 3770 cfg.publish_enabled = ac->publish_enabled; 3771 cfg.reg_timeout = ac->reg_timeout; 3772 cfg.reg_uri.ptr = PyString_AsString(ac->reg_uri); 3773 cfg.reg_uri.slen = strlen(PyString_AsString(ac->reg_uri)); 1516 1517 PJ_UNUSED_ARG(pSelf); 1518 1519 if (!PyArg_ParseTuple(pArgs, "iO", &acc_id, &acObj)) { 1520 return NULL; 1521 } 1522 1523 if (acObj != Py_None) { 1524 pjsua_acc_config cfg; 1525 1526 pjsua_acc_config_default(&cfg); 1527 ac = (PyObj_pjsua_acc_config *)acObj; 1528 PyObj_pjsua_acc_config_export(&cfg, ac); 1529 3774 1530 status = pjsua_acc_modify(acc_id, &cfg); 3775 1531 } else { 3776 status = pjsua_acc_modify(acc_id, NULL);1532 status = PJ_EINVAL; 3777 1533 } 3778 1534 return Py_BuildValue("i", status); … … 3782 1538 * py_pjsua_acc_set_online_status 3783 1539 */ 3784 static PyObject *py_pjsua_acc_set_online_status 3785 (PyObject *pSelf,PyObject *pArgs)1540 static PyObject *py_pjsua_acc_set_online_status(PyObject *pSelf, 1541 PyObject *pArgs) 3786 1542 { 3787 1543 int is_online; … … 3789 1545 int status; 3790 1546 3791 if (!PyArg_ParseTuple(pArgs, "ii", &acc_id, &is_online)) 3792 { 1547 PJ_UNUSED_ARG(pSelf); 1548 1549 if (!PyArg_ParseTuple(pArgs, "ii", &acc_id, &is_online)) { 3793 1550 return NULL; 3794 1551 } … … 3800 1557 3801 1558 /* 1559 * py_pjsua_acc_set_online_status2 1560 */ 1561 static PyObject *py_pjsua_acc_set_online_status2(PyObject *pSelf, 1562 PyObject *pArgs) 1563 { 1564 int is_online; 1565 int acc_id; 1566 int activity_id; 1567 const char *activity_text; 1568 pjrpid_element rpid; 1569 pj_status_t status; 1570 1571 PJ_UNUSED_ARG(pSelf); 1572 1573 if (!PyArg_ParseTuple(pArgs, "iiis", &acc_id, &is_online, 1574 &activity_id, &activity_text)) { 1575 return NULL; 1576 } 1577 1578 pj_bzero(&rpid, sizeof(rpid)); 1579 rpid.activity = activity_id; 1580 rpid.note = pj_str((char*)activity_text); 1581 1582 status = pjsua_acc_set_online_status2(acc_id, is_online, &rpid); 1583 1584 return Py_BuildValue("i", status); 1585 } 1586 1587 /* 3802 1588 * py_pjsua_acc_set_registration 3803 1589 */ 3804 static PyObject *py_pjsua_acc_set_registration 3805 (PyObject *pSelf,PyObject *pArgs)1590 static PyObject *py_pjsua_acc_set_registration(PyObject *pSelf, 1591 PyObject *pArgs) 3806 1592 { 3807 1593 int renew; … … 3809 1595 int status; 3810 1596 3811 if (!PyArg_ParseTuple(pArgs, "ii", &acc_id, &renew)) 3812 { 1597 PJ_UNUSED_ARG(pSelf); 1598 1599 if (!PyArg_ParseTuple(pArgs, "ii", &acc_id, &renew)) { 3813 1600 return NULL; 3814 1601 } … … 3823 1610 * !modified @ 051206 3824 1611 */ 3825 static PyObject *py_pjsua_acc_get_info 3826 (PyObject *pSelf, PyObject *pArgs) 1612 static PyObject *py_pjsua_acc_get_info(PyObject *pSelf, PyObject *pArgs) 3827 1613 { 3828 1614 int acc_id; 3829 acc_info_Object* obj;1615 PyObj_pjsua_acc_info * obj; 3830 1616 pjsua_acc_info info; 3831 1617 int status; 3832 int i; 3833 3834 if (!PyArg_ParseTuple(pArgs, "i", &acc_id)) 3835 { 3836 return NULL; 3837 } 3838 1618 1619 PJ_UNUSED_ARG(pSelf); 1620 1621 if (!PyArg_ParseTuple(pArgs, "i", &acc_id)) { 1622 return NULL; 1623 } 3839 1624 3840 1625 status = pjsua_acc_get_info(acc_id, &info); 3841 if (status == PJ_SUCCESS) 3842 { 3843 obj = (acc_info_Object *)acc_info_new(&acc_info_Type,NULL, NULL); 3844 obj->acc_uri = 3845 PyString_FromStringAndSize(info.acc_uri.ptr, 3846 info.acc_uri.slen); 3847 for (i = 0; i < PJ_ERR_MSG_SIZE; i++) 3848 { 3849 obj->buf_[i] = info.buf_[i]; 3850 } 3851 obj->expires = info.expires; 3852 obj->has_registration = info.has_registration; 3853 obj->id = info.id; 3854 obj->is_default = info.is_default; 3855 obj->online_status = info.online_status; 3856 obj->status = info.status; 3857 obj->status_text = 3858 PyString_FromStringAndSize(info.status_text.ptr, 3859 info.status_text.slen); 1626 if (status == PJ_SUCCESS) { 1627 obj = (PyObj_pjsua_acc_info *) 1628 PyObj_pjsua_acc_info_new(&PyTyp_pjsua_acc_info,NULL, NULL); 1629 PyObj_pjsua_acc_info_import(obj, &info); 3860 1630 return Py_BuildValue("O", obj); 3861 1631 } else { … … 3876 1646 pjsua_acc_id id[PJSUA_MAX_ACC]; 3877 1647 unsigned c, i; 1648 1649 PJ_UNUSED_ARG(pSelf); 1650 3878 1651 if (!PyArg_ParseTuple(pArgs, "")) 3879 1652 { … … 3905 1678 pj_status_t status; 3906 1679 PyObject *list; 3907 3908 1680 pjsua_acc_info info[PJSUA_MAX_ACC]; 3909 1681 unsigned c, i; 3910 if (!PyArg_ParseTuple(pArgs, "")) 3911 { 1682 1683 PJ_UNUSED_ARG(pSelf); 1684 1685 if (!PyArg_ParseTuple(pArgs, "")) { 3912 1686 return NULL; 3913 1687 } … … 3917 1691 3918 1692 list = PyList_New(c); 3919 for (i = 0; i < c; i++) 3920 { 3921 int ret; 3922 int j; 3923 acc_info_Object *obj; 3924 obj = (acc_info_Object *)acc_info_new(&acc_info_Type,NULL,NULL); 3925 obj->acc_uri = PyString_FromStringAndSize 3926 (info[i].acc_uri.ptr, info[i].acc_uri.slen); 3927 for(j = 0; j < PJ_ERR_MSG_SIZE; j++) 3928 { 3929 obj->buf_[j] = info[i].buf_[j]; 3930 } 3931 obj->expires = info[i].expires; 3932 obj->has_registration = info[i].has_registration; 3933 obj->id = info[i].id; 3934 obj->is_default = info[i].is_default; 3935 obj->online_status = info[i].online_status; 3936 obj->status = info[i].status; 3937 obj->status_text = PyString_FromStringAndSize(info[i].status_text.ptr, 3938 info[i].status_text.slen); 3939 ret = PyList_SetItem(list, i, (PyObject *)obj); 3940 if (ret == -1) { 3941 return NULL; 3942 } 1693 for (i = 0; i < c; i++) { 1694 PyObj_pjsua_acc_info *obj; 1695 obj = (PyObj_pjsua_acc_info *) 1696 PyObj_pjsua_acc_info_new(&PyTyp_pjsua_acc_info, NULL, NULL); 1697 1698 PyObj_pjsua_acc_info_import(obj, &info[i]); 1699 1700 PyList_SetItem(list, i, (PyObject *)obj); 3943 1701 } 3944 1702 … … 3949 1707 * py_pjsua_acc_find_for_outgoing 3950 1708 */ 3951 static PyObject *py_pjsua_acc_find_for_outgoing 3952 (PyObject *pSelf, PyObject *pArgs) 3953 { 3954 1709 static PyObject *py_pjsua_acc_find_for_outgoing(PyObject *pSelf, 1710 PyObject *pArgs) 1711 { 3955 1712 int acc_id; 3956 1713 PyObject * url; 3957 1714 pj_str_t str; 1715 1716 PJ_UNUSED_ARG(pSelf); 3958 1717 3959 1718 if (!PyArg_ParseTuple(pArgs, "O", &url)) … … 3972 1731 * py_pjsua_acc_find_for_incoming 3973 1732 */ 3974 static PyObject *py_pjsua_acc_find_for_incoming 3975 (PyObject *pSelf,PyObject *pArgs)1733 static PyObject *py_pjsua_acc_find_for_incoming(PyObject *pSelf, 1734 PyObject *pArgs) 3976 1735 { 3977 1736 int acc_id; 3978 1737 PyObject * tmpObj; 3979 pjsip_rx_data_Object* obj;1738 PyObj_pjsip_rx_data * obj; 3980 1739 pjsip_rx_data * rdata; 3981 1740 1741 PJ_UNUSED_ARG(pSelf); 1742 3982 1743 if (!PyArg_ParseTuple(pArgs, "O", &tmpObj)) 3983 1744 { … … 3986 1747 if (tmpObj != Py_None) 3987 1748 { 3988 obj = ( pjsip_rx_data_Object*)tmpObj;1749 obj = (PyObj_pjsip_rx_data *)tmpObj; 3989 1750 rdata = obj->rdata; 3990 1751 acc_id = pjsua_acc_find_for_incoming(rdata); … … 3999 1760 * !modified @ 061206 4000 1761 */ 4001 static PyObject *py_pjsua_acc_create_uac_contact 4002 (PyObject *pSelf,PyObject *pArgs)1762 static PyObject *py_pjsua_acc_create_uac_contact(PyObject *pSelf, 1763 PyObject *pArgs) 4003 1764 { 4004 1765 int status; 4005 1766 int acc_id; 4006 1767 PyObject * pObj; 4007 pj_pool_Object* p;1768 PyObj_pj_pool * p; 4008 1769 pj_pool_t * pool; 4009 1770 PyObject * strc; … … 4012 1773 pj_str_t uri; 4013 1774 1775 PJ_UNUSED_ARG(pSelf); 1776 4014 1777 if (!PyArg_ParseTuple(pArgs, "OiO", &pObj, &acc_id, &stru)) 4015 1778 { … … 4018 1781 if (pObj != Py_None) 4019 1782 { 4020 p = ( pj_pool_Object*)pObj;1783 p = (PyObj_pj_pool *)pObj; 4021 1784 pool = p->pool; 4022 1785 uri.ptr = PyString_AsString(stru); … … 4035 1798 * !modified @ 061206 4036 1799 */ 4037 static PyObject *py_pjsua_acc_create_uas_contact 4038 (PyObject *pSelf,PyObject *pArgs)1800 static PyObject *py_pjsua_acc_create_uas_contact(PyObject *pSelf, 1801 PyObject *pArgs) 4039 1802 { 4040 1803 int status; 4041 1804 int acc_id; 4042 1805 PyObject * pObj; 4043 pj_pool_Object* p;1806 PyObj_pj_pool * p; 4044 1807 pj_pool_t * pool; 4045 1808 PyObject * strc; 4046 1809 pj_str_t contact; 4047 1810 PyObject * rObj; 4048 pjsip_rx_data_Object* objr;1811 PyObj_pjsip_rx_data * objr; 4049 1812 pjsip_rx_data * rdata; 4050 1813 1814 PJ_UNUSED_ARG(pSelf); 1815 4051 1816 if (!PyArg_ParseTuple(pArgs, "OiO", &pObj, &acc_id, &rObj)) 4052 1817 { … … 4055 1820 if (pObj != Py_None) 4056 1821 { 4057 p = ( pj_pool_Object*)pObj;1822 p = (PyObj_pj_pool *)pObj; 4058 1823 pool = p->pool; 4059 1824 } else { … … 4062 1827 if (rObj != Py_None) 4063 1828 { 4064 objr = ( pjsip_rx_data_Object*)rObj;1829 objr = (PyObj_pjsip_rx_data *)rObj; 4065 1830 rdata = objr->rdata; 4066 1831 } else { … … 4107 1872 "Modify account information."; 4108 1873 static char pjsua_acc_set_online_status_doc[] = 4109 "int py_pjsua.acc_set_online_status (int acc_id, int is_online) " 1874 "int py_pjsua.acc_set_online_status2(int acc_id, int is_online) " 1875 "Modify account's presence status to be advertised " 1876 "to remote/presence subscribers."; 1877 static char pjsua_acc_set_online_status2_doc[] = 1878 "int py_pjsua.acc_set_online_status (int acc_id, int is_online, " 1879 "int activity_id, string activity_text) " 4110 1880 "Modify account's presence status to be advertised " 4111 1881 "to remote/presence subscribers."; … … 4127 1897 "to used to reach to the specified URL."; 4128 1898 static char pjsua_acc_find_for_incoming_doc[] = 4129 "int py_pjsua.acc_find_for_incoming ( pjsip_rx_data_Objectrdata) "1899 "int py_pjsua.acc_find_for_incoming (PyObj_pjsip_rx_data rdata) " 4130 1900 "This is an internal function to find the most appropriate account " 4131 1901 "to be used to handle incoming calls."; 4132 1902 static char pjsua_acc_create_uac_contact_doc[] = 4133 "string py_pjsua.acc_create_uac_contact ( pj_pool_Objectpool, "1903 "string py_pjsua.acc_create_uac_contact (PyObj_pj_pool pool, " 4134 1904 "int acc_id, string uri) " 4135 1905 "Create a suitable URI to be put as Contact based on the specified " 4136 1906 "target URI for the specified account."; 4137 1907 static char pjsua_acc_create_uas_contact_doc[] = 4138 "string py_pjsua.acc_create_uas_contact ( pj_pool_Objectpool, "4139 "int acc_id, pjsip_rx_data_Objectrdata) "1908 "string py_pjsua.acc_create_uas_contact (PyObj_pj_pool pool, " 1909 "int acc_id, PyObj_pjsip_rx_data rdata) " 4140 1910 "Create a suitable URI to be put as Contact based on the information " 4141 1911 "in the incoming request."; … … 4148 1918 4149 1919 /* 4150 * buddy_config_Object4151 * Buddy Config4152 */4153 typedef struct4154 {4155 PyObject_HEAD4156 /* Type-specific fields go here. */4157 4158 PyObject * uri;4159 int subscribe;4160 } buddy_config_Object;4161 4162 4163 /*4164 * buddy_config_dealloc4165 * deletes a buddy_config from memory4166 */4167 static void buddy_config_dealloc(buddy_config_Object* self)4168 {4169 Py_XDECREF(self->uri);4170 self->ob_type->tp_free((PyObject*)self);4171 }4172 4173 4174 /*4175 * buddy_config_new4176 * constructor for buddy_config object4177 */4178 static PyObject * buddy_config_new(PyTypeObject *type, PyObject *args,4179 PyObject *kwds)4180 {4181 buddy_config_Object *self;4182 4183 self = (buddy_config_Object *)type->tp_alloc(type, 0);4184 if (self != NULL)4185 {4186 self->uri = PyString_FromString("");4187 if (self->uri == NULL)4188 {4189 Py_DECREF(self);4190 return NULL;4191 }4192 }4193 return (PyObject *)self;4194 }4195 4196 /*4197 * buddy_config_members4198 */4199 static PyMemberDef buddy_config_members[] =4200 {4201 4202 {4203 "uri", T_OBJECT_EX,4204 offsetof(buddy_config_Object, uri), 0,4205 "TBuddy URL or name address."4206 },4207 4208 {4209 "subscribe", T_INT,4210 offsetof(buddy_config_Object, subscribe), 0,4211 "Specify whether presence subscription should start immediately. "4212 },4213 4214 {NULL} /* Sentinel */4215 };4216 4217 4218 4219 4220 /*4221 * buddy_config_Type4222 */4223 static PyTypeObject buddy_config_Type =4224 {4225 PyObject_HEAD_INIT(NULL)4226 0, /*ob_size*/4227 "py_pjsua.Buddy_Config", /*tp_name*/4228 sizeof(buddy_config_Object), /*tp_basicsize*/4229 0, /*tp_itemsize*/4230 (destructor)buddy_config_dealloc,/*tp_dealloc*/4231 0, /*tp_print*/4232 0, /*tp_getattr*/4233 0, /*tp_setattr*/4234 0, /*tp_compare*/4235 0, /*tp_repr*/4236 0, /*tp_as_number*/4237 0, /*tp_as_sequence*/4238 0, /*tp_as_mapping*/4239 0, /*tp_hash */4240 0, /*tp_call*/4241 0, /*tp_str*/4242 0, /*tp_getattro*/4243 0, /*tp_setattro*/4244 0, /*tp_as_buffer*/4245 Py_TPFLAGS_DEFAULT, /*tp_flags*/4246 "Buddy Config objects", /* tp_doc */4247 0, /* tp_traverse */4248 0, /* tp_clear */4249 0, /* tp_richcompare */4250 0, /* tp_weaklistoffset */4251 0, /* tp_iter */4252 0, /* tp_iternext */4253 0, /* tp_methods */4254 buddy_config_members, /* tp_members */4255 0, /* tp_getset */4256 0, /* tp_base */4257 0, /* tp_dict */4258 0, /* tp_descr_get */4259 0, /* tp_descr_set */4260 0, /* tp_dictoffset */4261 0, /* tp_init */4262 0, /* tp_alloc */4263 buddy_config_new, /* tp_new */4264 4265 };4266 4267 /*4268 * buddy_info_Object4269 * Buddy Info4270 * !modified @ 0712064271 */4272 typedef struct4273 {4274 PyObject_HEAD4275 /* Type-specific fields go here. */4276 int id;4277 PyObject * uri;4278 PyObject * contact;4279 int status;4280 PyObject * status_text;4281 int monitor_pres;4282 char buf_[256];4283 } buddy_info_Object;4284 4285 4286 /*4287 * buddy_info_dealloc4288 * deletes a buddy_info from memory4289 * !modified @ 0712064290 */4291 static void buddy_info_dealloc(buddy_info_Object* self)4292 {4293 Py_XDECREF(self->uri);4294 Py_XDECREF(self->contact);4295 Py_XDECREF(self->status_text);4296 4297 self->ob_type->tp_free((PyObject*)self);4298 }4299 4300 4301 /*4302 * buddy_info_new4303 * constructor for buddy_info object4304 * !modified @ 0712064305 */4306 static PyObject * buddy_info_new(PyTypeObject *type, PyObject *args,4307 PyObject *kwds)4308 {4309 buddy_info_Object *self;4310 4311 self = (buddy_info_Object *)type->tp_alloc(type, 0);4312 if (self != NULL)4313 {4314 self->uri = PyString_FromString("");4315 if (self->uri == NULL)4316 {4317 Py_DECREF(self);4318 return NULL;4319 }4320 self->contact = PyString_FromString("");4321 if (self->contact == NULL)4322 {4323 Py_DECREF(self);4324 return NULL;4325 }4326 self->status_text = PyString_FromString("");4327 if (self->status_text == NULL)4328 {4329 Py_DECREF(self);4330 return NULL;4331 }4332 4333 }4334 return (PyObject *)self;4335 }4336 4337 /*4338 * buddy_info_members4339 * !modified @ 0712064340 */4341 static PyMemberDef buddy_info_members[] =4342 {4343 {4344 "id", T_INT,4345 offsetof(buddy_info_Object, id), 0,4346 "The buddy ID."4347 },4348 {4349 "uri", T_OBJECT_EX,4350 offsetof(buddy_info_Object, uri), 0,4351 "The full URI of the buddy, as specified in the configuration. "4352 },4353 {4354 "contact", T_OBJECT_EX,4355 offsetof(buddy_info_Object, contact), 0,4356 "Buddy's Contact, only available when presence subscription "4357 "has been established to the buddy."4358 },4359 {4360 "status", T_INT,4361 offsetof(buddy_info_Object, status), 0,4362 "Buddy's online status. "4363 },4364 {4365 "status_text", T_OBJECT_EX,4366 offsetof(buddy_info_Object, status_text), 0,4367 "Text to describe buddy's online status."4368 },4369 {4370 "monitor_pres", T_INT,4371 offsetof(buddy_info_Object, monitor_pres), 0,4372 "Flag to indicate that we should monitor the presence information "4373 "for this buddy (normally yes, unless explicitly disabled). "4374 },4375 4376 4377 {NULL} /* Sentinel */4378 };4379 4380 4381 4382 4383 /*4384 * buddy_info_Type4385 */4386 static PyTypeObject buddy_info_Type =4387 {4388 PyObject_HEAD_INIT(NULL)4389 0, /*ob_size*/4390 "py_pjsua.Buddy_Info", /*tp_name*/4391 sizeof(buddy_info_Object), /*tp_basicsize*/4392 0, /*tp_itemsize*/4393 (destructor)buddy_info_dealloc,/*tp_dealloc*/4394 0, /*tp_print*/4395 0, /*tp_getattr*/4396 0, /*tp_setattr*/4397 0, /*tp_compare*/4398 0, /*tp_repr*/4399 0, /*tp_as_number*/4400 0, /*tp_as_sequence*/4401 0, /*tp_as_mapping*/4402 0, /*tp_hash */4403 0, /*tp_call*/4404 0, /*tp_str*/4405 0, /*tp_getattro*/4406 0, /*tp_setattro*/4407 0, /*tp_as_buffer*/4408 Py_TPFLAGS_DEFAULT, /*tp_flags*/4409 "Buddy Info objects", /* tp_doc */4410 0, /* tp_traverse */4411 0, /* tp_clear */4412 0, /* tp_richcompare */4413 0, /* tp_weaklistoffset */4414 0, /* tp_iter */4415 0, /* tp_iternext */4416 0, /* tp_methods */4417 buddy_info_members, /* tp_members */4418 0, /* tp_getset */4419 0, /* tp_base */4420 0, /* tp_dict */4421 0, /* tp_descr_get */4422 0, /* tp_descr_set */4423 0, /* tp_dictoffset */4424 0, /* tp_init */4425 0, /* tp_alloc */4426 buddy_info_new, /* tp_new */4427 4428 };4429 4430 /*4431 1920 * py_pjsua_buddy_config_default 4432 1921 */ 4433 static PyObject *py_pjsua_buddy_config_default 4434 (PyObject *pSelf,PyObject *pArgs)1922 static PyObject *py_pjsua_buddy_config_default(PyObject *pSelf, 1923 PyObject *pArgs) 4435 1924 { 4436 buddy_config_Object*obj;1925 PyObj_pjsua_buddy_config *obj; 4437 1926 pjsua_buddy_config cfg; 4438 1927 4439 if (!PyArg_ParseTuple(pArgs, "")) 4440 { 1928 PJ_UNUSED_ARG(pSelf); 1929 1930 if (!PyArg_ParseTuple(pArgs, "")) { 4441 1931 return NULL; 4442 1932 } 4443 1933 4444 1934 pjsua_buddy_config_default(&cfg); 4445 obj = (buddy_config_Object *) buddy_config_new 4446 (&buddy_config_Type,NULL,NULL); 4447 obj->uri = PyString_FromStringAndSize( 4448 cfg.uri.ptr, cfg.uri.slen 4449 ); 4450 obj->subscribe = cfg.subscribe; 1935 obj = (PyObj_pjsua_buddy_config *) 1936 PyObj_pjsua_buddy_config_new(&PyTyp_pjsua_buddy_config, NULL, NULL); 1937 PyObj_pjsua_buddy_config_import(obj, &cfg); 4451 1938 4452 1939 return (PyObject *)obj; … … 4456 1943 * py_pjsua_get_buddy_count 4457 1944 */ 4458 static PyObject *py_pjsua_get_buddy_count 4459 (PyObject *pSelf, PyObject *pArgs) 1945 static PyObject *py_pjsua_get_buddy_count(PyObject *pSelf, PyObject *pArgs) 4460 1946 { 4461 1947 int ret; 4462 1948 4463 if (!PyArg_ParseTuple(pArgs, "")) 4464 { 1949 PJ_UNUSED_ARG(pSelf); 1950 1951 if (!PyArg_ParseTuple(pArgs, "")) { 4465 1952 return NULL; 4466 1953 } … … 4473 1960 * py_pjsua_buddy_is_valid 4474 1961 */ 4475 static PyObject *py_pjsua_buddy_is_valid 4476 (PyObject *pSelf, PyObject *pArgs) 1962 static PyObject *py_pjsua_buddy_is_valid(PyObject *pSelf, PyObject *pArgs) 4477 1963 { 4478 1964 int id; 4479 1965 int is_valid; 4480 1966 4481 if (!PyArg_ParseTuple(pArgs, "i", &id)) 4482 { 1967 PJ_UNUSED_ARG(pSelf); 1968 1969 if (!PyArg_ParseTuple(pArgs, "i", &id)) { 4483 1970 return NULL; 4484 1971 } … … 4499 1986 pjsua_buddy_id id[PJSUA_MAX_BUDDIES]; 4500 1987 unsigned c, i; 4501 if (!PyArg_ParseTuple(pArgs, "")) 4502 { 1988 1989 PJ_UNUSED_ARG(pSelf); 1990 1991 if (!PyArg_ParseTuple(pArgs, "")) { 4503 1992 return NULL; 4504 1993 } … … 4506 1995 status = pjsua_enum_buddies(id, &c); 4507 1996 list = PyList_New(c); 4508 for (i = 0; i < c; i++) 4509 { 4510 int ret = PyList_SetItem(list, i, Py_BuildValue("i", id[i])); 4511 if (ret == -1) 4512 { 4513 return NULL; 4514 } 1997 for (i = 0; i < c; i++) { 1998 PyList_SetItem(list, i, Py_BuildValue("i", id[i])); 4515 1999 } 4516 2000 … … 4522 2006 * !modified @ 071206 4523 2007 */ 4524 static PyObject *py_pjsua_buddy_get_info 4525 (PyObject *pSelf, PyObject *pArgs) 2008 static PyObject *py_pjsua_buddy_get_info(PyObject *pSelf, PyObject *pArgs) 4526 2009 { 4527 2010 int buddy_id; 4528 buddy_info_Object* obj;2011 PyObj_pjsua_buddy_info * obj; 4529 2012 pjsua_buddy_info info; 4530 2013 int status; 4531 int i; 4532 4533 if (!PyArg_ParseTuple(pArgs, "i", &buddy_id)) 4534 { 4535 return NULL; 4536 } 4537 4538 2014 2015 PJ_UNUSED_ARG(pSelf); 2016 2017 if (!PyArg_ParseTuple(pArgs, "i", &buddy_id)) { 2018 return NULL; 2019 } 2020 4539 2021 status = pjsua_buddy_get_info(buddy_id, &info); 4540 if (status == PJ_SUCCESS) 4541 { 4542 obj = (buddy_info_Object *)buddy_info_new(&buddy_info_Type,NULL,NULL); 4543 obj->id = info.id; 4544 Py_XDECREF(obj->uri); 4545 obj->uri = 4546 PyString_FromStringAndSize(info.uri.ptr, 4547 info.uri.slen); 4548 Py_XDECREF(obj->contact); 4549 obj->contact = 4550 PyString_FromStringAndSize(info.contact.ptr, 4551 info.contact.slen); 4552 obj->status = info.status; 4553 Py_XDECREF(obj->status_text); 4554 obj->status_text = 4555 PyString_FromStringAndSize(info.status_text.ptr, 4556 info.status_text.slen); 4557 obj->monitor_pres = info.monitor_pres; 4558 for (i = 0; i < 256; i++) 4559 { 4560 4561 obj->buf_[i] = info.buf_[i]; 4562 } 4563 2022 if (status == PJ_SUCCESS) { 2023 obj = (PyObj_pjsua_buddy_info *) 2024 PyObj_pjsua_buddy_config_new(&PyTyp_pjsua_buddy_info,NULL,NULL); 2025 PyObj_pjsua_buddy_info_import(obj, &info); 4564 2026 return Py_BuildValue("O", obj); 4565 2027 } else { … … 4573 2035 * !modified @ 061206 4574 2036 */ 4575 static PyObject *py_pjsua_buddy_add 4576 (PyObject *pSelf, PyObject *pArgs) 2037 static PyObject *py_pjsua_buddy_add(PyObject *pSelf, PyObject *pArgs) 4577 2038 { 4578 2039 PyObject * bcObj; 4579 buddy_config_Object * bc; 4580 4581 pjsua_buddy_config cfg; 4582 4583 int p_buddy_id; 2040 int buddy_id; 4584 2041 int status; 4585 2042 4586 if (!PyArg_ParseTuple(pArgs, "O", &bcObj)) 4587 { 4588 return NULL; 4589 } 4590 if (bcObj != Py_None) 4591 { 4592 bc = (buddy_config_Object *)bcObj; 4593 4594 cfg.subscribe = bc->subscribe; 4595 cfg.uri.ptr = PyString_AsString(bc->uri); 4596 cfg.uri.slen = strlen(PyString_AsString(bc->uri)); 4597 4598 status = pjsua_buddy_add(&cfg, &p_buddy_id); 2043 PJ_UNUSED_ARG(pSelf); 2044 2045 if (!PyArg_ParseTuple(pArgs, "O", &bcObj)) { 2046 return NULL; 2047 } 2048 2049 if (bcObj != Py_None) { 2050 pjsua_buddy_config cfg; 2051 PyObj_pjsua_buddy_config * bc; 2052 2053 bc = (PyObj_pjsua_buddy_config *)bcObj; 2054 2055 pjsua_buddy_config_default(&cfg); 2056 PyObj_pjsua_buddy_config_export(&cfg, bc); 2057 2058 status = pjsua_buddy_add(&cfg, &buddy_id); 4599 2059 } else { 4600 status = pjsua_buddy_add(NULL, &p_buddy_id); 4601 } 4602 return Py_BuildValue("ii", status, p_buddy_id); 2060 status = PJ_EINVAL; 2061 buddy_id = PJSUA_INVALID_ID; 2062 } 2063 return Py_BuildValue("ii", status, buddy_id); 4603 2064 } 4604 2065 … … 4606 2067 * py_pjsua_buddy_del 4607 2068 */ 4608 static PyObject *py_pjsua_buddy_del 4609 (PyObject *pSelf, PyObject *pArgs) 2069 static PyObject *py_pjsua_buddy_del(PyObject *pSelf, PyObject *pArgs) 4610 2070 { 4611 2071 int buddy_id; 4612 2072 int status; 4613 2073 4614 if (!PyArg_ParseTuple(pArgs, "i", &buddy_id)) 4615 { 2074 PJ_UNUSED_ARG(pSelf); 2075 2076 if (!PyArg_ParseTuple(pArgs, "i", &buddy_id)) { 4616 2077 return NULL; 4617 2078 } … … 4625 2086 * py_pjsua_buddy_subscribe_pres 4626 2087 */ 4627 static PyObject *py_pjsua_buddy_subscribe_pres 4628 (PyObject *pSelf, PyObject *pArgs) 2088 static PyObject *py_pjsua_buddy_subscribe_pres(PyObject *pSelf, PyObject *pArgs) 4629 2089 { 4630 2090 int buddy_id; … … 4632 2092 int subscribe; 4633 2093 4634 if (!PyArg_ParseTuple(pArgs, "ii", &buddy_id, &subscribe)) 4635 { 2094 PJ_UNUSED_ARG(pSelf); 2095 2096 if (!PyArg_ParseTuple(pArgs, "ii", &buddy_id, &subscribe)) { 4636 2097 return NULL; 4637 2098 } … … 4645 2106 * py_pjsua_pres_dump 4646 2107 */ 4647 static PyObject *py_pjsua_pres_dump 4648 (PyObject *pSelf, PyObject *pArgs) 2108 static PyObject *py_pjsua_pres_dump(PyObject *pSelf, PyObject *pArgs) 4649 2109 { 4650 2110 int verbose; 4651 2111 4652 if (!PyArg_ParseTuple(pArgs, "i", &verbose)) 4653 { 2112 PJ_UNUSED_ARG(pSelf); 2113 2114 if (!PyArg_ParseTuple(pArgs, "i", &verbose)) { 4654 2115 return NULL; 4655 2116 } … … 4665 2126 * !modified @ 071206 4666 2127 */ 4667 static PyObject *py_pjsua_im_send 4668 (PyObject *pSelf, PyObject *pArgs) 2128 static PyObject *py_pjsua_im_send(PyObject *pSelf, PyObject *pArgs) 4669 2129 { 4670 2130 int status; … … 4677 2137 pjsua_msg_data msg_data; 4678 2138 PyObject * omdObj; 4679 msg_data_Object* omd;2139 PyObj_pjsua_msg_data * omd; 4680 2140 4681 2141 int user_data; 4682 2142 pj_pool_t *pool; 4683 2143 4684 2144 PJ_UNUSED_ARG(pSelf); 2145 4685 2146 if (!PyArg_ParseTuple(pArgs, "iOOOOi", &acc_id, 4686 2147 &st, &smt, &sc, &omdObj, &user_data)) … … 4688 2149 return NULL; 4689 2150 } 4690 if (smt != Py_None) 4691 { 2151 if (smt != Py_None) { 4692 2152 mime_type = &tmp_mime_type; 4693 tmp_mime_type.ptr = PyString_AsString(smt); 4694 tmp_mime_type.slen = strlen(PyString_AsString(smt)); 2153 tmp_mime_type = PyString_to_pj_str(smt); 4695 2154 } else { 4696 2155 mime_type = NULL; 4697 2156 } 4698 to.ptr = PyString_AsString(st); 4699 to.slen = strlen(PyString_AsString(st)); 4700 4701 content.ptr = PyString_AsString(sc); 4702 content.slen = strlen(PyString_AsString(sc)); 4703 if (omdObj != Py_None) 4704 { 2157 to = PyString_to_pj_str(st); 2158 content = PyString_to_pj_str(sc); 2159 2160 if (omdObj != Py_None) { 4705 2161 4706 omd = (msg_data_Object *)omdObj; 4707 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 4708 msg_data.content_type.slen = strlen 4709 (PyString_AsString(omd->content_type)); 4710 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 4711 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 2162 omd = (PyObj_pjsua_msg_data *)omdObj; 2163 msg_data.content_type = PyString_to_pj_str(omd->content_type); 2164 msg_data.msg_body = PyString_to_pj_str(omd->msg_body); 4712 2165 pool = pjsua_pool_create("pjsua", POOL_SIZE, POOL_SIZE); 4713 2166 … … 4728 2181 * py_pjsua_im_typing 4729 2182 */ 4730 static PyObject *py_pjsua_im_typing 4731 (PyObject *pSelf, PyObject *pArgs) 2183 static PyObject *py_pjsua_im_typing(PyObject *pSelf, PyObject *pArgs) 4732 2184 { 4733 2185 int status; … … 4738 2190 pjsua_msg_data msg_data; 4739 2191 PyObject * omdObj; 4740 msg_data_Object* omd;2192 PyObj_pjsua_msg_data * omd; 4741 2193 pj_pool_t * pool; 4742 2194 4743 if (!PyArg_ParseTuple(pArgs, "iOiO", &acc_id, &st, &is_typing, &omdObj)) 4744 { 2195 PJ_UNUSED_ARG(pSelf); 2196 2197 if (!PyArg_ParseTuple(pArgs, "iOiO", &acc_id, &st, &is_typing, &omdObj)) { 4745 2198 return NULL; 4746 2199 } 4747 2200 4748 to.ptr = PyString_AsString(st); 4749 to.slen = strlen(PyString_AsString(st)); 4750 if (omdObj != Py_None) 4751 { 4752 omd = (msg_data_Object *)omdObj; 4753 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 4754 msg_data.content_type.slen = strlen 4755 (PyString_AsString(omd->content_type)); 4756 msg_data.msg_body.ptr = PyString_AsString(omd->msg_body); 4757 msg_data.msg_body.slen = strlen(PyString_AsString(omd->msg_body)); 2201 to = PyString_to_pj_str(st); 2202 2203 if (omdObj != Py_None) { 2204 omd = (PyObj_pjsua_msg_data *)omdObj; 2205 msg_data.content_type = PyString_to_pj_str(omd->content_type); 2206 msg_data.msg_body = PyString_to_pj_str(omd->msg_body); 4758 2207 pool = pjsua_pool_create("pjsua", POOL_SIZE, POOL_SIZE); 4759 2208 … … 4811 2260 4812 2261 /* 4813 * codec_info_Object2262 * PyObj_pjsua_codec_info 4814 2263 * Codec Info 4815 2264 * !modified @ 071206 … … 4823 2272 pj_uint8_t priority; 4824 2273 char buf_[32]; 4825 } codec_info_Object;2274 } PyObj_pjsua_codec_info; 4826 2275 4827 2276 … … 4831 2280 * !modified @ 071206 4832 2281 */ 4833 static void codec_info_dealloc( codec_info_Object* self)2282 static void codec_info_dealloc(PyObj_pjsua_codec_info* self) 4834 2283 { 4835 2284 Py_XDECREF(self->codec_id); … … 4847 2296 PyObject *kwds) 4848 2297 { 4849 codec_info_Object *self; 4850 4851 self = (codec_info_Object *)type->tp_alloc(type, 0); 2298 PyObj_pjsua_codec_info *self; 2299 2300 PJ_UNUSED_ARG(args); 2301 PJ_UNUSED_ARG(kwds); 2302 2303 self = (PyObj_pjsua_codec_info *)type->tp_alloc(type, 0); 4852 2304 if (self != NULL) 4853 2305 { … … 4872 2324 { 4873 2325 "codec_id", T_OBJECT_EX, 4874 offsetof( codec_info_Object, codec_id), 0,2326 offsetof(PyObj_pjsua_codec_info, codec_id), 0, 4875 2327 "Codec unique identification." 4876 2328 }, … … 4878 2330 { 4879 2331 "priority", T_INT, 4880 offsetof( codec_info_Object, priority), 0,2332 offsetof(PyObj_pjsua_codec_info, priority), 0, 4881 2333 "Codec priority (integer 0-255)." 4882 2334 }, … … 4891 2343 4892 2344 /* 4893 * codec_info_Type4894 */ 4895 static PyTypeObject codec_info_Type=2345 * PyTyp_pjsua_codec_info 2346 */ 2347 static PyTypeObject PyTyp_pjsua_codec_info = 4896 2348 { 4897 2349 PyObject_HEAD_INIT(NULL) 4898 2350 0, /*ob_size*/ 4899 2351 "py_pjsua.Codec_Info", /*tp_name*/ 4900 sizeof( codec_info_Object), /*tp_basicsize*/2352 sizeof(PyObj_pjsua_codec_info), /*tp_basicsize*/ 4901 2353 0, /*tp_itemsize*/ 4902 2354 (destructor)codec_info_dealloc,/*tp_dealloc*/ … … 4938 2390 4939 2391 /* 4940 * conf_port_info_Object2392 * PyObj_pjsua_conf_port_info 4941 2393 * Conf Port Info 4942 2394 */ … … 4955 2407 PyListObject * listeners; 4956 2408 4957 } conf_port_info_Object;2409 } PyObj_pjsua_conf_port_info; 4958 2410 4959 2411 … … 4962 2414 * deletes a conf_port_info from memory 4963 2415 */ 4964 static void conf_port_info_dealloc( conf_port_info_Object* self)2416 static void conf_port_info_dealloc(PyObj_pjsua_conf_port_info* self) 4965 2417 { 4966 2418 Py_XDECREF(self->name); … … 4977 2429 PyObject *kwds) 4978 2430 { 4979 conf_port_info_Object *self; 4980 4981 self = (conf_port_info_Object *)type->tp_alloc(type, 0); 2431 PyObj_pjsua_conf_port_info *self; 2432 2433 PJ_UNUSED_ARG(args); 2434 PJ_UNUSED_ARG(kwds); 2435 2436 self = (PyObj_pjsua_conf_port_info *)type->tp_alloc(type, 0); 4982 2437 if (self != NULL) 4983 2438 { … … 5006 2461 { 5007 2462 "slot_id", T_INT, 5008 offsetof( conf_port_info_Object, slot_id), 0,2463 offsetof(PyObj_pjsua_conf_port_info, slot_id), 0, 5009 2464 "Conference port number." 5010 2465 }, 5011 2466 { 5012 2467 "name", T_OBJECT_EX, 5013 offsetof( conf_port_info_Object, name), 0,2468 offsetof(PyObj_pjsua_conf_port_info, name), 0, 5014 2469 "Port name" 5015 2470 }, 5016 2471 { 5017 2472 "clock_rate", T_INT, 5018 offsetof( conf_port_info_Object, clock_rate), 0,2473 offsetof(PyObj_pjsua_conf_port_info, clock_rate), 0, 5019 2474 "Clock rate" 5020 2475 }, 5021 2476 { 5022 2477 "channel_count", T_INT, 5023 offsetof( conf_port_info_Object, channel_count), 0,2478 offsetof(PyObj_pjsua_conf_port_info, channel_count), 0, 5024 2479 "Number of channels." 5025 2480 }, 5026 2481 { 5027 2482 "samples_per_frame", T_INT, 5028 offsetof( conf_port_info_Object, samples_per_frame), 0,2483 offsetof(PyObj_pjsua_conf_port_info, samples_per_frame), 0, 5029 2484 "Samples per frame " 5030 2485 }, 5031 2486 { 5032 2487 "bits_per_sample", T_INT, 5033 offsetof( conf_port_info_Object, bits_per_sample), 0,2488 offsetof(PyObj_pjsua_conf_port_info, bits_per_sample), 0, 5034 2489 "Bits per sample" 5035 2490 }, 5036 2491 { 5037 2492 "listener_cnt", T_INT, 5038 offsetof( conf_port_info_Object, listener_cnt), 0,2493 offsetof(PyObj_pjsua_conf_port_info, listener_cnt), 0, 5039 2494 "Number of listeners in the array." 5040 2495 }, 5041 2496 { 5042 2497 "listeners", T_OBJECT_EX, 5043 offsetof( conf_port_info_Object, listeners), 0,2498 offsetof(PyObj_pjsua_conf_port_info, listeners), 0, 5044 2499 "Array of listeners (in other words, ports where this port " 5045 2500 "is transmitting to" … … 5053 2508 5054 2509 /* 5055 * conf_port_info_Type5056 */ 5057 static PyTypeObject conf_port_info_Type=2510 * PyTyp_pjsua_conf_port_info 2511 */ 2512 static PyTypeObject PyTyp_pjsua_conf_port_info = 5058 2513 { 5059 2514 PyObject_HEAD_INIT(NULL) 5060 2515 0, /*ob_size*/ 5061 2516 "py_pjsua.Conf_Port_Info", /*tp_name*/ 5062 sizeof( conf_port_info_Object), /*tp_basicsize*/2517 sizeof(PyObj_pjsua_conf_port_info), /*tp_basicsize*/ 5063 2518 0, /*tp_itemsize*/ 5064 2519 (destructor)conf_port_info_dealloc,/*tp_dealloc*/ … … 5100 2555 5101 2556 /* 5102 * pjmedia_port_Object2557 * PyObj_pjmedia_port 5103 2558 */ 5104 2559 typedef struct … … 5107 2562 /* Type-specific fields go here. */ 5108 2563 pjmedia_port * port; 5109 } pjmedia_port_Object;5110 5111 5112 /* 5113 * pjmedia_port_Type5114 */ 5115 static PyTypeObject pjmedia_port_Type=2564 } PyObj_pjmedia_port; 2565 2566 2567 /* 2568 * PyTyp_pjmedia_port 2569 */ 2570 static PyTypeObject PyTyp_pjmedia_port = 5116 2571 { 5117 2572 PyObject_HEAD_INIT(NULL) 5118 2573 0, /*ob_size*/ 5119 2574 "py_pjsua.PJMedia_Port", /*tp_name*/ 5120 sizeof( pjmedia_port_Object), /*tp_basicsize*/2575 sizeof(PyObj_pjmedia_port), /*tp_basicsize*/ 5121 2576 0, /*tp_itemsize*/ 5122 2577 0, /*tp_dealloc*/ … … 5141 2596 5142 2597 /* 5143 * pjmedia_snd_dev_info_Object2598 * PyObj_pjmedia_snd_dev_info 5144 2599 * PJMedia Snd Dev Info 5145 2600 */ … … 5155 2610 PyObject * name; 5156 2611 5157 } pjmedia_snd_dev_info_Object;2612 } PyObj_pjmedia_snd_dev_info; 5158 2613 5159 2614 … … 5162 2617 * deletes a pjmedia_snd_dev_info from memory 5163 2618 */ 5164 static void pjmedia_snd_dev_info_dealloc( pjmedia_snd_dev_info_Object* self)2619 static void pjmedia_snd_dev_info_dealloc(PyObj_pjmedia_snd_dev_info* self) 5165 2620 { 5166 2621 Py_XDECREF(self->name); … … 5176 2631 PyObject *kwds) 5177 2632 { 5178 pjmedia_snd_dev_info_Object *self; 5179 5180 self = (pjmedia_snd_dev_info_Object *)type->tp_alloc(type, 0); 2633 PyObj_pjmedia_snd_dev_info *self; 2634 2635 PJ_UNUSED_ARG(args); 2636 PJ_UNUSED_ARG(kwds); 2637 2638 self = (PyObj_pjmedia_snd_dev_info *)type->tp_alloc(type, 0); 5181 2639 if (self != NULL) 5182 2640 { … … 5200 2658 { 5201 2659 "name", T_OBJECT_EX, 5202 offsetof( pjmedia_snd_dev_info_Object, name), 0,2660 offsetof(PyObj_pjmedia_snd_dev_info, name), 0, 5203 2661 "Device name" 5204 2662 }, 5205 2663 { 5206 2664 "input_count", T_INT, 5207 offsetof( pjmedia_snd_dev_info_Object, input_count), 0,2665 offsetof(PyObj_pjmedia_snd_dev_info, input_count), 0, 5208 2666 "Max number of input channels" 5209 2667 }, 5210 2668 { 5211 2669 "output_count", T_INT, 5212 offsetof( pjmedia_snd_dev_info_Object, output_count), 0,2670 offsetof(PyObj_pjmedia_snd_dev_info, output_count), 0, 5213 2671 "Max number of output channels" 5214 2672 }, 5215 2673 { 5216 2674 "default_samples_per_sec", T_INT, 5217 offsetof( pjmedia_snd_dev_info_Object, default_samples_per_sec), 0,2675 offsetof(PyObj_pjmedia_snd_dev_info, default_samples_per_sec), 0, 5218 2676 "Default sampling rate." 5219 2677 }, … … 5227 2685 5228 2686 /* 5229 * pjmedia_snd_dev_info_Type5230 */ 5231 static PyTypeObject pjmedia_snd_dev_info_Type=2687 * PyTyp_pjmedia_snd_dev_info 2688 */ 2689 static PyTypeObject PyTyp_pjmedia_snd_dev_info = 5232 2690 { 5233 2691 PyObject_HEAD_INIT(NULL) 5234 2692 0, /*ob_size*/ 5235 2693 "py_pjsua.PJMedia_Snd_Dev_Info", /*tp_name*/ 5236 sizeof( pjmedia_snd_dev_info_Object), /*tp_basicsize*/2694 sizeof(PyObj_pjmedia_snd_dev_info), /*tp_basicsize*/ 5237 2695 0, /*tp_itemsize*/ 5238 2696 (destructor)pjmedia_snd_dev_info_dealloc,/*tp_dealloc*/ … … 5274 2732 5275 2733 /* 5276 * pjmedia_codec_param_info_Object2734 * PyObj_pjmedia_codec_param_info 5277 2735 * PJMedia Codec Param Info 5278 2736 */ … … 5289 2747 pj_uint8_t pt; 5290 2748 5291 } pjmedia_codec_param_info_Object;2749 } PyObj_pjmedia_codec_param_info; 5292 2750 5293 2751 … … 5301 2759 { 5302 2760 "clock_rate", T_INT, 5303 offsetof( pjmedia_codec_param_info_Object, clock_rate), 0,2761 offsetof(PyObj_pjmedia_codec_param_info, clock_rate), 0, 5304 2762 "Sampling rate in Hz" 5305 2763 }, 5306 2764 { 5307 2765 "channel_cnt", T_INT, 5308 offsetof( pjmedia_codec_param_info_Object, channel_cnt), 0,2766 offsetof(PyObj_pjmedia_codec_param_info, channel_cnt), 0, 5309 2767 "Channel count" 5310 2768 }, 5311 2769 { 5312 2770 "avg_bps", T_INT, 5313 offsetof( pjmedia_codec_param_info_Object, avg_bps), 0,2771 offsetof(PyObj_pjmedia_codec_param_info, avg_bps), 0, 5314 2772 "Average bandwidth in bits/sec" 5315 2773 }, 5316 2774 { 5317 2775 "frm_ptime", T_INT, 5318 offsetof( pjmedia_codec_param_info_Object, frm_ptime), 0,2776 offsetof(PyObj_pjmedia_codec_param_info, frm_ptime), 0, 5319 2777 "Base frame ptime in msec." 5320 2778 }, 5321 2779 { 5322 2780 "pcm_bits_per_sample", T_INT, 5323 offsetof( pjmedia_codec_param_info_Object, pcm_bits_per_sample), 0,2781 offsetof(PyObj_pjmedia_codec_param_info, pcm_bits_per_sample), 0, 5324 2782 "Bits/sample in the PCM side" 5325 2783 }, 5326 2784 { 5327 2785 "pt", T_INT, 5328 offsetof( pjmedia_codec_param_info_Object, pt), 0,2786 offsetof(PyObj_pjmedia_codec_param_info, pt), 0, 5329 2787 "Payload type" 5330 2788 }, … … 5337 2795 5338 2796 /* 5339 * pjmedia_codec_param_info_Type5340 */ 5341 static PyTypeObject pjmedia_codec_param_info_Type=2797 * PyTyp_pjmedia_codec_param_info 2798 */ 2799 static PyTypeObject PyTyp_pjmedia_codec_param_info = 5342 2800 { 5343 2801 PyObject_HEAD_INIT(NULL) 5344 2802 0, /*ob_size*/ 5345 2803 "py_pjsua.PJMedia_Codec_Param_Info", /*tp_name*/ 5346 sizeof( pjmedia_codec_param_info_Object), /*tp_basicsize*/2804 sizeof(PyObj_pjmedia_codec_param_info), /*tp_basicsize*/ 5347 2805 0, /*tp_itemsize*/ 5348 2806 0,/*tp_dealloc*/ … … 5376 2834 5377 2835 /* 5378 * pjmedia_codec_param_setting_Object2836 * PyObj_pjmedia_codec_param_setting 5379 2837 * PJMedia Codec Param Setting 5380 2838 */ … … 5392 2850 pj_uint8_t dec_fmtp_mode; 5393 2851 5394 } pjmedia_codec_param_setting_Object;2852 } PyObj_pjmedia_codec_param_setting; 5395 2853 5396 2854 … … 5404 2862 { 5405 2863 "frm_per_pkt", T_INT, 5406 offsetof( pjmedia_codec_param_setting_Object, frm_per_pkt), 0,2864 offsetof(PyObj_pjmedia_codec_param_setting, frm_per_pkt), 0, 5407 2865 "Number of frames per packet" 5408 2866 }, 5409 2867 { 5410 2868 "vad", T_INT, 5411 offsetof( pjmedia_codec_param_setting_Object, vad), 0,2869 offsetof(PyObj_pjmedia_codec_param_setting, vad), 0, 5412 2870 "Voice Activity Detector" 5413 2871 }, 5414 2872 { 5415 2873 "penh", T_INT, 5416 offsetof( pjmedia_codec_param_setting_Object, penh), 0,2874 offsetof(PyObj_pjmedia_codec_param_setting, penh), 0, 5417 2875 "Perceptual Enhancement" 5418 2876 }, 5419 2877 { 5420 2878 "plc", T_INT, 5421 offsetof( pjmedia_codec_param_setting_Object, plc), 0,2879 offsetof(PyObj_pjmedia_codec_param_setting, plc), 0, 5422 2880 "Packet loss concealment" 5423 2881 }, 5424 2882 { 5425 2883 "reserved", T_INT, 5426 offsetof( pjmedia_codec_param_setting_Object, reserved), 0,2884 offsetof(PyObj_pjmedia_codec_param_setting, reserved), 0, 5427 2885 "Reserved, must be zero" 5428 2886 }, 5429 2887 { 5430 2888 "cng", T_INT, 5431 offsetof( pjmedia_codec_param_setting_Object, cng), 0,2889 offsetof(PyObj_pjmedia_codec_param_setting, cng), 0, 5432 2890 "Comfort Noise Generator" 5433 2891 }, 5434 2892 { 5435 2893 "enc_fmtp_mode", T_INT, 5436 offsetof( pjmedia_codec_param_setting_Object, enc_fmtp_mode), 0,2894 offsetof(PyObj_pjmedia_codec_param_setting, enc_fmtp_mode), 0, 5437 2895 "Mode param in fmtp (def:0)" 5438 2896 }, 5439 2897 { 5440 2898 "dec_fmtp_mode", T_INT, 5441 offsetof( pjmedia_codec_param_setting_Object, dec_fmtp_mode), 0,2899 offsetof(PyObj_pjmedia_codec_param_setting, dec_fmtp_mode), 0, 5442 2900 "Mode param in fmtp (def:0)" 5443 2901 }, … … 5450 2908 5451 2909 /* 5452 * pjmedia_codec_param_setting_Type5453 */ 5454 static PyTypeObject pjmedia_codec_param_setting_Type=2910 * PyTyp_pjmedia_codec_param_setting 2911 */ 2912 static PyTypeObject PyTyp_pjmedia_codec_param_setting = 5455 2913 { 5456 2914 PyObject_HEAD_INIT(NULL) 5457 2915 0, /*ob_size*/ 5458 2916 "py_pjsua.PJMedia_Codec_Param_Setting", /*tp_name*/ 5459 sizeof( pjmedia_codec_param_setting_Object), /*tp_basicsize*/2917 sizeof(PyObj_pjmedia_codec_param_setting), /*tp_basicsize*/ 5460 2918 0, /*tp_itemsize*/ 5461 2919 0,/*tp_dealloc*/ … … 5489 2947 5490 2948 /* 5491 * pjmedia_codec_param_Object2949 * PyObj_pjmedia_codec_param 5492 2950 * PJMedia Codec Param 5493 2951 */ … … 5497 2955 /* Type-specific fields go here. */ 5498 2956 5499 pjmedia_codec_param_info_Object* info;5500 pjmedia_codec_param_setting_Object* setting;5501 5502 } pjmedia_codec_param_Object;2957 PyObj_pjmedia_codec_param_info * info; 2958 PyObj_pjmedia_codec_param_setting * setting; 2959 2960 } PyObj_pjmedia_codec_param; 5503 2961 5504 2962 … … 5507 2965 * deletes a pjmedia_codec_param from memory 5508 2966 */ 5509 static void pjmedia_codec_param_dealloc( pjmedia_codec_param_Object* self)2967 static void pjmedia_codec_param_dealloc(PyObj_pjmedia_codec_param* self) 5510 2968 { 5511 2969 Py_XDECREF(self->info); … … 5522 2980 PyObject *kwds) 5523 2981 { 5524 pjmedia_codec_param_Object *self; 5525 5526 self = (pjmedia_codec_param_Object *)type->tp_alloc(type, 0); 2982 PyObj_pjmedia_codec_param *self; 2983 2984 PJ_UNUSED_ARG(args); 2985 PJ_UNUSED_ARG(kwds); 2986 2987 self = (PyObj_pjmedia_codec_param *)type->tp_alloc(type, 0); 5527 2988 if (self != NULL) 5528 2989 { 5529 self->info = ( pjmedia_codec_param_info_Object*)5530 PyType_GenericNew(& pjmedia_codec_param_info_Type, NULL, NULL);2990 self->info = (PyObj_pjmedia_codec_param_info *) 2991 PyType_GenericNew(&PyTyp_pjmedia_codec_param_info, NULL, NULL); 5531 2992 if (self->info == NULL) 5532 2993 { … … 5534 2995 return NULL; 5535 2996 } 5536 self->setting = ( pjmedia_codec_param_setting_Object*)5537 PyType_GenericNew(& pjmedia_codec_param_setting_Type, NULL, NULL);2997 self->setting = (PyObj_pjmedia_codec_param_setting *) 2998 PyType_GenericNew(&PyTyp_pjmedia_codec_param_setting, NULL, NULL); 5538 2999 if (self->setting == NULL) 5539 3000 { … … 5553 3014 { 5554 3015 "info", T_OBJECT_EX, 5555 offsetof( pjmedia_codec_param_Object, info), 0,3016 offsetof(PyObj_pjmedia_codec_param, info), 0, 5556 3017 "The 'info' part of codec param describes the capability of the codec," 5557 3018 " and the value should NOT be changed by application." … … 5559 3020 { 5560 3021 "setting", T_OBJECT_EX, 5561 offsetof( pjmedia_codec_param_Object, setting), 0,3022 offsetof(PyObj_pjmedia_codec_param, setting), 0, 5562 3023 "The 'setting' part of codec param describes various settings to be " 5563 3024 "applied to the codec. When the codec param is retrieved from the " … … 5577 3038 5578 3039 /* 5579 * pjmedia_codec_param_Type5580 */ 5581 static PyTypeObject pjmedia_codec_param_Type=3040 * PyTyp_pjmedia_codec_param 3041 */ 3042 static PyTypeObject PyTyp_pjmedia_codec_param = 5582 3043 { 5583 3044 PyObject_HEAD_INIT(NULL) 5584 3045 0, /*ob_size*/ 5585 3046 "py_pjsua.PJMedia_Codec_Param", /*tp_name*/ 5586 sizeof( pjmedia_codec_param_Object), /*tp_basicsize*/3047 sizeof(PyObj_pjmedia_codec_param), /*tp_basicsize*/ 5587 3048 0, /*tp_itemsize*/ 5588 3049 (destructor)pjmedia_codec_param_dealloc,/*tp_dealloc*/ … … 5631 3092 int ret; 5632 3093 3094 PJ_UNUSED_ARG(pSelf); 3095 5633 3096 if (!PyArg_ParseTuple(pArgs, "")) 5634 3097 { … … 5647 3110 { 5648 3111 int ret; 3112 3113 PJ_UNUSED_ARG(pSelf); 3114 5649 3115 if (!PyArg_ParseTuple(pArgs, "")) 5650 3116 { … … 5667 3133 pjsua_conf_port_id id[PJSUA_MAX_CONF_PORTS]; 5668 3134 unsigned c, i; 3135 3136 PJ_UNUSED_ARG(pSelf); 3137 5669 3138 if (!PyArg_ParseTuple(pArgs, "")) 5670 3139 { … … 5695 3164 { 5696 3165 int id; 5697 conf_port_info_Object* obj;3166 PyObj_pjsua_conf_port_info * obj; 5698 3167 pjsua_conf_port_info info; 5699 3168 int status; 5700 3169 int i; 5701 3170 3171 PJ_UNUSED_ARG(pSelf); 3172 5702 3173 if (!PyArg_ParseTuple(pArgs, "i", &id)) 5703 3174 { … … 5707 3178 5708 3179 status = pjsua_conf_get_port_info(id, &info); 5709 obj = ( conf_port_info_Object*)conf_port_info_new5710 (& conf_port_info_Type,NULL,NULL);3180 obj = (PyObj_pjsua_conf_port_info *)conf_port_info_new 3181 (&PyTyp_pjsua_conf_port_info,NULL,NULL); 5711 3182 obj->bits_per_sample = info.bits_per_sample; 5712 3183 obj->channel_count = info.bits_per_sample; … … 5732 3203 int p_id; 5733 3204 PyObject * oportObj; 5734 pjmedia_port_Object * oport;3205 PyObj_pjmedia_port * oport; 5735 3206 pjmedia_port * port; 5736 3207 PyObject * opoolObj; 5737 pj_pool_Object* opool;3208 PyObj_pj_pool * opool; 5738 3209 pj_pool_t * pool; 5739 3210 5740 3211 int status; 5741 3212 3213 PJ_UNUSED_ARG(pSelf); 5742 3214 5743 3215 if (!PyArg_ParseTuple(pArgs, "OO", &opoolObj, &oportObj)) … … 5747 3219 if (opoolObj != Py_None) 5748 3220 { 5749 opool = ( pj_pool_Object*)opoolObj;3221 opool = (PyObj_pj_pool *)opoolObj; 5750 3222 pool = opool->pool; 5751 3223 } else { … … 5755 3227 if (oportObj != Py_None) 5756 3228 { 5757 oport = ( pjmedia_port_Object *)oportObj;3229 oport = (PyObj_pjmedia_port *)oportObj; 5758 3230 port = oport->port; 5759 3231 } else { … … 5777 3249 int status; 5778 3250 3251 PJ_UNUSED_ARG(pSelf); 5779 3252 5780 3253 if (!PyArg_ParseTuple(pArgs, "i", &id)) … … 5798 3271 int status; 5799 3272 3273 PJ_UNUSED_ARG(pSelf); 5800 3274 5801 3275 if (!PyArg_ParseTuple(pArgs, "ii", &source, &sink)) … … 5819 3293 int status; 5820 3294 3295 PJ_UNUSED_ARG(pSelf); 5821 3296 5822 3297 if (!PyArg_ParseTuple(pArgs, "ii", &source, &sink)) … … 5843 3318 int status; 5844 3319 3320 PJ_UNUSED_ARG(pSelf); 5845 3321 5846 3322 if (!PyArg_ParseTuple(pArgs, "Oi", &filename, &options)) … … 5864 3340 int id, port_id; 5865 3341 3342 PJ_UNUSED_ARG(pSelf); 5866 3343 5867 3344 if (!PyArg_ParseTuple(pArgs, "i", &id)) … … 5886 3363 int status; 5887 3364 3365 PJ_UNUSED_ARG(pSelf); 5888 3366 5889 3367 if (!PyArg_ParseTuple(pArgs, "iI", &id, &samples)) … … 5907 3385 int status; 5908 3386 3387 PJ_UNUSED_ARG(pSelf); 5909 3388 5910 3389 if (!PyArg_ParseTuple(pArgs, "i", &id)) … … 5937 3416 int status; 5938 3417 3418 PJ_UNUSED_ARG(pSelf); 5939 3419 5940 3420 if (!PyArg_ParseTuple(pArgs, "OiOii", &filename, … … 5967 3447 int id, port_id; 5968 3448 3449 PJ_UNUSED_ARG(pSelf); 5969 3450 5970 3451 if (!PyArg_ParseTuple(pArgs, "i", &id)) … … 5988 3469 int status; 5989 3470 3471 PJ_UNUSED_ARG(pSelf); 5990 3472 5991 3473 if (!PyArg_ParseTuple(pArgs, "i", &id)) … … 6010 3492 pjmedia_snd_dev_info info[SND_DEV_NUM]; 6011 3493 unsigned c, i; 3494 3495 PJ_UNUSED_ARG(pSelf); 3496 6012 3497 if (!PyArg_ParseTuple(pArgs, "")) 6013 3498 { … … 6025 3510 char * str; 6026 3511 6027 pjmedia_snd_dev_info_Object* obj;6028 obj = ( pjmedia_snd_dev_info_Object*)pjmedia_snd_dev_info_new6029 (& pjmedia_snd_dev_info_Type, NULL, NULL);3512 PyObj_pjmedia_snd_dev_info * obj; 3513 obj = (PyObj_pjmedia_snd_dev_info *)pjmedia_snd_dev_info_new 3514 (&PyTyp_pjmedia_snd_dev_info, NULL, NULL); 6030 3515 obj->default_samples_per_sec = info[i].default_samples_per_sec; 6031 3516 obj->input_count = info[i].input_count; … … 6058 3543 int status; 6059 3544 3545 PJ_UNUSED_ARG(pSelf); 6060 3546 6061 3547 if (!PyArg_ParseTuple(pArgs, "")) … … 6079 3565 int status; 6080 3566 3567 PJ_UNUSED_ARG(pSelf); 6081 3568 6082 3569 if (!PyArg_ParseTuple(pArgs, "ii", &capture_dev, &playback_dev)) … … 6100 3587 int status; 6101 3588 3589 PJ_UNUSED_ARG(pSelf); 6102 3590 6103 3591 if (!PyArg_ParseTuple(pArgs, "")) … … 6119 3607 { 6120 3608 6121 pjmedia_port_Object * obj; 6122 3609 PyObj_pjmedia_port * obj; 3610 3611 PJ_UNUSED_ARG(pSelf); 3612 6123 3613 if (!PyArg_ParseTuple(pArgs, "")) 6124 3614 { … … 6126 3616 } 6127 3617 6128 obj = ( pjmedia_port_Object *)PyType_GenericNew6129 (& pjmedia_port_Type, NULL, NULL);3618 obj = (PyObj_pjmedia_port *)PyType_GenericNew 3619 (&PyTyp_pjmedia_port, NULL, NULL); 6130 3620 obj->port = pjsua_set_no_snd_dev(); 6131 3621 return Py_BuildValue("O", obj); … … 6142 3632 int status; 6143 3633 3634 PJ_UNUSED_ARG(pSelf); 6144 3635 6145 3636 if (!PyArg_ParseTuple(pArgs, "ii", &tail_ms, &options)) … … 6164 3655 unsigned p_tail_ms; 6165 3656 3657 PJ_UNUSED_ARG(pSelf); 3658 6166 3659 if (!PyArg_ParseTuple(pArgs, "")) 6167 3660 { … … 6186 3679 pjsua_codec_info info[PJMEDIA_CODEC_MGR_MAX_CODECS]; 6187 3680 unsigned c, i; 3681 3682 PJ_UNUSED_ARG(pSelf); 3683 6188 3684 if (!PyArg_ParseTuple(pArgs, "")) 6189 3685 { … … 6199 3695 int ret; 6200 3696 int j; 6201 codec_info_Object* obj;6202 obj = ( codec_info_Object*)codec_info_new6203 (& codec_info_Type, NULL, NULL);3697 PyObj_pjsua_codec_info * obj; 3698 obj = (PyObj_pjsua_codec_info *)codec_info_new 3699 (&PyTyp_pjsua_codec_info, NULL, NULL); 6204 3700 obj->codec_id = PyString_FromStringAndSize 6205 3701 (info[i].codec_id.ptr, info[i].codec_id.slen); … … 6231 3727 pj_uint8_t priority; 6232 3728 3729 PJ_UNUSED_ARG(pSelf); 3730 6233 3731 if (!PyArg_ParseTuple(pArgs, "OB", &id, &priority)) 6234 3732 { … … 6254 3752 pj_str_t str; 6255 3753 pjmedia_codec_param param; 6256 pjmedia_codec_param_Object *obj; 6257 6258 3754 PyObj_pjmedia_codec_param *obj; 3755 3756 PJ_UNUSED_ARG(pSelf); 3757 6259 3758 if (!PyArg_ParseTuple(pArgs, "O", &id)) 6260 3759 { … … 6264 3763 str.slen = strlen(PyString_AsString(id)); 6265 3764 status = pjsua_codec_get_param(&str, ¶m); 6266 obj = ( pjmedia_codec_param_Object*)pjmedia_codec_param_new6267 (& pjmedia_codec_param_Type, NULL, NULL);3765 obj = (PyObj_pjmedia_codec_param *)pjmedia_codec_param_new 3766 (&PyTyp_pjmedia_codec_param, NULL, NULL); 6268 3767 obj->info->avg_bps = param.info.avg_bps; 6269 3768 obj->info->channel_cnt = param.info.channel_cnt; … … 6295 3794 pjmedia_codec_param param; 6296 3795 PyObject * tmpObj; 6297 pjmedia_codec_param_Object *obj; 6298 6299 3796 PyObj_pjmedia_codec_param *obj; 3797 3798 PJ_UNUSED_ARG(pSelf); 3799 6300 3800 if (!PyArg_ParseTuple(pArgs, "OO", &id, &tmpObj)) 6301 3801 { … … 6307 3807 if (tmpObj != Py_None) 6308 3808 { 6309 obj = ( pjmedia_codec_param_Object*)tmpObj;3809 obj = (PyObj_pjmedia_codec_param *)tmpObj; 6310 3810 param.info.avg_bps = obj->info->avg_bps; 6311 3811 param.info.channel_cnt = obj->info->channel_cnt; … … 6343 3843 static char pjsua_conf_add_port_doc[] = 6344 3844 "int, int py_pjsua.conf_add_port " 6345 "(py_pjsua.P J_Pool pool, py_pjsua.PJMedia_Port port) "3845 "(py_pjsua.Pj_Pool pool, py_pjsua.PJMedia_Port port) " 6346 3846 "Add arbitrary media port to PJSUA's conference bridge. " 6347 3847 "Application can use this function to add the media port " … … 6443 3943 6444 3944 /* 6445 * pj_time_val_Object3945 * PyObj_pj_time_val 6446 3946 * PJ Time Val 6447 3947 */ … … 6453 3953 long msec; 6454 3954 6455 } pj_time_val_Object;3955 } PyObj_pj_time_val; 6456 3956 6457 3957 … … 6465 3965 { 6466 3966 "sec", T_INT, 6467 offsetof( pj_time_val_Object, sec), 0,3967 offsetof(PyObj_pj_time_val, sec), 0, 6468 3968 "The seconds part of the time" 6469 3969 }, 6470 3970 { 6471 3971 "msec", T_INT, 6472 offsetof( pj_time_val_Object, sec), 0,3972 offsetof(PyObj_pj_time_val, sec), 0, 6473 3973 "The milliseconds fraction of the time" 6474 3974 }, … … 6482 3982 6483 3983 /* 6484 * pj_time_val_Type6485 */ 6486 static PyTypeObject pj_time_val_Type=3984 * PyTyp_pj_time_val 3985 */ 3986 static PyTypeObject PyTyp_pj_time_val = 6487 3987 { 6488 3988 PyObject_HEAD_INIT(NULL) 6489 3989 0, /*ob_size*/ 6490 3990 "py_pjsua.PJ_Time_Val", /*tp_name*/ 6491 sizeof( pj_time_val_Object), /*tp_basicsize*/3991 sizeof(PyObj_pj_time_val), /*tp_basicsize*/ 6492 3992 0, /*tp_itemsize*/ 6493 3993 0,/*tp_dealloc*/ … … 6521 4021 6522 4022 /* 6523 * call_info_Object4023 * PyObj_pjsua_call_info 6524 4024 * Call Info 6525 4025 */ … … 6544 4044 int media_dir; 6545 4045 int conf_slot; 6546 pj_time_val_Object* connect_duration;6547 pj_time_val_Object* total_duration;4046 PyObj_pj_time_val * connect_duration; 4047 PyObj_pj_time_val * total_duration; 6548 4048 struct { 6549 4049 char local_info[128]; … … 6555 4055 } buf_; 6556 4056 6557 } call_info_Object;4057 } PyObj_pjsua_call_info; 6558 4058 6559 4059 … … 6562 4062 * deletes a call_info from memory 6563 4063 */ 6564 static void call_info_dealloc( call_info_Object* self)4064 static void call_info_dealloc(PyObj_pjsua_call_info* self) 6565 4065 { 6566 4066 Py_XDECREF(self->local_info); … … 6584 4084 PyObject *kwds) 6585 4085 { 6586 call_info_Object *self; 6587 6588 self = (call_info_Object *)type->tp_alloc(type, 0); 4086 PyObj_pjsua_call_info *self; 4087 4088 PJ_UNUSED_ARG(args); 4089 PJ_UNUSED_ARG(kwds); 4090 4091 self = (PyObj_pjsua_call_info *)type->tp_alloc(type, 0); 6589 4092 if (self != NULL) 6590 4093 { … … 6631 4134 return NULL; 6632 4135 } 6633 self->connect_duration = ( pj_time_val_Object*)PyType_GenericNew6634 (& pj_time_val_Type,NULL,NULL);4136 self->connect_duration = (PyObj_pj_time_val *)PyType_GenericNew 4137 (&PyTyp_pj_time_val,NULL,NULL); 6635 4138 if (self->connect_duration == NULL) 6636 4139 { … … 6638 4141 return NULL; 6639 4142 } 6640 self->total_duration = ( pj_time_val_Object*)PyType_GenericNew6641 (& pj_time_val_Type,NULL,NULL);4143 self->total_duration = (PyObj_pj_time_val *)PyType_GenericNew 4144 (&PyTyp_pj_time_val,NULL,NULL); 6642 4145 if (self->total_duration == NULL) 6643 4146 { … … 6656 4159 { 6657 4160 "id", T_INT, 6658 offsetof( call_info_Object, id), 0,4161 offsetof(PyObj_pjsua_call_info, id), 0, 6659 4162 "Call identification" 6660 4163 }, 6661 4164 { 6662 4165 "role", T_INT, 6663 offsetof( call_info_Object, role), 0,4166 offsetof(PyObj_pjsua_call_info, role), 0, 6664 4167 "Initial call role (UAC == caller)" 6665 4168 }, 6666 4169 { 6667 4170 "acc_id", T_INT, 6668 offsetof( call_info_Object, acc_id), 0,4171 offsetof(PyObj_pjsua_call_info, acc_id), 0, 6669 4172 "The account ID where this call belongs." 6670 4173 }, 6671 4174 { 6672 4175 "local_info", T_OBJECT_EX, 6673 offsetof( call_info_Object, local_info), 0,4176 offsetof(PyObj_pjsua_call_info, local_info), 0, 6674 4177 "Local URI" 6675 4178 }, 6676 4179 { 6677 4180 "local_contact", T_OBJECT_EX, 6678 offsetof( call_info_Object, local_contact), 0,4181 offsetof(PyObj_pjsua_call_info, local_contact), 0, 6679 4182 "Local Contact" 6680 4183 }, 6681 4184 { 6682 4185 "remote_info", T_OBJECT_EX, 6683 offsetof( call_info_Object, remote_info), 0,4186 offsetof(PyObj_pjsua_call_info, remote_info), 0, 6684 4187 "Remote URI" 6685 4188 }, 6686 4189 { 6687 4190 "remote_contact", T_OBJECT_EX, 6688 offsetof( call_info_Object, remote_contact), 0,4191 offsetof(PyObj_pjsua_call_info, remote_contact), 0, 6689 4192 "Remote Contact" 6690 4193 }, 6691 4194 { 6692 4195 "call_id", T_OBJECT_EX, 6693 offsetof( call_info_Object, call_id), 0,4196 offsetof(PyObj_pjsua_call_info, call_id), 0, 6694 4197 "Dialog Call-ID string" 6695 4198 }, 6696 4199 { 6697 4200 "state", T_INT, 6698 offsetof( call_info_Object, state), 0,4201 offsetof(PyObj_pjsua_call_info, state), 0, 6699 4202 "Call state" 6700 4203 }, 6701 4204 { 6702 4205 "state_text", T_OBJECT_EX, 6703 offsetof( call_info_Object, state_text), 0,4206 offsetof(PyObj_pjsua_call_info, state_text), 0, 6704 4207 "Text describing the state " 6705 4208 }, 6706 4209 { 6707 4210 "last_status", T_INT, 6708 offsetof( call_info_Object, last_status), 0,4211 offsetof(PyObj_pjsua_call_info, last_status), 0, 6709 4212 "Last status code heard, which can be used as cause code" 6710 4213 }, 6711 4214 { 6712 4215 "last_status_text", T_OBJECT_EX, 6713 offsetof( call_info_Object, last_status_text), 0,4216 offsetof(PyObj_pjsua_call_info, last_status_text), 0, 6714 4217 "The reason phrase describing the status." 6715 4218 }, 6716 4219 { 6717 4220 "media_status", T_INT, 6718 offsetof( call_info_Object, media_status), 0,4221 offsetof(PyObj_pjsua_call_info, media_status), 0, 6719 4222 "Call media status." 6720 4223 }, 6721 4224 { 6722 4225 "media_dir", T_INT, 6723 offsetof( call_info_Object, media_dir), 0,4226 offsetof(PyObj_pjsua_call_info, media_dir), 0, 6724 4227 "Media direction" 6725 4228 }, 6726 4229 { 6727 4230 "conf_slot", T_INT, 6728 offsetof( call_info_Object, conf_slot), 0,4231 offsetof(PyObj_pjsua_call_info, conf_slot), 0, 6729 4232 "The conference port number for the call" 6730 4233 }, 6731 4234 { 6732 4235 "connect_duration", T_OBJECT_EX, 6733 offsetof( call_info_Object, connect_duration), 0,4236 offsetof(PyObj_pjsua_call_info, connect_duration), 0, 6734 4237 "Up-to-date call connected duration(zero when call is not established)" 6735 4238 }, 6736 4239 { 6737 4240 "total_duration", T_OBJECT_EX, 6738 offsetof( call_info_Object, total_duration), 0,4241 offsetof(PyObj_pjsua_call_info, total_duration), 0, 6739 4242 "Total call duration, including set-up time" 6740 4243 }, … … 6747 4250 6748 4251 /* 6749 * call_info_Type6750 */ 6751 static PyTypeObject call_info_Type=4252 * PyTyp_pjsua_call_info 4253 */ 4254 static PyTypeObject PyTyp_pjsua_call_info = 6752 4255 { 6753 4256 PyObject_HEAD_INIT(NULL) 6754 4257 0, /*ob_size*/ 6755 4258 "py_pjsua.Call_Info", /*tp_name*/ 6756 sizeof( call_info_Object), /*tp_basicsize*/4259 sizeof(PyObj_pjsua_call_info), /*tp_basicsize*/ 6757 4260 0, /*tp_itemsize*/ 6758 4261 (destructor)call_info_dealloc,/*tp_dealloc*/ … … 6801 4304 int count; 6802 4305 4306 PJ_UNUSED_ARG(pSelf); 4307 6803 4308 if (!PyArg_ParseTuple(pArgs, "")) 6804 4309 { … … 6821 4326 int count; 6822 4327 4328 PJ_UNUSED_ARG(pSelf); 6823 4329 6824 4330 if (!PyArg_ParseTuple(pArgs, "")) … … 6843 4349 pjsua_transport_id id[PJSUA_MAX_CALLS]; 6844 4350 unsigned c, i; 4351 4352 PJ_UNUSED_ARG(pSelf); 4353 6845 4354 if (!PyArg_ParseTuple(pArgs, "")) 6846 4355 { … … 6877 4386 pjsua_msg_data msg_data; 6878 4387 PyObject * omdObj; 6879 msg_data_Object* omd;4388 PyObj_pjsua_msg_data * omd; 6880 4389 int user_data; 6881 4390 int call_id; 6882 4391 pj_pool_t * pool; 4392 4393 PJ_UNUSED_ARG(pSelf); 6883 4394 6884 4395 if (!PyArg_ParseTuple … … 6892 4403 if (omdObj != Py_None) 6893 4404 { 6894 omd = ( msg_data_Object*)omdObj;4405 omd = (PyObj_pjsua_msg_data *)omdObj; 6895 4406 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 6896 4407 msg_data.content_type.slen = strlen … … 6922 4433 int isActive; 6923 4434 4435 PJ_UNUSED_ARG(pSelf); 6924 4436 6925 4437 if (!PyArg_ParseTuple(pArgs, "i", &call_id)) … … 6943 4455 int hasMedia; 6944 4456 4457 PJ_UNUSED_ARG(pSelf); 6945 4458 6946 4459 if (!PyArg_ParseTuple(pArgs, "i", &call_id)) … … 6964 4477 int port_id; 6965 4478 4479 PJ_UNUSED_ARG(pSelf); 6966 4480 6967 4481 if (!PyArg_ParseTuple(pArgs, "i", &call_id)) … … 6984 4498 int call_id; 6985 4499 int status; 6986 call_info_Object* oi;4500 PyObj_pjsua_call_info * oi; 6987 4501 pjsua_call_info info; 6988 4502 4503 PJ_UNUSED_ARG(pSelf); 6989 4504 6990 4505 if (!PyArg_ParseTuple(pArgs, "i", &call_id)) … … 6997 4512 if (status == PJ_SUCCESS) 6998 4513 { 6999 oi = ( call_info_Object *)call_info_new(&call_info_Type, NULL, NULL);4514 oi = (PyObj_pjsua_call_info *)call_info_new(&PyTyp_pjsua_call_info, NULL, NULL); 7000 4515 oi->acc_id = info.acc_id; 7001 4516 pj_ansi_snprintf(oi->buf_.call_id, sizeof(oi->buf_.call_id), … … 7057 4572 int status; 7058 4573 4574 PJ_UNUSED_ARG(pSelf); 4575 7059 4576 if (!PyArg_ParseTuple(pArgs, "ii", &call_id, &user_data)) 7060 4577 { … … 7077 4594 void * user_data; 7078 4595 4596 PJ_UNUSED_ARG(pSelf); 7079 4597 7080 4598 if (!PyArg_ParseTuple(pArgs, "i", &call_id)) … … 7102 4620 pjsua_msg_data msg_data; 7103 4621 PyObject * omdObj; 7104 msg_data_Object* omd;4622 PyObj_pjsua_msg_data * omd; 7105 4623 pj_pool_t * pool; 4624 4625 PJ_UNUSED_ARG(pSelf); 7106 4626 7107 4627 if (!PyArg_ParseTuple(pArgs, "iIOO", &call_id, &code, &sr, &omdObj)) … … 7119 4639 if (omdObj != Py_None) 7120 4640 { 7121 omd = ( msg_data_Object*)omdObj;4641 omd = (PyObj_pjsua_msg_data *)omdObj; 7122 4642 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7123 4643 msg_data.content_type.slen = strlen … … 7153 4673 pjsua_msg_data msg_data; 7154 4674 PyObject * omdObj; 7155 msg_data_Object* omd;4675 PyObj_pjsua_msg_data * omd; 7156 4676 pj_pool_t * pool = NULL; 4677 4678 PJ_UNUSED_ARG(pSelf); 7157 4679 7158 4680 if (!PyArg_ParseTuple(pArgs, "iIOO", &call_id, &code, &sr, &omdObj)) … … 7170 4692 if (omdObj != Py_None) 7171 4693 { 7172 omd = ( msg_data_Object*)omdObj;4694 omd = (PyObj_pjsua_msg_data *)omdObj; 7173 4695 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7174 4696 msg_data.content_type.slen = strlen … … 7196 4718 int call_id; 7197 4719 pjsua_msg_data msg_data; 7198 7199 msg_data_Object* omd;4720 PyObject * omdObj; 4721 PyObj_pjsua_msg_data * omd; 7200 4722 pj_pool_t * pool; 7201 4723 4724 PJ_UNUSED_ARG(pSelf); 4725 7202 4726 if (!PyArg_ParseTuple(pArgs, "iO", &call_id, &omdObj)) 7203 4727 { … … 7207 4731 if (omdObj != Py_None) 7208 4732 { 7209 omd = ( msg_data_Object*)omdObj;4733 omd = (PyObj_pjsua_msg_data *)omdObj; 7210 4734 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7211 4735 msg_data.content_type.slen = strlen … … 7234 4758 pjsua_msg_data msg_data; 7235 4759 PyObject * omdObj; 7236 msg_data_Object* omd;4760 PyObj_pjsua_msg_data * omd; 7237 4761 pj_pool_t * pool; 7238 4762 4763 PJ_UNUSED_ARG(pSelf); 4764 7239 4765 if (!PyArg_ParseTuple(pArgs, "iiO", &call_id, &unhold, &omdObj)) 7240 4766 { … … 7244 4770 if (omdObj != Py_None) 7245 4771 { 7246 omd = ( msg_data_Object*)omdObj;4772 omd = (PyObj_pjsua_msg_data *)omdObj; 7247 4773 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7248 4774 msg_data.content_type.slen = strlen … … 7272 4798 pjsua_msg_data msg_data; 7273 4799 PyObject * omdObj; 7274 msg_data_Object* omd;4800 PyObj_pjsua_msg_data * omd; 7275 4801 pj_pool_t * pool; 4802 4803 PJ_UNUSED_ARG(pSelf); 7276 4804 7277 4805 if (!PyArg_ParseTuple(pArgs, "iOO", &call_id, &sd, &omdObj)) … … 7285 4813 if (omdObj != Py_None) 7286 4814 { 7287 omd = ( msg_data_Object*)omdObj;4815 omd = (PyObj_pjsua_msg_data *)omdObj; 7288 4816 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7289 4817 msg_data.content_type.slen = strlen … … 7313 4841 pjsua_msg_data msg_data; 7314 4842 PyObject * omdObj; 7315 msg_data_Object* omd;4843 PyObj_pjsua_msg_data * omd; 7316 4844 pj_pool_t * pool; 4845 4846 PJ_UNUSED_ARG(pSelf); 7317 4847 7318 4848 if (!PyArg_ParseTuple … … 7324 4854 if (omdObj != Py_None) 7325 4855 { 7326 omd = ( msg_data_Object*)omdObj;4856 omd = (PyObj_pjsua_msg_data *)omdObj; 7327 4857 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7328 4858 msg_data.content_type.slen = strlen … … 7352 4882 int status; 7353 4883 4884 PJ_UNUSED_ARG(pSelf); 4885 7354 4886 if (!PyArg_ParseTuple(pArgs, "iO", &call_id, &sd)) 7355 4887 { … … 7377 4909 pjsua_msg_data msg_data; 7378 4910 PyObject * omdObj; 7379 msg_data_Object* omd;4911 PyObj_pjsua_msg_data * omd; 7380 4912 int user_data; 7381 4913 pj_pool_t * pool; 4914 4915 PJ_UNUSED_ARG(pSelf); 7382 4916 7383 4917 if (!PyArg_ParseTuple … … 7399 4933 if (omdObj != Py_None) 7400 4934 { 7401 omd = ( msg_data_Object*)omdObj;4935 omd = (PyObj_pjsua_msg_data *)omdObj; 7402 4936 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7403 4937 msg_data.content_type.slen = strlen … … 7429 4963 pjsua_msg_data msg_data; 7430 4964 PyObject * omdObj; 7431 msg_data_Object* omd;4965 PyObj_pjsua_msg_data * omd; 7432 4966 pj_pool_t * pool; 4967 4968 PJ_UNUSED_ARG(pSelf); 7433 4969 7434 4970 if (!PyArg_ParseTuple(pArgs, "iiO", &call_id, &is_typing, &omdObj)) … … 7439 4975 if (omdObj != Py_None) 7440 4976 { 7441 omd = ( msg_data_Object*)omdObj;4977 omd = (PyObj_pjsua_msg_data *)omdObj; 7442 4978 msg_data.content_type.ptr = PyString_AsString(omd->content_type); 7443 4979 msg_data.content_type.slen = strlen … … 7462 4998 { 7463 4999 5000 PJ_UNUSED_ARG(pSelf); 5001 7464 5002 if (!PyArg_ParseTuple(pArgs, "")) 7465 5003 { … … 7488 5026 int status; 7489 5027 5028 PJ_UNUSED_ARG(pSelf); 5029 7490 5030 if (!PyArg_ParseTuple(pArgs, "iiIO", &call_id, &with_media, &maxlen, &si)) 7491 5031 { … … 7511 5051 char buf[1024]; 7512 5052 int detail; 5053 5054 PJ_UNUSED_ARG(pSelf); 7513 5055 7514 5056 if (!PyArg_ParseTuple(pArgs, "i", &detail)) … … 7722 5264 }, 7723 5265 { 7724 "transport_register", py_pjsua_transport_register, METH_VARARGS,7725 pjsua_transport_register_doc7726 },7727 {7728 5266 "transport_enum_transports", py_pjsua_enum_transports, METH_VARARGS, 7729 5267 pjsua_enum_transports_doc … … 7780 5318 "acc_set_online_status", py_pjsua_acc_set_online_status, METH_VARARGS, 7781 5319 pjsua_acc_set_online_status_doc 5320 }, 5321 { 5322 "acc_set_online_status2", py_pjsua_acc_set_online_status2, METH_VARARGS, 5323 pjsua_acc_set_online_status2_doc 7782 5324 }, 7783 5325 { … … 8067 5609 PyEval_InitThreads(); 8068 5610 8069 if (PyType_Ready(& callback_Type) < 0)5611 if (PyType_Ready(&PyTyp_pjsua_callback) < 0) 8070 5612 return; 8071 if (PyType_Ready(& config_Type) < 0)5613 if (PyType_Ready(&PyTyp_pjsua_config) < 0) 8072 5614 return; 8073 if (PyType_Ready(& logging_config_Type) < 0)5615 if (PyType_Ready(&PyTyp_pjsua_logging_config) < 0) 8074 5616 return; 8075 if (PyType_Ready(& msg_data_Type) < 0)5617 if (PyType_Ready(&PyTyp_pjsua_msg_data) < 0) 8076 5618 return; 8077 media_config_Type.tp_new = PyType_GenericNew;8078 if (PyType_Ready(& media_config_Type) < 0)5619 PyTyp_pjsua_media_config.tp_new = PyType_GenericNew; 5620 if (PyType_Ready(&PyTyp_pjsua_media_config) < 0) 8079 5621 return; 8080 pjsip_event_Type.tp_new = PyType_GenericNew;8081 if (PyType_Ready(& pjsip_event_Type) < 0)5622 PyTyp_pjsip_event.tp_new = PyType_GenericNew; 5623 if (PyType_Ready(&PyTyp_pjsip_event) < 0) 8082 5624 return; 8083 pjsip_rx_data_Type.tp_new = PyType_GenericNew;8084 if (PyType_Ready(& pjsip_rx_data_Type) < 0)5625 PyTyp_pjsip_rx_data.tp_new = PyType_GenericNew; 5626 if (PyType_Ready(&PyTyp_pjsip_rx_data) < 0) 8085 5627 return; 8086 pj_pool_Type.tp_new = PyType_GenericNew;8087 if (PyType_Ready(& pj_pool_Type) < 0)5628 PyTyp_pj_pool_t.tp_new = PyType_GenericNew; 5629 if (PyType_Ready(&PyTyp_pj_pool_t) < 0) 8088 5630 return; 8089 pjsip_endpoint_Type.tp_new = PyType_GenericNew;8090 if (PyType_Ready(& pjsip_endpoint_Type) < 0)5631 PyTyp_pjsip_endpoint.tp_new = PyType_GenericNew; 5632 if (PyType_Ready(&PyTyp_pjsip_endpoint) < 0) 8091 5633 return; 8092 pjmedia_endpt_Type.tp_new = PyType_GenericNew;8093 if (PyType_Ready(& pjmedia_endpt_Type) < 0)5634 PyTyp_pjmedia_endpt.tp_new = PyType_GenericNew; 5635 if (PyType_Ready(&PyTyp_pjmedia_endpt) < 0) 8094 5636 return; 8095 pj_pool_factory_Type.tp_new = PyType_GenericNew;8096 if (PyType_Ready(& pj_pool_factory_Type) < 0)5637 PyTyp_pj_pool_factory.tp_new = PyType_GenericNew; 5638 if (PyType_Ready(&PyTyp_pj_pool_factory) < 0) 8097 5639 return; 8098 pjsip_cred_info_Type.tp_new = PyType_GenericNew;8099 if (PyType_Ready(& pjsip_cred_info_Type) < 0)5640 PyTyp_pjsip_cred_info.tp_new = PyType_GenericNew; 5641 if (PyType_Ready(&PyTyp_pjsip_cred_info) < 0) 8100 5642 return; 8101 5643 8102 5644 /* LIB TRANSPORT */ 8103 5645 8104 if (PyType_Ready(& transport_config_Type) < 0)5646 if (PyType_Ready(&PyTyp_pjsua_transport_config) < 0) 8105 5647 return; 8106 if (PyType_Ready(&host_port_Type) < 0) 5648 5649 if (PyType_Ready(&PyTyp_pjsua_transport_info) < 0) 8107 5650 return; 8108 5651 8109 if (PyType_Ready(&transport_info_Type) < 0) 5652 /* END OF LIB TRANSPORT */ 5653 5654 /* LIB ACCOUNT */ 5655 5656 5657 if (PyType_Ready(&PyTyp_pjsua_acc_config) < 0) 8110 5658 return; 8111 8112 pjsip_transport_Type.tp_new = PyType_GenericNew; 8113 if (PyType_Ready(&pjsip_transport_Type) < 0) 5659 if (PyType_Ready(&PyTyp_pjsua_acc_info) < 0) 8114 5660 return; 8115 5661 8116 /* END OF LIB TRANSPORT */ 8117 8118 /* LIB ACCOUNT */ 8119 8120 8121 if (PyType_Ready(&acc_config_Type) < 0) 5662 /* END OF LIB ACCOUNT */ 5663 5664 /* LIB BUDDY */ 5665 5666 if (PyType_Ready(&PyTyp_pjsua_buddy_config) < 0) 8122 5667 return; 8123 if (PyType_Ready(&acc_info_Type) < 0) 8124 return; 8125 8126 /* END OF LIB ACCOUNT */ 8127 8128 /* LIB BUDDY */ 8129 8130 if (PyType_Ready(&buddy_config_Type) < 0) 8131 return; 8132 if (PyType_Ready(&buddy_info_Type) < 0) 5668 if (PyType_Ready(&PyTyp_pjsua_buddy_info) < 0) 8133 5669 return; 8134 5670 … … 8137 5673 /* LIB MEDIA */ 8138 5674 8139 if (PyType_Ready(& codec_info_Type) < 0)5675 if (PyType_Ready(&PyTyp_pjsua_codec_info) < 0) 8140 5676 return; 8141 5677 8142 if (PyType_Ready(& conf_port_info_Type) < 0)5678 if (PyType_Ready(&PyTyp_pjsua_conf_port_info) < 0) 8143 5679 return; 8144 5680 8145 pjmedia_port_Type.tp_new = PyType_GenericNew;8146 if (PyType_Ready(& pjmedia_port_Type) < 0)5681 PyTyp_pjmedia_port.tp_new = PyType_GenericNew; 5682 if (PyType_Ready(&PyTyp_pjmedia_port) < 0) 8147 5683 return; 8148 5684 8149 if (PyType_Ready(& pjmedia_snd_dev_info_Type) < 0)5685 if (PyType_Ready(&PyTyp_pjmedia_snd_dev_info) < 0) 8150 5686 return; 8151 5687 8152 pjmedia_codec_param_info_Type.tp_new = PyType_GenericNew;8153 if (PyType_Ready(& pjmedia_codec_param_info_Type) < 0)5688 PyTyp_pjmedia_codec_param_info.tp_new = PyType_GenericNew; 5689 if (PyType_Ready(&PyTyp_pjmedia_codec_param_info) < 0) 8154 5690 return; 8155 pjmedia_codec_param_setting_Type.tp_new = PyType_GenericNew;8156 if (PyType_Ready(& pjmedia_codec_param_setting_Type) < 0)5691 PyTyp_pjmedia_codec_param_setting.tp_new = PyType_GenericNew; 5692 if (PyType_Ready(&PyTyp_pjmedia_codec_param_setting) < 0) 8157 5693 return; 8158 5694 8159 if (PyType_Ready(& pjmedia_codec_param_Type) < 0)5695 if (PyType_Ready(&PyTyp_pjmedia_codec_param) < 0) 8160 5696 return; 8161 5697 … … 8164 5700 /* LIB CALL */ 8165 5701 8166 pj_time_val_Type.tp_new = PyType_GenericNew;8167 if (PyType_Ready(& pj_time_val_Type) < 0)5702 PyTyp_pj_time_val.tp_new = PyType_GenericNew; 5703 if (PyType_Ready(&PyTyp_pj_time_val) < 0) 8168 5704 return; 8169 5705 8170 if (PyType_Ready(& call_info_Type) < 0)5706 if (PyType_Ready(&PyTyp_pjsua_call_info) < 0) 8171 5707 return; 8172 5708 … … 8177 5713 ); 8178 5714 8179 Py_INCREF(& callback_Type);8180 PyModule_AddObject(m, "Callback", (PyObject *)& callback_Type);8181 8182 Py_INCREF(& config_Type);8183 PyModule_AddObject(m, "Config", (PyObject *)& config_Type);8184 8185 Py_INCREF(& media_config_Type);8186 PyModule_AddObject(m, "Media_Config", (PyObject *)& media_config_Type);8187 8188 Py_INCREF(& logging_config_Type);8189 PyModule_AddObject(m, "Logging_Config", (PyObject *)& logging_config_Type);8190 8191 Py_INCREF(& msg_data_Type);8192 PyModule_AddObject(m, "Msg_Data", (PyObject *)& msg_data_Type);8193 8194 Py_INCREF(& pjsip_event_Type);8195 PyModule_AddObject(m, "P JSIP_Event", (PyObject *)&pjsip_event_Type);8196 8197 Py_INCREF(& pjsip_rx_data_Type);8198 PyModule_AddObject(m, "P JSIP_RX_Data", (PyObject *)&pjsip_rx_data_Type);8199 8200 Py_INCREF(& pj_pool_Type);8201 PyModule_AddObject(m, "P J_Pool", (PyObject *)&pj_pool_Type);8202 8203 Py_INCREF(& pjsip_endpoint_Type);8204 PyModule_AddObject(m, "P JSIP_Endpoint", (PyObject *)&pjsip_endpoint_Type);8205 8206 Py_INCREF(& pjmedia_endpt_Type);8207 PyModule_AddObject(m, "P JMedia_Endpt", (PyObject *)&pjmedia_endpt_Type);8208 8209 Py_INCREF(& pj_pool_factory_Type);5715 Py_INCREF(&PyTyp_pjsua_callback); 5716 PyModule_AddObject(m, "Callback", (PyObject *)&PyTyp_pjsua_callback); 5717 5718 Py_INCREF(&PyTyp_pjsua_config); 5719 PyModule_AddObject(m, "Config", (PyObject *)&PyTyp_pjsua_config); 5720 5721 Py_INCREF(&PyTyp_pjsua_media_config); 5722 PyModule_AddObject(m, "Media_Config", (PyObject *)&PyTyp_pjsua_media_config); 5723 5724 Py_INCREF(&PyTyp_pjsua_logging_config); 5725 PyModule_AddObject(m, "Logging_Config", (PyObject *)&PyTyp_pjsua_logging_config); 5726 5727 Py_INCREF(&PyTyp_pjsua_msg_data); 5728 PyModule_AddObject(m, "Msg_Data", (PyObject *)&PyTyp_pjsua_msg_data); 5729 5730 Py_INCREF(&PyTyp_pjsip_event); 5731 PyModule_AddObject(m, "Pjsip_Event", (PyObject *)&PyTyp_pjsip_event); 5732 5733 Py_INCREF(&PyTyp_pjsip_rx_data); 5734 PyModule_AddObject(m, "Pjsip_Rx_Data", (PyObject *)&PyTyp_pjsip_rx_data); 5735 5736 Py_INCREF(&PyTyp_pj_pool_t); 5737 PyModule_AddObject(m, "Pj_Pool", (PyObject *)&PyTyp_pj_pool_t); 5738 5739 Py_INCREF(&PyTyp_pjsip_endpoint); 5740 PyModule_AddObject(m, "Pjsip_Endpoint", (PyObject *)&PyTyp_pjsip_endpoint); 5741 5742 Py_INCREF(&PyTyp_pjmedia_endpt); 5743 PyModule_AddObject(m, "Pjmedia_Endpt", (PyObject *)&PyTyp_pjmedia_endpt); 5744 5745 Py_INCREF(&PyTyp_pj_pool_factory); 8210 5746 PyModule_AddObject( 8211 m, "P J_Pool_Factory", (PyObject *)&pj_pool_factory_Type5747 m, "Pj_Pool_Factory", (PyObject *)&PyTyp_pj_pool_factory 8212 5748 ); 8213 5749 8214 Py_INCREF(& pjsip_cred_info_Type);8215 PyModule_AddObject(m, "P JSIP_Cred_Info",8216 (PyObject *)& pjsip_cred_info_Type5750 Py_INCREF(&PyTyp_pjsip_cred_info); 5751 PyModule_AddObject(m, "Pjsip_Cred_Info", 5752 (PyObject *)&PyTyp_pjsip_cred_info 8217 5753 ); 8218 5754 8219 5755 /* LIB TRANSPORT */ 8220 5756 8221 Py_INCREF(& transport_config_Type);5757 Py_INCREF(&PyTyp_pjsua_transport_config); 8222 5758 PyModule_AddObject 8223 (m, "Transport_Config", (PyObject *)&transport_config_Type); 8224 Py_INCREF(&host_port_Type); 8225 PyModule_AddObject(m, "Host_Port", (PyObject *)&host_port_Type); 8226 8227 Py_INCREF(&transport_info_Type); 8228 PyModule_AddObject(m, "Transport_Info", (PyObject *)&transport_info_Type); 8229 8230 Py_INCREF(&pjsip_transport_Type); 8231 PyModule_AddObject(m, "PJSIP_Transport", (PyObject *)&pjsip_transport_Type); 5759 (m, "Transport_Config", (PyObject *)&PyTyp_pjsua_transport_config); 5760 5761 Py_INCREF(&PyTyp_pjsua_transport_info); 5762 PyModule_AddObject(m, "Transport_Info", (PyObject *)&PyTyp_pjsua_transport_info); 5763 8232 5764 8233 5765 /* END OF LIB TRANSPORT */ … … 8236 5768 8237 5769 8238 Py_INCREF(& acc_config_Type);8239 PyModule_AddObject(m, "Acc_Config", (PyObject *)& acc_config_Type);8240 Py_INCREF(& acc_info_Type);8241 PyModule_AddObject(m, "Acc_Info", (PyObject *)& acc_info_Type);5770 Py_INCREF(&PyTyp_pjsua_acc_config); 5771 PyModule_AddObject(m, "Acc_Config", (PyObject *)&PyTyp_pjsua_acc_config); 5772 Py_INCREF(&PyTyp_pjsua_acc_info); 5773 PyModule_AddObject(m, "Acc_Info", (PyObject *)&PyTyp_pjsua_acc_info); 8242 5774 8243 5775 /* END OF LIB ACCOUNT */ … … 8245 5777 /* LIB BUDDY */ 8246 5778 8247 Py_INCREF(& buddy_config_Type);8248 PyModule_AddObject(m, "Buddy_Config", (PyObject *)& buddy_config_Type);8249 Py_INCREF(& buddy_info_Type);8250 PyModule_AddObject(m, "Buddy_Info", (PyObject *)& buddy_info_Type);5779 Py_INCREF(&PyTyp_pjsua_buddy_config); 5780 PyModule_AddObject(m, "Buddy_Config", (PyObject *)&PyTyp_pjsua_buddy_config); 5781 Py_INCREF(&PyTyp_pjsua_buddy_info); 5782 PyModule_AddObject(m, "Buddy_Info", (PyObject *)&PyTyp_pjsua_buddy_info); 8251 5783 8252 5784 /* END OF LIB BUDDY */ … … 8254 5786 /* LIB MEDIA */ 8255 5787 8256 Py_INCREF(& codec_info_Type);8257 PyModule_AddObject(m, "Codec_Info", (PyObject *)& codec_info_Type);8258 Py_INCREF(& conf_port_info_Type);8259 PyModule_AddObject(m, "Conf_Port_Info", (PyObject *)& conf_port_info_Type);8260 Py_INCREF(& pjmedia_port_Type);8261 PyModule_AddObject(m, "PJMedia_Port", (PyObject *)& pjmedia_port_Type);8262 Py_INCREF(& pjmedia_snd_dev_info_Type);5788 Py_INCREF(&PyTyp_pjsua_codec_info); 5789 PyModule_AddObject(m, "Codec_Info", (PyObject *)&PyTyp_pjsua_codec_info); 5790 Py_INCREF(&PyTyp_pjsua_conf_port_info); 5791 PyModule_AddObject(m, "Conf_Port_Info", (PyObject *)&PyTyp_pjsua_conf_port_info); 5792 Py_INCREF(&PyTyp_pjmedia_port); 5793 PyModule_AddObject(m, "PJMedia_Port", (PyObject *)&PyTyp_pjmedia_port); 5794 Py_INCREF(&PyTyp_pjmedia_snd_dev_info); 8263 5795 PyModule_AddObject(m, "PJMedia_Snd_Dev_Info", 8264 (PyObject *)& pjmedia_snd_dev_info_Type);8265 Py_INCREF(& pjmedia_codec_param_info_Type);5796 (PyObject *)&PyTyp_pjmedia_snd_dev_info); 5797 Py_INCREF(&PyTyp_pjmedia_codec_param_info); 8266 5798 PyModule_AddObject(m, "PJMedia_Codec_Param_Info", 8267 (PyObject *)& pjmedia_codec_param_info_Type);8268 Py_INCREF(& pjmedia_codec_param_setting_Type);5799 (PyObject *)&PyTyp_pjmedia_codec_param_info); 5800 Py_INCREF(&PyTyp_pjmedia_codec_param_setting); 8269 5801 PyModule_AddObject(m, "PJMedia_Codec_Param_Setting", 8270 (PyObject *)& pjmedia_codec_param_setting_Type);8271 Py_INCREF(& pjmedia_codec_param_Type);5802 (PyObject *)&PyTyp_pjmedia_codec_param_setting); 5803 Py_INCREF(&PyTyp_pjmedia_codec_param); 8272 5804 PyModule_AddObject(m, "PJMedia_Codec_Param", 8273 (PyObject *)& pjmedia_codec_param_Type);5805 (PyObject *)&PyTyp_pjmedia_codec_param); 8274 5806 8275 5807 /* END OF LIB MEDIA */ … … 8277 5809 /* LIB CALL */ 8278 5810 8279 Py_INCREF(& pj_time_val_Type);8280 PyModule_AddObject(m, "PJ_Time_Val", (PyObject *)& pj_time_val_Type);8281 8282 Py_INCREF(& call_info_Type);8283 PyModule_AddObject(m, "Call_Info", (PyObject *)& call_info_Type);5811 Py_INCREF(&PyTyp_pj_time_val); 5812 PyModule_AddObject(m, "PJ_Time_Val", (PyObject *)&PyTyp_pj_time_val); 5813 5814 Py_INCREF(&PyTyp_pjsua_call_info); 5815 PyModule_AddObject(m, "Call_Info", (PyObject *)&PyTyp_pjsua_call_info); 8284 5816 8285 5817 /* END OF LIB CALL */ -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r1424 r1430 571 571 * \code 572 572 # call_id: integer 573 # digit: integer573 # digit: digit string 574 574 575 575 def on_dtmf_digit(call_id, digit):
Note: See TracChangeset
for help on using the changeset viewer.