Ignore:
Timestamp:
Dec 9, 2006 12:39:42 AM (17 years ago)
Author:
bennylp
Message:

First update on buddy API

File:
1 edited

Legend:

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

    r845 r851  
    88# Create configuration objects 
    99# 
    10 ua_cfg = py_pjsua.Config() 
    11 log_cfg = py_pjsua.Logging_Config() 
    12 media_cfg = py_pjsua.Media_Config() 
     10ua_cfg = py_pjsua.config_default() 
     11log_cfg = py_pjsua.logging_config_default() 
     12media_cfg = py_pjsua.media_config_default() 
    1313 
    1414# 
     
    1818    print str, 
    1919 
    20  
    21 # 
    22 # Initialize configs with default values. 
    23 # 
    24 py_pjsua.config_default(ua_cfg) 
    25 py_pjsua.logging_config_default(log_cfg) 
    26 py_pjsua.media_config_default(media_cfg) 
    2720 
    2821# 
     
    4740 
    4841 
    49 message = py_pjsua.Msg_Data() 
    50 py_pjsua.msg_data_init(message) 
     42message = py_pjsua.msg_data_init() 
     43 
    5144print "identitas object message data :" + `message` 
    5245 
     
    7669 
    7770# lib transport 
    78 stunc = py_pjsua.STUN_Config(); 
    79 py_pjsua.stun_config_default(stunc); 
     71stunc = py_pjsua.stun_config_default(); 
    8072 
    81 tc = py_pjsua.Transport_Config(); 
    82 py_pjsua.transport_config_default(tc); 
     73 
     74tc = py_pjsua.transport_config_default(); 
     75 
    8376 
    8477py_pjsua.normalize_stun_config(stunc); 
    8578 
    86 id = py_pjsua.Transport_ID(); 
    87 status = py_pjsua.transport_create(1, tc, id); 
     79 
     80status, id = py_pjsua.transport_create(1, tc); 
    8881print "py transport create status " + `status` 
    8982 
    90 t_id = id.transport_id; 
    9183ti = py_pjsua.Transport_Info(); 
    92 status = py_pjsua.transport_get_info(t_id,ti) 
     84ti = py_pjsua.transport_get_info(id) 
    9385print "py transport get info status " + `status` 
    9486 
    95 status = py_pjsua.transport_set_enable(t_id,1) 
     87status = py_pjsua.transport_set_enable(id,1) 
    9688print "py transport set enable status " + `status` 
    9789if status != 0 : 
     
    9991 
    10092 
    101 status = py_pjsua.transport_close(t_id,1) 
     93status = py_pjsua.transport_close(id,1) 
    10294print "py transport close status " + `status` 
    10395if status != 0 : 
     
    108100# lib account  
    109101 
    110 accfg = py_pjsua.Acc_Config() 
    111 py_pjsua.acc_config_default(accfg) 
    112 accid = py_pjsua.Acc_ID() 
    113 status = py_pjsua.acc_add(accfg, 1, accid) 
     102accfg = py_pjsua.acc_config_default() 
     103status, accid = py_pjsua.acc_add(accfg, 1) 
    114104print "py acc add status " + `status` 
    115105if status != 0 : 
     
    118108print "acc count " + `count` 
    119109 
    120 accid.acc_id = py_pjsua.acc_get_default() 
     110accid = py_pjsua.acc_get_default() 
    121111 
    122 print "acc id default " + `accid.acc_id` 
     112print "acc id default " + `accid` 
    123113 
    124114# end of lib account 
     115 
     116#lib buddy 
     117 
     118bcfg = py_pjsua.Buddy_Config() 
     119status, id = py_pjsua.buddy_add(bcfg) 
     120print "py buddy add status " + `status` + " id " + `id` 
     121bool = py_pjsua.buddy_is_valid(id) 
     122print "py buddy is valid " + `bool` 
     123count = py_pjsua.get_buddy_count() 
     124print "buddy count " + `count` 
     125binfo = py_pjsua.buddy_get_info(id) 
     126ids = py_pjsua.enum_buddies(3) 
     127status = py_pjsua.buddy_del(id) 
     128print "py buddy del status " + `status` 
     129status = py_pjsua.buddy_subscribe_pres(id, 1) 
     130print "py buddy subscribe pres status " + `status` 
     131py_pjsua.pres_dump(1) 
     132status = py_pjsua.im_send(accid, "fahris@divusi.com", "", "hallo", message, 0) 
     133print "py im send status " + `status` 
     134status = py_pjsua.im_typing(accid, "fahris@divusi.com", 1, message) 
     135print "py im typing status " + `status` 
     136#print "binfo " + `binfo` 
     137 
     138#end of lib buddy 
    125139 
    126140py_pjsua.perror("saya","hallo",70006) 
Note: See TracChangeset for help on using the changeset viewer.