1、exoSip+开发者手册exoSip 开发者手册本手册指导开发者利用exoSip 栈开发用户代理原文标题:exoSIP User Manual1 The eXtented eXosip stack.41.1 How-To initialize libeXosip2.41.2 How-To initiate, modify or terminate calls. .51.2.1 Initiate a call.61.2.2 Answer a call.71.2.3 Sending other request.81.3 How-To send or update registrations. .9
2、1.3.1 Initiate a registration .91.3.2 Update a registration .91.3.3 Closing the registration .102 General purpose API .112.1 eXosip2 configuration API.112.1.1 Functions.112.1.2 Function Documentation.112.2 eXosip2 network API .142.2.2 Functions.142.2.3 Function Documentation.142.3 eXosip2 event API
3、.162.3.1 Data Structures.162.3.2 Enumerations .162.3.3 Functions.172.3.4 Enumeration Type Documentation.172.3.5 Function Documentation.193 SIP messages and call control API .213.1 eXosip2 INVITE and Call Management.213.1.1 Functions.213.1.2 Function Documentation.223.2 eXosip2 request outside of dia
4、log .293.2.1 Functions.293.2.2 Function Documentation.293.3 eXosip2 OPTIONS and UA capabilities Management .313.3.1 Functions.313.3.2 Function Documentation.313.4 eXosip2 Publication Management .333.4.1 Functions.333.4.2 Function Documentation.333.5 eXosip2 REFER and blind tranfer Management outside
5、 of calls.353.5.1 Functions.353.5.2 Function Documentation.353.6 eXosip2 REGISTER and Registration Management .373.6.1 Functions.373.6.2 Function Documentation.373.7 eXosip2 SUBSCRIBE and outgoing subscriptions.393.7.1 Enumerations.393.7.2 Functions.393.7.3 Enumeration Type Documentation.403.7.4 Fun
6、ction Documentation.413.8 eXosip2 SUBSCRIBE and incoming subscriptions.433.8.1 Functions.433.8.2 Function Documentation.433.9 eXosip2 authentication API.463.9.1 Functions.463.9.2 Function Documentation.463.10 Xosip2 SDP helper API.483.10.1 Functions.483.10.2 Function Documentation.481 The eXtented e
7、Xosip stack1.1 How-To initialize libeXosip2.When using eXosip, your first task is to initialize both eXosip context and libosiplibrary (parser and state machines). This must be done prior to any use of libeXosip2.include int i;TRACE_INITIALIZE (6, stdout);i=eXosip_init();if (i!=0)return -1;i = eXosi
8、p_listen_addr (IPPROTO_UDP, NULL, port, AF_INET, 0);if (i!=0)eXosip_quit();fprintf (stderr, could not initialize transport layern);return -1;. then you have to send messages and wait for eXosip events.In the previous code, youve learned how to:? Initialize the osip trace (compile this code with -DEN
9、ABLE_TRACE)? Initialize eXosip (and osip) stack? 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_autom
10、atic_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 theoriginal request of the affected tra
11、nsaction and the last response that triggers theevent when available.You can access all headers from those messages and store them in your own contextfor other actions or graphic displays.For example, when you receive a REFER request for a call transfer, youll typicallyretreive the refer-To header:o
12、sip_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, incomingsubscriptions or outgoing subscriptions when applicable. Those i
13、dentifiers are used inAPI to control calls, registrations, incoming or outgoing subscriptions. These API willbuild default messages with usual SIP headers (From, To, Call-ID, CSeq, Route,Record-Route, Max-Forward.) and send thoses messages for you.1.2 How-To initiate, modify or terminate calls.eXosi
14、p2 offers a flexible API to help you controling calls.1.2.1 Initiate a callTo start an outgoing call, you typically need a few headers which will be used byeXosip2 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
15、_invite (&invite,NULL, / optionnal route headerThis is a call for aconversation);if (i != 0)return -1;osip_message_set_supported (invite, 100rel);char tmp4096;char localip128;eXosip_guess_localip (AF_INET, localip, 128);snprintf (tmp, 4096,v=0rno=josua 0 0 IN IP4 %srns=conversationrnc=IN IP4 %srnt=0 0rnm=audio %s RTP/AVP 0 8 101rna=rtpmap:0 PCMU/8000rna=rtpmap:8 PCMA/8000rna=rtpmap:101 telephone-event/800
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1