Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Oct 2007 06:30:05 GMT
From:      Mayo Jordanov <mayo@oyam.ca>
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   Re: ports/117475: [maintainer update] updated net/asterisk-app-notify that works with Asterisk 1.4
Message-ID:  <200710260630.l9Q6U5lC000925@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/117475; it has been noted by GNATS.

From: Mayo Jordanov <mayo@oyam.ca>
To: bug-followup@FreeBSD.org,
 Mayo Jordanov <mayo@oyam.ca>
Cc:  
Subject: Re: ports/117475: [maintainer update] updated net/asterisk-app-notify that works with Asterisk 1.4
Date: Thu, 25 Oct 2007 23:02:28 -0700

 --Apple-Mail-9-322983422
 Content-Type: multipart/mixed; boundary=Apple-Mail-8-322983341
 
 
 --Apple-Mail-8-322983341
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=US-ASCII;
 	delsp=yes;
 	format=flowed
 
 last update, I promise. I've triple checked the port Makfile and pkg- 
 * files and they look good now. portlint is happy too.
 
 - fixed incorrectly set PORTREVISION
 - fixed invalid PORTVERSION by defining DISTVERSION
 - remove unused variable ASTETCDIR
 - don't create directories this port is not responsible for
 - don't clean up directories this port is not responsible for
 
 thanks,
 mayo
 
 
 --Apple-Mail-8-322983341
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	x-unix-mode=0644;
 	name=asterisk-app-notify.txt
 Content-Disposition: attachment;
 	filename=asterisk-app-notify.txt
 
 diff -ruN asterisk-app-notify.orig/Makefile asterisk-app-notify/Makefile
 --- asterisk-app-notify.orig/Makefile	Wed Apr 11 20:09:24 2007
 +++ asterisk-app-notify/Makefile	Thu Oct 25 22:26:02 2007
 @@ -2,12 +2,11 @@
  # Date created:				23 March 2007
  # Whom:					mayo
  #
 -# $FreeBSD: ports/net/asterisk-app-notify/Makefile,v 1.2 2007/04/12 =
 03:09:24 sobomax Exp $
 +# $FreeBSD$
  #
 =20
  PORTNAME=3D	app_notify
 -PORTVERSION=3D	1.0
 -PORTREVISION=3D	1
 +DISTVERSION=3D	2.0rc1
  CATEGORIES=3D	net
  MASTER_SITES=3D	http://www.mezzo.net/asterisk/ \
  		http://static.oyam.ca/freebsd/ports/
 @@ -16,20 +15,15 @@
  MAINTAINER=3D	mayo@oyam.ca
  COMMENT=3D	Notify application module for the Asterisk PBX
 =20
 -BUILD_DEPENDS=3D	asterisk:${PORTSDIR}/net/asterisk12
 -RUN_DEPENDS=3D	asterisk:${PORTSDIR}/net/asterisk12
 +BUILD_DEPENDS=3D	asterisk:${PORTSDIR}/net/asterisk
 +RUN_DEPENDS=3D	asterisk:${PORTSDIR}/net/asterisk
 =20
  USE_GMAKE=3D	yes
 =20
 -ASTETCDIR=3D	${PREFIX}/etc/asterisk
 -
 -pre-install:
 -	${MKDIR} ${ASTETCDIR}
 +#pre-install:
 +#	${MKDIR} ${ASTETCDIR}
 =20
  post-install:
 -	@if [ ! -f ${ASTETCDIR}/dialer_extensions.conf ]; then \
 -		${CP} -p ${ASTETCDIR}/dialer_extensions.conf.sample =
 ${ASTETCDIR}/dialer_extensions.conf ; \
 -	fi
  	@${CAT} ${PKGMESSAGE}
 =20
  .include <bsd.port.mk>
 Binary files asterisk-app-notify.orig/app_notify-2.0.r1.tbz and =
 asterisk-app-notify/app_notify-2.0.r1.tbz differ
 diff -ruN asterisk-app-notify.orig/distinfo asterisk-app-notify/distinfo
 --- asterisk-app-notify.orig/distinfo	Sun Mar 25 13:48:09 2007
 +++ asterisk-app-notify/distinfo	Wed Oct 24 23:39:33 2007
 @@ -1,3 +1,3 @@
 -MD5 (app_notify-1.0.tgz) =3D a2f4bf2b6f306c0a60086e98265571a3
 -SHA256 (app_notify-1.0.tgz) =3D =
 84d219c9ad2eed6c19a35e491f631428bd367cce4e736d973c762380378c29c0
 -SIZE (app_notify-1.0.tgz) =3D 3839
 +MD5 (app_notify-2.0rc1.tgz) =3D 0522cc76705bd11e943f309ae5c4a03f
 +SHA256 (app_notify-2.0rc1.tgz) =3D =
 b3eb3a7b1f567c9bb0d44406d3425de3062194411d0559f2c9c547926e3ad0cf
 +SIZE (app_notify-2.0rc1.tgz) =3D 4053
 diff -ruN asterisk-app-notify.orig/files/patch-Makefile =
 asterisk-app-notify/files/patch-Makefile
 --- asterisk-app-notify.orig/files/patch-Makefile	Sun Mar 25 =
 13:48:09 2007
 +++ asterisk-app-notify/files/patch-Makefile	Thu Oct 25 00:05:23 2007
 @@ -1,33 +1,27 @@
 ---- Makefile.orig	Fri Mar 23 21:14:57 2007
 -+++ Makefile	Sat Mar 24 00:09:09 2007
 -@@ -9,7 +9,7 @@
 - NAME=3Dapp_notify
 - CONF=3Ddialer_extensions.conf
 +--- Makefile.orig	Thu Feb  1 04:08:39 2007
 ++++ Makefile	Thu Oct 25 00:05:18 2007
 +@@ -7,6 +7,7 @@
 + #
  =20
 --CFLAGS=3D-g -Wall -D_REENTRANT -D_GNU_SOURCE -fPIC
 -+CFLAGS+=3D -g -Wall -D_REENTRANT -D_GNU_SOURCE -fPIC =
 -I$(LOCALBASE)/include
 - LIBS=3D
 - RES=3D$(NAME).so
 + NAME=3Dapp_notify
 ++CONF=3Dextensions_dialer.conf
  =20
 -@@ -19,7 +19,7 @@
 - SOLINK=3D-shared -Xlinker -x
 + CC=3Dgcc
 + CFLAGS=3D$(shell ./cflags.sh)
 +@@ -21,7 +22,7 @@
 + 	CC=3Dgcc -arch ppc -arch i386
 + else
 +   SOLINK=3D-shared -Xlinker -x
 +-  MODULES_DIR=3D/usr/lib/asterisk/modules
 ++  MODULES_DIR=3D$(LOCALBASE)/lib/asterisk/modules
   endif
  =20
 --MODULES_DIR=3D/usr/lib/asterisk/modules
 -+MODULES_DIR=3D$(PREFIX)/lib/asterisk/modules
 -=20
 - app_notify.so : app_notify.o
 - 	$(CC) $(SOLINK) -o $@ $<
 -@@ -30,10 +30,9 @@
 + RES=3D$(NAME).so
 +@@ -35,6 +36,7 @@
   	rm -f $(NAME).o $(NAME).so notifyClient.o notifyClient =
 sampleClient
  =20
   install: all
 --	if ! [ -f /etc/asterisk/$(CONF) ]; then \
 --		install -m 644 $(CONF).sample /etc/asterisk/$(CONF) ; \
 --	fi
 -+	install -m 644 $(CONF).sample =
 $(PREFIX)/etc/asterisk/$(CONF).sample ; \
 ++	install -m 644 $(CONF).sample =
 $(LOCALBASE)/etc/asterisk/$(CONF).sample ; \
   	if [ -f $(NAME).so ]; then \
 -+		mkdir -p $(MODULES_DIR) ; \
   		install -m 755 $(NAME).so $(MODULES_DIR) ; \
   	fi
 -=20
 diff -ruN asterisk-app-notify.orig/files/patch-cflags.sh =
 asterisk-app-notify/files/patch-cflags.sh
 --- asterisk-app-notify.orig/files/patch-cflags.sh	Wed Dec 31 =
 16:00:00 1969
 +++ asterisk-app-notify/files/patch-cflags.sh	Wed Oct 24 23:38:54 2007
 @@ -0,0 +1,12 @@
 +--- cflags.sh.orig	Wed Oct 24 23:37:00 2007
 ++++ cflags.sh	Wed Oct 24 23:31:46 2007
 +@@ -8,7 +8,8 @@
 +   INCDIR=3D/Library/Asterisk/include
 +   CFLAGS=3D"${CFLAGS} -I/Library/Asterisk/include"
 + else
 +-  INCDIR=3D/usr/include
 ++  INCDIR=3D${LOCALBASE}/include
 ++  CFLAGS=3D"${CFLAGS} -I${INCDIR}"
 + fi
 +=20
 + CHANNEL_H=3D${INCDIR}/asterisk/channel.h
 diff -ruN asterisk-app-notify.orig/pkg-message =
 asterisk-app-notify/pkg-message
 --- asterisk-app-notify.orig/pkg-message	Sun Mar 25 13:48:09 2007
 +++ asterisk-app-notify/pkg-message	Thu Oct 25 00:45:07 2007
 @@ -3,12 +3,12 @@
  a) If this is a new install, restart Asterisk or activate the module by
     running:
 =20
 -   # asterisk -rx "load app_notify"
 +   # asterisk -rx "module load app_notify"
 =20
  b) If this is an upgrade, you can restart Asterisk or reload the module =
 by
     running:
 =20
 -   # asterisk -rx "unload app_notify"
 -   # asterisk -rx "load app_notify"
 +   # asterisk -rx "module unload app_notify"
 +   # asterisk -rx "module load app_notify"
 =20
  =
 **************************************************************************=
 ***
 diff -ruN asterisk-app-notify.orig/pkg-plist =
 asterisk-app-notify/pkg-plist
 --- asterisk-app-notify.orig/pkg-plist	Sun Mar 25 13:48:09 2007
 +++ asterisk-app-notify/pkg-plist	Thu Oct 25 22:35:17 2007
 @@ -1,7 +1,2 @@
 -@unexec if cmp -s %D/etc/asterisk/dialer_extensions.conf.sample =
 %D/etc/asterisk/dialer_extensions.conf; then rm -f =
 %D/etc/asterisk/dialer_extensions.conf; fi
 -etc/asterisk/dialer_extensions.conf.sample
 -@exec if [ ! -f %D/etc/asterisk/dialer_extensions.conf ] ; then cp -p =
 %D/%F %B/dialer_extensions.conf; fi
 +etc/asterisk/extensions_dialer.conf.sample
  lib/asterisk/modules/app_notify.so
 -@dirrmtry lib/asterisk/modules
 -@dirrmtry lib/asterisk
 -@dirrmtry etc/asterisk
 diff -ruN asterisk-app-notify.orig/work/.PLIST.flattened =
 asterisk-app-notify/work/.PLIST.flattened
 --- asterisk-app-notify.orig/work/.PLIST.flattened	Wed Dec 31 =
 16:00:00 1969
 +++ asterisk-app-notify/work/.PLIST.flattened	Thu Oct 25 22:36:54 2007
 @@ -0,0 +1,2 @@
 +/usr/local/etc/asterisk/extensions_dialer.conf.sample
 +/usr/local/lib/asterisk/modules/app_notify.so
 diff -ruN asterisk-app-notify.orig/work/.PLIST.mktmp =
 asterisk-app-notify/work/.PLIST.mktmp
 --- asterisk-app-notify.orig/work/.PLIST.mktmp	Wed Dec 31 16:00:00 1969
 +++ asterisk-app-notify/work/.PLIST.mktmp	Thu Oct 25 22:36:44 2007
 @@ -0,0 +1,2 @@
 +etc/asterisk/extensions_dialer.conf.sample
 +lib/asterisk/modules/app_notify.so
 diff -ruN asterisk-app-notify.orig/work/.PLIST.objdump =
 asterisk-app-notify/work/.PLIST.objdump
 --- asterisk-app-notify.orig/work/.PLIST.objdump	Wed Dec 31 =
 16:00:00 1969
 +++ asterisk-app-notify/work/.PLIST.objdump	Thu Oct 25 22:36:54 2007
 @@ -0,0 +1,51 @@
 +
 +/usr/local/lib/asterisk/modules/app_notify.so:     file format =
 elf32-i386-freebsd
 +
 +DYNAMIC RELOCATION RECORDS
 +OFFSET   TYPE              VALUE=20
 +00002640 R_386_RELATIVE    *ABS*
 +00002644 R_386_RELATIVE    *ABS*
 +00002660 R_386_RELATIVE    *ABS*
 +00002664 R_386_RELATIVE    *ABS*
 +00002668 R_386_RELATIVE    *ABS*
 +00002684 R_386_RELATIVE    *ABS*
 +0000268c R_386_RELATIVE    *ABS*
 +00002690 R_386_RELATIVE    *ABS*
 +00002694 R_386_RELATIVE    *ABS*
 +00002698 R_386_RELATIVE    *ABS*
 +000026a0 R_386_RELATIVE    *ABS*
 +0000274c R_386_RELATIVE    *ABS*
 +00002758 R_386_RELATIVE    *ABS*
 +000027d8 R_386_GLOB_DAT    __cxa_finalize
 +000027dc R_386_GLOB_DAT    __deregister_frame_info
 +000027e0 R_386_GLOB_DAT    option_verbose
 +000027e4 R_386_GLOB_DAT    _Jv_RegisterClasses
 +000027e8 R_386_GLOB_DAT    __register_frame_info
 +00002770 R_386_JUMP_SLOT   ast_verbose
 +00002774 R_386_JUMP_SLOT   ast_module_register
 +00002778 R_386_JUMP_SLOT   __inet_addr
 +0000277c R_386_JUMP_SLOT   memcpy
 +00002780 R_386_JUMP_SLOT   __cxa_finalize
 +00002784 R_386_JUMP_SLOT   ast_register_application
 +00002788 R_386_JUMP_SLOT   socket
 +0000278c R_386_JUMP_SLOT   notify
 +00002790 R_386_JUMP_SLOT   __deregister_frame_info
 +00002794 R_386_JUMP_SLOT   ast_log
 +00002798 R_386_JUMP_SLOT   setsockopt
 +0000279c R_386_JUMP_SLOT   ast_gethostbyname
 +000027a0 R_386_JUMP_SLOT   sendto
 +000027a4 R_386_JUMP_SLOT   __ast_module_user_remove
 +000027a8 R_386_JUMP_SLOT   ast_module_unregister
 +000027ac R_386_JUMP_SLOT   __ast_module_user_hangup_all
 +000027b0 R_386_JUMP_SLOT   memset
 +000027b4 R_386_JUMP_SLOT   __ast_module_user_add
 +000027b8 R_386_JUMP_SLOT   strsep
 +000027bc R_386_JUMP_SLOT   atoi
 +000027c0 R_386_JUMP_SLOT   ast_unregister_application
 +000027c4 R_386_JUMP_SLOT   strlen
 +000027c8 R_386_JUMP_SLOT   strchr
 +000027cc R_386_JUMP_SLOT   _Jv_RegisterClasses
 +000027d0 R_386_JUMP_SLOT   __register_frame_info
 +000027d4 R_386_JUMP_SLOT   close
 +
 +
 diff -ruN asterisk-app-notify.orig/work/app_notify-2.0rc1/CHANGES =
 asterisk-app-notify/work/app_notify-2.0rc1/CHANGES
 --- asterisk-app-notify.orig/work/app_notify-2.0rc1/CHANGES	Wed Dec =
 31 16:00:00 1969
 +++ asterisk-app-notify/work/app_notify-2.0rc1/CHANGES	Thu Feb  1 =
 04:08:39 2007
 @@ -0,0 +1,10 @@
 +#
 +# app_notify
 +#
 +
 +0.9 - initial release
 +1.0rc1 - changes for asterisk 1.2
 +1.0rc2 - changed gethostbyname handling
 +1.0 - MacOSX, FreeBSD, Linux support
 +1.0 - MacOSX, FreeBSD, Linux support
 +2.0rc1 - neue version f=C3=BCr Asterisk 1.4 (thanks to Ronny Reinertsen =
 <ronny@reinertsen.net>)
 diff -ruN asterisk-app-notify.orig/work/app_notify-2.0rc1/Makefile =
 asterisk-app-notify/work/app_notify-2.0rc1/Makefile
 --- asterisk-app-notify.orig/work/app_notify-2.0rc1/Makefile	Wed Dec =
 31 16:00:00 1969
 +++ asterisk-app-notify/work/app_notify-2.0rc1/Makefile	Thu Oct 25 =
 22:36:42 2007
 @@ -0,0 +1,46 @@
 +#
 +# Network Caller Notification module for the Asterisk PBX
 +#
 +# Copyright (C) 2004,2005,2006 mezzoConsult C.B.
 +#
 +# Sven Slezak <sunny@mezzo.net>
 +#
 +
 +NAME=3Dapp_notify
 +CONF=3Dextensions_dialer.conf
 +
 +CC=3Dgcc
 +CFLAGS=3D$(shell ./cflags.sh)
 +
 +OSARCH=3D$(shell uname -s)
 +
 +ifeq ($(OSARCH),Darwin)
 +  CFLAGS+=3D -D__Darwin__
 +  SOLINK=3D-dynamic -bundle -undefined suppress -force_flat_namespace
 +  TESTLINK=3D-undefined suppress -force_flat_namespace
 +  MODULES_DIR=3D/Library/Asterisk/modules
 +	CC=3Dgcc -arch ppc -arch i386
 +else
 +  SOLINK=3D-shared -Xlinker -x
 +  MODULES_DIR=3D$(LOCALBASE)/lib/asterisk/modules
 +endif
 +
 +RES=3D$(NAME).so
 +
 +app_notify.so : app_notify.o
 +	$(CC) $(SOLINK) -o $@ $<
 +
 +all: $(RES) sampleClient
 +
 +clean:
 +	rm -f $(NAME).o $(NAME).so notifyClient.o notifyClient =
 sampleClient
 +
 +install: all
 +	install -m 644 $(CONF).sample =
 $(LOCALBASE)/etc/asterisk/$(CONF).sample ; \
 +	if [ -f $(NAME).so ]; then \
 +		install -m 755 $(NAME).so $(MODULES_DIR) ; \
 +	fi
 +
 +reload: install
 +	asterisk -rx "unload ${RES}"
 +	asterisk -rx "load ${RES}"
 diff -ruN asterisk-app-notify.orig/work/app_notify-2.0rc1/Makefile.orig =
 asterisk-app-notify/work/app_notify-2.0rc1/Makefile.orig
 --- asterisk-app-notify.orig/work/app_notify-2.0rc1/Makefile.orig	=
 Wed Dec 31 16:00:00 1969
 +++ asterisk-app-notify/work/app_notify-2.0rc1/Makefile.orig	Thu Feb  =
 1 04:08:39 2007
 @@ -0,0 +1,44 @@
 +#
 +# Network Caller Notification module for the Asterisk PBX
 +#
 +# Copyright (C) 2004,2005,2006 mezzoConsult C.B.
 +#
 +# Sven Slezak <sunny@mezzo.net>
 +#
 +
 +NAME=3Dapp_notify
 +
 +CC=3Dgcc
 +CFLAGS=3D$(shell ./cflags.sh)
 +
 +OSARCH=3D$(shell uname -s)
 +
 +ifeq ($(OSARCH),Darwin)
 +  CFLAGS+=3D -D__Darwin__
 +  SOLINK=3D-dynamic -bundle -undefined suppress -force_flat_namespace
 +  TESTLINK=3D-undefined suppress -force_flat_namespace
 +  MODULES_DIR=3D/Library/Asterisk/modules
 +	CC=3Dgcc -arch ppc -arch i386
 +else
 +  SOLINK=3D-shared -Xlinker -x
 +  MODULES_DIR=3D/usr/lib/asterisk/modules
 +endif
 +
 +RES=3D$(NAME).so
 +
 +app_notify.so : app_notify.o
 +	$(CC) $(SOLINK) -o $@ $<
 +
 +all: $(RES) sampleClient
 +
 +clean:
 +	rm -f $(NAME).o $(NAME).so notifyClient.o notifyClient =
 sampleClient
 +
 +install: all
 +	if [ -f $(NAME).so ]; then \
 +		install -m 755 $(NAME).so $(MODULES_DIR) ; \
 +	fi
 +
 +reload: install
 +	asterisk -rx "unload ${RES}"
 +	asterisk -rx "load ${RES}"
 diff -ruN asterisk-app-notify.orig/work/app_notify-2.0rc1/README =
 asterisk-app-notify/work/app_notify-2.0rc1/README
 --- asterisk-app-notify.orig/work/app_notify-2.0rc1/README	Wed Dec =
 31 16:00:00 1969
 +++ asterisk-app-notify/work/app_notify-2.0rc1/README	Thu Feb  1 =
 04:08:39 2007
 @@ -0,0 +1,38 @@
 +Network Caller*ID notification application module for asterisk
 +(c)2004,2005 Sven Slezak <sunny@mezzo.net>
 +Version: 0.9
 +
 +Notify is an asterisk application for client notification.
 +You can send messages to clients over the network.
 +An Asterisk notification client for Mac OS-X can be downloaded from =
 http://mezzo.net/asterisk/
 +That client supports Text2Speech, AddressBook, iCal, Bonjour, Growl.
 +
 +The syntax for Notify in extensions.conf is as follows:
 +
 +Notify(<cidnum>|<cidname>|<extension>/<hostname>[:port(default:40000)])
 +
 +
 +EXAMPLE:
 +exten =3D> =
 s,1000,Notify(${CALLERIDNUM}|${CALLERIDNAME}|${EXTEN}/sunnybook)
 +exten =3D> =
 s,1001,Notify(${CALLERIDNUM}|${CALLERIDNAME}|${EXTEN}/windfeebook)
 +
 +HOW TO COMPILE?
 +
 +You need the iconv library and header file (included in glibc-headers).
 +And of course the Asterisk pbx compiled and installed.
 +
 +Unpack the package:
 +tar -xzf app_notify-0.9.tgz
 +
 +and run:
 +make install
 +
 +Restart asterisk or load the application with:=20
 +load app_notify.so
 +
 +you're done. 'show application Notify' should print the description.
 +
 +
 +Todo:
 +- enable broadcasts/multicats
 +- re-ask for manager password when password is wrong.
 \ No newline at end of file
 diff -ruN asterisk-app-notify.orig/work/app_notify-2.0rc1/app_notify.c =
 asterisk-app-notify/work/app_notify-2.0rc1/app_notify.c
 --- asterisk-app-notify.orig/work/app_notify-2.0rc1/app_notify.c	=
 Wed Dec 31 16:00:00 1969
 +++ asterisk-app-notify/work/app_notify-2.0rc1/app_notify.c	Thu Feb  =
 1 04:08:39 2007
 @@ -0,0 +1,156 @@
 +/*
 + * Asterisk -- A telephony toolkit for Unix.
 + *
 + * Network Notification Application Module for Asterisk
 + *
 + * Copyright (c)2005,2006 mezzoCONSULT C.B.=20
 + *           Sven Slezak <sunny@mezzo.net>
 + * Version: 2.0rc1 (Jan 29.2007)
 + * http://www.mezzo.net/asterisk
 + *
 + */
 +
 +#include <stdlib.h>
 +#include <stdio.h>
 +#include <unistd.h>
 +#include <string.h>
 +#include <sys/types.h>
 +
 +#include <asterisk/options.h>
 +#include <asterisk/file.h>
 +#include <asterisk/logger.h>
 +#include <asterisk/channel.h>
 +#include <asterisk/pbx.h>
 +#include <asterisk/module.h>
 +#include <asterisk/astdb.h>
 +#include <asterisk/lock.h>
 +#include <asterisk/config.h>
 +#include <asterisk/utils.h>
 +
 +#include <ctype.h>
 +#include <errno.h>
 +
 +#include <sys/socket.h>
 +#include <netinet/in.h>
 +#include <arpa/inet.h>
 +#include <netdb.h>
 +#include <sys/time.h> /* select() */=20
 +
 +#define AST_MODULE "app_notify"
 +
 +#define DEFAULT_PORT 40000
 +
 +int notify(const char *text, const char *host, int port);
 +
 +
 +static char *app =3D "Notify";
 +static char *synopsis =3D "network notification application";
 +
 +static char *descrip =3D
 +  "  Notify(text/hostname_or_ip[:port]): \n"
 +  "   sends the text to the given hosts.\n"
 +  "   Always returns 0.\n";
 +
 +static int notify_exec (struct ast_channel *chan, void *data)
 +{
 +  int arglen, port;
 +  char *argv, *text, *host, *tmp;
 +	struct ast_module_user *u;
 +
 +	if(!data) {
 +		ast_log (LOG_ERROR, "Requires parameters\n");
 +		return -1;
 +	}       =20
 +	u =3D ast_module_user_add(chan);
 +
 +  arglen =3D strlen(data);
 +  argv =3D alloca(arglen + 1);
 +  if(!argv) {
 +    ast_log (LOG_ERROR, "Memory allocation failed\n");
 +		ast_module_user_remove(u);
 +		return -1;
 +  }
 +  memcpy (argv, data, arglen + 1);
 +
 +  if(strchr(argv, '/')) {
 +    text =3D strsep(&argv, "/");
 +    host =3D strsep(&argv, "\0");
 +    if (!text || !host) {
 +      ast_log (LOG_ERROR, "Ignoring: Syntax error in argument\n");
 +			ast_module_user_remove(u);
 +			return -1;
 +    }=20
 +    if(strchr(host, ':')) {
 +      tmp =3D strsep(&host, ":");
 +      port =3D atoi(strsep(&host, "\0"));
 +      host =3D tmp;
 +    } else {
 +      port =3D DEFAULT_PORT;
 +    }
 +  } else {
 +    ast_log (LOG_ERROR, "Ignoring: Wrong parameters\n");
 +		ast_module_user_remove(u);
 +		return -1;
 +  }
 +
 +  notify(text, host, port);
 +	ast_module_user_remove(u);
 +
 +  return 0;
 +}
 +
 +int notify(const char *text, const char *host, int port)=20
 +{
 +  int sock;
 +  int broadcast =3D 1;
 +  struct sockaddr_in servAddr;
 +  struct hostent *hp;
 +  struct ast_hostent ahp;
 +
 +  if(option_verbose > 2)
 +    ast_verbose (VERBOSE_PREFIX_3 "Notify: sending '%s' to %s:%d \n", =
 text, host, port);
 +
 +  if ((sock =3D socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
 +    ast_log(LOG_ERROR, "cannot open socket\n");
 +    return -1;
 +  }
 +
 +  if(setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &broadcast, =
 sizeof(broadcast)) < 0) {
 +    ast_log(LOG_ERROR, "setsockopt error.\n");
 +  }
 +
 +  memset(&servAddr, 0, sizeof(struct sockaddr_in));
 +  servAddr.sin_family =3D AF_INET;
 +  servAddr.sin_port =3D htons(port);
 +
 +  if((servAddr.sin_addr.s_addr =3D inet_addr(host)) =3D=3D -1) {
 +    hp =3D ast_gethostbyname(host, &ahp);
 +    if(hp =3D=3D (struct hostent *)0) {
 +      ast_log(LOG_ERROR, "unknown host: %s\n", host);
 +      return -1;
 +    }
 +    memcpy(&servAddr.sin_addr, hp->h_addr_list[0], hp->h_length);
 +  } =20
 +
 +  if (sendto(sock, text, strlen(text)+1, 0, (struct sockaddr =
 *)&servAddr, sizeof(servAddr)) < 0) {
 +    ast_log(LOG_ERROR, "cannot send text\n");
 +    close(sock);
 +    return -1;
 +  }
 +
 +  close(sock);
 +  return 0;
 +}
 +
 +static int unload_module(void)
 +{
 +	ast_module_user_hangup_all();=20
 +	return ast_unregister_application(app);
 +}
 +
 +static int load_module(void)
 +{
 +	return ast_register_application(app, notify_exec, synopsis, =
 descrip);
 +}
 +
 +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "network notification =
 function for Asterisk extension logic.");
 Binary files =
 asterisk-app-notify.orig/work/app_notify-2.0rc1/app_notify.o and =
 asterisk-app-notify/work/app_notify-2.0rc1/app_notify.o differ
 Binary files =
 asterisk-app-notify.orig/work/app_notify-2.0rc1/app_notify.so and =
 asterisk-app-notify/work/app_notify-2.0rc1/app_notify.so differ
 diff -ruN asterisk-app-notify.orig/work/app_notify-2.0rc1/cflags.sh =
 asterisk-app-notify/work/app_notify-2.0rc1/cflags.sh
 --- asterisk-app-notify.orig/work/app_notify-2.0rc1/cflags.sh	Wed Dec =
 31 16:00:00 1969
 +++ asterisk-app-notify/work/app_notify-2.0rc1/cflags.sh	Thu Oct =
 25 22:36:42 2007
 @@ -0,0 +1,25 @@
 +#!/bin/sh
 +
 +OSARCH=3D`uname -s`
 +
 +CFLAGS=3D"-g -Wall -D_REENTRANT -D_GNU_SOURCE -fPIC"
 +
 +if [ ${OSARCH} =3D "Darwin" ]; then
 +  INCDIR=3D/Library/Asterisk/include
 +  CFLAGS=3D"${CFLAGS} -I/Library/Asterisk/include"
 +else
 +  INCDIR=3D${LOCALBASE}/include
 +  CFLAGS=3D"${CFLAGS} -I${INCDIR}"
 +fi
 +
 +CHANNEL_H=3D${INCDIR}/asterisk/channel.h
 +if [ "`grep 'struct ast_callerid cid' ${CHANNEL_H}`" !=3D "" ]; then
 +    CFLAGS=3D"${CFLAGS} -DCHANNEL_HAS_CID"
 +fi
 +
 +CONFIG_H=3D${INCDIR}/asterisk/config.h
 +if [ "`grep 'ast_config_load' ${CONFIG_H}`" !=3D "" ]; then
 +    CFLAGS=3D"${CFLAGS} -DNEW_CONFIG"
 +fi
 +
 +echo "${CFLAGS}"
 diff -ruN asterisk-app-notify.orig/work/app_notify-2.0rc1/cflags.sh.orig =
 asterisk-app-notify/work/app_notify-2.0rc1/cflags.sh.orig
 --- asterisk-app-notify.orig/work/app_notify-2.0rc1/cflags.sh.orig	=
 Wed Dec 31 16:00:00 1969
 +++ asterisk-app-notify/work/app_notify-2.0rc1/cflags.sh.orig	Thu Feb  =
 1 04:08:39 2007
 @@ -0,0 +1,24 @@
 +#!/bin/sh
 +
 +OSARCH=3D`uname -s`
 +
 +CFLAGS=3D"-g -Wall -D_REENTRANT -D_GNU_SOURCE -fPIC"
 +
 +if [ ${OSARCH} =3D "Darwin" ]; then
 +  INCDIR=3D/Library/Asterisk/include
 +  CFLAGS=3D"${CFLAGS} -I/Library/Asterisk/include"
 +else
 +  INCDIR=3D/usr/include
 +fi
 +
 +CHANNEL_H=3D${INCDIR}/asterisk/channel.h
 +if [ "`grep 'struct ast_callerid cid' ${CHANNEL_H}`" !=3D "" ]; then
 +    CFLAGS=3D"${CFLAGS} -DCHANNEL_HAS_CID"
 +fi
 +
 +CONFIG_H=3D${INCDIR}/asterisk/config.h
 +if [ "`grep 'ast_config_load' ${CONFIG_H}`" !=3D "" ]; then
 +    CFLAGS=3D"${CFLAGS} -DNEW_CONFIG"
 +fi
 +
 +echo "${CFLAGS}"
 diff -ruN =
 asterisk-app-notify.orig/work/app_notify-2.0rc1/extensions_dialer.conf.sam=
 ple =
 asterisk-app-notify/work/app_notify-2.0rc1/extensions_dialer.conf.sample
 --- =
 asterisk-app-notify.orig/work/app_notify-2.0rc1/extensions_dialer.conf.sam=
 ple	Wed Dec 31 16:00:00 1969
 +++ =
 asterisk-app-notify/work/app_notify-2.0rc1/extensions_dialer.conf.sample	=
 Thu Feb  1 04:08:39 2007
 @@ -0,0 +1,5 @@
 +[dialer]
 +exten =3D> _X.,1,SetCallerID(${EXTEN})
 +exten =3D> _X.,2,Background(transfer)
 +exten =3D> _X.,3,Dial(Local/${EXTEN},120)
 +exten =3D> _X.,4,Hangup
 Binary files =
 asterisk-app-notify.orig/work/app_notify-2.0rc1/sampleClient and =
 asterisk-app-notify/work/app_notify-2.0rc1/sampleClient differ
 diff -ruN asterisk-app-notify.orig/work/app_notify-2.0rc1/sampleClient.c =
 asterisk-app-notify/work/app_notify-2.0rc1/sampleClient.c
 --- asterisk-app-notify.orig/work/app_notify-2.0rc1/sampleClient.c	=
 Wed Dec 31 16:00:00 1969
 +++ asterisk-app-notify/work/app_notify-2.0rc1/sampleClient.c	Thu Feb  =
 1 04:08:39 2007
 @@ -0,0 +1,57 @@
 +
 +#include <sys/types.h>
 +#include <sys/socket.h>
 +#include <netinet/in.h>
 +#include <arpa/inet.h>
 +#include <netdb.h>
 +#include <stdio.h>
 +#include <stdlib.h> /* exit() */
 +#include <unistd.h> /* close() */
 +#include <string.h> /* memset() */
 +
 +#define LOCAL_SERVER_PORT 40000
 +#define MAX_MSG 1024
 +
 +int main(int argc, char *argv[]) {
 +  int sd, rc, n;
 +  socklen_t cliLen;
 +  struct sockaddr_in cliAddr, servAddr;
 +	char *msg, *cidnum, *cidname, *called;
 +
 +  if((sd=3Dsocket(AF_INET, SOCK_DGRAM, 0))<0) {
 +    printf("%s: cannot open socket \n",argv[0]);
 +    exit(1);
 +  }
 +
 +  servAddr.sin_family =3D AF_INET;
 +  servAddr.sin_addr.s_addr =3D htonl(INADDR_ANY);
 +  servAddr.sin_port =3D htons(LOCAL_SERVER_PORT);
 +
 +  if((rc =3D bind (sd, (struct sockaddr *) =
 &servAddr,sizeof(servAddr)))<0) {
 +    printf("%s: cannot bind port %d \n", argv[0], LOCAL_SERVER_PORT);
 +    exit(1);
 +  }
 +
 +  printf("%s: waiting for data on port UDP %u\n", argv[0], =
 LOCAL_SERVER_PORT);
 +=09
 +	msg =3D alloca((size_t)MAX_MSG+1);
 +  while(1) {
 +    cliLen =3D sizeof(cliAddr);
 +    if((n =3D recvfrom(sd, msg, MAX_MSG, 0, (struct sockaddr =
 *)&cliAddr, &cliLen))<0) {
 +      printf("%s: cannot receive data \n",argv[0]);
 +      continue;
 +    }
 +
 +		if(strchr(msg,'|')) {
 +			cidnum  =3D strsep(&msg, "|");
 +			cidname  =3D strsep(&msg, "|");
 +			called  =3D strsep(&msg, "\0");
 +			printf("%s (%s) for %s\n", cidname, cidnum, =
 called);
 +		} else {
 +			printf("message received: %s", msg);
 +			continue;
 +		}
 +	=09
 +  }
 +	return 0;
 +}
 diff -ruN asterisk-app-notify.orig/work/app_notify-2.0rc1/sampleServer.c =
 asterisk-app-notify/work/app_notify-2.0rc1/sampleServer.c
 --- asterisk-app-notify.orig/work/app_notify-2.0rc1/sampleServer.c	=
 Wed Dec 31 16:00:00 1969
 +++ asterisk-app-notify/work/app_notify-2.0rc1/sampleServer.c	Thu Feb  =
 1 04:08:39 2007
 @@ -0,0 +1,48 @@
 +#include <stdio.h>
 +#include <sys/socket.h>
 +#include <arpa/inet.h>
 +#include <netinet/in.h>
 +#include <netdb.h>
 +#include <sys/types.h>
 +#include <stdlib.h> /* exit() */
 +#include <unistd.h> /* close() */
 +#include <string.h> /* memset() */
 +
 +#define LOCAL_SERVER_PORT 40000
 +#define MAX_MSG 1024
 +
 +void Die(char *mess) { perror(mess); exit(1); }
 +
 +int main(int argc, char *argv[]) {
 +	int sock;
 +	struct sockaddr_in servAddr;
 +	char buffer[MAX_MSG];
 +	unsigned int echolen;
 +	int received =3D 0;
 +
 +	if (argc !=3D 4) {
 +		fprintf(stderr, "USAGE: %s <server_ip> <word> <port>\n", =
 argv[0]);
 +		exit(1);
 +	}
 +
 +  /* Create the UDP socket */
 +	if ((sock =3D socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
 +		Die("Failed to create socket");
 +	}
 +	/* Construct the server sockaddr_in structure */
 +	memset(&servAddr, 0, sizeof(servAddr));       /* Clear struct */
 +	servAddr.sin_family =3D AF_INET;                  /* Internet/IP =
 */
 +	servAddr.sin_addr.s_addr =3D inet_addr(argv[1]);  /* IP address =
 */
 +	servAddr.sin_port =3D htons(atoi(argv[3]));       /* server port =
 */
 +
 +  /* Send the word to the server */
 +	echolen =3D strlen(argv[2]);
 +	if (sendto(sock, argv[2], echolen, 0,
 +						 (struct sockaddr *) =
 &servAddr,
 +						 sizeof(servAddr)) !=3D =
 echolen) {
 +		Die("Mismatch in number of sent bytes");
 +	}
 +
 +	close(sock);
 +	exit(0);
 +}
 
 --Apple-Mail-8-322983341--
 
 --Apple-Mail-9-322983422
 content-type: application/pgp-signature; x-mac-type=70674453;
 	name=PGP.sig
 content-description: This is a digitally signed message part
 content-disposition: inline; filename=PGP.sig
 content-transfer-encoding: 7bit
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.1 (Darwin)
 
 iEYEARECAAYFAkchgvcACgkQ3IqYlN3K/uYznQCfdD5OykpTMGw00dOW785m6rMM
 6SMAnR2qokV5vJJT+2watHLzhcmh/6xc
 =SvKx
 -----END PGP SIGNATURE-----
 
 --Apple-Mail-9-322983422--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200710260630.l9Q6U5lC000925>