[commit] r10030 - in freeswitch/branches/mrene: . build conf/autoload_configs libs libs/win32 src src/include src/mod/applications/mod_commands src/mod/applications/mod_conference src/mod/applications/mod_enum src/mod/endpoints/mod_sofia src/mod/formats/mod_shout src/mod/formats/mod_shout/windows src/mod/formats/mod_shout/windows/libmpg123 src/mod/xml_int/mod_xml_ldap
Author: mrene Date: Wed Oct 15 15:18:32 2008 New Revision: 10030 Added: freeswitch/branches/mrene/libs/win32/Download mpg123.2008.vcproj - copied unchanged from r10029, /freeswitch/trunk/libs/win32/Download mpg123.2008.vcproj freeswitch/branches/mrene/src/mod/formats/mod_shout/windows/ - copied from r10029, /freeswitch/trunk/src/mod/formats/mod_shout/windows/ freeswitch/branches/mrene/src/mod/formats/mod_shout/windows/libmpg123/ - copied from r10029, /freeswitch/trunk/src/mod/formats/mod_shout/windows/libmpg123/ freeswitch/branches/mrene/src/mod/formats/mod_shout/windows/libmpg123/mpg123.h - copied unchanged from r10029, /freeswitch/trunk/src/mod/formats/mod_shout/windows/libmpg123/mpg123.h Removed: freeswitch/branches/mrene/conf/autoload_configs/wanpipe.conf.xml Modified: freeswitch/branches/mrene/Freeswitch.2008.sln freeswitch/branches/mrene/build/modules.conf.in freeswitch/branches/mrene/conf/autoload_configs/modules.conf.xml freeswitch/branches/mrene/freeswitch.spec freeswitch/branches/mrene/libs/ (props changed) freeswitch/branches/mrene/src/include/switch_core.h freeswitch/branches/mrene/src/include/switch_utils.h freeswitch/branches/mrene/src/mod/applications/mod_commands/mod_commands.c freeswitch/branches/mrene/src/mod/applications/mod_conference/mod_conference.c freeswitch/branches/mrene/src/mod/applications/mod_enum/mod_enum.c freeswitch/branches/mrene/src/mod/endpoints/mod_sofia/sofia_reg.c freeswitch/branches/mrene/src/mod/formats/mod_shout/mod_shout.c freeswitch/branches/mrene/src/mod/formats/mod_shout/mod_shout.vcproj freeswitch/branches/mrene/src/mod/xml_int/mod_xml_ldap/mod_xml_ldapv2.c freeswitch/branches/mrene/src/switch_core_codec.c freeswitch/branches/mrene/src/switch_core_io.c freeswitch/branches/mrene/src/switch_ivr_originate.c freeswitch/branches/mrene/src/switch_rtp.c Log: Merge with r10029 Modified: freeswitch/branches/mrene/Freeswitch.2008.sln ============================================================================== --- freeswitch/branches/mrene/Freeswitch.2008.sln (original) +++ freeswitch/branches/mrene/Freeswitch.2008.sln Wed Oct 15 15:18:32 2008 @@ -972,6 +972,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeSWITCH.Managed", "src\mod\languages\mod_managed\managed\FreeSWITCH.Managed.csproj", "{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download mpg123", "libs\win32\Download mpg123.2008.vcproj", "{E796E337-DE78-4303-8614-9A590862EE95}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -1698,6 +1700,12 @@ {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|Any CPU + {E796E337-DE78-4303-8614-9A590862EE95}.Debug|Win32.ActiveCfg = Debug|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.Debug|Win32.Build.0 = Debug|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.Debug|x64.ActiveCfg = Debug|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.Release|Win32.ActiveCfg = Release|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.Release|Win32.Build.0 = Release|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1805,6 +1813,7 @@ {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B} = {C120A020-773F-4EA3-923F-B67AF28B750D} {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B} = {C120A020-773F-4EA3-923F-B67AF28B750D} {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B} = {C120A020-773F-4EA3-923F-B67AF28B750D} + {E796E337-DE78-4303-8614-9A590862EE95} = {C120A020-773F-4EA3-923F-B67AF28B750D} {988CACF7-3FCB-4992-BE69-77872AE67DC8} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} {5BC072DB-3826-48EA-AF34-FE32AA01E83B} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} {FA429E98-8B03-45E6-A096-A4BC5E821DE4} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} Modified: freeswitch/branches/mrene/build/modules.conf.in ============================================================================== --- freeswitch/branches/mrene/build/modules.conf.in (original) +++ freeswitch/branches/mrene/build/modules.conf.in Wed Oct 15 15:18:32 2008 @@ -35,7 +35,6 @@ #endpoints/mod_portaudio endpoints/mod_sofia endpoints/mod_loopback -#endpoints/mod_wanpipe #endpoints/mod_woomera #endpoints/mod_alsa #../../libs/openzap/mod_openzap Modified: freeswitch/branches/mrene/conf/autoload_configs/modules.conf.xml ============================================================================== --- freeswitch/branches/mrene/conf/autoload_configs/modules.conf.xml (original) +++ freeswitch/branches/mrene/conf/autoload_configs/modules.conf.xml Wed Oct 15 15:18:32 2008 @@ -33,7 +33,6 @@ <!-- <load module="mod_alsa"/> --> <load module="mod_sofia"/> <load module="mod_loopback"/> - <!-- <load module="mod_wanpipe"/> --> <!-- <load module="mod_woomera"/> --> <!-- <load module="mod_openzap"/> --> Modified: freeswitch/branches/mrene/freeswitch.spec ============================================================================== --- freeswitch/branches/mrene/freeswitch.spec (original) +++ freeswitch/branches/mrene/freeswitch.spec Wed Oct 15 15:18:32 2008 @@ -165,7 +165,7 @@ LOGGERS_MODULES="loggers/mod_console loggers/mod_logfile loggers/mod_syslog" SAY_MODULES="say/mod_say_en" TIMERS_MODULES= -DISABLED_MODULES="applications/mod_soundtouch directories/mod_ldap languages/mod_java languages/mod_python languages/mod_spidermonkey_skel ast_tts/mod_cepstral asr_tts/mod_lumenvox endpoints/mod_wanpipe event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf formats/mod_shout say/mod_say_it say/mod_say_es say/mod_say_nl" +DISABLED_MODULES="applications/mod_soundtouch directories/mod_ldap languages/mod_java languages/mod_python languages/mod_spidermonkey_skel ast_tts/mod_cepstral asr_tts/mod_lumenvox event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf formats/mod_shout say/mod_say_it say/mod_say_es say/mod_say_nl" XML_INT_MODULES="xml_int/mod_xml_rpc xml_int/mod_xml_curl xml_int/mod_xml_cdr" MYMODULES="$PASSTHRU_CODEC_MODULES $SPIDERMONKEY_MODULES $APPLICATIONS_MODULES $ASR_TTS_MODULES $CODECS_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES $DOTNET_MODULES $ENDPOINTS_MODULES $EVENT_HANDLERS_MODULES $FORMATS_MODULES $LANGUAGES_MODULES $LOGGERS_MODULES $SAY_MODULES $TIMERS_MODULES $XML_INT_MODULES" @@ -329,7 +329,6 @@ %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/switch.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/syslog.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/voicemail.conf.xml -%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/wanpipe.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/woomera.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/xml_cdr.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/xml_curl.conf.xml @@ -403,7 +402,6 @@ %{prefix}/mod/ozmod_analog_em.so %{prefix}/mod/ozmod_isdn.so %{prefix}/mod/ozmod_ss7_boost.so -%{prefix}/mod/ozmod_wanpipe.so %{prefix}/mod/ozmod_zt.so %files codec-passthru-amr Modified: freeswitch/branches/mrene/src/include/switch_core.h ============================================================================== --- freeswitch/branches/mrene/src/include/switch_core.h (original) +++ freeswitch/branches/mrene/src/include/switch_core.h Wed Oct 15 15:18:32 2008 @@ -1132,6 +1132,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(_In_ switch_core_session_t *session, switch_codec_t *codec); SWITCH_DECLARE(void) switch_core_session_unset_read_codec(_In_ switch_core_session_t *session); +SWITCH_DECLARE(void) switch_core_session_unset_write_codec(_In_ switch_core_session_t *session); /*! \brief Retrieve the read codec from a given session Modified: freeswitch/branches/mrene/src/include/switch_utils.h ============================================================================== --- freeswitch/branches/mrene/src/include/switch_utils.h (original) +++ freeswitch/branches/mrene/src/include/switch_utils.h Wed Oct 15 15:18:32 2008 @@ -376,8 +376,8 @@ \param fname the function name to declare \param vname the name of the global pointer to modify with the new function */ -#define SWITCH_DECLARE_GLOBAL_STRING_FUNC(fname, vname) static void fname(char *string) { if (!string) return;\ - if (vname) {free(vname); vname = NULL;}vname = strdup(string);} static void fname(char *string) +#define SWITCH_DECLARE_GLOBAL_STRING_FUNC(fname, vname) static void fname(const char *string) { if (!string) return;\ + if (vname) {free(vname); vname = NULL;}vname = strdup(string);} static void fname(const char *string) /*! \brief Separate a string into an array based on a character delimeter Modified: freeswitch/branches/mrene/src/mod/applications/mod_commands/mod_commands.c ============================================================================== --- freeswitch/branches/mrene/src/mod/applications/mod_commands/mod_commands.c (original) +++ freeswitch/branches/mrene/src/mod/applications/mod_commands/mod_commands.c Wed Oct 15 15:18:32 2008 @@ -2811,7 +2811,7 @@ SWITCH_ADD_API(commands_api_interface, "url_encode", "url encode a string", url_encode_function, "<string>"); SWITCH_ADD_API(commands_api_interface, "url_decode", "url decode a string", url_decode_function, "<string>"); SWITCH_ADD_API(commands_api_interface, "module_exists", "check if module exists", module_exists_function, "<module>"); - SWITCH_ADD_API(commands_api_interface, "domain_exists", "check if a domain exists", domain_exists_function, "<module>"); + SWITCH_ADD_API(commands_api_interface, "domain_exists", "check if a domain exists", domain_exists_function, "<domain>"); SWITCH_ADD_API(commands_api_interface, "uuid_send_dtmf", "send dtmf digits", uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX); SWITCH_ADD_API(commands_api_interface, "eval", "eval (noop)", eval_function, "<expression>"); SWITCH_ADD_API(commands_api_interface, "system", "Execute a system command", system_function, SYSTEM_SYNTAX); Modified: freeswitch/branches/mrene/src/mod/applications/mod_conference/mod_conference.c ============================================================================== --- freeswitch/branches/mrene/src/mod/applications/mod_conference/mod_conference.c (original) +++ freeswitch/branches/mrene/src/mod/applications/mod_conference/mod_conference.c Wed Oct 15 15:18:32 2008 @@ -618,8 +618,8 @@ conference_member_say(member, msg, CONF_DEFAULT_LEADIN); } else if (conference->count == 1 && !conference->perpetual_sound) { if (conference->alone_sound) { - conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), - 0); + conference_stop_file(conference, FILE_STOP_ASYNC); + conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 1); } else { switch_snprintf(msg, sizeof(msg), "You are currently the only person in this conference."); conference_member_say(member, msg, CONF_DEFAULT_LEADIN); @@ -743,7 +743,8 @@ conference_play_file(conference, conference->exit_sound, 0, switch_core_session_get_channel(member->session), 0); } if (conference->count == 1 && conference->alone_sound) { - conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session), 0); + conference_stop_file(conference, FILE_STOP_ASYNC); + conference_play_file(conference, conference->alone_sound, 0, switch_core_session_get_channel(member->session), 1); } } @@ -3152,7 +3153,7 @@ static switch_status_t conf_api_sub_stop(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) { - uint8_t current = 0, all = 0; + uint8_t current = 0, all = 0, async = 0; switch_assert(conference != NULL); switch_assert(stream != NULL); @@ -3160,11 +3161,12 @@ if (argc > 2) { current = strcasecmp(argv[2], "current") ? 0 : 1; all = strcasecmp(argv[2], "all") ? 0 : 1; + async = strcasecmp(argv[2], "async") ? 0 : 1; } else { all = 1; } - if (!(current || all)) + if (!(current || all || async)) return SWITCH_STATUS_GENERR; if (argc == 4) { @@ -3172,13 +3174,13 @@ conference_member_t *member; if ((member = conference_member_get(conference, id))) { - uint32_t stopped = conference_member_stop_file(member, current ? FILE_STOP_CURRENT : FILE_STOP_ALL); + uint32_t stopped = conference_member_stop_file(member, async ? FILE_STOP_ASYNC : current ? FILE_STOP_CURRENT : FILE_STOP_ALL); stream->write_function(stream, "Stopped %u files.\n", stopped); } else { stream->write_function(stream, "Member: %u not found.\n", id); } } else { - uint32_t stopped = conference_stop_file(conference, current ? FILE_STOP_CURRENT : FILE_STOP_ALL); + uint32_t stopped = conference_stop_file(conference, async ? FILE_STOP_ASYNC : current ? FILE_STOP_CURRENT : FILE_STOP_ALL); stream->write_function(stream, "Stopped %u files.\n", stopped); } return SWITCH_STATUS_SUCCESS; @@ -3553,12 +3555,12 @@ "<confname> volume_in <member_id|all|last> [<newval>]"}, {"volume_out", (void_fn_t) &conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET, "<confname> volume_out <member_id|all|last> [<newval>]"}, - {"play", (void_fn_t) &conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [<member_id>]"}, + {"play", (void_fn_t) &conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [async|<member_id>]"}, {"say", (void_fn_t) &conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"}, {"saymember", (void_fn_t) &conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE, "<confname> saymember <member_id> <text>"}, {"stop", (void_fn_t) &conf_api_sub_stop, CONF_API_SUB_ARGS_SPLIT, - "<confname> stop <[current|all|last]> [<member_id>]"}, + "<confname> stop <[current|all|async|last]> [<member_id>]"}, {"dtmf", (void_fn_t) &conf_api_sub_dtmf, CONF_API_SUB_MEMBER_TARGET, "<confname> dtmf <[member_id|all|last]> <digits>"}, {"kick", (void_fn_t) &conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"}, @@ -4548,7 +4550,7 @@ conference_del_member(member.conference, &member); /* Put the original codec back */ - switch_core_session_set_read_codec(member.session, read_codec); + switch_core_session_set_read_codec(member.session, NULL); /* Clean Up. codec_done(X): is for error situations after the codecs were setup and done: is for situations before */ codec_done1: Modified: freeswitch/branches/mrene/src/mod/applications/mod_enum/mod_enum.c ============================================================================== --- freeswitch/branches/mrene/src/mod/applications/mod_enum/mod_enum.c (original) +++ freeswitch/branches/mrene/src/mod/applications/mod_enum/mod_enum.c Wed Oct 15 15:18:32 2008 @@ -121,8 +121,8 @@ if ((settings = switch_xml_child(cfg, "settings"))) { for (param = switch_xml_child(settings, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); + const char *var = switch_xml_attr_soft(param, "name"); + const char *val = switch_xml_attr_soft(param, "value"); if (!strcasecmp(var, "default-root")) { set_global_root(val); } else if (!strcasecmp(var, "auto-reload")) { Modified: freeswitch/branches/mrene/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/branches/mrene/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/branches/mrene/src/mod/endpoints/mod_sofia/sofia_reg.c Wed Oct 15 15:18:32 2008 @@ -1296,6 +1296,36 @@ switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_realm", realm); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_nonce", nonce); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_uri", uri); + + if (sip->sip_contact) { + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_contact_user", sip->sip_contact->m_url->url_user); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_contact_host", sip->sip_contact->m_url->url_host); + } + + if (sip->sip_to) { + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_to_user", sip->sip_to->a_url->url_user); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_to_host", sip->sip_to->a_url->url_host); + if (sip->sip_to->a_url->url_port) { + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_to_port", sip->sip_to->a_url->url_port); + } + } + + if (sip->sip_from) { + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_from_user", sip->sip_from->a_url->url_user); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_from_host", sip->sip_from->a_url->url_host); + if (sip->sip_from->a_url->url_port) { + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_from_port", sip->sip_from->a_url->url_port); + } + } + + if (sip->sip_request) { + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_request_user", sip->sip_request->rq_url->url_user); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_request_host", sip->sip_request->rq_url->url_host); + if (sip->sip_request->rq_url->url_port) { + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_request_port", sip->sip_request->rq_url->url_port); + } + } + if (qop) { switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_qop", qop); } Modified: freeswitch/branches/mrene/src/mod/formats/mod_shout/mod_shout.c ============================================================================== --- freeswitch/branches/mrene/src/mod/formats/mod_shout/mod_shout.c (original) +++ freeswitch/branches/mrene/src/mod/formats/mod_shout/mod_shout.c Wed Oct 15 15:18:32 2008 @@ -189,7 +189,6 @@ } if (context->mh) { - mpg123_close(context->mh); mpg123_delete(context->mh); } } @@ -456,7 +455,7 @@ goto error; } - mpg123_close(context->mh); + mpg123_delete(context->mh); context->mh = our_mpg123_new(NULL, NULL); mpg123_open_feed(context->mh); mpg123_param(context->mh, MPG123_FORCE_RATE, context->samplerate, 0); @@ -566,7 +565,8 @@ if (context->channels == 2) { int16_t l[4800] = { 0 }; int16_t r[4800] = { 0 }; - int i, j = 0; + int j = 0; + switch_size_t i; for (i = 0; i < audio_read / 4; i++) { l[i] = audio[j++]; @@ -844,7 +844,7 @@ *cur_sample = fseek(context->fp, *cur_sample, whence); } - mpg123_close(context->mh); + mpg123_delete(context->mh); context->mh = our_mpg123_new(NULL, NULL); mpg123_open_feed(context->mh); mpg123_param(context->mh, MPG123_FORCE_RATE, context->samplerate, 0); @@ -1432,7 +1432,7 @@ if (!strcmp(var, "decoder")) { switch_set_string(globals.decoder, val); } else if (!strcmp(var, "volume")) { - globals.vol = atof(val); + globals.vol = (float)atof(val); } else if (!strcmp(var, "outscale")) { int tmp = atoi(val); if (tmp > 0) { Modified: freeswitch/branches/mrene/src/mod/formats/mod_shout/mod_shout.vcproj ============================================================================== --- freeswitch/branches/mrene/src/mod/formats/mod_shout/mod_shout.vcproj (original) +++ freeswitch/branches/mrene/src/mod/formats/mod_shout/mod_shout.vcproj Wed Oct 15 15:18:32 2008 @@ -41,7 +41,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""../../../../libs/curl/include";"../../../../libs/lame-3.97/include";"..\..\..\..\libs\win32\libshout";"..\..\..\..\libs\libshout-2.2.2\include"" + AdditionalIncludeDirectories="../../../../libs/curl/include;"../../../../libs/lame-3.97/include";..\..\..\..\libs\win32\libshout;"..\..\..\..\libs\libshout-2.2.2\include";..\..\..\..\libs\mpg123\src;"$(ProjectDir)windows"" PreprocessorDefinitions="CURL_STATICLIB" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -116,7 +116,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""../../../../libs/curl/include";"../../../../libs/lame-3.97/include";"..\..\..\..\libs\win32\libshout";"..\..\..\..\libs\libshout-2.2.2\include"" + AdditionalIncludeDirectories="../../../../libs/curl/include;"../../../../libs/lame-3.97/include";..\..\..\..\libs\win32\libshout;"..\..\..\..\libs\libshout-2.2.2\include";..\..\..\..\libs\mpg123\src;"$(ProjectDir)windows"" PreprocessorDefinitions="CURL_STATICLIB" RuntimeLibrary="2" EnableFunctionLevelLinking="true" @@ -174,37 +174,9 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File - RelativePath=".\common.c" - > - </File> - <File - RelativePath=".\dct64_i386.c" - > - </File> - <File - RelativePath=".\decode_i386.c" - > - </File> - <File - RelativePath=".\decode_ntom.c" - > - </File> - <File - RelativePath=".\interface.c" - > - </File> - <File - RelativePath=".\layer3.c" - > - </File> - <File RelativePath=".\mod_shout.c" > </File> - <File - RelativePath=".\tabinit.c" - > - </File> </Filter> <Filter Name="Header Files" Modified: freeswitch/branches/mrene/src/mod/xml_int/mod_xml_ldap/mod_xml_ldapv2.c ============================================================================== --- freeswitch/branches/mrene/src/mod/xml_int/mod_xml_ldap/mod_xml_ldapv2.c (original) +++ freeswitch/branches/mrene/src/mod/xml_int/mod_xml_ldap/mod_xml_ldapv2.c Wed Oct 15 15:18:32 2008 @@ -7,6 +7,9 @@ #define PCACHE_TTL 300 #define NCACHE_TTL 900 +typedef struct xml_ldap_attribute xml_ldap_attribute_t; + + typedef enum { XML_LDAP_CONFIG = 0, XML_LDAP_DIRECTORY, @@ -20,12 +23,53 @@ xml_ldap_query_type_t bt; char *url; char *basedn; - char *h350base; char *binddn; char *bindpass; char *filter; + xml_ldap_attribute_t *attr_list; } xml_binding_t; +typedef enum exten_types { + LDAP_EXTEN_ID = 0, + LDAP_EXTEN_VM_MAILBOX, + LDAP_EXTEN_PASSWORD, + LDAP_EXTEN_VM_PASSWORD, + LDAP_EXTEN_VM_EMAILADDR, + LDAP_EXTEN_VM_EMAILMSG, + LDAP_EXTEN_VM_DELETE, + LDAP_EXTEN_VM_ATTACHAUDIO, + LDAP_EXTEN_NAME, + LDAP_EXTEN_LABEL, + LDAP_EXTEN_AREACODE, + LDAP_EXTEN_CID_EXTNAME, + LDAP_EXTEN_CID_EXTNUM, + LDAP_EXTEN_INTNAME, + LDAP_EXTEN_INTNUM, + LDAP_EXTEN_RECORD_CALLS, + LDAP_EXTEN_ACTIVE, + LDAP_EXTEN_CFWD_REWRITECID, + LDAP_EXTEN_CFWD_ACTIVE, + LDAP_EXTEN_CFWD_DEST, + LDAP_EXTEN_CFWD_BUSYACTIVE, + LDAP_EXTEN_CFWD_BUSYDEST, + LDAP_EXTEN_NOANSWERACTIVE, + LDAP_EXTEN_NOANSWERDEST, + LDAP_EXTEN_NOANSWERSECONDS, + LDAP_EXTEN_PROGRESSAUDIO, + LDAP_EXTEN_ALLOW_OUTOBUND, + LDAP_EXTEN_ALLOW_XFER, + LDAP_EXTEN_HOTLINE_ACTIVE, + LDAP_EXTEN_HOTLINE_DEST, + LDAP_EXTEN_CLASSOFSERVICE +} exten_type_t; + +struct xml_ldap_attribute { + exten_type_t type; + uint64_t len; + char *val; + xml_ldap_attribute_t *next; +}; + SWITCH_MODULE_LOAD_FUNCTION(mod_xml_ldap_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_ldap_shutdown); @@ -35,7 +79,7 @@ static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data); -static switch_status_t tryh350(switch_xml_t *, int *, LDAP *, char *, char *, char *); +static switch_status_t trydir(switch_xml_t *, int *, LDAP *, char *, char *, xml_binding_t *); static switch_status_t do_config(void); static switch_status_t trysearch( switch_xml_t *pxml, int *xoff, LDAP *ld, char *basedn, char *filter); void rec( switch_xml_t *, int*, LDAP *ld, char *); @@ -73,8 +117,9 @@ static switch_status_t do_config(void) { char *cf = "xml_ldap.conf"; - switch_xml_t cfg, xml, bindings_tag, binding_tag, param; + switch_xml_t cfg, xml, bindings_tag, binding_tag, param,tran; xml_binding_t *binding = NULL; + xml_ldap_attribute_t *attr_list = NULL; int x = 0; if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) { @@ -94,6 +139,7 @@ goto done; } memset(binding, 0, sizeof(*binding)); + binding->attr_list = attr_list; for (param = switch_xml_child(binding_tag, "param"); param; param = param->next) { @@ -108,7 +154,6 @@ binding->bt = XML_LDAP_CONFIG; } else if (!strncmp(binding->bindings, "directory",strlen(binding->bindings))) { binding->bt = XML_LDAP_DIRECTORY; - binding->h350base = strdup("dc=example"); } else if (!strncmp(binding->bindings, "dialplain",strlen(binding->bindings))) { binding->bt = XML_LDAP_DIALPLAN; } else if (!strncmp(binding->bindings, "phrases",strlen(binding->bindings))) { @@ -131,6 +176,79 @@ } + if ( binding && binding->bt == XML_LDAP_DIRECTORY ) { + attr_list = malloc(sizeof(*attr_list)); + attr_list = memset(attr_list,0,sizeof(*attr_list)); + binding->attr_list = attr_list; + + param = switch_xml_child(binding_tag, "trans"); + for ( tran = switch_xml_child(param, "tran"); tran; tran = tran->next) { + char *n = (char *) switch_xml_attr_soft(tran, "name"); + char *m = (char *) switch_xml_attr_soft(tran, "mapfrom"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, " adding map %s => %s\n", m , n); + if(!strncasecmp("id",n,strlen(n))) { + attr_list->type = LDAP_EXTEN_ID; + attr_list->len = strlen(m); + attr_list->val = strdup(m); + attr_list->next = malloc(sizeof(*attr_list)); + attr_list->next = memset(attr_list->next,0,sizeof(*attr_list)); + attr_list = attr_list->next; + } else if ( !strncasecmp("mailbox",n,strlen(n))) { + attr_list->type = LDAP_EXTEN_VM_MAILBOX; + attr_list->len = strlen(m); + attr_list->val = strdup(m); + attr_list->next = malloc(sizeof(*attr_list)); + attr_list->next = memset(attr_list->next,0,sizeof(*attr_list)); + attr_list = attr_list->next; + } else if ( !strncasecmp("password",n,strlen(n))) { + attr_list->type = LDAP_EXTEN_PASSWORD; + attr_list->len = strlen(m); + attr_list->val = strdup(m); + attr_list->next = malloc(sizeof(*attr_list)); + attr_list->next = memset(attr_list->next,0,sizeof(*attr_list)); + attr_list = attr_list->next; + } else if ( !strncasecmp("vm-password",n,strlen(n))) { + attr_list->type = LDAP_EXTEN_VM_PASSWORD; + attr_list->len = strlen(m); + attr_list->val = strdup(m); + attr_list->next = malloc(sizeof(*attr_list)); + attr_list->next = memset(attr_list->next,0,sizeof(*attr_list)); + attr_list = attr_list->next; + } else if ( !strncasecmp("email-addr",n,strlen(n))) { + attr_list->type = LDAP_EXTEN_VM_EMAILADDR; + attr_list->len = strlen(m); + attr_list->val = strdup(m); + attr_list->next = malloc(sizeof(*attr_list)); + attr_list->next = memset(attr_list->next,0,sizeof(*attr_list)); + attr_list = attr_list->next; + } else if ( !strncasecmp("vm-email-all-messages",n,strlen(n))) { + attr_list->type = LDAP_EXTEN_VM_EMAILMSG; + attr_list->len = strlen(m); + attr_list->val = strdup(m); + attr_list->next = malloc(sizeof(*attr_list)); + attr_list->next = memset(attr_list->next,0,sizeof(*attr_list)); + attr_list = attr_list->next; + } else if ( !strncasecmp("vm-delete-file",n,strlen(n))) { + attr_list->type = LDAP_EXTEN_VM_DELETE; + attr_list->len = strlen(m); + attr_list->val = strdup(m); + attr_list->next = malloc(sizeof(*attr_list)); + attr_list->next = memset(attr_list->next,0,sizeof(*attr_list)); + attr_list = attr_list->next; + } else if ( !strncasecmp("vm-attach-file",n,strlen(n))) { + attr_list->type = LDAP_EXTEN_VM_ATTACHAUDIO; + attr_list->len = strlen(m); + attr_list->val = strdup(m); + attr_list->next = malloc(sizeof(*attr_list)); + attr_list->next = memset(attr_list->next,0,sizeof(*attr_list)); + attr_list = attr_list->next; + } + + } + attr_list->next = NULL; + } + + if (!binding->basedn || !binding->filter || !binding->url) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You must define \"basedn\", and \"filter\" in mod_xml_ldap.conf.xml\n"); @@ -153,18 +271,22 @@ return SWITCH_STATUS_SUCCESS; } -static switch_status_t tryh350(switch_xml_t *pxml, int *xoff, LDAP *ld, char *basedn, char *dir_domain, char *dir_exten) { +static switch_status_t trydir(switch_xml_t *pxml, int *xoff, LDAP *ld, char *dir_domain, char *dir_exten, xml_binding_t *binding) { switch_status_t ret = SWITCH_STATUS_FALSE; int off = *xoff; char *key = NULL; + char *basedn = NULL, *filter = NULL; char **val = NULL; - char *filter = NULL; BerElement *ber = NULL; - switch_xml_t xml = *pxml, save; + switch_xml_t xml = *pxml, params = NULL, vars = NULL, cur = NULL; LDAPMessage *msg, *entry; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "trying h350search in base %s with filter SIPIdentityUserName=%s\n", basedn, dir_exten); + static char *fsattr[] = { "id" , "mailbox", "password", "vm-password", "email-addr", "vm-email-all-messages", "vm-delete-file", "vm-attach-file", NULL }; - filter = switch_mprintf("(SIPIdentityUserName=%s)",dir_exten); + basedn = switch_mprintf(binding->basedn,dir_domain); + filter = switch_mprintf(binding->filter,dir_exten); + xml_ldap_attribute_t *attr = NULL; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "searching in basedn %s with filter %s\n",basedn,filter ); if ( (ldap_search_s(ld, basedn, LDAP_SCOPE_SUB, filter, NULL, 0, &msg) != LDAP_SUCCESS) ) goto cleanup; @@ -177,18 +299,11 @@ switch_xml_set_attr_d(xml, "name", dir_domain); xml = switch_xml_add_child_d(xml, "user", off++); - switch_xml_set_attr_d(xml, "id", dir_exten); - switch_xml_set_attr_d(xml, "mailbox", dir_exten); - save = switch_xml_add_child_d(xml, "variables", off++); - xml = switch_xml_add_child_d(save, "variable", off++); - switch_xml_set_attr_d(xml, "name", "accountcode"); - switch_xml_set_attr_d(xml, "value", dir_exten); + vars = switch_xml_add_child_d(xml, "variables", off++); + params = switch_xml_add_child_d(xml, "params", off++); - xml = save; - save = switch_xml_add_child_d(xml, "params", off++); - xml = switch_xml_add_child_d(save, "param", off++); for ( entry = ldap_first_entry(ld, msg); entry != NULL; @@ -200,20 +315,30 @@ key != NULL; key = ldap_next_attribute(ld, entry, ber) ) { - if ( !strncasecmp(key,"SIPIdentityPassword",strlen(key)) ) { - val = ldap_get_values(ld,entry,key); - switch_xml_set_attr_d(xml, "name", "password"); - switch_xml_set_attr_d(xml, "value", val[0]); - xml = switch_xml_add_child_d(save, "param", off++); - switch_xml_set_attr_d(xml, "name", "vm-password"); - switch_xml_set_attr_d(xml, "value", val[0]); - ldap_memfree(key); - ldap_value_free(val); - } else { - ldap_memfree(key); - continue; + for( attr = binding->attr_list; attr ; attr = attr->next ) { + if ( strlen(key) == attr->len ) { + if ( !strncasecmp(attr->val,key,strlen(key)) ) { + val = ldap_get_values(ld,entry,key); + if ( ldap_count_values(val) == 1 ) { + if (attr->type < 2) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "setting %s = %s ", fsattr[attr->type], val[0]); + switch_xml_set_attr_d(xml,fsattr[attr->type],val[0]); + } else if ( attr->type < 8 ) { + cur = switch_xml_add_child_d(params,"param",0); + switch_xml_set_attr_d(cur,fsattr[attr->type],val[0]); + } else { + cur = switch_xml_add_child_d(vars,"variable",0); + switch_xml_set_attr_d(cur,fsattr[attr->type],val[0]); + } + } else { + /* multi val attrs */ + } + ldap_value_free(val); + continue; + } + } } - + ldap_memfree(key); } ber_free(ber,0); } @@ -226,7 +351,9 @@ cleanup: switch_safe_free(filter); - switch_safe_free(key); + switch_safe_free(basedn) + switch_safe_free(dir_exten); + switch_safe_free(dir_domain); return ret; } @@ -358,6 +485,7 @@ xml_binding_t *binding = (xml_binding_t *) user_data; switch_event_header_t *hi; + switch_status_t ret = SWITCH_STATUS_FALSE; int desired_version = LDAP_VERSION3; int auth_method = LDAP_AUTH_SIMPLE; @@ -373,6 +501,9 @@ int xoff = 0; + xml = switch_xml_new("document"); + switch_xml_set_attr_d(xml, "type", "freeswitch/xml"); + if (params) { if ((hi = params->headers)) { for (; hi; hi = hi->next) { @@ -396,23 +527,24 @@ } } } + + + + if( (ldap_initialize(&ld,binding->url)) != LDAP_SUCCESS ) goto cleanup; + if( (ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &desired_version)) != LDAP_SUCCESS ) goto cleanup; + if( (ldap_bind_s(ld, binding->binddn, binding->bindpass, auth_method)) != LDAP_SUCCESS ) goto cleanup; + switch (binding->bt) { case XML_LDAP_CONFIG: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "humm %s", binding->filter); + xml = switch_xml_add_child_d(xml, "section", xoff++); + switch_xml_set_attr_d(xml, "name", "configuration"); filter = switch_mprintf(binding->filter,key_name,key_value); basedn = switch_mprintf(binding->basedn,tag_name); + ret = trysearch(&xml,&xoff,ld, basedn, filter); break; case XML_LDAP_DIRECTORY: - if(!dir_exten) { - filter = switch_mprintf(binding->filter,"objectclass","*","(!(objectclass=fsuser))"); - basedn = switch_mprintf(binding->basedn,dir_domain); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting filter %s and basedn %s\n", filter, basedn); - } else { - filter = switch_mprintf(binding->filter,"id",dir_exten,"(objectclass=*)"); - basedn = switch_mprintf(binding->basedn,dir_domain); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting filter %s and basedn %s\n", filter, basedn); - } + ret = trydir(&xml,&xoff,ld,dir_domain,dir_exten, binding); break; case XML_LDAP_DIALPLAN: @@ -423,25 +555,19 @@ } - ldap_initialize(&ld,binding->url); - ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &desired_version); - ldap_bind_s(ld, binding->binddn, binding->bindpass, auth_method); - - xml = switch_xml_new("document"); - switch_xml_set_attr_d(xml, "type", "freeswitch/xml"); - - trysearch(&xml,&xoff,ld, basedn, filter); - if(binding->bt == XML_LDAP_DIRECTORY ) tryh350(&xml,&xoff,ld,binding->h350base, dir_domain, dir_exten); - + cleanup: ldap_unbind_s(ld); - - switch_xml_toxml_buf(xml,buf,0,0,1); printf("providing:\n%s\n", buf); switch_safe_free(buf); + + if(ret != SWITCH_STATUS_SUCCESS) { + switch_xml_free(xml); + return NULL; + } return xml; } Modified: freeswitch/branches/mrene/src/switch_core_codec.c ============================================================================== --- freeswitch/branches/mrene/src/switch_core_codec.c (original) +++ freeswitch/branches/mrene/src/switch_core_codec.c Wed Oct 15 15:18:32 2008 @@ -47,6 +47,11 @@ session->real_read_codec = session->read_codec = NULL; } +SWITCH_DECLARE(void) switch_core_session_unset_write_codec(switch_core_session_t *session) +{ + session->real_write_codec = session->write_codec = NULL; +} + SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_session_t *session, switch_codec_t *codec) { @@ -55,16 +60,24 @@ char tmp[30]; if (codec && !codec->implementation) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot set INITIALIZED codec!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot set UNINITIALIZED codec!\n"); return SWITCH_STATUS_FALSE; } if (!codec || codec == session->real_read_codec) { + if (session->real_read_codec) { - session->read_codec = session->real_read_codec; + if (session->real_read_codec->implementation) { + session->read_codec = session->real_read_codec; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "resetting to uninitilized codec, setting to NULL\n"); + session->read_codec = session->real_read_codec = NULL; + return SWITCH_STATUS_FALSE; + } } else { return SWITCH_STATUS_FALSE; } + } else if (codec) { if (session->read_codec != session->real_read_codec) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot double-set codec!\n"); Modified: freeswitch/branches/mrene/src/switch_core_io.c ============================================================================== --- freeswitch/branches/mrene/src/switch_core_io.c (original) +++ freeswitch/branches/mrene/src/switch_core_io.c Wed Oct 15 15:18:32 2008 @@ -180,7 +180,6 @@ if (!(session->read_codec && session->read_codec->implementation)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s has no read codec.\n", switch_channel_get_name(session->channel)); - abort(); return SWITCH_STATUS_FALSE; } Modified: freeswitch/branches/mrene/src/switch_ivr_originate.c ============================================================================== --- freeswitch/branches/mrene/src/switch_ivr_originate.c (original) +++ freeswitch/branches/mrene/src/switch_ivr_originate.c Wed Oct 15 15:18:32 2008 @@ -88,6 +88,14 @@ char buf[10] = SWITCH_BLANK_STRING; char *p, term; + if (collect->session) { + if (switch_core_session_read_lock(collect->session) != SWITCH_STATUS_SUCCESS) { + return NULL; + } + } else { + return NULL; + } + if (!strcasecmp(collect->key, "exec")) { char *data; const switch_application_interface_t *application_interface; @@ -147,7 +155,9 @@ } } } - wbreak: + wbreak: + + switch_core_session_rwunlock(collect->session); return NULL; } Modified: freeswitch/branches/mrene/src/switch_rtp.c ============================================================================== --- freeswitch/branches/mrene/src/switch_rtp.c (original) +++ freeswitch/branches/mrene/src/switch_rtp.c Wed Oct 15 15:18:32 2008 @@ -1606,6 +1606,7 @@ if (switch_queue_trypop(rtp_session->dtmf_data.dtmf_inqueue, &pop) == SWITCH_STATUS_SUCCESS) { _dtmf = (switch_dtmf_t *) pop; *dtmf = *_dtmf; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP RECV DTMF %c:%d\n", dtmf->digit, dtmf->duration); bytes++; } switch_mutex_unlock(rtp_session->dtmf_data.dtmf_mutex);
participants (1)
-
Freeswitch SVN