Changeset 4581 for pjproject/trunk
- Timestamp:
- Aug 9, 2013 8:39:20 AM (11 years ago)
- Location:
- pjproject/trunk/pjsip-apps/src/python
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/python/_pjsua.h
r3553 r4581 1328 1328 PyObject *public_addr; 1329 1329 PyObject *bound_addr; 1330 pj_qos_type qos_type; 1331 pj_uint8_t qos_params_flags; 1332 pj_uint8_t qos_params_dscp_val; 1333 pj_uint8_t qos_params_so_prio; 1334 pj_qos_wmm_prio qos_params_wmm_prio; 1335 1330 1336 } PyObj_pjsua_transport_config; 1331 1337 … … 1338 1344 { 1339 1345 Py_XDECREF(self->public_addr); 1340 Py_XDECREF(self->bound_addr); 1346 Py_XDECREF(self->bound_addr); 1341 1347 self->ob_type->tp_free((PyObject*)self); 1342 1348 } … … 1350 1356 cfg->bound_addr = PyString_ToPJ(obj->bound_addr); 1351 1357 cfg->port = obj->port; 1352 1358 cfg->qos_type = obj->qos_type; 1359 cfg->qos_params.flags = obj->qos_params_flags; 1360 cfg->qos_params.dscp_val = obj->qos_params_dscp_val; 1361 cfg->qos_params.so_prio = obj->qos_params_so_prio; 1362 cfg->qos_params.wmm_prio = obj->qos_params_wmm_prio; 1353 1363 } 1354 1364 … … 1362 1372 obj->bound_addr = PyString_FromPJ(&cfg->bound_addr); 1363 1373 1364 obj->port = cfg->port; 1374 obj->port = cfg->port; 1375 obj->qos_type = cfg->qos_type; 1376 obj->qos_params_flags = cfg->qos_params.flags; 1377 obj->qos_params_dscp_val = cfg->qos_params.dscp_val; 1378 obj->qos_params_so_prio = cfg->qos_params.so_prio; 1379 obj->qos_params_wmm_prio = cfg->qos_params.wmm_prio; 1380 1365 1381 } 1366 1382 … … 1382 1398 if (self != NULL) { 1383 1399 self->public_addr = PyString_FromString(""); 1384 1400 self->bound_addr = PyString_FromString(""); 1385 1401 } 1386 1402 … … 1420 1436 "used for that purpose)." 1421 1437 }, 1438 { 1439 "qos_type", T_INT, 1440 offsetof(PyObj_pjsua_transport_config, qos_type), 0, 1441 "High level traffic classification." 1442 "Enumerator:" 1443 " 0: PJ_QOS_TYPE_BEST_EFFORT" 1444 " Best effort traffic (default value). Any QoS function calls with " 1445 " specifying this value are effectively no-op" 1446 " 1: PJ_QOS_TYPE_BACKGROUND" 1447 " Background traffic." 1448 " 2: PJ_QOS_TYPE_VIDEO" 1449 " Video traffic." 1450 " 3: PJ_QOS_TYPE_VOICE" 1451 " Voice traffic." 1452 " 4: PJ_QOS_TYPE_CONTROL" 1453 " Control traffic." 1454 }, 1455 { 1456 "qos_params_flags", T_INT, 1457 offsetof(PyObj_pjsua_transport_config, qos_params_flags), 0, 1458 "Determines which values to set, bitmask of pj_qos_flag." 1459 " PJ_QOS_PARAM_HAS_DSCP = 1" 1460 " PJ_QOS_PARAM_HAS_SO_PRIO = 2" 1461 " PJ_QOS_PARAM_HAS_WMM = 4" 1462 }, 1463 { 1464 "qos_params_dscp_val", T_INT, 1465 offsetof(PyObj_pjsua_transport_config, qos_params_dscp_val), 0, 1466 "The 6 bits DSCP value to set." 1467 "Example: 46=EF, 26=AF31, 24=CS3..." 1468 }, 1469 { 1470 "qos_params_so_prio", T_INT, 1471 offsetof(PyObj_pjsua_transport_config, qos_params_so_prio), 0, 1472 "Socket SO_PRIORITY value." 1473 }, 1474 { 1475 "qos_params_wmm_prio", T_INT, 1476 offsetof(PyObj_pjsua_transport_config, qos_params_wmm_prio), 0, 1477 "Standard WMM priorities." 1478 "Enumerator:" 1479 " 0: PJ_QOS_WMM_PRIO_BULK_EFFORT" 1480 " Bulk effort priority" 1481 " 1: PJ_QOS_WMM_PRIO_BULK" 1482 " Bulk priority." 1483 " 2: PJ_QOS_WMM_PRIO_VIDEO" 1484 " Video priority" 1485 " 3: PJ_QOS_WMM_PRIO_VOICE" 1486 " Voice priority." 1487 }, 1422 1488 {NULL} /* Sentinel */ 1423 1489 }; … … 1676 1742 unsigned use_srtp; 1677 1743 unsigned srtp_secure_signaling; 1744 PyObject *rtp_transport_cfg; 1678 1745 } PyObj_pjsua_acc_config; 1679 1746 … … 1695 1762 Py_XDECREF(self->contact_uri_params); 1696 1763 Py_XDECREF(self->ka_data); 1764 Py_XDECREF(self->rtp_transport_cfg); 1697 1765 self->ob_type->tp_free((PyObject*)self); 1698 1766 } … … 1728 1796 for (i=0; i<cfg->cred_count; ++i) { 1729 1797 PyObj_pjsip_cred_info * ci; 1730 1798 1731 1799 ci = (PyObj_pjsip_cred_info *) 1732 1800 PyObj_pjsip_cred_info_new(&PyTyp_pjsip_cred_info,NULL,NULL); … … 1756 1824 obj->use_srtp = cfg->use_srtp; 1757 1825 obj->srtp_secure_signaling = cfg->srtp_secure_signaling; 1826 1827 Py_XDECREF(obj->rtp_transport_cfg); 1828 PyObj_pjsua_transport_config *tconf; 1829 tconf = (PyObj_pjsua_transport_config*) PyObj_pjsua_transport_config_new(&PyTyp_pjsua_transport_config,NULL, NULL); 1830 PyObj_pjsua_transport_config_import(tconf, &cfg->rtp_cfg); 1831 obj->rtp_transport_cfg = (PyObject *) tconf; 1758 1832 } 1759 1833 … … 1785 1859 cfg->cred_count = PJ_ARRAY_SIZE(cfg->cred_info); 1786 1860 for (i = 0; i < cfg->cred_count; i++) { 1787 1788 ci = (PyObj_pjsip_cred_info*) 1861 PyObj_pjsip_cred_info *ci; 1862 ci = (PyObj_pjsip_cred_info*) 1789 1863 PyList_GetItem((PyObject *)obj->cred_info, i); 1790 1864 PyObj_pjsip_cred_info_export(&cfg->cred_info[i], ci); … … 1806 1880 cfg->use_srtp = obj->use_srtp; 1807 1881 cfg->srtp_secure_signaling = obj->srtp_secure_signaling; 1882 1883 PyObj_pjsua_transport_config *tconf; 1884 tconf = (PyObj_pjsua_transport_config*) obj->rtp_transport_cfg; 1885 PyObj_pjsua_transport_config_export(&cfg->rtp_cfg, tconf); 1808 1886 } 1809 1887 … … 1997 2075 offsetof(PyObj_pjsua_acc_config, srtp_secure_signaling), 0, 1998 2076 "Specify if SRTP requires secure signaling to be used." 2077 }, 2078 { 2079 "rtp_transport_cfg", T_OBJECT_EX, 2080 offsetof(PyObj_pjsua_acc_config, rtp_transport_cfg), 0, 2081 "Transport configuration for RTP." 1999 2082 }, 2000 2083 -
pjproject/trunk/pjsip-apps/src/python/pjsua.py
r2976 r4581 475 475 the public address from STUN or from the selected 476 476 local interface. Format is "host:port". 477 qos_type -- High level traffic classification. 478 Enumerator: 479 0: PJ_QOS_TYPE_BEST_EFFORT 480 Best effort traffic (default value). Any QoS function calls with 481 specifying this value are effectively no-op 482 1: PJ_QOS_TYPE_BACKGROUND 483 Background traffic. 484 2: PJ_QOS_TYPE_VIDEO 485 Video traffic. 486 3: PJ_QOS_TYPE_VOICE 487 Voice traffic. 488 4: PJ_QOS_TYPE_CONTROL 489 Control traffic. 490 qos_params_flags -- Determines which values to set, bitmask of pj_qos_flag. 491 PJ_QOS_PARAM_HAS_DSCP = 1 492 PJ_QOS_PARAM_HAS_SO_PRIO = 2 493 PJ_QOS_PARAM_HAS_WMM = 4 494 qos_params_dscp_val -- The 6 bits DSCP value to set. 495 qos_params_so_prio -- Socket SO_PRIORITY value. 496 qos_params_wmm_prio -- Standard WMM priorities. 497 Enumerator: 498 0: PJ_QOS_WMM_PRIO_BULK_EFFORT: Bulk effort priority 499 1: PJ_QOS_WMM_PRIO_BULK: Bulk priority. 500 2: PJ_QOS_WMM_PRIO_VIDEO: Video priority 501 3: PJ_QOS_WMM_PRIO_VOICE: Voice priority. 477 502 """ 478 503 port = 0 479 504 bound_addr = "" 480 505 public_addr = "" 506 507 qos_type = 0 508 qos_params_flags = 0 509 qos_params_dscp_val = 0 510 qos_params_so_prio = 0 511 qos_params_wmm_prio = 0 512 513 481 514 482 515 def __init__(self, port=0, … … 486 519 self.public_addr = public_addr 487 520 521 def _cvt_from_pjsua(self, cfg): 522 self.port = cfg.port 523 self.bound_addr = cfg.bound_addr 524 self.public_addr = cfg.public_addr 525 self.qos_type = cfg.qos_type 526 self.qos_params_flags = cfg.qos_params_flags 527 self.qos_params_dscp_val = cfg.qos_params_dscp_val 528 self.qos_params_so_prio = cfg.qos_params_so_prio 529 self.qos_params_wmm_prio = cfg.qos_params_wmm_prio 530 488 531 def _cvt_to_pjsua(self): 489 532 cfg = _pjsua.transport_config_default() … … 491 534 cfg.bound_addr = self.bound_addr 492 535 cfg.public_addr = self.public_addr 536 cfg.qos_type = self.qos_type 537 cfg.qos_params_flags = self.qos_params_flags 538 cfg.qos_params_dscp_val = self.qos_params_dscp_val 539 cfg.qos_params_so_prio = self.qos_params_so_prio 540 cfg.qos_params_wmm_prio = self.qos_params_wmm_prio 541 493 542 return cfg 494 543 … … 705 754 transport such as TLS is required, 2=end-to- 706 755 end secure transport is required (i.e. "sips"). 756 rtp_transport_cfg -- the rtp-transport-configuration that is usede, when 757 a rtp-connection is being established. 707 758 """ 708 759 priority = 0 … … 724 775 use_srtp = 0 725 776 srtp_secure_signaling = 1 777 rtp_transport_cfg = None 726 778 727 779 def __init__(self, domain="", username="", password="", … … 749 801 self.build_config(domain, username, password, 750 802 display, registrar, proxy) 803 self.rtp_transport_cfg = _pjsua.transport_config_default() 751 804 752 805 def build_config(self, domain, username, password, display="", 753 registrar="", proxy="" ):806 registrar="", proxy="", rtp_transport_cfg = None): 754 807 """ 755 808 Construct account config. If domain argument is specified, … … 785 838 if username != "": 786 839 self.auth_cred.append(AuthCred("*", username, password)) 840 841 if (rtp_transport_cfg is not None): 842 self.rtp_transport_cfg = rtp_transport_cfg 843 else: 844 self.rtp_transport_cfg = _pjsua.Transport_Config() 787 845 788 846 def _cvt_from_pjsua(self, cfg): … … 808 866 self.use_srtp = cfg.use_srtp 809 867 self.srtp_secure_signaling = cfg.srtp_secure_signaling 868 if (self.rtp_transport_cfg is not None): 869 self.rtp_transport_cfg._cvt_from_pjsua(cfg.rtp_transport_cfg) 810 870 811 871 def _cvt_to_pjsua(self): … … 828 888 c.data = cred.passwd 829 889 cfg.cred_info.append(c) 890 830 891 cfg.auth_initial_send = self.auth_initial_send 831 892 cfg.auth_initial_algorithm = self.auth_initial_algorithm … … 836 897 cfg.use_srtp = self.use_srtp 837 898 cfg.srtp_secure_signaling = self.srtp_secure_signaling 899 900 cfg.rtp_transport_cfg = self.rtp_transport_cfg._cvt_to_pjsua() 901 838 902 return cfg 839 903
Note: See TracChangeset
for help on using the changeset viewer.