OsipUA public API

Name

OsipUA public API -- The SIP user agent.

Synopsis


#include <osipua.h>


OsipUA*     osip_ua_new                     ();
int         osip_ua_set_contact             (OsipUA *ua,
                                             char *contact);
void        osip_ua_set_ip4addr             (OsipUA *ua,
                                             char *ip4addr,
                                             int port);
int         osip_ua_add_alias               (OsipUA *ua,
                                             char *contact);
int         osip_ua_remove_alias            (OsipUA *ua,
                                             char *contact);
void        osip_ua_clean_alias             (OsipUA *ua);
int         osip_ua_signal_connect          (OsipUA *ua,
                                             char *signal,
                                             OsipUACallbackFunc func);
int         osip_ua_set_outbound_proxy      (OsipUA *ua,
                                             char *proxy,
                                             char *passwd);
int         osip_ua_destroy                 (OsipUA *ua);

Description

The OsipUA object represents a SIP user agent. It can also be used for "endpoint servers" like conferencing servers or gateway servers. Once the user agent is created, then it is possible setup handlers for the application to be informed of the evolution of the call-legs managed by the user agent.

Details

osip_ua_new ()

OsipUA*     osip_ua_new                     ();

This function creates a user agent according to the parameters in params.

Returns :

a OsipUA object.


osip_ua_set_contact ()

int         osip_ua_set_contact             (OsipUA *ua,
                                             char *contact);

Set the official identity of the ua.

ua :

a user agent.

contact :

a sip uri.

Returns :

0


osip_ua_set_ip4addr ()

void        osip_ua_set_ip4addr             (OsipUA *ua,
                                             char *ip4addr,
                                             int port);

Set or change the ip address of a user agent.

ua :

a user agent.

ip4addr :

an ip address in the dot form (xxx.xxx.xxx.xxx).

port :


osip_ua_add_alias ()

int         osip_ua_add_alias               (OsipUA *ua,
                                             char *contact);

Add a new sip URI the user agent is supposed to respond. If an incoming request does not match the official contact or one of the uri in the alias list, then the ua answers 404 Not Found.

ua :

a user agent.

contact :

a sip uri.

Returns :

0 if added, -1 if the uri is bad-formuled.


osip_ua_remove_alias ()

int         osip_ua_remove_alias            (OsipUA *ua,
                                             char *contact);

Remove a contact uri from the ua list of alias.

ua :

a user agent.

contact :

a sip uri.

Returns :

0 if added, -1 if the uri is bad-formuled or was not in the list.


osip_ua_clean_alias ()

void        osip_ua_clean_alias             (OsipUA *ua);

ua: a user agent

Removes and free all alias contact from the user agent alias list.

ua :


osip_ua_signal_connect ()

int         osip_ua_signal_connect          (OsipUA *ua,
                                             char *signal,
                                             OsipUACallbackFunc func);

Setup a signal handler for one of the OsipUA signals: "INVITE" to be informed of new invites, "INVITE_ACCEPTED" to be informed of the acceptation of an outgoing invite, "FAILLURE" to be informed of the faillure of an outgoing request, "INFORMATIVE" to be informed a the progress of a call-leg.

ua :

a user agent.

signal :

the type of signal.

func :

a signal handler of type OsipUASignalHandler.

Returns :

0 if the signal handler was set, a negative value if not.


osip_ua_set_outbound_proxy ()

int         osip_ua_set_outbound_proxy      (OsipUA *ua,
                                             char *proxy,
                                             char *passwd);

Set a default proxy to use with a user agent. All requests will be sent to the proxy.

ua :

a user agent.

proxy :

the sip url of a proxy.

passwd :

the passwd to use to access the proxy, NULL if none.

Returns :


osip_ua_destroy ()

int         osip_ua_destroy                 (OsipUA *ua);

Destroy a user agent.

ua :

a user agent.

Returns :

0