Changes between Version 6 and Version 7 of pjsip-doc/account
- Timestamp:
- Feb 10, 2014 8:54:18 AM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
pjsip-doc/account
v6 v7 62 62 Creating Userless Accounts 63 63 -------------------------- 64 A userless account identifies a particular SIP endpoint rather than a particular user. Some other SIP softphones may call this peer-to-peer mode, which means that we are calling another computer via its address rather than calling a particular user ID. 64 A userless account identifies a particular SIP endpoint rather than a particular user. Some other SIP softphones may call this peer-to-peer mode, which means that we are calling another computer via its address rather than calling a particular user ID. For example, we might identify ourselves as "sip:192.168.0.15" (a userless account) rather than, say, "sip:alice@pjsip.org". 65 65 66 So for example, we might identify ourselves as "sip:192.168.0.15" (a userless account) rather than, say, "sip:alice@pjsip.org".66 In the lower layer PJSUA-LIB API, a userless account is associated with a SIP transport, and is created with ``pjsua_acc_add_local()`` API. This concept has been deprecated in PJSUA2, and rather, a userless account is a "normal" account with a userless ID URI (e.g. "sip:192.168.0.15") and without registration. Thus creating a userless account is exactly the same as creating "normal" account. 67 67 68 In pjsua, a userless account corresponds to a particular transport. Creating userless account is very simple, all we need is the transport ID which is returned by Endpoint.transportCreate() method as explained in previous chapter.69 70 Here's a snippet::71 72 AccountConfig acc_cfg;73 acc_cfg.sipConfig.transportId = tid;74 MyAccount *acc = new MyAccount;75 try {76 acc->create(acc_cfg);77 } catch(Error& err) {78 cout << "Account creation error: " << err.info() << endl;79 }80 81 Once the account is created, you can use the instance as a normal account. More will be explained later.82 83 Accounts created this way will have its URI derived from the transport address. For example, if the transport address is "192.168.0.15:5080", then the account's URI for UDP transport will be "sip:192.168.0.15:5080", or "sip:192.168.0.15:5080;transport=tcp" for TCP transport.84 68 85 69 Creating Account 86 70 ---------------- 87 For the "normal" account, we need to configure AccountConfig and call Account.create() to create the account. 71 We need to configure AccountConfig and call Account.create() to create the account. At the very minimum, pjsua only requires the account's ID, which is an URI to identify the account (or in SIP terms, it's called Address of Record/AOR). Here's a snippet: 88 72 89 At the very minimum, pjsua only requires the account's ID, which is an URI to identify the account (or in SIP terms, it's called Address of Record/AOR). Here's a snippet:: 73 .. code-block:: c++ 90 74 91 75 AccountConfig acc_cfg; 92 76 acc_cfg.idUri = "sip:test1@pjsip.org"; 77 93 78 MyAccount *acc = new MyAccount; 94 79 try { … … 100 85 The account created above doesn't do anything except to provide identity in the "From:" header for outgoing requests. The account will not register to SIP server or anything. 101 86 102 Typically you will want the account to authenticate and register to your SIP server so that you can receive incoming calls. To do that you will need to configure some more settings in your AccountConfig, something like this:: 87 Typically you will want the account to authenticate and register to your SIP server so that you can receive incoming calls. To do that you will need to configure some more settings in your AccountConfig, something like this: 88 89 .. code-block:: c++ 103 90 104 91 AccountConfig acc_cfg; 105 92 acc_cfg.idUri = "sip:test1@pjsip.org"; 106 93 acc_cfg.regConfig.registrarUri = "sip:pjsip.org"; 107 acc_cfg.sipConfig.authCreds.push_back( AuthCredInfo("digest", "*", "test1", 0, "test1") ); 94 acc_cfg.sipConfig.authCreds.push_back( AuthCredInfo("digest", "*", "test1", 0, "secret1") ); 95 108 96 MyAccount *acc = new MyAccount; 109 97 try { … … 132 120 Some of the operations to the Account object: 133 121 134 - add buddy objects135 - set account's presence online status136 - stop/start SIP registration122 - manage registration 123 - manage buddies/contacts 124 - manage presence online status 137 125 138 126 Please see the reference documentation for Account for more info. Calls, presence, and buddy will be explained in later chapters.