提交 8333afcb authored 作者: Helmut Kuper's avatar Helmut Kuper

Q931ToPcap patch


git-svn-id: http://svn.openzap.org/svn/openzap/trunk@628 a93c3328-9c30-0410-af19-c9cd2b2d52af
上级 ac172da1
......@@ -34,6 +34,11 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
DEFS = @DEFS@
CFLAGS=@CFLAGS@ @COMP_VENDOR_CFLAGS@ @DEFS@
###For libpcap
CFLAGS+=-D_GNU_SOURCE
####
LIBS = @LIBS@
DYNAMIC_LIB_EXTEN = @DYNAMIC_LIB_EXTEN@
SOLINK = @SOLINK@
......@@ -270,6 +275,8 @@ $(SRC)/ozmod/ozmod_isdn/ozmod_isdn.$(DYNAMIC_LIB_EXTEN): $(MYLIB) $(ISDN_OBJS) $
$(LINK) $(SOLINK) $(ISDN_OBJS) $(SRC)/ozmod/ozmod_isdn/ozmod_isdn.o $(MYLIB) -rpath $(libdir)
isdnmod: $(SRC)/ozmod/ozmod_isdn/ozmod_isdn.$(DYNAMIC_LIB_EXTEN)
$(ISDN_OBJS2): $(ISDN_HEADERS) $(ISDN_SOURCES) $(SRC)/ozmod/ozmod_isdn_libpcap/ozmod_isdn.c
$(SRC)/ozmod/ozmod_analog/ozmod_analog.$(DYNAMIC_LIB_EXTEN): $(MYLIB) $(SRC)/ozmod/ozmod_analog/ozmod_analog.o
$(LINK) $(SOLINK) $(SRC)/ozmod/ozmod_analog/ozmod_analog.o $(MYLIB) -rpath $(libdir)
analogmod: $(SRC)/ozmod/ozmod_analog/ozmod_analog.$(DYNAMIC_LIB_EXTEN)
......
......@@ -113,7 +113,8 @@ esac
# These must not be set unconditionally because not all systems understand
# e.g. LANG=C (notably SCO).
# We save the old values to restore during execute mode.
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
lt_env=
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${$lt_var+set}\" = set; then
save_$lt_var=\$$lt_var
......@@ -122,6 +123,10 @@ do
fi"
done
if test -n "$lt_env"; then
lt_env="env $lt_env"
fi
# Make sure IFS has a sensible default
lt_nl='
'
......@@ -817,6 +822,7 @@ if test -z "$show_help"; then
*.for) xform=for ;;
*.java) xform=java ;;
*.obj) xform=obj ;;
*.sx) xform=sx ;;
esac
libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
......@@ -985,7 +991,7 @@ EOF
$run $rm "$lobj" "$output_obj"
$show "$command"
if $run eval "$command"; then :
if $run eval $lt_env "$command"; then :
else
test -n "$output_obj" && $run $rm $removelist
exit $EXIT_FAILURE
......@@ -1057,7 +1063,7 @@ EOF
command="$command$suppress_output"
$run $rm "$obj" "$output_obj"
$show "$command"
if $run eval "$command"; then :
if $run eval $lt_env "$command"; then :
else
$run $rm $removelist
exit $EXIT_FAILURE
......@@ -1190,6 +1196,7 @@ EOF
thread_safe=no
vinfo=
vinfo_number=no
single_module="${wl}-single_module"
func_infer_tag $base_compile
......@@ -1676,6 +1683,11 @@ EOF
continue
;;
-multi_module)
single_module="${wl}-multi_module"
continue
;;
-module)
module=yes
continue
......@@ -2152,7 +2164,10 @@ EOF
case $pass in
dlopen) libs="$dlfiles" ;;
dlpreopen) libs="$dlprefiles" ;;
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
link)
libs="$deplibs %DEPLIBS%"
test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
;;
esac
fi
if test "$pass" = dlopen; then
......@@ -2202,7 +2217,12 @@ EOF
continue
fi
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
if test "$linkmode" = lib; then
searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
else
searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
fi
for searchdir in $searchdirs; do
for search_ext in .la $std_shrext .so .a; do
# Search the libtool library
lib="$searchdir/lib${name}${search_ext}"
......@@ -2998,12 +3018,18 @@ EOF
# we do not want to link against static libs,
# but need to link against shared
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
if test -n "$deplibrary_names" ; then
for tmp in $deplibrary_names ; do
depdepl=$tmp
done
if test -f "$path/$depdepl" ; then
if test -f "$deplibdir/$depdepl" ; then
depdepl="$deplibdir/$depdepl"
elif test -f "$path/$depdepl" ; then
depdepl="$path/$depdepl"
else
# Can't find it, oh well...
depdepl=
fi
# do not add paths which are already there
case " $newlib_search_path " in
......@@ -3151,9 +3177,10 @@ EOF
case $linkmode in
oldlib)
if test -n "$deplibs"; then
$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
fi
case " $deplibs" in
*\ -l* | *\ -L*)
$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
esac
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
......@@ -3297,6 +3324,11 @@ EOF
revision="$number_minor"
lt_irix_increment=no
;;
*)
$echo "$modename: unknown library version type \`$version_type'" 1>&2
$echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
exit $EXIT_FAILURE
;;
esac
;;
no)
......@@ -4290,9 +4322,10 @@ EOF
;;
obj)
if test -n "$deplibs"; then
$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
fi
case " $deplibs" in
*\ -l* | *\ -L*)
$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
esac
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
......@@ -6534,7 +6567,7 @@ relink_command=\"$relink_command\""
fi
# Restore saved environment variables
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${save_$lt_var+set}\" = set; then
$lt_var=\$save_$lt_var; export $lt_var
......
......@@ -1682,6 +1682,7 @@ static switch_status_t load_config(void)
zap_log(ZAP_LOG_ERROR, "Error starting OpenZAP span %d\n", span_id);
continue;
}
zap_log(ZAP_LOG_ERROR, "SPANID = %i\n", span->span_id);
SPAN_CONFIG[span->span_id].span = span;
switch_set_string(SPAN_CONFIG[span->span_id].context, context);
......@@ -1838,7 +1839,7 @@ static switch_status_t load_config(void)
int q921loglevel = -1;
int q931loglevel = -1;
// quick debug
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ID: '%s', Name:'%s'\n",id,name);
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ID: '%s', Name:'%s'\n",id,name);
for (param = switch_xml_child(myspan, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
......@@ -2055,7 +2056,7 @@ void dump_chan(zap_span_t *span, uint32_t chan_id, switch_stream_handle_t *strea
);
}
#define OZ_SYNTAX "list || dump <span_id> [<chan_id>]"
#define OZ_SYNTAX "list || dump <span_id> [<chan_id>] || bounce <span_id> [<chan_id>] || q931_pcap <span_id> on|off [pcapfilename without suffix]"
SWITCH_STANDARD_API(oz_function)
{
char *mycmd = NULL, *argv[10] = { 0 };
......@@ -2139,7 +2140,7 @@ SWITCH_STANDARD_API(oz_function)
} else if (!strcasecmp(argv[0], "bounce")) {
/* MSC testing "oz bounce" command */
if (argc < 2) {
stream->write_function(stream, "-ERR Usage: oz dump <span_id> [<chan_id>]\n");
stream->write_function(stream, "-ERR Usage: oz bounce <span_id> [<chan_id>]\n");
goto end;
} else {
int32_t span_id, chan_id = 0;
......@@ -2169,9 +2170,59 @@ SWITCH_STANDARD_API(oz_function)
}
}
}
/*Q931ToPcap enhancement*/
} else if (!strcasecmp(argv[0], "q931_pcap")) {
int32_t span_id = 0;
zap_span_t *span;
char *pcapfn = NULL;
char *tmp_path = NULL;
if (argc < 3) {
stream->write_function(stream, "-ERR Usage: oz q931_pcap <span_id> on|off [pcapfilename without suffix]\n");
goto end;
}
span_id = atoi(argv[1]);
if (!(span_id && (span = SPAN_CONFIG[span_id].span))) {
stream->write_function(stream, "-ERR invalid span\n");
goto end;
}
/*Look for a given file name or use default file name*/
if (argc > 3) {
if(argv[3]){
pcapfn=argv[3];
}
}
else {
pcapfn="q931";
}
/*Add log directory path to file name*/
tmp_path=switch_mprintf("%s%s%s.pcap", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, pcapfn);
if(!strcasecmp(argv[2], "on")) {
if (zap_configure_span("isdn", span, on_clear_channel_signal, "q931topcap", 1, "pcapfilename", tmp_path, TAG_END) != ZAP_SUCCESS) {
zap_log(ZAP_LOG_WARNING, "Error couldn't (re-)enable Q931-To-Pcap!\n");
goto end;
} else {
stream->write_function(stream, "+OK\n");
}
} else if(!strcasecmp(argv[2], "off")) {
if (zap_configure_span("isdn", span, on_clear_channel_signal, "q931topcap", 0, TAG_END) != ZAP_SUCCESS) {
zap_log(ZAP_LOG_ERROR, "Error couldn't enable Q931-To-Pcap!\n");
goto end;
} else {
stream->write_function(stream, "+OK\n");
}
} else {
stream->write_function(stream, "-ERR Usage: oz q931_pcap on|off [pcapfilename without suffix]\n");
goto end;
}
} else {
stream->write_function(stream, "-ERR Usage: oz list || dump <span_id> [<chan_id>]\n");
stream->write_function(stream, "-ERR Usage: %s\n", OZ_SYNTAX);
}
/*Q931ToPcap enhancement done*/
end:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论