Changes between Version 4 and Version 5 of pjsip-doc/getting_started


Ignore:
Timestamp:
Feb 24, 2014 5:46:12 AM (11 years ago)
Author:
ming
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • pjsip-doc/getting_started

    v4 v5  
    102102Using in Python Application 
    103103=========================== 
    104  
     104The equivalence of the C++ sample code above in Python is as follows: 
     105 
     106.. code-block:: python 
     107 
     108  # Subclass to extend the Account and get notifications etc. 
     109  class Account(pj.Account): 
     110    def onRegState(self, prm): 
     111        print "***OnRegState: " + prm.reason 
     112 
     113  # pjsua2 test function 
     114  def pjsua2_test(): 
     115    # Create and initialize the library 
     116    ep_cfg = pj.EpConfig() 
     117    ep = pj.Endpoint() 
     118    ep.libCreate() 
     119    ep.libInit(ep_cfg) 
     120     
     121    # Create SIP transport. Error handling sample is shown 
     122    sipTpConfig = pj.TransportConfig(); 
     123    sipTpConfig.port = 5060; 
     124    ep.transportCreate(pj.PJSIP_TRANSPORT_UDP, sipTpConfig); 
     125    # Start the library 
     126    ep.libStart(); 
     127     
     128    acfg = pj.AccountConfig(); 
     129    acfg.idUri = "sip:test@pjsip.org"; 
     130    acfg.regConfig.registrarUri = "sip:pjsip.org"; 
     131    cred = pj.AuthCredInfo("digest", "*", "test", 0, "pwtest"); 
     132    acfg.sipConfig.authCreds.append( cred ); 
     133    # Create the account 
     134    acc = Account(); 
     135    acc.create(acfg); 
     136    # Here we don't have anything else to do.. 
     137    time.sleep(10); 
     138 
     139    # Destroy the library 
     140    ep.libDestroy() 
     141 
     142  # 
     143  # main() 
     144  # 
     145  if __name__ == "__main__": 
     146    pjsua2_test() 
    105147 
    106148 
    107149Using in Java Application 
    108150========================= 
     151The equivalence of the C++ sample code above in Java is as follows: 
    109152 
    110153.. code-block:: java 
     
    112155  import org.pjsip.pjsua2.*; 
    113156 
     157  // Subclass to extend the Account and get notifications etc. 
    114158  class MyAccount extends Account { 
    115159    @Override