summaryrefslogtreecommitdiff
path: root/pjsip-apps/src/py_pjsua/pjsua.py
diff options
context:
space:
mode:
Diffstat (limited to 'pjsip-apps/src/py_pjsua/pjsua.py')
-rw-r--r--pjsip-apps/src/py_pjsua/pjsua.py70
1 files changed, 42 insertions, 28 deletions
diff --git a/pjsip-apps/src/py_pjsua/pjsua.py b/pjsip-apps/src/py_pjsua/pjsua.py
index fe306917..3505b124 100644
--- a/pjsip-apps/src/py_pjsua/pjsua.py
+++ b/pjsip-apps/src/py_pjsua/pjsua.py
@@ -7,9 +7,9 @@ print "py status " + `status`
#
# Create configuration objects
#
-ua_cfg = py_pjsua.Config()
-log_cfg = py_pjsua.Logging_Config()
-media_cfg = py_pjsua.Media_Config()
+ua_cfg = py_pjsua.config_default()
+log_cfg = py_pjsua.logging_config_default()
+media_cfg = py_pjsua.media_config_default()
#
# Logging callback.
@@ -19,13 +19,6 @@ def logging_cb1(level, str, len):
#
-# 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
@@ -46,8 +39,8 @@ if status != 0:
exit(1)
-message = py_pjsua.Msg_Data()
-py_pjsua.msg_data_init(message)
+message = py_pjsua.msg_data_init()
+
print "identitas object message data :" + `message`
sipaddr = 'sip:167.205.34.99'
@@ -75,30 +68,29 @@ print "py status after 3 second of blocking wait :" + `status`
#
# lib transport
-stunc = py_pjsua.STUN_Config();
-py_pjsua.stun_config_default(stunc);
+stunc = py_pjsua.stun_config_default();
+
+
+tc = py_pjsua.transport_config_default();
-tc = py_pjsua.Transport_Config();
-py_pjsua.transport_config_default(tc);
py_pjsua.normalize_stun_config(stunc);
-id = py_pjsua.Transport_ID();
-status = py_pjsua.transport_create(1, tc, id);
+
+status, id = py_pjsua.transport_create(1, tc);
print "py transport create status " + `status`
-t_id = id.transport_id;
ti = py_pjsua.Transport_Info();
-status = py_pjsua.transport_get_info(t_id,ti)
+ti = py_pjsua.transport_get_info(id)
print "py transport get info status " + `status`
-status = py_pjsua.transport_set_enable(t_id,1)
+status = py_pjsua.transport_set_enable(id,1)
print "py transport set enable status " + `status`
if status != 0 :
py_pjsua.perror("py_pjsua","set enable",status)
-status = py_pjsua.transport_close(t_id,1)
+status = py_pjsua.transport_close(id,1)
print "py transport close status " + `status`
if status != 0 :
py_pjsua.perror("py_pjsua","close",status)
@@ -107,22 +99,44 @@ if status != 0 :
# lib account
-accfg = py_pjsua.Acc_Config()
-py_pjsua.acc_config_default(accfg)
-accid = py_pjsua.Acc_ID()
-status = py_pjsua.acc_add(accfg, 1, accid)
+accfg = py_pjsua.acc_config_default()
+status, accid = py_pjsua.acc_add(accfg, 1)
print "py acc add status " + `status`
if status != 0 :
py_pjsua.perror("py_pjsua","add acc",status)
count = py_pjsua.acc_get_count()
print "acc count " + `count`
-accid.acc_id = py_pjsua.acc_get_default()
+accid = py_pjsua.acc_get_default()
-print "acc id default " + `accid.acc_id`
+print "acc id default " + `accid`
# end of lib account
+#lib buddy
+
+bcfg = py_pjsua.Buddy_Config()
+status, id = py_pjsua.buddy_add(bcfg)
+print "py buddy add status " + `status` + " id " + `id`
+bool = py_pjsua.buddy_is_valid(id)
+print "py buddy is valid " + `bool`
+count = py_pjsua.get_buddy_count()
+print "buddy count " + `count`
+binfo = py_pjsua.buddy_get_info(id)
+ids = py_pjsua.enum_buddies(3)
+status = py_pjsua.buddy_del(id)
+print "py buddy del status " + `status`
+status = py_pjsua.buddy_subscribe_pres(id, 1)
+print "py buddy subscribe pres status " + `status`
+py_pjsua.pres_dump(1)
+status = py_pjsua.im_send(accid, "fahris@divusi.com", "", "hallo", message, 0)
+print "py im send status " + `status`
+status = py_pjsua.im_typing(accid, "fahris@divusi.com", 1, message)
+print "py im typing status " + `status`
+#print "binfo " + `binfo`
+
+#end of lib buddy
+
py_pjsua.perror("saya","hallo",70006)
status = py_pjsua.destroy()