Add kphone, A SIP User Agent.

Based on work by:	Georg Schwarz (geos@epost.de)
This commit is contained in:
Tilman Keskinoz 2004-07-05 14:20:26 +00:00
parent 594b0641ce
commit 68dac9bdbc
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=112961
10 changed files with 462 additions and 0 deletions

View file

@ -247,6 +247,7 @@
SUBDIR += kmldonkey
SUBDIR += kontact-plugins
SUBDIR += konverse
SUBDIR += kphone
SUBDIR += kpopup
SUBDIR += krdesktop
SUBDIR += l2tpd

43
net/kphone/Makefile Normal file
View file

@ -0,0 +1,43 @@
# New ports collection Makefile for: kphone
# Date created: 2004-07-05
# Whom: arved
#
# $FreeBSD$
PORTNAME= kphone
PORTVERSION= 4.0.3
CATEGORIES= net
MASTER_SITES= http://www.wirlab.net/kphone/
MAINTAINER= ports@FreeBSD.org
COMMENT= A voice over internet phone
USE_QT_VER= 3
WRKSRC= ${WRKDIR}/${PORTNAME}
GNU_CONFIGURE= yes
USE_GMAKE= yes
USE_OPENSSL= yes
USE_REINPLACE= yes
.include <bsd.port.pre.mk>
.if (${OSVERSION} > 500000 )
BROKEN= "Does not compile"
.endif
post-patch:
${REINPLACE_CMD} -e "s,-O3,${CFLAGS} ${PTHREAD_CFLAGS}," ${WRKSRC}/configure
${REINPLACE_CMD} -e "s,-lresolv,${PTHREAD_LIBS}," ${WRKSRC}/kphone/Makefile.in
do-build:
cd ${WRKSRC}/dissipate2; ${SETENV} ${MAKE_ENV} ${GMAKE}
cd ${WRKSRC}/gsm; ${SETENV} ${MAKE_ENV} ${GMAKE}
cd ${WRKSRC}/ilbc; ${SETENV} ${MAKE_ENV} ${GMAKE}
cd ${WRKSRC}/kphone; ${SETENV} ${MAKE_ENV} ${GMAKE}
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/kphone/kphone ${PREFIX}/bin
${MKDIR} ${DATADIR}/icons
${INSTALL_DATA} ${WRKSRC}/icons/*.png ${DATADIR}/icons
.include <bsd.port.post.mk>

2
net/kphone/distinfo Normal file
View file

@ -0,0 +1,2 @@
MD5 (kphone-4.0.3.tar.gz) = 2368fcb845b7dc75f1de96ca047b29d0
SIZE (kphone-4.0.3.tar.gz) = 220383

View file

@ -0,0 +1,247 @@
This is a first port of kphone 2.1 from Linux to FreeBSD and NetBSD (as
of 28/11/2002)
Get the original sources for kphone 2.1 from
http://www.wirlab.net/kphone/kphone-2.1.tgz
use patch -l to apply the patch (ignoring whitespaces)
FreeBSD:
To configure I used
setenv LIBQT "-pthread -lqt-mt"
./configure --with-qt-libraries=/usr/X11R6/lib --with-extra-libs=/usr/local/lib
--prefix=/usr/local
then in kphone/Makefile change -lpthread into -phread in kphone_LDADD.
NetBSD:
setenv LIBQT="-lqt-mt"
./configure --prefix=/usr/local --with-qt-dir=/usr/X11R6/qt3 --with-extra-libs=/usr/pkg/lib --with-extra-includes=/usr/pkg/include
then in kphone/Makefile add -lossaudio to kphone_LDADD.
On both platforms use gmake.
Please send feedback to Georg Schwarz (geos@epost.de). Thanks.
Your response is appreciated.
*** kphone-2.1.orig/./kphone/dspoutoss.h Tue Apr 16 11:38:27 2002
--- kphone-2.1/./kphone/dspoutoss.h Wed Nov 27 21:05:03 2002
***************
*** 1,7 ****
--- 1,11 ----
#ifndef DSPOUTOSS_H_INCLUDED
#define DSPOUTOSS_H_INCLUDED
+ #ifdef __NetBSD__
+ #include <soundcard.h>
+ #else
#include <sys/soundcard.h>
+ #endif
#include <dspout.h>
/**
*** kphone-2.1.orig/./dissipate2/messagesocket.h Tue Sep 3 10:31:48 2002
--- kphone-2.1/./dissipate2/messagesocket.h Sat Nov 23 23:34:57 2002
***************
*** 26,31 ****
--- 26,35 ----
#define MESSAGESOCKET_H_INCLUDED
#include <netdb.h>
+ #ifdef __FreeBSD__
+ #include <sys/types.h>
+ #include <netinet/in_systm.h>
+ #endif
#include <netinet/in.h>
/**
*** kphone-2.1.orig/./dissipate2/sipprotocol.cpp Tue Aug 27 14:01:34 2002
--- kphone-2.1/./dissipate2/sipprotocol.cpp Sat Nov 23 23:22:55 2002
***************
*** 8,13 ****
--- 8,16 ----
#include <stdio.h>
#include <stdlib.h>
#include <siputil.h>
+ #ifdef __FreeBSD__
+ #include <sys/types.h>
+ #endif
#include <extern_md5.h>
#include <base64.h>
#include <sipprotocol.h>
*** kphone-2.1.orig/./dissipate2/siputil.cpp Tue Apr 16 13:33:37 2002
--- kphone-2.1/./dissipate2/siputil.cpp Wed Nov 27 19:46:09 2002
***************
*** 3,10 ****
--- 3,19 ----
#include <sys/utsname.h>
#include <sys/socket.h>
#include <sys/time.h>
+ #ifdef __NetBSD__
+ #include <errno.h>
+ #else
#include <sys/errno.h>
+ #endif
+ #ifdef __linux__
#include <features.h>
+ #endif
+ #if defined(__FreeBSD__) || defined(__NetBSD__)
+ #include <ifaddrs.h>
+ #endif
#include <net/if_arp.h>
#include <net/route.h>
#include <sys/ioctl.h>
***************
*** 26,31 ****
--- 35,42 ----
/* max number of network interfaces*/
#define MAX_IF 5
+ #ifdef __linux__
+
/* Path to the route entry in proc filesystem */
#define PROCROUTE "/proc/net/route"
***************
*** 41,46 ****
--- 52,59 ----
#define SIOCGIFCOUNT 0x8935
#endif
+ #endif /* not Linux */
+
char iface[16];
***************
*** 62,67 ****
--- 75,82 ----
 */
char *getdefaultdev()
{
+ #ifdef __linux__
+
FILE *fp = fopen( PROCROUTE, "r");
char buff[4096], gate_addr[128], net_addr[128];
char mask_addr[128];
***************
*** 85,90 ****
--- 100,107 ----
return iface;
}
fclose(fp);
+ #endif /* Linux */
+
/* didn't find a default gateway */
return NULL;
}
***************
*** 92,103 ****
void findFqdn( void )
{
! int sock, err, if_count, i, j = 0;
struct ifconf netconf;
char buffer[32*MAX_IF];
! char if_name[10][21];
! char if_addr[10][21];
char *default_ifName;
netconf.ifc_len = 32 * MAX_IF;
netconf.ifc_buf = buffer;
sock=socket( PF_INET, SOCK_DGRAM, 0 );
--- 109,146 ----
void findFqdn( void )
{
! int if_count, i, j = 0;
! #if !(defined(__FreeBSD__) || defined(__NetBSD__))
! int sock, err;
struct ifconf netconf;
char buffer[32*MAX_IF];
! #endif
! char if_name[MAX_IF][21];
! char if_addr[MAX_IF][21];
char *default_ifName;
+ #if defined(__FreeBSD__) || defined(__NetBSD__)
+ struct ifaddrs *ifp, *oifp;
+
+ if(getifaddrs(&ifp) < 0 )
+ printf( "Error with getifaddrs(): %i.\n", errno );
+ oifp=ifp; /* save ifp */
+ for (if_count = 0; ifp != NULL; ifp = ifp->ifa_next) {
+ if(ifp->ifa_addr->sa_family != AF_INET) continue;
+
+ if ( strncmp( ifp->ifa_name, "lo", 2 ) != 0 ) {
+ if(j == MAX_IF) printf( "Error: cannot handle more than %d interfaces.\n",MAX_IF);
+ else
+ {
+ strncpy( if_name[j], ifp->ifa_name, 20);
+ strncpy( if_addr[j], inet_ntoa(((struct sockaddr_in *)ifp->ifa_addr)->sin_addr ), 20);
+ j++;
+ }
+ }
+ if_count++;
+ }
+ if (oifp != NULL) freeifaddrs(oifp);
+
+ #else /* not FreeBSD or NetBSD */
netconf.ifc_len = 32 * MAX_IF;
netconf.ifc_buf = buffer;
sock=socket( PF_INET, SOCK_DGRAM, 0 );
***************
*** 105,118 ****
--- 148,169 ----
if ( err < 0 ) printf( "Error in ioctl: %i.\n", errno );
close( sock );
if_count = netconf.ifc_len / 32;
+ #endif
printf( "Found %i interfaces.\n", if_count );
+ #if !(defined(__FreeBSD__) || defined(__NetBSD__))
for( i = 0; i < if_count; i++ ) {
if( strcmp( netconf.ifc_req[i].ifr_name, "lo" ) != 0 ) {
+ if(j == MAX_IF) printf( "Error: cannot handle more than %d interfaces.\n",MAX_IF);
+ else
+ {
strncpy( if_name[j], netconf.ifc_req[i].ifr_name, 20 );
strncpy( if_addr[j], inet_ntoa(((struct sockaddr_in*)(&netconf.ifc_req[i].ifr_addr))->sin_addr), 20 );
j++;
}
}
+ }
+ #endif /* not FreeBSD or NetBSD */
+
if( j == 1 ) {
dissipate_our_fqdn = strdup( if_addr[0] );
} else {
*** kphone-2.1.orig/./dissipate2/udpmessagesocket.cpp Tue Sep 10 08:10:26 2002
--- kphone-2.1/./dissipate2/udpmessagesocket.cpp Wed Nov 27 19:13:41 2002
***************
*** 1,5 ****
--- 1,9 ----
#include <sys/types.h>
#include <sys/socket.h>
+ #if defined(__FreeBSD__) || defined(__NetBSD__)
+ #include <netinet/in_systm.h>
+ #include <netinet/in.h>
+ #endif
#include <netinet/ip.h>
#include <errno.h>
#include <string.h>
***************
*** 9,14 ****
--- 13,21 ----
#include <strings.h>
#include <udpmessagesocket.h>
+ #ifndef SOL_IP
+ #define SOL_IP SOL_SOCKET
+ #endif
UDPMessageSocket::UDPMessageSocket( void )
{

View file

@ -0,0 +1,11 @@
--- dissipate2/extern_md5.h.orig Mon Jul 5 14:01:05 2004
+++ dissipate2/extern_md5.h Mon Jul 5 14:08:08 2004
@@ -1,6 +1,8 @@
#ifndef EXTERN_MD5_H
#define EXTERN_MD5_H
+#include <sys/types.h>
+
#define HASHLEN 16
typedef u_char HASH[HASHLEN];
#define HASHHEXLEN 32

View file

@ -0,0 +1,10 @@
--- dissipate2/messagesocket.h.orig Mon Jul 5 13:49:27 2004
+++ dissipate2/messagesocket.h Mon Jul 5 13:50:01 2004
@@ -23,6 +23,7 @@
#define MESSAGESOCKET_H_INCLUDED
#include <netdb.h>
+#include <sys/types.h>
#include <netinet/in.h>
class MessageSocket

View file

@ -0,0 +1,110 @@
--- dissipate2/siputil.cpp.orig Thu Mar 4 12:22:57 2004
+++ dissipate2/siputil.cpp Mon Jul 5 15:05:32 2004
@@ -5,6 +5,9 @@
#include <sys/time.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
+#if defined (__FreeBSD__) || defined(__NetBSD__)
+#include <ifaddrs.h>
+#endif
#include <net/if_arp.h>
#include <net/route.h>
#include <net/if.h>
@@ -25,6 +28,8 @@
/* max number of network interfaces*/
#define MAX_IF 5
+#ifdef __linux__
+
/* Path to the route entry in proc filesystem */
#define PROCROUTE "/proc/net/route"
@@ -40,6 +45,8 @@
#define SIOCGIFCOUNT 0x8935
#endif
+#endif /* not Linux */
+
char iface[16];
@@ -61,6 +68,7 @@
 */
char *getdefaultdev()
{
+#ifdef __linux__
FILE *fp = fopen( PROCROUTE, "r");
char buff[4096], gate_addr[128], net_addr[128];
char mask_addr[128];
@@ -84,6 +92,8 @@
return iface;
}
fclose(fp);
+#endif /* Linux */
+
/* didn't find a default gateway */
return NULL;
}
@@ -91,12 +101,38 @@
void findFqdn( void )
{
- int sock, err, if_count, i, j = 0;
+ int if_count, i, j = 0;
+#if !(defined(__FreeBSD__) || defined(__NetBSD__))
+ int sock, err;
struct ifconf netconf;
char buffer[32*MAX_IF];
- char if_name[10][21];
- char if_addr[10][21];
+#endif
+ char if_name[MAX_IF][21];
+ char if_addr[MAX_IF][21];
char *default_ifName;
+#if defined(__FreeBSD__) || defined(__NetBSD__)
+ struct ifaddrs *ifp, *oifp;
+
+ if(getifaddrs(&ifp) < 0 )
+ printf( "Error with getifaddrs(): %i.\n", errno );
+ oifp=ifp; /* save ifp */
+ for (if_count = 0; ifp != NULL; ifp = ifp->ifa_next) {
+ if(ifp->ifa_addr->sa_family != AF_INET) continue;
+
+ if ( strncmp( ifp->ifa_name, "lo", 2 ) != 0 ) {
+ if(j == MAX_IF) printf( "Error: cannot handle more than %d interfaces.\n",MAX_IF);
+ else
+ {
+ strncpy( if_name[j], ifp->ifa_name, 20);
+ strncpy( if_addr[j], inet_ntoa(((struct sockaddr_in *)ifp->ifa_addr)->sin_addr ), 20);
+ j++;
+ }
+ }
+ if_count++;
+ }
+ if (oifp != NULL) freeifaddrs(oifp);
+
+#else /* not FreeBSD or NetBSD */
netconf.ifc_len = 32 * MAX_IF;
netconf.ifc_buf = buffer;
sock=socket( PF_INET, SOCK_DGRAM, 0 );
@@ -104,9 +140,11 @@
if ( err < 0 ) printf( "Error in ioctl: %i.\n", errno );
close( sock );
if_count = netconf.ifc_len / 32;
+#endif
printf( "Found %i interfaces.\n", if_count );
//#test
+#if !(defined(__FreeBSD__) || defined(__NetBSD__))
if ( if_count == 1 ) {
strncpy( if_name[j], netconf.ifc_req[0].ifr_name, 20 );
strncpy( if_addr[j], inet_ntoa(((struct sockaddr_in*)(&netconf.ifc_req[0].ifr_addr))->sin_addr), 20 );
@@ -120,6 +158,8 @@
}
}
}
+#endif /* not FreeBSD or NetBSD */
+
if( j == 1 ) {
dissipate_our_fqdn = strdup( if_addr[0] );
} else {

View file

@ -0,0 +1,19 @@
--- dissipate2/udpmessagesocket.cpp.orig Mon Jul 5 13:51:09 2004
+++ dissipate2/udpmessagesocket.cpp Mon Jul 5 13:59:32 2004
@@ -1,5 +1,7 @@
#include <sys/types.h>
#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <errno.h>
#include <string.h>
@@ -52,7 +54,7 @@
socklen_t optlen;
tos=IPTOS_PREC_CRITIC_ECP;
optlen=1;
- if(setsockopt(socketfd,SOL_IP,IP_TOS,&tos,optlen) != 0){
+ if(setsockopt(socketfd,IPPROTO_IP,IP_TOS,&tos,optlen) != 0){
perror("UDPMessageSocket::SetTOS");
}
return 0;

6
net/kphone/pkg-descr Normal file
View file

@ -0,0 +1,6 @@
KPhone is a SIP (Session Initiation Protocol) user agent with which you
can initiate VoIP (Voice over IP) connections over the Internet.
It supports Presence and Instant Messaging, and to some extent
also video calls between two hosts.
WWW: http://www.wirlab.net/

13
net/kphone/pkg-plist Normal file
View file

@ -0,0 +1,13 @@
bin/kphone
%%DATADIR%%/icons/dial.png
%%DATADIR%%/icons/enter.png
%%DATADIR%%/icons/hangup.png
%%DATADIR%%/icons/large-kphone.png
%%DATADIR%%/icons/lo-kphone.png
%%DATADIR%%/icons/mini-kphone.png
%%DATADIR%%/icons/offline.png
%%DATADIR%%/icons/online.png
%%DATADIR%%/icons/phonebook.png
%%DATADIR%%/icons/videocall.png
@dirrm %%DATADIR%%/icons
@dirrm %%DATADIR%%