Ignore:
Timestamp:
Sep 10, 2007 4:54:22 PM (15 years ago)
Author:
bennylp
Message:

Updated Python module to pjsip-0.7 (inc. custom presence test)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/py_pjsua/pjsua_app.py

    r1128 r1430  
    1818 
    1919# STUN config. 
    20 # Set C_STUN_SRV to the address of the STUN server to enable STUN 
    21 # 
    22 C_STUN_SRV = "" 
     20# Set C_STUN_HOST to the address:port of the STUN server to enable STUN 
     21# 
     22#C_STUN_HOST = "" 
     23C_STUN_HOST = "192.168.0.2" 
     24#C_STUN_HOST = "stun.iptel.org:3478" 
     25 
     26# SIP port 
    2327C_SIP_PORT = 5060 
    24 C_STUN_PORT = 3478 
    2528 
    2629 
     
    4144def err_exit(title, rc): 
    4245    py_pjsua.perror(THIS_FILE, title, rc) 
     46    py_pjsua.destroy() 
    4347    exit(1) 
    4448 
     
    197201        ua_cfg.cb.on_call_transfer_request = on_call_transfer_request 
    198202 
     203        # Configure STUN setting 
     204        if C_STUN_HOST != "": 
     205            ua_cfg.stun_host = C_STUN_HOST; 
     206 
    199207        # Create and initialize media config 
    200208        med_cfg = py_pjsua.media_config_default() 
     
    208216                err_exit("pjsua init() error", status) 
    209217 
    210         # 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 
    216  
    217218        # Configure UDP transport config 
    218219        transport_cfg = py_pjsua.transport_config_default() 
    219220        transport_cfg.port = C_SIP_PORT 
    220         #transport_cfg.stun_config = stun_cfg 
    221         if C_STUN_SRV != "": 
    222                 transport_cfg.use_stun = 1 
    223221 
    224222        # Create UDP transport 
     
    226224            py_pjsua.transport_create(py_pjsua.PJSIP_TRANSPORT_UDP, transport_cfg) 
    227225        if status != 0: 
    228                 py_pjsua.destroy() 
    229226                err_exit("Error creating UDP transport", status) 
     227                 
    230228 
    231229        # Create initial default account 
    232230        status, acc_id = py_pjsua.acc_add_local(transport_id, 1) 
    233231        if status != 0: 
    234                 py_pjsua.destroy() 
    235232                err_exit("Error creating account", status) 
    236233 
     
    497494        status = py_pjsua.start() 
    498495        if status != 0: 
    499                 py_pjsua.destroy() 
    500496                err_exit("Error starting pjsua!", status) 
    501497 
Note: See TracChangeset for help on using the changeset viewer.