Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

howto0_initialize(3) [debian man page]

How-To initialize libeXosip2.(3)				    libeXosip2					  How-To initialize libeXosip2.(3)

NAME
How-To initialize libeXosip2. - When using eXosip, your first task is to initialize both eXosip context and libosip library (parser and state machines). This must be done prior to any use of libeXosip2. #include <eXosip2/eXosip.h> int i; TRACE_INITIALIZE (6, stdout); i=eXosip_init(); if (i!=0) return -1; i = eXosip_listen_addr (IPPROTO_UDP, NULL, port, AF_INET, 0); if (i!=0) { eXosip_quit(); fprintf (stderr, 'could not initialize transport layer '); return -1; } ... then you have to send messages and wait for eXosip events... In the previous code, you've learned how to: o Initialize the osip trace (compile this code with -DENABLE_TRACE) o Initialize eXosip (and osip) stack o Open a socket for signalling (only UDP with initial eXosip2 version) Now you have to handle eXosip events. Here is some code to get eXosip_event from the eXosip2 stack. eXosip_event_t *je; for (;;) { je = eXosip_event_wait (0, 50); eXosip_lock(); eXosip_automatic_action (); eXosip_unlock(); if (je == NULL) break; if (je->type == EXOSIP_CALL_NEW) { .... .... } else if (je->type == EXOSIP_CALL_ACK) { .... .... } else if (je->type == EXOSIP_CALL_ANSWERED) { .... .... } else ..... .... .... eXosip_event_free(je); } You will receive one event for each SIP message sent. Each event contains the original request of the affected transaction and the last response that triggers the event when available. You can access all headers from those messages and store them in your own context for other actions or graphic displays. For example, when you receive a REFER request for a call transfer, you'll typically retreive the 'refer-To' header: osip_header_t *referto_head = NULL; i = osip_message_header_get_byname (evt->sip, 'refer-to', 0, &referto_head); if (referto_head == NULL || referto_head->hvalue == NULL) The eXosip_event also contains identifiers for calls, registrations, incoming subscriptions or outgoing subscriptions when applicable. Those identifiers are used in API to control calls, registrations, incoming or outgoing subscriptions. These API will build default messages with usual SIP headers (From, To, Call-ID, CSeq, Route, Record-Route, Max-Forward...) and send thoses messages for you. Author Generated automatically by Doxygen for libeXosip2 from the source code. Version 3.1.0 Sun Jun 24 2012 How-To initialize libeXosip2.(3)

Check Out this Related Man Page

eXosip.h(3)							    libeXosip2							       eXosip.h(3)

NAME
eXosip.h - eXosip API SYNOPSIS
#include <eXosip2/eX_setup.h> #include <eXosip2/eX_register.h> #include <eXosip2/eX_call.h> #include <eXosip2/eX_options.h> #include <eXosip2/eX_subscribe.h> #include <eXosip2/eX_refer.h> #include <eXosip2/eX_message.h> #include <eXosip2/eX_publish.h> #include <osipparser2/osip_parser.h> #include <osipparser2/sdp_message.h> #include <time.h> Data Structures struct eXosip_event struct eXosip_tls_credentials_s struct eXosip_tls_ctx_s Typedefs typedef struct eXosip_event eXosip_event_t Enumerations enum eXosip_event_type { EXOSIP_REGISTRATION_NEW, EXOSIP_REGISTRATION_SUCCESS, EXOSIP_REGISTRATION_FAILURE, EXOSIP_REGISTRATION_REFRESHED, EXOSIP_REGISTRATION_TERMINATED, EXOSIP_CALL_INVITE, EXOSIP_CALL_REINVITE, EXOSIP_CALL_NOANSWER, EXOSIP_CALL_PROCEEDING, EXOSIP_CALL_RINGING, EXOSIP_CALL_ANSWERED, EXOSIP_CALL_REDIRECTED, EXOSIP_CALL_REQUESTFAILURE, EXOSIP_CALL_SERVERFAILURE, EXOSIP_CALL_GLOBALFAILURE, EXOSIP_CALL_ACK, EXOSIP_CALL_CANCELLED, EXOSIP_CALL_TIMEOUT, EXOSIP_CALL_MESSAGE_NEW, EXOSIP_CALL_MESSAGE_PROCEEDING, EXOSIP_CALL_MESSAGE_ANSWERED, EXOSIP_CALL_MESSAGE_REDIRECTED, EXOSIP_CALL_MESSAGE_REQUESTFAILURE, EXOSIP_CALL_MESSAGE_SERVERFAILURE, EXOSIP_CALL_MESSAGE_GLOBALFAILURE, EXOSIP_CALL_CLOSED, EXOSIP_CALL_RELEASED, EXOSIP_MESSAGE_NEW, EXOSIP_MESSAGE_PROCEEDING, EXOSIP_MESSAGE_ANSWERED, EXOSIP_MESSAGE_REDIRECTED, EXOSIP_MESSAGE_REQUESTFAILURE, EXOSIP_MESSAGE_SERVERFAILURE, EXOSIP_MESSAGE_GLOBALFAILURE, EXOSIP_SUBSCRIPTION_UPDATE, EXOSIP_SUBSCRIPTION_CLOSED, EXOSIP_SUBSCRIPTION_NOANSWER, EXOSIP_SUBSCRIPTION_PROCEEDING, EXOSIP_SUBSCRIPTION_ANSWERED, EXOSIP_SUBSCRIPTION_REDIRECTED, EXOSIP_SUBSCRIPTION_REQUESTFAILURE, EXOSIP_SUBSCRIPTION_SERVERFAILURE, EXOSIP_SUBSCRIPTION_GLOBALFAILURE, EXOSIP_SUBSCRIPTION_NOTIFY, EXOSIP_SUBSCRIPTION_RELEASED, EXOSIP_IN_SUBSCRIPTION_NEW, EXOSIP_IN_SUBSCRIPTION_RELEASED, EXOSIP_NOTIFICATION_NOANSWER, EXOSIP_NOTIFICATION_PROCEEDING, EXOSIP_NOTIFICATION_ANSWERED, EXOSIP_NOTIFICATION_REDIRECTED, EXOSIP_NOTIFICATION_REQUESTFAILURE, EXOSIP_NOTIFICATION_SERVERFAILURE, EXOSIP_NOTIFICATION_GLOBALFAILURE, EXOSIP_EVENT_COUNT } enum eXosip_tls_ctx_error { TLS_OK = 0, TLS_ERR_NO_RAND = -1, TLS_ERR_NO_DH_PARAM = -2, TLS_ERR_NO_PW = -3, TLS_ERR_NO_ROOT_CA = -4, TLS_ERR_MISSING_AUTH_PART = -5 } Functions int eXosip_add_authentication_info (const char *username, const char *userid, const char *passwd, const char *ha1, const char *realm) int eXosip_clear_authentication_info (void) int eXosip_default_action (eXosip_event_t *je) void eXosip_automatic_refresh (void) void eXosip_automatic_action (void) int eXosip_insubscription_automatic (eXosip_event_t *evt) int eXosip_generate_random (char *buf, int buf_size) sdp_message_t * eXosip_get_remote_sdp (int did) sdp_message_t * eXosip_get_local_sdp (int did) sdp_message_t * eXosip_get_previous_local_sdp (int did) sdp_message_t * eXosip_get_remote_sdp_from_tid (int tid) sdp_message_t * eXosip_get_local_sdp_from_tid (int tid) sdp_message_t * eXosip_get_sdp_info (osip_message_t *message) sdp_connection_t * eXosip_get_audio_connection (sdp_message_t *sdp) sdp_media_t * eXosip_get_audio_media (sdp_message_t *sdp) sdp_connection_t * eXosip_get_video_connection (sdp_message_t *sdp) sdp_media_t * eXosip_get_video_media (sdp_message_t *sdp) sdp_connection_t * eXosip_get_connection (sdp_message_t *sdp, const char *media) sdp_media_t * eXosip_get_media (sdp_message_t *sdp, const char *media) void eXosip_event_free (eXosip_event_t *je) eXosip_event_t * eXosip_event_wait (int tv_s, int tv_ms) eXosip_event_t * eXosip_event_get (void) int eXosip_event_geteventsocket (void) eXosip_tls_ctx_error eXosip_set_tls_ctx (eXosip_tls_ctx_t *ctx) eXosip_tls_ctx_error eXosip_tls_use_server_certificate (const char *local_certificate_cn) eXosip_tls_ctx_error eXosip_tls_use_client_certificate (const char *local_certificate_cn) eXosip_tls_ctx_error eXosip_tls_verify_certificate (int _tls_verify_client_certificate) Detailed Description eXosip API eXosip is a high layer library for rfc3261: the SIP protocol. It offers a simple API to make it easy to use. eXosip2 offers great flexibility for implementing SIP endpoint like: o SIP User-Agents o SIP Voicemail or IVR o SIP B2BUA o any SIP server acting as an endpoint (music server...) If you need to implement proxy or complex SIP applications, you should consider using osip instead. Here are the eXosip capabilities: REGISTER to handle registration. INVITE/BYE to start/stop VoIP sessions. INFO to send DTMF within a VoIP sessions. OPTIONS to simulate VoIP sessions. re-INVITE to modify VoIP sessions REFER/NOTIFY to transfer calls. MESSAGE to send Instant Message. SUBSCRIBE/NOTIFY to handle presence capabilities. any other request to handle what you want! Typedef Documentation eXosip_event_t Structure for event description. Author Generated automatically by Doxygen for libeXosip2 from the source code. Version 3.1.0 Sun Jun 24 2012 eXosip.h(3)
Man Page