diff --git a/.gitignore b/.gitignore index 766adfb371..69f8cb476e 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ *.xz *.bz2 *.tbz2 +*.deb *.swp aclocal.m4 autom4te.cache @@ -43,6 +44,7 @@ config.cache configure.lineno config.log config.status +test-driver core.* TAGS *.2010.log diff --git a/acinclude.m4 b/acinclude.m4 index aeba17b5c3..58b5500a80 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -6,6 +6,7 @@ m4_include([build/config/ac_gcc_archflag.m4]) m4_include([build/config/ac_gcc_x86_cpuid.m4]) m4_include([build/config/ax_lib_mysql.m4]) m4_include([build/config/ax_check_java.m4]) +m4_include([build/config/uuid.m4]) m4_include([build/config/erlang.m4]) m4_include([build/config/odbc.m4]) m4_include([build/config/sched_setaffinity.m4]) diff --git a/build/config/uuid.m4 b/build/config/uuid.m4 new file mode 100644 index 0000000000..7f37c23c66 --- /dev/null +++ b/build/config/uuid.m4 @@ -0,0 +1,17 @@ +AC_DEFUN([CHECK_LIBUUID], + [ + PKG_CHECK_MODULES([LIBUUID], [uuid >= 1.41.2], + [LIBUUID_FOUND=yes], [LIBUUID_FOUND=no]) + if test "$LIBUUID_FOUND" = "no" ; then + PKG_CHECK_MODULES([LIBUUID], [uuid], + [LIBUUID_FOUND=yes], [LIBUUID_FOUND=no]) + if test "$LIBUUID_FOUND" = "no" ; then + AC_MSG_WARN([libuuid development package highly recommended!]) + else + LIBUUID_INCLUDEDIR=$(pkg-config --variable=includedir uuid) + LIBUUID_CFLAGS+=" -I$LIBUUID_INCLUDEDIR/uuid " + fi + fi + AC_SUBST([LIBUUID_CFLAGS]) + AC_SUBST([LIBUUID_LIBS]) + ]) diff --git a/build/modules.conf.in b/build/modules.conf.in index 81ae32f4c2..d60b1211ef 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -26,10 +26,14 @@ applications/mod_httapi #applications/mod_lcr #applications/mod_memcache #applications/mod_mongo +#applications/mod_mp4 #applications/mod_nibblebill +#applications/mod_oreka #applications/mod_osp +#applications/mod_rad_auth #applications/mod_redis #applications/mod_rss +#applications/mod_sonar applications/mod_sms #applications/mod_snapshot #applications/mod_snipe_hunt @@ -63,17 +67,20 @@ codecs/mod_h26x codecs/mod_vp8 #codecs/mod_ilbc #codecs/mod_isac +#codecs/mod_mp4v #codecs/mod_opus #codecs/mod_sangoma_codec #codecs/mod_silk #codecs/mod_siren codecs/mod_speex +#codecs/mod_theora dialplans/mod_dialplan_asterisk #dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml #directories/mod_ldap #endpoints/mod_alsa #endpoints/mod_dingaling +#endpoints/mod_gsmopen #endpoints/mod_h323 #endpoints/mod_html5 #endpoints/mod_khomp @@ -81,9 +88,10 @@ endpoints/mod_loopback #endpoints/mod_opal #endpoints/mod_portaudio #endpoints/mod_rtmp -#endpoints/mod_skinny +endpoints/mod_skinny #endpoints/mod_skypopen endpoints/mod_sofia +#endpoints/mod_unicall event_handlers/mod_cdr_csv #event_handlers/mod_cdr_mongodb #event_handlers/mod_cdr_pg_csv @@ -92,6 +100,7 @@ event_handlers/mod_cdr_sqlite #event_handlers/mod_event_multicast event_handlers/mod_event_socket #event_handlers/mod_event_zmq +#event_handlers/mod_json_cdr #event_handlers/mod_radius_cdr #event_handlers/mod_rayo #event_handlers/mod_snmp @@ -117,10 +126,13 @@ loggers/mod_syslog #say/mod_say_de say/mod_say_en #say/mod_say_es +#say/mod_say_fa #say/mod_say_fr #say/mod_say_he +#say/mod_say_hr #say/mod_say_hu #say/mod_say_it +#say/mod_say_ja #say/mod_say_nl #say/mod_say_pl #say/mod_say_pt @@ -140,4 +152,4 @@ xml_int/mod_xml_scgi #../../libs/openzap/mod_openzap ## Experimental Modules (don't cry if they're broken) -#../../contrib/mod/xml_int/mod_xml_odbc +#../../contrib/mod/xml_int/mod_xml_odbc \ No newline at end of file diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/acl.conf.xml b/conf/rayo/autoload_configs/acl.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/acl.conf.xml rename to conf/rayo/autoload_configs/acl.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/cdr_csv.conf.xml b/conf/rayo/autoload_configs/cdr_csv.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/cdr_csv.conf.xml rename to conf/rayo/autoload_configs/cdr_csv.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/conference.conf.xml b/conf/rayo/autoload_configs/conference.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/conference.conf.xml rename to conf/rayo/autoload_configs/conference.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/console.conf.xml b/conf/rayo/autoload_configs/console.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/console.conf.xml rename to conf/rayo/autoload_configs/console.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/distributor.conf.xml b/conf/rayo/autoload_configs/distributor.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/distributor.conf.xml rename to conf/rayo/autoload_configs/distributor.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/event_socket.conf.xml b/conf/rayo/autoload_configs/event_socket.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/event_socket.conf.xml rename to conf/rayo/autoload_configs/event_socket.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/hash.conf.xml b/conf/rayo/autoload_configs/hash.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/hash.conf.xml rename to conf/rayo/autoload_configs/hash.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/http_cache.conf.xml b/conf/rayo/autoload_configs/http_cache.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/http_cache.conf.xml rename to conf/rayo/autoload_configs/http_cache.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/local_stream.conf.xml b/conf/rayo/autoload_configs/local_stream.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/local_stream.conf.xml rename to conf/rayo/autoload_configs/local_stream.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/logfile.conf.xml b/conf/rayo/autoload_configs/logfile.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/logfile.conf.xml rename to conf/rayo/autoload_configs/logfile.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/lua.conf.xml b/conf/rayo/autoload_configs/lua.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/lua.conf.xml rename to conf/rayo/autoload_configs/lua.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/memcache.conf.xml b/conf/rayo/autoload_configs/memcache.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/memcache.conf.xml rename to conf/rayo/autoload_configs/memcache.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/modules.conf.xml b/conf/rayo/autoload_configs/modules.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/modules.conf.xml rename to conf/rayo/autoload_configs/modules.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/pocketsphinx.conf.xml b/conf/rayo/autoload_configs/pocketsphinx.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/pocketsphinx.conf.xml rename to conf/rayo/autoload_configs/pocketsphinx.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/post_load_modules.conf.xml b/conf/rayo/autoload_configs/post_load_modules.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/post_load_modules.conf.xml rename to conf/rayo/autoload_configs/post_load_modules.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/presence_map.conf.xml b/conf/rayo/autoload_configs/presence_map.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/presence_map.conf.xml rename to conf/rayo/autoload_configs/presence_map.conf.xml diff --git a/conf/rayo/autoload_configs/rayo.conf.xml b/conf/rayo/autoload_configs/rayo.conf.xml new file mode 100644 index 0000000000..f9ac49b99d --- /dev/null +++ b/conf/rayo/autoload_configs/rayo.conf.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/shout.conf.xml b/conf/rayo/autoload_configs/shout.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/shout.conf.xml rename to conf/rayo/autoload_configs/shout.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/sofia.conf.xml b/conf/rayo/autoload_configs/sofia.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/sofia.conf.xml rename to conf/rayo/autoload_configs/sofia.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/spandsp.conf.xml b/conf/rayo/autoload_configs/spandsp.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/spandsp.conf.xml rename to conf/rayo/autoload_configs/spandsp.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/ssml.conf.xml b/conf/rayo/autoload_configs/ssml.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/ssml.conf.xml rename to conf/rayo/autoload_configs/ssml.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/switch.conf.xml b/conf/rayo/autoload_configs/switch.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/switch.conf.xml rename to conf/rayo/autoload_configs/switch.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/timezones.conf.xml b/conf/rayo/autoload_configs/timezones.conf.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/autoload_configs/timezones.conf.xml rename to conf/rayo/autoload_configs/timezones.conf.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/cacert.pem b/conf/rayo/cacert.pem similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/cacert.pem rename to conf/rayo/cacert.pem diff --git a/src/mod/event_handlers/mod_rayo/conf/dialplan/public.xml b/conf/rayo/dialplan/public.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/dialplan/public.xml rename to conf/rayo/dialplan/public.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/directory/default.xml b/conf/rayo/directory/default.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/directory/default.xml rename to conf/rayo/directory/default.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/directory/default/usera.xml b/conf/rayo/directory/default/usera.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/directory/default/usera.xml rename to conf/rayo/directory/default/usera.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/directory/default/userb.xml b/conf/rayo/directory/default/userb.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/directory/default/userb.xml rename to conf/rayo/directory/default/userb.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/directory/default/userc.xml b/conf/rayo/directory/default/userc.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/directory/default/userc.xml rename to conf/rayo/directory/default/userc.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/directory/default/userd.xml b/conf/rayo/directory/default/userd.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/directory/default/userd.xml rename to conf/rayo/directory/default/userd.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/freeswitch.xml b/conf/rayo/freeswitch.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/freeswitch.xml rename to conf/rayo/freeswitch.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/de/de.xml b/conf/rayo/lang/de/de.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/de/de.xml rename to conf/rayo/lang/de/de.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/de/demo/demo.xml b/conf/rayo/lang/de/demo/demo.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/de/demo/demo.xml rename to conf/rayo/lang/de/demo/demo.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/de/vm/sounds.xml b/conf/rayo/lang/de/vm/sounds.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/de/vm/sounds.xml rename to conf/rayo/lang/de/vm/sounds.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/de/vm/tts.xml b/conf/rayo/lang/de/vm/tts.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/de/vm/tts.xml rename to conf/rayo/lang/de/vm/tts.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/demo/demo-ivr.xml b/conf/rayo/lang/en/demo/demo-ivr.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/en/demo/demo-ivr.xml rename to conf/rayo/lang/en/demo/demo-ivr.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/demo/demo.xml b/conf/rayo/lang/en/demo/demo.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/en/demo/demo.xml rename to conf/rayo/lang/en/demo/demo.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/demo/funnies.xml b/conf/rayo/lang/en/demo/funnies.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/en/demo/funnies.xml rename to conf/rayo/lang/en/demo/funnies.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/demo/new-demo-ivr.xml b/conf/rayo/lang/en/demo/new-demo-ivr.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/en/demo/new-demo-ivr.xml rename to conf/rayo/lang/en/demo/new-demo-ivr.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/dir/sounds.xml b/conf/rayo/lang/en/dir/sounds.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/en/dir/sounds.xml rename to conf/rayo/lang/en/dir/sounds.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/dir/tts.xml b/conf/rayo/lang/en/dir/tts.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/en/dir/tts.xml rename to conf/rayo/lang/en/dir/tts.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/en.xml b/conf/rayo/lang/en/en.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/en/en.xml rename to conf/rayo/lang/en/en.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/ivr/sounds.xml b/conf/rayo/lang/en/ivr/sounds.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/en/ivr/sounds.xml rename to conf/rayo/lang/en/ivr/sounds.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/vm/sounds.xml b/conf/rayo/lang/en/vm/sounds.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/en/vm/sounds.xml rename to conf/rayo/lang/en/vm/sounds.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/vm/tts.xml b/conf/rayo/lang/en/vm/tts.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/en/vm/tts.xml rename to conf/rayo/lang/en/vm/tts.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/en/vm/voicemail_ivr.xml b/conf/rayo/lang/en/vm/voicemail_ivr.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/en/vm/voicemail_ivr.xml rename to conf/rayo/lang/en/vm/voicemail_ivr.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-es-ES.xml b/conf/rayo/lang/es/demo/demo-es-ES.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-es-ES.xml rename to conf/rayo/lang/es/demo/demo-es-ES.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-es-MX.xml b/conf/rayo/lang/es/demo/demo-es-MX.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-es-MX.xml rename to conf/rayo/lang/es/demo/demo-es-MX.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-ivr-es-ES.xml b/conf/rayo/lang/es/demo/demo-ivr-es-ES.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-ivr-es-ES.xml rename to conf/rayo/lang/es/demo/demo-ivr-es-ES.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-ivr-es-MX.xml b/conf/rayo/lang/es/demo/demo-ivr-es-MX.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/es/demo/demo-ivr-es-MX.xml rename to conf/rayo/lang/es/demo/demo-ivr-es-MX.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/dir/sounds-es-ES.xml b/conf/rayo/lang/es/dir/sounds-es-ES.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/es/dir/sounds-es-ES.xml rename to conf/rayo/lang/es/dir/sounds-es-ES.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/dir/sounds-es-MX.xml b/conf/rayo/lang/es/dir/sounds-es-MX.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/es/dir/sounds-es-MX.xml rename to conf/rayo/lang/es/dir/sounds-es-MX.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/dir/tts-es-ES.xml b/conf/rayo/lang/es/dir/tts-es-ES.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/es/dir/tts-es-ES.xml rename to conf/rayo/lang/es/dir/tts-es-ES.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/dir/tts-es-MX.xml b/conf/rayo/lang/es/dir/tts-es-MX.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/es/dir/tts-es-MX.xml rename to conf/rayo/lang/es/dir/tts-es-MX.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/es_ES.xml b/conf/rayo/lang/es/es_ES.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/es/es_ES.xml rename to conf/rayo/lang/es/es_ES.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/es_MX.xml b/conf/rayo/lang/es/es_MX.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/es/es_MX.xml rename to conf/rayo/lang/es/es_MX.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/vm/sounds-es-ES.xml b/conf/rayo/lang/es/vm/sounds-es-ES.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/es/vm/sounds-es-ES.xml rename to conf/rayo/lang/es/vm/sounds-es-ES.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/vm/sounds-es-MX.xml b/conf/rayo/lang/es/vm/sounds-es-MX.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/es/vm/sounds-es-MX.xml rename to conf/rayo/lang/es/vm/sounds-es-MX.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/vm/tts-es-ES.xml b/conf/rayo/lang/es/vm/tts-es-ES.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/es/vm/tts-es-ES.xml rename to conf/rayo/lang/es/vm/tts-es-ES.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/es/vm/tts-es-MX.xml b/conf/rayo/lang/es/vm/tts-es-MX.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/es/vm/tts-es-MX.xml rename to conf/rayo/lang/es/vm/tts-es-MX.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/fr/demo/demo.xml b/conf/rayo/lang/fr/demo/demo.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/fr/demo/demo.xml rename to conf/rayo/lang/fr/demo/demo.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/fr/dir/sounds.xml b/conf/rayo/lang/fr/dir/sounds.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/fr/dir/sounds.xml rename to conf/rayo/lang/fr/dir/sounds.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/fr/dir/tts.xml b/conf/rayo/lang/fr/dir/tts.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/fr/dir/tts.xml rename to conf/rayo/lang/fr/dir/tts.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/fr/fr.xml b/conf/rayo/lang/fr/fr.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/fr/fr.xml rename to conf/rayo/lang/fr/fr.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/fr/vm/sounds.xml b/conf/rayo/lang/fr/vm/sounds.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/fr/vm/sounds.xml rename to conf/rayo/lang/fr/vm/sounds.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/he/demo/demo-ivr.xml b/conf/rayo/lang/he/demo/demo-ivr.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/he/demo/demo-ivr.xml rename to conf/rayo/lang/he/demo/demo-ivr.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/he/demo/demo.xml b/conf/rayo/lang/he/demo/demo.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/he/demo/demo.xml rename to conf/rayo/lang/he/demo/demo.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/he/dir/sounds.xml b/conf/rayo/lang/he/dir/sounds.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/he/dir/sounds.xml rename to conf/rayo/lang/he/dir/sounds.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/he/he.xml b/conf/rayo/lang/he/he.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/he/he.xml rename to conf/rayo/lang/he/he.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/he/vm/sounds.xml b/conf/rayo/lang/he/vm/sounds.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/he/vm/sounds.xml rename to conf/rayo/lang/he/vm/sounds.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-ivr-pt-BR.xml b/conf/rayo/lang/pt/demo/demo-ivr-pt-BR.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-ivr-pt-BR.xml rename to conf/rayo/lang/pt/demo/demo-ivr-pt-BR.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-ivr-pt-PT.xml b/conf/rayo/lang/pt/demo/demo-ivr-pt-PT.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-ivr-pt-PT.xml rename to conf/rayo/lang/pt/demo/demo-ivr-pt-PT.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-pt-BR.xml b/conf/rayo/lang/pt/demo/demo-pt-BR.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-pt-BR.xml rename to conf/rayo/lang/pt/demo/demo-pt-BR.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-pt-PT.xml b/conf/rayo/lang/pt/demo/demo-pt-PT.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/demo/demo-pt-PT.xml rename to conf/rayo/lang/pt/demo/demo-pt-PT.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/sounds-pt-BR.xml b/conf/rayo/lang/pt/dir/sounds-pt-BR.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/sounds-pt-BR.xml rename to conf/rayo/lang/pt/dir/sounds-pt-BR.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/sounds-pt-PT.xml b/conf/rayo/lang/pt/dir/sounds-pt-PT.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/sounds-pt-PT.xml rename to conf/rayo/lang/pt/dir/sounds-pt-PT.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/tts-pt-BR.xml b/conf/rayo/lang/pt/dir/tts-pt-BR.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/tts-pt-BR.xml rename to conf/rayo/lang/pt/dir/tts-pt-BR.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/tts-pt-PT.xml b/conf/rayo/lang/pt/dir/tts-pt-PT.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/dir/tts-pt-PT.xml rename to conf/rayo/lang/pt/dir/tts-pt-PT.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/pt_BR.xml b/conf/rayo/lang/pt/pt_BR.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/pt_BR.xml rename to conf/rayo/lang/pt/pt_BR.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/pt_PT.xml b/conf/rayo/lang/pt/pt_PT.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/pt_PT.xml rename to conf/rayo/lang/pt/pt_PT.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/sounds-pt-BR.xml b/conf/rayo/lang/pt/vm/sounds-pt-BR.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/sounds-pt-BR.xml rename to conf/rayo/lang/pt/vm/sounds-pt-BR.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/sounds-pt-PT.xml b/conf/rayo/lang/pt/vm/sounds-pt-PT.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/sounds-pt-PT.xml rename to conf/rayo/lang/pt/vm/sounds-pt-PT.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/tts-pt-BR.xml b/conf/rayo/lang/pt/vm/tts-pt-BR.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/tts-pt-BR.xml rename to conf/rayo/lang/pt/vm/tts-pt-BR.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/tts-pt-PT.xml b/conf/rayo/lang/pt/vm/tts-pt-PT.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/pt/vm/tts-pt-PT.xml rename to conf/rayo/lang/pt/vm/tts-pt-PT.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/ru/demo/demo-ivr.xml b/conf/rayo/lang/ru/demo/demo-ivr.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/ru/demo/demo-ivr.xml rename to conf/rayo/lang/ru/demo/demo-ivr.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/ru/demo/demo.xml b/conf/rayo/lang/ru/demo/demo.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/ru/demo/demo.xml rename to conf/rayo/lang/ru/demo/demo.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/ru/dir/sounds.xml b/conf/rayo/lang/ru/dir/sounds.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/ru/dir/sounds.xml rename to conf/rayo/lang/ru/dir/sounds.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/ru/dir/tts.xml b/conf/rayo/lang/ru/dir/tts.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/ru/dir/tts.xml rename to conf/rayo/lang/ru/dir/tts.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/ru/ru.xml b/conf/rayo/lang/ru/ru.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/ru/ru.xml rename to conf/rayo/lang/ru/ru.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/ru/vm/sounds.xml b/conf/rayo/lang/ru/vm/sounds.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/ru/vm/sounds.xml rename to conf/rayo/lang/ru/vm/sounds.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/lang/ru/vm/tts.xml b/conf/rayo/lang/ru/vm/tts.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/lang/ru/vm/tts.xml rename to conf/rayo/lang/ru/vm/tts.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/mime.types b/conf/rayo/mime.types similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/mime.types rename to conf/rayo/mime.types diff --git a/src/mod/event_handlers/mod_rayo/conf/sip_profiles/external.xml b/conf/rayo/sip_profiles/external.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/sip_profiles/external.xml rename to conf/rayo/sip_profiles/external.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/sip_profiles/external/example.xml b/conf/rayo/sip_profiles/external/example.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/sip_profiles/external/example.xml rename to conf/rayo/sip_profiles/external/example.xml diff --git a/src/mod/event_handlers/mod_rayo/conf/vars.xml b/conf/rayo/vars.xml similarity index 100% rename from src/mod/event_handlers/mod_rayo/conf/vars.xml rename to conf/rayo/vars.xml diff --git a/conf/vanilla/autoload_configs/lua.conf.xml b/conf/vanilla/autoload_configs/lua.conf.xml index 1eb594f0b5..f50307ea89 100644 --- a/conf/vanilla/autoload_configs/lua.conf.xml +++ b/conf/vanilla/autoload_configs/lua.conf.xml @@ -26,5 +26,7 @@ --> + + diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml index df838406d1..c813d99c67 100644 --- a/conf/vanilla/sip_profiles/internal.xml +++ b/conf/vanilla/sip_profiles/internal.xml @@ -178,6 +178,10 @@ + + + + @@ -311,6 +315,10 @@ + + + + diff --git a/configure.in b/configure.in index d09acd12f8..3699b98024 100644 --- a/configure.in +++ b/configure.in @@ -405,6 +405,10 @@ if test "x$enable_core_odbc_support" != "xno"; then AC_CHECK_LIB([odbc], [SQLDisconnect],, AC_MSG_ERROR([no usable libodbc; please install unixodbc devel package or equivalent])) fi +CHECK_LIBUUID +SWITCH_AM_LDFLAGS="$LIBUUID_LIBS $SWITCH_AM_LDFLAGS" +SWITCH_AM_CFLAGS="$LIBUUID_CFLAGS $SWITCH_AM_CFLAGS" + AC_ARG_ENABLE(core-pgsql-support, [AS_HELP_STRING([--enable-core-pgsql-support], [Compile with PGSQL Support])],,[enable_core_pgsql_support="no"]) @@ -414,7 +418,7 @@ AC_PATH_PROG([PG_CONFIG], [pg_config], [no]) if test "$PG_CONFIG" != "no"; then AC_MSG_CHECKING([for PostgreSQL libraries]) POSTGRESQL_CXXFLAGS="`$PG_CONFIG --cppflags` -I`$PG_CONFIG --includedir`" - POSTGRESQL_LDFLAGS="`$PG_CONFIG --ldflags` -L`$PG_CONFIG --libdir` -lpq" + POSTGRESQL_LDFLAGS="`$PG_CONFIG --ldflags|sed 's/ -Wl,--as-needed//g'` -L`$PG_CONFIG --libdir` -lpq" POSTGRESQL_VERSION=`$PG_CONFIG --version | sed -e 's#PostgreSQL ##'` POSTGRESQL_MAJOR_VERSION=`$PG_CONFIG --version | sed -re 's#PostgreSQL ([0-9]+).[0-9]+.[0-9]+#\1#'` POSTGRESQL_MINOR_VERSION=`$PG_CONFIG --version | sed -re 's#PostgreSQL [0-9]+.([0-9]+).[0-9]+#\1#'` diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 473bae5539..5843872904 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -179,7 +179,7 @@ Build-Depends: # bootstrapping automake (>= 1.9), autoconf, libtool, # core build - dpkg-dev (>= 1.15.8.12), gcc (>= 4:4.4.5) , g++ (>= 4:4.4.5), + dpkg-dev (>= 1.15.8.12), gcc (>= 4:4.4.5), g++ (>= 4:4.4.5), libc6-dev (>= 2.11.3), make (>= 3.81), wget, pkg-config, # configure options diff --git a/debian/control-modules b/debian/control-modules index 188f17ff96..ec291c71b6 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -227,9 +227,9 @@ Description: Voicemail detection This module detects voicemail beeps at any frequency in O(1) time. Module: applications/mod_voicemail -Depends: mail-transport-agent Description: Voicemail This module provides a voicemail system. +Depends: mail-transport-agent Module: applications/mod_voicemail_ivr Description: Voicemail IVR @@ -490,6 +490,10 @@ Module: event_handlers/mod_radius_cdr Description: mod_radius_cdr Adds mod_radius_cdr. +Module: event_handlers/mod_rayo +Description: mod_rayo + Adds mod_rayo. + Module: event_handlers/mod_snmp Description: mod_snmp Adds mod_snmp. @@ -523,6 +527,10 @@ Description: mod_sndfile Adds mod_sndfile. Build-Depends: libflac-dev, libogg-dev, libvorbis-dev +Module: formats/mod_ssml +Description: mod_ssml + Adds mod_ssml. + Module: formats/mod_tone_stream Description: mod_tone_stream Adds mod_tone_stream. diff --git a/freeswitch.spec b/freeswitch.spec index 10f45c08af..c8276c023a 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -1337,7 +1337,7 @@ ASR_TTS_MODULES="asr_tts/mod_flite asr_tts/mod_pocketsphinx asr_tts/mod_tts_comm ###################################################################################################################### CODECS_MODULES="codecs/mod_amr codecs/mod_amrwb codecs/mod_bv codecs/mod_celt codecs/mod_codec2 codecs/mod_g723_1 \ codecs/mod_g729 codecs/mod_h26x codecs/mod_ilbc codecs/mod_isac codecs/mod_mp4v codecs/mod_opus codecs/mod_silk \ - codecs/mod_siren codecs/mod_speex codecs/mod_theora mod_vp8" + codecs/mod_siren codecs/mod_speex codecs/mod_theora codecs/mod_vp8" # %if %{build_sng_tc} CODECS_MODULES+="codecs/mod_sangoma_codec" diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index 0e6521908c..5d87d521d3 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -57,6 +57,7 @@ typedef struct { int debug; const char *console_fnkeys[12]; char loglevel[128]; + int log_uuid; int quiet; int batch_mode; char prompt_color[12]; @@ -595,6 +596,7 @@ static const char *usage_str = " -i, --interrupt Allow Control-c to interrupt\n" " -x, --execute=command Execute Command and Exit\n" " -l, --loglevel=command Log Level\n" + " -U, --log-uuid Include UUID in log output\n" " -q, --quiet Disable logging\n" " -r, --retry Retry connection on failure\n" " -R, --reconnect Reconnect if disconnected\n" @@ -745,10 +747,14 @@ static void *msg_thread_run(esl_thread_t *me, void *obj) if (aok) { if (feature_level) clear_line(); if(!(global_profile->batch_mode)) { - printf("%s%s", colors[level], handle->last_event->body); + printf("%s", colors[level]); + } + if (global_profile->log_uuid && !esl_strlen_zero(userdata)) { + printf("%s ", userdata); + } + printf("%s", handle->last_event->body); + if(!(global_profile->batch_mode)) { if (!feature_level) printf("%s", ESL_SEQ_DEFAULT_COLOR); - } else { - printf("%s", handle->last_event->body); } if (feature_level) redisplay(); } @@ -757,6 +763,10 @@ static void *msg_thread_run(esl_thread_t *me, void *obj) if(!(global_profile->batch_mode)) { SetConsoleTextAttribute(hStdout, colors[level]); } + if (global_profile->log_uuid && !esl_strlen_zero(userdata)) { + WriteFile(hStdout, userdata, (DWORD)strlen(userdata), &outbytes, NULL); + WriteFile(hStdout, " ", (DWORD)strlen(" "), &outbytes, NULL); + } WriteFile(hStdout, handle->last_event->body, len, &outbytes, NULL); if(!(global_profile->batch_mode)) { SetConsoleTextAttribute(hStdout, wOldColorAttrs); @@ -1221,6 +1231,8 @@ static void read_config(const char *dft_cfile, const char *cfile) { } } else if(!strcasecmp(var, "loglevel")) { esl_set_string(profiles[pcount-1].loglevel, val); + } else if(!strcasecmp(var, "log-uuid")) { + profiles[pcount-1].log_uuid = esl_true(val); } else if(!strcasecmp(var, "quiet")) { profiles[pcount-1].quiet = esl_true(val); } else if(!strcasecmp(var, "prompt-color")) { @@ -1282,6 +1294,7 @@ int main(int argc, char *argv[]) {"debug", 1, 0, 'd'}, {"execute", 1, 0, 'x'}, {"loglevel", 1, 0, 'l'}, + {"log-uuid", 0, 0, 'U'}, {"quiet", 0, 0, 'q'}, {"batchmode", 0, 0, 'b'}, {"retry", 0, 0, 'r'}, @@ -1303,6 +1316,7 @@ int main(int argc, char *argv[]) int argv_exec = 0; char argv_command[1024] = ""; char argv_loglevel[128] = ""; + int argv_log_uuid = 0; int argv_quiet = 0; int argv_batch = 0; int loops = 2, reconnect = 0, timeout = 0; @@ -1340,7 +1354,7 @@ int main(int argc, char *argv[]) esl_global_set_default_logger(6); /* default debug level to 6 (info) */ for(;;) { int option_index = 0; - opt = getopt_long(argc, argv, "H:U:P:S:u:p:d:x:l:t:qrRhib?n", options, &option_index); + opt = getopt_long(argc, argv, "H:P:S:u:p:d:x:l:Ut:qrRhib?n", options, &option_index); if (opt == -1) break; switch (opt) { case 'H': @@ -1383,6 +1397,9 @@ int main(int argc, char *argv[]) case 'l': esl_set_string(argv_loglevel, optarg); break; + case 'U': + argv_log_uuid = 1; + break; case 'q': argv_quiet = 1; break; @@ -1445,6 +1462,9 @@ int main(int argc, char *argv[]) esl_set_string(profile->loglevel, argv_loglevel); profile->quiet = 0; } + if (argv_log_uuid) { + profile->log_uuid = 1; + } esl_log(ESL_LOG_DEBUG, "Using profile %s [%s]\n", profile->name, profile->host); esl_set_string(prompt_color, profile->prompt_color); esl_set_string(input_text_color, profile->input_text_color); diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c index 19cb6708a5..910180f47e 100644 --- a/libs/esl/src/esl_event.c +++ b/libs/esl/src/esl_event.c @@ -445,7 +445,7 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st fly++; } - if ((header = esl_event_get_header_ptr(event, header_name))) { + if (header || (header = esl_event_get_header_ptr(event, header_name))) { if (index_ptr) { if (index > -1 && index <= 4000) { diff --git a/libs/freetdm/src/libteletone_generate.c b/libs/freetdm/src/libteletone_generate.c index 3654d1ec34..ef7a7e03ec 100644 --- a/libs/freetdm/src/libteletone_generate.c +++ b/libs/freetdm/src/libteletone_generate.c @@ -382,9 +382,12 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm break; case 'L': if (!LOOPING) { - ts->LOOPS = atoi(cur + 2); + int L; + if ((L = atoi(cur + 2)) > 0) { + ts->LOOPS = L; + LOOPING++; + } } - LOOPING++; break; } } else { @@ -480,6 +483,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm bottom: free(data); data = NULL; + if (ts->LOOPS > 0) { ts->LOOPS--; } diff --git a/libs/libteletone/src/libteletone_generate.c b/libs/libteletone/src/libteletone_generate.c index 3654d1ec34..ef7a7e03ec 100644 --- a/libs/libteletone/src/libteletone_generate.c +++ b/libs/libteletone/src/libteletone_generate.c @@ -382,9 +382,12 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm break; case 'L': if (!LOOPING) { - ts->LOOPS = atoi(cur + 2); + int L; + if ((L = atoi(cur + 2)) > 0) { + ts->LOOPS = L; + LOOPING++; + } } - LOOPING++; break; } } else { @@ -480,6 +483,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm bottom: free(data); data = NULL; + if (ts->LOOPS > 0) { ts->LOOPS--; } diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 8024eeba38..c36486c61a 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Fri Jun 28 10:39:50 CDT 2013 +Wed Jul 3 11:09:02 CDT 2013 diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c index 8b7ecfaa7b..22c56ef07f 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c @@ -432,7 +432,6 @@ int tport_ws_init_secondary(tport_t *self, int socket, int accepted, int one = 1; tport_ws_primary_t *wspri = (tport_ws_primary_t *)self->tp_pri; tport_ws_t *wstp = (tport_ws_t *)self; - char *buffer, *wbuffer; self->tp_has_connection = 1; @@ -458,10 +457,7 @@ int tport_ws_init_secondary(tport_t *self, int socket, int accepted, memset(&wstp->ws, 0, sizeof(wstp->ws)); - buffer = (char *) su_alloc((su_home_t *)self, 65536); - wbuffer = (char *) su_alloc((su_home_t *)self, 65536); - - if (ws_init(&wstp->ws, socket, buffer, wbuffer, 65336, wstp->ws_secure ? wspri->ssl_ctx : NULL, 0) < 0) { + if (ws_init(&wstp->ws, socket, wstp->ws_secure ? wspri->ssl_ctx : NULL, 0) < 0) { return *return_reason = "WS_INIT", -1; } diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c index 6ee35e54a3..33d984a9d5 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c @@ -1,5 +1,10 @@ #include "ws.h" #include + +#ifndef _MSC_VER +#include +#endif + #define SHA1_HASH_SIZE 20 struct globals_s globals; @@ -316,16 +321,16 @@ issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes) do { r = recv(wsh->sock, data, bytes, 0); #ifndef _MSC_VER - if (x++) usleep(10000); + if (x++) usleep(10000); #else - if (x++) Sleep(10); + if (x++) Sleep(10); #endif - } while (r == -1 && (errno == EAGAIN || errno == EINTR) && x < 100); - - //if (r<0) { - // printf("READ FAIL: %s\n", strerror(errno)); - //} - + } while (r == -1 && (errno == EAGAIN || errno == EINTR) && x < 100); + + if (x >= 100) { + r = -1; + } + return r; } @@ -352,7 +357,54 @@ issize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes) return r; } -int ws_init(wsh_t *wsh, ws_socket_t sock, char *buffer, char *wbuffer, size_t buflen, SSL_CTX *ssl_ctx, int close_sock) +#ifdef _MSC_VER +static int setup_socket(ws_socket_t sock) +{ + unsigned long v = 1; + + if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR) { + return -1; + } + + return 0; + +} + +static int restore_socket(ws_socket_t sock) +{ + unsigned long v = 0; + + if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR) { + return -1; + } + + return 0; + +} + +#else + +static int setup_socket(ws_socket_t sock) +{ + int flags = fcntl(sock, F_GETFL, 0); + return fcntl(sock, F_SETFL, flags | O_NONBLOCK); +} + +static int restore_socket(ws_socket_t sock) +{ + int flags = fcntl(sock, F_GETFL, 0); + + flags &= ~O_NONBLOCK; + + return fcntl(sock, F_SETFL, flags); + +} + +#endif + + + +int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock) { memset(wsh, 0, sizeof(*wsh)); wsh->sock = sock; @@ -365,28 +417,10 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, char *buffer, char *wbuffer, size_t bu wsh->close_sock = 1; } - if (buflen > MAXLEN) { - buflen = MAXLEN; - } - - wsh->buflen = buflen; + wsh->buflen = sizeof(wsh->buffer); wsh->secure = ssl_ctx ? 1 : 0; - if (buffer) { - wsh->buffer = buffer; - } else if (!wsh->buffer) { - wsh->buffer = malloc(wsh->buflen); - assert(wsh->buffer); - wsh->free_buffer = 1; - } - - if (wbuffer) { - wsh->wbuffer = wbuffer; - } else if (!wsh->wbuffer) { - wsh->wbuffer = malloc(wsh->buflen); - assert(wsh->wbuffer); - wsh->free_wbuffer = 1; - } + setup_socket(sock); if (wsh->secure) { int code; @@ -464,16 +498,6 @@ void ws_destroy(wsh_t *wsh) SSL_free(wsh->ssl); wsh->ssl = NULL; } - - if (wsh->free_buffer && wsh->buffer) { - free(wsh->buffer); - wsh->buffer = NULL; - } - - if (wsh->free_wbuffer && wsh->wbuffer) { - free(wsh->wbuffer); - wsh->wbuffer = NULL; - } } issize_t ws_close(wsh_t *wsh, int16_t reason) @@ -494,6 +518,8 @@ issize_t ws_close(wsh_t *wsh, int16_t reason) ws_raw_write(wsh, fr, 4); } + restore_socket(wsh->sock); + if (wsh->close_sock) { close(wsh->sock); } diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.h b/libs/sofia-sip/libsofia-sip-ua/tport/ws.h index 84aa46fceb..81368158b3 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.h +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.h @@ -3,7 +3,6 @@ //#define WSS_STANDALONE 1 -#define MAXLEN 0x10000 #define WEBSOCKET_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" #define B64BUFFLEN 1024 @@ -59,8 +58,8 @@ typedef enum { typedef struct wsh_s { ws_socket_t sock; - char *buffer; - char *wbuffer; + char buffer[65536]; + char wbuffer[65536]; size_t buflen; issize_t datalen; issize_t wdatalen; @@ -71,8 +70,6 @@ typedef struct wsh_s { int handshake; uint8_t down; int secure; - uint8_t free_buffer; - uint8_t free_wbuffer; uint8_t close_sock; } wsh_t; @@ -84,7 +81,7 @@ issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes); issize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes); issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data); issize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes); -int ws_init(wsh_t *wsh, ws_socket_t sock, char *buffer, char *wbuffer, size_t buflen, SSL_CTX *ssl_ctx, int close_sock); +int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock); issize_t ws_close(wsh_t *wsh, int16_t reason); void ws_destroy(wsh_t *wsh); void init_ssl(void); diff --git a/libs/spandsp/src/spandsp/private/v18.h b/libs/spandsp/src/spandsp/private/v18.h index a991cc5107..2ce0520108 100644 --- a/libs/spandsp/src/spandsp/private/v18.h +++ b/libs/spandsp/src/spandsp/private/v18.h @@ -31,6 +31,7 @@ struct v18_state_s /*! \brief TRUE if we are the calling modem */ int calling_party; int mode; + int nation; put_msg_func_t put_msg; void *user_data; int repeat_shifts; diff --git a/libs/spandsp/src/spandsp/v18.h b/libs/spandsp/src/spandsp/v18.h index fbd4994a59..b1fd500f43 100644 --- a/libs/spandsp/src/spandsp/v18.h +++ b/libs/spandsp/src/spandsp/v18.h @@ -54,12 +54,16 @@ enum /* V.18 Annex F - V.21 text telephone, V.21, duplex, ASCII (Sweden, Norway and Finland). */ V18_MODE_V21TEXTPHONE = 7, /* V.18 Annex G - V.18 text telephone mode. */ - V18_MODE_V18TEXTPHONE = 8 + V18_MODE_V18TEXTPHONE = 8, + /* Use repetitive shift characters where character set shifts are used */ + V18_MODE_REPETITIVE_SHIFTS_OPTION = 0x1000 }; /* Automoding sequences for different countries */ enum { + V18_AUTOMODING_GLOBAL = 0, + /* 5-bit, V.21, V.23, EDT, DTMF, Bell 103 */ V18_AUTOMODING_AUSTRALIA, V18_AUTOMODING_IRELAND, @@ -89,7 +93,9 @@ enum /* V.23, EDT, DTMF, 5-bit, V.21, Bell 103 */ V18_AUTOMODING_FRANCE, - V18_AUTOMODING_BELGIUM + V18_AUTOMODING_BELGIUM, + + V18_AUTOMODING_END }; #if defined(__cplusplus) @@ -104,6 +110,7 @@ SPAN_DECLARE(logging_state_t *) v18_get_logging_state(v18_state_t *s); \param s The V.18 context. \param calling_party TRUE if caller mode, else answerer mode. \param mode Mode of operation. + \param nation National variant for automoding. \param put_msg A callback routine called to deliver the received text to the application. \param user_data An opaque pointer for the callback routine. @@ -111,6 +118,7 @@ SPAN_DECLARE(logging_state_t *) v18_get_logging_state(v18_state_t *s); SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s, int calling_party, int mode, + int nation, put_msg_func_t put_msg, void *user_data); diff --git a/libs/spandsp/src/v18.c b/libs/spandsp/src/v18.c index 16f5da5ac6..f3f21ad86f 100644 --- a/libs/spandsp/src/v18.c +++ b/libs/spandsp/src/v18.c @@ -954,6 +954,7 @@ SPAN_DECLARE(logging_state_t *) v18_get_logging_state(v18_state_t *s) SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s, int calling_party, int mode, + int nation, put_msg_func_t put_msg, void *user_data) { @@ -1024,6 +1025,7 @@ SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s, fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_V21CH1], FSK_FRAME_MODE_7E1_FRAMES, v18_textphone_put_async_byte, s); break; } + s->nation = nation; queue_init(&s->queue.queue, 128, QUEUE_READ_ATOMIC | QUEUE_WRITE_ATOMIC); return s; } diff --git a/libs/spandsp/test-data/local/lenna-colour-bilevel.tif b/libs/spandsp/test-data/local/lenna-colour-bilevel.tif new file mode 100644 index 0000000000..9d79aa868e Binary files /dev/null and b/libs/spandsp/test-data/local/lenna-colour-bilevel.tif differ diff --git a/libs/spandsp/tests/v18_tests.c b/libs/spandsp/tests/v18_tests.c index 23efd7ae3c..2293d39883 100644 --- a/libs/spandsp/tests/v18_tests.c +++ b/libs/spandsp/tests/v18_tests.c @@ -100,11 +100,11 @@ static void basic_tests(int mode) int j; printf("Testing %s\n", v18_mode_to_str(mode)); - v18[0] = v18_init(NULL, TRUE, mode, put_text_msg, NULL); + v18[0] = v18_init(NULL, TRUE, mode, V18_AUTOMODING_GLOBAL, put_text_msg, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, mode, put_text_msg, NULL); + v18[1] = v18_init(NULL, FALSE, mode, V18_AUTOMODING_GLOBAL, put_text_msg, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -227,11 +227,11 @@ static int test_misc_01(void) TUT should continue to probe until the test is terminated. Comments: This feature should also be verified by observation during the automoding tests. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -326,11 +326,11 @@ static int test_misc_02(void) Comments: The TUT should indicate that carrier has been lost at some time after the 1650Hz signal is lost. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -425,11 +425,11 @@ static int test_misc_03(void) Comments: The TUT should indicate that carrier has been lost at some time after the carrier signal is removed and not disconnect. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -523,11 +523,11 @@ static int test_misc_04(void) automatically hang up when busy tone is detected. PABX busy tones may differ in frequency and cadence from national parameters. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -618,11 +618,11 @@ static int test_misc_05(void) Pass criteria: The RINGING condition should be visually indicated by the TUT. Comments: This test should be repeated across a range of valid timings and ring voltages. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -716,11 +716,11 @@ static int test_misc_06(void) mode. There may be other cases, e.g. where the V.18 DCE is used in a gateway, when automatic disconnection is required. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -812,11 +812,11 @@ static int test_misc_07(void) However, this may possibly not be indicated by the DTE. Comments: The possible modes are: V.21, V.23, Baudot 45, Baudot 50, EDT, Bell 103, DTMF. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -909,11 +909,11 @@ static int test_misc_08(void) Comment: The response times and signal level thresholds of Circuit 135 are not specified in ITU-T V.18 or V.24 and therefore the pattern indicated may vary. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -1003,11 +1003,11 @@ static int test_misc_09(void) Pass criteria: TBD Comment: TBD */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -1106,11 +1106,11 @@ static int test_org_01(void) 8) The whole sequence should be repeated until the call is cleared. 9) When V.18 to V.18, the XCI must not force V.23 or Minitel mode. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -1204,11 +1204,11 @@ static int test_org_02(void) 2) The TUT should reply with transmission of TXP as defined in 5.1.2. 3) Verify that TXP sequence has correct bit pattern. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -1299,11 +1299,11 @@ static int test_org_03(void) Pass criteria: The TUT should stop sending TXP at the end of the current sequence when ANS tone ceases. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -1398,11 +1398,11 @@ static int test_org_04(void) with the V.18 operational requirements. Comments: The TUT should indicate that V.18 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -1498,11 +1498,11 @@ static int test_org_05(void) examination of TUT. If there is no visual indication, verify by use of ITU-T T.50 for ITU-T V.21 as opposed to UTF-8 coded ISO 10646 character set for ITU-T V.18. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -1597,11 +1597,11 @@ static int test_org_06(void) by the TUT to comply with Annex E. Comments: The TUT should indicate that V.23 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -1696,11 +1696,11 @@ static int test_org_07(void) literally. It may however, occur when connected to certain Swedish textphones if the handset is lifted just after the start of an automatically answered incoming call. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -1791,11 +1791,11 @@ static int test_org_08(void) 2) Data should be transmitted and received at 300 bit/s to comply with Annex D. Comments: The TUT should indicate that Bell 103 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -1886,11 +1886,11 @@ static int test_org_09(void) 2) Data should be transmitted and received at 300 bit/s to comply with Annex F. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -1982,11 +1982,11 @@ static int test_org_10(void) by the TUT to comply with Annex E. Comments: The TUT should indicate that V.23 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -2081,11 +2081,11 @@ static int test_org_11(void) Comments: The TUT should indicate that V.23 mode has been selected at least 3 seconds after the start of the 390Hz tone. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -2185,11 +2185,11 @@ static int test_org_12(void) automode answer state. The TUT may then select either 45.45 or 50 bit/s for the transmission. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -2283,11 +2283,11 @@ static int test_org_13(void) TUT should comply with ITU-T Q.24 for the Danish Administration while receiving for best possible performance. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -2383,11 +2383,11 @@ static int test_org_14(void) the number lost should be minimal. The data bits and parity are specified in Annex C. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -2478,11 +2478,11 @@ static int test_org_15(void) the CI signal. Comments: Echoes of the CI sequences may be detected at 300 bit/s. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -2573,11 +2573,11 @@ static int test_org_16(void) 2) Data should be transmitted and received at 300 bit/s complying with Annex F. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -2666,11 +2666,11 @@ static int test_org_17(void) Pass criteria: TUT should not respond to the 980Hz tone and resume sending CI signals after a maximum of 2.4 seconds from the end of the 980Hz tone. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -2761,11 +2761,11 @@ static int test_org_18(void) Comments: This implies timer Tr has expired 2 seconds after the start of the 980Hz tone and then 1650Hz has been detected for 0.5 seconds. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -2855,11 +2855,11 @@ static int test_org_19(void) 2) Data should be transmitted and received at 300 bit/s complying with Annex D. Comments: The TUT should indicate that Bell 103 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -2956,11 +2956,11 @@ static int test_org_20(void) presence and cadence of the tones for instance by a flashing light. The TUT may disconnect on reception of tones indicating a failed call attempt. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -3053,11 +3053,11 @@ static int test_org_21(void) Comments: Some high speed modems may fall back to a compatibility mode, e.g. V.21 or V.23 that should be correctly detected by the TUT. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -3149,11 +3149,11 @@ static int test_org_22(void) Comments: Ideally the TUT should detect the presence of a fax machine and report it back to the user. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -3245,11 +3245,11 @@ static int test_org_23(void) Comments: Ideally the TUT should report the presence of speech back to the user, e.g. via circuit 135. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -3343,11 +3343,11 @@ static int test_org_24(void) 2) The TUT should reply with transmission of CM as defined in 5.2.13. 3) Verify that CM sequence has correct bit pattern. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -3436,11 +3436,11 @@ static int test_org_25(void) Method: The Test System waits for the TUT to start transmitting V.21 carrier (1). Pass criteria: The TUT should connect by sending V.21 carrier (1). */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -3530,11 +3530,11 @@ static int test_ans_01(void) answers the call. It will then monitor for any signal. Pass criteria: The TUT should start probing 3 seconds after answering the call. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -3626,11 +3626,11 @@ static int test_ans_02(void) Comments: The ANSam tone is a modulated 2100Hz tone. It may have phase reversals. The XCI signal is tested in a separate test. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -3726,11 +3726,11 @@ static int test_ans_03(void) V.18 mode connection is completed. Comments: The TUT should indicate V.18 mode. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -3820,11 +3820,11 @@ static int test_ans_04(void) Pass criteria: The TUT should start probing 3 seconds after ANSam disappears. Comments: It is assumed that timer Ta is restarted on return to Monitor A. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -3915,11 +3915,11 @@ static int test_ans_05(void) Pass criteria: TUT should respond with 1650Hz within 400+-100 ms of start of 980Hz. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -4010,11 +4010,11 @@ static int test_ans_06(void) Pass criteria: TUT should respond with 390Hz after 1.7(+0.2-0.0) seconds of start of 1300Hz. Comments: The TUT should indicate that V.23 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -4105,11 +4105,11 @@ static int test_ans_07(void) Pass criteria: TUT should respond with 980Hz within 400+-100 ms of start of 1650Hz. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -4202,11 +4202,11 @@ static int test_ans_08(void) Comments: The TUT should indicate a V.21 connection. The time for which each frequency is transmitted is random and varies between 0.64 and 2.56 seconds. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -4298,11 +4298,11 @@ static int test_ans_09(void) 700 ms followed by 1 second of silence. Comments: The probe sent by the TUT will depend on the country setting. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -4392,11 +4392,11 @@ static int test_ans_10(void) Pass criteria: The TUT should respond with a 1650Hz tone in 1.5+-0.1 seconds. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -4490,11 +4490,11 @@ static int test_ans_11(void) be lost during the detection process. However, the number lost should be minimal. The data bits and parity are specified in Annex C. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -4589,11 +4589,11 @@ static int test_ans_12(void) (1650Hz) probe. However, it is catered for in V.18. It is more likely that this is where CI or TXP characters would be detected (see test ANS-02). */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -4687,11 +4687,11 @@ static int test_ans_13(void) when timer Tr will start. It is assumed that timer Ta is restarted on re-entering the Monitor A state. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -4782,11 +4782,11 @@ static int test_ans_14(void) Comments: It is assumed that timer Ta (3 seconds) is restarted on re-entering the Monitor A state. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -4887,11 +4887,11 @@ static int test_ans_15(void) automode answer state. The TUT may then select either 45.45 or 50 bit/s for the transmission. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -4983,11 +4983,11 @@ static int test_ans_16(void) Comments: The TUT should indicate that it has selected DTMF mode. The DTMF capabilities of the TUT should comply with ITU-T Q.24 for the Danish Administration. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -5076,11 +5076,11 @@ static int test_ans_17(void) Pass criteria: TUT should respond with 2225Hz tone after 0.7+-0.1 s. Comments: The TUT should indicate that Bell 103 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -5170,11 +5170,11 @@ static int test_ans_18(void) Comments: The TUT should indicate that Bell 103 mode has been selected. Bell 103 modems use 2225Hz as both answer tone and higher frequency of the upper channel. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -5263,11 +5263,11 @@ static int test_ans_19(void) Pass criteria: The TUT should respond with 980Hz after 0.4+-0.2 seconds. Comments: The TUT should indicate that V.21 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -5359,11 +5359,11 @@ static int test_ans_20(void) 700 ms followed by 1 second of silence. Comments: The probe sent by the TUT will depend on the country setting. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -5452,11 +5452,11 @@ static int test_ans_21(void) Pass criteria: The TUT should respond with 390Hz after 1.7+-0.1 seconds. Comments: The TUT should indicate that V.23 mode has been selected. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -5545,11 +5545,11 @@ static int test_ans_22(void) silent for 500 ms then transmit the TXP signal in V.21 (1) mode. Pass criteria: The TUT should respond with TXP using V.21 (2) and select V.18 mode. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -5641,11 +5641,11 @@ static int test_ans_23(void) Pass criteria: The TUT should use the orders described in Appendix I. Comments: The order of the probes is not mandatory. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -5737,11 +5737,11 @@ static int test_ans_24(void) modes followed by a pause of Tm (default 3) seconds. Comments: The carrierless modes are those described in Annexes A, B and C. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -5833,11 +5833,11 @@ static int test_ans_25(void) Pass criteria: The TUT should transmit silence on detecting the 1270Hz tone and then continue probing starting with the V.23 probe 20 seconds after the end of the 1270Hz signal. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -5929,11 +5929,11 @@ static int test_ans_26(void) 75+-5 ms and then the 1650Hz, 1300Hz and 2225Hz probes for time Tc. Comments: The carrier modes are those described in Annexes D, E, and F. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -6029,11 +6029,11 @@ static int test_ans_27(void) 390Hz. When the 1300Hz probe is not being transmitted, a 390Hz tone may be interpreted as a 400Hz network tone. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -6127,11 +6127,11 @@ static int test_ans_28(void) Comments: It is most likely that the TUT will return to probing time Ta (3 seconds) after the 1270Hz tone ceases. This condition needs further clarification. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -6224,11 +6224,11 @@ static int test_ans_29(void) Comments: The TUT may not respond to any signals while a carrierless mode probe is being sent since these modes are half duplex. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -6323,11 +6323,11 @@ static int test_ans_30(void) tones may be ignored. Some devices may only provide a visual indication of the presence and cadence of the tones for instance by a flashing light. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -6419,11 +6419,11 @@ static int test_ans_31(void) Comments: This is an optional test as detection of the fax calling tone is not required by ITU-T V.18. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -6515,11 +6515,11 @@ static int test_ans_32(void) Comments: Ideally the TUT should report the presence of speech back to the user. This is an optional test. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -6616,11 +6616,11 @@ static int test_ans_33(void) V.18 mode connection is completed. Comments: The TUT should indicate V.18 mode. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -6717,11 +6717,11 @@ static int test_mon_21(void) for 1 minute. Pass criteria: The TUT should not start probing. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -6815,11 +6815,11 @@ static int test_mon_22(void) Comments: In automode answer, the 1300Hz calling causes the DCE to start probing. In monitor mode it should only report detection to the DTE. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -6913,11 +6913,11 @@ static int test_mon_23(void) Comments: In automode answer, the 980Hz calling causes the DCE to start probing. In monitor mode it should only report detection to the DTE. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -7022,11 +7022,11 @@ static int test_x_01(void) 3) The tester will confirm that 1 start bit and at least 1.5 stop bits are used. Comments: The carrier should be maintained during the 300 ms after a character. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_45, x_01_put_text_msg, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, x_01_put_text_msg, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_45, x_01_put_text_msg, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, x_01_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -7121,11 +7121,11 @@ static int test_x_02(void) transmit the string "abcdef" at each rate. Pass criteria: The tester will measure the bit timings and confirm the rates. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_45, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_45, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -7218,11 +7218,11 @@ static int test_x_03(void) Comments: The probe message must be long enough for the tester to establish the bit rate. "GA" may not be sufficient. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_45, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_45, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -7336,11 +7336,11 @@ static int test_x_04(void) assumed that the character conversion is the same for Baudot at 50 bit/s and any other supported speed. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_45, x_04_put_echo_text_msg, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, x_04_put_echo_text_msg, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_45, x_04_put_text_msg, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_5BIT_45, V18_AUTOMODING_GLOBAL, x_04_put_text_msg, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -7450,11 +7450,11 @@ static int test_x_05(void) display will show when its receiver is re-enabled. Pass criteria: The receiver should be re-enabled after 300 ms. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, x_05_put_text_msg, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_05_put_text_msg, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, x_05_put_text_msg, (void *) (intptr_t) 1); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_05_put_text_msg, (void *) (intptr_t) 1); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -7565,11 +7565,11 @@ static int test_x_06(void) receiving character from the TUT. It is assumed that the echo delay in the test system is negligible. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, x_06_put_text_msg, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, x_06_put_text_msg, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -7681,11 +7681,11 @@ static int test_x_07(void) 3) The tester will confirm that 1 start bit and at least 1.5 stop bits are used. Comments: The carrier should be maintained during the 300 ms after a character. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -7776,11 +7776,11 @@ static int test_x_08(void) 2) The tester should confirm that 1 start bit, 7 data bits, 1 even parity bit and 2 stop bits are used. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -7874,11 +7874,11 @@ static int test_x_09(void) that there are no duplicate characters on the TUT display. 3) The received string should be correctly displayed despite the incorrect parity. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -7975,11 +7975,11 @@ static int test_x_10(void) Comments: This test is only applicable to Minitel Dialogue terminals. Prestel and Minitel Normal terminals cannot operate in this mode. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -8074,11 +8074,11 @@ static int test_x_11(void) 4) The last five characters on the TUT display should be "12345" (no "6") correctly displayed despite the incorrect parity. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -8170,11 +8170,11 @@ static int test_x_12(void) Pass criteria: The tester should confirm UTF8 encoded UNICODE characters are used with the controls specified in ITU-T T.140. */ - v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, NULL, NULL); + v18[0] = v18_init(NULL, TRUE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[0]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "A"); - v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, NULL, NULL); + v18[1] = v18_init(NULL, FALSE, V18_MODE_DTMF, V18_AUTOMODING_GLOBAL, NULL, NULL); logging = v18_get_logging_state(v18[1]); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, "B"); @@ -8267,7 +8267,7 @@ static int decode_test_data_file(int mode, const char *filename) fprintf(stderr, " Cannot open audio file '%s'\n", decode_test_file); exit(2); } - v18_state = v18_init(NULL, FALSE, mode, put_v18_msg, NULL); + v18_state = v18_init(NULL, FALSE, mode, V18_AUTOMODING_GLOBAL, put_v18_msg, NULL); logging = v18_get_logging_state(v18_state); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); span_log_set_tag(logging, ""); diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 416ed185de..c3583e9555 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2557,6 +2557,11 @@ SWITCH_DECLARE(int) switch_core_cert_expand_fingerprint(dtls_fingerprint_t *fp, SWITCH_DECLARE(int) switch_core_cert_verify(dtls_fingerprint_t *fp); SWITCH_DECLARE(switch_status_t) switch_core_session_refresh_video(switch_core_session_t *session); +SWITCH_DECLARE(int) switch_system(const char *cmd, switch_bool_t wait); +SWITCH_DECLARE(int) switch_stream_system_fork(const char *cmd, switch_stream_handle_t *stream); +SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t *stream); + + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 923919bc6a..755ac91d27 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -607,12 +607,15 @@ static inline char *switch_sanitize_number(char *number) switch_assert(number); - if (!(strchr(p, '/') || strchr(p, ':') || strchr(p, '@'))) { + if (!(strchr(p, '/') || strchr(p, ':') || strchr(p, '@') || strchr(p, '%'))) { return number; } while ((q = strrchr(p, '@'))) *q = '\0'; + + while ((q = strrchr(p, '%'))) + *q = '\0'; for (i = 0; i < (int) strlen(warp); i++) { while (p && (q = strchr(p, warp[i]))) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index c758147078..4e9e852aa9 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -562,27 +562,28 @@ char *cc_execute_sql2str(cc_queue_t *queue, switch_mutex_t *mutex, char *sql, ch switch_cache_db_handle_t *dbh = NULL; - if (!(dbh = cc_get_db_handle())) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); - return NULL; - } - if (mutex) { switch_mutex_lock(mutex); } else { switch_mutex_lock(globals.mutex); } + if (!(dbh = cc_get_db_handle())) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); + goto end; + } + ret = switch_cache_db_execute_sql2str(dbh, sql, resbuf, len, NULL); +end: + switch_cache_db_release_db_handle(&dbh); + if (mutex) { switch_mutex_unlock(mutex); } else { switch_mutex_unlock(globals.mutex); } - switch_cache_db_release_db_handle(&dbh); - return ret; } @@ -1524,7 +1525,15 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* Switch the agent session */ if (real_uuid) { switch_core_session_rwunlock(agent_session); - agent_session = switch_core_session_locate(real_uuid); + if (!(agent_session = switch_core_session_locate(real_uuid))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Real session is already gone (agent '%s')\n", h->agent_name); + sql = switch_mprintf("UPDATE members SET state = '%q', serving_agent = '', serving_system = ''" + " WHERE serving_agent = '%q' AND serving_system = '%q' AND uuid = '%q' AND system = 'single_box'", + cc_member_state2str(CC_MEMBER_STATE_WAITING), h->agent_name, h->agent_system, h->member_uuid); + cc_execute_sql(NULL, sql, NULL); + switch_safe_free(sql); + goto done; + } agent_uuid = switch_core_session_get_uuid(agent_session); agent_channel = switch_core_session_get_channel(agent_session); diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index ef34a985f7..1837328356 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -4390,7 +4390,11 @@ static int show_as_json_callback(void *pArg, int argc, char **argv, char **colum } if (holder->justcount) { - holder->count++; + if (zstr(argv[0])) { + holder->count = 0; + } else { + holder->count = (uint32_t) atoi(argv[0]); + } return 0; } @@ -4430,7 +4434,11 @@ static int show_as_xml_callback(void *pArg, int argc, char **argv, char **column } if (holder->justcount) { - holder->count++; + if (zstr(argv[0])) { + holder->count = 0; + } else { + holder->count = (uint32_t) atoi(argv[0]); + } return 0; } @@ -4468,7 +4476,11 @@ static int show_callback(void *pArg, int argc, char **argv, char **columnNames) int x; if (holder->justcount) { - holder->count++; + if (zstr(argv[0])) { + holder->count = 0; + } else { + holder->count = (uint32_t) atoi(argv[0]); + } return 0; } @@ -4543,6 +4555,35 @@ SWITCH_STANDARD_API(alias_function) return SWITCH_STATUS_SUCCESS; } +#define COALESCE_SYNTAX "[^^],,..." +SWITCH_STANDARD_API(coalesce_function) +{ + switch_status_t status = SWITCH_STATUS_FALSE; + char *data = (char *) cmd; + char *mydata = NULL, *argv[256] = { 0 }; + int argc = -1; + + if (data && *data && (mydata = strdup(data))) { + argc = switch_separate_string(mydata, ',', argv, + (sizeof(argv) / sizeof(argv[0]))); + } + + if (argc > 0) { + int i; + for (i = 0; i < argc; i++) { + if (argv[i] && *argv[i]) { + stream->write_function(stream, argv[i]); + status = SWITCH_STATUS_SUCCESS; + break; + } + } + } else if (argc <= 0){ + stream->write_function(stream, "-USAGE: %s\n", COALESCE_SYNTAX); + } + + return status; +} + #define SHOW_SYNTAX "codec|endpoint|application|api|dialplan|file|timer|calls [count]|channels [count|like ]|calls|detailed_calls|bridged_calls|detailed_bridged_calls|aliases|complete|chat|management|modules|nat_map|say|interfaces|interface_types|tasks|limits|status" SWITCH_STANDARD_API(show_function) { @@ -4675,6 +4716,7 @@ SWITCH_STANDARD_API(show_function) if (!strcasecmp(command, "calls")) { sprintf(sql, "select * from basic_calls where hostname='%s' order by call_created_epoch", hostname); if (argv[1] && !strcasecmp(argv[1], "count")) { + sprintf(sql, "select count(*) from basic_calls where hostname='%s'", hostname); holder.justcount = 1; if (argv[3] && !strcasecmp(argv[2], "as")) { as = argv[3]; @@ -4683,6 +4725,7 @@ SWITCH_STANDARD_API(show_function) } else if (!strcasecmp(command, "registrations")) { sprintf(sql, "select * from registrations where hostname='%s'", hostname); if (argv[1] && !strcasecmp(argv[1], "count")) { + sprintf(sql, "select count(*) from registrations where hostname='%s'", hostname); holder.justcount = 1; if (argv[3] && !strcasecmp(argv[2], "as")) { as = argv[3]; @@ -4714,6 +4757,7 @@ SWITCH_STANDARD_API(show_function) } else if (!strcasecmp(command, "channels")) { sprintf(sql, "select * from channels where hostname='%s' order by created_epoch", hostname); if (argv[1] && !strcasecmp(argv[1], "count")) { + sprintf(sql, "select count(*) from channels where hostname='%s'", hostname); holder.justcount = 1; if (argv[3] && !strcasecmp(argv[2], "as")) { as = argv[3]; @@ -5982,7 +6026,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "acl", "Compare an ip to an acl list", acl_function, " "); - SWITCH_ADD_API(commands_api_interface, "alias", "Alias", alias_function, ALIAS_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "alias", "Alias", alias_function, ALIAS_SYNTAX); SWITCH_ADD_API(commands_api_interface, "coalesce", "Return first nonempty parameter", coalesce_function, COALESCE_SYNTAX); SWITCH_ADD_API(commands_api_interface, "banner", "Return the system banner", banner_function, ""); SWITCH_ADD_API(commands_api_interface, "bgapi", "Execute an api command in a thread", bgapi_function, "[ ]"); SWITCH_ADD_API(commands_api_interface, "bg_system", "Execute a system command in the background", bg_system_function, SYSTEM_SYNTAX); @@ -6108,6 +6152,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add alias add"); switch_console_set_complete("add alias del"); + switch_console_set_complete("add coalesce"); switch_console_set_complete("add complete add"); switch_console_set_complete("add complete del"); switch_console_set_complete("add db_cache status"); diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 50bf670aad..a841f2d371 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -7359,7 +7359,7 @@ SWITCH_STANDARD_APP(conference_function) switch_core_session_message_t msg = { 0 }; uint8_t rl = 0, isbr = 0; char *dpin = ""; - char *mdpin = ""; + const char *mdpin = ""; conf_xml_cfg_t xml_cfg = { 0 }; switch_event_t *params = NULL; int locked = 0; @@ -7543,6 +7543,8 @@ SWITCH_STANDARD_APP(conference_function) /* if the conference exists, get the pointer to it */ if (!conference) { const char *max_members_str; + const char *endconf_grace_time_str; + const char *auto_record_str; /* couldn't find the conference, create one */ conference = conference_new(conf_name, xml_cfg, session, NULL); @@ -7562,11 +7564,19 @@ SWITCH_STANDARD_APP(conference_function) if (zstr(conference->moh_sound)) { conference->moh_sound = switch_core_strdup(conference->pool, switch_channel_get_variable(channel, "conference_moh_sound")); } + /* Set perpetual-sound from variable if not set */ if (zstr(conference->perpetual_sound)) { conference->perpetual_sound = switch_core_strdup(conference->pool, switch_channel_get_variable(channel, "conference_perpetual_sound")); } + /* Override auto-record profile parameter from variable */ + if (!zstr(auto_record_str = switch_channel_get_variable(channel, "conference_auto_record"))) { + conference->auto_record = switch_core_strdup(conference->pool, auto_record_str); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "conference_auto_record set from variable to %s\n", auto_record_str); + } + /* Set the minimum number of members (once you go above it you cannot go below it) */ conference->min = 1; @@ -7583,6 +7593,21 @@ SWITCH_STANDARD_APP(conference_function) } } + /* check for variable to override endconf_grace_time profile value */ + if (!zstr(endconf_grace_time_str = switch_channel_get_variable(channel, "conference_endconf_grace_time"))) { + uint32_t grace_time_val; + errno = 0; /* sanity first */ + grace_time_val = strtol(endconf_grace_time_str, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */ + if (errno == ERANGE || errno == EINVAL || (int32_t) grace_time_val < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "conference_endconf_grace_time variable %s is invalid, not setting a time limit\n", endconf_grace_time_str); + } else { + conference->endconf_grace_time = grace_time_val; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "conference endconf_grace_time set from variable to %d\n", grace_time_val); + } + } + /* Indicate the conference is dynamic */ switch_set_flag_locked(conference, CFLAG_DYNAMIC); @@ -7601,6 +7626,9 @@ SWITCH_STANDARD_APP(conference_function) rl++; } + /* Moderator PIN as a channel variable */ + mdpin = switch_channel_get_variable(channel, "conference_moderator_pin"); + if (zstr(dpin) && conference->pin) { dpin = conference->pin; } diff --git a/src/mod/applications/mod_db/mod_db.c b/src/mod/applications/mod_db/mod_db.c index 5cb6dd7cfa..ed9a8cf877 100644 --- a/src/mod/applications/mod_db/mod_db.c +++ b/src/mod/applications/mod_db/mod_db.c @@ -342,6 +342,8 @@ static switch_status_t do_config() /* CORE DB STUFF */ +static int group_callback(void *pArg, int argc, char **argv, char **columnNames); + SWITCH_STANDARD_API(db_api_function) { int argc = 0; @@ -409,6 +411,44 @@ SWITCH_STANDARD_API(db_api_function) else { stream->write_function(stream, "true"); } + goto done; + } else if (!strcasecmp(argv[0], "count")) { + char buf[256] = ""; + if (argc < 2) { + sql = switch_mprintf("select count(distinct realm) from db_data"); + } else if (argc < 3) { + sql = switch_mprintf("select count(data_key) from db_data where realm='%q'", argv[1]); + } else { + goto error; + } + limit_execute_sql2str(sql, buf, sizeof(buf)); + switch_safe_free(sql); + stream->write_function(stream, "%s", buf); + goto done; + } else if (!strcasecmp(argv[0], "list")) { + char buf[4096] = ""; + callback_t cbt = { 0 }; + cbt.buf = buf; + cbt.len = sizeof(buf); + + if (argc < 2) { + sql = switch_mprintf("select distinct realm,',' from db_data"); + } else if (argc < 3) { + sql = switch_mprintf("select distinct data_key,',' from db_data where realm='%q'", argv[1]); + } else { + goto error; + } + switch_assert(sql); + + limit_execute_sql_callback(sql, group_callback, &cbt); + switch_safe_free(sql); + + if (!zstr(buf)) { + *(buf + (strlen(buf) - 1)) = '\0'; + } + + stream->write_function(stream, "%s", buf); + goto done; } @@ -628,11 +668,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_db_load) SWITCH_ADD_APP(app_interface, "db", "Insert to the db", DB_DESC, db_function, DB_USAGE, SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC); SWITCH_ADD_APP(app_interface, "group", "Manage a group", GROUP_DESC, group_function, GROUP_USAGE, SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC); - SWITCH_ADD_API(commands_api_interface, "db", "db get/set", db_api_function, "[insert|delete|select]///"); + SWITCH_ADD_API(commands_api_interface, "db", "db get/set", db_api_function, "[insert|delete|select|exists|count|list]///"); switch_console_set_complete("add db insert"); switch_console_set_complete("add db delete"); switch_console_set_complete("add db select"); switch_console_set_complete("add db exists"); + switch_console_set_complete("add db count"); + switch_console_set_complete("add db list"); SWITCH_ADD_API(commands_api_interface, "group", "group [insert|delete|call]", group_api_function, "[insert|delete|call]::"); switch_console_set_complete("add group insert"); switch_console_set_complete("add group delete"); diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index c02e162b85..8f1057a137 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -31,6 +31,7 @@ * Luke Dashjr (OpenMethods, LLC) * Cesar Cepeda * Christopher M. Rienzo + * Seven Du * * mod_dptools.c -- Raw Audio File Streaming Application Module * @@ -1519,6 +1520,33 @@ SWITCH_STANDARD_APP(unset_function) } } +SWITCH_STANDARD_APP(multiunset_function) +{ + char delim = ' '; + char *arg = (char *) data; + + if (!zstr(arg) && *arg == '^' && *(arg+1) == '^') { + arg += 2; + delim = *arg++; + } + + if (arg) { + char *array[256] = {0}; + int i, argc; + + arg = switch_core_session_strdup(session, arg); + argc = switch_split(arg, delim, array); + + for(i = 0; i < argc; i++) { + switch_channel_set_variable(switch_core_session_get_channel(session), array[i], NULL); + } + + } else { + switch_channel_set_variable(switch_core_session_get_channel(session), arg, NULL); + } +} + + SWITCH_STANDARD_APP(log_function) { char *level, *log_str; @@ -2658,6 +2686,55 @@ SWITCH_STANDARD_APP(endless_playback_function) } +SWITCH_STANDARD_APP(loop_playback_function) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_status_t status = SWITCH_STATUS_SUCCESS; + const char *file = data; + int loop = 1; + + if (*file == '+') { + const char *p = ++file; + while(*file && *file++ != ' ') { } + + if (zstr(p)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing loop in data [%s]\n", data); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + return; + } + + loop = atoi(p); + } + + if (zstr(file)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing file arg in data [%s]\n", data); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + return; + } + + while (switch_channel_ready(channel) && (loop < 0 || loop-- > 0)) { + status = switch_ivr_play_file(session, NULL, file, NULL); + + if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { + break; + } + } + + switch (status) { + case SWITCH_STATUS_SUCCESS: + case SWITCH_STATUS_BREAK: + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "FILE PLAYED"); + break; + case SWITCH_STATUS_NOTFOUND: + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "FILE NOT FOUND"); + break; + default: + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "PLAYBACK ERROR"); + break; + } + +} + SWITCH_STANDARD_APP(gentones_function) { char *tone_script = NULL; @@ -5506,6 +5583,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) "=", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC); SWITCH_ADD_APP(app_interface, "unset", "Unset a channel variable", UNSET_LONG_DESC, unset_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC); + SWITCH_ADD_APP(app_interface, "multiunset", "Unset many channel variables", SET_LONG_DESC, multiunset_function, "[^^] ", + SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC); + SWITCH_ADD_APP(app_interface, "ring_ready", "Indicate Ring_Ready", "Indicate Ring_Ready on a channel.", ring_ready_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "remove_bugs", "Remove media bugs", "Remove all media bugs from a channel.", remove_bugs_function, "[]", SAF_NONE); SWITCH_ADD_APP(app_interface, "break", "Break", "Set the break flag.", break_function, "", SAF_SUPPORT_NOMEDIA); @@ -5574,6 +5654,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "playback", "Playback File", "Playback a file to the channel", playback_function, "", SAF_NONE); SWITCH_ADD_APP(app_interface, "endless_playback", "Playback File Endlessly", "Endlessly Playback a file to the channel", endless_playback_function, "", SAF_NONE); + SWITCH_ADD_APP(app_interface, "loop_playback", "Playback File looply", "Playback a file to the channel looply for limted times", + loop_playback_function, "[+loops] ", SAF_NONE); SWITCH_ADD_APP(app_interface, "att_xfer", "Attended Transfer", "Attended Transfer", att_xfer_function, "", SAF_NONE); SWITCH_ADD_APP(app_interface, "read", "Read Digits", "Read Digits", read_function, " ", SAF_NONE); diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index c271cc39d3..cd1420c058 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -3087,16 +3087,21 @@ SWITCH_STANDARD_APP(fifo_function) switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(other_session)); switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(session)); + switch_channel_set_variable(switch_core_session_get_channel(other_session), "fifo_initiated_bridge", "true"); + switch_channel_set_variable(switch_core_session_get_channel(other_session), "fifo_bridge_role", "caller"); + switch_channel_set_variable(switch_core_session_get_channel(session), "fifo_initiated_bridge", "true"); + switch_channel_set_variable(switch_core_session_get_channel(session), "fifo_bridge_role", "consumer"); + switch_ivr_multi_threaded_bridge(session, other_session, on_dtmf, other_session, session); - if (!switch_channel_test_flag(other_channel, CF_TRANSFER) || !switch_channel_up(other_channel)) { - switch_channel_set_variable(other_channel, "fifo_initiated_bridge", "true"); - switch_channel_set_variable(other_channel, "fifo_bridge_role", "caller"); + if (switch_channel_test_flag(other_channel, CF_TRANSFER) && switch_channel_up(other_channel)) { + switch_channel_set_variable(switch_core_session_get_channel(other_session), "fifo_initiated_bridge", NULL); + switch_channel_set_variable(switch_core_session_get_channel(other_session), "fifo_bridge_role", NULL); } - - if (!switch_channel_test_flag(channel, CF_TRANSFER) || !switch_channel_up(channel)) { - switch_channel_set_variable(channel, "fifo_initiated_bridge", "true"); - switch_channel_set_variable(channel, "fifo_bridge_role", "consumer"); + + if (switch_channel_test_flag(channel, CF_TRANSFER) && switch_channel_up(channel)) { + switch_channel_set_variable(switch_core_session_get_channel(other_session), "fifo_initiated_bridge", NULL); + switch_channel_set_variable(switch_core_session_get_channel(other_session), "fifo_bridge_role", NULL); } if (outbound_id) { diff --git a/src/mod/applications/mod_sms/mod_sms.c b/src/mod/applications/mod_sms/mod_sms.c index 102acb3db8..49037f24d9 100644 --- a/src/mod/applications/mod_sms/mod_sms.c +++ b/src/mod/applications/mod_sms/mod_sms.c @@ -24,6 +24,7 @@ * Contributor(s): * * Anthony Minessale II + * Raymond Chandler * * mod_sms.c -- Abstract SMS * @@ -448,6 +449,23 @@ static switch_status_t chat_send(switch_event_t *message_event) } +SWITCH_STANDARD_CHAT_APP(info_function) +{ + char *buf; + int level = SWITCH_LOG_INFO; + + if (!zstr(data)) { + level = switch_log_str2level(data); + } + + switch_event_serialize(message, &buf, SWITCH_FALSE); + switch_assert(buf); + switch_log_printf(SWITCH_CHANNEL_LOG, level, "CHANNEL_DATA:\n%s\n", buf); + free(buf); + + return SWITCH_STATUS_SUCCESS; +} + SWITCH_STANDARD_CHAT_APP(system_function) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Executing command: %s\n", data); @@ -546,6 +564,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sms_load) SWITCH_ADD_CHAT(chat_interface, SMS_CHAT_PROTO, chat_send); + SWITCH_ADD_CHAT_APP(chat_app_interface, "info", "Display Call Info", "Display Call Info", info_function, "", SCAF_NONE); SWITCH_ADD_CHAT_APP(chat_app_interface, "reply", "reply to a message", "reply to a message", reply_function, "", SCAF_NONE); SWITCH_ADD_CHAT_APP(chat_app_interface, "stop", "stop execution", "stop execution", stop_function, "", SCAF_NONE); SWITCH_ADD_CHAT_APP(chat_app_interface, "set", "set a variable", "set a variable", set_function, "", SCAF_NONE); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index 086a737b5a..b46b9ee396 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -206,7 +206,7 @@ switch_status_t spandsp_tdd_send_session(switch_core_session_t *session, const c return SWITCH_STATUS_FALSE; } - tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), put_text_msg, NULL); + tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL); v18_put(tdd_state, text, -1); @@ -253,7 +253,7 @@ switch_status_t spandsp_tdd_encode_session(switch_core_session_t *session, const } pvt->session = session; - pvt->tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), put_text_msg, NULL); + pvt->tdd_state = v18_init(NULL, TRUE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, NULL); pvt->head_lead = TDD_LEAD; v18_put(pvt->tdd_state, text, -1); @@ -331,7 +331,7 @@ switch_status_t spandsp_tdd_decode_session(switch_core_session_t *session) } pvt->session = session; - pvt->tdd_state = v18_init(NULL, FALSE, get_v18_mode(session), put_text_msg, pvt); + pvt->tdd_state = v18_init(NULL, FALSE, get_v18_mode(session), V18_AUTOMODING_GLOBAL, put_text_msg, pvt); if ((status = switch_core_media_bug_add(session, "spandsp_tdd_decode", NULL, tdd_decode_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) { diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 83bb8eaf23..eb552f77b1 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -1186,6 +1186,7 @@ static switch_status_t create_file(switch_core_session_t *session, vm_profile_t cc_t cc = { 0 }; switch_codec_implementation_t read_impl = { 0 }; int got_file = 0; + switch_bool_t skip_record_check = switch_true(switch_channel_get_variable(channel, "skip_record_check")); switch_core_session_get_read_impl(session, &read_impl); @@ -1265,6 +1266,9 @@ static switch_status_t create_file(switch_core_session_t *session, vm_profile_t *(input + 1) = '\0'; status = SWITCH_STATUS_SUCCESS; *cc.buf = '\0'; + } else if (skip_record_check) { + /* Skip the record check and simply return */ + goto end; } else { (void) vm_macro_get(session, VM_RECORD_FILE_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout); } @@ -3311,10 +3315,12 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p int disk_quota = 0; switch_bool_t skip_greeting = switch_true(switch_channel_get_variable(channel, "skip_greeting")); switch_bool_t skip_instructions = switch_true(switch_channel_get_variable(channel, "skip_instructions")); + switch_bool_t skip_record_urgent_check = switch_true(switch_channel_get_variable(channel, "skip_record_urgent_check")); switch_bool_t vm_enabled = SWITCH_TRUE; switch_channel_set_variable(channel, "skip_greeting", NULL); switch_channel_set_variable(channel, "skip_instructions", NULL); + switch_channel_set_variable(channel, "skip_record_urgent_check", NULL); memset(&cbt, 0, sizeof(cbt)); @@ -3589,13 +3595,14 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p char input[10] = "", term = 0; switch_snprintf(key_buf, sizeof(key_buf), "%s:%s", profile->urgent_key, profile->terminator_key); - - (void) vm_macro_get(session, VM_RECORD_URGENT_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout); - if (*profile->urgent_key == *input) { - read_flags = URGENT_FLAG_STRING; - (void) switch_ivr_phrase_macro(session, VM_ACK_MACRO, "marked-urgent", NULL, NULL); - } else { - (void) switch_ivr_phrase_macro(session, VM_ACK_MACRO, "saved", NULL, NULL); + if (!skip_record_urgent_check) { + (void) vm_macro_get(session, VM_RECORD_URGENT_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout); + if (*profile->urgent_key == *input) { + read_flags = URGENT_FLAG_STRING; + (void) switch_ivr_phrase_macro(session, VM_ACK_MACRO, "marked-urgent", NULL, NULL); + } else { + (void) switch_ivr_phrase_macro(session, VM_ACK_MACRO, "saved", NULL, NULL); + } } } diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen.h b/src/mod/endpoints/mod_gsmopen/gsmopen.h index 16e532478a..b37fa77834 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen.h +++ b/src/mod/endpoints/mod_gsmopen/gsmopen.h @@ -71,6 +71,7 @@ #include #include #include +#include #endif //WIN32 #ifndef WIN32 @@ -454,6 +455,7 @@ struct private_object { char buffer2[320]; int buffer2_full; + int serialPort_serial_audio_opened; }; @@ -556,3 +558,6 @@ int dump_event_full(private_t *tech_pvt, int is_alarm, int alarm_code, const cha int gsmopen_serial_init_audio_port(private_t *tech_pvt, int controldevice_audio_speed); int serial_audio_init(private_t *tech_pvt); int serial_audio_shutdown(private_t *tech_pvt); +#ifndef WIN32 +void find_ttyusb_devices(private_t *tech_pvt, const char *dirname); +#endif// WIN32 diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index 6e9e70876b..6af6a0075e 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -2202,7 +2202,7 @@ int gsmopen_serial_answer_AT(private_t *tech_pvt) return -1; } } - res = gsmopen_serial_write_AT_expect(tech_pvt, "AT^DDSETEX=2", tech_pvt->at_dial_expect); + //res = gsmopen_serial_write_AT_expect(tech_pvt, "AT^DDSETEX=2", tech_pvt->at_dial_expect); DEBUGA_GSMOPEN("AT: call answered\n", GSMOPEN_P_LOG); return 0; } @@ -2286,7 +2286,7 @@ int gsmopen_serial_call_AT(private_t *tech_pvt, char *dstr) ERRORA("dial command failed, dial string was: %s\n", GSMOPEN_P_LOG, at_command); return -1; } - res = gsmopen_serial_write_AT_expect(tech_pvt, "AT^DDSETEX=2", tech_pvt->at_dial_expect); + //res = gsmopen_serial_write_AT_expect(tech_pvt, "AT^DDSETEX=2", tech_pvt->at_dial_expect); return 0; } @@ -3007,6 +3007,8 @@ int gsmopen_serial_init_audio_port(private_t *tech_pvt, int controldevice_audio_ if (tech_pvt->serialPort_serial_audio->Open(devname, 115200, "8N1", ctb::SerialPort::NoFlowControl) >= 0) { DEBUGA_GSMOPEN("port %s, SUCCESS open\n", GSMOPEN_P_LOG, tech_pvt->controldevice_audio_name); + tech_pvt->serialPort_serial_audio_opened =1; + gsmopen_serial_write_AT_expect(tech_pvt, "AT^DDSETEX=2", tech_pvt->at_dial_expect); } else { #ifdef WIN32 LPVOID msg; @@ -3054,6 +3056,7 @@ int serial_audio_shutdown(private_t *tech_pvt) res = tech_pvt->serialPort_serial_audio->Close(); DEBUGA_GSMOPEN("serial_audio_shutdown res=%d (controldev_audio_fd is %d)\n", GSMOPEN_P_LOG, res, tech_pvt->controldev_audio_fd); + tech_pvt->serialPort_serial_audio_opened =0; return res; } diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index 65a9b1db58..9e78b8f55b 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -208,6 +208,7 @@ switch_status_t gsmopen_tech_init(private_t *tech_pvt, switch_core_session_t *se dtmf_rx_init(&tech_pvt->dtmf_state, NULL, NULL); dtmf_rx_parms(&tech_pvt->dtmf_state, 0, 10, 10, -99); +/* if (tech_pvt->no_sound == 0) { if (serial_audio_init(tech_pvt)) { ERRORA("serial_audio_init failed\n", GSMOPEN_P_LOG); @@ -215,6 +216,7 @@ switch_status_t gsmopen_tech_init(private_t *tech_pvt, switch_core_session_t *se } } +*/ if (switch_core_timer_init(&tech_pvt->timer_read, "soft", 20, tech_pvt->read_codec.implementation->samples_per_packet, gsmopen_module_pool) != SWITCH_STATUS_SUCCESS) { @@ -805,6 +807,9 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc gsmopen_sound_boost(frame->data, frame->samples, tech_pvt->playback_boost); if (!tech_pvt->no_sound) { + if (!tech_pvt->serialPort_serial_audio_opened) { + serial_audio_init(tech_pvt); + } sent = tech_pvt->serialPort_serial_audio->Write((char *) frame->data, (int) (frame->datalen)); if (sent && sent != frame->datalen && sent != -1) { @@ -1237,6 +1242,8 @@ static switch_status_t load_config(int reload_type) uint32_t controldevprotocol = PROTOCOL_AT; //FIXME TODO uint32_t running = 1; //FIXME TODO const char *gsmopen_serial_sync_period = "300"; //FIXME TODO + const char *imei = ""; + const char *imsi = ""; tech_pvt = NULL; @@ -1394,6 +1401,10 @@ static switch_status_t load_config(int reload_type) playback_boost = val; } else if (!strcasecmp(var, "no_sound")) { no_sound = val; + } else if (!strcasecmp(var, "imsi")) { + imsi = val; + } else if (!strcasecmp(var, "imei")) { + imei = val; } else if (!strcasecmp(var, "gsmopen_serial_sync_period")) { gsmopen_serial_sync_period = val; } @@ -1466,7 +1477,6 @@ static switch_status_t load_config(int reload_type) if (interface_id && interface_id < GSMOPEN_MAX_INTERFACES) { private_t newconf; - switch_threadattr_t *gsmopen_api_thread_attr = NULL; int res = 0; memset(&newconf, '\0', sizeof(newconf)); @@ -1536,6 +1546,8 @@ static switch_status_t load_config(int reload_type) switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].at_indicator_callsetupoutgoing_string, at_indicator_callsetupoutgoing_string); switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].at_indicator_callsetupremoteringing_string, at_indicator_callsetupremoteringing_string); + switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].imsi, imsi); + switch_set_string(globals.GSMOPEN_INTERFACES[interface_id].imei, imei); globals.GSMOPEN_INTERFACES[interface_id].at_early_audio = atoi(at_early_audio); globals.GSMOPEN_INTERFACES[interface_id].at_after_preinit_pause = atoi(at_after_preinit_pause); globals.GSMOPEN_INTERFACES[interface_id].at_initial_pause = atoi(at_initial_pause); @@ -1550,6 +1562,30 @@ static switch_status_t load_config(int reload_type) globals.GSMOPEN_INTERFACES[interface_id].controldevprotocol = controldevprotocol; //FIXME globals.GSMOPEN_INTERFACES[interface_id].running = running; //FIXME + + gsmopen_store_boost((char *) capture_boost, &globals.GSMOPEN_INTERFACES[interface_id].capture_boost); //FIXME + gsmopen_store_boost((char *) playback_boost, &globals.GSMOPEN_INTERFACES[interface_id].playback_boost); //FIXME + + } else { + ERRORA("interface id %u is higher than GSMOPEN_MAX_INTERFACES (%d)\n", GSMOPEN_P_LOG, interface_id, GSMOPEN_MAX_INTERFACES); + alarm_event(&globals.GSMOPEN_INTERFACES[interface_id], ALARM_FAILED_INTERFACE, "interface id is higher than GSMOPEN_MAX_INTERFACES"); + continue; + } + + } + +#ifndef WIN32 + find_ttyusb_devices(NULL, "/sys/devices"); +#endif// WIN32 + + for (i = 0; i < GSMOPEN_MAX_INTERFACES; i++) { + + switch_threadattr_t *gsmopen_api_thread_attr = NULL; + int res = 0; + int interface_id = i; + + if (strlen(globals.GSMOPEN_INTERFACES[i].name)) { + WARNINGA("STARTING interface_id=%u\n", GSMOPEN_P_LOG, interface_id); DEBUGA_GSMOPEN("id=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[interface_id].id); DEBUGA_GSMOPEN("name=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[interface_id].name); @@ -1557,6 +1593,8 @@ static switch_status_t load_config(int reload_type) DEBUGA_GSMOPEN("context=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[interface_id].context); DEBUGA_GSMOPEN("dialplan=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[interface_id].dialplan); DEBUGA_GSMOPEN("destination=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[interface_id].destination); + DEBUGA_GSMOPEN("imei=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[interface_id].imei); + DEBUGA_GSMOPEN("imsi=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[interface_id].imsi); DEBUGA_GSMOPEN("controldevice_name=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[interface_id].controldevice_name); DEBUGA_GSMOPEN("controldevice_audio_name=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[interface_id].controldevice_audio_name); DEBUGA_GSMOPEN("gsmopen_serial_sync_period=%d\n", GSMOPEN_P_LOG, @@ -1628,8 +1666,8 @@ static switch_status_t load_config(int reload_type) globals.GSMOPEN_INTERFACES[interface_id].active = 1; - gsmopen_store_boost((char *) capture_boost, &globals.GSMOPEN_INTERFACES[interface_id].capture_boost); //FIXME - gsmopen_store_boost((char *) playback_boost, &globals.GSMOPEN_INTERFACES[interface_id].playback_boost); //FIXME + //gsmopen_store_boost((char *) capture_boost, &globals.GSMOPEN_INTERFACES[interface_id].capture_boost); //FIXME + //gsmopen_store_boost((char *) playback_boost, &globals.GSMOPEN_INTERFACES[interface_id].playback_boost); //FIXME switch_sleep(100000); switch_threadattr_create(&gsmopen_api_thread_attr, gsmopen_module_pool); @@ -1640,14 +1678,10 @@ static switch_status_t load_config(int reload_type) switch_sleep(100000); WARNINGA("STARTED interface_id=%u\n", GSMOPEN_P_LOG, interface_id); - } else { - ERRORA("interface id %u is higher than GSMOPEN_MAX_INTERFACES (%d)\n", GSMOPEN_P_LOG, interface_id, GSMOPEN_MAX_INTERFACES); - alarm_event(&globals.GSMOPEN_INTERFACES[interface_id], ALARM_FAILED_INTERFACE, "interface id is higher than GSMOPEN_MAX_INTERFACES"); - continue; } - } + for (i = 0; i < GSMOPEN_MAX_INTERFACES; i++) { if (strlen(globals.GSMOPEN_INTERFACES[i].name)) { /* How many real intterfaces */ @@ -1661,6 +1695,8 @@ static switch_status_t load_config(int reload_type) DEBUGA_GSMOPEN("hold-music=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[i].hold_music); DEBUGA_GSMOPEN("dialplan=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[i].dialplan); DEBUGA_GSMOPEN("destination=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[i].destination); + DEBUGA_GSMOPEN("imei=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[i].imei); + DEBUGA_GSMOPEN("imsi=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[i].imsi); DEBUGA_GSMOPEN("controldevice_name=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[i].controldevice_name); DEBUGA_GSMOPEN("gsmopen_serial_sync_period=%d\n", GSMOPEN_P_LOG, (int) globals.GSMOPEN_INTERFACES[i].gsmopen_serial_sync_period); DEBUGA_GSMOPEN("controldevice_audio_name=%s\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[i].controldevice_audio_name); @@ -2773,6 +2809,294 @@ int sms_incoming(private_t *tech_pvt) return 0; } + + +#ifndef WIN32 +#define PATH_MAX_GIOVA PATH_MAX +static struct { +char path_idvendor[PATH_MAX_GIOVA]; +char path_idproduct[PATH_MAX_GIOVA]; +char tty_base[PATH_MAX_GIOVA]; +char idvendor[PATH_MAX_GIOVA]; +char idproduct[PATH_MAX_GIOVA]; +char tty_data_dir[PATH_MAX_GIOVA]; +char tty_audio_dir[PATH_MAX_GIOVA]; +char data_dev_id[256]; +char audio_dev_id[256]; +char delimiter[256]; +char txt_saved[PATH_MAX_GIOVA]; +char tty_base_copied[PATH_MAX_GIOVA]; +char tty_data_device_file[PATH_MAX_GIOVA]; +char tty_data_device[256]; +char tty_audio_device_file[PATH_MAX_GIOVA]; +char tty_audio_device[256]; +char answer[AT_BUFSIZ]; +char imei[256]; +char imsi[256]; +} f; +/* +int times=0; +int conta=0; +*/ +void find_ttyusb_devices(private_t *tech_pvt, const char *dirname) +{ + DIR *dir; + struct dirent *entry; + + memset( f.path_idvendor, 0, sizeof(f.path_idvendor) ); + memset( f.path_idproduct, 0, sizeof(f.path_idproduct) ); + memset( f.tty_base, 0, sizeof(f.tty_base) ); + memset( f.idvendor, 0, sizeof(f.idvendor) ); + memset( f.idproduct, 0, sizeof(f.idproduct) ); + memset( f.tty_data_dir, 0, sizeof(f.tty_data_dir) ); + memset( f.tty_audio_dir, 0, sizeof(f.tty_audio_dir) ); + memset( f.data_dev_id, 0, sizeof(f.data_dev_id) ); + memset( f.audio_dev_id, 0, sizeof(f.audio_dev_id) ); + memset( f.delimiter, 0, sizeof(f.delimiter) ); + memset( f.txt_saved, 0, sizeof(f.txt_saved) ); + memset( f.tty_base_copied, 0, sizeof(f.tty_base_copied) ); + memset( f.tty_data_device_file, 0, sizeof(f.tty_data_device_file) ); + memset( f.tty_data_device, 0, sizeof(f.tty_data_device) ); + memset( f.tty_audio_device_file, 0, sizeof(f.tty_audio_device_file) ); + memset( f.tty_audio_device, 0, sizeof(f.tty_audio_device) ); + + if (!(dir = opendir(dirname))){ + ERRORA("ERRORA! dirname=%s\n", GSMOPEN_P_LOG, dirname); + closedir(dir); + //conta--; + return; + } + if (!(entry = readdir(dir))){ + ERRORA("ERRORA!\n", GSMOPEN_P_LOG); + closedir(dir); + //conta--; + return; + } + + //conta++; + do { + if (entry->d_type == DT_DIR) { + char path[PATH_MAX_GIOVA]; + int len; + + //times++; + len = snprintf(path, sizeof(path)-1, "%s/%s", dirname, entry->d_name); + path[len] = 0; + if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) + continue; + find_ttyusb_devices(tech_pvt, path); + } else{ + int fd=-1; + int len2=-1; + DIR *dir2=NULL; + struct dirent *entry2=NULL; + int counter; + char *scratch=NULL; + char *txt=NULL; + + if (strcmp(entry->d_name, "idVendor") == 0){ + sprintf(f.tty_base, "%s", dirname); + sprintf(f.path_idvendor, "%s/%s", dirname, entry->d_name); + sprintf(f.path_idproduct, "%s/idProduct", dirname); + + fd = open(f.path_idvendor, O_RDONLY); + len2=read(fd, f.idvendor, sizeof(f.idvendor)); + close(fd); + + if(f.idvendor[len2-1]=='\n'){ + f.idvendor[len2-1]='\0'; + } + if (strcmp(f.idvendor, "12d1") == 0){ + + fd = open(f.path_idproduct, O_RDONLY); + len2=read(fd, f.idproduct, sizeof(f.idproduct)); + close(fd); + + if(f.idproduct[len2-1]=='\n'){ + f.idproduct[len2-1]='\0'; + } + if (strcmp(f.idproduct, "1001") == 0 || strcmp(f.idproduct, "140c") == 0 || strcmp(f.idproduct, "1436") == 0 || strcmp(f.idproduct, "1506") == 0 || strcmp(f.idproduct, "14ac") == 0 ){ + if (strcmp(f.idproduct, "1001") == 0){ + strcpy(f.data_dev_id, "2"); + strcpy(f.audio_dev_id, "1"); + }else if (strcmp(f.idproduct, "140c") == 0){ + strcpy(f.data_dev_id, "3"); + strcpy(f.audio_dev_id, "2"); + }else if (strcmp(f.idproduct, "1436") == 0){ + strcpy(f.data_dev_id, "4"); + strcpy(f.audio_dev_id, "3"); + }else if (strcmp(f.idproduct, "1506") == 0){ + strcpy(f.data_dev_id, "1"); + strcpy(f.audio_dev_id, "2"); + }else if (strcmp(f.idproduct, "14ac") == 0){ + strcpy(f.data_dev_id, "4"); + strcpy(f.audio_dev_id, "3"); + }else{ + //not possible + } + strcpy(f.delimiter, "/"); + strcpy(f.tty_base_copied, f.tty_base); + counter=0; + while((txt = strtok_r(!counter ? f.tty_base_copied : NULL, f.delimiter, &scratch))) + { + strcpy(f.txt_saved, txt); + counter++; + } + sprintf(f.tty_data_dir, "%s/%s:1.%s", f.tty_base, f.txt_saved, f.data_dev_id); + sprintf(f.tty_audio_dir, "%s/%s:1.%s", f.tty_base, f.txt_saved, f.audio_dev_id); + + if (!(dir2 = opendir(f.tty_data_dir))) { + ERRORA("ERRORA!\n", GSMOPEN_P_LOG); + } + if (!(entry2 = readdir(dir2))){ + ERRORA("ERRORA!\n", GSMOPEN_P_LOG); + } + do { + if (strncmp(entry2->d_name, "ttyUSB", 6) == 0){ + //char f.answer[AT_BUFSIZ]; + ctb::SerialPort *serialPort_serial_control; + int res; + int read_count; + char at_command[256]; + + sprintf(f.tty_data_device_file, "%s/%s", f.tty_data_dir, entry2->d_name); + sprintf(f.tty_data_device, "/dev/%s", entry2->d_name); + + memset(f.answer,0,sizeof(f.answer)); + memset(f.imei,0,sizeof(f.imei)); + memset(f.imsi,0,sizeof(f.imsi)); + + serialPort_serial_control = new ctb::SerialPort(); + if (serialPort_serial_control->Open(f.tty_data_device, 115200, "8N1", ctb::SerialPort::NoFlowControl) >= 0) { + sprintf(at_command, "AT\r\n"); + res = serialPort_serial_control->Write(at_command, 4); + usleep(20000); //0.02 seconds + res = serialPort_serial_control->Write(at_command, 4); + usleep(20000); //0.02 seconds + sprintf(at_command, "ATE1\r\n"); + res = serialPort_serial_control->Write(at_command, 6); + usleep(20000); //0.02 seconds + read_count = serialPort_serial_control->Read(f.answer, AT_BUFSIZ); + sprintf(at_command, "AT\r\n"); + res = serialPort_serial_control->Write(at_command, 4); + usleep(20000); //0.02 seconds + read_count = serialPort_serial_control->Read(f.answer, AT_BUFSIZ); + memset(f.answer,0,sizeof(f.answer)); + read_count = serialPort_serial_control->Read(f.answer, AT_BUFSIZ); + memset(f.answer,0,sizeof(f.answer)); + + /* IMEI */ + sprintf(at_command, "AT+GSN\r\n"); + res = serialPort_serial_control->Write(at_command, 8); + if (res != 8) { + ERRORA("writing AT+GSN failed: %d\n", GSMOPEN_P_LOG, res); + }else { + usleep(200000); //0.2 seconds + read_count = serialPort_serial_control->Read(f.answer, AT_BUFSIZ); + if (read_count < 32) { + ERRORA("reading AT+GSN failed: |%s|, read_count=%d\n", GSMOPEN_P_LOG, f.answer, read_count); + } else { + strncpy(f.imei, f.answer+9, 15); + sprintf(at_command, "AT\r\n"); + res = serialPort_serial_control->Write(at_command, 4); + usleep(20000); //0.02 seconds + res = serialPort_serial_control->Write(at_command, 4); + usleep(20000); //0.02 seconds + sprintf(at_command, "ATE1\r\n"); + res = serialPort_serial_control->Write(at_command, 6); + usleep(20000); //0.02 seconds + read_count = serialPort_serial_control->Read(f.answer, AT_BUFSIZ); + sprintf(at_command, "AT\r\n"); + res = serialPort_serial_control->Write(at_command, 4); + usleep(20000); //0.02 seconds + read_count = serialPort_serial_control->Read(f.answer, AT_BUFSIZ); + memset(f.answer,0,sizeof(f.answer)); + read_count = serialPort_serial_control->Read(f.answer, AT_BUFSIZ); + memset(f.answer,0,sizeof(f.answer)); + + /* IMSI */ + sprintf(at_command, "AT+CIMI\r\n"); + res = serialPort_serial_control->Write(at_command, 9); + if (res != 9) { + ERRORA("writing AT+CIMI failed: %d\n", GSMOPEN_P_LOG, res); + }else { + usleep(200000); //0.2 seconds + read_count = serialPort_serial_control->Read(f.answer, AT_BUFSIZ); + if (read_count < 33) { + ERRORA("reading AT+CIMI failed: |%s|, read_count=%d\n", GSMOPEN_P_LOG, f.answer, read_count); + } else { + strncpy(f.imsi, f.answer+10, 15); + } + } + } + } + res = serialPort_serial_control->Close(); + } else { + ERRORA("port %s, NOT open\n", GSMOPEN_P_LOG, f.tty_data_device); + } + } + } while ((entry2 = readdir(dir2))); + closedir(dir2); + + if (!(dir2 = opendir(f.tty_audio_dir))) { + ERRORA("ERRORA!\n", GSMOPEN_P_LOG); + } + if (!(entry2 = readdir(dir2))){ + ERRORA("ERRORA!\n", GSMOPEN_P_LOG); + } + do { + if (strncmp(entry2->d_name, "ttyUSB", 6) == 0){ + int i; + sprintf(f.tty_audio_device_file, "%s/%s", f.tty_audio_dir, entry2->d_name); + sprintf(f.tty_audio_device, "/dev/%s", entry2->d_name); + + NOTICA("************************************************\n", GSMOPEN_P_LOG, f.imei); + NOTICA("f.imei=|%s|\n", GSMOPEN_P_LOG, f.imei); + NOTICA("f.imsi=|%s|\n", GSMOPEN_P_LOG, f.imsi); + NOTICA("f.tty_data_device = |%s|\n", GSMOPEN_P_LOG, f.tty_data_device); + NOTICA("f.tty_audio_device = |%s|\n", GSMOPEN_P_LOG, f.tty_audio_device); + NOTICA("************************************************\n", GSMOPEN_P_LOG, f.imei); + + for (i = 0; i < GSMOPEN_MAX_INTERFACES; i++) { + switch_threadattr_t *gsmopen_api_thread_attr = NULL; + int res = 0; + int interface_id = i; + + if (strlen(globals.GSMOPEN_INTERFACES[i].name) && (strlen(globals.GSMOPEN_INTERFACES[i].imsi) || strlen(globals.GSMOPEN_INTERFACES[i].imei)) ) { + //NOTICA("globals.GSMOPEN_INTERFACES[i].imei)=%s strlen(globals.GSMOPEN_INTERFACES[i].imei)=%d (strcmp(globals.GSMOPEN_INTERFACES[i].imei, f.imei) == 0)=%d \n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[i].imei, strlen(globals.GSMOPEN_INTERFACES[i].imei), (strcmp(globals.GSMOPEN_INTERFACES[i].imei, f.imei) == 0) ); + if( ( strlen(globals.GSMOPEN_INTERFACES[i].imei) ? (strcmp(globals.GSMOPEN_INTERFACES[i].imei, f.imei) == 0) : 1) ) { + if ( (strlen(globals.GSMOPEN_INTERFACES[i].imsi) ? (strcmp(globals.GSMOPEN_INTERFACES[i].imsi, f.imsi) == 0) : 1) ){ + strcpy(globals.GSMOPEN_INTERFACES[i].controldevice_audio_name, f.tty_audio_device); + strcpy(globals.GSMOPEN_INTERFACES[i].controldevice_name, f.tty_data_device); + NOTICA("name = |%s|, controldevice_audio_name = |%s|, controldevice_name = |%s|\n", GSMOPEN_P_LOG, globals.GSMOPEN_INTERFACES[i].name, globals.GSMOPEN_INTERFACES[i].controldevice_audio_name, globals.GSMOPEN_INTERFACES[i].controldevice_name); + break; + } + } + } + } + } + } while ((entry2 = readdir(dir2))); + closedir(dir2); + } + } + } + } + } while ((entry = readdir(dir))); + closedir(dir); +/* + if(f.conta < 0){ + ERRORA("f.conta=%d, dirs=%d, mem=%d\n", GSMOPEN_P_LOG, conta, times, conta*PATH_MAX_GIOVA); + }else{ + NOTICA("f.conta=%d, dirs=%d, mem=%d\n", GSMOPEN_P_LOG, conta, times, conta*PATH_MAX_GIOVA); + } + conta--; +*/ +} +#endif// WIN32 + + + + /* For Emacs: * Local Variables: * mode:c diff --git a/src/mod/endpoints/mod_h323/mod_h323.cpp b/src/mod/endpoints/mod_h323/mod_h323.cpp index 90afd02c4e..17619129cf 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.cpp +++ b/src/mod/endpoints/mod_h323/mod_h323.cpp @@ -1591,7 +1591,36 @@ switch_status_t FSH323Connection::receive_message(switch_core_session_message_t } break; } + case SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA:{ + if (switch_rtp_ready(tech_pvt->rtp_session) && !zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) { + switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID] = {(switch_rtp_flag_t)0}; + int x = 0; + if (!strcasecmp(msg->string_array_arg[0], "read")) { + x++; flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ] = (switch_rtp_flag_t)1; + } else if (!strcasecmp(msg->string_array_arg[0], "write")) { + x++; flags[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE] = (switch_rtp_flag_t)1; + } else if (!strcasecmp(msg->string_array_arg[0], "both")) { + x++; + flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ] = (switch_rtp_flag_t)1; + flags[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE] = (switch_rtp_flag_t)1; + } else if (*msg->string_array_arg[0] == 'v') { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(m_fsSession), SWITCH_LOG_ERROR, "Video is not supported yet\n"); + break; + } + + if (x) { + if (switch_true(msg->string_array_arg[1])) { + switch_rtp_set_flags(tech_pvt->rtp_session, flags); + } else { + switch_rtp_clear_flags(tech_pvt->rtp_session, flags); + } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(m_fsSession), SWITCH_LOG_ERROR, "Invalid Options\n"); + } + } + break; + } default:{ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Received message id = %d [%p]\n", msg->message_id,this); } diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 6845ab2070..790eb7836c 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1315,25 +1315,12 @@ static int flush_listener_callback(void *pArg, int argc, char **argv, char **col return 0; } -static void flush_listener(listener_t *listener) +void skinny_clean_listener_from_db(listener_t *listener) { - if(!zstr(listener->device_name)) { skinny_profile_t *profile = listener->profile; char *sql; - if ((sql = switch_mprintf( - "SELECT '%q', value, '%q', '%q', '%d' " - "FROM skinny_lines " - "WHERE device_name='%s' AND device_instance=%d " - "ORDER BY position", - profile->name, profile->domain, listener->device_name, listener->device_instance, - listener->device_name, listener->device_instance - ))) { - skinny_execute_sql_callback(profile, profile->sql_mutex, sql, flush_listener_callback, NULL); - switch_safe_free(sql); - } - if ((sql = switch_mprintf( "DELETE FROM skinny_devices " "WHERE name='%s' and instance=%d", @@ -1358,6 +1345,38 @@ static void flush_listener(listener_t *listener) switch_safe_free(sql); } + if ((sql = switch_mprintf( + "DELETE FROM skinny_active_lines " + "WHERE device_name='%s' and device_instance=%d", + listener->device_name, listener->device_instance))) { + skinny_execute_sql(profile, sql, profile->sql_mutex); + switch_safe_free(sql); + } + + } +} + +static void flush_listener(listener_t *listener) +{ + + if(!zstr(listener->device_name)) { + skinny_profile_t *profile = listener->profile; + char *sql; + + if ((sql = switch_mprintf( + "SELECT '%q', value, '%q', '%q', '%d' " + "FROM skinny_lines " + "WHERE device_name='%s' AND device_instance=%d " + "ORDER BY position", + profile->name, profile->domain, listener->device_name, listener->device_instance, + listener->device_name, listener->device_instance + ))) { + skinny_execute_sql_callback(profile, profile->sql_mutex, sql, flush_listener_callback, NULL); + switch_safe_free(sql); + } + + skinny_clean_listener_from_db(listener); + strcpy(listener->device_name, ""); } } diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index e0e3515da4..717bcd0378 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -271,6 +271,7 @@ switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile, uint8_t listener_is_ready(listener_t *listener); switch_status_t kill_listener(listener_t *listener, void *pvt); switch_status_t keepalive_listener(listener_t *listener, void *pvt); +void skinny_clean_listener_from_db(listener_t *listener); /*****************************************************************************/ /* CHANNEL FUNCTIONS */ diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index c3c8f9029b..2b7031186d 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -964,8 +964,8 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r if (!zstr(listener->device_name)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "A device is already registred on this listener.\n"); - send_register_reject(listener, "A device is already registred on this listener"); + "A device is already registered on this listener.\n"); + send_register_reject(listener, "A device is already registered on this listener"); return SWITCH_STATUS_FALSE; } @@ -993,6 +993,9 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r goto end; } + /* clean up all traces before adding to database */ + skinny_clean_listener_from_db(listener); + if ((sql = switch_mprintf( "INSERT INTO skinny_devices " "(name, user_id, instance, ip, type, max_streams, codec_string) " @@ -1952,6 +1955,9 @@ switch_status_t skinny_handle_unregister(listener_t *listener, skinny_message_t /* Close socket */ switch_clear_flag_locked(listener, LFLAG_RUNNING); + /* Clear this device from database and any active lines/etc. */ + skinny_clean_listener_from_db(listener); + return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index bf6bee7b28..411ea3e44e 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -205,6 +205,10 @@ + + + @@ -353,6 +357,10 @@ + + + + diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 90e8dad19e..ac8b4366f7 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -230,6 +230,7 @@ typedef enum { PFLAG_DISABLE_SRV503, PFLAG_DISABLE_NAPTR, PFLAG_NAT_OPTIONS_PING, + PFLAG_UDP_NAT_OPTIONS_PING, PFLAG_ALL_REG_OPTIONS_PING, PFLAG_MESSAGE_QUERY_ON_REGISTER, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER, @@ -672,6 +673,7 @@ struct sofia_profile { su_strlst_t *tls_verify_in_subjects; uint32_t sip_force_expires; uint32_t sip_expires_max_deviation; + uint32_t sip_subscription_max_deviation; int ireg_seconds; sofia_paid_type_t paid_type; uint32_t rtp_digit_delay; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 54b683441c..ba5e1694b3 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2007,16 +2007,34 @@ void event_handler(switch_event_t *event) if (!strcasecmp(class, "PRESENCE_IN")) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nGot Presence IN event via MultiCast\n"); if (switch_event_create(&pevent, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "proto", switch_event_get_header_nil(event, "orig-proto")); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "login", switch_event_get_header_nil(event, "orig-login")); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "from", switch_event_get_header_nil(event, "orig-from")); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "rpid", switch_event_get_header_nil(event, "orig-rpid")); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "status", switch_event_get_header_nil(event, "orig-status")); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "answer-state", switch_event_get_header_nil(event, "orig-answer-state")); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "alt_event_type", switch_event_get_header_nil(event, "orig-alt_event_type")); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "presence-call-direction", switch_event_get_header_nil(event, "orig-presence-call-direction")); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "channel-state", switch_event_get_header_nil(event, "orig-channel-state")); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "call-direction", switch_event_get_header_nil(event, "orig-call-direction")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "alt_event_type", switch_event_get_header_nil(event, "orig-alt_event_type")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "answer-state", switch_event_get_header_nil(event, "orig-answer-state")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "astate", switch_event_get_header_nil(event, "orig-astate")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "call-direction", switch_event_get_header_nil(event, "orig-call-direction")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "Caller-Callee-ID-Number", switch_event_get_header_nil(event, "Orig-Caller-Callee-ID-Number")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "Caller-Caller-ID-Name", switch_event_get_header_nil(event, "Orig-Caller-Caller-ID-Name")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "Caller-Caller-ID-Number", switch_event_get_header_nil(event, "Orig-Caller-Caller-ID-Number")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "Caller-Destination-Number", switch_event_get_header_nil(event, "Orig-Caller-Destination-Number")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "Caller-Direction", switch_event_get_header_nil(event, "Orig-Caller-Direction")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "Caller-Username", switch_event_get_header_nil(event, "Orig-Caller-Username")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "channel-state", switch_event_get_header_nil(event, "orig-channel-state")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "force-status", switch_event_get_header_nil(event, "orig-force-status")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "from", switch_event_get_header_nil(event, "orig-from")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "login", switch_event_get_header_nil(event, "orig-login")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "Other-Leg-Caller-ID-Name", switch_event_get_header_nil(event, "Orig-Other-Leg-Caller-ID-Name")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "Other-Leg-Caller-ID-Number", switch_event_get_header_nil(event, "Orig-Other-Leg-Caller-ID-Number")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "presence-call-direction", switch_event_get_header_nil(event, "orig-presence-call-direction")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "presence-call-info-state", switch_event_get_header_nil(event, "orig-presence-call-info-state")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "Presence-Privacy", switch_event_get_header_nil(event, "Orig-Presence-Privacy")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "proto", switch_event_get_header_nil(event, "orig-proto")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "register-source", switch_event_get_header_nil(event, "orig-register-source")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "resub", switch_event_get_header_nil(event, "orig-resub")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "rpid", switch_event_get_header_nil(event, "orig-rpid")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "status", switch_event_get_header_nil(event, "orig-status")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "Unique-ID", switch_event_get_header_nil(event, "Orig-Unique-ID")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "variable_sip_from_user", switch_event_get_header_nil(event, "Orig-variable_sip_from_user")); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "variable_sip_to_user", switch_event_get_header_nil(event, "Orig-variable_sip_to_user")); + /* we cannot use switch_event_fire, or otherwise we'll start an endless loop */ sofia_presence_event_handler(pevent); return; @@ -3685,6 +3703,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) profile->rtp_digit_delay = 40; profile->sip_force_expires = 0; profile->sip_expires_max_deviation = 0; + profile->sip_subscription_max_deviation = 0; profile->tls_version = 0; profile->tls_timeout = 300; profile->mflags = MFLAG_REFER | MFLAG_REGISTER; @@ -4308,10 +4327,13 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } else if (!strcasecmp(var, "contact-user")) { profile->contact_user = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "nat-options-ping")) { - if (switch_true(val)) { + if (!strcasecmp(val, "udp-only")) { + sofia_set_pflag(profile, PFLAG_UDP_NAT_OPTIONS_PING); + } else if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_NAT_OPTIONS_PING); } else { sofia_clear_pflag(profile, PFLAG_NAT_OPTIONS_PING); + sofia_clear_pflag(profile, PFLAG_UDP_NAT_OPTIONS_PING); } } else if (!strcasecmp(var, "all-reg-options-ping")) { if (switch_true(val)) { @@ -4635,6 +4657,13 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } else { profile->sip_expires_max_deviation = 0; } + } else if (!strcasecmp(var, "sip-subscription-max-deviation")) { + int32_t sip_subscription_max_deviation = atoi(val); + if (sip_subscription_max_deviation >= 0) { + profile->sip_subscription_max_deviation = sip_subscription_max_deviation; + } else { + profile->sip_subscription_max_deviation = 0; + } } else if (!strcasecmp(var, "reuse-connections")) { switch_bool_t value = switch_true(val); if (!value) { diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 91ca35e879..8ac0629ae1 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -260,9 +260,22 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event) } if (!list) { + switch_event_t *event; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Chat proto [%s]\nfrom [%s]\nto [%s]\n%s\nNobody to send to: Profile %s\n", proto, from, to, body ? body : "[no body]", prof ? prof : "NULL"); + // emit no recipient event + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_ERROR) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Error-Type", "chat"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Error-Reason", "no recipient"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Chat-Send-To", to); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Chat-Send-From", from); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Chat-Send-Profile", prof ? prof : "NULL"); + switch_event_add_body(event, "%s", body); + switch_event_fire(&event); + } + goto end; } @@ -3516,6 +3529,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, long exp_delta = 0; char exp_delta_str[30] = ""; + uint32_t sub_max_deviation_var = 0; sip_to_t const *to; const char *from_user = NULL, *from_host = NULL; const char *to_user = NULL, *to_host = NULL; @@ -3615,6 +3629,18 @@ void sofia_presence_handle_sip_i_subscribe(int status, } } + if ((sub_max_deviation_var = profile->sip_subscription_max_deviation)) { + if (sub_max_deviation_var > 0) { + int sub_deviation; + srand( (unsigned) ( (unsigned)(intptr_t)switch_thread_self() + switch_micro_time_now() ) ); + /* random negative number between 0 and negative sub_max_deviation_var: */ + sub_deviation = ( rand() % sub_max_deviation_var ) - sub_max_deviation_var; + if ( (exp_delta + sub_deviation) > 45 ) { + exp_delta += sub_deviation; + } + } + } + if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DELTA %ld\n", exp_delta); } diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 2bdf11e2d1..aba34a321d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -822,6 +822,14 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot) " from sip_registrations where hostname='%s' and " "profile_name='%s'", mod_sofia_globals.hostname, profile->name); + sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile); + switch_safe_free(sql); + } else if (sofia_test_pflag(profile, PFLAG_UDP_NAT_OPTIONS_PING)) { + sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid," + "expires,user_agent,server_user,server_host,profile_name" + " from sip_registrations where status like '%%UDP-NAT%%' " + "and hostname='%s' and profile_name='%s'", mod_sofia_globals.hostname, profile->name); + sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile); switch_safe_free(sql); } else if (sofia_test_pflag(profile, PFLAG_NAT_OPTIONS_PING)) { diff --git a/src/mod/event_handlers/mod_rayo/mod_rayo.c b/src/mod/event_handlers/mod_rayo/mod_rayo.c index 66f59c9def..24b187d739 100644 --- a/src/mod/event_handlers/mod_rayo/mod_rayo.c +++ b/src/mod/event_handlers/mod_rayo/mod_rayo.c @@ -2884,7 +2884,7 @@ static struct rayo_actor *xmpp_stream_client_locate(struct xmpp_stream *stream, struct rayo_peer_server *rserver = RAYO_PEER_SERVER(xmpp_stream_get_private(stream)); actor = RAYO_ACTOR(rayo_client_create(jid, xmpp_stream_get_jid(stream), PS_UNKNOWN, rayo_client_send, rserver)); RAYO_RDLOCK(actor); - } else if (!strcmp(RAT_CLIENT, actor->type)) { + } else if (strcmp(RAT_CLIENT, actor->type)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s, not a client: %s\n", xmpp_stream_get_jid(stream), jid); RAYO_UNLOCK(actor); actor = NULL; diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index eb081a226f..0b64ba7e5b 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -60,52 +60,43 @@ static struct { mpg123_handle *our_mpg123_new(const char *decoder, int *error) { - mpg123_handle *mh; const char *arch = "auto"; + const char *err = NULL; + mpg123_handle *mh; int x64 = 0; int rc = 0; - const char *err = NULL; - if (*globals.decoder || globals.outscale || globals.vol) { - if (*globals.decoder) { - arch = globals.decoder; - } - if ((mh = mpg123_new(arch, &rc))) { - if (rc) { - err = mpg123_plain_strerror(rc); - } - if (globals.outscale) { - mpg123_param(mh, MPG123_OUTSCALE, globals.outscale, 0); - } - if (globals.vol) { - mpg123_volume(mh, globals.vol); - } - } + if (*globals.decoder) { + arch = globals.decoder; + } +#ifndef WIN32 + else if (sizeof(void *) == 4) { + arch = "i586"; } else { - -#ifdef WIN32 - x64++; + x64 = 1; + } #else - if (sizeof(void *) == 4) { - arch = "i586"; - } else { - x64++; - } + x64 = 1; #endif + mh = mpg123_new(arch, &rc); + if (!mh) { + err = mpg123_plain_strerror(rc); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error allocating mpg123 handle! %s\n", switch_str_nil(err)); + return NULL; + } - if ((mh = mpg123_new(arch, &rc))) { - if (rc) { - err = mpg123_plain_strerror(rc); - } - if (x64) { - mpg123_param(mh, MPG123_OUTSCALE, 8192, 0); - } + /* NOTE: keeping the globals.decoder check here for behaviour backwards compat - stkn */ + if (*globals.decoder || globals.outscale || globals.vol) { + if (globals.outscale) { + mpg123_param(mh, MPG123_OUTSCALE, globals.outscale, 0); } + if (globals.vol) { + mpg123_volume(mh, globals.vol); + } + } else if (x64) { + mpg123_param(mh, MPG123_OUTSCALE, 8192, 0); } - if (err) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error allocating mpg123 handle! %s\n", err); - } return mh; } diff --git a/src/mod/languages/mod_lua/mod_lua.cpp b/src/mod/languages/mod_lua/mod_lua.cpp index 642ad3fbf7..3d79dd8d0e 100644 --- a/src/mod/languages/mod_lua/mod_lua.cpp +++ b/src/mod/languages/mod_lua/mod_lua.cpp @@ -32,6 +32,7 @@ #include +#include SWITCH_BEGIN_EXTERN_C #include "lua.h" #include @@ -44,6 +45,7 @@ SWITCH_MODULE_DEFINITION_EX(mod_lua, mod_lua_load, mod_lua_shutdown, NULL, SMODF static struct { switch_memory_pool_t *pool; char *xml_handler; + switch_event_node_t *node; } globals; int luaopen_freeswitch(lua_State * L); @@ -287,10 +289,12 @@ static switch_xml_t lua_fetch(const char *section, } +static void lua_event_handler(switch_event_t *event); + static switch_status_t do_config(void) { const char *cf = "lua.conf"; - switch_xml_t cfg, xml, settings, param; + switch_xml_t cfg, xml, settings, param, hook; switch_stream_handle_t path_stream = {0}; switch_stream_handle_t cpath_stream = {0}; @@ -327,6 +331,31 @@ static switch_status_t do_config(void) path_stream.write_function(&path_stream, "%s", val); } } + + for (hook = switch_xml_child(settings, "hook"); hook; hook = hook->next) { + char *event = (char *) switch_xml_attr_soft(hook, "event"); + char *subclass = (char *) switch_xml_attr_soft(hook, "subclass"); + //char *script = strdup( (char *) switch_xml_attr_soft(hook, "script")); + char *script = (char *) switch_xml_attr_soft(hook, "script"); + switch_event_types_t evtype; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "hook params: '%s' | '%s' | '%s'\n", event, subclass, script); + + if (switch_name_event(event,&evtype) == SWITCH_STATUS_SUCCESS) { + if (!zstr(script)) { + if (switch_event_bind_removable(modname, evtype, !zstr(subclass) ? subclass : SWITCH_EVENT_SUBCLASS_ANY, + lua_event_handler, script, &globals.node) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "event handler for '%s' set to '%s'\n", switch_event_name(evtype), script); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set event handler: unsuccessful bind\n"); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set event handler: no script name\n", event); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set event handler: unknown event type '%s'\n", event); + } + } } if (cpath_stream.data_len) { @@ -405,6 +434,23 @@ int lua_thread(const char *text) return 0; } +static void lua_event_handler(switch_event_t *event) +{ + lua_State *L = lua_init(); + char *script = NULL; + + if (event->bind_user_data) { + script = strdup((char *)event->bind_user_data); + } + + mod_lua_conjure_event(L, event, "event", 1); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "lua event hook: execute '%s'\n", (char *)script); + lua_parse_and_execute(L, (char *)script); + lua_uninit(L); + + switch_safe_free(script); +} + SWITCH_STANDARD_APP(lua_function) { lua_State *L = lua_init(); @@ -645,6 +691,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load) SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lua_shutdown) { + switch_event_unbind(&globals.node); + return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/loggers/mod_console/mod_console.c b/src/mod/loggers/mod_console/mod_console.c index 905029b92b..4b80add5e4 100644 --- a/src/mod/loggers/mod_console/mod_console.c +++ b/src/mod/loggers/mod_console/mod_console.c @@ -60,6 +60,7 @@ static switch_memory_pool_t *module_pool = NULL; static switch_hash_t *log_hash = NULL; static uint32_t all_level = 0; static int32_t hard_log_level = SWITCH_LOG_DEBUG; +static switch_bool_t log_uuid = SWITCH_FALSE; //static int32_t failed_write = 0; static void del_mapping(char *var) { @@ -138,6 +139,8 @@ static switch_status_t config_logger(void) #endif } else if (!strcasecmp(var, "loglevel") && !zstr(val)) { hard_log_level = switch_log_str2level(val); + } else if (!strcasecmp(var, "uuid") && switch_true(val)) { + log_uuid = SWITCH_TRUE; } } } @@ -244,11 +247,21 @@ static switch_status_t switch_console_logger(const switch_log_node_t *node, swit DWORD len = (DWORD) strlen(node->data); DWORD outbytes = 0; SetConsoleTextAttribute(hStdout, COLORS[node->level]); + if (log_uuid && !zstr(node->userdata)) { + WriteFile(hStdout, node->userdata, strlen(node->userdata), &outbytes, NULL); + WriteFile(hStdout, " ", strlen(" "), &outbytes, NULL); + } WriteFile(hStdout, node->data, len, &outbytes, NULL); SetConsoleTextAttribute(hStdout, wOldColorAttrs); #else - fprintf(handle, "%s%s%s", COLORS[node->level], node->data, SWITCH_SEQ_DEFAULT_COLOR); + if (log_uuid && !zstr(node->userdata)) { + fprintf(handle, "%s%s %s%s", COLORS[node->level], node->userdata, node->data, SWITCH_SEQ_DEFAULT_COLOR); + } else { + fprintf(handle, "%s%s%s", COLORS[node->level], node->data, SWITCH_SEQ_DEFAULT_COLOR); + } #endif + } else if (log_uuid && !zstr(node->userdata)) { + fprintf(handle, "%s %s", node->userdata, node->data); } else { fprintf(handle, "%s", node->data); } diff --git a/src/mod/say/mod_say_de/mod_say_de.c b/src/mod/say/mod_say_de/mod_say_de.c index af970430c5..a461bebe1f 100644 --- a/src/mod/say/mod_say_de/mod_say_de.c +++ b/src/mod/say/mod_say_de/mod_say_de.c @@ -91,7 +91,7 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_ } else { say_file("digits/%d.wav", a); } - say_file("digits/hundred.wav"); + say_file("digits/hundred.wav"); } if (b) { @@ -106,13 +106,25 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_ say_file("currency/and.wav"); } if (method == SSM_COUNTED) { - say_file("digits/h-%d0.wav", b); + if ( gender == SSG_MASCULINE ) { + say_file("digits/h-%d0_m.wav", b); + } else if ( gender == SSG_NEUTER ) { + say_file("digits/h-%d0_n.wav", b); + } else { + say_file("digits/h-%d0.wav", b); + } } else { say_file("digits/%d0.wav", b); } } else { if (method == SSM_COUNTED) { - say_file("digits/h-%d%d.wav", b, c); + if ( gender == SSG_MASCULINE ) { + say_file("digits/h-%d%d_m.wav", b,c); + } else if ( gender == SSG_NEUTER ) { + say_file("digits/h-%d%d_n.wav", b,c); + } else { + say_file("digits/h-%d%d.wav", b,c); + } } else { say_file("digits/%d%d.wav", b, c); } @@ -122,12 +134,18 @@ static switch_status_t play_group(switch_say_method_t method, switch_say_gender_ if (c) { if (method == SSM_COUNTED) { - say_file("digits/h-%d.wav", c); + if ( gender == SSG_MASCULINE ) { + say_file("digits/h-%d_m.wav", c); + } else if ( gender == SSG_NEUTER ) { + say_file("digits/h-%d_n.wav", c); + } else { + say_file("digits/h-%d.wav", c); + } } else { /*"one" used as an article is feminine or masculine in german, e.g. voicemail-message is feminine only applies to the likes of 1, 101, 1001 etc.*/ if ( b == 0 && c == 1 && gender == SSG_FEMININE ) { - say_file("digits/%d_f.wav", c); + say_file("digits/1_f.wav"); } else if ( b == 0 && c == 1 && what ) { say_file("digits/s-1.wav"); } else { @@ -251,10 +269,11 @@ static switch_status_t de_say_time(switch_core_session_t *session, char *tosay, } if (hours) { - say_num(hours, SSM_PRONOUNCED); if (hours == 1) { + say_file("digits/1_f.wav"); say_file("time/hour.wav"); } else { + say_num(hours, SSM_PRONOUNCED); say_file("time/hours.wav"); } } else { @@ -263,10 +282,11 @@ static switch_status_t de_say_time(switch_core_session_t *session, char *tosay, } if (minutes) { - say_num(minutes, SSM_PRONOUNCED); if (minutes == 1) { + say_file("digits/1_f.wav"); say_file("time/minute.wav"); } else { + say_num(minutes, SSM_PRONOUNCED); say_file("time/minutes.wav"); } } else { @@ -274,11 +294,13 @@ static switch_status_t de_say_time(switch_core_session_t *session, char *tosay, say_file("time/minutes.wav"); } + say_file("currency/and.wav"); if (seconds) { - say_num(seconds, SSM_PRONOUNCED); if (seconds == 1) { + say_file("digits/1_f.wav"); say_file("time/second.wav"); } else { + say_num(seconds, SSM_PRONOUNCED); say_file("time/seconds.wav"); } } else { @@ -311,6 +333,7 @@ static switch_status_t de_say_time(switch_core_session_t *session, char *tosay, } if (say_date) { + say_args->gender = SSG_MASCULINE; say_file("time/day-%d.wav", tm.tm_wday); say_num(tm.tm_mday, SSM_COUNTED); say_file("time/mon-%d.wav", tm.tm_mon); @@ -318,29 +341,27 @@ static switch_status_t de_say_time(switch_core_session_t *session, char *tosay, } if (say_time) { - int32_t hour = tm.tm_hour, pm = 0; - - if (hour > 12) { - hour -= 12; - pm = 1; - } else if (hour == 12) { - pm = 1; - } else if (hour == 0) { - hour = 12; - pm = 0; + if (say_date) { + say_file("time/at.wav"); } - say_num(hour, SSM_PRONOUNCED); - say_file("time/oclock.wav"); - - if (tm.tm_min > 9) { - say_num(tm.tm_min, SSM_PRONOUNCED); - } else if (tm.tm_min) { - say_file("time/oh.wav"); - say_num(tm.tm_min, SSM_PRONOUNCED); + if (tm.tm_hour == 1) { + say_file("digits/s-1.wav"); + } else { + say_num(tm.tm_hour, SSM_PRONOUNCED); + } + say_file("time/oclock.wav"); + + if (tm.tm_min > 0) { + say_file("currency/and.wav"); + if (tm.tm_min == 1) { + say_file("digits/1_f.wav") + say_file("time/minute.wav"); + } else { + say_num(tm.tm_min, SSM_PRONOUNCED); + say_file("time/minutes.wav"); + } } - - say_file("time/%s.wav", pm ? "p-m" : "a-m"); } return SWITCH_STATUS_SUCCESS; @@ -378,23 +399,25 @@ static switch_status_t de_say_money(switch_core_session_t *session, char *tosay, dollars++; } + /* Say dollar amount */ - de_say_general_count(session, dollars, say_args, args); if (atoi(dollars) == 1) { + say_file("digits/s-1.wav"); say_file("currency/dollar.wav"); } else { + de_say_general_count(session, dollars, say_args, args); say_file("currency/dollars.wav"); } - /* Say "and" */ - say_file("currency/and.wav"); - /* Say cents */ if (cents) { - de_say_general_count(session, cents, say_args, args); + /* Say "and" */ + say_file("currency/and.wav"); if (atoi(cents) == 1) { + say_file("digits/s-1.wav"); say_file("currency/cent.wav"); } else { + de_say_general_count(session, cents, say_args, args); say_file("currency/cents.wav"); } } else { diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 9270b0b729..a52c9e08e7 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -2788,7 +2788,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s if ((zstr(map->rm_encoding) || (smh->mparams->ndlb & SM_NDLB_ALLOW_BAD_IANANAME)) && map->rm_pt < 96) { match = (map->rm_pt == imp->ianacode) ? 1 : 0; } else { - match = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1; + match = (!strcasecmp(rm_encoding, imp->iananame) && (map->rm_rate == codec_rate)) ? 1 : 0; } if (match && bit_rate && map_bit_rate && map_bit_rate != bit_rate && strcasecmp(map->rm_encoding, "ilbc") && diff --git a/src/switch_event.c b/src/switch_event.c index de875b6337..20262677e1 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -916,11 +916,9 @@ static switch_status_t switch_event_base_add_header(switch_event_t *event, switc if (index_ptr || (stack & SWITCH_STACK_PUSH) || (stack & SWITCH_STACK_UNSHIFT)) { if (!(header = switch_event_get_header_ptr(event, header_name)) && index_ptr) { - /* - * Removing a possible leak. But it doesn't appear this is used anywhere, and even if it were then it wouldn't be working. - header = new_header(header_name); - */ - + + header = new_header(header_name); + if (switch_test_flag(event, EF_UNIQ_HEADERS)) { switch_event_del_header(event, header_name); } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index ba4ad8bead..e98be1349e 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2234,8 +2234,10 @@ static int switch_ivr_set_xml_chan_var(switch_xml_t xml, const char *var, const char *data; switch_size_t dlen = strlen(val) * 3 + 1; switch_xml_t variable; + + if (!val) val = ""; - if (!zstr(var) && !zstr(val) && ((variable = switch_xml_add_child_d(xml, var, off++)))) { + if (!zstr(var) && ((variable = switch_xml_add_child_d(xml, var, off++)))) { if ((data = malloc(dlen))) { memset(data, 0, dlen); switch_url_encode(val, data, dlen); diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 6566670848..8e5a451e7e 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1132,6 +1132,9 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s switch_time_t diff; rh->wready = 1; + nframe = switch_core_media_bug_get_native_write_frame(bug); + len = nframe->datalen; + if (!rh->rready) { unsigned char fill_data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0}; switch_size_t fill_len = len; @@ -1140,8 +1143,6 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s } - nframe = switch_core_media_bug_get_native_write_frame(bug); - len = nframe->datalen; if (rh->last_write_time && rh->last_write_time < now) { @@ -1211,6 +1212,12 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s switch_event_fire(&event); } + if (read_impl.actual_samples_per_second) { + switch_channel_set_variable_printf(channel, "record_seconds", "%d", rh->fh->samples_out / read_impl.actual_samples_per_second); + switch_channel_set_variable_printf(channel, "record_ms", "%d", rh->fh->samples_out / (read_impl.actual_samples_per_second / 1000)); + } + switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out); + switch_channel_execute_on(channel, SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE); if ((var = switch_channel_get_variable(channel, SWITCH_RECORD_POST_PROCESS_EXEC_API_VARIABLE))) { diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 9f903c6ba8..f9b22f8a4f 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -874,6 +874,8 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio if (switch_ivr_wait_for_answer(session, other_session) != SWITCH_STATUS_SUCCESS) { if (switch_true(switch_channel_get_variable(channel, "uuid_bridge_continue_on_cancel"))) { switch_channel_set_state(channel, CS_EXECUTE); + } else if (switch_true(switch_channel_get_variable(channel, "uuid_bridge_park_on_cancel"))) { + switch_ivr_park_session(session); } else if (!switch_channel_test_flag(channel, CF_TRANSFER)) { switch_channel_hangup(channel, SWITCH_CAUSE_ORIGINATOR_CANCEL); } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 1f2f076a06..7222c43533 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1705,7 +1705,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess if (read_impl.samples_per_second) { switch_channel_set_variable_printf(channel, "playback_seconds", "%d", fh->samples_in / fh->native_rate); - switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_in / fh->native_rate); + switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_in / (fh->native_rate / 1000)); } switch_channel_set_variable_printf(channel, "playback_samples", "%d", fh->samples_in); diff --git a/src/switch_odbc.c b/src/switch_odbc.c index 9be34079d6..7656231c3e 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -412,7 +412,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec_string(switch_odbc_ SQLRowCount(stmt, &m); handle->affected_rows = (int) m; - if (m <= 0) { + if (m == 0) { goto done; } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 177fbffcc5..45ab478f96 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -4066,7 +4066,10 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t #endif #ifdef ENABLE_SRTP - if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] && rtp_session->recv_msg.header.version == 2 && rtp_session->recv_msg.header.pt == rtp_session->rpayload) { + if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] && rtp_session->recv_msg.header.version == 2 && + ((rtp_session->recv_msg.header.pt == rtp_session->rpayload) || + (rtp_session->recv_te && rtp_session->recv_msg.header.pt == rtp_session->recv_te) || + (rtp_session->cng_pt && rtp_session->recv_msg.header.pt == rtp_session->cng_pt))) { //if (rtp_session->flags[SWITCH_RTP_FLAG_SECURE_RECV] && (!rtp_session->ice.ice_user || rtp_session->recv_msg.header.version == 2)) { int sbytes = (int) *bytes; err_status_t stat = 0; diff --git a/src/switch_xml.c b/src/switch_xml.c index 018c01dd47..c13e33bea4 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -105,6 +105,42 @@ void globfree(glob_t *); /* Use UTF-8 as the general encoding */ static switch_bool_t USE_UTF_8_ENCODING = SWITCH_TRUE; +static void preprocess_exec_set(char *keyval) +{ + char *key = keyval; + char *val = strchr(key, '='); + + if (val) { + char *ve = val++; + while (*val && *val == ' ') { + val++; + } + *ve-- = '\0'; + while (*ve && *ve == ' ') { + *ve-- = '\0'; + } + } + + if (key && val) { + switch_stream_handle_t exec_result = { 0 }; + SWITCH_STANDARD_STREAM(exec_result); + if (switch_stream_system_fork(val, &exec_result) == 0) { + if (!zstr(exec_result.data)) { + char *tmp = (char *) exec_result.data; + tmp = &tmp[strlen(tmp)-1]; + while (tmp >= (char *) exec_result.data && ( tmp[0] == ' ' || tmp[0] == '\n') ) { + tmp[0] = '\0'; /* remove trailing spaces and newlines */ + tmp--; + } + switch_core_set_variable(key, exec_result.data); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error while executing command: %s\n", val); + } + switch_safe_free(exec_result.data); + } +} + static int preprocess(const char *cwd, const char *file, FILE *write_fd, int rlevel); typedef struct switch_xml_root *switch_xml_root_t; @@ -1457,6 +1493,8 @@ static int preprocess(const char *cwd, const char *file, FILE *write_fd, int rle switch_core_set_variable(name, val); } + } else if (!strcasecmp(tcmd, "exec-set")) { + preprocess_exec_set(targ); } else if (!strcasecmp(tcmd, "include")) { preprocess_glob(cwd, targ, write_fd, rlevel + 1); } else if (!strcasecmp(tcmd, "exec")) { @@ -1515,6 +1553,8 @@ static int preprocess(const char *cwd, const char *file, FILE *write_fd, int rle switch_core_set_variable(name, val); } + } else if (!strcasecmp(cmd, "exec-set")) { + preprocess_exec_set(arg); } else if (!strcasecmp(cmd, "include")) { preprocess_glob(cwd, arg, write_fd, rlevel + 1); } else if (!strcasecmp(cmd, "exec")) {