summaryrefslogtreecommitdiff
path: root/pjsip-apps/src/py_pjsua/pjsua_app.py
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-09-17 15:44:47 +0000
committerBenny Prijono <bennylp@teluu.com>2007-09-17 15:44:47 +0000
commit0b5b5d6d0b9e0c0362c15126bd74176aa1ce5161 (patch)
treef825c13c0f498430911d4312b5df6a90970f5ebf /pjsip-apps/src/py_pjsua/pjsua_app.py
parent256d36fb49a1aebcea8d63dbb65f3597ddc2cb3c (diff)
Updated pjsua_app.py Python sample application to the new changes in Python module (thanks Gideon Klompje)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1438 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps/src/py_pjsua/pjsua_app.py')
-rw-r--r--pjsip-apps/src/py_pjsua/pjsua_app.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/pjsip-apps/src/py_pjsua/pjsua_app.py b/pjsip-apps/src/py_pjsua/pjsua_app.py
index 1ba04930..093b96ea 100644
--- a/pjsip-apps/src/py_pjsua/pjsua_app.py
+++ b/pjsip-apps/src/py_pjsua/pjsua_app.py
@@ -19,8 +19,8 @@ C_LOG_LEVEL = 4
# STUN config.
# Set C_STUN_HOST to the address:port of the STUN server to enable STUN
#
-#C_STUN_HOST = ""
-C_STUN_HOST = "192.168.0.2"
+C_STUN_HOST = ""
+#C_STUN_HOST = "192.168.0.2"
#C_STUN_HOST = "stun.iptel.org:3478"
# SIP port
@@ -267,12 +267,16 @@ def add_account():
acc_cfg = py_pjsua.acc_config_default()
acc_cfg.id = "sip:" + acc_username + "@" + acc_domain
acc_cfg.reg_uri = "sip:" + acc_domain
- acc_cfg.cred_count = 1
- acc_cfg.cred_info[0].realm = acc_domain
- acc_cfg.cred_info[0].scheme = "digest"
- acc_cfg.cred_info[0].username = acc_username
- acc_cfg.cred_info[0].data_type = 0
- acc_cfg.cred_info[0].data = acc_passwd
+
+ cred_info = py_pjsua.Pjsip_Cred_Info()
+ cred_info.realm = "*"
+ cred_info.scheme = "digest"
+ cred_info.username = acc_username
+ cred_info.data_type = 0
+ cred_info.data = acc_passwd
+
+ acc_cfg.cred_info.append(1)
+ acc_cfg.cred_info[0] = cred_info
# Add new SIP account
status, acc_id = py_pjsua.acc_add(acc_cfg, 1)
@@ -338,8 +342,8 @@ def conf_list():
info = None
info = py_pjsua.conf_get_port_info(port)
txlist = ""
- for i in range(info.listener_cnt):
- txlist = txlist + "#" + `info.listeners[i]` + " "
+ for listener in info.listeners:
+ txlist = txlist + "#" + `listener` + " "
print "Port #" + `info.slot_id` + "[" + `(info.clock_rate/1000)` + "KHz/" + `(info.samples_per_frame * 1000 / info.clock_rate)` + "ms] " + info.name + " transmitting to: " + txlist