Transcript eXosip

eXosip
Speaker: Ni-Ya Li
Outline
•
•
•
•
Overview
SIP Message
Function
Example
– Register
– Invite
• Reference
Overview
• oSIP
– An implementation of SIP
– Large APIs makes it rather complex and not
suitable for beginners
• eXosip
– Extend the capability of the oSIP library
– The API is enough flexible to control and complete
SIP messages
SIP Message
• Register
REGISTER
200 OK
SIP Message
• Invite
INVITE
100 Trying
180 Ringing
200 OK
ACK
Function - Initialize
• int eXosip_init(void)
– Initiate the eXtented oSIP library
• int eXosip_listen_addr(int transport, const
char *addr, int port, int family, int secure)
–
–
–
–
–
transport
addr
port
family
secure
IPPROTO_UDP for udp
the address to bind (NULL for all interface)
the listening port (0 for random port)
the IP family (AF_INET or AF_INET6)
0 for UDP or TCP, 1 for TLS (with TCP)
Function - Register
• int eXosip_register_build_initial_register(const
char *from, const char *proxy, const char
*contact, int expires, osip_message_t **reg)
–
–
–
–
–
from
proxy
contact
expires
reg
SIP url for caller.
Proxy used for registration.
Contact address. (optional)
The expires value for registration.
The SIP request to build.
Function - Register
• int eXosip_register_send_register(int rid,
osip_message_t *reg
– rid
– reg
A unique identifier for the registration
context
The SIP request to build. (NULL for default
REGISTER)
Function - Invite
• int eXosip_call_build_initial_invite
(osip_message_t **invite, const char *to,
const char *from, const char *route, const
char *subject)
–
–
–
–
–
Invite
to
from
route
subject
Pointer for the SIP element to hold.
SIP url for callee.
SIP url for caller.
Route header for INVITE. (optionnal)
Subject for the call
Function - Invite
• int osip_message_set_body (osip_message_t
* sip, const char *buf, size_t length)
– sip
The element to work on.
– buf
The buffer containing the body.
– length The length of the buffer
Function - Invite
• int osip_message_set_content_type
(osip_message_t * sip, const char *hvalue)
– sip
The element to work on.
– hvalue The string describing the element.
• eXosip_call_send_initial_invite (invite)
– Invite SIP INVITE message to send
Example - Register
Start
eXosip_init()
eXosip_listen_addr()
eXosip_register_build
_initial_register()
eXosip_register_send_
register()
End
Example - Invite
Start
eXosip_call_send
_initial_invite()
Register
eXosip_call_buil
d_initial_invite()
Flag=1?
No
End
osip_message_s
et_body()
osip_message_se
t_content_type()
Yes eXosip_event_w
ait()
No
case
EXOSIP_CALL_PR
OCEEDING
Yes
100 Trying
No
case
EXOSIP_CALL_RI
NGING
Yes
180 Ringing
No
case
EXOSIP_CALL_AN
SWERED
Yes
200 OK
Flag=0
Reference
• libeXosip2 Documentation
– http://www.antisip.com/doc/exosip2/index.html
• libosip Documentation
– http://www.gnu.org/software/osip/doc/html