Changeset 1128


Ignore:
Timestamp:
Apr 2, 2007 4:56:20 PM (17 years ago)
Author:
bennylp
Message:

Fixed Python module because of recent ICE changes in pjsua

Location:
pjproject/trunk/pjsip-apps
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/build/pjsip_apps.dsw

    r803 r1128  
    5252############################################################################### 
    5353 
     54Project: "pjnath"="..\..\pjnath\build\pjnath.dsp" - Package Owner=<4> 
     55 
     56Package=<5> 
     57{{{ 
     58}}} 
     59 
     60Package=<4> 
     61{{{ 
     62}}} 
     63 
     64############################################################################### 
     65 
    5466Project: "pjsip_core"="..\..\pjsip\build\pjsip_core.dsp" - Package Owner=<4> 
    5567 
     
    168180    Project_Dep_Name pjsua_lib 
    169181    End Project Dependency 
     182    Begin Project Dependency 
     183    Project_Dep_Name pjnath 
     184    End Project Dependency 
    170185}}} 
    171186 
  • pjproject/trunk/pjsip-apps/build/py_pjsua.dsp

    r851 r1128  
    4444# PROP Target_Dir "" 
    4545# 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 /c 
     46# 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 
    4747# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 
    4848# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 
     
    5454LINK32=link.exe 
    5555# 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" 
    5757# SUBTRACT LINK32 /nodefaultlib 
    5858 
     
    7171# PROP Target_Dir "" 
    7272# 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 /c 
     73# 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 
    7474# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 
    7575# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 
     
    8181LINK32=link.exe 
    8282# 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" 
    8484 
    8585!ENDIF  
  • pjproject/trunk/pjsip-apps/src/py_pjsua/pjsua_app.py

    r972 r1128  
    209209 
    210210        # Configure STUN config 
    211         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 
     211        #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 
    216216 
    217217        # Configure UDP transport config 
    218218        transport_cfg = py_pjsua.transport_config_default() 
    219219        transport_cfg.port = C_SIP_PORT 
    220         transport_cfg.stun_config = stun_cfg 
     220        #transport_cfg.stun_config = stun_cfg 
    221221        if C_STUN_SRV != "": 
    222222                transport_cfg.use_stun = 1 
  • pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.c

    r972 r1128  
    919919    unsigned outbound_proxy_cnt; 
    920920    pj_str_t outbound_proxy[4]; 
     921    PyObject *stun_domain; 
     922    PyObject *stun_host; 
     923    PyObject *stun_relay_host; 
    921924    unsigned cred_count; 
    922925    pjsip_cred_info cred_info[PJSUA_ACC_MAX_PROXIES]; 
     
    23482351 
    23492352/* 
    2350  * stun_config_Object 
    2351  * STUN configuration 
    2352  */ 
    2353 typedef struct 
    2354 { 
    2355     PyObject_HEAD 
    2356     /* 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_dealloc 
    2366  * deletes a stun config from memory 
    2367  */ 
    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_new 
    2378  * constructor for stun_config object 
    2379  */ 
    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_members 
    2407  */ 
    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_Type 
    2439  */ 
    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 /* 
    24852353 * transport_config_Object 
    24862354 * Transport configuration for creating UDP transports for both SIP 
     
    24942362    PyObject * public_addr; 
    24952363    PyObject * bound_addr; 
    2496     int use_stun; 
    2497     stun_config_Object * stun_config; 
    24982364} transport_config_Object; 
    24992365 
     
    25072373    Py_XDECREF(self->public_addr);     
    25082374    Py_XDECREF(self->bound_addr);     
    2509     Py_XDECREF(self->stun_config);     
    25102375    self->ob_type->tp_free((PyObject*)self); 
    25112376} 
     
    25362401            return NULL; 
    25372402        } 
    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          
    25462403    } 
    25472404 
     
    25802437        "used for that purpose)."                
    25812438    },     
    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     }, 
    25922439    {NULL}  /* Sentinel */ 
    25932440}; 
     
    26412488    transport_config_new,             /* tp_new */ 
    26422489 
    2643 }; 
    2644  
    2645 /* 
    2646  * sockaddr_Object 
    2647  * C/Python wrapper for sockaddr object 
    2648  */ 
    2649 typedef struct 
    2650 { 
    2651     PyObject_HEAD 
    2652     /* Type-specific fields go here. */ 
    2653 #if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=0 
    2654     pj_uint8_t  sa_zero_len; 
    2655     pj_uint8_t  sa_family; 
    2656 #else 
    2657     pj_uint16_t sa_family;      /**< Common data: address family.   */ 
    2658 #endif 
    2659     PyObject * sa_data; /**< Address data.                  */ 
    2660 } sockaddr_Object; 
    2661  
    2662 /* 
    2663  * sockaddr_dealloc 
    2664  * deletes a sockaddr from memory 
    2665  */ 
    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_new 
    2675  * constructor for sockaddr object 
    2676  */ 
    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_members 
    2700  * declares attributes accessible from both C and Python for sockaddr object 
    2701  */ 
    2702 static PyMemberDef sockaddr_members[] = 
    2703 { 
    2704 #if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=0 
    2705     { 
    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 #else 
    2715     { 
    2716         "sa_family", T_INT, 
    2717         offsetof(sockaddr_Object, sa_family), 0, 
    2718         "Common data: address family." 
    2719     }, 
    2720 #endif 
    2721     { 
    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_Type 
    2732  */ 
    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 */ 
    27742490}; 
    27752491 
     
    29052621    unsigned flag; 
    29062622    unsigned addr_len; 
    2907     sockaddr_Object * local_addr; 
    29082623    host_port_Object * local_name; 
    29092624    unsigned usage_count; 
     
    29192634    Py_XDECREF(self->type_name);  
    29202635    Py_XDECREF(self->info); 
    2921     Py_XDECREF(self->local_addr); 
    29222636    Py_XDECREF(self->local_name); 
    29232637    self->ob_type->tp_free((PyObject*)self); 
     
    29492663            return NULL; 
    29502664        } 
    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         } 
    29582665        self->local_name =  
    29592666            (host_port_Object *)host_port_new(&host_port_Type,NULL,NULL); 
     
    29992706        "addr_len", T_INT, offsetof(transport_info_Object, addr_len), 0, 
    30002707        "Local address length." 
    3001     }, 
    3002     { 
    3003         "local_addr", T_OBJECT_EX, 
    3004         offsetof(transport_info_Object, local_addr), 0, 
    3005         "Local/bound address." 
    30062708    }, 
    30072709    { 
     
    31102812 
    31112813/* 
    3112  * py_pjsua_stun_config_default 
    3113  * !modified @ 051206 
    3114  */ 
    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 /* 
    31392814 * py_pjsua_transport_config_default 
    31402815 * !modified @ 051206 
     
    31582833        PyString_FromStringAndSize(cfg.bound_addr.ptr, cfg.bound_addr.slen); 
    31592834    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); 
    31742835    return (PyObject *)obj; 
    3175 } 
    3176  
    3177 /* 
    3178  * py_pjsua_normalize_stun_config 
    3179  */ 
    3180 static PyObject *py_pjsua_normalize_stun_config 
    3181 (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; 
    32172836} 
    32182837 
     
    32422861        cfg.bound_addr.slen = strlen(PyString_AsString(obj->bound_addr)); 
    32432862        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)); 
    32552863        status = pjsua_transport_create(type, &cfg, &id); 
    32562864    } else { 
     
    33442952        obj->id = info.id; 
    33452953        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!=0 
    3349         obj->local_addr->sa_zero_len = info.local_addr.sa_zero_len; 
    3350         obj->local_addr->sa_family = info.local_addr.sa_family; 
    3351 #else 
    3352         obj->local_addr->sa_family = info.local_addr.sa_family; 
    3353 #endif 
    33542954        return Py_BuildValue("O", obj); 
    33552955    } else { 
     
    33942994} 
    33952995 
    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."; 
    33992996static char pjsua_transport_config_default_doc[] = 
    34002997    "py_pjsua.Transport_Config py_pjsua.transport_config_default () " 
    34012998    "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. "; 
    34052999static char pjsua_transport_create_doc[] = 
    34063000    "int, int py_pjsua.transport_create (int type, " 
     
    81207714    }, 
    81217715    { 
    8122         "stun_config_default", py_pjsua_stun_config_default, METH_VARARGS, 
    8123         pjsua_stun_config_default_doc 
    8124     }, 
    8125     { 
    81267716        "transport_config_default", py_pjsua_transport_config_default,  
    81277717        METH_VARARGS,pjsua_transport_config_default_doc 
    81287718    }, 
    8129     { 
    8130         "normalize_stun_config", py_pjsua_normalize_stun_config, METH_VARARGS, 
    8131         pjsua_normalize_stun_config_doc 
    8132     }, 
    8133      
    81347719    { 
    81357720        "transport_create", py_pjsua_transport_create, METH_VARARGS, 
     
    85178102    /* LIB TRANSPORT */ 
    85188103 
    8519     if (PyType_Ready(&stun_config_Type) < 0) 
    8520         return; 
    85218104    if (PyType_Ready(&transport_config_Type) < 0) 
    8522         return; 
    8523     if (PyType_Ready(&sockaddr_Type) < 0) 
    85248105        return; 
    85258106    if (PyType_Ready(&host_port_Type) < 0) 
     
    86388219    /* LIB TRANSPORT */ 
    86398220 
    8640     Py_INCREF(&stun_config_Type); 
    8641     PyModule_AddObject(m, "STUN_Config", (PyObject *)&stun_config_Type); 
    86428221    Py_INCREF(&transport_config_Type); 
    86438222    PyModule_AddObject 
    86448223        (m, "Transport_Config", (PyObject *)&transport_config_Type); 
    8645     Py_INCREF(&sockaddr_Type); 
    8646     PyModule_AddObject(m, "Sockaddr", (PyObject *)&sockaddr_Type); 
    86478224    Py_INCREF(&host_port_Type); 
    86488225    PyModule_AddObject(m, "Host_Port", (PyObject *)&host_port_Type); 
Note: See TracChangeset for help on using the changeset viewer.