rel 3.3.4

This commit is contained in:
Thomas Ries
2003-08-05 17:33:01 +00:00
parent de208ab818
commit b6b97c0c46
16 changed files with 290 additions and 351 deletions

View File

@@ -1,3 +1,10 @@
0.3.4
=====
05-Aug-2003: - released 0.3.4
31-Jul-2003: - now supports only OSIP2 only (due to rather big changes
in the API libosip -> libosip2). Compiles cleanly w/
libosip2 2.0.2
0.3.3
=====
05-Jul-2003: - released 0.3.3

View File

@@ -1,4 +1,4 @@
Release Notes for siproxd-0.3.3
Release Notes for siproxd-0.3.4
===============================
- Fli4l OPT_SIP (still experimental) available, check
@@ -27,10 +27,9 @@ Release Notes for siproxd-0.3.3
need this 'feature'.
Requirements:
- pthreads
- pthreads (Linux)
- glibc2 / libc5 / uClibc
- builds with libosip>0.8.8 / libosip2
- prebuild binaries (RPMs) require libosip2 to be installed
- libosip2 (libosip1 is no longer supported!)
Currently tested on:
- Redhat 6.0 (Kernel 2.2.x, Glibc)
@@ -50,24 +49,15 @@ Reported interoperability (tested with softphones):
- MSN messenger 4.6 (remote and local UA)
Known bugs:
- with kphone 3.1 & libosip-0.*, authentication does NOT work at
all (due to 'parse error' in libosip) - use libosip2, this works fine
-----
md5sum for siproxd-0.3.3.tar.gz: 110651cb3a7ad9b2cabc598d83a7bc4d
md5sum for siproxd-0.3.3-1rh60.i386.rpm:ba1cf809e14241b4e3b979b2c7173e10
md5sum for siproxd-0.3.3-1rh72.i386.rpm:
md5sum for siproxd-0.3.3-1.src.rpm: 5b7275c714ca51f14b9df26c4d123dab
md5sum for siproxd-0.3.4.tar.gz:
md5sum for siproxd-0.3.4-1rh60.i386.rpm:
md5sum for siproxd-0.3.4-1rh72.i386.rpm:
md5sum for siproxd-0.3.4-1.src.rpm:
GnuPG signature for siproxd-0.3.3.tar.gz archive:
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQA/BwNECfzBioe83JQRAto5AJ9RDVpGHO3exzFz99/TAEuAS54H9gCguaU+
8AzD82Zpj2szGh2dWp+LOCk=
=WGag
-----END PGP SIGNATURE-----
GnuPG signature for siproxd-0.3.4.tar.gz archive:

View File

@@ -117,6 +117,12 @@
/* Define if you have the <varargs.h> header file. */
#undef HAVE_VARARGS_H
/* Define if you have the osip2 library (-losip2). */
#undef HAVE_LIBOSIP2
/* Define if you have the osipparser2 library (-losipparser2). */
#undef HAVE_LIBOSIPPARSER2
/* Name of package */
#undef PACKAGE
@@ -144,12 +150,6 @@
/* building on NetBSD platform */
#undef _NETBSD
/* type of libosip */
#undef LIBOSIPVER
/* have osip2 installed */
#undef HAVE_OSIP2
/* Define to the necessary symbol if this constant
uses a non-standard name on your system. */
#undef PTHREAD_CREATE_JOINABLE

View File

@@ -11,7 +11,8 @@ dnl --enable-uclibc (uClibc building support)
dnl 29-Mar-2003 tries added support for libosip2
dnl 6-Apr-2003 tries redone the fli4l specific build options
dnl now: --enable-fli4l-libc5, --enable-fli4l-uclibc
dnl 7-Apr-2003 tries added siproxd.spex to autoconf process
dnl 7-Apr-2003 tries added siproxd.spec to autoconf process
dnl 31-Jul-2003 tries changed to support OSIP2 only
dnl
dnl
dnl
@@ -27,7 +28,7 @@ dnl Release Version
dnl
SPD_MAJOR_VERSION=0
SPD_MINOR_VERSION=3
SPD_MICRO_VERSION=3
SPD_MICRO_VERSION=4
SPD_VERSION=$SPD_MAJOR_VERSION.$SPD_MINOR_VERSION.$SPD_MICRO_VERSION
@@ -168,32 +169,29 @@ fi
dnl
dnl Check for libosip
dnl
osiplib=osip
have_osip2=no
AC_MSG_CHECKING("force to use libosip1")
AC_ARG_ENABLE(force-osip1,
[ --enable-force-osip1 force the use of libosip1],
AC_MSG_RESULT("yes"),
AC_MSG_RESULT("no")
dnl do we have libosip2 available?
AC_CHECK_LIB(osip2, main,
[osiplib=osip2 have_osip2=yes], )
)
AC_DEFINE_UNQUOTED(LIBOSIPVER, ["$osiplib"], [type of libosip])
if test "x$have_osip2" = "xyes"; then
AC_DEFINE(HAVE_OSIP2, , [have osip2 installed])
fi
if test "x$build_static_libosip" = "xno"; then
dnl link dynamically (default)
AC_CHECK_LIB($osiplib, parser_init,,
echo "*** ERROR: libosip is required!";exit 1;)
AC_CHECK_LIB(osip2, osip_init,,
echo "*** ERROR: libosip2 is required!";exit 1;,
[-losipparser2])
AC_CHECK_LIB(osipparser2, parser_init,,
echo "*** ERROR: libosipparser2 is required!";exit 1;,
[-losip2])
else
dnl link statically to this lib
dnl (this probably only will work on linux yet...)
AC_MSG_CHECKING("where I can find lib$osiplib.a")
AC_MSG_CHECKING("where I can find libosip2.a")
libosip_static=`find $extra_libs /lib /usr/lib /usr/local/lib \
-name lib$osiplib.a 2>/dev/null|head -1`
-name libosip2.a 2>/dev/null|head -1`
if test "x$libosip_static" != "x"; then
LIBS="$libosip_static $LIBS"
AC_MSG_RESULT($libosip_static)
else
echo "*** ERROR: a static libosip library is required!";exit 1;
fi
AC_MSG_CHECKING("where I can find libosipparser2.a")
libosip_static=`find $extra_libs /lib /usr/lib /usr/local/lib \
-name libosipparser2.a 2>/dev/null|head -1`
if test "x$libosip_static" != "x"; then
LIBS="$libosip_static $LIBS"
AC_MSG_RESULT($libosip_static)

View File

@@ -26,11 +26,7 @@
#include <sys/types.h>
#include <netinet/in.h>
#ifdef HAVE_OSIP2
#include <osip2/smsg.h>
#else
#include <osip/smsg.h>
#endif
#include <osipparser2/osip_parser.h>
#include "siproxd.h"
#include "log.h"

View File

@@ -29,17 +29,9 @@
#include <netinet/in.h>
#ifdef HAVE_OSIP2
#include <osip2/smsg.h>
#include <osip2/port.h>
#include <osip2/global.h>
#include <osip2/md5.h>
#else
#include <osip/smsg.h>
#include <osip/port.h>
#include <osip/global.h>
#include <osip/md5.h>
#endif
#include <osipparser2/osip_parser.h>
#include <osipparser2/osip_port.h>
#include <osipparser2/osip_md5.h>
#include "digcalc.h"
@@ -54,7 +46,7 @@ extern struct siproxd_config configuration;
/* local protorypes */
static char *auth_generate_nonce(void);
static int auth_check(proxy_authorization_t *proxy_auth);
static int auth_check(osip_proxy_authorization_t *proxy_auth);
static char *auth_getpwd(char *username);
/*
@@ -65,8 +57,8 @@ static char *auth_getpwd(char *username);
* STS_FAILURE : authentication failed
* STS_NEEDAUTH: authentication needed
*/
int authenticate_proxy(sip_t *request) {
proxy_authorization_t *proxy_auth;
int authenticate_proxy(osip_message_t *request) {
osip_proxy_authorization_t *proxy_auth;
/* required by config? */
if (configuration.proxy_auth_realm == NULL) {
@@ -74,7 +66,7 @@ int authenticate_proxy(sip_t *request) {
}
/* supplied by UA? */
msg_getproxy_authorization(request, 0, &proxy_auth);
osip_message_get_proxy_authorization(request, 0, &proxy_auth);
if (proxy_auth == NULL) {
DEBUGC(DBCLASS_AUTH,"proxy-auth required, not supplied by UA");
return STS_NEED_AUTH;
@@ -98,19 +90,19 @@ int authenticate_proxy(sip_t *request) {
* STS_SUCCESS
* STS_FAILURE
*/
int auth_include_authrq(sip_t *response) {
proxy_authenticate_t *p_auth;
int auth_include_authrq(osip_message_t *response) {
osip_proxy_authenticate_t *p_auth;
if (proxy_authenticate_init(&p_auth) != 0) {
if (osip_proxy_authenticate_init(&p_auth) != 0) {
ERROR("proxy_authenticate_init failed");
return STS_FAILURE;
}
proxy_authenticate_setauth_type(p_auth, sgetcopy("Digest"));
proxy_authenticate_setnonce(p_auth, sgetcopy(auth_generate_nonce()));
proxy_authenticate_setrealm(p_auth, sgetcopy(configuration.proxy_auth_realm));
osip_proxy_authenticate_set_auth_type(p_auth, osip_strdup("Digest"));
osip_proxy_authenticate_set_nonce(p_auth, osip_strdup(auth_generate_nonce()));
osip_proxy_authenticate_set_realm(p_auth, osip_strdup(configuration.proxy_auth_realm));
list_add (response->proxy_authenticates, p_auth, -1);
osip_list_add (response->proxy_authenticates, p_auth, -1);
DEBUGC(DBCLASS_AUTH,"added authentication header");
@@ -144,7 +136,7 @@ static char *auth_generate_nonce() {
* STS_SUCCESS if succeeded
* STS_FAILURE if failed
*/
static int auth_check(proxy_authorization_t *proxy_auth) {
static int auth_check(osip_proxy_authorization_t *proxy_auth) {
char *password=NULL;
int sts;
@@ -163,28 +155,28 @@ static int auth_check(proxy_authorization_t *proxy_auth) {
/* if item exists, allocate& copy string without quotes */
if (proxy_auth->username)
Username=sgetcopy_unquoted_string(proxy_auth->username);
Username=osip_strdup_without_quote(proxy_auth->username);
if (proxy_auth->realm)
Realm=sgetcopy_unquoted_string(proxy_auth->realm);
Realm=osip_strdup_without_quote(proxy_auth->realm);
if (proxy_auth->nonce)
Nonce=sgetcopy_unquoted_string(proxy_auth->nonce);
Nonce=osip_strdup_without_quote(proxy_auth->nonce);
if (proxy_auth->cnonce)
CNonce=sgetcopy_unquoted_string(proxy_auth->cnonce);
CNonce=osip_strdup_without_quote(proxy_auth->cnonce);
if (proxy_auth->nonce_count)
NonceCount=sgetcopy_unquoted_string(proxy_auth->nonce_count);
NonceCount=osip_strdup_without_quote(proxy_auth->nonce_count);
if (proxy_auth->message_qop)
Qpop=sgetcopy_unquoted_string(proxy_auth->message_qop);
Qpop=osip_strdup_without_quote(proxy_auth->message_qop);
if (proxy_auth->uri)
Uri=sgetcopy_unquoted_string(proxy_auth->uri);
Uri=osip_strdup_without_quote(proxy_auth->uri);
if (proxy_auth->response)
Response=sgetcopy_unquoted_string(proxy_auth->response);
Response=osip_strdup_without_quote(proxy_auth->response);
/* get password */
if (configuration.proxy_auth_pwfile) {

View File

@@ -29,13 +29,8 @@
#include <arpa/inet.h>
#include <netdb.h>
#ifdef HAVE_OSIP2
#include <osip2/smsg.h>
#include <osip2/sdp.h>
#else
#include <osip/smsg.h>
#include <osip/sdp.h>
#endif
#include <osipparser2/osip_parser.h>
#include <osipparser2/sdp_message.h>
#include "siproxd.h"
#include "log.h"
@@ -60,13 +55,13 @@ extern int sip_socket; /* sending SIP datagrams */
* STS_SUCCESS on success
* STS_FAILURE on error
*/
int proxy_request (sip_t *request) {
int proxy_request (osip_message_t *request) {
int i;
int sts;
int type;
struct in_addr sendto_addr;
contact_t *contact;
url_t *url;
osip_contact_t *contact;
osip_uri_t *url;
int port;
char *buffer;
@@ -119,10 +114,10 @@ int proxy_request (sip_t *request) {
This issue has been fixed in 0.9.1pre1
*/
{
header_t *header_ua;
osip_header_t *header_ua;
url=msg_geturi(request);
msg_getuser_agent(request,0,&header_ua);
url=osip_message_get_uri(request);
osip_message_get_user_agent(request,0,&header_ua);
if ( header_ua && header_ua->hvalue &&
(strcmp(header_ua->hvalue,"oSIP/Linphone-0.8.0")==0) ) {
@@ -167,10 +162,11 @@ int proxy_request (sip_t *request) {
if (MSG_IS_BYE(request) || MSG_IS_CANCEL(request)) {
#ifdef MOREDEBUG /*&&&&*/
INFO("stopping RTP proxy stream for: %s@%s",
msg_getcall_id(request)->number, msg_getcall_id(request)->host);
osip_message_get_call_id(request)->number,
osip_message_get_call_id(request)->host);
#endif
/* stop the RTP proxying stream */
rtp_stop_fwd(msg_getcall_id(request), 0);
rtp_stop_fwd(osip_message_get_call_id(request), 0);
}
break;
@@ -180,7 +176,7 @@ INFO("stopping RTP proxy stream for: %s@%s",
*/
case REQTYP_OUTGOING:
/* get destination address */
url=msg_geturi(request);
url=osip_message_get_uri(request);
sts = get_ip_by_host(url->host, &sendto_addr);
if (sts == STS_FAILURE) {
@@ -193,7 +189,7 @@ INFO("stopping RTP proxy stream for: %s@%s",
* method that I as a proxy do not support. Reject */
if (is_sipuri_local(request) == STS_TRUE) {
WARN("unsupported request [%s] directed to proxy from %s@%s -> %s@%s",
request->strtline->sipmethod? request->strtline->sipmethod:"*NULL*",
request->sip_method? request->sip_method:"*NULL*",
request->from->url->username? request->from->url->username:"*NULL*",
request->from->url->host? request->from->url->host : "*NULL*",
url->username? url->username : "*NULL*",
@@ -210,7 +206,7 @@ INFO("stopping RTP proxy stream for: %s@%s",
}
/* rewrite Contact header to represent the masqued address */
msg_getcontact(request,0,&contact);
osip_message_get_contact(request,0,&contact);
if (contact != NULL) {
for (i=0;i<URLMAP_SIZE;i++){
if (urlmap[i].active == 0) continue;
@@ -219,18 +215,21 @@ INFO("stopping RTP proxy stream for: %s@%s",
}
/* found a mapping entry */
if (i<URLMAP_SIZE) {
char *tmp;
DEBUGC(DBCLASS_PROXY, "rewrote Contact header %s@%s -> %s@%s",
(contact->url->username)? contact->url->username : "*NULL*",
(contact->url->host)? contact->url->host : "*NULL*",
urlmap[i].masq_url->username, urlmap[i].masq_url->host);
/* remove old entry */
list_remove(request->contacts,0);
contact_free(contact);
free(contact);
osip_list_remove(request->contacts,0);
osip_contact_to_str(contact, &tmp);
osip_contact_free(contact);
/* clone the masquerading url */
contact_init(&contact);
url_clone(urlmap[i].masq_url, &contact->url);
list_add(request->contacts,contact,-1);
osip_contact_init(&contact);
osip_contact_parse(contact,tmp);
osip_uri_free(contact->url);
osip_uri_clone(urlmap[i].masq_url, &contact->url);
osip_list_add(request->contacts,contact,-1);
}
}
@@ -242,16 +241,16 @@ INFO("stopping RTP proxy stream for: %s@%s",
/* if this is CANCEL/BYE request, stop RTP proxying */
if (MSG_IS_BYE(request) || MSG_IS_CANCEL(request)) {
rtp_stop_fwd(msg_getcall_id(request), 0);
rtp_stop_fwd(osip_message_get_call_id(request), 0);
}
break;
default:
url=msg_geturi(request);
url=osip_message_get_uri(request);
DEBUGC(DBCLASS_PROXY, "request [%s] from/to unregistered UA "
"(RQ: %s@%s -> %s@%s)",
request->strtline->sipmethod? request->strtline->sipmethod:"*NULL*",
request->sip_method? request->sip_method:"*NULL*",
request->from->url->username? request->from->url->username:"*NULL*",
request->from->url->host? request->from->url->host : "*NULL*",
url->username? url->username : "*NULL*",
@@ -275,9 +274,9 @@ INFO("stopping RTP proxy stream for: %s@%s",
}
sts = msg_2char(request, &buffer);
sts = osip_message_to_str(request, &buffer);
if (sts != 0) {
ERROR("proxy_request: msg_2char failed");
ERROR("proxy_request: osip_message_to_str failed");
return STS_FAILURE;
}
@@ -289,7 +288,7 @@ INFO("stopping RTP proxy stream for: %s@%s",
}
sipsock_send_udp(&sip_socket, sendto_addr, port, buffer, strlen(buffer), 1);
free (buffer);
osip_free (buffer);
return STS_SUCCESS;
}
@@ -301,13 +300,13 @@ INFO("stopping RTP proxy stream for: %s@%s",
* STS_SUCCESS on success
* STS_FAILURE on error
*/
int proxy_response (sip_t *response) {
int proxy_response (osip_message_t *response) {
int i;
int sts;
int type;
struct in_addr addr;
via_t *via;
contact_t *contact;
osip_via_t *via;
osip_contact_t *contact;
int port;
char *buffer;
@@ -383,13 +382,13 @@ int proxy_response (sip_t *response) {
case RESTYP_OUTGOING:
#define satoi atoi /* used in MSG_TEST_CODE macro ... */
/* If an 200 answer to an INVITE request, rewrite body */
if ((MSG_IS_RESPONSEFOR(response,"INVITE")) &&
if ((MSG_IS_RESPONSE_FOR(response,"INVITE")) &&
(MSG_TEST_CODE(response, 200))) {
sts = proxy_rewrite_invitation_body(response);
}
/* rewrite Contact header to represent the masqued address */
msg_getcontact(response,0,&contact);
osip_message_get_contact(response,0,&contact);
if (contact != NULL) {
for (i=0;i<URLMAP_SIZE;i++){
if (urlmap[i].active == 0) continue;
@@ -403,13 +402,12 @@ int proxy_response (sip_t *response) {
(contact->url->host) ? contact->url->host : "*NULL*",
urlmap[i].masq_url->username, urlmap[i].masq_url->host);
/* remove old entry */
list_remove(response->contacts,0);
contact_free(contact);
free(contact);
osip_list_remove(response->contacts,0);
osip_contact_free(contact);
/* clone the masquerading url */
contact_init(&contact);
url_clone(urlmap[i].masq_url, &contact->url);
list_add(response->contacts,contact,-1);
osip_contact_init(&contact);
osip_uri_clone(urlmap[i].masq_url, &contact->url);
osip_list_add(response->contacts,contact,-1);
}
}
@@ -423,7 +421,7 @@ int proxy_response (sip_t *response) {
}
/* get target address from VIA header */
via = (via_t *) list_get (response->vias, 0);
via = (osip_via_t *) osip_list_get (response->vias, 0);
if (via == NULL) {
ERROR("proxy_response: list_get via failed");
return STS_FAILURE;
@@ -436,9 +434,9 @@ int proxy_response (sip_t *response) {
return STS_FAILURE;
}
sts = msg_2char(response, &buffer);
sts = osip_message_to_str(response, &buffer);
if (sts != 0) {
ERROR("proxy_response: msg_2char failed");
ERROR("proxy_response: osip_message_to_str failed");
return STS_FAILURE;
}
@@ -450,7 +448,7 @@ int proxy_response (sip_t *response) {
}
sipsock_send_udp(&sip_socket, addr, port, buffer, strlen(buffer), 1);
free (buffer);
osip_free (buffer);
return STS_SUCCESS;
}
@@ -464,9 +462,9 @@ int proxy_response (sip_t *response) {
* STS_SUCCESS on success
* STS_FAILURE on error
*/
int proxy_rewrite_invitation_body(sip_t *mymsg){
body_t *body;
sdp_t *sdp;
int proxy_rewrite_invitation_body(osip_message_t *mymsg){
osip_body_t *body;
sdp_message_t *sdp;
struct in_addr outb_addr, lcl_clnt_addr;
int sts;
char *bodybuff;
@@ -479,16 +477,16 @@ int proxy_rewrite_invitation_body(sip_t *mymsg){
/*
* get SDP structure
*/
sts = msg_getbody(mymsg, 0, &body);
sts = osip_message_get_body(mymsg, 0, &body);
if (sts != 0) {
ERROR("rewrite_invitation_body: no body found in message");
return STS_FAILURE;
}
sts = body_2char(body, &bodybuff);
sts = sdp_init(&sdp);
sts = sdp_parse (sdp, bodybuff);
free(bodybuff);
sts = osip_body_to_str(body, &bodybuff);
sts = sdp_message_init(&sdp);
sts = sdp_message_parse (sdp, bodybuff);
osip_free(bodybuff);
if (sts != 0) {
ERROR("rewrite_invitation_body: unable to sdp_parse body");
return STS_FAILURE;
@@ -498,23 +496,23 @@ int proxy_rewrite_invitation_body(sip_t *mymsg){
if (configuration.debuglevel)
{ /* just dump the buffer */
char *tmp, *tmp2;
sts = msg_getbody(mymsg, 0, &body);
sts = body_2char(body, &tmp);
content_length_2char(mymsg->contentlength, &tmp2);
sts = osip_message_get_body(mymsg, 0, &body);
sts = osip_body_to_str(body, &tmp);
osip_content_length_to_str(mymsg->content_length, &tmp2);
DEBUG("Body before rewrite (clen=%s, strlen=%i):\n%s\n----",
tmp2, strlen(tmp), tmp);
free(tmp);
free(tmp2);
osip_free(tmp);
osip_free(tmp2);
}
/*
* RTP proxy: get ready and start forwarding
* start forwarding for each media stream ('m=' item in SIP message)
*/
sts = get_ip_by_host(sdp_c_addr_get(sdp,-1,0), &lcl_clnt_addr);
sts = get_ip_by_host(sdp_message_c_addr_get(sdp,-1,0), &lcl_clnt_addr);
if (sts == STS_FAILURE) {
DEBUGC(DBCLASS_PROXY, "proxy_rewrite_invitation_body: cannot resolve "
"m= (media) host [%s]", sdp_c_addr_get(sdp,-1,0));
"m= (media) host [%s]", sdp_message_c_addr_get(sdp,-1,0));
return STS_FAILURE;
}
@@ -528,10 +526,10 @@ if (configuration.debuglevel)
/*
* rewrite c= address
*/
sdp_conn = sdp_connection_get (sdp, -1, 0);
sdp_conn = sdp_message_connection_get (sdp, -1, 0);
if (sdp_conn && sdp_conn->c_addr) {
free(sdp_conn->c_addr);
sdp_conn->c_addr=malloc(HOSTNAME_SIZE);
osip_free(sdp_conn->c_addr);
sdp_conn->c_addr=osip_malloc(HOSTNAME_SIZE);
sprintf(sdp_conn->c_addr, "%s", inet_ntoa(outb_addr));
} else {
ERROR("got NULL c= address record - can't rewrite");
@@ -543,19 +541,19 @@ if (configuration.debuglevel)
*/
for (media_stream_no=0;;media_stream_no++) {
/* check if n'th media stream is present */
if (sdp_m_port_get(sdp, media_stream_no) == NULL) break;
if (sdp_message_m_port_get(sdp, media_stream_no) == NULL) break;
/* start an RTP proxying stream */
if (sdp_m_port_get(sdp, media_stream_no)) {
inb_clnt_port=atoi(sdp_m_port_get(sdp, media_stream_no));
rtp_start_fwd(msg_getcall_id(mymsg), media_stream_no,
if (sdp_message_m_port_get(sdp, media_stream_no)) {
inb_clnt_port=atoi(sdp_message_m_port_get(sdp, media_stream_no));
rtp_start_fwd(osip_message_get_call_id(mymsg), media_stream_no,
outb_addr, &outb_rtp_port,
lcl_clnt_addr, inb_clnt_port);
/* and rewrite the port */
sdp_med=list_get(sdp->m_medias, media_stream_no);
sdp_med=osip_list_get(sdp->m_medias, media_stream_no);
if (sdp_med && sdp_med->m_port) {
free(sdp_med->m_port);
sdp_med->m_port=malloc(8);
osip_free(sdp_med->m_port);
sdp_med->m_port=osip_malloc(8);
sprintf(sdp_med->m_port, "%i", outb_rtp_port);
DEBUGC(DBCLASS_PROXY, "proxy_rewrite_invitation_body: "
"m= rewrote port to [%i]",outb_rtp_port);
@@ -572,38 +570,35 @@ if (configuration.debuglevel)
}
/* remove old body */
sts = list_remove(mymsg->bodies, 0);
body_free(body);
free(body);
sts = osip_list_remove(mymsg->bodies, 0);
osip_body_free(body);
/* dump new body */
sdp_2char(sdp, &bodybuff);
sdp_message_to_str(sdp, &bodybuff);
/* free sdp structure */
sdp_free(sdp);
free(sdp);
sdp_message_free(sdp);
/* include new body */
msg_setbody(mymsg, bodybuff);
free(bodybuff);
osip_message_set_body(mymsg, bodybuff);
/* free content length resource and include new one*/
content_length_free(mymsg->contentlength);
free(mymsg->contentlength);
mymsg->contentlength=NULL;
osip_content_length_free(mymsg->content_length);
// osip_free(mymsg->content_length);
mymsg->content_length=NULL;
sprintf(clen,"%i",strlen(bodybuff));
sts = msg_setcontent_length(mymsg, clen);
sts = osip_message_set_content_length(mymsg, clen);
if (configuration.debuglevel)
{ /* just dump the buffer */
char *tmp, *tmp2;
sts = msg_getbody(mymsg, 0, &body);
sts = body_2char(body, &tmp);
content_length_2char(mymsg->contentlength, &tmp2);
sts = osip_message_get_body(mymsg, 0, &body);
sts = osip_body_to_str(body, &tmp);
osip_content_length_to_str(mymsg->content_length, &tmp2);
DEBUG("Body after rewrite (clen=%s, strlen=%i):\n%s\n----",
tmp2, strlen(tmp), tmp);
free(tmp);
free(tmp2);
osip_free(tmp);
osip_free(tmp2);
}
return STS_SUCCESS;
}
@@ -617,21 +612,21 @@ if (configuration.debuglevel)
* RETURNS
* STS_SUCCESS on success
*/
int proxy_rewrite_request_uri(sip_t *mymsg, int idx){
int proxy_rewrite_request_uri(osip_message_t *mymsg, int idx){
char *host;
char *port;
url_t *url;
osip_uri_t *url;
DEBUGC(DBCLASS_PROXY,"rewriting incoming Request URI");
url=msg_geturi(mymsg);
free(url->host);url->host=NULL;
url=osip_message_get_uri(mymsg);
osip_free(url->host);url->host=NULL;
/* set the true host */
if(urlmap[idx].true_url->host) {
host = (char *)malloc(strlen(urlmap[idx].true_url->host)+1);
memcpy(host, urlmap[idx].true_url->host, strlen(urlmap[idx].true_url->host));
host[strlen(urlmap[idx].true_url->host)]='\0';
url_sethost(url, host);
osip_uri_set_host(url, host);
}
/* set the true port */
@@ -639,7 +634,7 @@ int proxy_rewrite_request_uri(sip_t *mymsg, int idx){
port = (char *)malloc(strlen(urlmap[idx].true_url->port)+1);
memcpy(port, urlmap[idx].true_url->port, strlen(urlmap[idx].true_url->port));
port[strlen(urlmap[idx].true_url->port)]='\0';
url_setport(url, port);
osip_uri_set_port(url, port);
}
return STS_SUCCESS;
}

View File

@@ -27,11 +27,7 @@
#include <sys/types.h>
#include <netinet/in.h>
#ifdef HAVE_OSIP2
#include <osip2/smsg.h>
#else
#include <osip/smsg.h>
#endif
#include <osipparser2/osip_parser.h>
#include "siproxd.h"
#include "log.h"

View File

@@ -28,11 +28,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#ifdef HAVE_OSIP2
#include <osip2/smsg.h>
#else
#include <osip/smsg.h>
#endif
#include <osipparser2/osip_parser.h>
#include "siproxd.h"
#include "log.h"
@@ -63,13 +59,13 @@ void register_init(void) {
* STS_FAILURE : registration failed
* STS_NEED_AUTH : authentication needed
*/
int register_client(sip_t *my_msg) {
int register_client(osip_message_t *my_msg) {
int i, j, n, sts;
int expires;
time_t time_now;
url_t *url1_to, *url1_contact;
url_t *url2_to, *url2_contact;
header_t *expires_hdr;
osip_uri_t *url1_to, *url1_contact;
osip_uri_t *url2_to, *url2_contact;
osip_header_t *expires_hdr;
/* check for proxy authentication */
sts = authenticate_proxy(my_msg);
@@ -102,7 +98,7 @@ int register_client(sip_t *my_msg) {
DEBUGC(DBCLASS_BABBLE,"sip_register:");
/* evaluate Expires Header field */
msg_getexpires(my_msg, 0, &expires_hdr);
osip_message_get_expires(my_msg, 0, &expires_hdr);
if (expires_hdr && expires_hdr->hvalue) {
expires=atoi(expires_hdr->hvalue);
@@ -110,11 +106,11 @@ int register_client(sip_t *my_msg) {
/* it seems the expires filed in not present everywhere... */
WARN("no 'expires' header found - set time to 600 sec");
expires=600;
msg_setexpires(my_msg, "600");
osip_message_set_expires(my_msg, "600");
}
url1_to=my_msg->to->url;
url1_contact=((contact_t*)(my_msg->contacts->node->element))->url;
url1_contact=((osip_contact_t*)(my_msg->contacts->node->element))->url;
DEBUGC(DBCLASS_REG,"register: %s@%s expires=%i seconds",
(url1_contact->username) ? url1_contact->username : "*NULL*",
@@ -161,9 +157,9 @@ int register_client(sip_t *my_msg) {
/* write entry */
urlmap[i].active=1;
url_clone( ((contact_t*)(my_msg->contacts->node->element))->url,
osip_uri_clone( ((osip_contact_t*)(my_msg->contacts->node->element))->url,
&urlmap[i].true_url); /* Contact: field */
url_clone( my_msg->to->url,
osip_uri_clone( my_msg->to->url,
&urlmap[i].reg_url); /* To: field */
DEBUGC(DBCLASS_REG,"create new entry for %s@%s <-> %s@%s at slot=%i",
@@ -176,8 +172,8 @@ int register_client(sip_t *my_msg) {
/*
* try to figure out if we ought to do some masquerading
*/
url_clone( my_msg->to->url,
&urlmap[i].masq_url);
osip_uri_clone( my_msg->to->url,
&urlmap[i].masq_url);
n=configuration.mask_host.used;
if (n != configuration.masked_host.used) {
@@ -205,7 +201,7 @@ int register_client(sip_t *my_msg) {
strcpy(urlmap[i].masq_url->host, configuration.masked_host.string[j]);
}
via_clone( ((via_t*)(my_msg->vias->node->element)),
osip_via_clone( ((osip_via_t*)(my_msg->vias->node->element)),
&urlmap[i].via); /* via field */
} /* if new entry */
@@ -235,14 +231,10 @@ void register_agemap(void) {
DEBUGC(DBCLASS_REG,"cleaned entry:%i %s@%s", i,
urlmap[i].masq_url->username, urlmap[i].masq_url->host);
urlmap[i].active=0;
url_free(urlmap[i].true_url);
url_free(urlmap[i].masq_url);
url_free(urlmap[i].reg_url);
via_free(urlmap[i].via);
free(urlmap[i].true_url);
free(urlmap[i].masq_url);
free(urlmap[i].reg_url);
free(urlmap[i].via);
osip_uri_free(urlmap[i].true_url);
osip_uri_free(urlmap[i].masq_url);
osip_uri_free(urlmap[i].reg_url);
osip_via_free(urlmap[i].via);
}
}
return;
@@ -259,15 +251,15 @@ void register_agemap(void) {
* STS_SUCCESS on success
* STS_FAILURE on error
*/
int register_response(sip_t *request, int flag) {
sip_t *response;
int register_response(osip_message_t *request, int flag) {
osip_message_t *response;
int code;
int sts;
via_t *via;
osip_via_t *via;
int port;
char *buffer;
struct in_addr addr;
header_t *expires_hdr;
osip_header_t *expires_hdr;
/* ok -> 200, fail -> 503 */
switch (flag) {
@@ -292,9 +284,9 @@ int register_response(sip_t *request, int flag) {
}
/* insert the expiration header */
msg_getexpires(request, 0, &expires_hdr);
osip_message_get_expires(request, 0, &expires_hdr);
if (expires_hdr) {
msg_setexpires(response, expires_hdr->hvalue);
osip_message_set_expires(response, expires_hdr->hvalue);
}
/* if we send back an proxy authentication needed,
@@ -304,7 +296,7 @@ int register_response(sip_t *request, int flag) {
}
/* get the IP address from existing VIA header */
msg_getvia (response, 0, &via);
osip_message_get_via (response, 0, &via);
if (via == NULL) {
ERROR("register_response: Cannot send response - no via field");
return STS_FAILURE;
@@ -321,7 +313,7 @@ int register_response(sip_t *request, int flag) {
}
}
sts = msg_2char(response, &buffer);
sts = osip_message_to_str(response, &buffer);
if (sts != 0) {
ERROR("register_response: msg_2char failed");
return STS_FAILURE;
@@ -337,8 +329,7 @@ int register_response(sip_t *request, int flag) {
sipsock_send_udp(&sip_socket, addr, port, buffer, strlen(buffer), 1);
/* free the resources */
msg_free(response);
free(response);
osip_message_free(response);
free(buffer);
return STS_SUCCESS;
}

View File

@@ -32,11 +32,7 @@
#include <netinet/in.h>
#include <signal.h>
#ifdef HAVE_OSIP2
#include <osip2/smsg.h>
#else
#include <osip/smsg.h>
#endif
#include <osipparser2/osip_parser.h>
#include "siproxd.h"
#include "log.h"
@@ -128,7 +124,7 @@ void *rtpproxy_main(void *arg) {
int i, count;
int num_fd;
static int rtp_socket=0;
call_id_t callid;
osip_call_id_t callid;
char rtp_buff[RTP_BUFFER_SIZE];
memcpy(&fdset, &master_fdset, sizeof(fdset));
@@ -231,7 +227,7 @@ INFO("RTP stream sock=%i %s@%s (idx=%i) "
* STS_SUCCESS on success
* STS_FAILURE on error
*/
int rtp_start_fwd (call_id_t *callid, int media_stream_no,
int rtp_start_fwd (osip_call_id_t *callid, int media_stream_no,
struct in_addr outbound_ipaddr, int *outboundport,
struct in_addr lcl_client_ipaddr, int lcl_clientport) {
int i, j;
@@ -405,7 +401,7 @@ unlock_and_exit:
* STS_SUCCESS on success
* STS_FAILURE on error
*/
int rtp_stop_fwd (call_id_t *callid, int nolock) {
int rtp_stop_fwd (osip_call_id_t *callid, int nolock) {
int i, sts;
int retsts=STS_SUCCESS;
int got_match=0;

View File

@@ -27,11 +27,7 @@
#include <unistd.h>
#include <netinet/in.h>
#ifdef HAVE_OSIP2
#include <osip2/smsg.h>
#else
#include <osip/smsg.h>
#endif
#include <osipparser2/osip_parser.h>
#include "siproxd.h"
#include "log.h"
@@ -64,10 +60,10 @@ int security_check_raw(char *sip_buffer, int size){
* STS_SUCCESS if ok
* STS_FAILURE if the packed did not pass the checks
*/
int security_check_sip(sip_t *sip){
int security_check_sip(osip_message_t *sip){
/* check for existing SIP URI */
if (sip->strtline == NULL) {
if (sip->req_uri == NULL) {
ERROR("security check failed: NULL SIP URI");
return STS_FAILURE;
}

View File

@@ -35,13 +35,8 @@
#include <sys/types.h>
#include <pwd.h>
#ifdef HAVE_OSIP2
#include <osip2/smsg.h>
#include <osip2/port.h>
#else
#include <osip/smsg.h>
#include <osip/port.h>
#endif
#include <osipparser2/osip_parser.h>
#include <osipparser2/osip_port.h>
#include "siproxd.h"
#include "rewrite_rules.h"
@@ -60,19 +55,18 @@ extern int sip_socket; /* sending SIP datagrams */
/*
* create a reply template from an given SIP request
*
* RETURNS a pointer to sip_t
* RETURNS a pointer to osip_message_t
*/
sip_t *msg_make_template_reply (sip_t * request, int code) {
sip_t *response;
char *tmp;
osip_message_t *msg_make_template_reply (osip_message_t * request, int code) {
osip_message_t *response;
int pos;
msg_init (&response);
msg_setversion (response, sgetcopy ("SIP/2.0"));
tmp = malloc(STATUSCODE_SIZE);
snprintf (tmp, STATUSCODE_SIZE, "%i", code);
msg_setstatuscode (response, tmp);
msg_setreasonphrase (response, msg_getreason (code));
osip_message_init (&response);
response->message=NULL;
osip_message_set_version (response, osip_strdup ("SIP/2.0"));
osip_message_set_status_code (response, code);
osip_message_set_reason_phrase (response,
osip_strdup(osip_message_get_reason (code)));
if (request->to==NULL) {
ERROR("msg_make_template_reply: empty To in request header");
@@ -82,24 +76,25 @@ sip_t *msg_make_template_reply (sip_t * request, int code) {
ERROR("msg_make_template_reply: empty From in request header");
}
to_clone (request->to, &response->to);
from_clone (request->from, &response->from);
osip_to_clone (request->to, &response->to);
osip_from_clone (request->from, &response->from);
/* via headers */
pos = 0;
while (!list_eol (request->vias, pos)) {
via_t *via;
via = (via_t *) list_get (request->vias, pos);
via_2char (via, &tmp);
while (!osip_list_eol (request->vias, pos)) {
char *tmp;
osip_via_t *via;
via = (osip_via_t *) osip_list_get (request->vias, pos);
osip_via_to_str (via, &tmp);
msg_setvia (response, tmp);
free (tmp);
osip_message_set_via (response, tmp);
osip_free (tmp);
pos++;
}
call_id_clone(request->call_id,&response->call_id);
cseq_clone(request->cseq,&response->cseq);
osip_call_id_clone(request->call_id,&response->call_id);
osip_cseq_clone(request->cseq,&response->cseq);
return response;
}
@@ -114,7 +109,7 @@ sip_t *msg_make_template_reply (sip_t * request, int code) {
* STS_TRUE if loop detected
* STS_FALSE if no loop
*/
int check_vialoop (sip_t *my_msg) {
int check_vialoop (osip_message_t *my_msg) {
/*
!!! actually this is a problematic one.
1) for requests, I must search the whole VIA list
@@ -139,9 +134,9 @@ int check_vialoop (sip_t *my_msg) {
found_own_via=0;
pos = 1; /* for detecting a loop, don't check the first entry
as this is my own VIA! */
while (!list_eol (my_msg->vias, pos)) {
via_t *via;
via = (via_t *) list_get (my_msg->vias, pos);
while (!osip_list_eol (my_msg->vias, pos)) {
osip_via_t *via;
via = (osip_via_t *) osip_list_get (my_msg->vias, pos);
sts = is_via_local (via);
if (sts == STS_TRUE) found_own_via=1;
pos++;
@@ -151,14 +146,14 @@ int check_vialoop (sip_t *my_msg) {
/*
* check if a given via_t is local. I.e. its address is owned
* check if a given osip_via_t is local. I.e. its address is owned
* by my inbound or outbound interface
*
* RETURNS
* STS_TRUE if the given VIA is one of my interfaces
* STS_FALSE otherwise
*/
int is_via_local (via_t *via) {
int is_via_local (osip_via_t *via) {
int sts, found;
struct in_addr addr_via, addr_myself;
char *my_interfaces[]=
@@ -221,7 +216,7 @@ int is_via_local (via_t *via) {
* STS_SUCCESS if equal
* STS_FAILURE if non equal or error
*/
int compare_url(url_t *url1, url_t *url2) {
int compare_url(osip_uri_t *url1, osip_uri_t *url2) {
int sts;
struct in_addr addr1, addr2;
@@ -294,7 +289,7 @@ int compare_url(url_t *url1, url_t *url2) {
* STS_TRUE if the request is addressed local
* STS_FALSE otherwise
*/
int is_sipuri_local (sip_t *sip) {
int is_sipuri_local (osip_message_t *sip) {
int sts, found;
struct in_addr addr_uri, addr_myself;
char *my_interfaces[]=
@@ -308,18 +303,18 @@ int is_sipuri_local (sip_t *sip) {
return STS_FALSE;
}
if (!sip || !sip->strtline || !sip->strtline->rquri) {
if (!sip || !sip->req_uri) {
ERROR("is_sipuri_local: no request URI present");
return STS_FALSE;
}
DEBUGC(DBCLASS_DNS,"check for local SIP URI %s:%s",
sip->strtline->rquri->host? sip->strtline->rquri->host : "*NULL*",
sip->strtline->rquri->port? sip->strtline->rquri->port : "*NULL*");
sip->req_uri->host? sip->req_uri->host : "*NULL*",
sip->req_uri->port? sip->req_uri->port : "*NULL*");
if (inet_aton(sip->strtline->rquri->host, &addr_uri) == 0) {
if (inet_aton(sip->req_uri->host, &addr_uri) == 0) {
/* need name resolution */
get_ip_by_host(sip->strtline->rquri->host, &addr_uri);
get_ip_by_host(sip->req_uri->host, &addr_uri);
}
found=0;
@@ -336,8 +331,8 @@ int is_sipuri_local (sip_t *sip) {
}
/* check the extracted HOST against my own host addresses */
if (sip->strtline->rquri->port) {
port=atoi(sip->strtline->rquri->port);
if (sip->req_uri->port) {
port=atoi(sip->req_uri->port);
} else {
port=SIP_PORT;
}
@@ -364,23 +359,23 @@ int is_sipuri_local (sip_t *sip) {
* STS_TRUE if to be rewritten
* STS_FALSE otherwise
*/
int check_rewrite_rq_uri (sip_t *sip) {
int check_rewrite_rq_uri (osip_message_t *sip) {
int i, j, sts;
int dflidx;
header_t *ua_hdr;
osip_header_t *ua_hdr;
/* get index of default entry */
dflidx=(sizeof(RQ_rewrite)/sizeof(RQ_rewrite[0])) - 1;
/* check fort existence of method */
if ((sip==NULL) || (sip->strtline==NULL) ||
(sip->strtline->sipmethod==NULL)) {
if ((sip==NULL) ||
(sip->sip_method==NULL)) {
ERROR("check_rewrite_rq_uri: got NULL method");
return STS_FALSE;
}
/* extract UA string */
msg_getuser_agent (sip, 0, &ua_hdr);
osip_message_get_user_agent (sip, 0, &ua_hdr);
if ((ua_hdr==NULL) || (ua_hdr->hvalue==NULL)) {
WARN("check_rewrite_rq_uri: NULL UA in Header, using default");
i=dflidx;
@@ -398,7 +393,7 @@ int check_rewrite_rq_uri (sip_t *sip) {
for (j=0; RQ_method[j].name; j++) {
if (strncmp(RQ_method[j].name,
sip->strtline->sipmethod, RQ_method[j].size)==0) {
sip->sip_method, RQ_method[j].size)==0) {
if (RQ_rewrite[i].action[j] >= 0) {
sts = (RQ_rewrite[i].action[j])? STS_TRUE: STS_FALSE;
} else {
@@ -406,8 +401,8 @@ int check_rewrite_rq_uri (sip_t *sip) {
}
DEBUGC(DBCLASS_SIP, "check_rewrite_rq_uri: [%s:%s, i=%i, j=%i] "
"got action %s",
(sip && sip->strtline && sip->strtline->sipmethod) ?
sip->strtline->sipmethod : "*NULL*",
(sip && sip->sip_method) ?
sip->sip_method : "*NULL*",
(ua_hdr && ua_hdr->hvalue)? ua_hdr->hvalue:"*NULL*",
i, j, (sts==STS_TRUE)? "rewrite":"norewrite");
return sts;
@@ -415,7 +410,7 @@ int check_rewrite_rq_uri (sip_t *sip) {
} /* for j */
WARN("check_rewrite_rq_uri: didn't get a hit of the method [%s]",
sip->strtline->sipmethod);
sip->sip_method);
return STS_FALSE;
}
@@ -431,10 +426,10 @@ int check_rewrite_rq_uri (sip_t *sip) {
* STS_SUCCESS on success
* STS_FAILURE on error
*/
int sip_gen_response(sip_t *request, int code) {
sip_t *response;
int sip_gen_response(osip_message_t *request, int code) {
osip_message_t *response;
int sts;
via_t *via;
osip_via_t *via;
int port;
char *buffer;
struct in_addr addr;
@@ -446,7 +441,7 @@ int sip_gen_response(sip_t *request, int code) {
}
/* we must check if first via has x.x.x.x address. If not, we must resolve it */
msg_getvia (response, 0, &via);
osip_message_get_via (response, 0, &via);
if (via == NULL)
{
ERROR("proxy_response: Cannot send response - no via field");
@@ -467,7 +462,7 @@ int sip_gen_response(sip_t *request, int code) {
}
}
sts = msg_2char(response, &buffer);
sts = osip_message_to_str(response, &buffer);
if (sts != 0) {
ERROR("proxy_response: msg_2char failed");
return STS_FAILURE;
@@ -485,9 +480,8 @@ int sip_gen_response(sip_t *request, int code) {
buffer, strlen(buffer), 1);
/* free the resources */
msg_free(response);
free(response);
free (buffer);
osip_message_free(response);
osip_free(buffer);
return STS_SUCCESS;
}
@@ -501,10 +495,10 @@ int sip_gen_response(sip_t *request, int code) {
* STS_SUCCESS on success
* STS_FAILURE on error
*/
int sip_add_myvia (sip_t *request, int interface) {
int sip_add_myvia (osip_message_t *request, int interface) {
struct in_addr addr;
char tmp[URL_STRING_SIZE];
via_t *via;
osip_via_t *via;
int sts;
if (interface == IF_OUTBOUND) {
@@ -527,13 +521,13 @@ int sip_add_myvia (sip_t *request, int interface) {
configuration.sip_listen_port);
DEBUGC(DBCLASS_BABBLE,"adding VIA:%s",tmp);
sts = via_init(&via);
sts = osip_via_init(&via);
if (sts!=0) return STS_FAILURE; /* allocation failed */
sts = via_parse(via, tmp);
sts = osip_via_parse(via, tmp);
if (sts!=0) return STS_FAILURE;
list_add(request->vias,via,0);
osip_list_add(request->vias,via,0);
return STS_SUCCESS;
}
@@ -546,21 +540,20 @@ int sip_add_myvia (sip_t *request, int interface) {
* STS_SUCCESS on success
* STS_FAILURE on error
*/
int sip_del_myvia (sip_t *response) {
via_t *via;
int sip_del_myvia (osip_message_t *response) {
osip_via_t *via;
int sts;
DEBUGC(DBCLASS_PROXY,"deleting topmost VIA");
via = list_get (response->vias, 0);
via = osip_list_get (response->vias, 0);
if ( is_via_local(via) == STS_FALSE ) {
ERROR("I'm trying to delete a VIA but it's not mine! host=%s",via->host);
return STS_FAILURE;
}
sts = list_remove(response->vias, 0);
via_free (via);
free(via);
sts = osip_list_remove(response->vias, 0);
osip_via_free (via);
return STS_SUCCESS;
}

View File

@@ -30,11 +30,7 @@
#include <getopt.h>
#ifdef HAVE_OSIP2
#include <osip2/smsg.h>
#else
#include <osip/smsg.h>
#endif
#include <osipparser2/osip_parser.h>
#include "siproxd.h"
#include "log.h"
@@ -51,7 +47,7 @@ int sip_socket=0;
/* -h help option text */
static const char str_helpmsg[] =
PACKAGE"-"VERSION"-"BUILDSTR" ("LIBOSIPVER") (c) 2002-2003 Thomas Ries\n" \
PACKAGE"-"VERSION"-"BUILDSTR" (c) 2002-2003 Thomas Ries\n" \
"\nUsage: siproxd [options]\n\n" \
"options:\n" \
" --help (-h) help\n" \
@@ -68,7 +64,7 @@ int main (int argc, char *argv[])
int access;
struct sockaddr_in from;
char buff [BUFFER_SIZE];
sip_t *my_msg=NULL;
osip_message_t *my_msg=NULL;
extern char *optarg;
int ch1;
@@ -192,7 +188,7 @@ INFO("rtpproxy_init done");
INFO("sipsock_listen done");
#endif
INFO(PACKAGE"-"VERSION"-"BUILDSTR" ("LIBOSIPVER") started");
INFO(PACKAGE"-"VERSION"-"BUILDSTR" started");
/*
* silence the log - if so required...
*/
@@ -229,15 +225,17 @@ INFO("got packet from %s [%s]", inet_ntoa(from.sin_addr), tmp);}
if (sts != STS_SUCCESS) continue; /* there are no resources to free */
/* parse the received message */
sts=msg_init(&my_msg);
sts=osip_message_init(&my_msg);
my_msg->message=NULL;
if (sts != 0) {
ERROR("msg_init() failed... this is not good");
ERROR("osip_message_init() failed... this is not good");
continue; /* skip, there are no resources to free */
}
sts=msg_parse(my_msg, buff);
sts=osip_message_parse(my_msg, buff);
if (sts != 0) {
ERROR("msg_parse() failed... this is not good");
ERROR("osip_message_parse() failed... this is not good");
goto end_loop; /* skip and free resources */
}
@@ -247,8 +245,8 @@ INFO("got packet from %s [%s]", inet_ntoa(from.sin_addr), tmp);}
DEBUGC(DBCLASS_SIP,"received SIP type %s:%s",
(MSG_IS_REQUEST(my_msg))? "REQ" : "RES",
(my_msg->strtline->sipmethod)?
my_msg->strtline->sipmethod : "NULL") ;
(my_msg->sip_method)?
my_msg->sip_method : "NULL") ;
/*
* if RQ REGISTER, just register
@@ -307,7 +305,7 @@ INFO("got packet from %s [%s]", inet_ntoa(from.sin_addr), tmp);}
} else {
ERROR("received unsupported SIP type %s %s",
(MSG_IS_REQUEST(my_msg))? "REQ" : "RES",
my_msg->strtline->sipmethod);
my_msg->sip_method);
}
@@ -315,8 +313,7 @@ INFO("got packet from %s [%s]", inet_ntoa(from.sin_addr), tmp);}
* free the SIP message buffers
*/
end_loop:
msg_free(my_msg);
free(my_msg);
osip_message_free(my_msg);
} /* while TRUE */

View File

@@ -30,15 +30,15 @@ int sockbind(struct in_addr ipaddr, int localport, int errflg);
/* register.c */
void register_init(void);
int register_client(sip_t *request); /*X*/
int register_client(osip_message_t *request); /*X*/
void register_agemap(void);
int register_response(sip_t *request, int flag); /*X*/
int register_response(osip_message_t *request, int flag); /*X*/
/* proxy.c */
int proxy_request (sip_t *request); /*X*/
int proxy_response (sip_t *response); /*X*/
int proxy_rewrite_invitation_body(sip_t *mymsg); /*X*/
int proxy_rewrite_request_uri(sip_t *mymsg, int idx); /*X*/
int proxy_request (osip_message_t *request); /*X*/
int proxy_response (osip_message_t *response); /*X*/
int proxy_rewrite_invitation_body(osip_message_t *mymsg); /*X*/
int proxy_rewrite_request_uri(osip_message_t *mymsg, int idx); /*X*/
/* utils.c */
int get_ip_by_host(char *hostname, struct in_addr *addr); /*X*/
@@ -46,27 +46,27 @@ void secure_enviroment (void);
int get_ip_by_ifname(char *ifname, struct in_addr *retaddr); /*X*/
/* sip_utils.c */
sip_t * msg_make_template_reply (sip_t * request, int code);
int check_vialoop (sip_t *my_msg); /*X*/
int is_via_local (via_t *via); /*X*/
int compare_url(url_t *url1, url_t *url2); /*X*/
int is_sipuri_local (sip_t *sip); /*X*/
int check_rewrite_rq_uri (sip_t *sip); /*X*/
int sip_gen_response(sip_t *request, int code); /*X*/
osip_message_t * msg_make_template_reply (osip_message_t * request, int code);
int check_vialoop (osip_message_t *my_msg); /*X*/
int is_via_local (osip_via_t *via); /*X*/
int compare_url(osip_uri_t *url1, osip_uri_t *url2); /*X*/
int is_sipuri_local (osip_message_t *sip); /*X*/
int check_rewrite_rq_uri (osip_message_t *sip); /*X*/
int sip_gen_response(osip_message_t *request, int code); /*X*/
#define IF_OUTBOUND 0
#define IF_INBOUND 1
int sip_add_myvia (sip_t *request, int interface); /*X*/
int sip_del_myvia (sip_t *response); /*X*/
int sip_add_myvia (osip_message_t *request, int interface); /*X*/
int sip_del_myvia (osip_message_t *response); /*X*/
/* readconf.c */
int read_config(char *name, int search); /*X*/
/* rtpproxy.c */
int rtpproxy_init( void ); /*X*/
int rtp_start_fwd (call_id_t *callid, int media_stream_no, /*X*/
int rtp_start_fwd (osip_call_id_t *callid, int media_stream_no, /*X*/
struct in_addr outbound_ipaddr, int *outboundport,
struct in_addr lcl_client_ipaddr, int lcl_clientport);
int rtp_stop_fwd (call_id_t *callid, int nolock); /*X*/
int rtp_stop_fwd (osip_call_id_t *callid, int nolock); /*X*/
void rtpproxy_kill( void ); /*X*/
/* accessctl.c */
@@ -74,11 +74,11 @@ int accesslist_check(struct sockaddr_in from);
/* security.c */
int security_check_raw(char *sip_buffer, int size); /*X*/
int security_check_sip(sip_t *sip); /*X*/
int security_check_sip(osip_message_t *sip); /*X*/
/* auth.c */
int authenticate_proxy(sip_t *request); /*X*/
int auth_include_authrq(sip_t *response); /*X*/
int authenticate_proxy(osip_message_t *request); /*X*/
int auth_include_authrq(osip_message_t *response); /*X*/
@@ -88,10 +88,10 @@ int auth_include_authrq(sip_t *response); /*X*/
struct urlmap_s {
int active;
int expires;
url_t *true_url; // true URL of UA (inbound URL)
url_t *masq_url; // masqueraded URL (outbound URL)
url_t *reg_url; // registered URL (masq URL as wished by UA)
via_t *via;
osip_uri_t *true_url; // true URL of UA (inbound URL)
osip_uri_t *masq_url; // masqueraded URL (outbound URL)
osip_uri_t *reg_url; // registered URL (masq URL as wished by UA)
osip_via_t *via;
};
/*
* the difference between masq_url and reg_url is,

View File

@@ -33,11 +33,7 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_OSIP2
#include <osip2/smsg.h>
#else
#include <osip/smsg.h>
#endif
#include <osipparser2/osip_parser.h>
#include "siproxd.h"
#include "log.h"

View File

@@ -35,11 +35,7 @@
#include <sys/types.h>
#include <pwd.h>
#ifdef HAVE_OSIP2
#include <osip2/smsg.h>
#else
#include <osip/smsg.h>
#endif
#include <osipparser2/osip_parser.h>
#include "siproxd.h"
#include "log.h"