1How-To send or update registrationsl.i(b3e)XoHsoiwp-2To send or update registrations.(3)
2
3
4
6 How-To send or update registrations. - eXosip2 offers a flexible API to
7 help you to register one or several identities.
8
9 Initiate a registration
10 To start a registration, you need to build a default REGISTER request
11 bby providing several mandatory headers
12
13 osip_message_t *reg = NULL;
14 int id;
15 int i;
16
17 eXosip_lock ();
18 id = eXosip_register_build_initial_register (identity, registrar, NULL,
19 1800, ®);
20 if (id < 0)
21 {
22 eXosip_unlock ();
23 return -1;
24 }
25
26 osip_message_set_supported (reg, '100rel');
27 osip_message_set_supported(reg, 'path');
28
29 i = eXosip_register_send_register (id, reg);
30 eXosip_unlock ();
31 return i;
32
33 The returned element of eXosip_register_build_initial_register is the
34 registration identifier that you can use to update your registration.
35 In future events about this registration, you'll see that registration
36 identifier when applicable.
37
38 Update a registration
39 You just need to reuse the registration identifier:
40
41 int i;
42
43 eXosip_lock ();
44 i = eXosip_register_build_register (id, 1800, ®);
45 if (i < 0)
46 {
47 eXosip_unlock ();
48 return -1;
49 }
50
51 eXosip_register_send_register (id, reg);
52 eXosip_unlock ();
53
54 Note: The above code also shows that the stack is sometimes able to
55 build and send a default SIP messages with only one API call
56
57 Closing the registration
58 A softphone should delete its registration on the SIP server when
59 terminating. To do so, you have to send a REGISTER request with the
60 expires header set to value '0'.
61
62 The same code as for updating a registration is used with 0 instead of
63 1800 for the expiration delay.
64
65
66
67Version 3.0.1 30 AugHo2w0-0T7o send or update registrations.(3)