- Timestamp:
- Apr 2, 2007 4:56:20 PM (18 years ago)
- Location:
- pjproject/trunk/pjsip-apps
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/build/pjsip_apps.dsw
r803 r1128 52 52 ############################################################################### 53 53 54 Project: "pjnath"="..\..\pjnath\build\pjnath.dsp" - Package Owner=<4> 55 56 Package=<5> 57 {{{ 58 }}} 59 60 Package=<4> 61 {{{ 62 }}} 63 64 ############################################################################### 65 54 66 Project: "pjsip_core"="..\..\pjsip\build\pjsip_core.dsp" - Package Owner=<4> 55 67 … … 168 180 Project_Dep_Name pjsua_lib 169 181 End Project Dependency 182 Begin Project Dependency 183 Project_Dep_Name pjnath 184 End Project Dependency 170 185 }}} 171 186 -
pjproject/trunk/pjsip-apps/build/py_pjsua.dsp
r851 r1128 44 44 # PROP Target_Dir "" 45 45 # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PY_PJSUA_EXPORTS" /YX /FD /c 46 # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\pjlib\include" /I "..\..\pjlib-util\include" /I "..\..\pjmedia\include" /I "..\..\pjsip\include" / D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PY_PJSUA_EXPORTS" /FR /YX /FD /c46 # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\pjlib\include" /I "..\..\pjlib-util\include" /I "..\..\pjmedia\include" /I "..\..\pjsip\include" /I "../../pjnath/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PY_PJSUA_EXPORTS" /FR /YX /FD /c 47 47 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 48 48 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 … … 54 54 LINK32=link.exe 55 55 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 56 # ADD LINK32 python24.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib /nologo /dll /map /machine:I386 /nodefaultlib:"libcmt.lib" /out:"..\lib\py_pjsua.pyd" /libpath:"../../pjlib/lib" /libpath:"../../pjlib-util/lib" /libpath:"../../pjmedia/lib" /libpath:"../../pjsip/lib"56 # ADD LINK32 python24.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib iphlpapi.lib /nologo /dll /map /machine:I386 /nodefaultlib:"libcmt.lib" /out:"..\lib\py_pjsua.pyd" /libpath:"../../pjlib/lib" /libpath:"../../pjlib-util/lib" /libpath:"../../pjmedia/lib" /libpath:"../../pjsip/lib" 57 57 # SUBTRACT LINK32 /nodefaultlib 58 58 … … 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 /W3 /Gm /GX /ZI /Od /I "..\..\pjlib\include" /I "..\..\pjlib-util\include" /I "..\..\pjmedia\include" /I "..\..\pjsip\include" / D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PY_PJSUA_EXPORTS" /FR /YX /FD /GZ /c73 # ADD CPP /nologo /MTd /W3 /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 … … 81 81 LINK32=link.exe 82 82 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept 83 # ADD LINK32 python24_d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib /nologo /dll /debug /machine:I386 /out:"..\lib\py_pjsua_d.pyd" /pdbtype:sept /libpath:"../../pjlib/lib" /libpath:"../../pjlib-util/lib" /libpath:"../../pjmedia/lib" /libpath:"../../pjsip/lib" /libpath:"F:\incoming\projects\divusi\Python-2.4\Python-2.4\PCbuild" /libpath:"F:\incoming\projects\divusi\Python-2.4\Python-2.4\PC\VC6"83 # ADD LINK32 python24_d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib iphlpapi.lib /nologo /dll /debug /machine:I386 /out:"..\lib\py_pjsua_d.pyd" /pdbtype:sept /libpath:"../../pjlib/lib" /libpath:"../../pjlib-util/lib" /libpath:"../../pjmedia/lib" /libpath:"../../pjsip/lib" /libpath:"F:\incoming\projects\divusi\Python-2.4\Python-2.4\PCbuild" /libpath:"F:\incoming\projects\divusi\Python-2.4\Python-2.4\PC\VC6" 84 84 85 85 !ENDIF -
pjproject/trunk/pjsip-apps/src/py_pjsua/pjsua_app.py
r972 r1128 209 209 210 210 # Configure STUN config 211 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_PORT211 #stun_cfg = py_pjsua.stun_config_default() 212 #stun_cfg.stun_srv1 = C_STUN_SRV 213 #stun_cfg.stun_srv2 = C_STUN_SRV 214 #stun_cfg.stun_port1 = C_STUN_PORT 215 #stun_cfg.stun_port2 = C_STUN_PORT 216 216 217 217 # Configure UDP transport config 218 218 transport_cfg = py_pjsua.transport_config_default() 219 219 transport_cfg.port = C_SIP_PORT 220 transport_cfg.stun_config = stun_cfg220 #transport_cfg.stun_config = stun_cfg 221 221 if C_STUN_SRV != "": 222 222 transport_cfg.use_stun = 1 -
pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.c
r972 r1128 919 919 unsigned outbound_proxy_cnt; 920 920 pj_str_t outbound_proxy[4]; 921 PyObject *stun_domain; 922 PyObject *stun_host; 923 PyObject *stun_relay_host; 921 924 unsigned cred_count; 922 925 pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES]; … … 2348 2351 2349 2352 /* 2350 * stun_config_Object2351 * STUN configuration2352 */2353 typedef struct2354 {2355 PyObject_HEAD2356 /* Type-specific fields go here. */2357 PyObject * stun_srv1;2358 unsigned stun_port1;2359 PyObject * stun_srv2;2360 unsigned stun_port2;2361 } stun_config_Object;2362 2363 2364 /*2365 * stun_config_dealloc2366 * deletes a stun config from memory2367 */2368 static void stun_config_dealloc(stun_config_Object* self)2369 {2370 Py_XDECREF(self->stun_srv1);2371 Py_XDECREF(self->stun_srv2);2372 self->ob_type->tp_free((PyObject*)self);2373 }2374 2375 2376 /*2377 * stun_config_new2378 * constructor for stun_config object2379 */2380 static PyObject * stun_config_new(PyTypeObject *type, PyObject *args,2381 PyObject *kwds)2382 {2383 stun_config_Object *self;2384 self = (stun_config_Object *)type->tp_alloc(type, 0);2385 if (self != NULL)2386 {2387 self->stun_srv1 = PyString_FromString("");2388 if (self->stun_srv1 == NULL)2389 {2390 Py_DECREF(self);2391 return NULL;2392 }2393 self->stun_srv2 = PyString_FromString("");2394 if (self->stun_srv2 == NULL)2395 {2396 Py_DECREF(self);2397 return NULL;2398 }2399 }2400 2401 return (PyObject *)self;2402 }2403 2404 2405 /*2406 * stun_config_members2407 */2408 static PyMemberDef stun_config_members[] =2409 {2410 {2411 "stun_port1", T_INT, offsetof(stun_config_Object, stun_port1), 0,2412 "The first STUN server IP address or hostname."2413 },2414 {2415 "stun_port2", T_INT, offsetof(stun_config_Object, stun_port2), 0,2416 "Port number of the second STUN server. "2417 "If zero, default STUN port will be used."2418 },2419 {2420 "stun_srv1", T_OBJECT_EX,2421 offsetof(stun_config_Object, stun_srv1), 0,2422 "The first STUN server IP address or hostname"2423 },2424 {2425 "stun_srv2", T_OBJECT_EX,2426 offsetof(stun_config_Object, stun_srv2), 0,2427 "Optional second STUN server IP address or hostname, for which the "2428 "result of the mapping request will be compared to. If the value "2429 "is empty, only one STUN server will be used"2430 },2431 {NULL} /* Sentinel */2432 };2433 2434 2435 2436 2437 /*2438 * stun_config_Type2439 */2440 static PyTypeObject stun_config_Type =2441 {2442 PyObject_HEAD_INIT(NULL)2443 0, /*ob_size*/2444 "py_pjsua.STUN_Config", /*tp_name*/2445 sizeof(stun_config_Object), /*tp_basicsize*/2446 0, /*tp_itemsize*/2447 (destructor)stun_config_dealloc,/*tp_dealloc*/2448 0, /*tp_print*/2449 0, /*tp_getattr*/2450 0, /*tp_setattr*/2451 0, /*tp_compare*/2452 0, /*tp_repr*/2453 0, /*tp_as_number*/2454 0, /*tp_as_sequence*/2455 0, /*tp_as_mapping*/2456 0, /*tp_hash */2457 0, /*tp_call*/2458 0, /*tp_str*/2459 0, /*tp_getattro*/2460 0, /*tp_setattro*/2461 0, /*tp_as_buffer*/2462 Py_TPFLAGS_DEFAULT, /*tp_flags*/2463 "STUN Config objects", /* tp_doc */2464 0, /* tp_traverse */2465 0, /* tp_clear */2466 0, /* tp_richcompare */2467 0, /* tp_weaklistoffset */2468 0, /* tp_iter */2469 0, /* tp_iternext */2470 0, /* tp_methods */2471 stun_config_members, /* tp_members */2472 0, /* tp_getset */2473 0, /* tp_base */2474 0, /* tp_dict */2475 0, /* tp_descr_get */2476 0, /* tp_descr_set */2477 0, /* tp_dictoffset */2478 0, /* tp_init */2479 0, /* tp_alloc */2480 stun_config_new, /* tp_new */2481 2482 };2483 2484 /*2485 2353 * transport_config_Object 2486 2354 * Transport configuration for creating UDP transports for both SIP … … 2494 2362 PyObject * public_addr; 2495 2363 PyObject * bound_addr; 2496 int use_stun;2497 stun_config_Object * stun_config;2498 2364 } transport_config_Object; 2499 2365 … … 2507 2373 Py_XDECREF(self->public_addr); 2508 2374 Py_XDECREF(self->bound_addr); 2509 Py_XDECREF(self->stun_config);2510 2375 self->ob_type->tp_free((PyObject*)self); 2511 2376 } … … 2536 2401 return NULL; 2537 2402 } 2538 self->stun_config =2539 (stun_config_Object *)stun_config_new(&stun_config_Type,NULL,NULL);2540 if (self->stun_config == NULL)2541 {2542 Py_DECREF(self);2543 return NULL;2544 }2545 2546 2403 } 2547 2404 … … 2580 2437 "used for that purpose)." 2581 2438 }, 2582 {2583 "use_stun", T_INT,2584 offsetof(transport_config_Object, use_stun), 0,2585 "Flag to indicate whether STUN should be used."2586 },2587 {2588 "stun_config", T_OBJECT_EX,2589 offsetof(transport_config_Object, stun_config), 0,2590 "STUN configuration, must be specified when STUN is used."2591 },2592 2439 {NULL} /* Sentinel */ 2593 2440 }; … … 2641 2488 transport_config_new, /* tp_new */ 2642 2489 2643 };2644 2645 /*2646 * sockaddr_Object2647 * C/Python wrapper for sockaddr object2648 */2649 typedef struct2650 {2651 PyObject_HEAD2652 /* Type-specific fields go here. */2653 #if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=02654 pj_uint8_t sa_zero_len;2655 pj_uint8_t sa_family;2656 #else2657 pj_uint16_t sa_family; /**< Common data: address family. */2658 #endif2659 PyObject * sa_data; /**< Address data. */2660 } sockaddr_Object;2661 2662 /*2663 * sockaddr_dealloc2664 * deletes a sockaddr from memory2665 */2666 static void sockaddr_dealloc(sockaddr_Object* self)2667 {2668 Py_XDECREF(self->sa_data);2669 self->ob_type->tp_free((PyObject*)self);2670 }2671 2672 2673 /*2674 * sockaddr_new2675 * constructor for sockaddr object2676 */2677 static PyObject * sockaddr_new(PyTypeObject *type, PyObject *args,2678 PyObject *kwds)2679 {2680 sockaddr_Object *self;2681 2682 self = (sockaddr_Object *)type->tp_alloc(type, 0);2683 if (self != NULL)2684 {2685 self->sa_data = PyString_FromString("");2686 if (self->sa_data == NULL)2687 {2688 Py_DECREF(self);2689 return NULL;2690 }2691 2692 }2693 2694 return (PyObject *)self;2695 }2696 2697 2698 /*2699 * sockaddr_members2700 * declares attributes accessible from both C and Python for sockaddr object2701 */2702 static PyMemberDef sockaddr_members[] =2703 {2704 #if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=02705 {2706 "sa_zero_len", T_INT, offsetof(sockaddr_Object, sa_zero_len), 0,2707 ""2708 },2709 {2710 "sa_family", T_INT,2711 offsetof(sockaddr_Object, sa_family), 0,2712 "Common data: address family."2713 },2714 #else2715 {2716 "sa_family", T_INT,2717 offsetof(sockaddr_Object, sa_family), 0,2718 "Common data: address family."2719 },2720 #endif2721 {2722 "sa_data", T_OBJECT_EX,2723 offsetof(sockaddr_Object, sa_data), 0,2724 "Address data"2725 },2726 {NULL} /* Sentinel */2727 };2728 2729 2730 /*2731 * sockaddr_Type2732 */2733 static PyTypeObject sockaddr_Type =2734 {2735 PyObject_HEAD_INIT(NULL)2736 0, /*ob_size*/2737 "py_pjsua.Sockaddr", /*tp_name*/2738 sizeof(sockaddr_Object), /*tp_basicsize*/2739 0, /*tp_itemsize*/2740 (destructor)sockaddr_dealloc,/*tp_dealloc*/2741 0, /*tp_print*/2742 0, /*tp_getattr*/2743 0, /*tp_setattr*/2744 0, /*tp_compare*/2745 0, /*tp_repr*/2746 0, /*tp_as_number*/2747 0, /*tp_as_sequence*/2748 0, /*tp_as_mapping*/2749 0, /*tp_hash */2750 0, /*tp_call*/2751 0, /*tp_str*/2752 0, /*tp_getattro*/2753 0, /*tp_setattro*/2754 0, /*tp_as_buffer*/2755 Py_TPFLAGS_DEFAULT, /*tp_flags*/2756 "Sockaddr objects", /*tp_doc*/2757 0, /*tp_traverse*/2758 0, /*tp_clear*/2759 0, /*tp_richcompare*/2760 0, /* tp_weaklistoffset */2761 0, /* tp_iter */2762 0, /* tp_iternext */2763 0, /* tp_methods */2764 sockaddr_members, /* tp_members */2765 0, /* tp_getset */2766 0, /* tp_base */2767 0, /* tp_dict */2768 0, /* tp_descr_get */2769 0, /* tp_descr_set */2770 0, /* tp_dictoffset */2771 0, /* tp_init */2772 0, /* tp_alloc */2773 sockaddr_new, /* tp_new */2774 2490 }; 2775 2491 … … 2905 2621 unsigned flag; 2906 2622 unsigned addr_len; 2907 sockaddr_Object * local_addr;2908 2623 host_port_Object * local_name; 2909 2624 unsigned usage_count; … … 2919 2634 Py_XDECREF(self->type_name); 2920 2635 Py_XDECREF(self->info); 2921 Py_XDECREF(self->local_addr);2922 2636 Py_XDECREF(self->local_name); 2923 2637 self->ob_type->tp_free((PyObject*)self); … … 2949 2663 return NULL; 2950 2664 } 2951 self->local_addr =2952 (sockaddr_Object *)sockaddr_new(&sockaddr_Type,NULL,NULL);2953 if (self->local_addr == NULL)2954 {2955 Py_DECREF(self);2956 return NULL;2957 }2958 2665 self->local_name = 2959 2666 (host_port_Object *)host_port_new(&host_port_Type,NULL,NULL); … … 2999 2706 "addr_len", T_INT, offsetof(transport_info_Object, addr_len), 0, 3000 2707 "Local address length." 3001 },3002 {3003 "local_addr", T_OBJECT_EX,3004 offsetof(transport_info_Object, local_addr), 0,3005 "Local/bound address."3006 2708 }, 3007 2709 { … … 3110 2812 3111 2813 /* 3112 * py_pjsua_stun_config_default3113 * !modified @ 0512063114 */3115 static PyObject *py_pjsua_stun_config_default(PyObject *pSelf, PyObject *pArgs)3116 {3117 stun_config_Object *obj;3118 pjsua_stun_config cfg;3119 3120 if (!PyArg_ParseTuple(pArgs, ""))3121 {3122 return NULL;3123 }3124 3125 pjsua_stun_config_default(&cfg);3126 obj = (stun_config_Object *)stun_config_new(&stun_config_Type, NULL, NULL);3127 obj->stun_port1 = cfg.stun_port1;3128 obj->stun_port2 = cfg.stun_port2;3129 Py_XDECREF(obj->stun_srv1);3130 obj->stun_srv1 =3131 PyString_FromStringAndSize(cfg.stun_srv1.ptr, cfg.stun_srv1.slen);3132 Py_XDECREF(obj->stun_srv2);3133 obj->stun_srv2 =3134 PyString_FromStringAndSize(cfg.stun_srv2.ptr, cfg.stun_srv2.slen);3135 return (PyObject *)obj;3136 }3137 3138 /*3139 2814 * py_pjsua_transport_config_default 3140 2815 * !modified @ 051206 … … 3158 2833 PyString_FromStringAndSize(cfg.bound_addr.ptr, cfg.bound_addr.slen); 3159 2834 obj->port = cfg.port; 3160 obj->use_stun = cfg.use_stun;3161 Py_XDECREF(obj->stun_config);3162 obj->stun_config =3163 (stun_config_Object *)stun_config_new(&stun_config_Type, NULL, NULL);3164 obj->stun_config->stun_port1 = cfg.stun_config.stun_port1;3165 obj->stun_config->stun_port2 = cfg.stun_config.stun_port2;3166 Py_XDECREF(obj->stun_config->stun_srv1);3167 obj->stun_config->stun_srv1 =3168 PyString_FromStringAndSize(cfg.stun_config.stun_srv1.ptr,3169 cfg.stun_config.stun_srv1.slen);3170 Py_XDECREF(obj->stun_config->stun_srv2);3171 obj->stun_config->stun_srv2 =3172 PyString_FromStringAndSize(cfg.stun_config.stun_srv2.ptr,3173 cfg.stun_config.stun_srv2.slen);3174 2835 return (PyObject *)obj; 3175 }3176 3177 /*3178 * py_pjsua_normalize_stun_config3179 */3180 static PyObject *py_pjsua_normalize_stun_config3181 (PyObject *pSelf, PyObject *pArgs)3182 {3183 PyObject * tmpObj;3184 stun_config_Object *obj;3185 pjsua_stun_config cfg;3186 3187 if (!PyArg_ParseTuple(pArgs, "O", &tmpObj))3188 {3189 return NULL;3190 }3191 3192 if (tmpObj == Py_None) {3193 Py_INCREF(Py_None);3194 return Py_None;3195 }3196 3197 obj = (stun_config_Object *) tmpObj;3198 cfg.stun_port1 = obj->stun_port1;3199 cfg.stun_port2 = obj->stun_port2;3200 cfg.stun_srv1.ptr = PyString_AsString(obj->stun_srv1);3201 cfg.stun_srv1.slen = strlen(PyString_AsString(obj->stun_srv1));3202 cfg.stun_srv2.ptr = PyString_AsString(obj->stun_srv2);3203 cfg.stun_srv2.slen = strlen(PyString_AsString(obj->stun_srv2));3204 3205 pjsua_normalize_stun_config(&cfg);3206 obj->stun_port1 = cfg.stun_port1;3207 obj->stun_port2 = cfg.stun_port2;3208 Py_XDECREF(obj->stun_srv1);3209 obj->stun_srv1 =3210 PyString_FromStringAndSize(cfg.stun_srv1.ptr, cfg.stun_srv1.slen);3211 Py_XDECREF(obj->stun_srv2);3212 obj->stun_srv2 =3213 PyString_FromStringAndSize(cfg.stun_srv2.ptr, cfg.stun_srv2.slen);3214 3215 Py_INCREF(Py_None);3216 return Py_None;3217 2836 } 3218 2837 … … 3242 2861 cfg.bound_addr.slen = strlen(PyString_AsString(obj->bound_addr)); 3243 2862 cfg.port = obj->port; 3244 cfg.use_stun = obj->use_stun;3245 cfg.stun_config.stun_port1 = obj->stun_config->stun_port1;3246 cfg.stun_config.stun_port2 = obj->stun_config->stun_port2;3247 cfg.stun_config.stun_srv1.ptr =3248 PyString_AsString(obj->stun_config->stun_srv1);3249 cfg.stun_config.stun_srv1.slen =3250 strlen(PyString_AsString(obj->stun_config->stun_srv1));3251 cfg.stun_config.stun_srv2.ptr =3252 PyString_AsString(obj->stun_config->stun_srv2);3253 cfg.stun_config.stun_srv2.slen =3254 strlen(PyString_AsString(obj->stun_config->stun_srv2));3255 2863 status = pjsua_transport_create(type, &cfg, &id); 3256 2864 } else { … … 3344 2952 obj->id = info.id; 3345 2953 obj->info = PyString_FromStringAndSize(info.info.ptr, info.info.slen); 3346 obj->local_addr->sa_data =3347 PyString_FromStringAndSize(info.local_addr.sa_data, 14);3348 #if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=03349 obj->local_addr->sa_zero_len = info.local_addr.sa_zero_len;3350 obj->local_addr->sa_family = info.local_addr.sa_family;3351 #else3352 obj->local_addr->sa_family = info.local_addr.sa_family;3353 #endif3354 2954 return Py_BuildValue("O", obj); 3355 2955 } else { … … 3394 2994 } 3395 2995 3396 static char pjsua_stun_config_default_doc[] =3397 "py_pjsua.STUN_Config py_pjsua.stun_config_default () "3398 "Call this function to initialize STUN config with default values.";3399 2996 static char pjsua_transport_config_default_doc[] = 3400 2997 "py_pjsua.Transport_Config py_pjsua.transport_config_default () " 3401 2998 "Call this function to initialize UDP config with default values."; 3402 static char pjsua_normalize_stun_config_doc[] =3403 "void py_pjsua.normalize_stun_config (py_pjsua.STUN_Config cfg) "3404 "Normalize STUN config. ";3405 2999 static char pjsua_transport_create_doc[] = 3406 3000 "int, int py_pjsua.transport_create (int type, " … … 8120 7714 }, 8121 7715 { 8122 "stun_config_default", py_pjsua_stun_config_default, METH_VARARGS,8123 pjsua_stun_config_default_doc8124 },8125 {8126 7716 "transport_config_default", py_pjsua_transport_config_default, 8127 7717 METH_VARARGS,pjsua_transport_config_default_doc 8128 7718 }, 8129 {8130 "normalize_stun_config", py_pjsua_normalize_stun_config, METH_VARARGS,8131 pjsua_normalize_stun_config_doc8132 },8133 8134 7719 { 8135 7720 "transport_create", py_pjsua_transport_create, METH_VARARGS, … … 8517 8102 /* LIB TRANSPORT */ 8518 8103 8519 if (PyType_Ready(&stun_config_Type) < 0)8520 return;8521 8104 if (PyType_Ready(&transport_config_Type) < 0) 8522 return;8523 if (PyType_Ready(&sockaddr_Type) < 0)8524 8105 return; 8525 8106 if (PyType_Ready(&host_port_Type) < 0) … … 8638 8219 /* LIB TRANSPORT */ 8639 8220 8640 Py_INCREF(&stun_config_Type);8641 PyModule_AddObject(m, "STUN_Config", (PyObject *)&stun_config_Type);8642 8221 Py_INCREF(&transport_config_Type); 8643 8222 PyModule_AddObject 8644 8223 (m, "Transport_Config", (PyObject *)&transport_config_Type); 8645 Py_INCREF(&sockaddr_Type);8646 PyModule_AddObject(m, "Sockaddr", (PyObject *)&sockaddr_Type);8647 8224 Py_INCREF(&host_port_Type); 8648 8225 PyModule_AddObject(m, "Host_Port", (PyObject *)&host_port_Type);
Note: See TracChangeset
for help on using the changeset viewer.