Changeset 2163 for pjproject/trunk/pjsip-apps/src/python/_pjsua.h
- Timestamp:
- Jul 21, 2008 6:20:57 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/python/_pjsua.h
r2156 r2163 27 27 28 28 29 PJ_INLINE(pj_str_t) PyString_ to_pj_str(const PyObject *obj)29 PJ_INLINE(pj_str_t) PyString_ToPJ(const PyObject *obj) 30 30 { 31 31 pj_str_t str; 32 32 33 if (obj ) {33 if (obj && PyString_Check(obj)) { 34 34 str.ptr = PyString_AS_STRING(obj); 35 35 str.slen = PyString_GET_SIZE(obj); … … 42 42 } 43 43 44 45 ////////////////////////////////////////////////////////////////////////////// 46 /* 47 * PyObj_pj_pool 48 */ 49 typedef struct 50 { 51 PyObject_HEAD 52 /* Type-specific fields go here. */ 53 pj_pool_t * pool; 54 } PyObj_pj_pool; 55 56 57 /* 58 * PyTyp_pj_pool_t 59 */ 60 static PyTypeObject PyTyp_pj_pool_t = 61 { 62 PyObject_HEAD_INIT(NULL) 63 0, /*ob_size*/ 64 "_pjsua.Pj_Pool", /*tp_name*/ 65 sizeof(PyObj_pj_pool), /*tp_basicsize*/ 66 0, /*tp_itemsize*/ 67 0, /*tp_dealloc*/ 68 0, /*tp_print*/ 69 0, /*tp_getattr*/ 70 0, /*tp_setattr*/ 71 0, /*tp_compare*/ 72 0, /*tp_repr*/ 73 0, /*tp_as_number*/ 74 0, /*tp_as_sequence*/ 75 0, /*tp_as_mapping*/ 76 0, /*tp_hash */ 77 0, /*tp_call*/ 78 0, /*tp_str*/ 79 0, /*tp_getattro*/ 80 0, /*tp_setattro*/ 81 0, /*tp_as_buffer*/ 82 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 83 "pj_pool_t objects", /* tp_doc */ 84 85 }; 86 87 88 ////////////////////////////////////////////////////////////////////////////// 89 /* 90 * PyObj_pjsip_endpoint 91 */ 92 typedef struct 93 { 94 PyObject_HEAD 95 /* Type-specific fields go here. */ 96 pjsip_endpoint * endpt; 97 } PyObj_pjsip_endpoint; 98 99 100 /* 101 * PyTyp_pjsip_endpoint 102 */ 103 static PyTypeObject PyTyp_pjsip_endpoint = 104 { 105 PyObject_HEAD_INIT(NULL) 106 0, /*ob_size*/ 107 "_pjsua.Pjsip_Endpoint", /*tp_name*/ 108 sizeof(PyObj_pjsip_endpoint),/*tp_basicsize*/ 109 0, /*tp_itemsize*/ 110 0, /*tp_dealloc*/ 111 0, /*tp_print*/ 112 0, /*tp_getattr*/ 113 0, /*tp_setattr*/ 114 0, /*tp_compare*/ 115 0, /*tp_repr*/ 116 0, /*tp_as_number*/ 117 0, /*tp_as_sequence*/ 118 0, /*tp_as_mapping*/ 119 0, /*tp_hash */ 120 0, /*tp_call*/ 121 0, /*tp_str*/ 122 0, /*tp_getattro*/ 123 0, /*tp_setattro*/ 124 0, /*tp_as_buffer*/ 125 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 126 "pjsip_endpoint objects", /* tp_doc */ 127 }; 128 129 130 /* 131 * PyObj_pjmedia_endpt 132 */ 133 typedef struct 134 { 135 PyObject_HEAD 136 /* Type-specific fields go here. */ 137 pjmedia_endpt * endpt; 138 } PyObj_pjmedia_endpt; 139 140 141 ////////////////////////////////////////////////////////////////////////////// 142 /* 143 * PyTyp_pjmedia_endpt 144 */ 145 static PyTypeObject PyTyp_pjmedia_endpt = 146 { 147 PyObject_HEAD_INIT(NULL) 148 0, /*ob_size*/ 149 "_pjsua.Pjmedia_Endpt", /*tp_name*/ 150 sizeof(PyObj_pjmedia_endpt), /*tp_basicsize*/ 151 0, /*tp_itemsize*/ 152 0, /*tp_dealloc*/ 153 0, /*tp_print*/ 154 0, /*tp_getattr*/ 155 0, /*tp_setattr*/ 156 0, /*tp_compare*/ 157 0, /*tp_repr*/ 158 0, /*tp_as_number*/ 159 0, /*tp_as_sequence*/ 160 0, /*tp_as_mapping*/ 161 0, /*tp_hash */ 162 0, /*tp_call*/ 163 0, /*tp_str*/ 164 0, /*tp_getattro*/ 165 0, /*tp_setattro*/ 166 0, /*tp_as_buffer*/ 167 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 168 "pjmedia_endpt objects", /* tp_doc */ 169 170 }; 171 172 173 ////////////////////////////////////////////////////////////////////////////// 174 /* 175 * PyObj_pj_pool_factory 176 */ 177 typedef struct 178 { 179 PyObject_HEAD 180 /* Type-specific fields go here. */ 181 pj_pool_factory * pool_fact; 182 } PyObj_pj_pool_factory; 183 184 185 186 /* 187 * PyTyp_pj_pool_factory 188 */ 189 static PyTypeObject PyTyp_pj_pool_factory = 190 { 191 PyObject_HEAD_INIT(NULL) 192 0, /*ob_size*/ 193 "_pjsua.Pj_Pool_Factory",/*tp_name*/ 194 sizeof(PyObj_pj_pool_factory), /*tp_basicsize*/ 195 0, /*tp_itemsize*/ 196 0, /*tp_dealloc*/ 197 0, /*tp_print*/ 198 0, /*tp_getattr*/ 199 0, /*tp_setattr*/ 200 0, /*tp_compare*/ 201 0, /*tp_repr*/ 202 0, /*tp_as_number*/ 203 0, /*tp_as_sequence*/ 204 0, /*tp_as_mapping*/ 205 0, /*tp_hash */ 206 0, /*tp_call*/ 207 0, /*tp_str*/ 208 0, /*tp_getattro*/ 209 0, /*tp_setattro*/ 210 0, /*tp_as_buffer*/ 211 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 212 "pj_pool_factory objects", /* tp_doc */ 213 214 }; 215 44 PJ_INLINE(PyObject*) PyString_FromPJ(const pj_str_t *str) 45 { 46 return PyString_FromStringAndSize(str->ptr, str->slen); 47 } 216 48 217 49 ////////////////////////////////////////////////////////////////////////////// … … 250 82 { 251 83 Py_XDECREF(obj->realm); 252 obj->realm = PyString_From StringAndSize(cfg->realm.ptr, cfg->realm.slen);84 obj->realm = PyString_FromPJ(&cfg->realm); 253 85 Py_XDECREF(obj->scheme); 254 obj->scheme = PyString_From StringAndSize(cfg->scheme.ptr, cfg->scheme.slen);86 obj->scheme = PyString_FromPJ(&cfg->scheme); 255 87 Py_XDECREF(obj->username); 256 obj->username = PyString_From StringAndSize(cfg->username.ptr, cfg->username.slen);88 obj->username = PyString_FromPJ(&cfg->username); 257 89 obj->data_type = cfg->data_type; 258 90 Py_XDECREF(obj->data); 259 obj->data = PyString_From StringAndSize(cfg->data.ptr, cfg->data.slen);91 obj->data = PyString_FromPJ(&cfg->data); 260 92 } 261 93 … … 263 95 PyObj_pjsip_cred_info *obj) 264 96 { 265 cfg->realm = PyString_ to_pj_str(obj->realm);266 cfg->scheme = PyString_ to_pj_str(obj->scheme);267 cfg->username = PyString_ to_pj_str(obj->username);97 cfg->realm = PyString_ToPJ(obj->realm); 98 cfg->scheme = PyString_ToPJ(obj->scheme); 99 cfg->username = PyString_ToPJ(obj->username); 268 100 cfg->data_type = obj->data_type; 269 cfg->data = PyString_ to_pj_str(obj->data);101 cfg->data = PyString_ToPJ(obj->data); 270 102 } 271 103 … … 285 117 286 118 self = (PyObj_pjsip_cred_info *)type->tp_alloc(type, 0); 287 if (self != NULL) 288 { 119 if (self != NULL) { 289 120 self->realm = PyString_FromString(""); 290 if (self->realm == NULL)291 {292 Py_DECREF(self);293 return NULL;294 }295 121 self->scheme = PyString_FromString(""); 296 if (self->scheme == NULL)297 {298 Py_DECREF(self);299 return NULL;300 }301 122 self->username = PyString_FromString(""); 302 if (self->username == NULL)303 {304 Py_DECREF(self);305 return NULL;306 }307 123 self->data_type = PJSIP_CRED_DATA_PLAIN_PASSWD; 308 124 self->data = PyString_FromString(""); 309 if (self->data == NULL)310 {311 Py_DECREF(self);312 return NULL;313 }314 125 } 315 126 … … 387 198 0, /* tp_iternext */ 388 199 0, /* tp_methods */ 389 PyObj_pjsip_cred_info_members, 200 PyObj_pjsip_cred_info_members, /* tp_members */ 390 201 0, /* tp_getset */ 391 202 0, /* tp_base */ … … 396 207 0, /* tp_init */ 397 208 0, /* tp_alloc */ 398 PyObj_pjsip_cred_info_new, /* tp_new */ 399 400 }; 401 402 403 ////////////////////////////////////////////////////////////////////////////// 404 /* 405 * PyObj_pjsip_event 406 * C/python typewrapper for event struct 407 */ 408 typedef struct 409 { 410 PyObject_HEAD 411 /* Type-specific fields go here. */ 412 pjsip_event * event; 413 } PyObj_pjsip_event; 414 415 416 417 /* 418 * PyTyp_pjsip_event 419 * event struct signatures 420 */ 421 static PyTypeObject PyTyp_pjsip_event = 422 { 423 PyObject_HEAD_INIT(NULL) 424 0, /*ob_size*/ 425 "_pjsua.Pjsip_Event", /*tp_name*/ 426 sizeof(PyObj_pjsip_event), /*tp_basicsize*/ 427 0, /*tp_itemsize*/ 428 0, /*tp_dealloc*/ 429 0, /*tp_print*/ 430 0, /*tp_getattr*/ 431 0, /*tp_setattr*/ 432 0, /*tp_compare*/ 433 0, /*tp_repr*/ 434 0, /*tp_as_number*/ 435 0, /*tp_as_sequence*/ 436 0, /*tp_as_mapping*/ 437 0, /*tp_hash */ 438 0, /*tp_call*/ 439 0, /*tp_str*/ 440 0, /*tp_getattro*/ 441 0, /*tp_setattro*/ 442 0, /*tp_as_buffer*/ 443 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 444 "pjsip_event object", /*tp_doc */ 445 }; 446 447 448 ////////////////////////////////////////////////////////////////////////////// 449 /* 450 * PyObj_pjsip_rx_data 451 * C/python typewrapper for pjsip_rx_data struct 452 */ 453 typedef struct 454 { 455 PyObject_HEAD 456 /* Type-specific fields go here. */ 457 pjsip_rx_data * rdata; 458 } PyObj_pjsip_rx_data; 459 460 461 /* 462 * PyTyp_pjsip_rx_data 463 */ 464 static PyTypeObject PyTyp_pjsip_rx_data = 465 { 466 PyObject_HEAD_INIT(NULL) 467 0, /*ob_size*/ 468 "_pjsua.Pjsip_Rx_Data", /*tp_name*/ 469 sizeof(PyObj_pjsip_rx_data), /*tp_basicsize*/ 470 0, /*tp_itemsize*/ 471 0, /*tp_dealloc*/ 472 0, /*tp_print*/ 473 0, /*tp_getattr*/ 474 0, /*tp_setattr*/ 475 0, /*tp_compare*/ 476 0, /*tp_repr*/ 477 0, /*tp_as_number*/ 478 0, /*tp_as_sequence*/ 479 0, /*tp_as_mapping*/ 480 0, /*tp_hash */ 481 0, /*tp_call*/ 482 0, /*tp_str*/ 483 0, /*tp_getattro*/ 484 0, /*tp_setattro*/ 485 0, /*tp_as_buffer*/ 486 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 487 "pjsip_rx_data object", /*tp_doc*/ 488 }; 489 209 PyObj_pjsip_cred_info_new, /* tp_new */ 210 211 }; 490 212 491 213 … … 554 276 555 277 self = (PyObj_pjsua_callback *)type->tp_alloc(type, 0); 556 if (self != NULL) 557 { 558 Py_INCREF(Py_None); 559 self->on_call_state = Py_None; 560 if (self->on_call_state == NULL) 561 { 562 Py_DECREF(Py_None); 563 return NULL; 564 } 565 Py_INCREF(Py_None); 566 self->on_incoming_call = Py_None; 567 if (self->on_incoming_call == NULL) 568 { 569 Py_DECREF(Py_None); 570 return NULL; 571 } 572 Py_INCREF(Py_None); 573 self->on_call_media_state = Py_None; 574 if (self->on_call_media_state == NULL) 575 { 576 Py_DECREF(Py_None); 577 return NULL; 578 } 579 Py_INCREF(Py_None); 580 self->on_dtmf_digit = Py_None; 581 if (self->on_dtmf_digit == NULL) 582 { 583 Py_DECREF(Py_None); 584 return NULL; 585 } 586 Py_INCREF(Py_None); 587 self->on_call_transfer_request = Py_None; 588 if (self->on_call_transfer_request == NULL) 589 { 590 Py_DECREF(Py_None); 591 return NULL; 592 } 593 Py_INCREF(Py_None); 594 self->on_call_transfer_status = Py_None; 595 if (self->on_call_transfer_status == NULL) 596 { 597 Py_DECREF(Py_None); 598 return NULL; 599 } 600 Py_INCREF(Py_None); 601 self->on_call_replace_request = Py_None; 602 if (self->on_call_replace_request == NULL) 603 { 604 Py_DECREF(Py_None); 605 return NULL; 606 } 607 Py_INCREF(Py_None); 608 self->on_call_replaced = Py_None; 609 if (self->on_call_replaced == NULL) 610 { 611 Py_DECREF(Py_None); 612 return NULL; 613 } 614 Py_INCREF(Py_None); 615 self->on_reg_state = Py_None; 616 if (self->on_reg_state == NULL) 617 { 618 Py_DECREF(Py_None); 619 return NULL; 620 } 621 Py_INCREF(Py_None); 622 self->on_incoming_subscribe = Py_None; 623 Py_INCREF(Py_None); 624 self->on_buddy_state = Py_None; 625 if (self->on_buddy_state == NULL) 626 { 627 Py_DECREF(Py_None); 628 return NULL; 629 } 630 Py_INCREF(Py_None); 631 self->on_pager = Py_None; 632 if (self->on_pager == NULL) 633 { 634 Py_DECREF(Py_None); 635 return NULL; 636 } 637 Py_INCREF(Py_None); 638 self->on_pager_status = Py_None; 639 if (self->on_pager_status == NULL) 640 { 641 Py_DECREF(Py_None); 642 return NULL; 643 } 644 Py_INCREF(Py_None); 645 self->on_typing = Py_None; 646 if (self->on_typing == NULL) 647 { 648 Py_DECREF(Py_None); 649 return NULL; 650 } 278 if (self != NULL) { 279 self->on_call_state = Py_BuildValue(""); 280 self->on_incoming_call = Py_BuildValue(""); 281 self->on_call_media_state = Py_BuildValue(""); 282 self->on_dtmf_digit = Py_BuildValue(""); 283 self->on_call_transfer_request = Py_BuildValue(""); 284 self->on_call_transfer_status = Py_BuildValue(""); 285 self->on_call_replace_request = Py_BuildValue(""); 286 self->on_call_replaced = Py_BuildValue(""); 287 self->on_reg_state = Py_BuildValue(""); 288 self->on_incoming_subscribe = Py_BuildValue(""); 289 self->on_buddy_state = Py_BuildValue(""); 290 self->on_pager = Py_BuildValue(""); 291 self->on_pager_status = Py_BuildValue(""); 292 self->on_typing = Py_BuildValue(""); 651 293 } 652 294 … … 989 631 }, 990 632 { 991 "turn_passw ", T_OBJECT_EX,633 "turn_passwd", T_OBJECT_EX, 992 634 offsetof(PyObj_pjsua_media_config, turn_passwd), 0, 993 635 "Specify the TURN password." … … 1008 650 1009 651 self = (PyObj_pjsua_media_config*)type->tp_alloc(type, 0); 1010 if (self != NULL) 1011 { 652 if (self != NULL) { 1012 653 self->turn_server = PyString_FromString(""); 1013 654 self->turn_realm = PyString_FromString(""); … … 1052 693 obj->enable_turn = cfg->enable_turn; 1053 694 Py_XDECREF(obj->turn_server); 1054 obj->turn_server = PyString_FromStringAndSize(cfg->turn_server.ptr, 1055 cfg->turn_server.slen); 695 obj->turn_server = PyString_FromPJ(&cfg->turn_server); 1056 696 obj->turn_conn_type = cfg->turn_conn_type; 1057 697 if (cfg->turn_auth_cred.type == PJ_STUN_AUTH_CRED_STATIC) { … … 1059 699 1060 700 Py_XDECREF(obj->turn_realm); 1061 obj->turn_realm = PyString_FromStringAndSize(cred->data.static_cred.realm.ptr, 1062 cred->data.static_cred.realm.slen); 701 obj->turn_realm = PyString_FromPJ(&cred->data.static_cred.realm); 1063 702 Py_XDECREF(obj->turn_username); 1064 obj->turn_username = PyString_FromStringAndSize(cred->data.static_cred.username.ptr, 1065 cred->data.static_cred.username.slen); 703 obj->turn_username = PyString_FromPJ(&cred->data.static_cred.username); 1066 704 obj->turn_passwd_type = cred->data.static_cred.data_type; 1067 705 Py_XDECREF(obj->turn_passwd); 1068 obj->turn_passwd = PyString_FromStringAndSize(cred->data.static_cred.data.ptr, 1069 cred->data.static_cred.data.slen); 706 obj->turn_passwd = PyString_FromPJ(&cred->data.static_cred.data); 1070 707 } else { 1071 708 Py_XDECREF(obj->turn_realm); … … 1104 741 1105 742 if (cfg->enable_turn) { 1106 cfg->turn_server = PyString_ to_pj_str(obj->turn_server);743 cfg->turn_server = PyString_ToPJ(obj->turn_server); 1107 744 cfg->turn_conn_type = obj->turn_conn_type; 1108 745 cfg->turn_auth_cred.type = PJ_STUN_AUTH_CRED_STATIC; 1109 cfg->turn_auth_cred.data.static_cred.realm = PyString_ to_pj_str(obj->turn_realm);1110 cfg->turn_auth_cred.data.static_cred.username = PyString_ to_pj_str(obj->turn_username);746 cfg->turn_auth_cred.data.static_cred.realm = PyString_ToPJ(obj->turn_realm); 747 cfg->turn_auth_cred.data.static_cred.username = PyString_ToPJ(obj->turn_username); 1111 748 cfg->turn_auth_cred.data.static_cred.data_type= obj->turn_passwd_type; 1112 cfg->turn_auth_cred.data.static_cred.data = PyString_ to_pj_str(obj->turn_passwd);749 cfg->turn_auth_cred.data.static_cred.data = PyString_ToPJ(obj->turn_passwd); 1113 750 } 1114 751 } … … 1202 839 obj->thread_cnt = cfg->thread_cnt; 1203 840 Py_XDECREF(obj->outbound_proxy); 1204 obj->outbound_proxy = PyString_FromStringAndSize(cfg->outbound_proxy[0].ptr, 1205 cfg->outbound_proxy[0].slen); 841 if (cfg->outbound_proxy_cnt) 842 obj->outbound_proxy = PyString_FromPJ(&cfg->outbound_proxy[0]); 843 else 844 obj->outbound_proxy = PyString_FromString(""); 845 1206 846 Py_XDECREF(obj->stun_domain); 1207 obj->stun_domain = PyString_FromStringAndSize(cfg->stun_domain.ptr, 1208 cfg->stun_domain.slen); 847 obj->stun_domain = PyString_FromPJ(&cfg->stun_domain); 1209 848 Py_XDECREF(obj->stun_host); 1210 obj->stun_host = PyString_FromStringAndSize(cfg->stun_host.ptr, 1211 cfg->stun_host.slen); 849 obj->stun_host = PyString_FromPJ(&cfg->stun_host); 1212 850 Py_XDECREF(obj->nameserver); 1213 851 obj->nameserver = (PyListObject *)PyList_New(0); 1214 852 for (i=0; i<cfg->nameserver_count; ++i) { 1215 853 PyObject * str; 1216 str = PyString_FromStringAndSize(cfg->nameserver[i].ptr, 1217 cfg->nameserver[i].slen); 854 str = PyString_FromPJ(&cfg->nameserver[i]); 1218 855 PyList_Append((PyObject *)obj->nameserver, str); 1219 856 } 1220 857 Py_XDECREF(obj->user_agent); 1221 obj->user_agent = PyString_FromStringAndSize(cfg->user_agent.ptr, 1222 cfg->user_agent.slen); 858 obj->user_agent = PyString_FromPJ(&cfg->user_agent); 1223 859 } 1224 860 … … 1233 869 if (PyString_Size(obj->outbound_proxy) > 0) { 1234 870 cfg->outbound_proxy_cnt = 1; 1235 cfg->outbound_proxy[0] = PyString_ to_pj_str(obj->outbound_proxy);871 cfg->outbound_proxy[0] = PyString_ToPJ(obj->outbound_proxy); 1236 872 } else { 1237 873 cfg->outbound_proxy_cnt = 0; … … 1241 877 cfg->nameserver_count = PJ_ARRAY_SIZE(cfg->nameserver); 1242 878 for (i = 0; i < cfg->nameserver_count; i++) { 1243 cfg->nameserver[i] = PyString_to_pj_str(PyList_GetItem((PyObject *)obj->nameserver,i)); 879 PyObject *item = PyList_GetItem((PyObject *)obj->nameserver,i); 880 cfg->nameserver[i] = PyString_ToPJ(item); 1244 881 } 1245 cfg->stun_domain = PyString_ to_pj_str(obj->stun_domain);1246 cfg->stun_host = PyString_ to_pj_str(obj->stun_host);1247 cfg->user_agent = PyString_ to_pj_str(obj->user_agent);882 cfg->stun_domain = PyString_ToPJ(obj->stun_domain); 883 cfg->stun_host = PyString_ToPJ(obj->stun_host); 884 cfg->user_agent = PyString_ToPJ(obj->user_agent); 1248 885 1249 886 } … … 1260 897 1261 898 self = (PyObj_pjsua_config *)type->tp_alloc(type, 0); 1262 if (self != NULL) 1263 { 899 if (self != NULL) { 1264 900 self->user_agent = PyString_FromString(""); 1265 if (self->user_agent == NULL)1266 {1267 Py_DECREF(self);1268 return NULL;1269 }1270 901 self->outbound_proxy = PyString_FromString(""); 1271 if (self->outbound_proxy == NULL) 1272 { 1273 Py_DECREF(self); 1274 return NULL; 1275 } 902 self->stun_domain = PyString_FromString(""); 903 self->stun_host = PyString_FromString(""); 1276 904 self->cb = (PyObj_pjsua_callback *) 1277 905 PyType_GenericNew(&PyTyp_pjsua_callback, NULL, NULL); 1278 if (self->cb == NULL)1279 {1280 Py_DECREF(Py_None);1281 return NULL;1282 }1283 906 } 1284 907 return (PyObject *)self; … … 1426 1049 obj->console_level = cfg->console_level; 1427 1050 obj->decor = cfg->decor; 1051 Py_XDECREF(obj->log_filename); 1052 obj->log_filename = PyString_FromPJ(&cfg->log_filename); 1428 1053 } 1429 1054 … … 1435 1060 cfg->console_level = obj->console_level; 1436 1061 cfg->decor = obj->decor; 1437 cfg->log_filename = PyString_ to_pj_str(obj->log_filename);1062 cfg->log_filename = PyString_ToPJ(obj->log_filename); 1438 1063 } 1439 1064 … … 1453 1078 1454 1079 self = (PyObj_pjsua_logging_config *)type->tp_alloc(type, 0); 1455 if (self != NULL) 1456 { 1080 if (self != NULL) { 1457 1081 self->log_filename = PyString_FromString(""); 1458 if (self->log_filename == NULL) 1459 { 1460 Py_DECREF(self); 1461 return NULL; 1462 } 1463 Py_INCREF(Py_None); 1464 self->cb = Py_None; 1465 if (self->cb == NULL) 1466 { 1467 Py_DECREF(Py_None); 1468 return NULL; 1469 } 1082 self->cb = Py_BuildValue(""); 1470 1083 } 1471 1084 … … 1610 1223 1611 1224 self = (PyObj_pjsua_msg_data *)type->tp_alloc(type, 0); 1612 if (self != NULL) 1613 { 1614 Py_INCREF(Py_None); 1615 self->hdr_list = Py_None; 1616 if (self->hdr_list == NULL) { 1617 Py_DECREF(self); 1618 return NULL; 1619 } 1225 if (self != NULL) { 1226 self->hdr_list = PyList_New(0); 1620 1227 self->content_type = PyString_FromString(""); 1621 if (self->content_type == NULL) {1622 Py_DECREF(self);1623 return NULL;1624 }1625 1228 self->msg_body = PyString_FromString(""); 1626 if (self->msg_body == NULL) {1627 Py_DECREF(self);1628 return NULL;1629 }1630 1229 } 1631 1230 … … 1738 1337 PyObj_pjsua_transport_config *obj) 1739 1338 { 1740 cfg->public_addr = PyString_ to_pj_str(obj->public_addr);1741 cfg->bound_addr = PyString_ to_pj_str(obj->bound_addr);1339 cfg->public_addr = PyString_ToPJ(obj->public_addr); 1340 cfg->bound_addr = PyString_ToPJ(obj->bound_addr); 1742 1341 cfg->port = obj->port; 1743 1342 … … 1748 1347 { 1749 1348 Py_XDECREF(obj->public_addr); 1750 obj->public_addr = PyString_FromStringAndSize(cfg->public_addr.ptr, 1751 cfg->public_addr.slen); 1349 obj->public_addr = PyString_FromPJ(&cfg->public_addr); 1752 1350 1753 1351 Py_XDECREF(obj->bound_addr); 1754 obj->bound_addr = PyString_FromStringAndSize(cfg->bound_addr.ptr, 1755 cfg->bound_addr.slen); 1352 obj->bound_addr = PyString_FromPJ(&cfg->bound_addr); 1756 1353 1757 1354 obj->port = cfg->port; … … 1775 1372 if (self != NULL) { 1776 1373 self->public_addr = PyString_FromString(""); 1777 if (self->public_addr == NULL) {1778 Py_DECREF(self);1779 return NULL;1780 }1781 1374 self->bound_addr = PyString_FromString(""); 1782 if (self->bound_addr == NULL) {1783 Py_DECREF(self);1784 return NULL;1785 }1786 1375 } 1787 1376 … … 1912 1501 obj->id = info->id; 1913 1502 obj->type = info->type; 1914 obj->type_name = PyString_FromStringAndSize(info->type_name.ptr, 1915 info->type_name.slen); 1916 obj->info = PyString_FromStringAndSize(info->info.ptr, 1917 info->info.slen); 1503 obj->type_name = PyString_FromPJ(&info->type_name); 1504 obj->info = PyString_FromPJ(&info->info); 1918 1505 obj->flag = info->flag; 1919 obj->addr = PyString_FromStringAndSize(info->local_name.host.ptr, 1920 info->local_name.host.slen); 1506 obj->addr = PyString_FromPJ(&info->local_name.host); 1921 1507 obj->port = info->local_name.port; 1922 1508 obj->usage_count= info->usage_count; … … 1940 1526 { 1941 1527 self->type_name = PyString_FromString(""); 1942 if (self->type_name == NULL) {1943 Py_DECREF(self);1944 return NULL;1945 }1946 1528 self->info = PyString_FromString(""); 1947 if (self->info == NULL) {1948 Py_DECREF(self);1949 return NULL;1950 }1951 1529 self->addr = PyString_FromString(""); 1952 if (self->addr == NULL) {1953 Py_DECREF(self);1954 return NULL;1955 }1956 1530 } 1957 1531 … … 1972 1546 { 1973 1547 "type", T_INT, 1974 offsetof(PyObj_pjsua_transport_info, id), 0,1548 offsetof(PyObj_pjsua_transport_info, type), 0, 1975 1549 "Transport type." 1976 1550 }, … … 2072 1646 int publish_enabled; 2073 1647 PyObject *force_contact; 2074 /*pj_str_t proxy[8];*/2075 1648 PyListObject *proxy; 2076 1649 unsigned reg_timeout; 2077 /*pjsip_cred_info cred_info[8];*/2078 1650 PyListObject *cred_info; 2079 1651 int transport_id; 2080 2081 1652 int auth_initial_send; 2082 1653 PyObject *auth_initial_algorithm; … … 2116 1687 obj->priority = cfg->priority; 2117 1688 Py_XDECREF(obj->id); 2118 obj->id = PyString_From StringAndSize(cfg->id.ptr, cfg->id.slen);1689 obj->id = PyString_FromPJ(&cfg->id); 2119 1690 Py_XDECREF(obj->reg_uri); 2120 obj->reg_uri = PyString_FromStringAndSize(cfg->reg_uri.ptr, 2121 cfg->reg_uri.slen); 1691 obj->reg_uri = PyString_FromPJ(&cfg->reg_uri); 2122 1692 obj->publish_enabled = cfg->publish_enabled; 2123 1693 Py_XDECREF(obj->force_contact); 2124 obj->force_contact = PyString_FromStringAndSize(cfg->force_contact.ptr, 2125 cfg->force_contact.slen); 1694 obj->force_contact = PyString_FromPJ(&cfg->force_contact); 2126 1695 Py_XDECREF(obj->proxy); 2127 1696 obj->proxy = (PyListObject *)PyList_New(0); 2128 1697 for (i=0; i<cfg->proxy_cnt; ++i) { 2129 1698 PyObject * str; 2130 str = PyString_FromStringAndSize(cfg->proxy[i].ptr, 2131 cfg->proxy[i].slen); 1699 str = PyString_FromPJ(&cfg->proxy[i]); 2132 1700 PyList_Append((PyObject *)obj->proxy, str); 2133 1701 } … … 2150 1718 obj->auth_initial_send = cfg->auth_pref.initial_auth; 2151 1719 Py_XDECREF(obj->auth_initial_algorithm); 2152 obj->auth_initial_algorithm = PyString_FromStringAndSize(cfg->auth_pref.algorithm.ptr, 2153 cfg->auth_pref.algorithm.slen); 1720 obj->auth_initial_algorithm = PyString_FromPJ(&cfg->auth_pref.algorithm); 2154 1721 Py_XDECREF(obj->pidf_tuple_id); 2155 obj->pidf_tuple_id = PyString_FromStringAndSize(cfg->pidf_tuple_id.ptr, 2156 cfg->pidf_tuple_id.slen); 1722 obj->pidf_tuple_id = PyString_FromPJ(&cfg->pidf_tuple_id); 2157 1723 obj->require_100rel = cfg->require_100rel; 2158 1724 obj->allow_contact_rewrite = cfg->allow_contact_rewrite; 2159 1725 obj->ka_interval = cfg->ka_interval; 2160 1726 Py_XDECREF(obj->ka_data); 2161 obj->ka_data = PyString_From StringAndSize(cfg->ka_data.ptr, cfg->ka_data.slen);1727 obj->ka_data = PyString_FromPJ(&cfg->ka_data); 2162 1728 obj->use_srtp = cfg->use_srtp; 2163 1729 obj->srtp_secure_signaling = cfg->srtp_secure_signaling; … … 2170 1736 2171 1737 cfg->priority = obj->priority; 2172 cfg->id = PyString_ to_pj_str(obj->id);2173 cfg->reg_uri = PyString_ to_pj_str(obj->reg_uri);1738 cfg->id = PyString_ToPJ(obj->id); 1739 cfg->reg_uri = PyString_ToPJ(obj->reg_uri); 2174 1740 cfg->publish_enabled = obj->publish_enabled; 2175 cfg->force_contact = PyString_ to_pj_str(obj->force_contact);1741 cfg->force_contact = PyString_ToPJ(obj->force_contact); 2176 1742 2177 1743 cfg->proxy_cnt = PyList_Size((PyObject*)obj->proxy); 1744 if (cfg->proxy_cnt > PJ_ARRAY_SIZE(cfg->proxy)) 1745 cfg->proxy_cnt = PJ_ARRAY_SIZE(cfg->proxy); 2178 1746 for (i = 0; i < cfg->proxy_cnt; i++) { 2179 /*cfg.proxy[i] = ac->proxy[i];*/ 2180 cfg->proxy[i] = PyString_ to_pj_str(PyList_GetItem((PyObject *)obj->proxy,i));1747 PyObject *item = PyList_GetItem((PyObject *)obj->proxy, i); 1748 cfg->proxy[i] = PyString_ToPJ(item); 2181 1749 } 2182 1750 … … 2184 1752 2185 1753 cfg->cred_count = PyList_Size((PyObject*)obj->cred_info); 1754 if (cfg->cred_count > PJ_ARRAY_SIZE(cfg->cred_info)) 1755 cfg->cred_count = PJ_ARRAY_SIZE(cfg->cred_info); 2186 1756 for (i = 0; i < cfg->cred_count; i++) { 2187 /*cfg.cred_info[i] = ac->cred_info[i];*/2188 1757 PyObj_pjsip_cred_info *ci; 2189 1758 ci = (PyObj_pjsip_cred_info*) 2190 PyList_GetItem((PyObject *)obj->cred_info, i);1759 PyList_GetItem((PyObject *)obj->cred_info, i); 2191 1760 PyObj_pjsip_cred_info_export(&cfg->cred_info[i], ci); 2192 1761 } … … 2194 1763 cfg->transport_id = obj->transport_id; 2195 1764 cfg->auth_pref.initial_auth = obj->auth_initial_send; 2196 cfg->auth_pref.algorithm = PyString_ to_pj_str(obj->auth_initial_algorithm);2197 cfg->pidf_tuple_id = PyString_ to_pj_str(obj->pidf_tuple_id);1765 cfg->auth_pref.algorithm = PyString_ToPJ(obj->auth_initial_algorithm); 1766 cfg->pidf_tuple_id = PyString_ToPJ(obj->pidf_tuple_id); 2198 1767 cfg->require_100rel = obj->require_100rel; 2199 1768 cfg->allow_contact_rewrite = obj->allow_contact_rewrite; 2200 1769 cfg->ka_interval = obj->ka_interval; 2201 cfg->ka_data = PyString_ to_pj_str(obj->ka_data);1770 cfg->ka_data = PyString_ToPJ(obj->ka_data); 2202 1771 cfg->use_srtp = obj->use_srtp; 2203 1772 cfg->srtp_secure_signaling = obj->srtp_secure_signaling; … … 2221 1790 if (self != NULL) { 2222 1791 self->id = PyString_FromString(""); 2223 if (self->id == NULL) {2224 Py_DECREF(self);2225 return NULL;2226 }2227 1792 self->reg_uri = PyString_FromString(""); 2228 if (self->reg_uri == NULL) {2229 Py_DECREF(self);2230 return NULL;2231 }2232 1793 self->force_contact = PyString_FromString(""); 2233 if (self->force_contact == NULL) {2234 Py_DECREF(self);2235 return NULL;2236 }2237 1794 self->proxy = (PyListObject *)PyList_New(0); 2238 if (self->proxy == NULL) {2239 Py_DECREF(self);2240 return NULL;2241 }2242 1795 self->cred_info = (PyListObject *)PyList_New(0); 2243 if (self->cred_info == NULL) {2244 Py_DECREF(self);2245 return NULL;2246 }2247 1796 self->auth_initial_algorithm = PyString_FromString(""); 2248 1797 self->pidf_tuple_id = PyString_FromString(""); … … 2305 1854 }, 2306 1855 { 2307 "reg_timeout", T_INT, offsetof(PyObj_pjsua_acc_config, reg_timeout), 0, 1856 "reg_timeout", T_INT, 1857 offsetof(PyObj_pjsua_acc_config, reg_timeout), 0, 2308 1858 "Optional interval for registration, in seconds. " 2309 1859 "If the value is zero, default interval will be used " … … 2328 1878 " use, so in that case it can set this field." 2329 1879 }, 2330 2331 1880 { 2332 1881 "auth_initial_send", T_INT, … … 2388 1937 PyObject_HEAD_INIT(NULL) 2389 1938 0, /*ob_size*/ 2390 "_pjsua.Acc_Config", 2391 sizeof(PyObj_pjsua_acc_config), 1939 "_pjsua.Acc_Config", /*tp_name*/ 1940 sizeof(PyObj_pjsua_acc_config), /*tp_basicsize*/ 2392 1941 0, /*tp_itemsize*/ 2393 1942 (destructor)PyObj_pjsua_acc_config_delete,/*tp_dealloc*/ … … 2407 1956 0, /*tp_as_buffer*/ 2408 1957 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 2409 "Acc Config objects",/* tp_doc */1958 "Account settings", /* tp_doc */ 2410 1959 0, /* tp_traverse */ 2411 1960 0, /* tp_clear */ … … 2414 1963 0, /* tp_iter */ 2415 1964 0, /* tp_iternext */ 2416 0 /*acc_config_methods*/, /* tp_methods */2417 PyObj_pjsua_acc_config_members, 1965 0, /* tp_methods */ 1966 PyObj_pjsua_acc_config_members, /* tp_members */ 2418 1967 0, /* tp_getset */ 2419 1968 0, /* tp_base */ … … 2424 1973 0, /* tp_init */ 2425 1974 0, /* tp_alloc */ 2426 PyObj_pjsua_acc_config_new, 1975 PyObj_pjsua_acc_config_new, /* tp_new */ 2427 1976 2428 1977 }; … … 2468 2017 obj->id = info->id; 2469 2018 obj->is_default = info->is_default; 2470 obj->acc_uri = PyString_FromStringAndSize(info->acc_uri.ptr,2471 info->acc_uri.slen);2019 Py_XDECREF(obj->acc_uri); 2020 obj->acc_uri = PyString_FromPJ(&info->acc_uri); 2472 2021 obj->has_registration = info->has_registration; 2473 2022 obj->expires = info->expires; 2474 2023 obj->status = info->status; 2475 obj->status_text= PyString_FromStringAndSize(info->status_text.ptr,2476 info->status_text.slen);2024 Py_XDECREF(obj->status_text); 2025 obj->status_text= PyString_FromPJ(&info->status_text); 2477 2026 obj->online_status = info->online_status; 2478 obj->online_status_text = PyString_FromStringAndSize(info->online_status_text.ptr,2479 info->online_status_text.slen);2027 Py_XDECREF(obj->online_status_text); 2028 obj->online_status_text = PyString_FromPJ(&info->online_status_text); 2480 2029 } 2481 2030 … … 2497 2046 if (self != NULL) { 2498 2047 self->acc_uri = PyString_FromString(""); 2499 if (self->acc_uri == NULL) {2500 Py_DECREF(self);2501 return NULL;2502 }2503 2048 self->status_text = PyString_FromString(""); 2504 if (self->status_text == NULL) {2505 Py_DECREF(self);2506 return NULL;2507 }2508 2049 self->online_status_text = PyString_FromString(""); 2509 if (self->online_status_text == NULL) {2510 Py_DECREF(self);2511 return NULL;2512 }2513 2050 } 2514 2051 … … 2582 2119 PyObject_HEAD_INIT(NULL) 2583 2120 0, /*ob_size*/ 2584 "_pjsua.Acc_Info", 2585 sizeof(PyObj_pjsua_acc_info), /*tp_basicsize*/2121 "_pjsua.Acc_Info", /*tp_name*/ 2122 sizeof(PyObj_pjsua_acc_info), /*tp_basicsize*/ 2586 2123 0, /*tp_itemsize*/ 2587 2124 (destructor)PyObj_pjsua_acc_info_delete,/*tp_dealloc*/ … … 2601 2138 0, /*tp_as_buffer*/ 2602 2139 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 2603 "Acc Info objects",/* tp_doc */2140 "Account info", /* tp_doc */ 2604 2141 0, /* tp_traverse */ 2605 2142 0, /* tp_clear */ … … 2653 2190 { 2654 2191 Py_XDECREF(obj->uri); 2655 obj->uri = PyString_From StringAndSize(cfg->uri.ptr, cfg->uri.slen);2192 obj->uri = PyString_FromPJ(&cfg->uri); 2656 2193 obj->subscribe = cfg->subscribe; 2657 2194 } … … 2661 2198 PyObj_pjsua_buddy_config *obj) 2662 2199 { 2663 cfg->uri = PyString_ to_pj_str(obj->uri);2200 cfg->uri = PyString_ToPJ(obj->uri); 2664 2201 cfg->subscribe = obj->subscribe; 2665 } 2666 2202 cfg->user_data = NULL; 2203 } 2667 2204 2668 2205 … … 2683 2220 if (self != NULL) { 2684 2221 self->uri = PyString_FromString(""); 2685 if (self->uri == NULL) {2686 Py_DECREF(self);2687 return NULL;2688 }2689 2222 } 2690 2223 return (PyObject *)self; … … 2741 2274 0, /*tp_as_buffer*/ 2742 2275 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 2743 "Buddy Config objects",/* tp_doc */2276 "Buddy config", /* tp_doc */ 2744 2277 0, /* tp_traverse */ 2745 2278 0, /* tp_clear */ … … 2749 2282 0, /* tp_iternext */ 2750 2283 0, /* tp_methods */ 2751 PyObj_pjsua_buddy_config_members, 2284 PyObj_pjsua_buddy_config_members,/* tp_members */ 2752 2285 0, /* tp_getset */ 2753 2286 0, /* tp_base */ … … 2804 2337 obj->id = info->id; 2805 2338 Py_XDECREF(obj->uri); 2806 obj->uri = PyString_From StringAndSize(info->uri.ptr, info->uri.slen);2339 obj->uri = PyString_FromPJ(&info->uri); 2807 2340 Py_XDECREF(obj->contact); 2808 obj->contact = PyString_From StringAndSize(info->contact.ptr, info->contact.slen);2341 obj->contact = PyString_FromPJ(&info->contact); 2809 2342 obj->status = info->status; 2810 2343 Py_XDECREF(obj->status_text); 2811 obj->status_text = PyString_FromStringAndSize(info->status_text.ptr, 2812 info->status_text.slen); 2344 obj->status_text = PyString_FromPJ(&info->status_text); 2813 2345 obj->monitor_pres = info->monitor_pres; 2814 2346 obj->activity = info->rpid.activity; 2815 2347 obj->sub_state = info->sub_state; 2816 2348 Py_XDECREF(obj->sub_term_reason); 2817 obj->sub_term_reason = PyString_FromStringAndSize(info->sub_term_reason.ptr, 2818 info->sub_term_reason.slen); 2349 obj->sub_term_reason = PyString_FromPJ(&info->sub_term_reason); 2819 2350 } 2820 2351 … … 2837 2368 if (self != NULL) { 2838 2369 self->uri = PyString_FromString(""); 2839 if (self->uri == NULL) {2840 Py_DECREF(self);2841 return NULL;2842 }2843 2370 self->contact = PyString_FromString(""); 2844 if (self->contact == NULL) {2845 Py_DECREF(self);2846 return NULL;2847 }2848 2371 self->status_text = PyString_FromString(""); 2849 if (self->status_text == NULL) {2850 Py_DECREF(self);2851 return NULL;2852 }2853 2372 self->sub_term_reason = PyString_FromString(""); 2854 2373 } … … 2924 2443 PyObject_HEAD_INIT(NULL) 2925 2444 0, /*ob_size*/ 2926 "_pjsua.Buddy_Info", 2927 sizeof(PyObj_pjsua_buddy_info), 2445 "_pjsua.Buddy_Info", /*tp_name*/ 2446 sizeof(PyObj_pjsua_buddy_info), /*tp_basicsize*/ 2928 2447 0, /*tp_itemsize*/ 2929 2448 (destructor)PyObj_pjsua_buddy_info_delete,/*tp_dealloc*/ … … 2943 2462 0, /*tp_as_buffer*/ 2944 2463 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 2945 "Buddy Info object s",/* tp_doc */2464 "Buddy Info object", /* tp_doc */ 2946 2465 0, /* tp_traverse */ 2947 2466 0, /* tp_clear */ … … 2951 2470 0, /* tp_iternext */ 2952 2471 0, /* tp_methods */ 2953 PyObj_pjsua_buddy_info_members, 2472 PyObj_pjsua_buddy_info_members, /* tp_members */ 2954 2473 0, /* tp_getset */ 2955 2474 0, /* tp_base */ … … 2960 2479 0, /* tp_init */ 2961 2480 0, /* tp_alloc */ 2962 PyObj_pjsua_buddy_info_new, /* tp_new */ 2963 2964 }; 2965 2966 2967 2968 2481 PyObj_pjsua_buddy_info_new, /* tp_new */ 2482 2483 }; 2484 2485 2486 ////////////////////////////////////////////////////////////////////////////// 2487 2488 /* 2489 * PyObj_pjsua_codec_info 2490 * Codec Info 2491 */ 2492 typedef struct 2493 { 2494 PyObject_HEAD 2495 /* Type-specific fields go here. */ 2496 2497 PyObject * codec_id; 2498 pj_uint8_t priority; 2499 } PyObj_pjsua_codec_info; 2500 2501 2502 /* 2503 * codec_info_dealloc 2504 * deletes a codec_info from memory 2505 */ 2506 static void codec_info_dealloc(PyObj_pjsua_codec_info* self) 2507 { 2508 Py_XDECREF(self->codec_id); 2509 self->ob_type->tp_free((PyObject*)self); 2510 } 2511 2512 2513 /* 2514 * codec_info_new 2515 * constructor for codec_info object 2516 */ 2517 static PyObject * codec_info_new(PyTypeObject *type, PyObject *args, 2518 PyObject *kwds) 2519 { 2520 PyObj_pjsua_codec_info *self; 2521 2522 PJ_UNUSED_ARG(args); 2523 PJ_UNUSED_ARG(kwds); 2524 2525 self = (PyObj_pjsua_codec_info *)type->tp_alloc(type, 0); 2526 if (self != NULL) { 2527 self->codec_id = PyString_FromString(""); 2528 } 2529 return (PyObject *)self; 2530 } 2531 2532 /* 2533 * codec_info_members 2534 * !modified @ 071206 2535 */ 2536 static PyMemberDef codec_info_members[] = 2537 { 2538 { 2539 "codec_id", T_OBJECT_EX, 2540 offsetof(PyObj_pjsua_codec_info, codec_id), 0, 2541 "Codec unique identification." 2542 }, 2543 { 2544 "priority", T_INT, 2545 offsetof(PyObj_pjsua_codec_info, priority), 0, 2546 "Codec priority (integer 0-255)." 2547 }, 2548 2549 {NULL} /* Sentinel */ 2550 }; 2551 2552 /* 2553 * PyTyp_pjsua_codec_info 2554 */ 2555 static PyTypeObject PyTyp_pjsua_codec_info = 2556 { 2557 PyObject_HEAD_INIT(NULL) 2558 0, /*ob_size*/ 2559 "_pjsua.Codec_Info", /*tp_name*/ 2560 sizeof(PyObj_pjsua_codec_info), /*tp_basicsize*/ 2561 0, /*tp_itemsize*/ 2562 (destructor)codec_info_dealloc, /*tp_dealloc*/ 2563 0, /*tp_print*/ 2564 0, /*tp_getattr*/ 2565 0, /*tp_setattr*/ 2566 0, /*tp_compare*/ 2567 0, /*tp_repr*/ 2568 0, /*tp_as_number*/ 2569 0, /*tp_as_sequence*/ 2570 0, /*tp_as_mapping*/ 2571 0, /*tp_hash */ 2572 0, /*tp_call*/ 2573 0, /*tp_str*/ 2574 0, /*tp_getattro*/ 2575 0, /*tp_setattro*/ 2576 0, /*tp_as_buffer*/ 2577 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 2578 "Codec Info", /* tp_doc */ 2579 0, /* tp_traverse */ 2580 0, /* tp_clear */ 2581 0, /* tp_richcompare */ 2582 0, /* tp_weaklistoffset */ 2583 0, /* tp_iter */ 2584 0, /* tp_iternext */ 2585 0, /* tp_methods */ 2586 codec_info_members, /* tp_members */ 2587 0, /* tp_getset */ 2588 0, /* tp_base */ 2589 0, /* tp_dict */ 2590 0, /* tp_descr_get */ 2591 0, /* tp_descr_set */ 2592 0, /* tp_dictoffset */ 2593 0, /* tp_init */ 2594 0, /* tp_alloc */ 2595 codec_info_new, /* tp_new */ 2596 2597 }; 2598 2599 2600 ////////////////////////////////////////////////////////////////////////////// 2601 2602 /* 2603 * PyObj_pjsua_conf_port_info 2604 * Conf Port Info 2605 */ 2606 typedef struct 2607 { 2608 PyObject_HEAD 2609 /* Type-specific fields go here. */ 2610 2611 int slot_id; 2612 PyObject *name; 2613 unsigned clock_rate; 2614 unsigned channel_count; 2615 unsigned samples_per_frame; 2616 unsigned bits_per_sample; 2617 PyObject *listeners; 2618 2619 } PyObj_pjsua_conf_port_info; 2620 2621 2622 /* 2623 * conf_port_info_dealloc 2624 * deletes a conf_port_info from memory 2625 */ 2626 static void conf_port_info_dealloc(PyObj_pjsua_conf_port_info* self) 2627 { 2628 Py_XDECREF(self->name); 2629 Py_XDECREF(self->listeners); 2630 self->ob_type->tp_free((PyObject*)self); 2631 } 2632 2633 2634 /* 2635 * conf_port_info_new 2636 * constructor for conf_port_info object 2637 */ 2638 static PyObject * conf_port_info_new(PyTypeObject *type, PyObject *args, 2639 PyObject *kwds) 2640 { 2641 PyObj_pjsua_conf_port_info *self; 2642 2643 PJ_UNUSED_ARG(args); 2644 PJ_UNUSED_ARG(kwds); 2645 2646 self = (PyObj_pjsua_conf_port_info *)type->tp_alloc(type, 0); 2647 if (self != NULL) { 2648 self->name = PyString_FromString(""); 2649 self->listeners = PyList_New(0); 2650 } 2651 return (PyObject *)self; 2652 } 2653 2654 /* 2655 * conf_port_info_members 2656 */ 2657 static PyMemberDef conf_port_info_members[] = 2658 { 2659 { 2660 "slot_id", T_INT, 2661 offsetof(PyObj_pjsua_conf_port_info, slot_id), 0, 2662 "Conference port number." 2663 }, 2664 { 2665 "name", T_OBJECT_EX, 2666 offsetof(PyObj_pjsua_conf_port_info, name), 0, 2667 "Port name" 2668 }, 2669 { 2670 "clock_rate", T_INT, 2671 offsetof(PyObj_pjsua_conf_port_info, clock_rate), 0, 2672 "Clock rate" 2673 }, 2674 { 2675 "channel_count", T_INT, 2676 offsetof(PyObj_pjsua_conf_port_info, channel_count), 0, 2677 "Number of channels." 2678 }, 2679 { 2680 "samples_per_frame", T_INT, 2681 offsetof(PyObj_pjsua_conf_port_info, samples_per_frame), 0, 2682 "Samples per frame " 2683 }, 2684 { 2685 "bits_per_sample", T_INT, 2686 offsetof(PyObj_pjsua_conf_port_info, bits_per_sample), 0, 2687 "Bits per sample" 2688 }, 2689 { 2690 "listeners", T_OBJECT_EX, 2691 offsetof(PyObj_pjsua_conf_port_info, listeners), 0, 2692 "Array of listeners (in other words, ports where this port " 2693 "is transmitting to" 2694 }, 2695 2696 {NULL} /* Sentinel */ 2697 }; 2698 2699 2700 2701 2702 /* 2703 * PyTyp_pjsua_conf_port_info 2704 */ 2705 static PyTypeObject PyTyp_pjsua_conf_port_info = 2706 { 2707 PyObject_HEAD_INIT(NULL) 2708 0, /*ob_size*/ 2709 "_pjsua.Conf_Port_Info", /*tp_name*/ 2710 sizeof(PyObj_pjsua_conf_port_info), /*tp_basicsize*/ 2711 0, /*tp_itemsize*/ 2712 (destructor)conf_port_info_dealloc,/*tp_dealloc*/ 2713 0, /*tp_print*/ 2714 0, /*tp_getattr*/ 2715 0, /*tp_setattr*/ 2716 0, /*tp_compare*/ 2717 0, /*tp_repr*/ 2718 0, /*tp_as_number*/ 2719 0, /*tp_as_sequence*/ 2720 0, /*tp_as_mapping*/ 2721 0, /*tp_hash */ 2722 0, /*tp_call*/ 2723 0, /*tp_str*/ 2724 0, /*tp_getattro*/ 2725 0, /*tp_setattro*/ 2726 0, /*tp_as_buffer*/ 2727 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 2728 "Conf Port Info objects", /* tp_doc */ 2729 0, /* tp_traverse */ 2730 0, /* tp_clear */ 2731 0, /* tp_richcompare */ 2732 0, /* tp_weaklistoffset */ 2733 0, /* tp_iter */ 2734 0, /* tp_iternext */ 2735 0, /* tp_methods */ 2736 conf_port_info_members, /* tp_members */ 2737 0, /* tp_getset */ 2738 0, /* tp_base */ 2739 0, /* tp_dict */ 2740 0, /* tp_descr_get */ 2741 0, /* tp_descr_set */ 2742 0, /* tp_dictoffset */ 2743 0, /* tp_init */ 2744 0, /* tp_alloc */ 2745 conf_port_info_new, /* tp_new */ 2746 2747 }; 2748 2749 ////////////////////////////////////////////////////////////////////////////// 2750 2751 /* 2752 * PyObj_pjmedia_snd_dev_info 2753 * PJMedia Snd Dev Info 2754 */ 2755 typedef struct 2756 { 2757 PyObject_HEAD 2758 /* Type-specific fields go here. */ 2759 2760 unsigned input_count; 2761 unsigned output_count; 2762 unsigned default_samples_per_sec; 2763 PyObject *name; 2764 2765 } PyObj_pjmedia_snd_dev_info; 2766 2767 /* 2768 * pjmedia_snd_dev_info_dealloc 2769 * deletes a pjmedia_snd_dev_info from memory 2770 */ 2771 static void pjmedia_snd_dev_info_dealloc(PyObj_pjmedia_snd_dev_info* self) 2772 { 2773 Py_XDECREF(self->name); 2774 self->ob_type->tp_free((PyObject*)self); 2775 } 2776 2777 /* 2778 * pjmedia_snd_dev_info_new 2779 * constructor for pjmedia_snd_dev_info object 2780 */ 2781 static PyObject * pjmedia_snd_dev_info_new(PyTypeObject *type, 2782 PyObject *args, 2783 PyObject *kwds) 2784 { 2785 PyObj_pjmedia_snd_dev_info *self; 2786 2787 PJ_UNUSED_ARG(args); 2788 PJ_UNUSED_ARG(kwds); 2789 2790 self = (PyObj_pjmedia_snd_dev_info *)type->tp_alloc(type, 0); 2791 if (self != NULL) { 2792 self->name = PyString_FromString(""); 2793 } 2794 return (PyObject *)self; 2795 } 2796 2797 /* 2798 * pjmedia_snd_dev_info_members 2799 */ 2800 static PyMemberDef pjmedia_snd_dev_info_members[] = 2801 { 2802 { 2803 "input_count", T_INT, 2804 offsetof(PyObj_pjmedia_snd_dev_info, input_count), 0, 2805 "Max number of input channels" 2806 }, 2807 { 2808 "output_count", T_INT, 2809 offsetof(PyObj_pjmedia_snd_dev_info, output_count), 0, 2810 "Max number of output channels" 2811 }, 2812 { 2813 "default_samples_per_sec", T_INT, 2814 offsetof(PyObj_pjmedia_snd_dev_info, default_samples_per_sec), 0, 2815 "Default sampling rate." 2816 }, 2817 { 2818 "name", T_OBJECT_EX, 2819 offsetof(PyObj_pjmedia_snd_dev_info, name), 0, 2820 "Device name" 2821 }, 2822 2823 {NULL} /* Sentinel */ 2824 }; 2825 2826 2827 /* 2828 * PyTyp_pjmedia_snd_dev_info 2829 */ 2830 static PyTypeObject PyTyp_pjmedia_snd_dev_info = 2831 { 2832 PyObject_HEAD_INIT(NULL) 2833 0, /*ob_size*/ 2834 "_pjsua.PJMedia_Snd_Dev_Info", /*tp_name*/ 2835 sizeof(PyObj_pjmedia_snd_dev_info), /*tp_basicsize*/ 2836 0, /*tp_itemsize*/ 2837 (destructor)pjmedia_snd_dev_info_dealloc,/*tp_dealloc*/ 2838 0, /*tp_print*/ 2839 0, /*tp_getattr*/ 2840 0, /*tp_setattr*/ 2841 0, /*tp_compare*/ 2842 0, /*tp_repr*/ 2843 0, /*tp_as_number*/ 2844 0, /*tp_as_sequence*/ 2845 0, /*tp_as_mapping*/ 2846 0, /*tp_hash */ 2847 0, /*tp_call*/ 2848 0, /*tp_str*/ 2849 0, /*tp_getattro*/ 2850 0, /*tp_setattro*/ 2851 0, /*tp_as_buffer*/ 2852 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 2853 "PJMedia Snd Dev Info object", /* tp_doc */ 2854 0, /* tp_traverse */ 2855 0, /* tp_clear */ 2856 0, /* tp_richcompare */ 2857 0, /* tp_weaklistoffset */ 2858 0, /* tp_iter */ 2859 0, /* tp_iternext */ 2860 0, /* tp_methods */ 2861 pjmedia_snd_dev_info_members, /* tp_members */ 2862 0, /* tp_getset */ 2863 0, /* tp_base */ 2864 0, /* tp_dict */ 2865 0, /* tp_descr_get */ 2866 0, /* tp_descr_set */ 2867 0, /* tp_dictoffset */ 2868 0, /* tp_init */ 2869 0, /* tp_alloc */ 2870 pjmedia_snd_dev_info_new, /* tp_new */ 2871 2872 }; 2873 2874 ////////////////////////////////////////////////////////////////////////////// 2875 2876 /* 2877 * PyObj_pjmedia_codec_param_info 2878 * PJMedia Codec Param Info 2879 */ 2880 typedef struct 2881 { 2882 PyObject_HEAD 2883 /* Type-specific fields go here. */ 2884 2885 unsigned clock_rate; 2886 unsigned channel_cnt; 2887 pj_uint32_t avg_bps; 2888 pj_uint16_t frm_ptime; 2889 pj_uint8_t pcm_bits_per_sample; 2890 pj_uint8_t pt; 2891 2892 } PyObj_pjmedia_codec_param_info; 2893 2894 2895 2896 /* 2897 * pjmedia_codec_param_info_members 2898 */ 2899 static PyMemberDef pjmedia_codec_param_info_members[] = 2900 { 2901 { 2902 "clock_rate", T_INT, 2903 offsetof(PyObj_pjmedia_codec_param_info, clock_rate), 0, 2904 "Sampling rate in Hz" 2905 }, 2906 { 2907 "channel_cnt", T_INT, 2908 offsetof(PyObj_pjmedia_codec_param_info, channel_cnt), 0, 2909 "Channel count" 2910 }, 2911 { 2912 "avg_bps", T_INT, 2913 offsetof(PyObj_pjmedia_codec_param_info, avg_bps), 0, 2914 "Average bandwidth in bits/sec" 2915 }, 2916 { 2917 "frm_ptime", T_INT, 2918 offsetof(PyObj_pjmedia_codec_param_info, frm_ptime), 0, 2919 "Base frame ptime in msec." 2920 }, 2921 { 2922 "pcm_bits_per_sample", T_INT, 2923 offsetof(PyObj_pjmedia_codec_param_info, pcm_bits_per_sample), 0, 2924 "Bits/sample in the PCM side" 2925 }, 2926 { 2927 "pt", T_INT, 2928 offsetof(PyObj_pjmedia_codec_param_info, pt), 0, 2929 "Payload type" 2930 }, 2931 2932 {NULL} /* Sentinel */ 2933 }; 2934 2935 2936 /* 2937 * PyTyp_pjmedia_codec_param_info 2938 */ 2939 static PyTypeObject PyTyp_pjmedia_codec_param_info = 2940 { 2941 PyObject_HEAD_INIT(NULL) 2942 0, /*ob_size*/ 2943 "_pjsua.PJMedia_Codec_Param_Info", /*tp_name*/ 2944 sizeof(PyObj_pjmedia_codec_param_info), /*tp_basicsize*/ 2945 0, /*tp_itemsize*/ 2946 0, /*tp_dealloc*/ 2947 0, /*tp_print*/ 2948 0, /*tp_getattr*/ 2949 0, /*tp_setattr*/ 2950 0, /*tp_compare*/ 2951 0, /*tp_repr*/ 2952 0, /*tp_as_number*/ 2953 0, /*tp_as_sequence*/ 2954 0, /*tp_as_mapping*/ 2955 0, /*tp_hash */ 2956 0, /*tp_call*/ 2957 0, /*tp_str*/ 2958 0, /*tp_getattro*/ 2959 0, /*tp_setattro*/ 2960 0, /*tp_as_buffer*/ 2961 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 2962 "PJMedia Codec Param Info objects",/* tp_doc */ 2963 0, /* tp_traverse */ 2964 0, /* tp_clear */ 2965 0, /* tp_richcompare */ 2966 0, /* tp_weaklistoffset */ 2967 0, /* tp_iter */ 2968 0, /* tp_iternext */ 2969 0, /* tp_methods */ 2970 pjmedia_codec_param_info_members,/* tp_members */ 2971 }; 2972 2973 2974 ////////////////////////////////////////////////////////////////////////////// 2975 2976 /* 2977 * PyObj_pjmedia_codec_param_setting 2978 * PJMedia Codec Param Setting 2979 */ 2980 typedef struct 2981 { 2982 PyObject_HEAD 2983 /* Type-specific fields go here. */ 2984 pj_uint8_t frm_per_pkt; 2985 unsigned vad; 2986 unsigned cng; 2987 unsigned penh; 2988 unsigned plc; 2989 pj_uint8_t enc_fmtp_mode; 2990 pj_uint8_t dec_fmtp_mode; 2991 2992 } PyObj_pjmedia_codec_param_setting; 2993 2994 2995 2996 /* 2997 * pjmedia_codec_param_setting_members 2998 */ 2999 static PyMemberDef pjmedia_codec_param_setting_members[] = 3000 { 3001 { 3002 "frm_per_pkt", T_INT, 3003 offsetof(PyObj_pjmedia_codec_param_setting, frm_per_pkt), 0, 3004 "Number of frames per packet" 3005 }, 3006 { 3007 "vad", T_INT, 3008 offsetof(PyObj_pjmedia_codec_param_setting, vad), 0, 3009 "Voice Activity Detector" 3010 }, 3011 { 3012 "cng", T_INT, 3013 offsetof(PyObj_pjmedia_codec_param_setting, cng), 0, 3014 "Comfort Noise Generator" 3015 }, 3016 { 3017 "penh", T_INT, 3018 offsetof(PyObj_pjmedia_codec_param_setting, penh), 0, 3019 "Perceptual Enhancement" 3020 }, 3021 { 3022 "plc", T_INT, 3023 offsetof(PyObj_pjmedia_codec_param_setting, plc), 0, 3024 "Packet loss concealment" 3025 }, 3026 { 3027 "enc_fmtp_mode", T_INT, 3028 offsetof(PyObj_pjmedia_codec_param_setting, enc_fmtp_mode), 0, 3029 "Mode param in fmtp (def:0)" 3030 }, 3031 { 3032 "dec_fmtp_mode", T_INT, 3033 offsetof(PyObj_pjmedia_codec_param_setting, dec_fmtp_mode), 0, 3034 "Mode param in fmtp (def:0)" 3035 }, 3036 3037 {NULL} /* Sentinel */ 3038 }; 3039 3040 3041 /* 3042 * PyTyp_pjmedia_codec_param_setting 3043 */ 3044 static PyTypeObject PyTyp_pjmedia_codec_param_setting = 3045 { 3046 PyObject_HEAD_INIT(NULL) 3047 0, /*ob_size*/ 3048 "_pjsua.PJMedia_Codec_Param_Setting",/*tp_name*/ 3049 sizeof(PyObj_pjmedia_codec_param_setting), /*tp_basicsize*/ 3050 0, /*tp_itemsize*/ 3051 0, /*tp_dealloc*/ 3052 0, /*tp_print*/ 3053 0, /*tp_getattr*/ 3054 0, /*tp_setattr*/ 3055 0, /*tp_compare*/ 3056 0, /*tp_repr*/ 3057 0, /*tp_as_number*/ 3058 0, /*tp_as_sequence*/ 3059 0, /*tp_as_mapping*/ 3060 0, /*tp_hash */ 3061 0, /*tp_call*/ 3062 0, /*tp_str*/ 3063 0, /*tp_getattro*/ 3064 0, /*tp_setattro*/ 3065 0, /*tp_as_buffer*/ 3066 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 3067 "PJMedia Codec Param Setting", /* tp_doc */ 3068 0, /* tp_traverse */ 3069 0, /* tp_clear */ 3070 0, /* tp_richcompare */ 3071 0, /* tp_weaklistoffset */ 3072 0, /* tp_iter */ 3073 0, /* tp_iternext */ 3074 0, /* tp_methods */ 3075 pjmedia_codec_param_setting_members,/* tp_members */ 3076 }; 3077 3078 ////////////////////////////////////////////////////////////////////////////// 3079 3080 3081 /* 3082 * PyObj_pjmedia_codec_param 3083 * PJMedia Codec Param 3084 */ 3085 typedef struct 3086 { 3087 PyObject_HEAD 3088 /* Type-specific fields go here. */ 3089 3090 PyObj_pjmedia_codec_param_info * info; 3091 PyObj_pjmedia_codec_param_setting * setting; 3092 3093 } PyObj_pjmedia_codec_param; 3094 3095 /* 3096 * pjmedia_codec_param_dealloc 3097 * deletes a pjmedia_codec_param from memory 3098 */ 3099 static void pjmedia_codec_param_dealloc(PyObj_pjmedia_codec_param* self) 3100 { 3101 Py_XDECREF(self->info); 3102 Py_XDECREF(self->setting); 3103 self->ob_type->tp_free((PyObject*)self); 3104 } 3105 3106 /* 3107 * pjmedia_codec_param_new 3108 * constructor for pjmedia_codec_param object 3109 */ 3110 static PyObject * pjmedia_codec_param_new(PyTypeObject *type, 3111 PyObject *args, 3112 PyObject *kwds) 3113 { 3114 PyObj_pjmedia_codec_param *self; 3115 3116 PJ_UNUSED_ARG(args); 3117 PJ_UNUSED_ARG(kwds); 3118 3119 self = (PyObj_pjmedia_codec_param *)type->tp_alloc(type, 0); 3120 if (self != NULL) { 3121 self->info = (PyObj_pjmedia_codec_param_info *) 3122 PyType_GenericNew(&PyTyp_pjmedia_codec_param_info, 3123 NULL, NULL); 3124 self->setting = (PyObj_pjmedia_codec_param_setting *) 3125 PyType_GenericNew(&PyTyp_pjmedia_codec_param_setting, 3126 NULL, NULL); 3127 } 3128 return (PyObject *)self; 3129 } 3130 3131 /* 3132 * pjmedia_codec_param_members 3133 */ 3134 static PyMemberDef pjmedia_codec_param_members[] = 3135 { 3136 3137 { 3138 "info", T_OBJECT_EX, 3139 offsetof(PyObj_pjmedia_codec_param, info), 0, 3140 "The 'info' part of codec param describes the capability of the codec," 3141 " and the value should NOT be changed by application." 3142 }, 3143 { 3144 "setting", T_OBJECT_EX, 3145 offsetof(PyObj_pjmedia_codec_param, setting), 0, 3146 "The 'setting' part of codec param describes various settings to be " 3147 "applied to the codec. When the codec param is retrieved from the " 3148 "codec or codec factory, the values of these will be filled by " 3149 "the capability of the codec. Any features that are supported by " 3150 "the codec (e.g. vad or plc) will be turned on, so that application " 3151 "can query which capabilities are supported by the codec. " 3152 "Application may change the settings here before instantiating " 3153 "the codec/stream." 3154 }, 3155 3156 {NULL} /* Sentinel */ 3157 }; 3158 3159 /* 3160 * PyTyp_pjmedia_codec_param 3161 */ 3162 static PyTypeObject PyTyp_pjmedia_codec_param = 3163 { 3164 PyObject_HEAD_INIT(NULL) 3165 0, /*ob_size*/ 3166 "_pjsua.PJMedia_Codec_Param", /*tp_name*/ 3167 sizeof(PyObj_pjmedia_codec_param),/*tp_basicsize*/ 3168 0, /*tp_itemsize*/ 3169 (destructor)pjmedia_codec_param_dealloc,/*tp_dealloc*/ 3170 0, /*tp_print*/ 3171 0, /*tp_getattr*/ 3172 0, /*tp_setattr*/ 3173 0, /*tp_compare*/ 3174 0, /*tp_repr*/ 3175 0, /*tp_as_number*/ 3176 0, /*tp_as_sequence*/ 3177 0, /*tp_as_mapping*/ 3178 0, /*tp_hash */ 3179 0, /*tp_call*/ 3180 0, /*tp_str*/ 3181 0, /*tp_getattro*/ 3182 0, /*tp_setattro*/ 3183 0, /*tp_as_buffer*/ 3184 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 3185 "PJMedia Codec Param", /* tp_doc */ 3186 0, /* tp_traverse */ 3187 0, /* tp_clear */ 3188 0, /* tp_richcompare */ 3189 0, /* tp_weaklistoffset */ 3190 0, /* tp_iter */ 3191 0, /* tp_iternext */ 3192 0, /* tp_methods */ 3193 pjmedia_codec_param_members, /* tp_members */ 3194 0, /* tp_getset */ 3195 0, /* tp_base */ 3196 0, /* tp_dict */ 3197 0, /* tp_descr_get */ 3198 0, /* tp_descr_set */ 3199 0, /* tp_dictoffset */ 3200 0, /* tp_init */ 3201 0, /* tp_alloc */ 3202 pjmedia_codec_param_new, /* tp_new */ 3203 3204 }; 3205 3206 ////////////////////////////////////////////////////////////////////////////// 3207 3208 /* 3209 * PyObj_pjsua_call_info 3210 * Call Info 3211 */ 3212 typedef struct 3213 { 3214 PyObject_HEAD 3215 /* Type-specific fields go here. */ 3216 3217 int id; 3218 int role; 3219 int acc_id; 3220 PyObject *local_info; 3221 PyObject *local_contact; 3222 PyObject *remote_info; 3223 PyObject *remote_contact; 3224 PyObject *call_id; 3225 int state; 3226 PyObject *state_text; 3227 int last_status; 3228 PyObject *last_status_text; 3229 int media_status; 3230 int media_dir; 3231 int conf_slot; 3232 int connect_duration; 3233 int total_duration; 3234 3235 } PyObj_pjsua_call_info; 3236 3237 3238 /* 3239 * call_info_dealloc 3240 * deletes a call_info from memory 3241 */ 3242 static void call_info_dealloc(PyObj_pjsua_call_info* self) 3243 { 3244 Py_XDECREF(self->local_info); 3245 Py_XDECREF(self->local_contact); 3246 Py_XDECREF(self->remote_info); 3247 Py_XDECREF(self->remote_contact); 3248 Py_XDECREF(self->call_id); 3249 Py_XDECREF(self->state_text); 3250 Py_XDECREF(self->last_status_text); 3251 self->ob_type->tp_free((PyObject*)self); 3252 } 3253 3254 3255 /* 3256 * call_info_new 3257 * constructor for call_info object 3258 */ 3259 static PyObject * call_info_new(PyTypeObject *type, PyObject *args, 3260 PyObject *kwds) 3261 { 3262 PyObj_pjsua_call_info *self; 3263 3264 PJ_UNUSED_ARG(args); 3265 PJ_UNUSED_ARG(kwds); 3266 3267 self = (PyObj_pjsua_call_info *)type->tp_alloc(type, 0); 3268 if (self != NULL) { 3269 self->local_info = PyString_FromString(""); 3270 self->local_contact = PyString_FromString(""); 3271 self->remote_info = PyString_FromString(""); 3272 self->remote_contact = PyString_FromString(""); 3273 self->call_id = PyString_FromString(""); 3274 self->state_text = PyString_FromString(""); 3275 self->last_status_text = PyString_FromString(""); 3276 } 3277 return (PyObject *)self; 3278 } 3279 3280 /* 3281 * call_info_members 3282 */ 3283 static PyMemberDef call_info_members[] = 3284 { 3285 { 3286 "id", T_INT, 3287 offsetof(PyObj_pjsua_call_info, id), 0, 3288 "Call identification" 3289 }, 3290 { 3291 "role", T_INT, 3292 offsetof(PyObj_pjsua_call_info, role), 0, 3293 "Initial call role (UAC == caller)" 3294 }, 3295 { 3296 "acc_id", T_INT, 3297 offsetof(PyObj_pjsua_call_info, acc_id), 0, 3298 "The account ID where this call belongs." 3299 }, 3300 { 3301 "local_info", T_OBJECT_EX, 3302 offsetof(PyObj_pjsua_call_info, local_info), 0, 3303 "Local URI" 3304 }, 3305 { 3306 "local_contact", T_OBJECT_EX, 3307 offsetof(PyObj_pjsua_call_info, local_contact), 0, 3308 "Local Contact" 3309 }, 3310 { 3311 "remote_info", T_OBJECT_EX, 3312 offsetof(PyObj_pjsua_call_info, remote_info), 0, 3313 "Remote URI" 3314 }, 3315 { 3316 "remote_contact", T_OBJECT_EX, 3317 offsetof(PyObj_pjsua_call_info, remote_contact), 0, 3318 "Remote Contact" 3319 }, 3320 { 3321 "call_id", T_OBJECT_EX, 3322 offsetof(PyObj_pjsua_call_info, call_id), 0, 3323 "Dialog Call-ID string" 3324 }, 3325 { 3326 "state", T_INT, 3327 offsetof(PyObj_pjsua_call_info, state), 0, 3328 "Call state" 3329 }, 3330 { 3331 "state_text", T_OBJECT_EX, 3332 offsetof(PyObj_pjsua_call_info, state_text), 0, 3333 "Text describing the state " 3334 }, 3335 { 3336 "last_status", T_INT, 3337 offsetof(PyObj_pjsua_call_info, last_status), 0, 3338 "Last status code heard, which can be used as cause code" 3339 }, 3340 { 3341 "last_status_text", T_OBJECT_EX, 3342 offsetof(PyObj_pjsua_call_info, last_status_text), 0, 3343 "The reason phrase describing the status." 3344 }, 3345 { 3346 "media_status", T_INT, 3347 offsetof(PyObj_pjsua_call_info, media_status), 0, 3348 "Call media status." 3349 }, 3350 { 3351 "media_dir", T_INT, 3352 offsetof(PyObj_pjsua_call_info, media_dir), 0, 3353 "Media direction" 3354 }, 3355 { 3356 "conf_slot", T_INT, 3357 offsetof(PyObj_pjsua_call_info, conf_slot), 0, 3358 "The conference port number for the call" 3359 }, 3360 { 3361 "connect_duration", T_INT, 3362 offsetof(PyObj_pjsua_call_info, connect_duration), 0, 3363 "Up-to-date call connected duration(zero when call is not established)" 3364 }, 3365 { 3366 "total_duration", T_INT, 3367 offsetof(PyObj_pjsua_call_info, total_duration), 0, 3368 "Total call duration, including set-up time" 3369 }, 3370 3371 {NULL} /* Sentinel */ 3372 }; 3373 3374 3375 3376 3377 /* 3378 * PyTyp_pjsua_call_info 3379 */ 3380 static PyTypeObject PyTyp_pjsua_call_info = 3381 { 3382 PyObject_HEAD_INIT(NULL) 3383 0, /*ob_size*/ 3384 "_pjsua.Call_Info", /*tp_name*/ 3385 sizeof(PyObj_pjsua_call_info), /*tp_basicsize*/ 3386 0, /*tp_itemsize*/ 3387 (destructor)call_info_dealloc, /*tp_dealloc*/ 3388 0, /*tp_print*/ 3389 0, /*tp_getattr*/ 3390 0, /*tp_setattr*/ 3391 0, /*tp_compare*/ 3392 0, /*tp_repr*/ 3393 0, /*tp_as_number*/ 3394 0, /*tp_as_sequence*/ 3395 0, /*tp_as_mapping*/ 3396 0, /*tp_hash */ 3397 0, /*tp_call*/ 3398 0, /*tp_str*/ 3399 0, /*tp_getattro*/ 3400 0, /*tp_setattro*/ 3401 0, /*tp_as_buffer*/ 3402 Py_TPFLAGS_DEFAULT, /*tp_flags*/ 3403 "Call Info", /* tp_doc */ 3404 0, /* tp_traverse */ 3405 0, /* tp_clear */ 3406 0, /* tp_richcompare */ 3407 0, /* tp_weaklistoffset */ 3408 0, /* tp_iter */ 3409 0, /* tp_iternext */ 3410 0, /* tp_methods */ 3411 call_info_members, /* tp_members */ 3412 0, /* tp_getset */ 3413 0, /* tp_base */ 3414 0, /* tp_dict */ 3415 0, /* tp_descr_get */ 3416 0, /* tp_descr_set */ 3417 0, /* tp_dictoffset */ 3418 0, /* tp_init */ 3419 0, /* tp_alloc */ 3420 call_info_new, /* tp_new */ 3421 3422 }; 3423 3424 3425 3426 ////////////////////////////////////////////////////////////////////////////// 2969 3427 2970 3428 #endif /* __PY_PJSUA_H__ */
Note: See TracChangeset
for help on using the changeset viewer.