Ignore:
Timestamp:
Dec 4, 2006 8:33:20 AM (17 years ago)
Author:
bennylp
Message:

Updated Python abstraction with transport and account API

File:
1 edited

Legend:

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

    r824 r845  
    7575# 
    7676 
     77# lib transport 
     78stunc = py_pjsua.STUN_Config(); 
     79py_pjsua.stun_config_default(stunc); 
     80 
     81tc = py_pjsua.Transport_Config(); 
     82py_pjsua.transport_config_default(tc); 
     83 
     84py_pjsua.normalize_stun_config(stunc); 
     85 
     86id = py_pjsua.Transport_ID(); 
     87status = py_pjsua.transport_create(1, tc, id); 
     88print "py transport create status " + `status` 
     89 
     90t_id = id.transport_id; 
     91ti = py_pjsua.Transport_Info(); 
     92status = py_pjsua.transport_get_info(t_id,ti) 
     93print "py transport get info status " + `status` 
     94 
     95status = py_pjsua.transport_set_enable(t_id,1) 
     96print "py transport set enable status " + `status` 
     97if status != 0 : 
     98        py_pjsua.perror("py_pjsua","set enable",status) 
     99 
     100 
     101status = py_pjsua.transport_close(t_id,1) 
     102print "py transport close status " + `status` 
     103if status != 0 : 
     104        py_pjsua.perror("py_pjsua","close",status) 
     105 
     106# end of lib transport 
     107 
     108# lib account  
     109 
     110accfg = py_pjsua.Acc_Config() 
     111py_pjsua.acc_config_default(accfg) 
     112accid = py_pjsua.Acc_ID() 
     113status = py_pjsua.acc_add(accfg, 1, accid) 
     114print "py acc add status " + `status` 
     115if status != 0 : 
     116        py_pjsua.perror("py_pjsua","add acc",status) 
     117count = py_pjsua.acc_get_count() 
     118print "acc count " + `count` 
     119 
     120accid.acc_id = py_pjsua.acc_get_default() 
     121 
     122print "acc id default " + `accid.acc_id` 
     123 
     124# end of lib account 
     125 
    77126py_pjsua.perror("saya","hallo",70006) 
    78127 
Note: See TracChangeset for help on using the changeset viewer.