Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

howto2_registration(3) [debian man page]

How-To send or update registrations.(3) 			    libeXosip2				   How-To send or update registrations.(3)

NAME
How-To send or update registrations. - eXosip2 offers a flexible API to help you to register one or several identities. Initiate a registration To start a registration, you need to build a default REGISTER request bby providing several mandatory headers osip_message_t *reg = NULL; int id; int i; eXosip_lock (); id = eXosip_register_build_initial_register (identity, registrar, NULL, 1800, &reg); if (id < 0) { eXosip_unlock (); return -1; } osip_message_set_supported (reg, '100rel'); osip_message_set_supported(reg, 'path'); i = eXosip_register_send_register (id, reg); eXosip_unlock (); return i; The returned element of eXosip_register_build_initial_register is the registration identifier that you can use to update your registration. In future events about this registration, you'll see that registration identifier when applicable. Update a registration You just need to reuse the registration identifier: int i; eXosip_lock (); i = eXosip_register_build_register (id, 1800, &reg); if (i < 0) { eXosip_unlock (); return -1; } eXosip_register_send_register (id, reg); eXosip_unlock (); Note: The above code also shows that the stack is sometimes able to build and send a default SIP messages with only one API call Closing the registration A softphone should delete its registration on the SIP server when terminating. To do so, you have to send a REGISTER request with the expires header set to value '0'. The same code as for updating a registration is used with 0 instead of 1800 for the expiration delay. Author Generated automatically by Doxygen for libeXosip2 from the source code. Version 3.1.0 Sun Jun 24 2012 How-To send or update registrations.(3)

Check Out this Related Man Page

How-To initiate, modify or terminate calls.(3)			    libeXosip2			    How-To initiate, modify or terminate calls.(3)

NAME
How-To initiate, modify or terminate calls. - eXosip2 offers a flexible API to help you controling calls. Initiate a call To start an outgoing call, you typically need a few headers which will be used by eXosip2 to build a default SIP INVITE request. The code below is used to start a call: osip_message_t *invite; int i; i = eXosip_call_build_initial_invite (&invite, '<sip:to@antisip.com>', '<sip:from@antisip.com>', NULL, // optional route header 'This is a call for a conversation'); if (i != 0) { return -1; } osip_message_set_supported (invite, '100rel'); { char tmp[4096]; char localip[128]; eXosip_guess_localip (AF_INET, localip, 128); snprintf (tmp, 4096, 'v=0 ' 'o=josua 0 0 IN IP4 %s ' 's=conversation ' 'c=IN IP4 %s ' 't=0 0 ' 'm=audio %s RTP/AVP 0 8 101 ' 'a=rtpmap:0 PCMU/8000 ' 'a=rtpmap:8 PCMA/8000 ' 'a=rtpmap:101 telephone-event/8000 ' 'a=fmtp:101 0-11 ', localip, localip, port); osip_message_set_body (invite, tmp, strlen (tmp)); osip_message_set_content_type (invite, 'application/sdp'); } eXosip_lock (); i = eXosip_call_send_initial_invite (invite); if (i > 0) { eXosip_call_set_reference (i, reference); } eXosip_unlock (); return i; The above code is using eXosip_call_build_initial_invite to build a default SIP INVITE request for a new call. You have to insert a SDP body announcing your audio parameter for the RTP stream. The above code also show the flexibility of the eXosip2 API which allow you to insert additionnal headers such as 'Supported: 100rel' (announcing support for a SIP extension). Thus you can enterely control the creation of SIP requests. The returned element of eXosip_call_send_initial_invite is the call identifier that you can use to send a CANCEL. In future events other than 100 Trying, you'll also get the dialog identifier that will also be needed to control established calls. eXosip_call_set_reference is also a mean to attach one of your own context to a call so that you'll get your pointer back in eXosip_event. Answer a call The code below is another example that teach you how to answer an incoming call. You'll usually need to send a '180 Ringing' SIP answer when receiving a SIP INVITE: eXosip_lock (); eXosip_call_send_answer (ca->tid, 180, NULL); eXosip_unlock (); Note: The above code also shows that the stack is sometimes able to build and send a default SIP messages with only one API call Then, when the user wants to answer the call, you'll need to send a 200 ok and insert a SDP body in your SIP answer: osip_message_t *answer = NULL; eXosip_lock (); i = eXosip_call_build_answer (ca->tid, 200, &answer); if (i != 0) { eXosip_call_send_answer (ca->tid, 400, NULL); } else { i = sdp_complete_200ok (ca->did, answer); if (i != 0) { osip_message_free (answer); eXosip_call_send_answer (ca->tid, 415, NULL); } else eXosip_call_send_answer (ca->tid, 200, answer); } eXosip_unlock (); Note: In the above code, you can note that to send a response to a request, you have to use the transaction identifier (and not a call identifier or a dialog identifier!) Note2: For sending a 200ok, you'll usually need to insert a SDP body in the answer and before this, to negotiate the parameters and codecs that you want to support. In the test tool, provided by eXosip2 (josua application), you'll find a very basic implementation of the SDP negotiation. Sending other request The call control API allows you to send and receive REFER, UPDATE, INFO, OPTIONS, NOTIFY and INVITEs whitin calls. A few limitations still exist for answering other requests within calls, but it should be already possible to send any kind of request. Here you have a code sample to send an INFO requests used to send an out of band dtmf within the signalling layer. osip_message_t *info; char dtmf_body[1000]; int i; eXosip_lock (); i = eXosip_call_build_info (ca->did, &info); if (i == 0) { snprintf (dtmf_body, 999, 'Signal=%c Duration=250 ', c); osip_message_set_content_type (info, 'application/dtmf-relay'); osip_message_set_body (info, dtmf_body, strlen (dtmf_body)); i = eXosip_call_send_request (ca->did, info); } eXosip_unlock (); Author Generated automatically by Doxygen for libeXosip2 from the source code. Version 3.1.0 Sun Jun 24 2012 How-To initiate, modify or terminate calls.(3)
Man Page