📄 exosip.h
字号:
/* eXosip - This is the eXtended osip library. Copyright (C) 2002, 2003 Aymeric MOIZARD - jack@atosc.org eXosip is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. eXosip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/#ifdef ENABLE_MPATROL#include <mpatrol.h>#endif#ifndef __EXOSIP_H__#define __EXOSIP_H__#include <osipparser2/osip_parser.h>#include <osip2/osip_negotiation.h>/** * @file eXosip.h * @brief eXosip API * * eXosip is a high layer library for rfc3261: the SIP protocol. * It has limited API and functionnalities to make it easy to use. * If you need complexity in your SIP applications, you may prefer * to use directly osip. * * eXosip capabilities: * REGISTER to handle mobility. * INVITE/BYE/OPTIONS to start/stop VoIP sessions. * re-INVITE to modify VoIP sessions (On-hold/Off-hold) * MESSAGE to send Instant Message. * SUBSCRIBE/NOTIFY to handle presence capabilities. * * <P> */#ifdef __cplusplusextern "C"{#endif/** * @defgroup eXosip eXosip Management * @ingroup eXosip * @{ *//** * Use IPv6 instead of IPv4. * * @param ipv6_enable This paramter should be set to 1 to enable IPv6. */void eXosip_enable_ipv6(int ipv6_enable);/** * Initiate the eXtented oSIP library. * * @param input command input (RESERVED FOR FUTUR USE). * @param output resulting output (RESERVED FOR FUTUR USE). * @param port The SIP port to use. (5060 is the default) */int eXosip_init(FILE *input, FILE *output, int port); /** * Force eXosip to use a specific local ip address in all its SIP message. * * @param localip the ip address. * * If set to NULL, then the local ip address will be guessed * automatically (returns to default mode). */int eXosip_force_localip(const char *localip); /** * Release ressource used by the eXtented oSIP library. * */void eXosip_quit(void);/** * Wake Up the eXosip_event_wait method. * */void __eXosip_wakeup_event(void);/** * This method is used to modify the sdp connection address * When you are behind a NAT. (EXPERIMENTAL) * */void eXosip_set_firewallip(const char *firewall_address);/** * Find the current localip (interface with default route). * ****DEPRECATED**** Use eXosip_guess_localip * * @param ip a string containing the local IP address. */void eXosip_get_localip(char *ip);/** * Find the current localip (interface with default route). * * @param family AF_INET or AF_INET6 * @param address a string containing the local IP address. * @param size The size of the string */int eXosip_guess_localip(int family, char *address, int size);/** * Find the interface to be used to reach the specified host. * * @param ip a string containing the local IP address. * @param localip the local ip address to be used to reach host. * * You usually don't need this function at all. */void eXosip_get_localip_for(char *host, char **localip);/** * Add authentication credentials. These are used when an outgoing * request comes back with an authorization required response. * * @param username username * @param userid not sure what this is for * @param passwd password * @param ha1 currently ignored * @param realm realm within which credentials apply, or NULL * to apply credentials to unrecognized realms */int eXosip_add_authentication_info(const char *username, const char *userid, const char *passwd, const char *ha1, const char *realm);/** * Remove an audio payload. * */void eXosip_sdp_negotiation_remove_audio_payloads(void);/** * Remove an audio payload. * * @param payload The payload * @param number_of_port The number of port * @param proto The protocol * @param c_nettype The connection type of network * @param c_addrtype The connection type of address * @param c_addr The connection address * @param c_addr_multicast_ttl The multicast TTL value * @param c_addr_multicast_int ? * @param a_rtpmap The rtpmap of element. */void eXosip_sdp_negotiation_add_codec(char *payload, char *number_of_port, char *proto, char *c_nettype, char *c_addrtype, char *c_addr, char *c_addr_multicast_ttl, char *c_addr_multicast_int, char *a_rtpmap);/** * Replace the internal SDP negociator facility. * * @param sn The new negociator context */int eXosip_sdp_negotiation_replace(osip_negotiation_t *sn);struct eXosip_call_t;/** * Set the reference element to be used in callback for the negociator. * This must be done only if eXosip_sdp_negotiation_replace has been * used and must not be done if this method has not been used. * * @param jc The related call. * @param sn The new negociator context. */void eXosip_sdp_negotiation_ctx_set_mycontext(struct eXosip_call_t *jc, void *arg);#define DEFAULT_MODE 2#define CALLBACK_MODE 1#define EVENT_MODE 2/** * Set the functionnal mode of eXosip. * The default mode is the EVENT_MODE. * * @param mode mode to use. */void eXosip_set_mode(int mode);/** * Set the SIP User-Agent: header string. */void eXosip_set_user_agent(const char *user_agent);/** * Lock the eXtented oSIP library. * */int eXosip_lock(void);/** * UnLock the eXtented oSIP library. * */int eXosip_unlock(void);/** @} *//** * @defgroup eXosip_call eXosip Call Management * @ingroup eXosip * @{ *//** * Build a default INVITE message for a new call. * * @param invite Pointer for the SIP element to hold. * @param to SIP url for callee. * @param from SIP url for caller. * @param route Route header for INVITE. (optionnal) * @param subject Subject for the call. */int eXosip_build_initial_invite(osip_message_t **invite, char *to, char *from, char *route, char *subject);/** * Initiate a call. * * @param invite SIP INVITE message to send. * @param reference Application context. (optionnal) * @param sdp_reference_context Sdp Application context. (optionnal) * @param local_sdp_port The port to be used for this call. */int eXosip_initiate_call (osip_message_t *invite, void *reference, void *sdp_context_reference, char *local_sdp_port);/** * Initiate a call with the specified body-type and body * * @param invite SIP INVITE message to send. * @param body_type body type (ex: "application/sdp") * @param body The body. */int eXosip_initiate_call_with_body (osip_message_t *invite, const char *body_type, const char *body);/** * Initiate a blind transfer outside of a call. * (probably not supported by many softphone...) * * @param refer_to SIP url for transfer. * @param from SIP url for caller. * @param to SIP url for callee. * @param route Route header for REFER. (optionnal) */int eXosip_transfer_call_out_of_dialog(char *refer_to, char *from, char *to, char *route);/** * Answer call. * * @param jid dialog id of call. * @param status Status code to use. */int eXosip_answer_call (int jid, int status, char *local_sdp_port);/** * Answer call. * * @param jid dialog id of call. * @param status Status code to use. * @param answer The resulting sip answer to send. */int eXosip2_answer (int jid, int status, osip_message_t **answer);/** * Answer call. * * @param jid dialog id of call. * @param answer The sip answer to send. */int eXosip2_answer_send(int jid, osip_message_t *answer);/** * Answer call with the specified body. * * @param jid dialog id of call. * @param status Status code to use. * @param body_type body type (ex: "application/sdp") * @param body The body. */int eXosip_answer_call_with_body (int jid, int status,const char *body_type, const char*body);/** * Set a new application context for an existing call * * @param jc Pointer to the call to modify * @param reference New application context. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -