diff options
Diffstat (limited to 'pjsip-apps/src/py_pjsua/pjsua.py')
-rw-r--r-- | pjsip-apps/src/py_pjsua/pjsua.py | 81 |
1 files changed, 73 insertions, 8 deletions
diff --git a/pjsip-apps/src/py_pjsua/pjsua.py b/pjsip-apps/src/py_pjsua/pjsua.py index cae3480f..d5b9af36 100644 --- a/pjsip-apps/src/py_pjsua/pjsua.py +++ b/pjsip-apps/src/py_pjsua/pjsua.py @@ -1,17 +1,82 @@ -# import module py_pjsua import py_pjsua -print '''Testing py_pjsua.create : ''' status = py_pjsua.create() print "py status " + `status` -# perror -print '''Testing error code 70006 : ''' -py_pjsua.perror("py_pjsua","hello",70006) -# test py_pjsua.destroy -print '''Testing py_pjsua.destroy : ''' +# +# Create configuration objects +# +ua_cfg = py_pjsua.Config() +log_cfg = py_pjsua.Logging_Config() +media_cfg = py_pjsua.Media_Config() + +# +# Logging callback. +# +def logging_cb1(level, str, len): + print str, + + +# +# Initialize configs with default values. +# +py_pjsua.config_default(ua_cfg) +py_pjsua.logging_config_default(log_cfg) +py_pjsua.media_config_default(media_cfg) + +# +# Configure logging +# +log_cfg.cb = logging_cb1 +log_cfg.console_level = 4 + +# +# Initialize pjsua! +# +status = py_pjsua.init(ua_cfg, log_cfg, media_cfg); +print "py status after initialization :" + `status` + + +# +# Start pjsua! +# +status = py_pjsua.start() +if status != 0: + exit(1) + + +message = py_pjsua.Msg_Data() +py_pjsua.msg_data_init(message) +print "identitas object message data :" + `message` + +sipaddr = 'sip:167.205.34.99' +print "checking sip address [%s] : %d" % (sipaddr, py_pjsua.verify_sip_url(sipaddr)) + +sipaddr = '167.205.34.99' +print "checking invalid sip address [%s] : %d" % (sipaddr, py_pjsua.verify_sip_url(sipaddr)) + +object = py_pjsua.get_pjsip_endpt() +print "identitas Endpoint :" + `object` + "" + +mediaend = py_pjsua.get_pjmedia_endpt() +print "identitas Media Endpoint :" + `mediaend` + "" + +pool = py_pjsua.get_pool_factory() +print "identitas pool factory :" + `pool` + "" + +status = py_pjsua.handle_events(3000) +print "py status after 3 second of blocking wait :" + `status` + + + +# end of new testrun + +# + +py_pjsua.perror("saya","hallo",70006) + status = py_pjsua.destroy() print "py status " + `status` -print '''End Of py_pjsua''' + |