提交 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@ ...@@ -34,6 +34,11 @@ CPP = @CPP@
CPPFLAGS = @CPPFLAGS@ CPPFLAGS = @CPPFLAGS@
DEFS = @DEFS@ DEFS = @DEFS@
CFLAGS=@CFLAGS@ @COMP_VENDOR_CFLAGS@ @DEFS@ CFLAGS=@CFLAGS@ @COMP_VENDOR_CFLAGS@ @DEFS@
###For libpcap
CFLAGS+=-D_GNU_SOURCE
####
LIBS = @LIBS@ LIBS = @LIBS@
DYNAMIC_LIB_EXTEN = @DYNAMIC_LIB_EXTEN@ DYNAMIC_LIB_EXTEN = @DYNAMIC_LIB_EXTEN@
SOLINK = @SOLINK@ SOLINK = @SOLINK@
...@@ -270,6 +275,8 @@ $(SRC)/ozmod/ozmod_isdn/ozmod_isdn.$(DYNAMIC_LIB_EXTEN): $(MYLIB) $(ISDN_OBJS) $ ...@@ -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) $(LINK) $(SOLINK) $(ISDN_OBJS) $(SRC)/ozmod/ozmod_isdn/ozmod_isdn.o $(MYLIB) -rpath $(libdir)
isdnmod: $(SRC)/ozmod/ozmod_isdn/ozmod_isdn.$(DYNAMIC_LIB_EXTEN) 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 $(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) $(LINK) $(SOLINK) $(SRC)/ozmod/ozmod_analog/ozmod_analog.o $(MYLIB) -rpath $(libdir)
analogmod: $(SRC)/ozmod/ozmod_analog/ozmod_analog.$(DYNAMIC_LIB_EXTEN) analogmod: $(SRC)/ozmod/ozmod_analog/ozmod_analog.$(DYNAMIC_LIB_EXTEN)
......
...@@ -113,7 +113,8 @@ esac ...@@ -113,7 +113,8 @@ esac
# These must not be set unconditionally because not all systems understand # These must not be set unconditionally because not all systems understand
# e.g. LANG=C (notably SCO). # e.g. LANG=C (notably SCO).
# We save the old values to restore during execute mode. # 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 do
eval "if test \"\${$lt_var+set}\" = set; then eval "if test \"\${$lt_var+set}\" = set; then
save_$lt_var=\$$lt_var save_$lt_var=\$$lt_var
...@@ -122,6 +123,10 @@ do ...@@ -122,6 +123,10 @@ do
fi" fi"
done done
if test -n "$lt_env"; then
lt_env="env $lt_env"
fi
# Make sure IFS has a sensible default # Make sure IFS has a sensible default
lt_nl=' lt_nl='
' '
...@@ -817,6 +822,7 @@ if test -z "$show_help"; then ...@@ -817,6 +822,7 @@ if test -z "$show_help"; then
*.for) xform=for ;; *.for) xform=for ;;
*.java) xform=java ;; *.java) xform=java ;;
*.obj) xform=obj ;; *.obj) xform=obj ;;
*.sx) xform=sx ;;
esac esac
libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
...@@ -985,7 +991,7 @@ EOF ...@@ -985,7 +991,7 @@ EOF
$run $rm "$lobj" "$output_obj" $run $rm "$lobj" "$output_obj"
$show "$command" $show "$command"
if $run eval "$command"; then : if $run eval $lt_env "$command"; then :
else else
test -n "$output_obj" && $run $rm $removelist test -n "$output_obj" && $run $rm $removelist
exit $EXIT_FAILURE exit $EXIT_FAILURE
...@@ -1057,7 +1063,7 @@ EOF ...@@ -1057,7 +1063,7 @@ EOF
command="$command$suppress_output" command="$command$suppress_output"
$run $rm "$obj" "$output_obj" $run $rm "$obj" "$output_obj"
$show "$command" $show "$command"
if $run eval "$command"; then : if $run eval $lt_env "$command"; then :
else else
$run $rm $removelist $run $rm $removelist
exit $EXIT_FAILURE exit $EXIT_FAILURE
...@@ -1190,6 +1196,7 @@ EOF ...@@ -1190,6 +1196,7 @@ EOF
thread_safe=no thread_safe=no
vinfo= vinfo=
vinfo_number=no vinfo_number=no
single_module="${wl}-single_module"
func_infer_tag $base_compile func_infer_tag $base_compile
...@@ -1676,6 +1683,11 @@ EOF ...@@ -1676,6 +1683,11 @@ EOF
continue continue
;; ;;
-multi_module)
single_module="${wl}-multi_module"
continue
;;
-module) -module)
module=yes module=yes
continue continue
...@@ -2152,7 +2164,10 @@ EOF ...@@ -2152,7 +2164,10 @@ EOF
case $pass in case $pass in
dlopen) libs="$dlfiles" ;; dlopen) libs="$dlfiles" ;;
dlpreopen) libs="$dlprefiles" ;; dlpreopen) libs="$dlprefiles" ;;
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; link)
libs="$deplibs %DEPLIBS%"
test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
;;
esac esac
fi fi
if test "$pass" = dlopen; then if test "$pass" = dlopen; then
...@@ -2202,7 +2217,12 @@ EOF ...@@ -2202,7 +2217,12 @@ EOF
continue continue
fi fi
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 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 for search_ext in .la $std_shrext .so .a; do
# Search the libtool library # Search the libtool library
lib="$searchdir/lib${name}${search_ext}" lib="$searchdir/lib${name}${search_ext}"
...@@ -2998,12 +3018,18 @@ EOF ...@@ -2998,12 +3018,18 @@ EOF
# we do not want to link against static libs, # we do not want to link against static libs,
# but need to link against shared # but need to link against shared
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 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 if test -n "$deplibrary_names" ; then
for tmp in $deplibrary_names ; do for tmp in $deplibrary_names ; do
depdepl=$tmp depdepl=$tmp
done 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" depdepl="$path/$depdepl"
else
# Can't find it, oh well...
depdepl=
fi fi
# do not add paths which are already there # do not add paths which are already there
case " $newlib_search_path " in case " $newlib_search_path " in
...@@ -3151,9 +3177,10 @@ EOF ...@@ -3151,9 +3177,10 @@ EOF
case $linkmode in case $linkmode in
oldlib) oldlib)
if test -n "$deplibs"; then case " $deplibs" in
$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 *\ -l* | *\ -L*)
fi $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
esac
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
...@@ -3297,6 +3324,11 @@ EOF ...@@ -3297,6 +3324,11 @@ EOF
revision="$number_minor" revision="$number_minor"
lt_irix_increment=no 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 esac
;; ;;
no) no)
...@@ -4290,9 +4322,10 @@ EOF ...@@ -4290,9 +4322,10 @@ EOF
;; ;;
obj) obj)
if test -n "$deplibs"; then case " $deplibs" in
$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 *\ -l* | *\ -L*)
fi $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
esac
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
...@@ -6534,7 +6567,7 @@ relink_command=\"$relink_command\"" ...@@ -6534,7 +6567,7 @@ relink_command=\"$relink_command\""
fi fi
# Restore saved environment variables # 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 do
eval "if test \"\${save_$lt_var+set}\" = set; then eval "if test \"\${save_$lt_var+set}\" = set; then
$lt_var=\$save_$lt_var; export $lt_var $lt_var=\$save_$lt_var; export $lt_var
......
...@@ -1682,6 +1682,7 @@ static switch_status_t load_config(void) ...@@ -1682,6 +1682,7 @@ static switch_status_t load_config(void)
zap_log(ZAP_LOG_ERROR, "Error starting OpenZAP span %d\n", span_id); zap_log(ZAP_LOG_ERROR, "Error starting OpenZAP span %d\n", span_id);
continue; continue;
} }
zap_log(ZAP_LOG_ERROR, "SPANID = %i\n", span->span_id);
SPAN_CONFIG[span->span_id].span = span; SPAN_CONFIG[span->span_id].span = span;
switch_set_string(SPAN_CONFIG[span->span_id].context, context); switch_set_string(SPAN_CONFIG[span->span_id].context, context);
...@@ -1838,7 +1839,7 @@ static switch_status_t load_config(void) ...@@ -1838,7 +1839,7 @@ static switch_status_t load_config(void)
int q921loglevel = -1; int q921loglevel = -1;
int q931loglevel = -1; int q931loglevel = -1;
// quick debug // 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) { for (param = switch_xml_child(myspan, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name"); 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 ...@@ -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) SWITCH_STANDARD_API(oz_function)
{ {
char *mycmd = NULL, *argv[10] = { 0 }; char *mycmd = NULL, *argv[10] = { 0 };
...@@ -2139,7 +2140,7 @@ SWITCH_STANDARD_API(oz_function) ...@@ -2139,7 +2140,7 @@ SWITCH_STANDARD_API(oz_function)
} else if (!strcasecmp(argv[0], "bounce")) { } else if (!strcasecmp(argv[0], "bounce")) {
/* MSC testing "oz bounce" command */ /* MSC testing "oz bounce" command */
if (argc < 2) { 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; goto end;
} else { } else {
int32_t span_id, chan_id = 0; int32_t span_id, chan_id = 0;
...@@ -2169,9 +2170,59 @@ SWITCH_STANDARD_API(oz_function) ...@@ -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 { } 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: end:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论