Ignore:
Timestamp:
Nov 23, 2006 9:50:02 PM (17 years ago)
Author:
bennylp
Message:

Updated Python project with base PJSUA API

File:
1 edited

Legend:

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

    r803 r824  
    1 # import module py_pjsua 
    21import py_pjsua 
    32 
    4 print '''Testing py_pjsua.create : ''' 
    53status = py_pjsua.create() 
    64print "py status " + `status` 
    75 
    8 # perror 
    9 print '''Testing error code 70006 : ''' 
    10 py_pjsua.perror("py_pjsua","hello",70006) 
    116 
    12 # test py_pjsua.destroy 
    13 print '''Testing py_pjsua.destroy : ''' 
     7# 
     8# Create configuration objects 
     9# 
     10ua_cfg = py_pjsua.Config() 
     11log_cfg = py_pjsua.Logging_Config() 
     12media_cfg = py_pjsua.Media_Config() 
     13 
     14# 
     15# Logging callback. 
     16# 
     17def logging_cb1(level, str, len): 
     18    print str, 
     19 
     20 
     21# 
     22# Initialize configs with default values. 
     23# 
     24py_pjsua.config_default(ua_cfg) 
     25py_pjsua.logging_config_default(log_cfg) 
     26py_pjsua.media_config_default(media_cfg) 
     27 
     28# 
     29# Configure logging 
     30# 
     31log_cfg.cb = logging_cb1 
     32log_cfg.console_level = 4 
     33 
     34# 
     35# Initialize pjsua! 
     36# 
     37status = py_pjsua.init(ua_cfg, log_cfg, media_cfg); 
     38print "py status after initialization :" + `status` 
     39 
     40 
     41# 
     42# Start pjsua! 
     43# 
     44status = py_pjsua.start() 
     45if status != 0: 
     46    exit(1) 
     47 
     48 
     49message = py_pjsua.Msg_Data() 
     50py_pjsua.msg_data_init(message) 
     51print "identitas object message data :" + `message` 
     52 
     53sipaddr = 'sip:167.205.34.99' 
     54print "checking sip address [%s] : %d" % (sipaddr, py_pjsua.verify_sip_url(sipaddr)) 
     55 
     56sipaddr = '167.205.34.99' 
     57print "checking invalid sip address [%s] : %d" % (sipaddr, py_pjsua.verify_sip_url(sipaddr)) 
     58 
     59object = py_pjsua.get_pjsip_endpt() 
     60print "identitas Endpoint :" + `object` + "" 
     61 
     62mediaend = py_pjsua.get_pjmedia_endpt() 
     63print "identitas Media Endpoint :" + `mediaend` + "" 
     64 
     65pool = py_pjsua.get_pool_factory() 
     66print "identitas pool factory :" + `pool` + "" 
     67 
     68status = py_pjsua.handle_events(3000) 
     69print "py status after 3 second of blocking wait :" + `status` 
     70 
     71 
     72 
     73# end of new testrun 
     74 
     75# 
     76 
     77py_pjsua.perror("saya","hallo",70006) 
     78 
    1479status = py_pjsua.destroy() 
    1580print "py status " + `status` 
    1681 
    17 print '''End Of py_pjsua''' 
     82 
Note: See TracChangeset for help on using the changeset viewer.