From buklov at freeswitch.org Mon Jun 1 01:41:52 2009 From: buklov at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 03:41:52 -0500 Subject: [Freeswitch-svn] [commit] r13524 - freeswitch/trunk/docs/phrase Message-ID: Author: buklov Date: Mon Jun 1 03:41:50 2009 New Revision: 13524 Log: fix Modified: freeswitch/trunk/docs/phrase/phrase_ru.xml Modified: freeswitch/trunk/docs/phrase/phrase_ru.xml ============================================================================== --- freeswitch/trunk/docs/phrase/phrase_ru.xml (original) +++ freeswitch/trunk/docs/phrase/phrase_ru.xml Mon Jun 1 03:41:50 2009 @@ -431,14 +431,14 @@ - - + + - - - + + + From anthm at freeswitch.org Mon Jun 1 05:45:57 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 07:45:57 -0500 Subject: [Freeswitch-svn] [commit] r13525 - freeswitch/trunk/src Message-ID: Author: anthm Date: Mon Jun 1 07:45:56 2009 New Revision: 13525 Log: extended data from hangup_complete event Modified: freeswitch/trunk/src/switch_channel.c Modified: freeswitch/trunk/src/switch_channel.c ============================================================================== --- freeswitch/trunk/src/switch_channel.c (original) +++ freeswitch/trunk/src/switch_channel.c Mon Jun 1 07:45:56 2009 @@ -1359,6 +1359,7 @@ event->event_id == SWITCH_EVENT_CHANNEL_PROGRESS || event->event_id == SWITCH_EVENT_CHANNEL_PROGRESS_MEDIA || event->event_id == SWITCH_EVENT_CHANNEL_HANGUP || + event->event_id == SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE || event->event_id == SWITCH_EVENT_REQUEST_PARAMS || event->event_id == SWITCH_EVENT_CHANNEL_DATA || event->event_id == SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE || From anthm at freeswitch.org Mon Jun 1 06:06:46 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 08:06:46 -0500 Subject: [Freeswitch-svn] [commit] r13526 - freeswitch/trunk/src/mod/applications/mod_conference Message-ID: Author: anthm Date: Mon Jun 1 08:06:45 2009 New Revision: 13526 Log: make endconf count cumulative Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original) +++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Mon Jun 1 08:06:45 2009 @@ -279,6 +279,7 @@ int video_running; uint32_t eflags; uint32_t verbose_events; + int end_count; } conference_obj_t; /* Relationship with another member */ @@ -609,6 +610,11 @@ if (!switch_test_flag(member, MFLAG_NOCHANNEL)) { conference->count++; + + if (switch_test_flag(member, MFLAG_ENDCONF)) { + if (conference->end_count++); + } + if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", conference->name); @@ -756,10 +762,6 @@ switch_core_speech_close(&member->lsh, &flags); } - if (switch_test_flag(member, MFLAG_ENDCONF)) { - switch_set_flag_locked(member->conference, CFLAG_DESTRUCT); - } - if (member == member->conference->floor_holder) { member->conference->floor_holder = NULL; } @@ -768,6 +770,14 @@ if (!switch_test_flag(member, MFLAG_NOCHANNEL)) { conference->count--; + + if (switch_test_flag(member, MFLAG_ENDCONF)) { + if (!--member->conference->end_count) { + switch_set_flag_locked(member->conference, CFLAG_DESTRUCT); + } + } + + if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", conference->name); From brian at freeswitch.org Mon Jun 1 06:45:51 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 08:45:51 -0500 Subject: [Freeswitch-svn] [commit] r13527 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Mon Jun 1 08:45:50 2009 New Revision: 13527 Log: sigh, guess we can only do this on snom and polycom right now to be safe Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Mon Jun 1 08:45:50 2009 @@ -179,16 +179,21 @@ { private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session); const char *callee_name = NULL, *callee_number = NULL; + const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent"); - if (!(callee_name = switch_channel_get_variable(tech_pvt->channel, "callee_id_name"))) { - callee_name = ""; - } + if (ua && switch_stristr("polycom", ua)) { + if (!(callee_name = switch_channel_get_variable(tech_pvt->channel, "callee_id_name"))) { + callee_name = ""; + } + + if (!(callee_number = switch_channel_get_variable(tech_pvt->channel, "callee_id_number"))) { + callee_number = tech_pvt->caller_profile->destination_number; + } - if (!(callee_number = switch_channel_get_variable(tech_pvt->channel, "callee_id_number"))) { - callee_number = tech_pvt->caller_profile->destination_number; + return switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>", callee_name, callee_number); } - return switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>", callee_name, callee_number); + return NULL; } /* map QSIG cause codes to SIP from RFC4497 section 8.4.1 */ @@ -1258,7 +1263,7 @@ if (ua && switch_stristr("snom", ua)) { snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number); nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END()); - } else { + } else if (ua && switch_stristr("polycom", ua)) { snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number); nua_update(tech_pvt->nh, TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)), @@ -1274,8 +1279,17 @@ sofia_glue_do_invite(session); if (!switch_strlen_zero(msg->string_arg)) { char message[256] = ""; - snprintf(message, sizeof(message), "From:\r\nTo: \"%s\"\r\n", msg->string_arg); - nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END()); + const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent"); + + if (ua && switch_stristr("snom", ua)) { + snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number); + nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END()); + } else if (ua && switch_stristr("polycom", ua)) { + snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number); + nua_update(tech_pvt->nh, + TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)), + TAG_END()); + } } } break; Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Mon Jun 1 08:45:50 2009 @@ -5072,7 +5072,7 @@ snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", acp->caller_id_name, acp->caller_id_number); } nua_info(b_tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END()); - } else { + } else if (ua && switch_stristr("polycom", ua)) { if (switch_strlen_zero(acp->caller_id_name)) { snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", acp->caller_id_number, acp->caller_id_number); } else { From brian at freeswitch.org Mon Jun 1 06:55:18 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 08:55:18 -0500 Subject: [Freeswitch-svn] [commit] r13528 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Mon Jun 1 08:55:17 2009 New Revision: 13528 Log: ok only do this is callee_id_name is set Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Mon Jun 1 08:55:17 2009 @@ -179,21 +179,15 @@ { private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session); const char *callee_name = NULL, *callee_number = NULL; - const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent"); - - if (ua && switch_stristr("polycom", ua)) { - if (!(callee_name = switch_channel_get_variable(tech_pvt->channel, "callee_id_name"))) { - callee_name = ""; - } + char *pai = NULL; + if ((callee_name = switch_channel_get_variable(tech_pvt->channel, "callee_id_name"))) { if (!(callee_number = switch_channel_get_variable(tech_pvt->channel, "callee_id_number"))) { callee_number = tech_pvt->caller_profile->destination_number; } - - return switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>", callee_name, callee_number); + pai = switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>", callee_name, callee_number); } - - return NULL; + return pai; } /* map QSIG cause codes to SIP from RFC4497 section 8.4.1 */ From intralanman at freeswitch.org Mon Jun 1 09:35:34 2009 From: intralanman at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 11:35:34 -0500 Subject: [Freeswitch-svn] [commit] r13529 - freeswitch/trunk/scripts/contrib/intralanman/C/lcr/sql Message-ID: Author: intralanman Date: Mon Jun 1 11:35:33 2009 New Revision: 13529 Log: bad rupa, no donutsvn diff scripts/contrib/intralanman/C/lcr/sql/mysql-5.0.sql :-P Modified: freeswitch/trunk/scripts/contrib/intralanman/C/lcr/sql/mysql-5.0.sql Modified: freeswitch/trunk/scripts/contrib/intralanman/C/lcr/sql/mysql-5.0.sql ============================================================================== --- freeswitch/trunk/scripts/contrib/intralanman/C/lcr/sql/mysql-5.0.sql (original) +++ freeswitch/trunk/scripts/contrib/intralanman/C/lcr/sql/mysql-5.0.sql Mon Jun 1 11:35:33 2009 @@ -34,7 +34,7 @@ `date_end` datetime NOT NULL DEFAULT '2030-12-31', `quality` float(10,6) NOT NULL, `reliability` float(10,6) NOT NULL, - `cid` varchar(32), NOT NULL DEFAULT '', + `cid` varchar(32) NOT NULL DEFAULT '', `enabled` boolean NOT NULL DEFAULT '1', PRIMARY KEY (`id`), KEY `carrier_id` (`carrier_id`), From anthm at freeswitch.org Mon Jun 1 10:45:37 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 12:45:37 -0500 Subject: [Freeswitch-svn] [commit] r13530 - freeswitch/trunk/src/mod/applications/mod_conference Message-ID: Author: anthm Date: Mon Jun 1 12:45:36 2009 New Revision: 13530 Log: fix regression MODAPP-284 Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original) +++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Mon Jun 1 12:45:36 2009 @@ -772,8 +772,8 @@ conference->count--; if (switch_test_flag(member, MFLAG_ENDCONF)) { - if (!--member->conference->end_count) { - switch_set_flag_locked(member->conference, CFLAG_DESTRUCT); + if (!--conference->end_count) { + switch_set_flag_locked(conference, CFLAG_DESTRUCT); } } From brian at freeswitch.org Mon Jun 1 11:24:54 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 13:24:54 -0500 Subject: [Freeswitch-svn] [commit] r13531 - freeswitch/trunk/src/mod/applications/mod_commands Message-ID: Author: brian Date: Mon Jun 1 13:24:54 2009 New Revision: 13531 Log: adding nat_map api Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original) +++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Mon Jun 1 13:24:54 2009 @@ -44,6 +44,53 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown); SWITCH_MODULE_DEFINITION(mod_commands, mod_commands_load, mod_commands_shutdown, NULL); +SWITCH_STANDARD_API(nat_map_function) +{ + int argc; + char *mydata = NULL, *argv[4]; + switch_nat_ip_proto_t proto = SWITCH_NAT_UDP; + + if (!cmd) { + goto error; + } + + mydata = strdup(cmd); + switch_assert(mydata); + + argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + + if (argc < 3) { + goto error; + } + + if (argv[2] && switch_stristr("tcp", argv[2])) { + proto = SWITCH_NAT_TCP; + } else if (argv[2] && switch_stristr("udp", argv[2])) { + proto = SWITCH_NAT_UDP; + } + + if (argv[0] && switch_stristr("add", argv[0])) { + if (switch_nat_add_mapping(atoi(argv[1]), proto) == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "true"); + goto ok; + } + } else if (argv[0] && switch_stristr("del", argv[0])) { + if (switch_nat_del_mapping(atoi(argv[1]), proto) == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "true"); + goto ok; + } + } + + error: + + stream->write_function(stream, "false"); + + ok: + + switch_safe_free(mydata); + + return SWITCH_STATUS_SUCCESS; +} SWITCH_STANDARD_API(time_test_function) { @@ -3483,6 +3530,7 @@ SWITCH_ADD_API(commands_api_interface, "stun", "stun", stun_function, "[:port]"); SWITCH_ADD_API(commands_api_interface, "system", "Execute a system command", system_function, SYSTEM_SYNTAX); SWITCH_ADD_API(commands_api_interface, "time_test", "time_test", time_test_function, ""); + SWITCH_ADD_API(commands_api_interface, "nat_map", "nat_map", nat_map_function, "[add|del] [tcp|udp]"); /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_NOUNLOAD; From brian at freeswitch.org Mon Jun 1 11:28:20 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 13:28:20 -0500 Subject: [Freeswitch-svn] [commit] r13532 - freeswitch/trunk/src Message-ID: Author: brian Date: Mon Jun 1 13:28:19 2009 New Revision: 13532 Log: moving init up so we have it in pre process vars Modified: freeswitch/trunk/src/switch_core.c Modified: freeswitch/trunk/src/switch_core.c ============================================================================== --- freeswitch/trunk/src/switch_core.c (original) +++ freeswitch/trunk/src/switch_core.c Mon Jun 1 13:28:19 2009 @@ -1128,8 +1128,6 @@ runtime.flags = flags; runtime.sps_total = 30; - - switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET); switch_core_set_variable("local_ip_v4", guess_ip); switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET6); @@ -1139,6 +1137,8 @@ switch_event_init(runtime.memory_pool); + switch_nat_init(runtime.memory_pool); + if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) { apr_terminate(); return SWITCH_STATUS_MEMERR; @@ -1161,7 +1161,6 @@ switch_scheduler_task_thread_start(); switch_rtp_init(runtime.memory_pool); - switch_nat_init(runtime.memory_pool); runtime.running = 1; From mikej at freeswitch.org Mon Jun 1 11:51:20 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 13:51:20 -0500 Subject: [Freeswitch-svn] [commit] r13533 - freeswitch/trunk/src/mod/applications/mod_commands Message-ID: Author: mikej Date: Mon Jun 1 13:51:19 2009 New Revision: 13533 Log: msvc build fix Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original) +++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Mon Jun 1 13:51:19 2009 @@ -70,12 +70,12 @@ } if (argv[0] && switch_stristr("add", argv[0])) { - if (switch_nat_add_mapping(atoi(argv[1]), proto) == SWITCH_STATUS_SUCCESS) { + if (switch_nat_add_mapping((switch_port_t)atoi(argv[1]), proto) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "true"); goto ok; } } else if (argv[0] && switch_stristr("del", argv[0])) { - if (switch_nat_del_mapping(atoi(argv[1]), proto) == SWITCH_STATUS_SUCCESS) { + if (switch_nat_del_mapping((switch_port_t)atoi(argv[1]), proto) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "true"); goto ok; } From mikej at freeswitch.org Mon Jun 1 12:03:26 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 14:03:26 -0500 Subject: [Freeswitch-svn] [commit] r13534 - in freeswitch/trunk/libs: libnatpmp miniupnpc Message-ID: Author: mikej Date: Mon Jun 1 14:03:26 2009 New Revision: 13534 Log: msvc build fixes for libnatpmp and miniupnpc Modified: freeswitch/trunk/libs/libnatpmp/getgateway.c freeswitch/trunk/libs/libnatpmp/getgateway.h freeswitch/trunk/libs/libnatpmp/natpmp.c freeswitch/trunk/libs/libnatpmp/natpmp.h freeswitch/trunk/libs/libnatpmp/wingettimeofday.c freeswitch/trunk/libs/miniupnpc/codelength.h freeswitch/trunk/libs/miniupnpc/minissdpc.c Modified: freeswitch/trunk/libs/libnatpmp/getgateway.c ============================================================================== --- freeswitch/trunk/libs/libnatpmp/getgateway.c (original) +++ freeswitch/trunk/libs/libnatpmp/getgateway.c Mon Jun 1 14:03:26 2009 @@ -18,7 +18,9 @@ #ifndef WIN32 #include #endif +#ifndef _MSC_VER #include +#endif /* There is no portable method to get the default route gateway. * So below are three differents functions implementing this. * Parsing /proc/net/route is for linux. @@ -271,10 +273,10 @@ DWORD numSubKeys = 0; TCHAR keyName[MAX_KEY_LENGTH]; DWORD keyNameLength = MAX_KEY_LENGTH; - TCHAR keyValue[MAX_VALUE_LENGTH]; + BYTE keyValue[MAX_VALUE_LENGTH]; DWORD keyValueLength = MAX_VALUE_LENGTH; DWORD keyValueType = REG_SZ; - TCHAR gatewayValue[MAX_VALUE_LENGTH]; + BYTE gatewayValue[MAX_VALUE_LENGTH]; DWORD gatewayValueLength = MAX_VALUE_LENGTH; DWORD gatewayValueType = REG_MULTI_SZ; int done = 0; @@ -369,7 +371,7 @@ { //printf("keyValue: %s\n", keyValue); - if(RegOpenKeyEx(interfacesKey, keyValue, 0, KEY_READ, &interfaceKey) == ERROR_SUCCESS) + if(RegOpenKeyEx(interfacesKey, (char *)keyValue, 0, KEY_READ, &interfaceKey) == ERROR_SUCCESS) { gatewayValueLength = MAX_VALUE_LENGTH; if(ERROR_SUCCESS == RegQueryValueEx(interfaceKey, // Open registry key @@ -413,7 +415,7 @@ if(done) { - *addr = inet_addr(gatewayValue); + *addr = inet_addr((char *)gatewayValue); return 0; } Modified: freeswitch/trunk/libs/libnatpmp/getgateway.h ============================================================================== --- freeswitch/trunk/libs/libnatpmp/getgateway.h (original) +++ freeswitch/trunk/libs/libnatpmp/getgateway.h Mon Jun 1 14:03:26 2009 @@ -17,7 +17,11 @@ #define __GETGATEWAY_H__ #ifdef WIN32 +#ifdef _MSC_VER +typedef unsigned __int32 uint32_t; +#else #include +#endif #define in_addr_t uint32_t #endif #include "declspec.h" Modified: freeswitch/trunk/libs/libnatpmp/natpmp.c ============================================================================== --- freeswitch/trunk/libs/libnatpmp/natpmp.c (original) +++ freeswitch/trunk/libs/libnatpmp/natpmp.c Mon Jun 1 14:03:26 2009 @@ -16,13 +16,28 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #include +#ifndef _MSC_VER #include +#endif #ifdef WIN32 #include #include #include #define EWOULDBLOCK WSAEWOULDBLOCK #define ECONNREFUSED WSAECONNREFUSED + +static int gettimeofday(struct timeval* p, void* tz /* IGNORED */) { + union { + long long ns100; /*time since 1 Jan 1601 in 100ns units */ + FILETIME ft; + } _now; + + GetSystemTimeAsFileTime( &(_now.ft) ); + p->tv_usec=(long)((_now.ns100 / 10LL) % 1000000LL ); + p->tv_sec= (long)((_now.ns100-(116444736000000000LL))/10000000LL); + return 0; +} + #else #include #include @@ -150,7 +165,7 @@ if(!p || (protocol!=NATPMP_PROTOCOL_TCP && protocol!=NATPMP_PROTOCOL_UDP)) return NATPMP_ERR_INVALIDARGS; p->pending_request[0] = 0; - p->pending_request[1] = protocol; + p->pending_request[1] = (char)protocol; p->pending_request[2] = 0; p->pending_request[3] = 0; *((uint16_t *)(p->pending_request + 4)) = htons(privateport); @@ -162,7 +177,7 @@ int readnatpmpresponse(natpmp_t * p, natpmpresp_t * response) { - unsigned char buf[16]; + char buf[16]; struct sockaddr_in addr; socklen_t addrlen = sizeof(addr); int n; Modified: freeswitch/trunk/libs/libnatpmp/natpmp.h ============================================================================== --- freeswitch/trunk/libs/libnatpmp/natpmp.h (original) +++ freeswitch/trunk/libs/libnatpmp/natpmp.h Mon Jun 1 14:03:26 2009 @@ -21,10 +21,17 @@ #define NATPMP_PORT (5351) #include +#ifndef _MSC_VER #include +#endif #ifdef WIN32 #include +#ifdef _MSC_VER +typedef unsigned __int32 uint32_t; +typedef unsigned __int16 uint16_t; +#else #include +#endif #define in_addr_t uint32_t #include "declspec.h" #else @@ -36,7 +43,7 @@ int s; /* socket */ in_addr_t gateway; /* default gateway (IPv4) */ int has_pending_request; - unsigned char pending_request[12]; + char pending_request[12]; int pending_request_len; int try_number; struct timeval retry_time; Modified: freeswitch/trunk/libs/libnatpmp/wingettimeofday.c ============================================================================== --- freeswitch/trunk/libs/libnatpmp/wingettimeofday.c (original) +++ freeswitch/trunk/libs/libnatpmp/wingettimeofday.c Mon Jun 1 14:03:26 2009 @@ -1,25 +0,0 @@ -#ifdef WIN32 -#include - -typedef struct _FILETIME { - unsigned long dwLowDateTime; - unsigned long dwHighDateTime; -} FILETIME; - -void __stdcall GetSystemTimeAsFileTime(FILETIME*); - -//void gettimeofday(struct timeval* p, void* tz /* IGNORED */); - -void gettimeofday(struct timeval* p, void* tz /* IGNORED */) { - union { - long long ns100; /*time since 1 Jan 1601 in 100ns units */ - FILETIME ft; - } _now; - - GetSystemTimeAsFileTime( &(_now.ft) ); - p->tv_usec=(long)((_now.ns100 / 10LL) % 1000000LL ); - p->tv_sec= (long)((_now.ns100-(116444736000000000LL))/10000000LL); - return; -} -#endif - Modified: freeswitch/trunk/libs/miniupnpc/codelength.h ============================================================================== --- freeswitch/trunk/libs/miniupnpc/codelength.h (original) +++ freeswitch/trunk/libs/miniupnpc/codelength.h Mon Jun 1 14:03:26 2009 @@ -14,11 +14,11 @@ do { n = (n << 7) | (*p & 0x7f); } \ while(*(p++)&0x80); -#define CODELENGTH(n, p) if(n>=268435456) *(p++) = (n >> 28) | 0x80; \ - if(n>=2097152) *(p++) = (n >> 21) | 0x80; \ - if(n>=16384) *(p++) = (n >> 14) | 0x80; \ - if(n>=128) *(p++) = (n >> 7) | 0x80; \ - *(p++) = n & 0x7f; +#define CODELENGTH(n, p) if(n>=268435456) *(p++) = (unsigned char)((n >> 28) | 0x80); \ + if(n>=2097152) *(p++) = (unsigned char)((n >> 21) | 0x80); \ + if(n>=16384) *(p++) = (unsigned char)((n >> 14) | 0x80); \ + if(n>=128) *(p++) = (unsigned char)((n >> 7) | 0x80); \ + *(p++) = (unsigned char)(n & 0x7f); #endif Modified: freeswitch/trunk/libs/miniupnpc/minissdpc.c ============================================================================== --- freeswitch/trunk/libs/miniupnpc/minissdpc.c (original) +++ freeswitch/trunk/libs/miniupnpc/minissdpc.c Mon Jun 1 14:03:26 2009 @@ -8,7 +8,15 @@ #include #include #include +#ifdef _MSC_VER +#include +typedef intptr_t ssize_t; +#define read _read +#define write _write +#define close _close +#else #include +#endif #include #ifdef WIN32 #include @@ -27,6 +35,10 @@ struct UPNPDev * getDevicesFromMiniSSDPD(const char * devtype, const char * socketpath) { +#ifdef _MSC_VER + /* sockaddr_un not supported on msvc*/ + return NULL; +#else struct UPNPDev * tmp; struct UPNPDev * devlist = NULL; unsigned char buffer[2048]; @@ -105,5 +117,6 @@ } close(s); return devlist; +#endif } From mikej at freeswitch.org Mon Jun 1 12:15:34 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 14:15:34 -0500 Subject: [Freeswitch-svn] [commit] r13535 - freeswitch/trunk/w32/Library Message-ID: Author: mikej Date: Mon Jun 1 14:15:34 2009 New Revision: 13535 Log: add upnp to windows build Modified: freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj freeswitch/trunk/w32/Library/FreeSwitchCore.vcproj Modified: freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj ============================================================================== --- freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj (original) +++ freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj Mon Jun 1 14:15:34 2009 @@ -48,7 +48,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -141,7 +141,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -233,7 +233,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;CRASH_PROT;PCRE_STATIC" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC" RuntimeLibrary="2" UsePrecompiledHeader="2" PrecompiledHeaderThrough="switch.h" @@ -322,7 +322,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;CRASH_PROT;PCRE_STATIC" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC" RuntimeLibrary="2" UsePrecompiledHeader="2" PrecompiledHeaderThrough="switch.h" @@ -743,6 +743,42 @@ > + + + + + + + + + + + + + + @@ -786,6 +822,516 @@ RelativePath="..\..\src\switch_xml_config.c" > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -508,6 +528,322 @@ RelativePath="..\..\src\switch_xml_config.c" > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Author: brian Date: Mon Jun 1 14:20:45 2009 New Revision: 13536 Log: tweak for linux Modified: freeswitch/trunk/libs/libnatpmp/natpmp.c Modified: freeswitch/trunk/libs/libnatpmp/natpmp.c ============================================================================== --- freeswitch/trunk/libs/libnatpmp/natpmp.c (original) +++ freeswitch/trunk/libs/libnatpmp/natpmp.c Mon Jun 1 14:20:45 2009 @@ -177,7 +177,7 @@ int readnatpmpresponse(natpmp_t * p, natpmpresp_t * response) { - char buf[16]; + unsigned char buf[16]; struct sockaddr_in addr; socklen_t addrlen = sizeof(addr); int n; From mikej at freeswitch.org Mon Jun 1 12:23:53 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 14:23:53 -0500 Subject: [Freeswitch-svn] [commit] r13537 - freeswitch/trunk/libs/libnatpmp Message-ID: Author: mikej Date: Mon Jun 1 14:23:53 2009 New Revision: 13537 Log: fix windows build a different way Modified: freeswitch/trunk/libs/libnatpmp/natpmp.c Modified: freeswitch/trunk/libs/libnatpmp/natpmp.c ============================================================================== --- freeswitch/trunk/libs/libnatpmp/natpmp.c (original) +++ freeswitch/trunk/libs/libnatpmp/natpmp.c Mon Jun 1 14:23:53 2009 @@ -183,7 +183,7 @@ int n; if(!p) return NATPMP_ERR_INVALIDARGS; - n = recvfrom(p->s, buf, sizeof(buf), 0, + n = recvfrom(p->s, (char *)buf, sizeof(buf), 0, (struct sockaddr *)&addr, &addrlen); if(n<0) switch(errno) { From mikej at freeswitch.org Mon Jun 1 14:29:58 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 16:29:58 -0500 Subject: [Freeswitch-svn] [commit] r13538 - freeswitch/trunk/w32/Library Message-ID: Author: mikej Date: Mon Jun 1 16:29:58 2009 New Revision: 13538 Log: build: fix msvc 64 bit build regression from upnp build (FSBUILD-167) Modified: freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj Modified: freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj ============================================================================== --- freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj (original) +++ freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj Mon Jun 1 16:29:58 2009 @@ -850,6 +850,7 @@ @@ -871,6 +872,7 @@ @@ -896,6 +898,7 @@ @@ -917,6 +920,7 @@ @@ -942,6 +946,7 @@ @@ -963,6 +968,7 @@ @@ -988,6 +994,7 @@ @@ -1009,6 +1016,7 @@ @@ -1034,6 +1042,7 @@ @@ -1055,6 +1064,7 @@ @@ -1080,6 +1090,7 @@ @@ -1101,6 +1112,7 @@ @@ -1126,6 +1138,7 @@ @@ -1147,6 +1160,7 @@ @@ -1172,6 +1186,7 @@ @@ -1193,6 +1208,7 @@ @@ -1218,6 +1234,7 @@ @@ -1239,6 +1256,7 @@ @@ -1266,6 +1284,7 @@ > @@ -1285,6 +1304,7 @@ > @@ -1308,6 +1328,7 @@ > @@ -1327,6 +1348,7 @@ > From mikej at freeswitch.org Mon Jun 1 15:49:19 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 17:49:19 -0500 Subject: [Freeswitch-svn] [commit] r13539 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nta Message-ID: Author: mikej Date: Mon Jun 1 17:49:18 2009 New Revision: 13539 Log: Thu May 14 13:01:25 CDT 2009 Pekka Pessi * nta.c: sanity checks for fork()ed cases Ignore-this: f384a65929393f36012f433292a73a91 Modified: freeswitch/trunk/libs/sofia-sip/.update freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c Modified: freeswitch/trunk/libs/sofia-sip/.update ============================================================================== --- freeswitch/trunk/libs/sofia-sip/.update (original) +++ freeswitch/trunk/libs/sofia-sip/.update Mon Jun 1 17:49:18 2009 @@ -1 +1 @@ -Tue May 26 17:22:34 CDT 2009 +Mon Jun 1 17:49:04 CDT 2009 Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c ============================================================================== --- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c (original) +++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c Mon Jun 1 17:49:18 2009 @@ -8881,11 +8881,7 @@ orq = original->orq_forks; original->orq_forks = orq->orq_forks; - //assert(orq->orq_forking == original); - - if (orq->orq_forking != original) { - break; - } + assert(orq->orq_forking == original); SU_DEBUG_5(("nta: timer %s fired, %s %s (%u);tag=%s\n", "D", "terminate", orq->orq_method_name, orq->orq_cseq->cs_seq, From mikej at freeswitch.org Mon Jun 1 15:50:03 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 17:50:03 -0500 Subject: [Freeswitch-svn] [commit] r13540 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/tport Message-ID: Author: mikej Date: Mon Jun 1 17:50:03 2009 New Revision: 13540 Log: Tue May 19 12:03:18 CDT 2009 Pekka Pessi * tport_tls.c: removed global tls_ex_data_idx, using static one Modified: freeswitch/trunk/libs/sofia-sip/.update freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c Modified: freeswitch/trunk/libs/sofia-sip/.update ============================================================================== --- freeswitch/trunk/libs/sofia-sip/.update (original) +++ freeswitch/trunk/libs/sofia-sip/.update Mon Jun 1 17:50:03 2009 @@ -1 +1 @@ -Mon Jun 1 17:49:04 CDT 2009 +Mon Jun 1 17:49:52 CDT 2009 Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c ============================================================================== --- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c (original) +++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c Mon Jun 1 17:50:03 2009 @@ -90,7 +90,7 @@ #include "tport_tls.h" char const tls_version[] = OPENSSL_VERSION_TEXT; -int tls_ex_data_idx = -1; /* see SSL_get_ex_new_index(3ssl) */ +static int tls_ex_data_idx = -1; /* see SSL_get_ex_new_index(3ssl) */ static void tls_init_once(void) From mikej at freeswitch.org Mon Jun 1 15:50:59 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 17:50:59 -0500 Subject: [Freeswitch-svn] [commit] r13541 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nta Message-ID: Author: mikej Date: Mon Jun 1 17:50:59 2009 New Revision: 13541 Log: Thu May 14 09:05:13 CDT 2009 Aleksander Morgado * extra_100 parameter at transaction level Modified: freeswitch/trunk/libs/sofia-sip/.update freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c Modified: freeswitch/trunk/libs/sofia-sip/.update ============================================================================== --- freeswitch/trunk/libs/sofia-sip/.update (original) +++ freeswitch/trunk/libs/sofia-sip/.update Mon Jun 1 17:50:59 2009 @@ -1 +1 @@ -Mon Jun 1 17:49:52 CDT 2009 +Mon Jun 1 17:50:41 CDT 2009 Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c ============================================================================== --- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c (original) +++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c Mon Jun 1 17:50:59 2009 @@ -440,6 +440,7 @@ unsigned irq_reliable_tp:1; /**< Transport is reliable */ unsigned irq_sigcomp_zap:1; /**< Reset SigComp */ unsigned irq_must_100rel:1; /**< 100rel is required */ + unsigned irq_extra_100:1; /**< 100 Trying should be sent */ unsigned irq_tag_set:1; /**< Tag is not from request */ unsigned :0; @@ -5274,6 +5275,7 @@ } irq->irq_branch = sip->sip_via->v_branch; irq->irq_reliable_tp = tport_is_reliable(tport); + irq->irq_extra_100 = 1; /* Sending extra 100 trying true by default */ if (sip->sip_timestamp) irq->irq_timestamp = sip_timestamp_copy(home, sip->sip_timestamp); @@ -6016,8 +6018,9 @@ sip->sip_request->rq_method_name, irq->irq_status)); incoming_retransmit_reply(irq, tport); } - else if (irq->irq_agent->sa_extra_100) { - /* Answer automatically with 100 Trying */ + else if (irq->irq_agent->sa_extra_100 && + irq->irq_extra_100) { + /* Agent and Irq configured to answer automatically with 100 Trying */ if (irq->irq_method == sip_method_invite || /* * Send 100 trying to non-invite if at least half of T2 has expired @@ -6184,11 +6187,11 @@ /**Set server transaction parameters. * - * Sets the server transaction parameters. The parameters determine the way + * Sets the server transaction parameters. Among others, parameters determine the way * the SigComp compression is handled. * * @TAGS - * NTATAG_COMP(), and NTATAG_SIGCOMP_CLOSE(). + * NTATAG_COMP(), NTATAG_SIGCOMP_CLOSE() and NTATAG_EXTRA_100(). * * @retval number of set parameters when succesful * @retval -1 upon an error @@ -6234,6 +6237,9 @@ else if (tptag_compartment == tt) cc = (void *)t->t_value, retval++; + + else if (ntatag_extra_100 == tt) + irq->irq_extra_100 = t->t_value != 0, retval++; } if (cc != NONE) { @@ -6848,9 +6854,16 @@ } else { /* Timer N1 */ - SU_DEBUG_5(("nta: timer N1 fired, sending %u %s\n", SIP_100_TRYING)); incoming_reset_timer(irq); - nta_incoming_treply(irq, SIP_100_TRYING, TAG_END()); + + if(irq->irq_extra_100) { + SU_DEBUG_5(("nta: timer N1 fired, sending %u %s\n", SIP_100_TRYING)); + nta_incoming_treply(irq, SIP_100_TRYING, TAG_END()); + } + else { + SU_DEBUG_5(("nta: timer N1 fired, but avoided sending %u %s\n", + SIP_100_TRYING)); + } } } Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c ============================================================================== --- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c (original) +++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c Mon Jun 1 17:50:59 2009 @@ -967,9 +967,17 @@ * to a request within half of the SIP T2 (the default value for T2 is 4000 * milliseconds, so the extra 100 Trying would be sent after 2 seconds). * + * At agent level, this option applies to retransmissions of both non-INVITE + * and INVITE transactions. + * + * At incoming request level, this option can disable sending the 100 Trying for + * both retransmissions (if set at agent level) and N1 firings, for just a given + * incoming request. + * * @par Used with * nua_create(), nua_set_params(), - * nta_agent_create(), nta_agent_set_params() + * nta_agent_create(), nta_agent_set_params(), + * nta_incoming_set_params() * * @par Parameter type * boolean: true (non-zero or non-NULL pointer) @@ -979,9 +987,12 @@ * - true - send extra 100 Trying if application does not respond * - false - do not send 100 Trying * - * @par Default Value + * @par Default Value at Agent level * - 0 (false, do not respond with 100 Trying to retransmissions) - + * + * @par Default Value at incoming transaction level + * - 1 (true, respond with 100 Trying to retransmissions and when N1 fired) + * * @sa @RFC4320, NTATAG_PASS_408(), NTATAG_TIMEOUT_408() */ tag_typedef_t ntatag_extra_100 = BOOLTAG_TYPEDEF(extra_100); From mikej at freeswitch.org Mon Jun 1 15:51:27 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 17:51:27 -0500 Subject: [Freeswitch-svn] [commit] r13542 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/nta Message-ID: Author: mikej Date: Mon Jun 1 17:51:27 2009 New Revision: 13542 Log: Thu May 14 13:05:11 CDT 2009 Pekka Pessi * nta_outgoing_tcreate(): log offending tag Modified: freeswitch/trunk/libs/sofia-sip/.update freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c Modified: freeswitch/trunk/libs/sofia-sip/.update ============================================================================== --- freeswitch/trunk/libs/sofia-sip/.update (original) +++ freeswitch/trunk/libs/sofia-sip/.update Mon Jun 1 17:51:27 2009 @@ -1 +1 @@ -Mon Jun 1 17:50:41 CDT 2009 +Mon Jun 1 17:51:14 CDT 2009 Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c ============================================================================== --- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c (original) +++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c Mon Jun 1 17:51:27 2009 @@ -7196,6 +7196,7 @@ sip_t *sip; nta_outgoing_t *orq = NULL; ta_list ta; + tagi_t const *tagi; if (leg == NULL) return NULL; @@ -7209,8 +7210,15 @@ ta_start(ta, tag, value); - if (sip_add_tl(msg, sip, ta_tags(ta)) < 0) - ; + tagi = ta_args(ta); + + if (sip_add_tagis(msg, sip, &tagi) < 0) { + if (tagi && tagi->t_tag) { + tag_type_t t = tagi->t_tag; + SU_DEBUG_5(("%s(): bad tag %s::%s\n", __func__, + t->tt_ns ? t->tt_ns : "", t->tt_name ? t->tt_name : "")); + } + } else if (route_url == NULL && leg->leg_route && leg->leg_loose_route && !(route_url = (url_string_t *)leg->leg_route->r_url)) From mrene at freeswitch.org Mon Jun 1 17:54:38 2009 From: mrene at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 19:54:38 -0500 Subject: [Freeswitch-svn] [commit] r13543 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: mrene Date: Mon Jun 1 19:54:38 2009 New Revision: 13543 Log: mod_sofia: Rewrite sofia_glue_get_user_host Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Mon Jun 1 19:54:38 2009 @@ -3961,20 +3961,30 @@ *user = NULL; *host = NULL; - if (!strncasecmp(u, "sip:", 4)) { - u += 4; - } - + /* First isolate the host part from the user part */ if ((h = strchr(u, '@'))) { *h++ = '\0'; } else { return 0; } - p = h + strlen(h) - 1; + /* Clean out the user part of its protocol prefix (if any) */ + if ((p = strchr(u, ':'))) { + *p++ = '\0'; + u = p; + } - if (p && (*p == ':' || *p == ';' || *p == ' ')) { - *p = '\0'; + /* Clean out the host part of any suffix */ + if ((p = strchr(h, ':'))) { + *p = 0; + } + + if ((p = strchr(h, ';'))) { + *p = 0; + } + + if ((p = strchr(h, ' '))) { + *p = 0; } *user = u; From mrene at freeswitch.org Mon Jun 1 17:56:14 2009 From: mrene at freeswitch.org (FreeSWITCH SVN) Date: Mon, 01 Jun 2009 19:56:14 -0500 Subject: [Freeswitch-svn] [commit] r13544 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: mrene Date: Mon Jun 1 19:56:14 2009 New Revision: 13544 Log: mod_sofia: its cuter that way Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Mon Jun 1 19:56:14 2009 @@ -3976,15 +3976,15 @@ /* Clean out the host part of any suffix */ if ((p = strchr(h, ':'))) { - *p = 0; + *p = '\0'; } if ((p = strchr(h, ';'))) { - *p = 0; + *p = '\0'; } if ((p = strchr(h, ' '))) { - *p = 0; + *p = '\0'; } *user = u; From mikej at freeswitch.org Tue Jun 2 07:42:16 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 09:42:16 -0500 Subject: [Freeswitch-svn] [commit] r13545 - in freeswitch/trunk/libs/spandsp/src: . spandsp Message-ID: Author: mikej Date: Tue Jun 2 09:42:16 2009 New Revision: 13545 Log: use __cdecl calling convention for callback functions Modified: freeswitch/trunk/libs/spandsp/src/fsk.c freeswitch/trunk/libs/spandsp/src/hdlc.c freeswitch/trunk/libs/spandsp/src/modem_connect_tones.c freeswitch/trunk/libs/spandsp/src/spandsp/fsk.h freeswitch/trunk/libs/spandsp/src/spandsp/hdlc.h freeswitch/trunk/libs/spandsp/src/spandsp/modem_connect_tones.h freeswitch/trunk/libs/spandsp/src/spandsp/tone_generate.h freeswitch/trunk/libs/spandsp/src/spandsp/v27ter_tx.h freeswitch/trunk/libs/spandsp/src/spandsp/v29tx.h freeswitch/trunk/libs/spandsp/src/tone_generate.c freeswitch/trunk/libs/spandsp/src/v27ter_tx.c freeswitch/trunk/libs/spandsp/src/v29tx.c Modified: freeswitch/trunk/libs/spandsp/src/fsk.c ============================================================================== --- freeswitch/trunk/libs/spandsp/src/fsk.c (original) +++ freeswitch/trunk/libs/spandsp/src/fsk.c Tue Jun 2 09:42:16 2009 @@ -169,7 +169,7 @@ } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) fsk_tx(fsk_tx_state_t *s, int16_t amp[], int len) +SPAN_DECLARE_NONSTD(int) fsk_tx(fsk_tx_state_t *s, int16_t amp[], int len) { int sample; int bit; Modified: freeswitch/trunk/libs/spandsp/src/hdlc.c ============================================================================== --- freeswitch/trunk/libs/spandsp/src/hdlc.c (original) +++ freeswitch/trunk/libs/spandsp/src/hdlc.c Tue Jun 2 09:42:16 2009 @@ -252,7 +252,7 @@ } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(void) hdlc_rx_put_bit(hdlc_rx_state_t *s, int new_bit) +SPAN_DECLARE_NONSTD(void) hdlc_rx_put_bit(hdlc_rx_state_t *s, int new_bit) { if (new_bit < 0) { @@ -545,7 +545,7 @@ } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) hdlc_tx_get_bit(hdlc_tx_state_t *s) +SPAN_DECLARE_NONSTD(int) hdlc_tx_get_bit(hdlc_tx_state_t *s) { int txbit; Modified: freeswitch/trunk/libs/spandsp/src/modem_connect_tones.c ============================================================================== --- freeswitch/trunk/libs/spandsp/src/modem_connect_tones.c (original) +++ freeswitch/trunk/libs/spandsp/src/modem_connect_tones.c Tue Jun 2 09:42:16 2009 @@ -87,7 +87,7 @@ } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *s, +SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *s, int16_t amp[], int len) { Modified: freeswitch/trunk/libs/spandsp/src/spandsp/fsk.h ============================================================================== --- freeswitch/trunk/libs/spandsp/src/spandsp/fsk.h (original) +++ freeswitch/trunk/libs/spandsp/src/spandsp/fsk.h Tue Jun 2 09:42:16 2009 @@ -175,7 +175,7 @@ \param len The number of samples to be generated. \return The number of samples actually generated. */ -SPAN_DECLARE(int) fsk_tx(fsk_tx_state_t *s, int16_t amp[], int len); +SPAN_DECLARE_NONSTD(int) fsk_tx(fsk_tx_state_t *s, int16_t amp[], int len); /*! Get the current received signal power. \param s The modem context. Modified: freeswitch/trunk/libs/spandsp/src/spandsp/hdlc.h ============================================================================== --- freeswitch/trunk/libs/spandsp/src/spandsp/hdlc.h (original) +++ freeswitch/trunk/libs/spandsp/src/spandsp/hdlc.h Tue Jun 2 09:42:16 2009 @@ -154,7 +154,7 @@ \param s A pointer to an HDLC receiver context. \param new_bit The bit. */ -SPAN_DECLARE(void) hdlc_rx_put_bit(hdlc_rx_state_t *s, int new_bit); +SPAN_DECLARE_NONSTD(void) hdlc_rx_put_bit(hdlc_rx_state_t *s, int new_bit); /*! \brief Put a byte of data to an HDLC receiver. \param s A pointer to an HDLC receiver context. @@ -228,7 +228,7 @@ \param s A pointer to an HDLC transmitter context. \return The next bit for transmission. */ -SPAN_DECLARE(int) hdlc_tx_get_bit(hdlc_tx_state_t *s); +SPAN_DECLARE_NONSTD(int) hdlc_tx_get_bit(hdlc_tx_state_t *s); /*! \brief Get the next byte for transmission. \param s A pointer to an HDLC transmitter context. Modified: freeswitch/trunk/libs/spandsp/src/spandsp/modem_connect_tones.h ============================================================================== --- freeswitch/trunk/libs/spandsp/src/spandsp/modem_connect_tones.h (original) +++ freeswitch/trunk/libs/spandsp/src/spandsp/modem_connect_tones.h Tue Jun 2 09:42:16 2009 @@ -125,7 +125,7 @@ \param len The number of samples to generate. \return The number of samples generated. */ -SPAN_DECLARE(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *s, +SPAN_DECLARE_NONSTD(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *s, int16_t amp[], int len); Modified: freeswitch/trunk/libs/spandsp/src/spandsp/tone_generate.h ============================================================================== --- freeswitch/trunk/libs/spandsp/src/spandsp/tone_generate.h (original) +++ freeswitch/trunk/libs/spandsp/src/spandsp/tone_generate.h Tue Jun 2 09:42:16 2009 @@ -88,7 +88,7 @@ int d4, int repeat); -SPAN_DECLARE(int) tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples); +SPAN_DECLARE_NONSTD(int) tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples); SPAN_DECLARE(tone_gen_state_t *) tone_gen_init(tone_gen_state_t *s, tone_gen_descriptor_t *t); Modified: freeswitch/trunk/libs/spandsp/src/spandsp/v27ter_tx.h ============================================================================== --- freeswitch/trunk/libs/spandsp/src/spandsp/v27ter_tx.h (original) +++ freeswitch/trunk/libs/spandsp/src/spandsp/v27ter_tx.h Tue Jun 2 09:42:16 2009 @@ -141,7 +141,7 @@ \param len The number of samples to be generated. \return The number of samples actually generated. */ -SPAN_DECLARE(int) v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len); +SPAN_DECLARE_NONSTD(int) v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len); #if defined(__cplusplus) } Modified: freeswitch/trunk/libs/spandsp/src/spandsp/v29tx.h ============================================================================== --- freeswitch/trunk/libs/spandsp/src/spandsp/v29tx.h (original) +++ freeswitch/trunk/libs/spandsp/src/spandsp/v29tx.h Tue Jun 2 09:42:16 2009 @@ -172,7 +172,7 @@ \param len The number of samples to be generated. \return The number of samples actually generated. */ -SPAN_DECLARE(int) v29_tx(v29_tx_state_t *s, int16_t amp[], int len); +SPAN_DECLARE_NONSTD(int) v29_tx(v29_tx_state_t *s, int16_t amp[], int len); #if defined(__cplusplus) } Modified: freeswitch/trunk/libs/spandsp/src/tone_generate.c ============================================================================== --- freeswitch/trunk/libs/spandsp/src/tone_generate.c (original) +++ freeswitch/trunk/libs/spandsp/src/tone_generate.c Tue Jun 2 09:42:16 2009 @@ -143,7 +143,7 @@ } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples) +SPAN_DECLARE_NONSTD(int) tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples) { int samples; int limit; Modified: freeswitch/trunk/libs/spandsp/src/v27ter_tx.c ============================================================================== --- freeswitch/trunk/libs/spandsp/src/v27ter_tx.c (original) +++ freeswitch/trunk/libs/spandsp/src/v27ter_tx.c Tue Jun 2 09:42:16 2009 @@ -244,7 +244,7 @@ } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len) +SPAN_DECLARE_NONSTD(int) v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len) { #if defined(SPANDSP_USE_FIXED_POINT) complexi_t x; Modified: freeswitch/trunk/libs/spandsp/src/v29tx.c ============================================================================== --- freeswitch/trunk/libs/spandsp/src/v29tx.c (original) +++ freeswitch/trunk/libs/spandsp/src/v29tx.c Tue Jun 2 09:42:16 2009 @@ -202,7 +202,7 @@ } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) v29_tx(v29_tx_state_t *s, int16_t amp[], int len) +SPAN_DECLARE_NONSTD(int) v29_tx(v29_tx_state_t *s, int16_t amp[], int len) { #if defined(SPANDSP_USE_FIXED_POINT) complexi_t x; From rupa at freeswitch.org Tue Jun 2 09:38:30 2009 From: rupa at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 11:38:30 -0500 Subject: [Freeswitch-svn] [commit] r13546 - freeswitch/trunk/src/mod/applications/mod_lcr Message-ID: Author: rupa Date: Tue Jun 2 11:38:29 2009 New Revision: 13546 Log: MODAPP-281 - add extra sip headers Modified: freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c Modified: freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c (original) +++ freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c Tue Jun 2 11:38:29 2009 @@ -132,6 +132,7 @@ switch_bool_t reorder_by_rate; switch_bool_t quote_in_list; + switch_bool_t info_in_headers; }; typedef struct profile_obj profile_t; @@ -219,7 +220,7 @@ return number; } -static char *get_bridge_data(switch_memory_pool_t *pool, char *dialed_number, char *caller_id, lcr_route cur_route) +static char *get_bridge_data(switch_memory_pool_t *pool, char *dialed_number, char *caller_id, lcr_route cur_route, profile_t *profile) { size_t lstrip; size_t tstrip; @@ -228,6 +229,7 @@ char *orig_destination_number = NULL; char *codec = NULL; char *cid = NULL; + char *header = NULL; orig_destination_number = destination_number = switch_core_strdup(pool, dialed_number); @@ -261,9 +263,16 @@ do_cid(pool, cur_route->cid, caller_id)); } - data = switch_core_sprintf(pool, "[lcr_carrier=%s,lcr_rate=%s%s%s]%s%s%s%s%s" + header = ""; + if (profile->info_in_headers) { + header = switch_core_sprintf(pool, ",sip_h_X-LCR-INFO=lcr_rate=%s;lcr_carrier=%s", + cur_route->rate_str, + cur_route->carrier_name); + } + + data = switch_core_sprintf(pool, "[lcr_carrier=%s,lcr_rate=%s%s%s%s]%s%s%s%s%s" , cur_route->carrier_name, cur_route->rate_str - , codec, cid + , codec, cid, header , cur_route->gw_prefix, cur_route->prefix , destination_number, cur_route->suffix, cur_route->gw_suffix); @@ -546,7 +555,7 @@ if (argc > LCR_CID_PLACE) { additional->cid = switch_core_strdup(pool, switch_str_nil(argv[LCR_CID_PLACE])); } - additional->dialstring = get_bridge_data(pool, cbt->lookup_number, cbt->cid, additional); + additional->dialstring = get_bridge_data(pool, cbt->lookup_number, cbt->cid, additional, cbt->profile); if (cbt->head == NULL) { key = switch_core_sprintf(pool, "%s:%s", additional->gw_prefix, additional->gw_suffix); @@ -783,6 +792,7 @@ switch_stream_handle_t *thisorder = NULL; char *reorder_by_rate = NULL; char *quote_in_list = NULL; + char *info_in_headers = NULL; char *id_s = NULL; char *custom_sql = NULL; int argc, x = 0; @@ -835,6 +845,8 @@ custom_sql = val; } else if (!strcasecmp(var, "reorder_by_rate") && !switch_strlen_zero(val)) { reorder_by_rate = val; + } else if (!strcasecmp(var, "info_in_headers") && !switch_strlen_zero(val)) { + info_in_headers = val; } else if (!strcasecmp(var, "quote_in_list") && !switch_strlen_zero(val)) { quote_in_list = val; } @@ -913,6 +925,10 @@ profile->reorder_by_rate = switch_true(reorder_by_rate); } + if (!switch_strlen_zero(info_in_headers)) { + profile->info_in_headers = switch_true(info_in_headers); + } + if (!switch_strlen_zero(quote_in_list)) { profile->quote_in_list = switch_true(quote_in_list); } @@ -1207,7 +1223,7 @@ current = cb_struct.head; while (current) { - dialstring = get_bridge_data(pool, cb_struct.lookup_number, cb_struct.cid, current); + dialstring = get_bridge_data(pool, cb_struct.lookup_number, cb_struct.cid, current, cb_struct.profile); stream->write_function(stream, " | %s", current->digit_str); str_repeat((maximum_lengths.digit_str - current->digit_len), " ", stream); @@ -1300,6 +1316,8 @@ } stream->write_function(stream, " Reorder rate:\t%s\n", profile->reorder_by_rate ? "enabled" : "disabled"); + stream->write_function(stream, " Info in headers:\t%s\n", + profile->info_in_headers ? "enabled" : "disabled"); stream->write_function(stream, " Quote IN() List:\t%s\n", profile->quote_in_list ? "enabled" : "disabled"); stream->write_function(stream, "\n"); From rupa at freeswitch.org Tue Jun 2 09:39:55 2009 From: rupa at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 11:39:55 -0500 Subject: [Freeswitch-svn] [commit] r13547 - freeswitch/trunk/src/mod/applications/mod_lcr Message-ID: Author: rupa Date: Tue Jun 2 11:39:54 2009 New Revision: 13547 Log: use origination_caller_id_number instead Modified: freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c Modified: freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c (original) +++ freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c Tue Jun 2 11:39:54 2009 @@ -259,7 +259,7 @@ cid = ""; if (!switch_strlen_zero(cur_route->cid)) { - cid = switch_core_sprintf(pool, ",effective_caller_id_number=%s", + cid = switch_core_sprintf(pool, ",origination_caller_id_number=%s", do_cid(pool, cur_route->cid, caller_id)); } From anthm at freeswitch.org Tue Jun 2 09:48:24 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 11:48:24 -0500 Subject: [Freeswitch-svn] [commit] r13548 - freeswitch/trunk/src/mod/xml_int/mod_xml_rpc Message-ID: Author: anthm Date: Tue Jun 2 11:48:24 2009 New Revision: 13548 Log: XML-2 Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c ============================================================================== --- freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c (original) +++ freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c Tue Jun 2 11:48:24 2009 @@ -217,7 +217,7 @@ } switch_event_destroy(¶ms); - box = switch_xml_attr_soft(x_user, "number-alias"); + box = switch_xml_attr(x_user, "number-alias"); if ((x_params = switch_xml_child(x_domain, "params"))) { From anthm at freeswitch.org Tue Jun 2 09:55:10 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 11:55:10 -0500 Subject: [Freeswitch-svn] [commit] r13549 - in freeswitch/trunk: conf/autoload_configs conf/jingle_profiles src src/include src/mod/applications/mod_commands src/mod/applications/mod_esf src/mod/endpoints/mod_alsa src/mod/endpoints/mod_dingaling src/mod/endpoints/mod_portaudio src/mod/endpoints/mod_sofia Message-ID: Author: anthm Date: Tue Jun 2 11:55:10 2009 New Revision: 13549 Log: add netmask detection for nat discovery work Modified: freeswitch/trunk/conf/autoload_configs/acl.conf.xml freeswitch/trunk/conf/jingle_profiles/client.xml freeswitch/trunk/conf/jingle_profiles/server.xml freeswitch/trunk/src/include/switch_types.h freeswitch/trunk/src/include/switch_utils.h freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c freeswitch/trunk/src/switch.c freeswitch/trunk/src/switch_core.c freeswitch/trunk/src/switch_event.c freeswitch/trunk/src/switch_nat.c freeswitch/trunk/src/switch_utils.c Modified: freeswitch/trunk/conf/autoload_configs/acl.conf.xml ============================================================================== --- freeswitch/trunk/conf/autoload_configs/acl.conf.xml (original) +++ freeswitch/trunk/conf/autoload_configs/acl.conf.xml Tue Jun 2 11:55:10 2009 @@ -1,26 +1,18 @@ + - - - - + Modified: freeswitch/trunk/conf/jingle_profiles/server.xml ============================================================================== --- freeswitch/trunk/conf/jingle_profiles/server.xml (original) +++ freeswitch/trunk/conf/jingle_profiles/server.xml Tue Jun 2 11:55:10 2009 @@ -16,6 +16,6 @@ - + Modified: freeswitch/trunk/src/include/switch_types.h ============================================================================== --- freeswitch/trunk/src/include/switch_types.h (original) +++ freeswitch/trunk/src/include/switch_types.h Tue Jun 2 11:55:10 2009 @@ -232,7 +232,8 @@ SCF_CRASH_PROT = (1 << 3), SCF_VG = (1 << 4), SCF_RESTART = (1 << 5), - SCF_SHUTDOWN_REQUESTED = (1 << 6) + SCF_SHUTDOWN_REQUESTED = (1 << 6), + SCF_USE_AUTO_NAT = (1 << 7) } switch_core_flag_enum_t; typedef uint32_t switch_core_flag_t; Modified: freeswitch/trunk/src/include/switch_utils.h ============================================================================== --- freeswitch/trunk/src/include/switch_utils.h (original) +++ freeswitch/trunk/src/include/switch_utils.h Tue Jun 2 11:55:10 2009 @@ -172,7 +172,7 @@ \return SWITCH_STATUS_SUCCESSS for success, otherwise failure */ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(_Out_opt_bytecapcount_(len) - char *buf, _In_ int len, _In_ int family); + char *buf, _In_ int len, _In_ int *mask, _In_ int family); /*! \brief find the char representation of an ip adress @@ -550,7 +550,7 @@ SWITCH_DECLARE(char *) switch_find_end_paren(const char *s, char open, char close); SWITCH_DECLARE(int) switch_parse_cidr(const char *string, uint32_t *ip, uint32_t *mask, uint32_t *bitp); -SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, switch_bool_t default_type, switch_memory_pool_t *pool); +SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, const char *name, switch_bool_t default_type, switch_memory_pool_t *pool); SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr_token(switch_network_list_t *list, const char *cidr_str, switch_bool_t ok, const char *token); #define switch_network_list_add_cidr(_list, _cidr_str, _ok) switch_network_list_add_cidr_token(_list, _cidr_str, _ok, NULL) Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original) +++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Tue Jun 2 11:55:10 2009 @@ -608,7 +608,7 @@ if (pip) { switch_copy_string(ip_buf, pip, sizeof(ip_buf)); } else { - switch_find_local_ip(ip_buf, sizeof(ip_buf), AF_INET); + switch_find_local_ip(ip_buf, sizeof(ip_buf), NULL, AF_INET); } switch_core_new_memory_pool(&pool); Modified: freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c (original) +++ freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c Tue Jun 2 11:55:10 2009 @@ -172,7 +172,7 @@ if ((var = switch_channel_get_variable(channel, "esf_broadcast_ip"))) { esf_broadcast_ip = switch_core_session_strdup(session, var); } else { - switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET); + switch_find_local_ip(guess_ip, sizeof(guess_ip), NULL, AF_INET); esf_broadcast_ip = guess_ip; } Modified: freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c Tue Jun 2 11:55:10 2009 @@ -1484,7 +1484,7 @@ tech_pvt->codec_ms = atoi(argv[5]); } - switch_find_local_ip(ip, sizeof(ip), AF_INET); + switch_find_local_ip(ip, sizeof(ip), NULL, AF_INET); if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session), NULL, Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Tue Jun 2 11:55:10 2009 @@ -2215,7 +2215,7 @@ memset(&globals, 0, sizeof(globals)); globals.running = 1; - switch_find_local_ip(globals.guess_ip, sizeof(globals.guess_ip), AF_INET); + switch_find_local_ip(globals.guess_ip, sizeof(globals.guess_ip), NULL, AF_INET); switch_core_hash_init(&globals.profile_hash, module_pool); Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Tue Jun 2 11:55:10 2009 @@ -1755,7 +1755,7 @@ tech_pvt->codec_ms = atoi(argv[5]); } - switch_find_local_ip(ip, sizeof(ip), AF_INET); + switch_find_local_ip(ip, sizeof(ip), NULL, AF_INET); if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session), NULL, dialplan, cid_name, cid_num, ip, NULL, NULL, NULL, modname, NULL, dest)) != 0) { Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Tue Jun 2 11:55:10 2009 @@ -3204,7 +3204,8 @@ mod_sofia_globals.pool = pool; switch_mutex_init(&mod_sofia_globals.mutex, SWITCH_MUTEX_NESTED, mod_sofia_globals.pool); - switch_find_local_ip(mod_sofia_globals.guess_ip, sizeof(mod_sofia_globals.guess_ip), AF_INET); + switch_find_local_ip(mod_sofia_globals.guess_ip, sizeof(mod_sofia_globals.guess_ip), &mod_sofia_globals.guess_mask, AF_INET); + switch_set_string(mod_sofia_globals.guess_mask_str, inet_ntoa(*(struct in_addr *)&mod_sofia_globals.guess_mask)); gethostname(mod_sofia_globals.hostname, sizeof(mod_sofia_globals.hostname)); Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Tue Jun 2 11:55:10 2009 @@ -268,6 +268,8 @@ switch_event_node_t *roster_node; switch_event_node_t *custom_node; switch_event_node_t *mwi_node; + int guess_mask; + char guess_mask_str[16]; int debug_presence; int auto_restart; }; Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Tue Jun 2 11:55:10 2009 @@ -627,7 +627,7 @@ switch_mutex_lock(profile->ireg_mutex); sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); - switch_find_local_ip(guess_ip4, sizeof(guess_ip4), AF_INET); + switch_find_local_ip(guess_ip4, sizeof(guess_ip4), NULL, AF_INET); sql = switch_mprintf("insert into sip_registrations " "(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires," "user_agent,server_user,server_host,profile_name,hostname,network_ip,network_port,sip_username,sip_realm) " Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Tue Jun 2 11:55:10 2009 @@ -1045,7 +1045,7 @@ switch_mutex_lock(profile->ireg_mutex); sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); - switch_find_local_ip(guess_ip4, sizeof(guess_ip4), AF_INET); + switch_find_local_ip(guess_ip4, sizeof(guess_ip4), NULL, AF_INET); sql = switch_mprintf("insert into sip_registrations " "(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires," "user_agent,server_user,server_host,profile_name,hostname,network_ip,network_port,sip_username,sip_realm) " Modified: freeswitch/trunk/src/switch.c ============================================================================== --- freeswitch/trunk/src/switch.c (original) +++ freeswitch/trunk/src/switch.c Tue Jun 2 11:55:10 2009 @@ -171,7 +171,7 @@ /* the main service entry point */ void WINAPI service_main(DWORD numArgs, char **args) { - switch_core_flag_t flags = SCF_USE_SQL; + switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT; const char *err = NULL; /* error value for return from freeswitch initialization */ /* we have to initialize the service-specific stuff */ memset(&status, 0, sizeof(SERVICE_STATUS)); @@ -274,7 +274,7 @@ int alt_dirs = 0; int known_opt; int high_prio = 0; - switch_core_flag_t flags = SCF_USE_SQL; + switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT; int ret = 0; switch_status_t destroy_status; switch_file_t *fd; @@ -306,6 +306,7 @@ "\t-hp -- enable high priority settings\n" "\t-vg -- run under valgrind\n" "\t-nosql -- disable internal sql scoreboard\n" + "\t-nonat -- disable auto nat detection\n" "\t-stop -- stop freeswitch\n" "\t-nc -- do not output to a console and background\n" "\t-c -- output to a console and stay in the foreground\n" @@ -463,6 +464,11 @@ known_opt++; } + if (argv[x] && !strcmp(argv[x], "-nonat")) { + flags &= ~SCF_USE_AUTO_NAT; + known_opt++; + } + if (argv[x] && !strcmp(argv[x], "-vg")) { flags |= SCF_VG; known_opt++; Modified: freeswitch/trunk/src/switch_core.c ============================================================================== --- freeswitch/trunk/src/switch_core.c (original) +++ freeswitch/trunk/src/switch_core.c Tue Jun 2 11:55:10 2009 @@ -95,9 +95,10 @@ char old_ip4[256] = ""; char old_ip6[256] = ""; int ok4 = 1, ok6 = 1; - - switch_find_local_ip(guess_ip4, sizeof(guess_ip4), AF_INET); - switch_find_local_ip(guess_ip6, sizeof(guess_ip6), AF_INET6); + int mask = 0; + + switch_find_local_ip(guess_ip4, sizeof(guess_ip4), &mask, AF_INET); + switch_find_local_ip(guess_ip6, sizeof(guess_ip6), NULL, AF_INET6); if (!*main_ip4) { switch_set_string(main_ip4, guess_ip4); @@ -106,6 +107,7 @@ switch_set_string(old_ip4, main_ip4); switch_set_string(main_ip4, guess_ip4); switch_core_set_variable("local_ip_v4", guess_ip4); + switch_core_set_variable("local_mask_v4", inet_ntoa(*(struct in_addr *)&mask)); } } @@ -861,9 +863,16 @@ SWITCH_DECLARE(void) switch_load_network_lists(switch_bool_t reload) { switch_xml_t xml = NULL, x_lists = NULL, x_list = NULL, x_node = NULL, cfg = NULL; - switch_network_list_t *list; - + switch_network_list_t *rfc_list, *list; + char guess_ip[16] = ""; + int mask = 0; + char guess_mask[16] = ""; + char *tmp_name; + int ip_tmp = 0; + switch_find_local_ip(guess_ip, sizeof(guess_ip), &mask, AF_INET); + switch_set_string(guess_mask, inet_ntoa(*(struct in_addr *)&mask)); + switch_mutex_lock(runtime.global_mutex); if (IP_LIST.hash) { @@ -878,6 +887,44 @@ switch_core_new_memory_pool(&IP_LIST.pool); switch_core_hash_init(&IP_LIST.hash, IP_LIST.pool); + + tmp_name = "rfc1918.auto"; + switch_network_list_create(&rfc_list, tmp_name, SWITCH_FALSE, IP_LIST.pool); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created ip list %s default (deny)\n", tmp_name); + switch_network_list_add_cidr(rfc_list, "10.0.0.0/8", SWITCH_TRUE); + switch_network_list_add_cidr(rfc_list, "172.16.0.0/12", SWITCH_TRUE); + switch_network_list_add_cidr(rfc_list, "192.168.0.0/16", SWITCH_TRUE); + switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list); + + tmp_name = "nat.auto"; + switch_network_list_create(&rfc_list, tmp_name, SWITCH_FALSE, IP_LIST.pool); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created ip list %s default (deny)\n", tmp_name); + switch_network_list_add_cidr(rfc_list, "10.0.0.0/8", SWITCH_TRUE); + switch_network_list_add_cidr(rfc_list, "172.16.0.0/12", SWITCH_TRUE); + switch_network_list_add_cidr(rfc_list, "192.168.0.0/16", SWITCH_TRUE); + switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list); + + tmp_name = "localnet.auto"; + switch_network_list_create(&list, tmp_name, SWITCH_FALSE, IP_LIST.pool); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created ip list %s default (deny)\n", tmp_name); + + if (switch_network_list_add_host_mask(list, guess_ip, guess_mask, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, + "Adding %s/%s (allow) to list %s\n", guess_ip, guess_mask, tmp_name); + } + switch_core_hash_insert(IP_LIST.hash, tmp_name, list); + + switch_inet_pton(AF_INET, guess_ip, &ip_tmp); + ip_tmp = htonl(ip_tmp); + tmp_name = "nat.auto"; + + if (switch_network_list_validate_ip_token(rfc_list, ip_tmp, NULL)) { + switch_network_list_add_host_mask(rfc_list, guess_ip, guess_mask, SWITCH_FALSE); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, + "Adding %s/%s (deny) to list %s\n", guess_ip, guess_mask, tmp_name); + } + + if ((xml = switch_xml_open_cfg("acl.conf", &cfg, NULL))) { if ((x_lists = switch_xml_child(cfg, "network-lists"))) { for (x_list = switch_xml_child(x_lists, "list"); x_list; x_list = x_list->next) { @@ -893,7 +940,7 @@ default_type = switch_true(dft); } - if (switch_network_list_create(&list, default_type, IP_LIST.pool) != SWITCH_STATUS_SUCCESS) { + if (switch_network_list_create(&list, name, default_type, IP_LIST.pool) != SWITCH_STATUS_SUCCESS) { abort(); } @@ -1075,6 +1122,7 @@ switch_uuid_t uuid; char guess_ip[256]; char *dir_path; + int mask = 0; memset(&runtime, 0, sizeof(runtime)); @@ -1128,16 +1176,21 @@ runtime.flags = flags; runtime.sps_total = 30; - switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET); + switch_find_local_ip(guess_ip, sizeof(guess_ip), &mask, AF_INET); switch_core_set_variable("local_ip_v4", guess_ip); - switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET6); + switch_core_set_variable("local_mask_v4", inet_ntoa(*(struct in_addr *)&mask)); + + + switch_find_local_ip(guess_ip, sizeof(guess_ip), NULL, AF_INET6); switch_core_set_variable("local_ip_v6", guess_ip); switch_core_set_variable("base_dir", SWITCH_GLOBAL_dirs.base_dir); switch_core_set_serial(); switch_event_init(runtime.memory_pool); - switch_nat_init(runtime.memory_pool); + if (switch_test_flag((&runtime), SCF_USE_AUTO_NAT)) { + switch_nat_init(runtime.memory_pool); + } if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) { apr_terminate(); @@ -1559,7 +1612,9 @@ switch_scheduler_task_thread_stop(); switch_rtp_shutdown(); - switch_nat_shutdown(); + if (switch_test_flag((&runtime), SCF_USE_AUTO_NAT)) { + switch_nat_shutdown(); + } switch_xml_destroy(); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Closing Event Engine.\n"); Modified: freeswitch/trunk/src/switch_event.c ============================================================================== --- freeswitch/trunk/src/switch_event.c (original) +++ freeswitch/trunk/src/switch_event.c Tue Jun 2 11:55:10 2009 @@ -574,8 +574,8 @@ switch_threadattr_create(&thd_attr, pool); gethostname(hostname, sizeof(hostname)); - switch_find_local_ip(guess_ip_v4, sizeof(guess_ip_v4), AF_INET); - switch_find_local_ip(guess_ip_v6, sizeof(guess_ip_v6), AF_INET6); + switch_find_local_ip(guess_ip_v4, sizeof(guess_ip_v4), NULL, AF_INET); + switch_find_local_ip(guess_ip_v6, sizeof(guess_ip_v6), NULL, AF_INET6); switch_queue_create(&EVENT_QUEUE[0], POOL_COUNT_MAX + 10, THRUNTIME_POOL); Modified: freeswitch/trunk/src/switch_nat.c ============================================================================== --- freeswitch/trunk/src/switch_nat.c (original) +++ freeswitch/trunk/src/switch_nat.c Tue Jun 2 11:55:10 2009 @@ -144,7 +144,7 @@ memset(&nat_globals, 0, sizeof(nat_globals)); nat_globals.pool = pool; - switch_find_local_ip(nat_globals.pvt_addr, sizeof(nat_globals.pvt_addr), AF_INET); + switch_find_local_ip(nat_globals.pvt_addr, sizeof(nat_globals.pvt_addr), NULL, AF_INET); init_pmp(); Modified: freeswitch/trunk/src/switch_utils.c ============================================================================== --- freeswitch/trunk/src/switch_utils.c (original) +++ freeswitch/trunk/src/switch_utils.c Tue Jun 2 11:55:10 2009 @@ -44,6 +44,7 @@ uint32_t bits; switch_bool_t ok; char *token; + char *str; struct switch_network_node *next; }; typedef struct switch_network_node switch_network_node_t; @@ -52,6 +53,7 @@ struct switch_network_node *node_head; switch_bool_t default_type; switch_memory_pool_t *pool; + char *name; }; #ifndef WIN32 @@ -119,7 +121,7 @@ return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, switch_bool_t default_type, switch_memory_pool_t *pool) +SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, const char *name, switch_bool_t default_type, switch_memory_pool_t *pool) { switch_network_list_t *new_list; @@ -130,6 +132,7 @@ new_list = switch_core_alloc(pool, sizeof(**list)); new_list->pool = pool; new_list->default_type = default_type; + new_list->name = switch_core_strdup(new_list->pool, name); *list = new_list; @@ -176,6 +179,7 @@ node->mask = mask; node->ok = ok; node->bits = bits; + node->str = switch_core_strdup(list->pool, cidr_str); if (!switch_strlen_zero(token)) { node->token = switch_core_strdup(list->pool, token); @@ -197,15 +201,16 @@ node = switch_core_alloc(list->pool, sizeof(*node)); - node->ip = ip; - node->mask = mask; + node->ip = ntohl(ip); + node->mask = ntohl(mask); node->ok = ok; /* http://graphics.stanford.edu/~seander/bithacks.html */ mask = mask - ((mask >> 1) & 0x55555555); mask = (mask & 0x33333333) + ((mask >> 2) & 0x33333333); node->bits = (((mask + (mask >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; - + node->str = switch_core_sprintf(list->pool, "%s:%s", host, mask_str); + node->next = list->node_head; list->node_head = node; @@ -735,7 +740,33 @@ return NULL; } -SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int family) +#ifndef WIN32 +#include + +static int get_netmask(struct sockaddr_in *me, int *mask) +{ + struct ifaddrs *ifaddrs, *i = NULL; + + if (getifaddrs(&ifaddrs) < 0) { + return -1; + } + + for(i = ifaddrs; i; i = i->ifa_next) { + struct sockaddr_in *s = (struct sockaddr_in *)i->ifa_addr; + struct sockaddr_in *m = (struct sockaddr_in *)i->ifa_netmask; + + if (s->sin_addr.s_addr == me->sin_addr.s_addr) { + *mask = m->sin_addr.s_addr; + return 0; + } + } + + + return -2; +} +#endif + +SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *mask, int family) { switch_status_t status = SWITCH_STATUS_FALSE; char *base; @@ -758,7 +789,6 @@ if (len < 16) { return status; } - switch (family) { case AF_INET: @@ -790,6 +820,10 @@ return status; } + if (mask) { + *mask = 0; // find the right one + } + closesocket(tmp_socket); freeaddrinfo(address_info); @@ -832,6 +866,10 @@ } switch_copy_string(buf, get_addr(abuf, sizeof(abuf), (struct sockaddr*)&iface_out, sizeof(iface_out)), len); + if (mask) { + get_netmask((struct sockaddr_in*)&iface_out, mask); + } + status = SWITCH_STATUS_SUCCESS; } break; From anthm at freeswitch.org Tue Jun 2 11:30:19 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 13:30:19 -0500 Subject: [Freeswitch-svn] [commit] r13550 - freeswitch/trunk/src Message-ID: Author: anthm Date: Tue Jun 2 13:30:18 2009 New Revision: 13550 Log: rupa said this segged Modified: freeswitch/trunk/src/switch_utils.c Modified: freeswitch/trunk/src/switch_utils.c ============================================================================== --- freeswitch/trunk/src/switch_utils.c (original) +++ freeswitch/trunk/src/switch_utils.c Tue Jun 2 13:30:18 2009 @@ -747,7 +747,7 @@ { struct ifaddrs *ifaddrs, *i = NULL; - if (getifaddrs(&ifaddrs) < 0) { + if (!me || getifaddrs(&ifaddrs) < 0) { return -1; } @@ -755,7 +755,7 @@ struct sockaddr_in *s = (struct sockaddr_in *)i->ifa_addr; struct sockaddr_in *m = (struct sockaddr_in *)i->ifa_netmask; - if (s->sin_addr.s_addr == me->sin_addr.s_addr) { + if (s && m && s->sin_addr.s_addr == me->sin_addr.s_addr) { *mask = m->sin_addr.s_addr; return 0; } From anthm at freeswitch.org Tue Jun 2 12:50:04 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 14:50:04 -0500 Subject: [Freeswitch-svn] [commit] r13551 - in freeswitch/trunk/src: . include mod/languages/mod_managed mod/languages/mod_managed/managed mod/languages/mod_perl Message-ID: Author: anthm Date: Tue Jun 2 14:50:04 2009 New Revision: 13551 Log: fix recursive file record during file playback issue IRC-00 Modified: freeswitch/trunk/src/include/switch_cpp.h freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp freeswitch/trunk/src/switch_cpp.cpp Modified: freeswitch/trunk/src/include/switch_cpp.h ============================================================================== --- freeswitch/trunk/src/include/switch_cpp.h (original) +++ freeswitch/trunk/src/include/switch_cpp.h Tue Jun 2 14:50:04 2009 @@ -203,7 +203,6 @@ char *xml_cdr_text; void store_file_handle(switch_file_handle_t *fh); void *on_hangup; // language specific callback function, cast as void * - switch_file_handle_t local_fh; switch_file_handle_t *fhp; char dtmf_buf[512]; Modified: freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx ============================================================================== --- freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx (original) +++ freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx Tue Jun 2 14:50:04 2009 @@ -5718,6 +5718,32 @@ } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_pool_set_data(void * jarg1, char * jarg2, void * jarg3) { + switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ; + char *arg2 = (char *) 0 ; + void *arg3 = (void *) 0 ; + + arg1 = (switch_memory_pool_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (void *)jarg3; + switch_core_memory_pool_set_data(arg1,(char const *)arg2,arg3); +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_memory_pool_get_data(void * jarg1, char * jarg2) { + void * jresult ; + switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ; + char *arg2 = (char *) 0 ; + void *result = 0 ; + + arg1 = (switch_memory_pool_t *)jarg1; + arg2 = (char *)jarg2; + result = (void *)switch_core_memory_pool_get_data(arg1,(char const *)arg2); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_run(void * jarg1) { switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -5968,6 +5994,14 @@ } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_reporting_state(void * jarg1) { + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + + arg1 = (switch_core_session_t *)jarg1; + switch_core_session_reporting_state(arg1); +} + + SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_count() { unsigned long jresult ; uint32_t result; @@ -6082,6 +6116,18 @@ } +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_force_locate(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_core_session_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_core_session_t *)switch_core_session_force_locate((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_variable(char * jarg1) { char * jresult ; char *arg1 = (char *) 0 ; @@ -6142,6 +6188,20 @@ } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_partner(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_core_session_t **arg2 = (switch_core_session_t **) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_core_session_t **)jarg2; + result = (switch_status_t)switch_core_session_get_partner(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_message_send(char * jarg1, void * jarg2) { int jresult ; char *arg1 = (char *) 0 ; @@ -8687,17 +8747,19 @@ } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_find_local_ip(char * jarg1, int jarg2, int jarg3) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_find_local_ip(char * jarg1, int jarg2, void * jarg3, int jarg4) { int jresult ; char *arg1 = (char *) 0 ; int arg2 ; - int arg3 ; + int *arg3 = (int *) 0 ; + int arg4 ; switch_status_t result; arg1 = (char *)jarg1; arg2 = (int)jarg2; - arg3 = (int)jarg3; - result = (switch_status_t)switch_find_local_ip(arg1,arg2,arg3); + arg3 = (int *)jarg3; + arg4 = (int)jarg4; + result = (switch_status_t)switch_find_local_ip(arg1,arg2,arg3,arg4); jresult = result; return jresult; } @@ -9029,7 +9091,7 @@ arg1 = (char *)jarg1; arg2 = (char *)jarg2; arg3 = (size_t)jarg3; - result = (switch_bool_t)switch_ast2regex(arg1,arg2,arg3); + result = (switch_bool_t)switch_ast2regex((char const *)arg1,arg2,arg3); jresult = result; return jresult; } @@ -9195,17 +9257,19 @@ } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_create(void * jarg1, int jarg2, void * jarg3) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_create(void * jarg1, char * jarg2, int jarg3, void * jarg4) { int jresult ; switch_network_list_t **arg1 = (switch_network_list_t **) 0 ; - switch_bool_t arg2 ; - switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_bool_t arg3 ; + switch_memory_pool_t *arg4 = (switch_memory_pool_t *) 0 ; switch_status_t result; arg1 = (switch_network_list_t **)jarg1; - arg2 = (switch_bool_t)jarg2; - arg3 = (switch_memory_pool_t *)jarg3; - result = (switch_status_t)switch_network_list_create(arg1,arg2,arg3); + arg2 = (char *)jarg2; + arg3 = (switch_bool_t)jarg3; + arg4 = (switch_memory_pool_t *)jarg4; + result = (switch_status_t)switch_network_list_create(arg1,(char const *)arg2,arg3,arg4); jresult = result; return jresult; } @@ -10587,6 +10651,29 @@ } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_extra_data_set(void * jarg1, void * jarg2) { + switch_frame *arg1 = (switch_frame *) 0 ; + void *arg2 = (void *) 0 ; + + arg1 = (switch_frame *)jarg1; + arg2 = (void *)jarg2; + if (arg1) (arg1)->extra_data = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_frame_extra_data_get(void * jarg1) { + void * jresult ; + switch_frame *arg1 = (switch_frame *) 0 ; + void *result = 0 ; + + arg1 = (switch_frame *)jarg1; + result = (void *) ((arg1)->extra_data); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_data_set(void * jarg1, void * jarg2) { switch_frame *arg1 = (switch_frame *) 0 ; void *arg2 = (void *) 0 ; @@ -18478,6 +18565,18 @@ } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_wait_for_state_timeout(void * jarg1, int jarg2, unsigned long jarg3) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_channel_state_t arg2 ; + uint32_t arg3 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_channel_state_t)jarg2; + arg3 = (uint32_t)jarg3; + switch_channel_wait_for_state_timeout(arg1,arg2,arg3); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_wait_for_flag(void * jarg1, int jarg2, int jarg3, unsigned long jarg4, void * jarg5) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -18933,6 +19032,20 @@ } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_flag_partner(void * jarg1, int jarg2) { + unsigned long jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_channel_flag_t arg2 ; + uint32_t result; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_channel_flag_t)jarg2; + result = (uint32_t)switch_channel_test_flag_partner(arg1,arg2); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_state_flag(void * jarg1, int jarg2) { switch_channel_t *arg1 = (switch_channel_t *) 0 ; switch_channel_flag_t arg2 ; @@ -24398,6 +24511,20 @@ } +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_str_dynamic(char * jarg1, int jarg2) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_bool_t arg2 ; + switch_xml_t result; + + arg1 = (char *)jarg1; + arg2 = (switch_bool_t)jarg2; + result = (switch_xml_t)switch_xml_parse_str_dynamic(arg1,arg2); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_str(char * jarg1, void * jarg2) { void * jresult ; char *arg1 = (char *) 0 ; Modified: freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs ============================================================================== --- freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs (original) +++ freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs Tue Jun 2 14:50:04 2009 @@ -1050,6 +1050,16 @@ return ret; } + public static void switch_core_memory_pool_set_data(SWIGTYPE_p_apr_pool_t pool, string key, SWIGTYPE_p_void data) { + freeswitchPINVOKE.switch_core_memory_pool_set_data(SWIGTYPE_p_apr_pool_t.getCPtr(pool), key, SWIGTYPE_p_void.getCPtr(data)); + } + + public static SWIGTYPE_p_void switch_core_memory_pool_get_data(SWIGTYPE_p_apr_pool_t pool, string key) { + IntPtr cPtr = freeswitchPINVOKE.switch_core_memory_pool_get_data(SWIGTYPE_p_apr_pool_t.getCPtr(pool), key); + SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false); + return ret; + } + public static void switch_core_session_run(SWIGTYPE_p_switch_core_session session) { freeswitchPINVOKE.switch_core_session_run(SWIGTYPE_p_switch_core_session.getCPtr(session)); } @@ -1130,6 +1140,10 @@ freeswitchPINVOKE.switch_core_session_destroy_state(SWIGTYPE_p_switch_core_session.getCPtr(session)); } + public static void switch_core_session_reporting_state(SWIGTYPE_p_switch_core_session session) { + freeswitchPINVOKE.switch_core_session_reporting_state(SWIGTYPE_p_switch_core_session.getCPtr(session)); + } + public static uint switch_core_session_count() { uint ret = freeswitchPINVOKE.switch_core_session_count(); return ret; @@ -1182,6 +1196,12 @@ return ret; } + public static SWIGTYPE_p_switch_core_session switch_core_session_force_locate(string uuid_str) { + IntPtr cPtr = freeswitchPINVOKE.switch_core_session_force_locate(uuid_str); + SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false); + return ret; + } + public static string switch_core_get_variable(string varname) { string ret = freeswitchPINVOKE.switch_core_get_variable(varname); return ret; @@ -1207,6 +1227,11 @@ freeswitchPINVOKE.switch_core_session_hupall_endpoint(switch_endpoint_interface.getCPtr(endpoint_interface), (int)cause); } + public static switch_status_t switch_core_session_get_partner(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session partner) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_partner(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session.getCPtr(partner)); + return ret; + } + public static switch_status_t switch_core_session_message_send(string uuid_str, switch_core_session_message message) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_message_send(uuid_str, switch_core_session_message.getCPtr(message)); return ret; @@ -2102,8 +2127,8 @@ return ret; } - public static switch_status_t switch_find_local_ip(string buf, int len, int family) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_find_local_ip(buf, len, family); + public static switch_status_t switch_find_local_ip(string buf, int len, SWIGTYPE_p_int mask, int family) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_find_local_ip(buf, len, SWIGTYPE_p_int.getCPtr(mask), family); return ret; } @@ -2274,8 +2299,8 @@ return ret; } - public static switch_status_t switch_network_list_create(SWIGTYPE_p_p_switch_network_list list, switch_bool_t default_type, SWIGTYPE_p_apr_pool_t pool) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_network_list_create(SWIGTYPE_p_p_switch_network_list.getCPtr(list), (int)default_type, SWIGTYPE_p_apr_pool_t.getCPtr(pool)); + public static switch_status_t switch_network_list_create(SWIGTYPE_p_p_switch_network_list list, string name, switch_bool_t default_type, SWIGTYPE_p_apr_pool_t pool) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_network_list_create(SWIGTYPE_p_p_switch_network_list.getCPtr(list), name, (int)default_type, SWIGTYPE_p_apr_pool_t.getCPtr(pool)); return ret; } @@ -2355,6 +2380,10 @@ freeswitchPINVOKE.switch_channel_wait_for_state(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_channel.getCPtr(other_channel), (int)want_state); } + public static void switch_channel_wait_for_state_timeout(SWIGTYPE_p_switch_channel other_channel, switch_channel_state_t want_state, uint timeout) { + freeswitchPINVOKE.switch_channel_wait_for_state_timeout(SWIGTYPE_p_switch_channel.getCPtr(other_channel), (int)want_state, timeout); + } + public static switch_status_t switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t want_flag, switch_bool_t pres, uint to, SWIGTYPE_p_switch_channel super_channel) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)want_flag, (int)pres, to, SWIGTYPE_p_switch_channel.getCPtr(super_channel)); return ret; @@ -2523,6 +2552,11 @@ return ret; } + public static uint switch_channel_test_flag_partner(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) { + uint ret = freeswitchPINVOKE.switch_channel_test_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag); + return ret; + } + public static void switch_channel_set_state_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) { freeswitchPINVOKE.switch_channel_set_state_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag); } @@ -3706,6 +3740,12 @@ return ret; } + public static switch_xml switch_xml_parse_str_dynamic(string s, switch_bool_t dup) { + IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_str_dynamic(s, (int)dup); + switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false); + return ret; + } + public static switch_xml switch_xml_parse_str(string s, SWIGTYPE_p_switch_size_t len) { IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_str(s, SWIGTYPE_p_switch_size_t.getCPtr(len)); switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false); @@ -5850,6 +5890,12 @@ [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_destroy_memory_pool")] public static extern int switch_core_perform_destroy_memory_pool(HandleRef jarg1, string jarg2, string jarg3, int jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_pool_set_data")] + public static extern void switch_core_memory_pool_set_data(HandleRef jarg1, string jarg2, HandleRef jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_pool_get_data")] + public static extern IntPtr switch_core_memory_pool_get_data(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_run")] public static extern void switch_core_session_run(HandleRef jarg1); @@ -5895,6 +5941,9 @@ [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_destroy_state")] public static extern void switch_core_session_destroy_state(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_reporting_state")] + public static extern void switch_core_session_reporting_state(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_count")] public static extern uint switch_core_session_count(); @@ -5925,6 +5974,9 @@ [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_locate")] public static extern IntPtr switch_core_session_locate(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_force_locate")] + public static extern IntPtr switch_core_session_force_locate(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_variable")] public static extern string switch_core_get_variable(string jarg1); @@ -5943,6 +5995,9 @@ [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_hupall_endpoint")] public static extern void switch_core_session_hupall_endpoint(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_partner")] + public static extern int switch_core_session_get_partner(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_send")] public static extern int switch_core_session_message_send(string jarg1, HandleRef jarg2); @@ -6493,7 +6548,7 @@ public static extern int switch_frame_free(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_find_local_ip")] - public static extern int switch_find_local_ip(string jarg1, int jarg2, int jarg3); + public static extern int switch_find_local_ip(string jarg1, int jarg2, HandleRef jarg3, int jarg4); [DllImport("mod_managed", EntryPoint="CSharp_get_addr")] public static extern string get_addr(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4); @@ -6595,7 +6650,7 @@ public static extern int switch_parse_cidr(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_create")] - public static extern int switch_network_list_create(HandleRef jarg1, int jarg2, HandleRef jarg3); + public static extern int switch_network_list_create(HandleRef jarg1, string jarg2, int jarg3, HandleRef jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_add_cidr_token")] public static extern int switch_network_list_add_cidr_token(HandleRef jarg1, string jarg2, int jarg3, string jarg4); @@ -6912,6 +6967,12 @@ [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_packetlen_get")] public static extern uint switch_frame_packetlen_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_extra_data_set")] + public static extern void switch_frame_extra_data_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_extra_data_get")] + public static extern IntPtr switch_frame_extra_data_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_data_set")] public static extern void switch_frame_data_set(HandleRef jarg1, HandleRef jarg2); @@ -8910,6 +8971,9 @@ [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_wait_for_state")] public static extern void switch_channel_wait_for_state(HandleRef jarg1, HandleRef jarg2, int jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_wait_for_state_timeout")] + public static extern void switch_channel_wait_for_state_timeout(HandleRef jarg1, int jarg2, uint jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_wait_for_flag")] public static extern int switch_channel_wait_for_flag(HandleRef jarg1, int jarg2, int jarg3, uint jarg4, HandleRef jarg5); @@ -9012,6 +9076,9 @@ [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_flag_partner")] public static extern int switch_channel_clear_flag_partner(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_flag_partner")] + public static extern uint switch_channel_test_flag_partner(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_state_flag")] public static extern void switch_channel_set_state_flag(HandleRef jarg1, int jarg2); @@ -10185,6 +10252,9 @@ [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_xml")] public static extern void delete_switch_xml(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_str_dynamic")] + public static extern IntPtr switch_xml_parse_str_dynamic(string jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_str")] public static extern IntPtr switch_xml_parse_str(string jarg1, HandleRef jarg2); @@ -17542,6 +17612,10 @@ CF_PAUSE_BUGS, CF_DIVERT_EVENTS, CF_BLOCK_STATE, + CF_FS_RTP, + CF_REPORTING, + CF_PARK, + CF_TIMESTAMP_SET, CF_FLAG_MAX } @@ -18779,7 +18853,8 @@ SCF_CRASH_PROT = (1 << 3), SCF_VG = (1 << 4), SCF_RESTART = (1 << 5), - SCF_SHUTDOWN_REQUESTED = (1 << 6) + SCF_SHUTDOWN_REQUESTED = (1 << 6), + SCF_USE_AUTO_NAT = (1 << 7) } } @@ -20324,6 +20399,7 @@ SWITCH_EVENT_CHANNEL_STATE, SWITCH_EVENT_CHANNEL_ANSWER, SWITCH_EVENT_CHANNEL_HANGUP, + SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE, SWITCH_EVENT_CHANNEL_EXECUTE, SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE, SWITCH_EVENT_CHANNEL_BRIDGE, @@ -20382,6 +20458,7 @@ SWITCH_EVENT_SERVER_DISCONNECTED, SWITCH_EVENT_SEND_INFO, SWITCH_EVENT_RECV_INFO, + SWITCH_EVENT_CALL_SECURE, SWITCH_EVENT_ALL } @@ -21123,6 +21200,17 @@ } } + public SWIGTYPE_p_void extra_data { + set { + freeswitchPINVOKE.switch_frame_extra_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_frame_extra_data_get(swigCPtr); + SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false); + return ret; + } + } + public SWIGTYPE_p_void data { set { freeswitchPINVOKE.switch_frame_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value)); @@ -21260,7 +21348,8 @@ SFF_PLC = (1 << 3), SFF_RFC2833 = (1 << 4), SFF_PROXY_PACKET = (1 << 5), - SFF_DYNAMIC = (1 << 6) + SFF_DYNAMIC = (1 << 6), + SFF_ZRTP = (1 << 7) } } @@ -23391,7 +23480,11 @@ SWITCH_RTP_FLAG_SHUTDOWN = (1 << 19), SWITCH_RTP_FLAG_FLUSH = (1 << 20), SWITCH_RTP_FLAG_AUTOFLUSH = (1 << 21), - SWITCH_RTP_FLAG_STICKY_FLUSH = (1 << 22) + SWITCH_RTP_FLAG_STICKY_FLUSH = (1 << 22), + SWITCH_ZRTP_FLAG_SECURE_SEND = (1 << 23), + SWITCH_ZRTP_FLAG_SECURE_RECV = (1 << 24), + SWITCH_ZRTP_FLAG_SECURE_MITM_SEND = (1 << 25), + SWITCH_ZRTP_FLAG_SECURE_MITM_RECV = (1 << 26) } } Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp ============================================================================== --- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp (original) +++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp Tue Jun 2 14:50:04 2009 @@ -11562,17 +11562,17 @@ SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu"); SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API"); SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t"); - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK))); SvREADONLY_on(sv); Modified: freeswitch/trunk/src/switch_cpp.cpp ============================================================================== --- freeswitch/trunk/src/switch_cpp.cpp (original) +++ freeswitch/trunk/src/switch_cpp.cpp Tue Jun 2 14:50:04 2009 @@ -829,6 +829,7 @@ switch_status_t status; //switch_file_handle_t fh = { 0 }; const char *prebuf; + switch_file_handle_t local_fh; this_check(-1); sanity_check(-1); @@ -978,6 +979,7 @@ SWITCH_DECLARE(int) CoreSession::recordFile(char *file_name, int time_limit, int silence_threshold, int silence_hits) { switch_status_t status; + switch_file_handle_t local_fh; this_check(-1); sanity_check(-1); From brian at freeswitch.org Tue Jun 2 13:57:54 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 15:57:54 -0500 Subject: [Freeswitch-svn] [commit] r13552 - freeswitch/branches/brian/trunk Message-ID: Author: brian Date: Tue Jun 2 15:57:54 2009 New Revision: 13552 Log: branch for nat testing Added: freeswitch/branches/brian/trunk/ - copied from r13551, /freeswitch/trunk/ From brian at freeswitch.org Tue Jun 2 14:02:47 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 16:02:47 -0500 Subject: [Freeswitch-svn] [commit] r13553 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Tue Jun 2 16:02:47 2009 New Revision: 13553 Log: adding NAT patch to my branch so others can help Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Tue Jun 2 16:02:47 2009 @@ -394,6 +394,7 @@ if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) { nua_bye(tech_pvt->nh, SIPTAG_REASON_STR(reason), + TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_END()); } @@ -407,7 +408,6 @@ nua_cancel(tech_pvt->nh, SIPTAG_REASON_STR(reason), TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)), - TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_END()); } } else { @@ -2644,6 +2644,9 @@ } } else { + char *dup_dest = NULL, *dest_host, *dest_user; + + if (!(dest = strchr(profile_name, '/'))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n"); cause = SWITCH_CAUSE_INVALID_NUMBER_FORMAT; @@ -2661,10 +2664,17 @@ profile_name = profile->domain_name; } + dup_dest = strdup(dest); + switch_assert(dup_dest != NULL); + sofia_glue_get_user_host(dup_dest, &dest_user, &dest_host); + tech_pvt->remote_ip = switch_core_session_sprintf(nsession, "%s", dest_host); + switch_safe_free(dup_dest); + if (!strncasecmp(dest, "sip:", 4) || !strncasecmp(dest, "sips:", 5)) { tech_pvt->dest = switch_core_session_strdup(nsession, dest); } else if ((host = strchr(dest, '%'))) { char buf[128]; + *host = '@'; tech_pvt->e_dest = switch_core_session_strdup(nsession, dest); *host++ = '\0'; @@ -2678,6 +2688,7 @@ } } else if (!(host = strchr(dest, '@'))) { char buf[128]; + tech_pvt->e_dest = switch_core_session_strdup(nsession, dest); if (sofia_reg_find_reg_url(profile, dest, profile_name, buf, sizeof(buf))) { tech_pvt->dest = switch_core_session_strdup(nsession, buf); @@ -3217,6 +3228,8 @@ mod_sofia_globals.running = 1; switch_mutex_unlock(mod_sofia_globals.mutex); + mod_sofia_globals.auto_nat = (switch_core_get_variable("nat_type") ? 1 : 0); + switch_queue_create(&mod_sofia_globals.presence_queue, SOFIA_QUEUE_SIZE, mod_sofia_globals.pool); switch_queue_create(&mod_sofia_globals.mwi_queue, SOFIA_QUEUE_SIZE, mod_sofia_globals.pool); Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Tue Jun 2 16:02:47 2009 @@ -192,6 +192,7 @@ PFLAG_MESSAGE_QUERY_ON_REGISTER, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE, PFLAG_PROXY_FOLLOW_REDIRECT, + PFLAG_AUTO_NAT, /* No new flags below this line */ PFLAG_MAX } PFLAGS; @@ -272,6 +273,7 @@ char guess_mask_str[16]; int debug_presence; int auto_restart; + int auto_nat; }; extern struct mod_sofia_globals mod_sofia_globals; @@ -408,9 +410,13 @@ char *extsipip; char *username; char *url; + char *public_url; char *bindurl; char *tls_url; + char *tls_public_url; char *tls_bindurl; + char *tcp_public_contact; + char *tls_public_contact; char *tcp_contact; char *tls_contact; char *sla_contact; @@ -489,6 +495,7 @@ uint32_t timer_t2; uint32_t timer_t4; char *contact_user; + char *local_network; }; struct private_object { @@ -613,6 +620,7 @@ switch_rtp_bug_flag_t rtp_bugs; switch_codec_implementation_t read_impl; switch_codec_implementation_t write_impl; + char *user_via; }; struct callback_t { Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Tue Jun 2 16:02:47 2009 @@ -766,6 +766,7 @@ sofia_event_callback, /* Callback for processing events */ profile, /* Additional data to pass to callback */ NUTAG_URL(profile->bindurl), + NTATAG_USER_VIA(1), TAG_IF(!strchr(profile->sipip, ':'), SOATAG_AF(SOA_AF_IP4_ONLY)), TAG_IF(strchr(profile->sipip, ':'), SOATAG_AF(SOA_AF_IP6_ONLY)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_SIPS_URL(profile->tls_bindurl)), @@ -1759,6 +1760,8 @@ } } else if(!strcasecmp(var, "context")) { profile->context = switch_core_strdup(profile->pool, val); + } else if (!strcasecmp(var, "local-network-acl")) { + profile->local_network = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "force-register-domain")) { profile->reg_domain = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "force-register-db-domain")) { @@ -2163,8 +2166,11 @@ if (!strcmp(val, "0.0.0.0")) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip); + } else if (!strcasecmp(val, "auto-nat")) { + ip = mod_sofia_globals.auto_nat ? switch_core_get_variable("nat_public_addr") : mod_sofia_globals.guess_ip; + sofia_set_pflag(profile, PFLAG_AUTO_NAT); } else { - ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip; + ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip; } profile->extrtpip = switch_core_strdup(profile->pool, ip); } else { @@ -2198,6 +2204,9 @@ if (!strcasecmp(val, "0.0.0.0")) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip); + } else if (!strcasecmp(val, "auto-nat")) { + ip = mod_sofia_globals.auto_nat ? switch_core_get_variable("nat_public_addr") : mod_sofia_globals.guess_ip; + sofia_set_pflag(profile, PFLAG_AUTO_NAT); } else if (strcasecmp(val, "auto")) { switch_port_t port = 0; if (sofia_glue_ext_address_lookup(profile, NULL, &myip, &port, val, profile->pool) == SWITCH_STATUS_SUCCESS) { @@ -2210,6 +2219,8 @@ } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ext-sip-ip\n"); } + } else if (!strcasecmp(var, "local-network-acl")) { + profile->local_network = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "force-register-domain")) { profile->reg_domain = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "force-register-db-domain")) { @@ -2264,7 +2275,7 @@ } else if (!strcasecmp(var, "manage-shared-appearance")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE); - profile->sla_contact = switch_core_sprintf(profile->pool, "sip:sla-agent@%s", profile->sipip); + profile->sla_contact = switch_core_sprintf(profile->pool, "sla-agent"); } } else if (!strcasecmp(var, "disable-srv")) { if (switch_true(val)) { @@ -2548,7 +2559,18 @@ if (!profile->sipdomain) { profile->sipdomain = switch_core_strdup(profile->pool, profile->sipip); } - if (profile->extsipip) { + if (profile->extsipip && sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + char *ipv6 = strchr(profile->extsipip, ':'); + profile->public_url = switch_core_sprintf(profile->pool, + "sip:%s@%s%s%s:%d", + profile->contact_user, + ipv6 ? "[" : "", + profile->extsipip, + ipv6 ? "]" : "", + profile->sip_port); + } + + if (profile->extsipip && !sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { char *ipv6 = strchr(profile->extsipip, ':'); profile->url = switch_core_sprintf(profile->pool, "sip:%s@%s%s%s:%d", @@ -2571,7 +2593,11 @@ } profile->tcp_contact = switch_core_sprintf(profile->pool, "%s;transport=tcp", profile->url); - + + if(sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + profile->tcp_public_contact = switch_core_sprintf(profile->pool, "%s;transport=tcp", profile->public_url); + } + if (profile->bind_params) { char *bindurl = profile->bindurl; profile->bindurl = switch_core_sprintf(profile->pool, "%s;%s", bindurl, profile->bind_params); @@ -2585,7 +2611,18 @@ profile->tls_sip_port = atoi(SOFIA_DEFAULT_TLS_PORT); } - if (profile->extsipip) { + if (profile->extsipip && sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + char *ipv6 = strchr(profile->extsipip, ':'); + profile->tls_public_url = switch_core_sprintf(profile->pool, + "sip:%s@%s%s%s:%d", + profile->contact_user, + ipv6 ? "[" : "", + profile->extsipip, + ipv6 ? "]" : "", + profile->tls_sip_port); + } + + if (profile->extsipip && !sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { char *ipv6 = strchr(profile->extsipip, ':'); profile->tls_url = switch_core_sprintf(profile->pool, @@ -2632,6 +2669,9 @@ profile->tls_cert_dir = switch_core_sprintf(profile->pool, "%s/ssl", SWITCH_GLOBAL_dirs.conf_dir); } profile->tls_contact = switch_core_sprintf(profile->pool, "%s;transport=tls", profile->tls_url); + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + profile->tls_public_contact = switch_core_sprintf(profile->pool, "%s;transport=tls", profile->tls_public_url); + } } } if (profile) { @@ -4309,6 +4349,7 @@ get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port); + if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) { if (sip && sip->sip_via) { const char *port = sip->sip_via->v_port; @@ -4428,6 +4469,12 @@ tech_pvt->remote_ip = switch_core_session_strdup(session, network_ip); tech_pvt->remote_port = network_port; + + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) { + sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url); + tech_pvt->user_via = switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport", sofia_glue_transport2str(transport), + profile->extsipip); + } channel = tech_pvt->channel = switch_core_session_get_channel(session); @@ -4626,7 +4673,8 @@ const char *url; - if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url)) { + if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : + (switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) ? profile->url : profile->public_url)) { if (strchr(url, '>')) { tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport)); } else { Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Tue Jun 2 16:02:47 2009 @@ -642,15 +642,16 @@ switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_audio_port); } - tech_pvt->local_sdp_audio_ip = ip; + if (!(tech_pvt->local_sdp_audio_port = switch_rtp_request_port(tech_pvt->profile->rtpip))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No RTP ports available!\n"); return SWITCH_STATUS_FALSE; } + sdp_port = tech_pvt->local_sdp_audio_port; - if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_audio_ip"))) { + if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_audio_ip")) && !sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT)) { if (tech_pvt->profile->extrtpip) { use_ip = tech_pvt->profile->extrtpip; } @@ -663,9 +664,24 @@ return SWITCH_STATUS_FALSE; } } - - tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip); + if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + if (tech_pvt->remote_ip && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && + !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip); + } else { + tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip); + } + } else { + + if (tech_pvt->remote_ip && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && + !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip); + } else { + tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip); + } + } + tech_pvt->adv_sdp_audio_port = sdp_port; switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port); @@ -1257,10 +1273,19 @@ check_decode(cid_num, session); if (!tech_pvt->from_str) { - const char* sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; - const char* format = strchr(sipip, ':') ? "\"%s\" " : "\"%s\" "; + const char* sipip; + const char* format; const char *alt = NULL; + if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT)) { + sipip = (switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) + ? tech_pvt->profile->sipip : tech_pvt->profile->extsipip; + } else { + sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; + } + + format = strchr(sipip, ':') ? "\"%s\" " : "\"%s\" "; + if ((alt = switch_channel_get_variable(channel, "sip_invite_domain"))) { sipip = alt; } @@ -1303,7 +1328,7 @@ const char *invite_from_params = switch_channel_get_variable(tech_pvt->channel, "sip_invite_from_params"); const char *from_var = switch_channel_get_variable(tech_pvt->channel, "sip_from_uri"); const char *from_display = switch_channel_get_variable(tech_pvt->channel, "sip_from_display"); - + if (switch_strlen_zero(tech_pvt->dest)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "URL Error!\n"); return SWITCH_STATUS_FALSE; @@ -1365,6 +1390,13 @@ tech_pvt->transport = SOFIA_TRANSPORT_UDP; } } + + if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + const char *transport = sofia_glue_transport2str(tech_pvt->transport); + tech_pvt->user_via = switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport", + transport, tech_pvt->profile->extsipip); + } + if (!sofia_test_pflag(tech_pvt->profile, PFLAG_TLS) && sofia_glue_transport_has_tls(tech_pvt->transport)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "TLS not supported by profile\n"); @@ -1374,8 +1406,18 @@ if (switch_strlen_zero(tech_pvt->invite_contact)) { const char * contact; if ((contact = switch_channel_get_variable(channel, "sip_contact_user"))) { - char *ip_addr = (tech_pvt->profile->extsipip) ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; - char *ipv6 = strchr(ip_addr, ':'); + char *ip_addr; + char *ipv6; + + if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT)) { + ip_addr = (switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) + ? tech_pvt->profile->sipip : tech_pvt->profile->extsipip; + } else { + ip_addr = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; + } + + ipv6 = strchr(ip_addr, ':'); + if (sofia_glue_transport_has_tls(tech_pvt->transport)) { tech_pvt->invite_contact = switch_core_session_sprintf(session, "sip:%s@%s%s%s:%d", contact, ipv6 ? "[" : "", ip_addr, ipv6 ? "]" : "", @@ -1388,7 +1430,12 @@ if (sofia_glue_transport_has_tls(tech_pvt->transport)) { tech_pvt->invite_contact = tech_pvt->profile->tls_url; } else { - tech_pvt->invite_contact = tech_pvt->profile->url; + if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && + !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + tech_pvt->invite_contact = tech_pvt->profile->public_url; + } else { + tech_pvt->invite_contact = tech_pvt->profile->url; + } } } } @@ -1603,6 +1650,7 @@ nua_invite(tech_pvt->nh, NUTAG_AUTOANSWER(0), NUTAG_SESSION_TIMER(session_timeout), + TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_IF(!switch_strlen_zero(tech_pvt->rpid), SIPTAG_REMOTE_PARTY_ID_STR(tech_pvt->rpid)), TAG_IF(!switch_strlen_zero(tech_pvt->preferred_id), SIPTAG_P_PREFERRED_IDENTITY_STR(tech_pvt->preferred_id)), TAG_IF(!switch_strlen_zero(tech_pvt->asserted_id), SIPTAG_P_ASSERTED_IDENTITY_STR(tech_pvt->asserted_id)), @@ -1630,14 +1678,23 @@ private_object_t *tech_pvt = switch_core_session_get_private(session); switch_channel_t *channel = switch_core_session_get_channel(session); switch_caller_profile_t *caller_profile; - const char *sipip, *format; + const char *sipip, *format, *contact_url; switch_assert(tech_pvt != NULL); switch_mutex_lock(tech_pvt->sofia_mutex); caller_profile = switch_channel_get_caller_profile(channel); - sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; + if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT)) { + sipip = (switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) + ? tech_pvt->profile->sipip : tech_pvt->profile->extsipip; + contact_url = tech_pvt->profile->public_url; + } else { + sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; + contact_url = tech_pvt->profile->url; + } + format = strchr(sipip, ':') ? "\"%s\" " : "\"%s\" "; + if ((tech_pvt->from_str = switch_core_session_sprintf(session, format, caller_profile->caller_id_name, caller_profile->caller_id_number, sipip))) { @@ -1646,12 +1703,15 @@ tech_pvt->nh2 = nua_handle(tech_pvt->profile->nua, NULL, SIPTAG_TO_STR(tech_pvt->dest), - SIPTAG_FROM_STR(tech_pvt->from_str), SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END()); + SIPTAG_FROM_STR(tech_pvt->from_str), + SIPTAG_CONTACT_STR(contact_url), + TAG_END()); nua_handle_bind(tech_pvt->nh2, tech_pvt->sofia_private); nua_invite(tech_pvt->nh2, - SIPTAG_CONTACT_STR(tech_pvt->profile->url), + SIPTAG_CONTACT_STR(contact_url), + TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_REUSE_REJECTED(1), Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Tue Jun 2 16:02:47 2009 @@ -306,12 +306,10 @@ for_everyone = 1; } - dup_account = strdup(account); switch_assert(dup_account != NULL); sofia_glue_get_user_host(dup_account, &user, &host); - if ((pname = switch_event_get_header(event, "sofia-profile"))) { if (!(profile = sofia_glue_find_profile(pname))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No profile %s\n", pname); @@ -375,11 +373,11 @@ } if (for_everyone) { - sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,'%q' " + sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q' " "from sip_registrations where sip_user='%q' and sip_host='%q'", stream.data, user, host); } else if (call_id) { - sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,'%q' " + sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q' " "from sip_registrations where sip_user='%q' and sip_host='%q' and call_id='%q'", stream.data, user, host, call_id); } @@ -1363,7 +1361,7 @@ profile = ext_profile; } } - + if (!(nh = nua_handle_by_call_id(h->profile->nua, call_id))) { if (profile->debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot find handle for %s\n", call_id); @@ -1379,7 +1377,10 @@ nua_handle_bind(nh, &mod_sofia_globals.keep_private); nua_notify(nh, SIPTAG_SUBSCRIPTION_STATE_STR("active"), - SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END()); + SIPTAG_EVENT_STR(event), + SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), + SIPTAG_PAYLOAD_STR(body), + TAG_END()); switch_safe_free(id); @@ -1401,13 +1402,14 @@ char *event = "message-summary"; char *contact, *o_contact = argv[2]; char *profile_name = argv[3]; - char *body = argv[4]; + char *network_ip = argv[4]; + char *body = argv[5]; char *id = NULL; nua_handle_t *nh; struct mwi_helper *h = (struct mwi_helper *) pArg; sofia_profile_t *ext_profile = NULL, *profile = h->profile; - char *route = NULL, *route_uri = NULL; - char *p; + char *route = NULL, *route_uri = NULL, *user_via = NULL; + char *p, *contact_str; if (profile_name && strcasecmp(profile_name, h->profile->name)) { if ((ext_profile = sofia_glue_find_profile(profile_name))) { @@ -1415,9 +1417,24 @@ } } - id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host); + id = switch_mprintf("sip:%s@%s", sub_to_user, switch_check_network_list_ip(network_ip, profile->local_network) ? sub_to_host : profile->extsipip); contact = sofia_glue_get_url_from_contact(o_contact, 1); + + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, profile->local_network)) { + char *ptr = NULL; + if ((ptr = sofia_glue_find_parameter(o_contact, "transport="))) { + sofia_transport_t transport = sofia_glue_str2transport(ptr); + user_via = switch_mprintf("SIP/2.0/%s %s;rport", sofia_glue_transport2str(transport), profile->extsipip); + printf("user_via -> %s\n", user_via); + } else { + user_via = switch_mprintf("SIP/2.0/UDP %s;rport", profile->extsipip); + } + + contact_str = profile->public_url; + } else { + contact_str = profile->url; + } if ((route = strstr(contact, ";fs_path=")) && (route = strdup(route + 9))) { for (p = route; p && *p ; p++) { @@ -1455,17 +1472,23 @@ } } - nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(h->profile->url), TAG_END()); + nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact), + SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), + SIPTAG_CONTACT_STR(contact_str), TAG_END()); nua_handle_bind(nh, &mod_sofia_globals.destroy_private); nua_notify(nh, NUTAG_NEWSUB(1), TAG_IF(route_uri, NUTAG_PROXY(route_uri)), - SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END()); + TAG_IF(!switch_strlen_zero(user_via), SIPTAG_VIA_STR(user_via)), + SIPTAG_EVENT_STR(event), + SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), + SIPTAG_PAYLOAD_STR(body), TAG_END()); switch_safe_free(contact); switch_safe_free(id); switch_safe_free(route); + switch_safe_free(user_via); if (ext_profile) { sofia_glue_release_profile(ext_profile); } @@ -1508,6 +1531,7 @@ char *port; char new_port[25] = ""; char *is_nat = NULL; + int is_auto_nat = 0; const char *ipv6; if (!(contact && sip->sip_contact->m_url)) { @@ -1518,6 +1542,10 @@ get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port); + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, profile->local_network)) { + is_auto_nat = 1; + } + tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END()); event = sip_header_as_string(profile->home, (void *) sip->sip_event); @@ -1777,25 +1805,41 @@ network_port, params); } + + + if (is_auto_nat) { + contactstr = profile->public_url; + } else { + contactstr = profile->url; + } + if (switch_stristr("port=tcp", contact->m_url->url_params)) { - contactstr = profile->tcp_contact; + if (is_auto_nat) { + contactstr = profile->tcp_public_contact; + } else { + contactstr = profile->tcp_contact; + } } else if (switch_stristr("port=tls", contact->m_url->url_params)) { - contactstr = profile->tls_contact; + if (is_auto_nat) { + contactstr = profile->tls_contact; + } else { + contactstr = profile->tls_public_contact; + } } - if (nh && nh->nh_ds && nh->nh_ds->ds_usage) { nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta + SUB_OVERLAP, exp_delta + SUB_OVERLAP); } - nua_respond(nh, SIP_202_ACCEPTED, SIPTAG_CONTACT_STR(contactstr), NUTAG_WITH_THIS(nua), + nua_respond(nh, SIP_202_ACCEPTED, + SIPTAG_CONTACT_STR(contactstr), + NUTAG_WITH_THIS(nua), SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EXPIRES_STR(exp_delta_str), TAG_IF(sticky, NUTAG_PROXY(sticky)), TAG_END()); switch_safe_free(sticky); - } sent_reply++; Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Tue Jun 2 16:02:47 2009 @@ -76,6 +76,12 @@ struct sla_helper sh = { { 0 } }; char *contact_str = strip_uri(full_contact); sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url); + su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); + char network_ip[80]; + int network_port = 0; + + get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); + network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port); sql = switch_mprintf("select call_id from sip_shared_appearance_dialogs where hostname='%q' and profile_name='%q' and contact_str='%q'", mod_sofia_globals.hostname, profile->name, contact_str); @@ -99,8 +105,13 @@ nua_handle_bind(nh, &mod_sofia_globals.keep_private); switch_snprintf(exp_str, sizeof(exp_str), "%ld", exptime + 30); - switch_snprintf(my_contact, sizeof(my_contact), "<%s;transport=%s>;expires=%s", profile->sla_contact, sofia_glue_transport2str(transport), exp_str); - + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, profile->local_network)) { + switch_snprintf(my_contact, sizeof(my_contact), ";expires=%s", profile->sla_contact, + profile->extsipip, sofia_glue_transport2str(transport), exp_str); + } else { + switch_snprintf(my_contact, sizeof(my_contact), ";expires=%s", profile->sla_contact, + profile->sipip, sofia_glue_transport2str(transport), exp_str); + } nua_subscribe(nh, SIPTAG_TO(sip->sip_to), SIPTAG_FROM(sip->sip_to), @@ -125,8 +136,14 @@ char *sql = NULL; char *route_uri = NULL; char *sla_contact = NULL; + su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); + char network_ip[80]; + int network_port = 0; sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url); + + get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); + network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port); /* * XXX MTK FIXME - we don't look at the tag to see if NUTAG_SUBSTATE(nua_substate_terminated) or * a Subscription-State header with state "terminated" and/or expiration of 0. So we never forget @@ -187,8 +204,12 @@ *p++ = '\0'; } } - - sla_contact = switch_mprintf("<%s;transport=%s>", profile->sla_contact, sofia_glue_transport2str(transport)); + + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, profile->local_network)) { + sla_contact = switch_mprintf("", profile->sla_contact, profile->extsipip, sofia_glue_transport2str(transport)); + } else { + sla_contact = switch_mprintf("", profile->sla_contact, profile->extsipip, sofia_glue_transport2str(transport)); + } nua_respond(nh, SIP_202_ACCEPTED, SIPTAG_CONTACT_STR(sla_contact), NUTAG_WITH_THIS(nua), TAG_IF(route_uri, NUTAG_PROXY(route_uri)), From brian at freeswitch.org Tue Jun 2 14:49:39 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 16:49:39 -0500 Subject: [Freeswitch-svn] [commit] r13554 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Tue Jun 2 16:49:39 2009 New Revision: 13554 Log: tweak sla to work inside out Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Tue Jun 2 16:49:39 2009 @@ -3547,7 +3547,8 @@ " aor VARCHAR(255),\n" " profile_name VARCHAR(255),\n" " hostname VARCHAR(255),\n" - " contact_str VARCHAR(255)\n" + " contact_str VARCHAR(255),\n" + " network_ip VARCHAR(255)\n" ");\n"; char shared_appearance_dialogs_sql[] = Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Tue Jun 2 16:49:39 2009 @@ -159,7 +159,7 @@ */ aor = switch_mprintf("sip:%s@%s;transport=%s", sip->sip_contact->m_url->url_user, - sip->sip_from->a_url->url_host, sofia_glue_transport2str(transport)); + profile->sipip, sofia_glue_transport2str(transport)); /* * ok, and now that we HAVE the AOR, we REALLY should go check in the XML config and see if this particular @@ -180,9 +180,9 @@ } if ((sql = - switch_mprintf("insert into sip_shared_appearance_subscriptions (subscriber, call_id, aor, profile_name, hostname, contact_str) " - "values ('%q','%q','%q','%q','%q','%q')", - subscriber, sip->sip_call_id->i_id, aor, profile->name, mod_sofia_globals.hostname, contact_str))) { + switch_mprintf("insert into sip_shared_appearance_subscriptions (subscriber, call_id, aor, profile_name, hostname, contact_str, network_ip) " + "values ('%q','%q','%q','%q','%q','%q','%q')", + subscriber, sip->sip_call_id->i_id, aor, profile->name, mod_sofia_globals.hostname, contact_str, network_ip))) { sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); } @@ -298,7 +298,7 @@ /* calculate the AOR we're trying to tell people about. should probably double-check before derferencing XXX MTK */ aor = switch_mprintf("sip:%s@%s;transport=%s", sip->sip_to->a_url->url_user, - sip->sip_to->a_url->url_host, sofia_glue_transport2str(transport)); + profile->sipip, sofia_glue_transport2str(transport)); /* this isn't sufficient because on things like the polycom, the subscriber is the 'main' ext number, but the * 'main' ext number isn't in ANY of the headers they send us in the notify. of course. @@ -312,8 +312,10 @@ if (sip->sip_payload && sip->sip_payload->pl_data) { sql = switch_mprintf("select subscriber,call_id,aor,profile_name,hostname,contact_str from sip_shared_appearance_subscriptions where " - "aor='%q' and subscriber<>'%q' and profile_name='%q' and hostname='%q'", - aor, contact, profile->name, mod_sofia_globals.hostname); + "aor='%q' and profile_name='%q' and hostname='%q'", + aor, profile->name, mod_sofia_globals.hostname); + printf("WTF %s\n", sql); + helper.profile = profile; @@ -340,7 +342,6 @@ nua_handle_t *nh; char *route_uri = NULL; - nh = nua_handle_by_call_id(helper->profile->nua, call_id); /* that's all you need to find the subscription's nh */ if (nh) { From brian at freeswitch.org Tue Jun 2 14:51:25 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 16:51:25 -0500 Subject: [Freeswitch-svn] [commit] r13555 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Tue Jun 2 16:51:25 2009 New Revision: 13555 Log: tweak sla to work inside out Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Tue Jun 2 16:51:25 2009 @@ -158,6 +158,7 @@ * so we do what openser's pua_bla does and... */ + /* We always store the AOR as the sipip and not the request so SLA works with NAT inside out */ aor = switch_mprintf("sip:%s@%s;transport=%s", sip->sip_contact->m_url->url_user, profile->sipip, sofia_glue_transport2str(transport)); @@ -297,6 +298,7 @@ } /* calculate the AOR we're trying to tell people about. should probably double-check before derferencing XXX MTK */ + /* We always store the AOR as the sipip and not the request so SLA works with NAT inside out */ aor = switch_mprintf("sip:%s@%s;transport=%s", sip->sip_to->a_url->url_user, profile->sipip, sofia_glue_transport2str(transport)); @@ -314,9 +316,6 @@ sql = switch_mprintf("select subscriber,call_id,aor,profile_name,hostname,contact_str from sip_shared_appearance_subscriptions where " "aor='%q' and profile_name='%q' and hostname='%q'", aor, profile->name, mod_sofia_globals.hostname); - printf("WTF %s\n", sql); - - helper.profile = profile; helper.payload = sip->sip_payload->pl_data; /* could just send the WHOLE payload. you'd get the type that way. */ From anthm at freeswitch.org Tue Jun 2 15:03:33 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 17:03:33 -0500 Subject: [Freeswitch-svn] [commit] r13556 - freeswitch/trunk/src Message-ID: Author: anthm Date: Tue Jun 2 17:03:33 2009 New Revision: 13556 Log: fix order of ops to enable logging sooner Modified: freeswitch/trunk/src/switch_core.c freeswitch/trunk/src/switch_nat.c freeswitch/trunk/src/switch_xml.c Modified: freeswitch/trunk/src/switch_core.c ============================================================================== --- freeswitch/trunk/src/switch_core.c (original) +++ freeswitch/trunk/src/switch_core.c Tue Jun 2 17:03:33 2009 @@ -1176,6 +1176,12 @@ runtime.flags = flags; runtime.sps_total = 30; + *err = NULL; + + if (console) { + runtime.console = stdout; + } + switch_find_local_ip(guess_ip, sizeof(guess_ip), &mask, AF_INET); switch_core_set_variable("local_ip_v4", guess_ip); switch_core_set_variable("local_mask_v4", inet_ntoa(*(struct in_addr *)&mask)); @@ -1188,25 +1194,21 @@ switch_event_init(runtime.memory_pool); - if (switch_test_flag((&runtime), SCF_USE_AUTO_NAT)) { - switch_nat_init(runtime.memory_pool); - } - if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) { apr_terminate(); return SWITCH_STATUS_MEMERR; } - switch_load_core_config("switch.conf"); - + if (switch_test_flag((&runtime), SCF_USE_AUTO_NAT)) { + switch_nat_init(runtime.memory_pool); + } + switch_log_init(runtime.memory_pool, runtime.colorize_console); - switch_core_state_machine_init(runtime.memory_pool); - *err = NULL; + switch_load_core_config("switch.conf"); - if (console) { - runtime.console = stdout; - } + + switch_core_state_machine_init(runtime.memory_pool); if (switch_test_flag((&runtime), SCF_USE_SQL)) { switch_core_sqldb_start(runtime.memory_pool); Modified: freeswitch/trunk/src/switch_nat.c ============================================================================== --- freeswitch/trunk/src/switch_nat.c (original) +++ freeswitch/trunk/src/switch_nat.c Tue Jun 2 17:03:33 2009 @@ -146,9 +146,14 @@ switch_find_local_ip(nat_globals.pvt_addr, sizeof(nat_globals.pvt_addr), NULL, AF_INET); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Detecting NAT\n"); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for PMP\n"); init_pmp(); - if (!nat_globals.nat_type) { + if (nat_globals.nat_type) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for UPNP\n"); init_upnp(); } @@ -156,8 +161,9 @@ switch_core_set_variable("nat_public_addr", nat_globals.pub_addr); switch_core_set_variable("nat_private_addr", nat_globals.pvt_addr); switch_core_set_variable("nat_type", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "NAT detected type: %s\n", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp"); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No PMP or uPNP NAT device detected!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No PMP or uPNP NAT device detected!\n"); } } Modified: freeswitch/trunk/src/switch_xml.c ============================================================================== --- freeswitch/trunk/src/switch_xml.c (original) +++ freeswitch/trunk/src/switch_xml.c Tue Jun 2 17:03:33 2009 @@ -1287,8 +1287,8 @@ char *bp = expand_vars(buf, ebuf, sizeof(ebuf), &cur, &err); line++; - if (err && stderr) { - fprintf(stderr, "Error [%s] in file %s line %d\n", err, file, line); + if (err) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error [%s] in file %s line %d\n", err, file, line); } /* we ignore or for the sake of validators as well as type stuff */ From anthm at freeswitch.org Tue Jun 2 15:46:38 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 17:46:38 -0500 Subject: [Freeswitch-svn] [commit] r13557 - freeswitch/trunk/src Message-ID: Author: anthm Date: Tue Jun 2 17:46:38 2009 New Revision: 13557 Log: fix long delay in nat detection Modified: freeswitch/trunk/src/switch_nat.c Modified: freeswitch/trunk/src/switch_nat.c ============================================================================== --- freeswitch/trunk/src/switch_nat.c (original) +++ freeswitch/trunk/src/switch_nat.c Tue Jun 2 17:46:38 2009 @@ -101,11 +101,11 @@ static int init_pmp(void) { - int r = 0; + int r = 0, i = 0, max = 5; natpmpresp_t response; char *pubaddr = NULL; fd_set fds; - struct timeval timeout; + initnatpmp(&nat_globals.natpmp); r = sendpublicaddressrequest(&nat_globals.natpmp); @@ -115,12 +115,16 @@ } do { + struct timeval timeout = { 1, 0}; + i++; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for PMP %d/%d\n", i, max); + FD_ZERO(&fds); FD_SET(nat_globals.natpmp.s, &fds); getnatpmprequesttimeout(&nat_globals.natpmp, &timeout); select(FD_SETSIZE, &fds, NULL, NULL, &timeout); r = readnatpmpresponseorretry(&nat_globals.natpmp, &response); - } while(r == NATPMP_TRYAGAIN); + } while(r == NATPMP_TRYAGAIN && i < max); if (r < 0) { goto end; @@ -147,13 +151,12 @@ switch_find_local_ip(nat_globals.pvt_addr, sizeof(nat_globals.pvt_addr), NULL, AF_INET); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Detecting NAT\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Scanning for NAT\n"); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for PMP\n"); init_pmp(); - if (nat_globals.nat_type) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for UPNP\n"); + if (!nat_globals.nat_type) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for UPnP\n"); init_upnp(); } @@ -163,7 +166,7 @@ switch_core_set_variable("nat_type", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "NAT detected type: %s\n", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp"); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No PMP or uPNP NAT device detected!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No PMP or UPnP NAT detected!\n"); } } From brian at freeswitch.org Tue Jun 2 16:02:13 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 18:02:13 -0500 Subject: [Freeswitch-svn] [commit] r13558 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Tue Jun 2 18:02:13 2009 New Revision: 13558 Log: patch the XML so that if it happens to traverse nat it'll display the pickup and barge correctly for the phone Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Tue Jun 2 18:02:13 2009 @@ -1426,7 +1426,6 @@ if ((ptr = sofia_glue_find_parameter(o_contact, "transport="))) { sofia_transport_t transport = sofia_glue_str2transport(ptr); user_via = switch_mprintf("SIP/2.0/%s %s;rport", sofia_glue_transport2str(transport), profile->extsipip); - printf("user_via -> %s\n", user_via); } else { user_via = switch_mprintf("SIP/2.0/UDP %s;rport", profile->extsipip); } Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Tue Jun 2 18:02:13 2009 @@ -313,7 +313,7 @@ sip->sip_contact->m_url->url_host, sofia_glue_transport2str(transport)); if (sip->sip_payload && sip->sip_payload->pl_data) { - sql = switch_mprintf("select subscriber,call_id,aor,profile_name,hostname,contact_str from sip_shared_appearance_subscriptions where " + sql = switch_mprintf("select subscriber,call_id,aor,profile_name,hostname,contact_str,network_ip from sip_shared_appearance_subscriptions where " "aor='%q' and profile_name='%q' and hostname='%q'", aor, profile->name, mod_sofia_globals.hostname); @@ -338,9 +338,10 @@ /* char *profile_name = argv[3]; */ /* char *hostname = argv[4]; */ char *contact_str = argv[5]; + char *network_ip = argv[6]; nua_handle_t *nh; char *route_uri = NULL; - + char *xml_fixup = NULL; nh = nua_handle_by_call_id(helper->profile->nua, call_id); /* that's all you need to find the subscription's nh */ if (nh) { @@ -363,14 +364,23 @@ *p++ = '\0'; } } - + + if (sofia_test_pflag(helper->profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, helper->profile->local_network)) { + xml_fixup = switch_string_replace(helper->payload, helper->profile->sipip, helper->profile->extsipip); + } else if (sofia_test_pflag(helper->profile, PFLAG_AUTO_NAT) && switch_check_network_list_ip(network_ip, helper->profile->local_network)) { + xml_fixup = switch_string_replace(helper->payload, helper->profile->extsipip, helper->profile->sipip); + } else { + xml_fixup = helper->payload; + } + nua_notify(nh, SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=300"), /* XXX MTK FIXME - this is totally fake calculation */ TAG_IF(route_uri, NUTAG_PROXY(route_uri)), SIPTAG_CONTENT_TYPE_STR("application/dialog-info+xml"), /* could've just kept the type from the payload */ - SIPTAG_PAYLOAD_STR(helper->payload), + SIPTAG_PAYLOAD_STR(xml_fixup), TAG_END()); switch_safe_free(route_uri); + switch_safe_free(xml_fixup); } return 0; } From brian at freeswitch.org Tue Jun 2 16:42:44 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 18:42:44 -0500 Subject: [Freeswitch-svn] [commit] r13559 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Tue Jun 2 18:42:43 2009 New Revision: 13559 Log: reboot packets now work correctly Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Tue Jun 2 18:42:43 2009 @@ -843,7 +843,7 @@ const char *sofia_glue_strip_proto(const char *uri); switch_status_t reconfig_sofia(sofia_profile_t *profile); void sofia_glue_del_gateway(sofia_gateway_t *gp); -void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent); +void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent, const char *network_ip); void sofia_glue_restart_all_profiles(void); void sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly); const char * sofia_state_string(int state); Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Tue Jun 2 18:42:43 2009 @@ -1423,17 +1423,28 @@ if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, profile->local_network)) { char *ptr = NULL; + const char *transport_str = NULL; if ((ptr = sofia_glue_find_parameter(o_contact, "transport="))) { sofia_transport_t transport = sofia_glue_str2transport(ptr); - user_via = switch_mprintf("SIP/2.0/%s %s;rport", sofia_glue_transport2str(transport), profile->extsipip); + transport_str = sofia_glue_transport2str(transport); + user_via = switch_mprintf("SIP/2.0/%s %s;rport", transport_str, profile->extsipip); } else { user_via = switch_mprintf("SIP/2.0/UDP %s;rport", profile->extsipip); } - - contact_str = profile->public_url; + + if (switch_stristr("udp", transport_str)) { + contact_str = profile->public_url; + } else if (switch_stristr("tcp", transport_str)) { + contact_str = profile->tcp_public_contact; + } else if (switch_stristr("tls", transport_str)) { + contact_str = profile->tls_public_contact; + } else { + contact_str = profile->public_url; + } } else { contact_str = profile->url; } + if ((route = strstr(contact, ";fs_path=")) && (route = strdup(route + 9))) { for (p = route; p && *p ; p++) { Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Tue Jun 2 18:42:43 2009 @@ -402,11 +402,13 @@ return 0; } -void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent) +void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent, const char *network_ip) { const char *event = "check-sync"; nua_handle_t *nh; char *contact_url = NULL; + char *contact_str = NULL; + char *user_via = NULL; char *id = NULL; if (switch_stristr("snom", user_agent)) { @@ -417,22 +419,47 @@ if ((contact_url = sofia_glue_get_url_from_contact((char *)contact, 1))) { char *p; - id = switch_mprintf("sip:%s@%s", user, host); + id = switch_mprintf("sip:%s@%s", user, network_ip); if ((p = strstr(contact_url, ";fs_"))) { *p = '\0'; } - + + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, profile->local_network)) { + char *ptr = NULL; + const char *transport_str = NULL; + if ((ptr = sofia_glue_find_parameter(contact_url, "transport="))) { + sofia_transport_t transport = sofia_glue_str2transport(ptr); + transport_str = sofia_glue_transport2str(transport); + user_via = switch_mprintf("SIP/2.0/%s %s;rport", transport_str, profile->extsipip); + } else { + user_via = switch_mprintf("SIP/2.0/UDP %s;rport", profile->extsipip); + } + + if (switch_stristr("udp", transport_str)) { + contact_str = profile->public_url; + } else if (switch_stristr("tcp", transport_str)) { + contact_str = profile->tcp_public_contact; + } else if (switch_stristr("tls", transport_str)) { + contact_str = profile->tls_public_contact; + } else { + contact_str = profile->public_url; + } + } else { + contact_str = profile->url; + } + nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact_url), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), - SIPTAG_CONTACT_STR(profile->url), + SIPTAG_CONTACT_STR(contact_str), TAG_END()); nua_handle_bind(nh, &mod_sofia_globals.destroy_private); nua_notify(nh, NUTAG_NEWSUB(1), + TAG_IF(!switch_strlen_zero(user_via), SIPTAG_VIA_STR(user_via)), SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(""), @@ -462,8 +489,8 @@ switch_event_t *s_event; sofia_profile_t *profile = (sofia_profile_t *) pArg; - if (argc > 11 && atoi(argv[11]) == 1) { - sofia_reg_send_reboot(profile, argv[1], argv[2], argv[3], argv[7]); + if (argc > 12 && atoi(argv[12]) == 1) { + sofia_reg_send_reboot(profile, argv[1], argv[2], argv[3], argv[7], argv[11]); } if (argc >= 3) { @@ -508,7 +535,8 @@ switch_snprintf(sqlextra, sizeof(sqlextra), " or (sip_user='%s' and sip_host='%s')", user, host); } - switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name" + switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires" + ",user_agent,server_user,server_host,profile_name,network_ip" ",%d from sip_registrations where call_id='%s' %s", reboot, call_id, sqlextra); @@ -548,7 +576,8 @@ switch_mutex_lock(profile->ireg_mutex); if (now) { - switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name" + switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires" + ",user_agent,server_user,server_host,profile_name,network_ip" ",%d from sip_registrations where expires > 0 and expires <= %ld", reboot, (long) now); } else { switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name" From brian at freeswitch.org Tue Jun 2 16:56:06 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 18:56:06 -0500 Subject: [Freeswitch-svn] [commit] r13560 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Tue Jun 2 18:56:06 2009 New Revision: 13560 Log: adding map and unmap of profile ports when AUTO_NAT is on Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Tue Jun 2 18:56:06 2009 @@ -762,6 +762,15 @@ use_timer ? "timer, " : "" ); + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + if (switch_nat_add_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created UDP nat mapping for %s\n", profile->name); + } + if (switch_nat_add_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP nat mapping for %s\n", profile->name); + } + } + profile->nua = nua_create(profile->s_root, /* Event loop */ sofia_event_callback, /* Callback for processing events */ profile, /* Additional data to pass to callback */ @@ -903,6 +912,16 @@ su_root_run(profile->s_root); sofia_clear_pflag_locked(profile, PFLAG_RUNNING); + + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + if (switch_nat_del_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted UDP nat mapping for %s\n", profile->name); + } + if (switch_nat_del_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP nat mapping for %s\n", profile->name); + } + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n"); switch_thread_join(&st, worker_thread); From brian at freeswitch.org Tue Jun 2 17:14:44 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 19:14:44 -0500 Subject: [Freeswitch-svn] [commit] r13561 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Tue Jun 2 19:14:44 2009 New Revision: 13561 Log: adding nat mapping and unmapping for audio and video rtp ports Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Tue Jun 2 19:14:44 2009 @@ -684,6 +684,10 @@ tech_pvt->adv_sdp_audio_port = sdp_port; + if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP); + } + switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port); switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip); switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, tmp); @@ -724,6 +728,10 @@ tech_pvt->adv_sdp_video_port = sdp_port; + if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP); + } + switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port); switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip); switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_PORT_VARIABLE, tmp); @@ -1821,12 +1829,21 @@ switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_audio_port); } + if (tech_pvt->local_sdp_audio_port > 0 && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && + !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + switch_nat_del_mapping((switch_port_t)tech_pvt->local_sdp_audio_port, SWITCH_NAT_UDP); + } + if (tech_pvt->video_rtp_session) { switch_rtp_destroy(&tech_pvt->video_rtp_session); } else if (tech_pvt->local_sdp_video_port) { switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_video_port); } + if (tech_pvt->local_sdp_video_port > 0 && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && + !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + switch_nat_del_mapping((switch_port_t)tech_pvt->local_sdp_video_port, SWITCH_NAT_UDP); + } } switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force) From brian at freeswitch.org Tue Jun 2 17:19:55 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 19:19:55 -0500 Subject: [Freeswitch-svn] [commit] r13562 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Tue Jun 2 19:19:54 2009 New Revision: 13562 Log: OCD Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Tue Jun 2 19:19:54 2009 @@ -1777,7 +1777,7 @@ } else { sofia_clear_pflag(profile, PFLAG_AUTH_CALLS); } - } else if(!strcasecmp(var, "context")) { + } else if (!strcasecmp(var, "context")) { profile->context = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "local-network-acl")) { profile->local_network = switch_core_strdup(profile->pool, val); @@ -2613,7 +2613,7 @@ profile->tcp_contact = switch_core_sprintf(profile->pool, "%s;transport=tcp", profile->url); - if(sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { profile->tcp_public_contact = switch_core_sprintf(profile->pool, "%s;transport=tcp", profile->public_url); } Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Tue Jun 2 19:19:54 2009 @@ -2557,7 +2557,7 @@ if (map->rm_pt < 96) { match = (map->rm_pt == imp->ianacode) ? 1 : 0; } else { - if(map->rm_encoding) { + if (map->rm_encoding) { match = strcasecmp(map->rm_encoding, imp->iananame) ? 0 : 1; } else { match = 0; @@ -2565,7 +2565,7 @@ } if (match) { - if(ptime > 0) { + if (ptime > 0) { switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate, ptime); } else { switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh", imp->iananame, (unsigned int) map->rm_rate); @@ -2598,7 +2598,7 @@ if (map->rm_pt < 96) { match = (map->rm_pt == imp->ianacode) ? 1 : 0; } else { - if(map->rm_encoding) { + if (map->rm_encoding) { match = strcasecmp(map->rm_encoding, imp->iananame) ? 0 : 1; } else { match = 0; @@ -2606,7 +2606,7 @@ } if (match) { - if(ptime > 0) { + if (ptime > 0) { switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate, ptime); } else { switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh", imp->iananame, (unsigned int) map->rm_rate); From brian at freeswitch.org Tue Jun 2 17:33:59 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 19:33:59 -0500 Subject: [Freeswitch-svn] [commit] r13563 - freeswitch/branches/brian/trunk/src Message-ID: Author: brian Date: Tue Jun 2 19:33:59 2009 New Revision: 13563 Log: merge trunk down Modified: freeswitch/branches/brian/trunk/src/switch_core.c freeswitch/branches/brian/trunk/src/switch_nat.c freeswitch/branches/brian/trunk/src/switch_xml.c Modified: freeswitch/branches/brian/trunk/src/switch_core.c ============================================================================== --- freeswitch/branches/brian/trunk/src/switch_core.c (original) +++ freeswitch/branches/brian/trunk/src/switch_core.c Tue Jun 2 19:33:59 2009 @@ -1176,6 +1176,12 @@ runtime.flags = flags; runtime.sps_total = 30; + *err = NULL; + + if (console) { + runtime.console = stdout; + } + switch_find_local_ip(guess_ip, sizeof(guess_ip), &mask, AF_INET); switch_core_set_variable("local_ip_v4", guess_ip); switch_core_set_variable("local_mask_v4", inet_ntoa(*(struct in_addr *)&mask)); @@ -1188,25 +1194,21 @@ switch_event_init(runtime.memory_pool); - if (switch_test_flag((&runtime), SCF_USE_AUTO_NAT)) { - switch_nat_init(runtime.memory_pool); - } - if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) { apr_terminate(); return SWITCH_STATUS_MEMERR; } - switch_load_core_config("switch.conf"); - + if (switch_test_flag((&runtime), SCF_USE_AUTO_NAT)) { + switch_nat_init(runtime.memory_pool); + } + switch_log_init(runtime.memory_pool, runtime.colorize_console); - switch_core_state_machine_init(runtime.memory_pool); - *err = NULL; + switch_load_core_config("switch.conf"); - if (console) { - runtime.console = stdout; - } + + switch_core_state_machine_init(runtime.memory_pool); if (switch_test_flag((&runtime), SCF_USE_SQL)) { switch_core_sqldb_start(runtime.memory_pool); Modified: freeswitch/branches/brian/trunk/src/switch_nat.c ============================================================================== --- freeswitch/branches/brian/trunk/src/switch_nat.c (original) +++ freeswitch/branches/brian/trunk/src/switch_nat.c Tue Jun 2 19:33:59 2009 @@ -101,11 +101,11 @@ static int init_pmp(void) { - int r = 0; + int r = 0, i = 0, max = 5; natpmpresp_t response; char *pubaddr = NULL; fd_set fds; - struct timeval timeout; + initnatpmp(&nat_globals.natpmp); r = sendpublicaddressrequest(&nat_globals.natpmp); @@ -115,12 +115,16 @@ } do { + struct timeval timeout = { 1, 0}; + i++; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for PMP %d/%d\n", i, max); + FD_ZERO(&fds); FD_SET(nat_globals.natpmp.s, &fds); getnatpmprequesttimeout(&nat_globals.natpmp, &timeout); select(FD_SETSIZE, &fds, NULL, NULL, &timeout); r = readnatpmpresponseorretry(&nat_globals.natpmp, &response); - } while(r == NATPMP_TRYAGAIN); + } while(r == NATPMP_TRYAGAIN && i < max); if (r < 0) { goto end; @@ -146,9 +150,13 @@ switch_find_local_ip(nat_globals.pvt_addr, sizeof(nat_globals.pvt_addr), NULL, AF_INET); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Scanning for NAT\n"); + init_pmp(); if (!nat_globals.nat_type) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for UPnP\n"); init_upnp(); } @@ -156,8 +164,9 @@ switch_core_set_variable("nat_public_addr", nat_globals.pub_addr); switch_core_set_variable("nat_private_addr", nat_globals.pvt_addr); switch_core_set_variable("nat_type", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "NAT detected type: %s\n", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp"); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No PMP or uPNP NAT device detected!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No PMP or UPnP NAT detected!\n"); } } Modified: freeswitch/branches/brian/trunk/src/switch_xml.c ============================================================================== --- freeswitch/branches/brian/trunk/src/switch_xml.c (original) +++ freeswitch/branches/brian/trunk/src/switch_xml.c Tue Jun 2 19:33:59 2009 @@ -1287,8 +1287,8 @@ char *bp = expand_vars(buf, ebuf, sizeof(ebuf), &cur, &err); line++; - if (err && stderr) { - fprintf(stderr, "Error [%s] in file %s line %d\n", err, file, line); + if (err) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error [%s] in file %s line %d\n", err, file, line); } /* we ignore or for the sake of validators as well as type stuff */ From brian at freeswitch.org Tue Jun 2 18:19:15 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Tue, 02 Jun 2009 20:19:15 -0500 Subject: [Freeswitch-svn] [commit] r13564 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Tue Jun 2 20:19:14 2009 New Revision: 13564 Log: fix seggy fault Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Tue Jun 2 20:19:14 2009 @@ -580,7 +580,8 @@ ",user_agent,server_user,server_host,profile_name,network_ip" ",%d from sip_registrations where expires > 0 and expires <= %ld", reboot, (long) now); } else { - switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name" + switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires" + ",user_agent,server_user,server_host,profile_name,network_ip" ",%d from sip_registrations where expires > 0", reboot); } From brian at freeswitch.org Wed Jun 3 06:42:37 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 08:42:37 -0500 Subject: [Freeswitch-svn] [commit] r13565 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 08:42:37 2009 New Revision: 13565 Log: adding sanity checking if local_network happens to never be set. Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 3 08:42:37 2009 @@ -4489,7 +4489,8 @@ tech_pvt->remote_ip = switch_core_session_strdup(session, network_ip); tech_pvt->remote_port = network_port; - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) { + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && + !switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) { sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url); tech_pvt->user_via = switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport", sofia_glue_transport2str(transport), profile->extsipip); @@ -4689,11 +4690,25 @@ if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) { tech_pvt->reply_contact = switch_core_session_sprintf(session, "", user, host); } else { - const char *url; - if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : - (switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) ? profile->url : profile->public_url)) { + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && + !switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) { + + if (sofia_glue_transport_has_tls(transport)) { + url = profile->tls_public_url; + } else { + url = profile->public_url; + } + + if (strchr(url, '>')) { + tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, + sofia_glue_transport2str(transport)); + } else { + tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", profile->url, + sofia_glue_transport2str(transport)); + } + } else if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url)) { if (strchr(url, '>')) { tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport)); } else { @@ -4706,8 +4721,24 @@ } } else { const char *url; - - if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url)) { + + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && + !switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) { + + if (sofia_glue_transport_has_tls(transport)) { + url = profile->tls_public_url; + } else { + url = profile->public_url; + } + + if (strchr(url, '>')) { + tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, + sofia_glue_transport2str(transport)); + } else { + tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url, + sofia_glue_transport2str(transport)); + } + } else if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url)) { if (strchr(url, '>')) { tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport)); } else { @@ -4718,7 +4749,7 @@ } } } - + if (sip->sip_contact && sip->sip_contact->m_url) { const char *contact_uri = url_set_chanvars(session, sip->sip_contact->m_url, sip_contact); if (!channel_name) { Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 08:42:37 2009 @@ -666,15 +666,14 @@ } if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - if (tech_pvt->remote_ip && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && + if (tech_pvt->remote_ip && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip); } else { tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip); } } else { - - if (tech_pvt->remote_ip && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && + if (tech_pvt->remote_ip && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip); } else { @@ -716,11 +715,12 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No RTP ports available!\n"); return SWITCH_STATUS_FALSE; } - sdp_port = tech_pvt->local_sdp_video_port; + sdp_port = tech_pvt->local_sdp_video_port; if (tech_pvt->profile->extrtpip) { - if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &ip, &sdp_port, tech_pvt->profile->extrtpip, switch_core_session_get_pool(tech_pvt->session)) != + if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &ip, &sdp_port, tech_pvt->profile->extrtpip, + switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; } @@ -728,7 +728,8 @@ tech_pvt->adv_sdp_video_port = sdp_port; - if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && + !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP); } @@ -1285,7 +1286,7 @@ const char* format; const char *alt = NULL; - if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT)) { + if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network) { sipip = (switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) ? tech_pvt->profile->sipip : tech_pvt->profile->extsipip; } else { @@ -1399,7 +1400,8 @@ } } - if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && + !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { const char *transport = sofia_glue_transport2str(tech_pvt->transport); tech_pvt->user_via = switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport", transport, tech_pvt->profile->extsipip); @@ -1417,7 +1419,7 @@ char *ip_addr; char *ipv6; - if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT)) { + if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network) { ip_addr = (switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) ? tech_pvt->profile->sipip : tech_pvt->profile->extsipip; } else { @@ -1438,7 +1440,7 @@ if (sofia_glue_transport_has_tls(tech_pvt->transport)) { tech_pvt->invite_contact = tech_pvt->profile->tls_url; } else { - if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && + if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { tech_pvt->invite_contact = tech_pvt->profile->public_url; } else { @@ -1692,7 +1694,7 @@ switch_mutex_lock(tech_pvt->sofia_mutex); caller_profile = switch_channel_get_caller_profile(channel); - if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT)) { + if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network) { sipip = (switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) ? tech_pvt->profile->sipip : tech_pvt->profile->extsipip; contact_url = tech_pvt->profile->public_url; @@ -1829,7 +1831,7 @@ switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_audio_port); } - if (tech_pvt->local_sdp_audio_port > 0 && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && + if (tech_pvt->local_sdp_audio_port > 0 && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { switch_nat_del_mapping((switch_port_t)tech_pvt->local_sdp_audio_port, SWITCH_NAT_UDP); } @@ -1840,7 +1842,7 @@ switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_video_port); } - if (tech_pvt->local_sdp_video_port > 0 && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && + if (tech_pvt->local_sdp_video_port > 0 && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { switch_nat_del_mapping((switch_port_t)tech_pvt->local_sdp_video_port, SWITCH_NAT_UDP); } Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Wed Jun 3 08:42:37 2009 @@ -1417,13 +1417,17 @@ } } - id = switch_mprintf("sip:%s@%s", sub_to_user, switch_check_network_list_ip(network_ip, profile->local_network) ? sub_to_host : profile->extsipip); + id = switch_mprintf("sip:%s@%s", sub_to_user, (profile->local_network && switch_check_network_list_ip(network_ip, profile->local_network)) + ? sub_to_host : profile->extsipip); contact = sofia_glue_get_url_from_contact(o_contact, 1); if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, profile->local_network)) { char *ptr = NULL; const char *transport_str = NULL; + + id = switch_mprintf("sip:%s@%s", sub_to_user, profile->extsipip); + if ((ptr = sofia_glue_find_parameter(o_contact, "transport="))) { sofia_transport_t transport = sofia_glue_str2transport(ptr); transport_str = sofia_glue_transport2str(transport); @@ -1443,6 +1447,7 @@ } } else { contact_str = profile->url; + id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host); } if ((route = strstr(contact, ";fs_path=")) && (route = strdup(route + 9))) { From anthm at freeswitch.org Wed Jun 3 06:45:13 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 08:45:13 -0500 Subject: [Freeswitch-svn] [commit] r13566 - freeswitch/trunk/src/mod/applications/mod_cluechoo Message-ID: Author: anthm Date: Wed Jun 3 08:45:12 2009 New Revision: 13566 Log: fix compiler warning Modified: freeswitch/trunk/src/mod/applications/mod_cluechoo/mod_cluechoo.c Modified: freeswitch/trunk/src/mod/applications/mod_cluechoo/mod_cluechoo.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_cluechoo/mod_cluechoo.c (original) +++ freeswitch/trunk/src/mod/applications/mod_cluechoo/mod_cluechoo.c Wed Jun 3 08:45:12 2009 @@ -42,10 +42,10 @@ */ SWITCH_MODULE_DEFINITION(mod_cluechoo, mod_cluechoo_load, mod_cluechoo_shutdown, NULL); -int add_D51(); -int add_sl(); -int add_man(); -int add_smoke(); +int add_D51(int x); +int add_sl(int x); +int add_man(int y, int x); +int add_smoke(int y, int x); int go(int i); int vgo(int i, switch_core_session_t *session); From brian at freeswitch.org Wed Jun 3 07:25:36 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 09:25:36 -0500 Subject: [Freeswitch-svn] [commit] r13567 - in freeswitch/trunk: conf/autoload_configs src/mod/event_handlers/mod_event_socket Message-ID: Author: brian Date: Wed Jun 3 09:25:35 2009 New Revision: 13567 Log: adding nat-map option to mod_event_socket Modified: freeswitch/trunk/conf/autoload_configs/event_socket.conf.xml freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Modified: freeswitch/trunk/conf/autoload_configs/event_socket.conf.xml ============================================================================== --- freeswitch/trunk/conf/autoload_configs/event_socket.conf.xml (original) +++ freeswitch/trunk/conf/autoload_configs/event_socket.conf.xml Wed Jun 3 09:25:35 2009 @@ -1,5 +1,6 @@ + Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c ============================================================================== --- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original) +++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Wed Jun 3 09:25:35 2009 @@ -115,6 +115,7 @@ char *acl[MAX_ACL]; uint32_t acl_count; uint32_t id; + int nat_map; } prefs; @@ -2211,6 +2212,10 @@ set_pref_ip(val); } else if (!strcmp(var, "debug")) { globals.debug = atoi(val); + } else if (!strcmp(var, "nat-map")) { + if (switch_true(val)) { + prefs.nat_map = 1; + } } else if (!strcmp(var, "listen-port")) { prefs.port = (uint16_t) atoi(val); } else if (!strcmp(var, "password")) { @@ -2235,6 +2240,10 @@ set_pref_pass("ClueCon"); } + if (!prefs.nat_map) { + prefs.nat_map = 0; + } + if (!prefs.port) { prefs.port = 8021; } @@ -2276,6 +2285,11 @@ if (rv) goto sock_fail; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket up listening on %s:%u\n", prefs.ip, prefs.port); + + if (prefs.nat_map) { + switch_nat_add_mapping(prefs.port, SWITCH_NAT_TCP); + } + break; sock_fail: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error! Could not listen on %s:%u\n", prefs.ip, prefs.port); @@ -2326,6 +2340,10 @@ } close_socket(&listen_list.sock); + + if (prefs.nat_map) { + switch_nat_del_mapping(prefs.port, SWITCH_NAT_TCP); + } if (pool) { switch_core_destroy_memory_pool(&pool); From brian at freeswitch.org Wed Jun 3 07:33:32 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 09:33:32 -0500 Subject: [Freeswitch-svn] [commit] r13568 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 09:33:32 2009 New Revision: 13568 Log: adding nat detection to the gateways now Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Wed Jun 3 09:33:32 2009 @@ -2550,6 +2550,7 @@ if (!strncasecmp(profile_name, "gateway", 7)) { char *gw, *params; sofia_gateway_t *gateway_ptr = NULL; + char *dup_dest = NULL, *dest_host, *dest_user; if (!(gw = strchr(profile_name, '/'))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n"); @@ -2632,6 +2633,12 @@ tech_pvt->invite_contact = switch_core_session_strdup(nsession, gateway_ptr->register_contact); } + dup_dest = strdup(dest); + switch_assert(dup_dest != NULL); + sofia_glue_get_user_host(dup_dest, &dest_user, &dest_host); + tech_pvt->remote_ip = switch_core_session_sprintf(nsession, "%s", dest_host); + switch_safe_free(dup_dest); + gateway_ptr->ob_calls++; if (gateway_ptr->ob_vars) { @@ -2645,7 +2652,6 @@ } else { char *dup_dest = NULL, *dest_host, *dest_user; - if (!(dest = strchr(profile_name, '/'))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n"); @@ -2669,7 +2675,7 @@ sofia_glue_get_user_host(dup_dest, &dest_user, &dest_host); tech_pvt->remote_ip = switch_core_session_sprintf(nsession, "%s", dest_host); switch_safe_free(dup_dest); - + if (!strncasecmp(dest, "sip:", 4) || !strncasecmp(dest, "sips:", 5)) { tech_pvt->dest = switch_core_session_strdup(nsession, dest); } else if ((host = strchr(dest, '%'))) { From brian at freeswitch.org Wed Jun 3 07:36:38 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 09:36:38 -0500 Subject: [Freeswitch-svn] [commit] r13569 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 09:36:38 2009 New Revision: 13569 Log: adding addition sanity check Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Wed Jun 3 09:36:38 2009 @@ -1422,7 +1422,8 @@ contact = sofia_glue_get_url_from_contact(o_contact, 1); - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, profile->local_network)) { + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && + !switch_check_network_list_ip(network_ip, profile->local_network)) { char *ptr = NULL; const char *transport_str = NULL; From brian at freeswitch.org Wed Jun 3 08:05:27 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 10:05:27 -0500 Subject: [Freeswitch-svn] [commit] r13570 - in freeswitch/branches/brian/trunk: conf/autoload_configs src/mod/applications/mod_cluechoo src/mod/event_handlers/mod_event_socket Message-ID: Author: brian Date: Wed Jun 3 10:05:27 2009 New Revision: 13570 Log: trunk Modified: freeswitch/branches/brian/trunk/conf/autoload_configs/event_socket.conf.xml freeswitch/branches/brian/trunk/src/mod/applications/mod_cluechoo/mod_cluechoo.c freeswitch/branches/brian/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Modified: freeswitch/branches/brian/trunk/conf/autoload_configs/event_socket.conf.xml ============================================================================== --- freeswitch/branches/brian/trunk/conf/autoload_configs/event_socket.conf.xml (original) +++ freeswitch/branches/brian/trunk/conf/autoload_configs/event_socket.conf.xml Wed Jun 3 10:05:27 2009 @@ -1,5 +1,6 @@ + Modified: freeswitch/branches/brian/trunk/src/mod/applications/mod_cluechoo/mod_cluechoo.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/applications/mod_cluechoo/mod_cluechoo.c (original) +++ freeswitch/branches/brian/trunk/src/mod/applications/mod_cluechoo/mod_cluechoo.c Wed Jun 3 10:05:27 2009 @@ -42,10 +42,10 @@ */ SWITCH_MODULE_DEFINITION(mod_cluechoo, mod_cluechoo_load, mod_cluechoo_shutdown, NULL); -int add_D51(); -int add_sl(); -int add_man(); -int add_smoke(); +int add_D51(int x); +int add_sl(int x); +int add_man(int y, int x); +int add_smoke(int y, int x); int go(int i); int vgo(int i, switch_core_session_t *session); Modified: freeswitch/branches/brian/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original) +++ freeswitch/branches/brian/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Wed Jun 3 10:05:27 2009 @@ -115,6 +115,7 @@ char *acl[MAX_ACL]; uint32_t acl_count; uint32_t id; + int nat_map; } prefs; @@ -2211,6 +2212,10 @@ set_pref_ip(val); } else if (!strcmp(var, "debug")) { globals.debug = atoi(val); + } else if (!strcmp(var, "nat-map")) { + if (switch_true(val)) { + prefs.nat_map = 1; + } } else if (!strcmp(var, "listen-port")) { prefs.port = (uint16_t) atoi(val); } else if (!strcmp(var, "password")) { @@ -2235,6 +2240,10 @@ set_pref_pass("ClueCon"); } + if (!prefs.nat_map) { + prefs.nat_map = 0; + } + if (!prefs.port) { prefs.port = 8021; } @@ -2276,6 +2285,11 @@ if (rv) goto sock_fail; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket up listening on %s:%u\n", prefs.ip, prefs.port); + + if (prefs.nat_map) { + switch_nat_add_mapping(prefs.port, SWITCH_NAT_TCP); + } + break; sock_fail: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error! Could not listen on %s:%u\n", prefs.ip, prefs.port); @@ -2326,6 +2340,10 @@ } close_socket(&listen_list.sock); + + if (prefs.nat_map) { + switch_nat_del_mapping(prefs.port, SWITCH_NAT_TCP); + } if (pool) { switch_core_destroy_memory_pool(&pool); From brian at freeswitch.org Wed Jun 3 08:33:18 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 10:33:18 -0500 Subject: [Freeswitch-svn] [commit] r13571 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 10:33:17 2009 New Revision: 13571 Log: dont' leak Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Wed Jun 3 10:33:17 2009 @@ -469,6 +469,7 @@ free(contact_url); } + switch_safe_free(user_via); switch_safe_free(id); } From brian at freeswitch.org Wed Jun 3 08:43:34 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 10:43:34 -0500 Subject: [Freeswitch-svn] [commit] r13572 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 10:43:34 2009 New Revision: 13572 Log: port Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 3 10:43:34 2009 @@ -764,10 +764,10 @@ if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { if (switch_nat_add_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created UDP nat mapping for %s\n", profile->name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created UDP nat mapping for %s port %d\n", profile->name, profile->sip_port); } if (switch_nat_add_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP nat mapping for %s\n", profile->name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP nat mapping for %s port %d\n", profile->name, profile->sip_port); } } From mikej at freeswitch.org Wed Jun 3 08:43:41 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 10:43:41 -0500 Subject: [Freeswitch-svn] [commit] r13573 - freeswitch/trunk/src/include Message-ID: Author: mikej Date: Wed Jun 3 10:43:41 2009 New Revision: 13573 Log: fix msvc function tagging for code analysis Modified: freeswitch/trunk/src/include/switch_utils.h Modified: freeswitch/trunk/src/include/switch_utils.h ============================================================================== --- freeswitch/trunk/src/include/switch_utils.h (original) +++ freeswitch/trunk/src/include/switch_utils.h Wed Jun 3 10:43:41 2009 @@ -172,7 +172,7 @@ \return SWITCH_STATUS_SUCCESSS for success, otherwise failure */ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(_Out_opt_bytecapcount_(len) - char *buf, _In_ int len, _In_ int *mask, _In_ int family); + char *buf, _In_ int len, _In_opt_ int *mask, _In_ int family); /*! \brief find the char representation of an ip adress From brian at freeswitch.org Wed Jun 3 08:44:31 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 10:44:31 -0500 Subject: [Freeswitch-svn] [commit] r13574 - freeswitch/branches/brian/trunk/src/include Message-ID: Author: brian Date: Wed Jun 3 10:44:31 2009 New Revision: 13574 Log: merge trunk Modified: freeswitch/branches/brian/trunk/src/include/switch_utils.h Modified: freeswitch/branches/brian/trunk/src/include/switch_utils.h ============================================================================== --- freeswitch/branches/brian/trunk/src/include/switch_utils.h (original) +++ freeswitch/branches/brian/trunk/src/include/switch_utils.h Wed Jun 3 10:44:31 2009 @@ -172,7 +172,7 @@ \return SWITCH_STATUS_SUCCESSS for success, otherwise failure */ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(_Out_opt_bytecapcount_(len) - char *buf, _In_ int len, _In_ int *mask, _In_ int family); + char *buf, _In_ int len, _In_opt_ int *mask, _In_ int family); /*! \brief find the char representation of an ip adress From brian at freeswitch.org Wed Jun 3 09:35:08 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 11:35:08 -0500 Subject: [Freeswitch-svn] [commit] r13575 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 11:35:08 2009 New Revision: 13575 Log: cleanup by mike and bkw Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Wed Jun 3 11:35:08 2009 @@ -2550,7 +2550,6 @@ if (!strncasecmp(profile_name, "gateway", 7)) { char *gw, *params; sofia_gateway_t *gateway_ptr = NULL; - char *dup_dest = NULL, *dest_host, *dest_user; if (!(gw = strchr(profile_name, '/'))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n"); @@ -2633,12 +2632,6 @@ tech_pvt->invite_contact = switch_core_session_strdup(nsession, gateway_ptr->register_contact); } - dup_dest = strdup(dest); - switch_assert(dup_dest != NULL); - sofia_glue_get_user_host(dup_dest, &dest_user, &dest_host); - tech_pvt->remote_ip = switch_core_session_sprintf(nsession, "%s", dest_host); - switch_safe_free(dup_dest); - gateway_ptr->ob_calls++; if (gateway_ptr->ob_vars) { @@ -2651,8 +2644,6 @@ } } else { - char *dup_dest = NULL, *dest_host, *dest_user; - if (!(dest = strchr(profile_name, '/'))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n"); cause = SWITCH_CAUSE_INVALID_NUMBER_FORMAT; @@ -2670,12 +2661,6 @@ profile_name = profile->domain_name; } - dup_dest = strdup(dest); - switch_assert(dup_dest != NULL); - sofia_glue_get_user_host(dup_dest, &dest_user, &dest_host); - tech_pvt->remote_ip = switch_core_session_sprintf(nsession, "%s", dest_host); - switch_safe_free(dup_dest); - if (!strncasecmp(dest, "sip:", 4) || !strncasecmp(dest, "sips:", 5)) { tech_pvt->dest = switch_core_session_strdup(nsession, dest); } else if ((host = strchr(dest, '%'))) { @@ -2711,6 +2696,8 @@ } } + sofia_glue_get_user_host(switch_core_session_strdup(nsession, tech_pvt->dest), NULL, &tech_pvt->remote_ip); + if (dest_to) { if (strchr(dest_to, '@')) { tech_pvt->dest_to = switch_core_session_sprintf(nsession, "sip:%s", dest_to); Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 11:35:08 2009 @@ -4038,7 +4038,10 @@ { char *p, *h, *u = in; - *user = NULL; + if (user) { + *user = NULL; + } + *host = NULL; /* First isolate the host part from the user part */ @@ -4049,7 +4052,7 @@ } /* Clean out the user part of its protocol prefix (if any) */ - if ((p = strchr(u, ':'))) { + if (user && (p = strchr(u, ':'))) { *p++ = '\0'; u = p; } @@ -4067,7 +4070,10 @@ *p = '\0'; } + if (user) { *user = u; + } + *host = h; return 1; From brian at freeswitch.org Wed Jun 3 09:40:18 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 11:40:18 -0500 Subject: [Freeswitch-svn] [commit] r13576 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 11:40:18 2009 New Revision: 13576 Log: fix debug Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 3 11:40:18 2009 @@ -915,10 +915,10 @@ if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { if (switch_nat_del_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted UDP nat mapping for %s\n", profile->name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted UDP nat mapping for %s port %d\n", profile->name, profile->sip_port); } if (switch_nat_del_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP nat mapping for %s\n", profile->name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP nat mapping for %s port %d\n", profile->name, profile->sip_port); } } From brian at freeswitch.org Wed Jun 3 10:30:50 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 12:30:50 -0500 Subject: [Freeswitch-svn] [commit] r13577 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 12:30:49 2009 New Revision: 13577 Log: cleanup by mike and bkw Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 3 12:30:49 2009 @@ -4491,8 +4491,8 @@ if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && !switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) { - sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url); - tech_pvt->user_via = switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport", sofia_glue_transport2str(transport), + tech_pvt->user_via = switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport", + sofia_glue_transport2str(sofia_glue_url2transport(sip->sip_contact->m_url)), profile->extsipip); } @@ -4690,17 +4690,17 @@ if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) { tech_pvt->reply_contact = switch_core_session_sprintf(session, "", user, host); } else { - const char *url; + const char *url = NULL; if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && !switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) { - - if (sofia_glue_transport_has_tls(transport)) { - url = profile->tls_public_url; - } else { - url = profile->public_url; - } + url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url; + } else { + url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url; + } + + if (url) { if (strchr(url, '>')) { tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport)); @@ -4708,42 +4708,30 @@ tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", profile->url, sofia_glue_transport2str(transport)); } - } else if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url)) { - if (strchr(url, '>')) { - tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport)); - } else { - tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url, sofia_glue_transport2str(transport)); - } } else { switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); } } } } else { - const char *url; - + const char *url = NULL; + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && !switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) { - if (sofia_glue_transport_has_tls(transport)) { - url = profile->tls_public_url; - } else { - url = profile->public_url; - } - + url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url; + } else { + url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url; + } + + if (url) { if (strchr(url, '>')) { tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport)); } else { - tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url, + tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", profile->url, sofia_glue_transport2str(transport)); } - } else if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url)) { - if (strchr(url, '>')) { - tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport)); - } else { - tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url, sofia_glue_transport2str(transport)); - } } else { switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); } Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 12:30:49 2009 @@ -665,28 +665,16 @@ } } - if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - if (tech_pvt->remote_ip && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && - !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { - tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip); - } else { - tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip); - } + if (tech_pvt->remote_ip && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && + !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip); + switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP); } else { - if (tech_pvt->remote_ip && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && - !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { - tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip); - } else { - tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip); - } + tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip); } - + tech_pvt->adv_sdp_audio_port = sdp_port; - if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { - switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP); - } - switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port); switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip); switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, tmp); From brian at freeswitch.org Wed Jun 3 10:52:05 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 12:52:05 -0500 Subject: [Freeswitch-svn] [commit] r13578 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 12:52:05 2009 New Revision: 13578 Log: cleanup by mike and bkw Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Wed Jun 3 12:52:05 2009 @@ -1417,9 +1417,6 @@ } } - id = switch_mprintf("sip:%s@%s", sub_to_user, (profile->local_network && switch_check_network_list_ip(network_ip, profile->local_network)) - ? sub_to_host : profile->extsipip); - contact = sofia_glue_get_url_from_contact(o_contact, 1); if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && @@ -1432,20 +1429,26 @@ if ((ptr = sofia_glue_find_parameter(o_contact, "transport="))) { sofia_transport_t transport = sofia_glue_str2transport(ptr); transport_str = sofia_glue_transport2str(transport); + + switch (transport) { + case SOFIA_TRANSPORT_TCP: + contact_str = profile->tcp_public_contact; + break; + case SOFIA_TRANSPORT_TCP_TLS: + contact_str = profile->tls_public_contact; + break; + default: + contact_str = profile->public_url; + break; + } + user_via = switch_mprintf("SIP/2.0/%s %s;rport", transport_str, profile->extsipip); + } else { user_via = switch_mprintf("SIP/2.0/UDP %s;rport", profile->extsipip); - } - - if (switch_stristr("udp", transport_str)) { - contact_str = profile->public_url; - } else if (switch_stristr("tcp", transport_str)) { - contact_str = profile->tcp_public_contact; - } else if (switch_stristr("tls", transport_str)) { - contact_str = profile->tls_public_contact; - } else { contact_str = profile->public_url; } + } else { contact_str = profile->url; id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host); @@ -1496,7 +1499,7 @@ nua_notify(nh, NUTAG_NEWSUB(1), TAG_IF(route_uri, NUTAG_PROXY(route_uri)), - TAG_IF(!switch_strlen_zero(user_via), SIPTAG_VIA_STR(user_via)), + TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END()); @@ -1505,6 +1508,7 @@ switch_safe_free(id); switch_safe_free(route); switch_safe_free(user_via); + if (ext_profile) { sofia_glue_release_profile(ext_profile); } @@ -1558,7 +1562,8 @@ get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port); - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, profile->local_network)) { + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && + !switch_check_network_list_ip(network_ip, profile->local_network)) { is_auto_nat = 1; } @@ -1663,8 +1668,6 @@ } } - - if (to) { to_str = switch_mprintf("sip:%s@%s", to->a_url->url_user, to->a_url->url_host); } Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Wed Jun 3 12:52:05 2009 @@ -425,26 +425,34 @@ *p = '\0'; } - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, profile->local_network)) { + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && + !switch_check_network_list_ip(network_ip, profile->local_network)) { char *ptr = NULL; const char *transport_str = NULL; + if ((ptr = sofia_glue_find_parameter(contact_url, "transport="))) { sofia_transport_t transport = sofia_glue_str2transport(ptr); transport_str = sofia_glue_transport2str(transport); - user_via = switch_mprintf("SIP/2.0/%s %s;rport", transport_str, profile->extsipip); + + switch (transport) { + case SOFIA_TRANSPORT_TCP: + contact_str = profile->tcp_public_contact; + break; + case SOFIA_TRANSPORT_TCP_TLS: + contact_str = profile->tls_public_contact; + break; + default: + contact_str = profile->public_url; + break; + } + + user_via = switch_mprintf("SIP/2.0/%s %s;rport", transport_str, profile->extsipip); + } else { user_via = switch_mprintf("SIP/2.0/UDP %s;rport", profile->extsipip); - } - - if (switch_stristr("udp", transport_str)) { - contact_str = profile->public_url; - } else if (switch_stristr("tcp", transport_str)) { - contact_str = profile->tcp_public_contact; - } else if (switch_stristr("tls", transport_str)) { - contact_str = profile->tls_public_contact; - } else { contact_str = profile->public_url; } + } else { contact_str = profile->url; } @@ -459,7 +467,7 @@ nua_handle_bind(nh, &mod_sofia_globals.destroy_private); nua_notify(nh, NUTAG_NEWSUB(1), - TAG_IF(!switch_strlen_zero(user_via), SIPTAG_VIA_STR(user_via)), + TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(""), From mikej at freeswitch.org Wed Jun 3 11:16:52 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 13:16:52 -0500 Subject: [Freeswitch-svn] [commit] r13579 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: mikej Date: Wed Jun 3 13:16:51 2009 New Revision: 13579 Log: factor out helper function for getting ip address information from a msg_t sofia_glue_get_addr() Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Wed Jun 3 13:16:51 2009 @@ -885,3 +885,4 @@ sofia_cid_type_t sofia_cid_name2type(const char *name); void sofia_glue_tech_set_local_sdp(private_object_t *tech_pvt, const char *sdp_str, switch_bool_t dup); void sofia_glue_set_rtp_stats(private_object_t *tech_pvt); +void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port); Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 3 13:16:51 2009 @@ -406,8 +406,7 @@ if (authorization) { char network_ip[80]; - su_addrinfo_t *addrinfo = msg_addrinfo(nua_current_request(nua)); - get_addr(network_ip, sizeof(network_ip), addrinfo->ai_addr, addrinfo->ai_addrlen); + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), NULL); auth_res = sofia_reg_parse_auth(profile, authorization, sip, (char *) sip->sip_request->rq_method_name, tech_pvt->key, strlen(tech_pvt->key), network_ip, NULL, 0, REG_INVITE, NULL, NULL); @@ -2833,13 +2832,11 @@ const char *uuid; switch_core_session_t *other_session; private_object_t *tech_pvt = switch_core_session_get_private(session); - su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); char network_ip[80]; int network_port = 0; switch_caller_profile_t *caller_profile = NULL; - get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); - network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port); + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); switch_channel_set_variable(channel, "sip_reply_host", network_ip); switch_channel_set_variable_printf(channel, "sip_reply_port", "%d", network_port); @@ -4341,7 +4338,6 @@ uint32_t sess_count = switch_core_session_count(); uint32_t sess_max = switch_core_session_limit(0); int is_auth = 0, calling_myself = 0; - su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); int network_port = 0; char *is_nat = NULL; char acl_token[512] = ""; @@ -4365,9 +4361,7 @@ goto fail; } - get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); - network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port); - + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) { if (sip && sip->sip_via) { Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 13:16:51 2009 @@ -830,6 +830,18 @@ } } +void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port) { + su_addrinfo_t *addrinfo = msg_addrinfo(msg); + + if (buf) { + get_addr(buf, buflen, addrinfo->ai_addr, addrinfo->ai_addrlen); + } + + if (port) { + *port = get_port(addrinfo->ai_addr); + } +} + char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const sofia_transport_t transport, switch_bool_t uri_only, const char *params) { Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Wed Jun 3 13:16:51 2009 @@ -764,19 +764,17 @@ char *force_user; char received_data[128] = ""; char *path_val = NULL; - su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); switch_event_t *auth_params = NULL; int r = 0; /* all callers must confirm that sip, sip->sip_request and sip->sip_contact are not NULL */ switch_assert(sip != NULL && sip->sip_contact != NULL && sip->sip_request != NULL); - get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr,my_addrinfo->ai_addrlen); - network_port = get_port(my_addrinfo->ai_addr); + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); snprintf(network_port_c, sizeof(network_port_c), "%d", network_port); - snprintf(url_ip, sizeof(url_ip), my_addrinfo->ai_addr->sa_family == AF_INET6 ? "[%s]" : "%s", network_ip); + snprintf(url_ip, sizeof(url_ip), (msg_addrinfo(nua_current_request(nua)))->ai_addr->sa_family == AF_INET6 ? "[%s]" : "%s", network_ip); expires = sip->sip_expires; authorization = sip->sip_authorization; @@ -1281,22 +1279,17 @@ } - void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]) { char key[128] = ""; switch_event_t *v_event = NULL; char network_ip[80]; - su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); sofia_regtype_t type = REG_REGISTER; int network_port = 0; char *is_nat = NULL; - - get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); - network_port = get_port(msg_addrinfo(nua_current_request(nua))->ai_addr); - + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); if (!(sip->sip_contact && sip->sip_contact->m_url)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n"); Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Wed Jun 3 13:16:51 2009 @@ -76,12 +76,10 @@ struct sla_helper sh = { { 0 } }; char *contact_str = strip_uri(full_contact); sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url); - su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); char network_ip[80]; int network_port = 0; - get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); - network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port); + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); sql = switch_mprintf("select call_id from sip_shared_appearance_dialogs where hostname='%q' and profile_name='%q' and contact_str='%q'", mod_sofia_globals.hostname, profile->name, contact_str); @@ -136,14 +134,11 @@ char *sql = NULL; char *route_uri = NULL; char *sla_contact = NULL; - su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); char network_ip[80]; int network_port = 0; sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url); - - get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); - network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port); + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); /* * XXX MTK FIXME - we don't look at the tag to see if NUTAG_SUBSTATE(nua_substate_terminated) or * a Subscription-State header with state "terminated" and/or expiration of 0. So we never forget From mikej at freeswitch.org Wed Jun 3 11:21:03 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 13:21:03 -0500 Subject: [Freeswitch-svn] [commit] r13580 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: mikej Date: Wed Jun 3 13:21:03 2009 New Revision: 13580 Log: factor out helper function for getting ip address information from a msg_t sofia_glue_get_addr() Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Wed Jun 3 13:21:03 2009 @@ -1544,7 +1544,6 @@ switch_event_t *sevent; int sub_state; int sent_reply = 0; - su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); int network_port = 0; char network_ip[80]; const char *contact_host, *contact_user; @@ -1559,8 +1558,7 @@ return; } - get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); - network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port); + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && !switch_check_network_list_ip(network_ip, profile->local_network)) { From brian at freeswitch.org Wed Jun 3 12:02:16 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 14:02:16 -0500 Subject: [Freeswitch-svn] [commit] r13581 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 14:02:16 2009 New Revision: 13581 Log: refactor and clean up Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Wed Jun 3 14:02:16 2009 @@ -830,7 +830,7 @@ const char *sofia_glue_transport2str(const sofia_transport_t tp); char * sofia_glue_find_parameter(const char *str, const char *param); - +int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip); int sofia_glue_transport_has_tls(const sofia_transport_t tp); const char *sofia_glue_get_unknown_header(sip_t const *sip, const char *name); switch_status_t sofia_glue_build_crypto(private_object_t *tech_pvt, int index, switch_rtp_crypto_key_type_t type, switch_rtp_crypto_direction_t direction); Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 14:02:16 2009 @@ -665,9 +665,8 @@ } } - if (tech_pvt->remote_ip && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && - !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { - tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip); + if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { + tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip); switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP); } else { tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip); @@ -716,8 +715,7 @@ tech_pvt->adv_sdp_video_port = sdp_port; - if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && - !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP); } @@ -819,6 +817,14 @@ } } +int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip) +{ + return (network_ip && + profile->local_network && + sofia_test_pflag(profile, PFLAG_AUTO_NAT) && + !switch_check_network_list_ip(network_ip, profile->local_network)); +} + int sofia_glue_transport_has_tls(const sofia_transport_t tp) { switch (tp) { @@ -1286,9 +1292,8 @@ const char* format; const char *alt = NULL; - if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network) { - sipip = (switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) - ? tech_pvt->profile->sipip : tech_pvt->profile->extsipip; + if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->profile->local_network)) { + sipip = tech_pvt->profile->extsipip; } else { sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; } @@ -1400,8 +1405,7 @@ } } - if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && - !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { const char *transport = sofia_glue_transport2str(tech_pvt->transport); tech_pvt->user_via = switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport", transport, tech_pvt->profile->extsipip); @@ -1419,7 +1423,7 @@ char *ip_addr; char *ipv6; - if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network) { + if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { ip_addr = (switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) ? tech_pvt->profile->sipip : tech_pvt->profile->extsipip; } else { @@ -1440,8 +1444,7 @@ if (sofia_glue_transport_has_tls(tech_pvt->transport)) { tech_pvt->invite_contact = tech_pvt->profile->tls_url; } else { - if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && - !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { tech_pvt->invite_contact = tech_pvt->profile->public_url; } else { tech_pvt->invite_contact = tech_pvt->profile->url; @@ -1694,9 +1697,8 @@ switch_mutex_lock(tech_pvt->sofia_mutex); caller_profile = switch_channel_get_caller_profile(channel); - if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network) { - sipip = (switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) - ? tech_pvt->profile->sipip : tech_pvt->profile->extsipip; + if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { + sipip = tech_pvt->profile->extsipip; contact_url = tech_pvt->profile->public_url; } else { sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; @@ -1831,8 +1833,7 @@ switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_audio_port); } - if (tech_pvt->local_sdp_audio_port > 0 && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && - !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + if (tech_pvt->local_sdp_audio_port > 0 && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { switch_nat_del_mapping((switch_port_t)tech_pvt->local_sdp_audio_port, SWITCH_NAT_UDP); } @@ -1842,8 +1843,8 @@ switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_video_port); } - if (tech_pvt->local_sdp_video_port > 0 && sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT) && tech_pvt->profile->local_network && - !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + + if (tech_pvt->local_sdp_video_port > 0 && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { switch_nat_del_mapping((switch_port_t)tech_pvt->local_sdp_video_port, SWITCH_NAT_UDP); } } Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Wed Jun 3 14:02:16 2009 @@ -103,7 +103,7 @@ nua_handle_bind(nh, &mod_sofia_globals.keep_private); switch_snprintf(exp_str, sizeof(exp_str), "%ld", exptime + 30); - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, profile->local_network)) { + if (sofia_glue_check_nat(profile, network_ip)) { switch_snprintf(my_contact, sizeof(my_contact), ";expires=%s", profile->sla_contact, profile->extsipip, sofia_glue_transport2str(transport), exp_str); } else { @@ -200,11 +200,10 @@ *p++ = '\0'; } } - - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, profile->local_network)) { + if (sofia_glue_check_nat(profile, network_ip)) { sla_contact = switch_mprintf("", profile->sla_contact, profile->extsipip, sofia_glue_transport2str(transport)); } else { - sla_contact = switch_mprintf("", profile->sla_contact, profile->extsipip, sofia_glue_transport2str(transport)); + sla_contact = switch_mprintf("", profile->sla_contact, profile->sipip, sofia_glue_transport2str(transport)); } nua_respond(nh, SIP_202_ACCEPTED, SIPTAG_CONTACT_STR(sla_contact), NUTAG_WITH_THIS(nua), @@ -337,6 +336,7 @@ nua_handle_t *nh; char *route_uri = NULL; char *xml_fixup = NULL; + char *fixup = NULL; nh = nua_handle_by_call_id(helper->profile->nua, call_id); /* that's all you need to find the subscription's nh */ if (nh) { @@ -359,11 +359,14 @@ *p++ = '\0'; } } - - if (sofia_test_pflag(helper->profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, helper->profile->local_network)) { - xml_fixup = switch_string_replace(helper->payload, helper->profile->sipip, helper->profile->extsipip); - } else if (sofia_test_pflag(helper->profile, PFLAG_AUTO_NAT) && switch_check_network_list_ip(network_ip, helper->profile->local_network)) { - xml_fixup = switch_string_replace(helper->payload, helper->profile->extsipip, helper->profile->sipip); + + if (sofia_test_pflag(helper->profile, PFLAG_AUTO_NAT)) { + if (sofia_glue_check_nat(helper->profile, network_ip)) { + fixup = switch_string_replace(helper->payload, helper->profile->sipip, helper->profile->extsipip); + } else { + fixup = switch_string_replace(helper->payload, helper->profile->extsipip, helper->profile->sipip); + } + xml_fixup = fixup; } else { xml_fixup = helper->payload; } @@ -375,7 +378,7 @@ SIPTAG_PAYLOAD_STR(xml_fixup), TAG_END()); switch_safe_free(route_uri); - switch_safe_free(xml_fixup); + switch_safe_free(fixup); } return 0; } From brian at freeswitch.org Wed Jun 3 12:07:52 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 14:07:52 -0500 Subject: [Freeswitch-svn] [commit] r13582 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 14:07:52 2009 New Revision: 13582 Log: missed these Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 3 14:07:52 2009 @@ -4482,9 +4482,7 @@ tech_pvt->remote_ip = switch_core_session_strdup(session, network_ip); tech_pvt->remote_port = network_port; - - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && - !switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) { + if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) { tech_pvt->user_via = switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport", sofia_glue_transport2str(sofia_glue_url2transport(sip->sip_contact->m_url)), profile->extsipip); @@ -4686,9 +4684,7 @@ } else { const char *url = NULL; - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && - !switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) { - + if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) { url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url; } else { url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url; @@ -4709,11 +4705,8 @@ } } else { const char *url = NULL; - - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && - !switch_check_network_list_ip(tech_pvt->remote_ip, profile->local_network)) { - - url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url; + if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) { + url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url; } else { url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url; } From brian at freeswitch.org Wed Jun 3 12:12:29 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 14:12:29 -0500 Subject: [Freeswitch-svn] [commit] r13583 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 14:12:29 2009 New Revision: 13583 Log: move this down to after the profile has stopped Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 3 14:12:29 2009 @@ -912,15 +912,6 @@ sofia_clear_pflag_locked(profile, PFLAG_RUNNING); - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { - if (switch_nat_del_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted UDP nat mapping for %s port %d\n", profile->name, profile->sip_port); - } - if (switch_nat_del_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP nat mapping for %s port %d\n", profile->name, profile->sip_port); - } - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n"); switch_thread_join(&st, worker_thread); @@ -958,6 +949,15 @@ switch_event_fire(&s_event); } + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + if (switch_nat_del_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted UDP nat mapping for %s port %d\n", profile->name, profile->sip_port); + } + if (switch_nat_del_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP nat mapping for %s port %d\n", profile->name, profile->sip_port); + } + } + sofia_glue_sql_close(profile); su_home_unref(profile->home); su_root_destroy(profile->s_root); From brian at freeswitch.org Wed Jun 3 12:17:11 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 14:17:11 -0500 Subject: [Freeswitch-svn] [commit] r13584 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 14:17:11 2009 New Revision: 13584 Log: enable AUTO_NAT flag when you set ext-rtp-ip or ext-sip-ip Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 3 14:17:11 2009 @@ -2186,10 +2186,10 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip); } else if (!strcasecmp(val, "auto-nat")) { ip = mod_sofia_globals.auto_nat ? switch_core_get_variable("nat_public_addr") : mod_sofia_globals.guess_ip; - sofia_set_pflag(profile, PFLAG_AUTO_NAT); } else { ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip; } + sofia_set_pflag(profile, PFLAG_AUTO_NAT); profile->extrtpip = switch_core_strdup(profile->pool, ip); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ext-rtp-ip\n"); @@ -2224,7 +2224,6 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip); } else if (!strcasecmp(val, "auto-nat")) { ip = mod_sofia_globals.auto_nat ? switch_core_get_variable("nat_public_addr") : mod_sofia_globals.guess_ip; - sofia_set_pflag(profile, PFLAG_AUTO_NAT); } else if (strcasecmp(val, "auto")) { switch_port_t port = 0; if (sofia_glue_ext_address_lookup(profile, NULL, &myip, &port, val, profile->pool) == SWITCH_STATUS_SUCCESS) { @@ -2233,6 +2232,7 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to get external ip.\n"); } } + sofia_set_pflag(profile, PFLAG_AUTO_NAT); profile->extsipip = switch_core_strdup(profile->pool, ip); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ext-sip-ip\n"); From brian at freeswitch.org Wed Jun 3 12:25:27 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 14:25:27 -0500 Subject: [Freeswitch-svn] [commit] r13585 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 14:25:27 2009 New Revision: 13585 Log: adding tls port to auto map Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 3 14:25:27 2009 @@ -768,6 +768,9 @@ if (switch_nat_add_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP nat mapping for %s port %d\n", profile->name, profile->sip_port); } + if(profile->tls_sip_port && switch_nat_add_mapping((switch_port_t)profile->tls_sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP/TLS nat mapping for %s port %d\n", profile->name, profile->tls_sip_port); + } } profile->nua = nua_create(profile->s_root, /* Event loop */ @@ -956,6 +959,9 @@ if (switch_nat_del_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP nat mapping for %s port %d\n", profile->name, profile->sip_port); } + if(profile->tls_sip_port && switch_nat_del_mapping((switch_port_t)profile->tls_sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP/TLS nat mapping for %s port %d\n", profile->name, profile->tls_sip_port); + } } sofia_glue_sql_close(profile); From brian at freeswitch.org Wed Jun 3 12:25:42 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 14:25:42 -0500 Subject: [Freeswitch-svn] [commit] r13586 - freeswitch/trunk/src Message-ID: Author: brian Date: Wed Jun 3 14:25:42 2009 New Revision: 13586 Log: adding loopback.auto Modified: freeswitch/trunk/src/switch_core.c Modified: freeswitch/trunk/src/switch_core.c ============================================================================== --- freeswitch/trunk/src/switch_core.c (original) +++ freeswitch/trunk/src/switch_core.c Wed Jun 3 14:25:42 2009 @@ -904,6 +904,12 @@ switch_network_list_add_cidr(rfc_list, "192.168.0.0/16", SWITCH_TRUE); switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list); + tmp_name = "loopback.auto"; + switch_network_list_create(&rfc_list, tmp_name, SWITCH_FALSE, IP_LIST.pool); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created ip list %s default (deny)\n", tmp_name); + switch_network_list_add_cidr(rfc_list, "127.0.0.0/8", SWITCH_TRUE); + switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list); + tmp_name = "localnet.auto"; switch_network_list_create(&list, tmp_name, SWITCH_FALSE, IP_LIST.pool); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created ip list %s default (deny)\n", tmp_name); From brian at freeswitch.org Wed Jun 3 12:26:35 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 14:26:35 -0500 Subject: [Freeswitch-svn] [commit] r13587 - freeswitch/branches/brian/trunk/src Message-ID: Author: brian Date: Wed Jun 3 14:26:35 2009 New Revision: 13587 Log: merge trunk Modified: freeswitch/branches/brian/trunk/src/switch_core.c Modified: freeswitch/branches/brian/trunk/src/switch_core.c ============================================================================== --- freeswitch/branches/brian/trunk/src/switch_core.c (original) +++ freeswitch/branches/brian/trunk/src/switch_core.c Wed Jun 3 14:26:35 2009 @@ -904,6 +904,12 @@ switch_network_list_add_cidr(rfc_list, "192.168.0.0/16", SWITCH_TRUE); switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list); + tmp_name = "loopback.auto"; + switch_network_list_create(&rfc_list, tmp_name, SWITCH_FALSE, IP_LIST.pool); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created ip list %s default (deny)\n", tmp_name); + switch_network_list_add_cidr(rfc_list, "127.0.0.0/8", SWITCH_TRUE); + switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list); + tmp_name = "localnet.auto"; switch_network_list_create(&list, tmp_name, SWITCH_FALSE, IP_LIST.pool); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created ip list %s default (deny)\n", tmp_name); From mikej at freeswitch.org Wed Jun 3 12:42:35 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 14:42:35 -0500 Subject: [Freeswitch-svn] [commit] r13588 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: mikej Date: Wed Jun 3 14:42:34 2009 New Revision: 13588 Log: don't free helper->payload Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Wed Jun 3 14:42:34 2009 @@ -378,7 +378,9 @@ SIPTAG_PAYLOAD_STR(xml_fixup), TAG_END()); switch_safe_free(route_uri); - switch_safe_free(fixup); + if (fixup && fixup != helper->payload) { + free(fixup); + } } return 0; } From brian at freeswitch.org Wed Jun 3 12:42:53 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 14:42:53 -0500 Subject: [Freeswitch-svn] [commit] r13589 - freeswitch/trunk/src/mod/event_handlers/mod_event_socket Message-ID: Author: brian Date: Wed Jun 3 14:42:53 2009 New Revision: 13589 Log: don't nat map where its loopback Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c ============================================================================== --- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original) +++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Wed Jun 3 14:42:53 2009 @@ -2244,6 +2244,10 @@ prefs.nat_map = 0; } + if (prefs.nat_map && !switch_check_network_list_ip(prefs.ip, "loopback.auto")) { + prefs.nat_map = 0; + } + if (!prefs.port) { prefs.port = 8021; } From brian at freeswitch.org Wed Jun 3 12:44:25 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 14:44:25 -0500 Subject: [Freeswitch-svn] [commit] r13590 - freeswitch/branches/brian/trunk/src/mod/event_handlers/mod_event_socket Message-ID: Author: brian Date: Wed Jun 3 14:44:25 2009 New Revision: 13590 Log: merge trunk Modified: freeswitch/branches/brian/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Modified: freeswitch/branches/brian/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original) +++ freeswitch/branches/brian/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Wed Jun 3 14:44:25 2009 @@ -2244,6 +2244,10 @@ prefs.nat_map = 0; } + if (prefs.nat_map && !switch_check_network_list_ip(prefs.ip, "loopback.auto")) { + prefs.nat_map = 0; + } + if (!prefs.port) { prefs.port = 8021; } From brian at freeswitch.org Wed Jun 3 12:46:26 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 14:46:26 -0500 Subject: [Freeswitch-svn] [commit] r13591 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 14:46:25 2009 New Revision: 13591 Log: more clean up Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Wed Jun 3 14:46:25 2009 @@ -424,9 +424,7 @@ if ((p = strstr(contact_url, ";fs_"))) { *p = '\0'; } - - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && - !switch_check_network_list_ip(network_ip, profile->local_network)) { + if (sofia_glue_check_nat(profile, network_ip)) { char *ptr = NULL; const char *transport_str = NULL; From brian at freeswitch.org Wed Jun 3 13:49:57 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 15:49:57 -0500 Subject: [Freeswitch-svn] [commit] r13592 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 15:49:57 2009 New Revision: 13592 Log: more clean up Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Wed Jun 3 15:49:57 2009 @@ -436,8 +436,8 @@ sofia_cid_type_t cid_type; sofia_dtmf_t dtmf_type; int auto_restart; - int sip_port; - int tls_sip_port; + switch_port_t sip_port; + switch_port_t tls_sip_port; int tls_version; char *codec_string; int running; @@ -830,6 +830,8 @@ const char *sofia_glue_transport2str(const sofia_transport_t tp); char * sofia_glue_find_parameter(const char *str, const char *param); +char *sofia_glue_create_via(switch_core_session_t *session, const char *ip, switch_port_t port, sofia_transport_t transport); +char *sofia_glue_create_external_via(switch_core_session_t *session, sofia_profile_t *profile, sofia_transport_t transport); int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip); int sofia_glue_transport_has_tls(const sofia_transport_t tp); const char *sofia_glue_get_unknown_header(sip_t const *sip, const char *name); Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 3 15:49:57 2009 @@ -762,13 +762,13 @@ ); if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { - if (switch_nat_add_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { + if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created UDP nat mapping for %s port %d\n", profile->name, profile->sip_port); } - if (switch_nat_add_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP nat mapping for %s port %d\n", profile->name, profile->sip_port); } - if(profile->tls_sip_port && switch_nat_add_mapping((switch_port_t)profile->tls_sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + if(sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_add_mapping(profile->tls_sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP/TLS nat mapping for %s port %d\n", profile->name, profile->tls_sip_port); } } @@ -953,13 +953,13 @@ } if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { - if (switch_nat_del_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { + if (switch_nat_del_mapping(profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted UDP nat mapping for %s port %d\n", profile->name, profile->sip_port); } - if (switch_nat_del_mapping((switch_port_t)profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + if (switch_nat_del_mapping(profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP nat mapping for %s port %d\n", profile->name, profile->sip_port); } - if(profile->tls_sip_port && switch_nat_del_mapping((switch_port_t)profile->tls_sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + if(sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_del_mapping(profile->tls_sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP/TLS nat mapping for %s port %d\n", profile->name, profile->tls_sip_port); } } @@ -4347,6 +4347,7 @@ int network_port = 0; char *is_nat = NULL; char acl_token[512] = ""; + sofia_transport_t transport; profile->ib_calls++; @@ -4488,11 +4489,6 @@ tech_pvt->remote_ip = switch_core_session_strdup(session, network_ip); tech_pvt->remote_port = network_port; - if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) { - tech_pvt->user_via = switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport", - sofia_glue_transport2str(sofia_glue_url2transport(sip->sip_contact->m_url)), - profile->extsipip); - } channel = tech_pvt->channel = switch_core_session_get_channel(session); @@ -4509,7 +4505,7 @@ if (sip->sip_contact && sip->sip_contact->m_url) { char tmp[35] = ""; - sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url); + transport = sofia_glue_url2transport(sip->sip_contact->m_url); const char *ipv6 = strchr(tech_pvt->remote_ip, ':'); tech_pvt->record_route = @@ -4638,7 +4634,6 @@ if (sip->sip_to && sip->sip_to->a_url) { const char *host, *user; int port; - sofia_transport_t transport; url_t *transport_url; if (sip->sip_record_route && sip->sip_record_route->r_url) { @@ -4731,6 +4726,10 @@ } } + if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) { + tech_pvt->user_via = sofia_glue_create_external_via(session, profile, tech_pvt->transport); + } + if (sip->sip_contact && sip->sip_contact->m_url) { const char *contact_uri = url_set_chanvars(session, sip->sip_contact->m_url, sip_contact); if (!channel_name) { Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 15:49:57 2009 @@ -817,6 +817,32 @@ } } +char *sofia_glue_create_external_via(switch_core_session_t *session, sofia_profile_t *profile, sofia_transport_t transport) +{ + return sofia_glue_create_via(session, + profile->extsipip, + (sofia_glue_transport_has_tls(transport)) + ? profile->tls_sip_port : profile->sip_port, + transport); +} + +char *sofia_glue_create_via(switch_core_session_t *session, const char *ip, switch_port_t port, sofia_transport_t transport) +{ + if (port && port != 5060) { + if (session) { + return switch_core_session_sprintf(session, "SIP/2.0/%s %s:%d;rport", sofia_glue_transport2str(transport), ip, port); + } else { + return switch_mprintf("SIP/2.0/%s %s:%d;rport", sofia_glue_transport2str(transport), ip, port); + } + } else { + if (session) { + return switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport", sofia_glue_transport2str(transport), ip); + } else { + return switch_mprintf("SIP/2.0/%s %s;rport", sofia_glue_transport2str(transport), ip); + } + } +} + int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip) { return (network_ip && @@ -1406,9 +1432,7 @@ } if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { - const char *transport = sofia_glue_transport2str(tech_pvt->transport); - tech_pvt->user_via = switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport", - transport, tech_pvt->profile->extsipip); + tech_pvt->user_via = sofia_glue_create_external_via(session, tech_pvt->profile, tech_pvt->transport); } Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Wed Jun 3 15:49:57 2009 @@ -1441,11 +1441,9 @@ contact_str = profile->public_url; break; } - - user_via = switch_mprintf("SIP/2.0/%s %s;rport", transport_str, profile->extsipip); - + user_via = sofia_glue_create_external_via(NULL, profile, transport); } else { - user_via = switch_mprintf("SIP/2.0/UDP %s;rport", profile->extsipip); + user_via = sofia_glue_create_external_via(NULL, profile, SOFIA_TRANSPORT_UDP); contact_str = profile->public_url; } Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Wed Jun 3 15:49:57 2009 @@ -444,10 +444,9 @@ break; } - user_via = switch_mprintf("SIP/2.0/%s %s;rport", transport_str, profile->extsipip); - + user_via = sofia_glue_create_external_via(NULL, profile, transport); } else { - user_via = switch_mprintf("SIP/2.0/UDP %s;rport", profile->extsipip); + user_via = sofia_glue_create_external_via(NULL, profile, SOFIA_TRANSPORT_UDP); contact_str = profile->public_url; } From brian at freeswitch.org Wed Jun 3 13:57:58 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 15:57:58 -0500 Subject: [Freeswitch-svn] [commit] r13593 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 15:57:57 2009 New Revision: 13593 Log: fix compile warnings for windows Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 3 15:57:57 2009 @@ -2172,7 +2172,7 @@ } else if (!strcasecmp(var, "cng-pt") && !sofia_test_pflag(profile, PFLAG_SUPPRESS_CNG)) { profile->cng_pt = (switch_payload_t) atoi(val); } else if (!strcasecmp(var, "sip-port")) { - profile->sip_port = atoi(val); + profile->sip_port = (switch_port_t)atoi(val); } else if (!strcasecmp(var, "vad")) { if (!strcasecmp(val, "in")) { sofia_set_flag(profile, TFLAG_VAD_IN); @@ -2501,7 +2501,7 @@ } else if (!strcasecmp(var, "tls-bind-params")) { profile->tls_bind_params = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "tls-sip-port")) { - profile->tls_sip_port = atoi(val); + profile->tls_sip_port = (switch_port_t)atoi(val); } else if (!strcasecmp(var, "tls-cert-dir")) { profile->tls_cert_dir = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "tls-version")) { @@ -2569,7 +2569,7 @@ } if (!profile->sip_port) { - profile->sip_port = atoi(SOFIA_DEFAULT_PORT); + profile->sip_port = (switch_port_t)atoi(SOFIA_DEFAULT_PORT); } if (!profile->dialplan) { @@ -2632,7 +2632,7 @@ */ if (sofia_test_pflag(profile, PFLAG_TLS)) { if (!profile->tls_sip_port) { - profile->tls_sip_port = atoi(SOFIA_DEFAULT_TLS_PORT); + profile->tls_sip_port = (switch_port_t)atoi(SOFIA_DEFAULT_TLS_PORT); } if (profile->extsipip && sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { @@ -4505,9 +4505,10 @@ if (sip->sip_contact && sip->sip_contact->m_url) { char tmp[35] = ""; + const char *ipv6 = strchr(tech_pvt->remote_ip, ':'); + transport = sofia_glue_url2transport(sip->sip_contact->m_url); - const char *ipv6 = strchr(tech_pvt->remote_ip, ':'); tech_pvt->record_route = switch_core_session_sprintf(session, "sip:%s@%s%s%s:%d;transport=%s", Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 15:57:57 2009 @@ -665,8 +665,8 @@ } } - if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { - tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip); + if (tech_pvt->profile->extrtpip && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { + tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip); switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP); } else { tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip); From mikej at freeswitch.org Wed Jun 3 14:08:34 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 16:08:34 -0500 Subject: [Freeswitch-svn] [commit] r13594 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: mikej Date: Wed Jun 3 16:08:34 2009 New Revision: 13594 Log: merge sip nat improvements from branches/brian Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Wed Jun 3 16:08:34 2009 @@ -394,6 +394,7 @@ if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) { nua_bye(tech_pvt->nh, SIPTAG_REASON_STR(reason), + TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_END()); } @@ -407,7 +408,6 @@ nua_cancel(tech_pvt->nh, SIPTAG_REASON_STR(reason), TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)), - TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_END()); } } else { @@ -2694,6 +2694,8 @@ } } + sofia_glue_get_user_host(switch_core_session_strdup(nsession, tech_pvt->dest), NULL, &tech_pvt->remote_ip); + if (dest_to) { if (strchr(dest_to, '@')) { tech_pvt->dest_to = switch_core_session_sprintf(nsession, "sip:%s", dest_to); @@ -3217,6 +3219,8 @@ mod_sofia_globals.running = 1; switch_mutex_unlock(mod_sofia_globals.mutex); + mod_sofia_globals.auto_nat = (switch_core_get_variable("nat_type") ? 1 : 0); + switch_queue_create(&mod_sofia_globals.presence_queue, SOFIA_QUEUE_SIZE, mod_sofia_globals.pool); switch_queue_create(&mod_sofia_globals.mwi_queue, SOFIA_QUEUE_SIZE, mod_sofia_globals.pool); Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Wed Jun 3 16:08:34 2009 @@ -192,6 +192,7 @@ PFLAG_MESSAGE_QUERY_ON_REGISTER, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE, PFLAG_PROXY_FOLLOW_REDIRECT, + PFLAG_AUTO_NAT, /* No new flags below this line */ PFLAG_MAX } PFLAGS; @@ -272,6 +273,7 @@ char guess_mask_str[16]; int debug_presence; int auto_restart; + int auto_nat; }; extern struct mod_sofia_globals mod_sofia_globals; @@ -408,9 +410,13 @@ char *extsipip; char *username; char *url; + char *public_url; char *bindurl; char *tls_url; + char *tls_public_url; char *tls_bindurl; + char *tcp_public_contact; + char *tls_public_contact; char *tcp_contact; char *tls_contact; char *sla_contact; @@ -430,8 +436,8 @@ sofia_cid_type_t cid_type; sofia_dtmf_t dtmf_type; int auto_restart; - int sip_port; - int tls_sip_port; + switch_port_t sip_port; + switch_port_t tls_sip_port; int tls_version; char *codec_string; int running; @@ -489,6 +495,7 @@ uint32_t timer_t2; uint32_t timer_t4; char *contact_user; + char *local_network; }; struct private_object { @@ -613,6 +620,7 @@ switch_rtp_bug_flag_t rtp_bugs; switch_codec_implementation_t read_impl; switch_codec_implementation_t write_impl; + char *user_via; }; struct callback_t { @@ -822,7 +830,9 @@ const char *sofia_glue_transport2str(const sofia_transport_t tp); char * sofia_glue_find_parameter(const char *str, const char *param); - +char *sofia_glue_create_via(switch_core_session_t *session, const char *ip, switch_port_t port, sofia_transport_t transport); +char *sofia_glue_create_external_via(switch_core_session_t *session, sofia_profile_t *profile, sofia_transport_t transport); +int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip); int sofia_glue_transport_has_tls(const sofia_transport_t tp); const char *sofia_glue_get_unknown_header(sip_t const *sip, const char *name); switch_status_t sofia_glue_build_crypto(private_object_t *tech_pvt, int index, switch_rtp_crypto_key_type_t type, switch_rtp_crypto_direction_t direction); @@ -835,7 +845,7 @@ const char *sofia_glue_strip_proto(const char *uri); switch_status_t reconfig_sofia(sofia_profile_t *profile); void sofia_glue_del_gateway(sofia_gateway_t *gp); -void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent); +void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent, const char *network_ip); void sofia_glue_restart_all_profiles(void); void sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly); const char * sofia_state_string(int state); @@ -877,3 +887,4 @@ sofia_cid_type_t sofia_cid_name2type(const char *name); void sofia_glue_tech_set_local_sdp(private_object_t *tech_pvt, const char *sdp_str, switch_bool_t dup); void sofia_glue_set_rtp_stats(private_object_t *tech_pvt); +void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port); Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Jun 3 16:08:34 2009 @@ -406,8 +406,7 @@ if (authorization) { char network_ip[80]; - su_addrinfo_t *addrinfo = msg_addrinfo(nua_current_request(nua)); - get_addr(network_ip, sizeof(network_ip), addrinfo->ai_addr, addrinfo->ai_addrlen); + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), NULL); auth_res = sofia_reg_parse_auth(profile, authorization, sip, (char *) sip->sip_request->rq_method_name, tech_pvt->key, strlen(tech_pvt->key), network_ip, NULL, 0, REG_INVITE, NULL, NULL); @@ -762,10 +761,23 @@ use_timer ? "timer, " : "" ); + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created UDP nat mapping for %s port %d\n", profile->name, profile->sip_port); + } + if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP nat mapping for %s port %d\n", profile->name, profile->sip_port); + } + if(sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_add_mapping(profile->tls_sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP/TLS nat mapping for %s port %d\n", profile->name, profile->tls_sip_port); + } + } + profile->nua = nua_create(profile->s_root, /* Event loop */ sofia_event_callback, /* Callback for processing events */ profile, /* Additional data to pass to callback */ NUTAG_URL(profile->bindurl), + NTATAG_USER_VIA(1), TAG_IF(!strchr(profile->sipip, ':'), SOATAG_AF(SOA_AF_IP4_ONLY)), TAG_IF(strchr(profile->sipip, ':'), SOATAG_AF(SOA_AF_IP6_ONLY)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_SIPS_URL(profile->tls_bindurl)), @@ -939,6 +951,18 @@ switch_event_fire(&s_event); } + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + if (switch_nat_del_mapping(profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted UDP nat mapping for %s port %d\n", profile->name, profile->sip_port); + } + if (switch_nat_del_mapping(profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP nat mapping for %s port %d\n", profile->name, profile->sip_port); + } + if(sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_del_mapping(profile->tls_sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP/TLS nat mapping for %s port %d\n", profile->name, profile->tls_sip_port); + } + } + sofia_glue_sql_close(profile); su_home_unref(profile->home); su_root_destroy(profile->s_root); @@ -1757,8 +1781,10 @@ } else { sofia_clear_pflag(profile, PFLAG_AUTH_CALLS); } - } else if(!strcasecmp(var, "context")) { + } else if (!strcasecmp(var, "context")) { profile->context = switch_core_strdup(profile->pool, val); + } else if (!strcasecmp(var, "local-network-acl")) { + profile->local_network = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "force-register-domain")) { profile->reg_domain = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "force-register-db-domain")) { @@ -2145,7 +2171,7 @@ } else if (!strcasecmp(var, "cng-pt") && !sofia_test_pflag(profile, PFLAG_SUPPRESS_CNG)) { profile->cng_pt = (switch_payload_t) atoi(val); } else if (!strcasecmp(var, "sip-port")) { - profile->sip_port = atoi(val); + profile->sip_port = (switch_port_t)atoi(val); } else if (!strcasecmp(var, "vad")) { if (!strcasecmp(val, "in")) { sofia_set_flag(profile, TFLAG_VAD_IN); @@ -2163,9 +2189,12 @@ if (!strcmp(val, "0.0.0.0")) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip); + } else if (!strcasecmp(val, "auto-nat")) { + ip = mod_sofia_globals.auto_nat ? switch_core_get_variable("nat_public_addr") : mod_sofia_globals.guess_ip; } else { - ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip; + ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip; } + sofia_set_pflag(profile, PFLAG_AUTO_NAT); profile->extrtpip = switch_core_strdup(profile->pool, ip); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ext-rtp-ip\n"); @@ -2198,6 +2227,8 @@ if (!strcasecmp(val, "0.0.0.0")) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip); + } else if (!strcasecmp(val, "auto-nat")) { + ip = mod_sofia_globals.auto_nat ? switch_core_get_variable("nat_public_addr") : mod_sofia_globals.guess_ip; } else if (strcasecmp(val, "auto")) { switch_port_t port = 0; if (sofia_glue_ext_address_lookup(profile, NULL, &myip, &port, val, profile->pool) == SWITCH_STATUS_SUCCESS) { @@ -2206,10 +2237,13 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to get external ip.\n"); } } + sofia_set_pflag(profile, PFLAG_AUTO_NAT); profile->extsipip = switch_core_strdup(profile->pool, ip); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ext-sip-ip\n"); } + } else if (!strcasecmp(var, "local-network-acl")) { + profile->local_network = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "force-register-domain")) { profile->reg_domain = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "force-register-db-domain")) { @@ -2264,7 +2298,7 @@ } else if (!strcasecmp(var, "manage-shared-appearance")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE); - profile->sla_contact = switch_core_sprintf(profile->pool, "sip:sla-agent@%s", profile->sipip); + profile->sla_contact = switch_core_sprintf(profile->pool, "sla-agent"); } } else if (!strcasecmp(var, "disable-srv")) { if (switch_true(val)) { @@ -2466,7 +2500,7 @@ } else if (!strcasecmp(var, "tls-bind-params")) { profile->tls_bind_params = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "tls-sip-port")) { - profile->tls_sip_port = atoi(val); + profile->tls_sip_port = (switch_port_t)atoi(val); } else if (!strcasecmp(var, "tls-cert-dir")) { profile->tls_cert_dir = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "tls-version")) { @@ -2534,7 +2568,7 @@ } if (!profile->sip_port) { - profile->sip_port = atoi(SOFIA_DEFAULT_PORT); + profile->sip_port = (switch_port_t)atoi(SOFIA_DEFAULT_PORT); } if (!profile->dialplan) { @@ -2548,7 +2582,18 @@ if (!profile->sipdomain) { profile->sipdomain = switch_core_strdup(profile->pool, profile->sipip); } - if (profile->extsipip) { + if (profile->extsipip && sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + char *ipv6 = strchr(profile->extsipip, ':'); + profile->public_url = switch_core_sprintf(profile->pool, + "sip:%s@%s%s%s:%d", + profile->contact_user, + ipv6 ? "[" : "", + profile->extsipip, + ipv6 ? "]" : "", + profile->sip_port); + } + + if (profile->extsipip && !sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { char *ipv6 = strchr(profile->extsipip, ':'); profile->url = switch_core_sprintf(profile->pool, "sip:%s@%s%s%s:%d", @@ -2571,7 +2616,11 @@ } profile->tcp_contact = switch_core_sprintf(profile->pool, "%s;transport=tcp", profile->url); - + + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + profile->tcp_public_contact = switch_core_sprintf(profile->pool, "%s;transport=tcp", profile->public_url); + } + if (profile->bind_params) { char *bindurl = profile->bindurl; profile->bindurl = switch_core_sprintf(profile->pool, "%s;%s", bindurl, profile->bind_params); @@ -2582,10 +2631,21 @@ */ if (sofia_test_pflag(profile, PFLAG_TLS)) { if (!profile->tls_sip_port) { - profile->tls_sip_port = atoi(SOFIA_DEFAULT_TLS_PORT); + profile->tls_sip_port = (switch_port_t)atoi(SOFIA_DEFAULT_TLS_PORT); } - if (profile->extsipip) { + if (profile->extsipip && sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + char *ipv6 = strchr(profile->extsipip, ':'); + profile->tls_public_url = switch_core_sprintf(profile->pool, + "sip:%s@%s%s%s:%d", + profile->contact_user, + ipv6 ? "[" : "", + profile->extsipip, + ipv6 ? "]" : "", + profile->tls_sip_port); + } + + if (profile->extsipip && !sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { char *ipv6 = strchr(profile->extsipip, ':'); profile->tls_url = switch_core_sprintf(profile->pool, @@ -2632,6 +2692,9 @@ profile->tls_cert_dir = switch_core_sprintf(profile->pool, "%s/ssl", SWITCH_GLOBAL_dirs.conf_dir); } profile->tls_contact = switch_core_sprintf(profile->pool, "%s;transport=tls", profile->tls_url); + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + profile->tls_public_contact = switch_core_sprintf(profile->pool, "%s;transport=tls", profile->tls_public_url); + } } } if (profile) { @@ -2774,13 +2837,11 @@ const char *uuid; switch_core_session_t *other_session; private_object_t *tech_pvt = switch_core_session_get_private(session); - su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); char network_ip[80]; int network_port = 0; switch_caller_profile_t *caller_profile = NULL; - get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); - network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port); + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); switch_channel_set_variable(channel, "sip_reply_host", network_ip); switch_channel_set_variable_printf(channel, "sip_reply_port", "%d", network_port); @@ -4282,10 +4343,10 @@ uint32_t sess_count = switch_core_session_count(); uint32_t sess_max = switch_core_session_limit(0); int is_auth = 0, calling_myself = 0; - su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); int network_port = 0; char *is_nat = NULL; char acl_token[512] = ""; + sofia_transport_t transport; profile->ib_calls++; @@ -4306,8 +4367,7 @@ goto fail; } - get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); - network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port); + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) { if (sip && sip->sip_via) { @@ -4444,9 +4504,10 @@ if (sip->sip_contact && sip->sip_contact->m_url) { char tmp[35] = ""; - sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url); - const char *ipv6 = strchr(tech_pvt->remote_ip, ':'); + + transport = sofia_glue_url2transport(sip->sip_contact->m_url); + tech_pvt->record_route = switch_core_session_sprintf(session, "sip:%s@%s%s%s:%d;transport=%s", @@ -4573,7 +4634,6 @@ if (sip->sip_to && sip->sip_to->a_url) { const char *host, *user; int port; - sofia_transport_t transport; url_t *transport_url; if (sip->sip_record_route && sip->sip_record_route->r_url) { @@ -4623,14 +4683,21 @@ if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) { tech_pvt->reply_contact = switch_core_session_sprintf(session, "", user, host); } else { + const char *url = NULL; - const char *url; - - if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url)) { + if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) { + url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url; + } else { + url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url; + } + + if (url) { if (strchr(url, '>')) { - tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport)); + tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, + sofia_glue_transport2str(transport)); } else { - tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url, sofia_glue_transport2str(transport)); + tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", profile->url, + sofia_glue_transport2str(transport)); } } else { switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); @@ -4638,19 +4705,30 @@ } } } else { - const char *url; - - if ((url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url)) { + const char *url = NULL; + if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) { + url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url; + } else { + url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url; + } + + if (url) { if (strchr(url, '>')) { - tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, sofia_glue_transport2str(transport)); + tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s;transport=%s", url, + sofia_glue_transport2str(transport)); } else { - tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", url, sofia_glue_transport2str(transport)); + tech_pvt->reply_contact = switch_core_session_sprintf(session, "<%s;transport=%s>", profile->url, + sofia_glue_transport2str(transport)); } } else { switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); } } } + + if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) { + tech_pvt->user_via = sofia_glue_create_external_via(session, profile, tech_pvt->transport); + } if (sip->sip_contact && sip->sip_contact->m_url) { const char *contact_uri = url_set_chanvars(session, sip->sip_contact->m_url, sip_contact); Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 16:08:34 2009 @@ -663,9 +663,14 @@ return SWITCH_STATUS_FALSE; } } - - tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip); + if (tech_pvt->profile->extrtpip && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { + tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip); + switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP); + } else { + tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip); + } + tech_pvt->adv_sdp_audio_port = sdp_port; switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port); @@ -708,6 +713,10 @@ tech_pvt->adv_sdp_video_port = sdp_port; + if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { + switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP); + } + switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port); switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip); switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_PORT_VARIABLE, tmp); @@ -806,6 +815,40 @@ } } +char *sofia_glue_create_external_via(switch_core_session_t *session, sofia_profile_t *profile, sofia_transport_t transport) +{ + return sofia_glue_create_via(session, + profile->extsipip, + (sofia_glue_transport_has_tls(transport)) + ? profile->tls_sip_port : profile->sip_port, + transport); +} + +char *sofia_glue_create_via(switch_core_session_t *session, const char *ip, switch_port_t port, sofia_transport_t transport) +{ + if (port && port != 5060) { + if (session) { + return switch_core_session_sprintf(session, "SIP/2.0/%s %s:%d;rport", sofia_glue_transport2str(transport), ip, port); + } else { + return switch_mprintf("SIP/2.0/%s %s:%d;rport", sofia_glue_transport2str(transport), ip, port); + } + } else { + if (session) { + return switch_core_session_sprintf(session, "SIP/2.0/%s %s;rport", sofia_glue_transport2str(transport), ip); + } else { + return switch_mprintf("SIP/2.0/%s %s;rport", sofia_glue_transport2str(transport), ip); + } + } +} + +int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip) +{ + return (network_ip && + profile->local_network && + sofia_test_pflag(profile, PFLAG_AUTO_NAT) && + !switch_check_network_list_ip(network_ip, profile->local_network)); +} + int sofia_glue_transport_has_tls(const sofia_transport_t tp) { switch (tp) { @@ -817,6 +860,18 @@ } } +void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port) { + su_addrinfo_t *addrinfo = msg_addrinfo(msg); + + if (buf) { + get_addr(buf, buflen, addrinfo->ai_addr, addrinfo->ai_addrlen); + } + + if (port) { + *port = get_port(addrinfo->ai_addr); + } +} + char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const sofia_transport_t transport, switch_bool_t uri_only, const char *params) { @@ -1257,10 +1312,18 @@ check_decode(cid_num, session); if (!tech_pvt->from_str) { - const char* sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; - const char* format = strchr(sipip, ':') ? "\"%s\" " : "\"%s\" "; + const char* sipip; + const char* format; const char *alt = NULL; + if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->profile->local_network)) { + sipip = tech_pvt->profile->extsipip; + } else { + sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; + } + + format = strchr(sipip, ':') ? "\"%s\" " : "\"%s\" "; + if ((alt = switch_channel_get_variable(channel, "sip_invite_domain"))) { sipip = alt; } @@ -1365,6 +1428,10 @@ tech_pvt->transport = SOFIA_TRANSPORT_UDP; } } + + if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { + tech_pvt->user_via = sofia_glue_create_external_via(session, tech_pvt->profile, tech_pvt->transport); + } if (!sofia_test_pflag(tech_pvt->profile, PFLAG_TLS) && sofia_glue_transport_has_tls(tech_pvt->transport)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "TLS not supported by profile\n"); @@ -1374,8 +1441,18 @@ if (switch_strlen_zero(tech_pvt->invite_contact)) { const char * contact; if ((contact = switch_channel_get_variable(channel, "sip_contact_user"))) { - char *ip_addr = (tech_pvt->profile->extsipip) ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; - char *ipv6 = strchr(ip_addr, ':'); + char *ip_addr; + char *ipv6; + + if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { + ip_addr = (switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) + ? tech_pvt->profile->sipip : tech_pvt->profile->extsipip; + } else { + ip_addr = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; + } + + ipv6 = strchr(ip_addr, ':'); + if (sofia_glue_transport_has_tls(tech_pvt->transport)) { tech_pvt->invite_contact = switch_core_session_sprintf(session, "sip:%s@%s%s%s:%d", contact, ipv6 ? "[" : "", ip_addr, ipv6 ? "]" : "", @@ -1388,7 +1465,11 @@ if (sofia_glue_transport_has_tls(tech_pvt->transport)) { tech_pvt->invite_contact = tech_pvt->profile->tls_url; } else { - tech_pvt->invite_contact = tech_pvt->profile->url; + if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { + tech_pvt->invite_contact = tech_pvt->profile->public_url; + } else { + tech_pvt->invite_contact = tech_pvt->profile->url; + } } } } @@ -1603,6 +1684,7 @@ nua_invite(tech_pvt->nh, NUTAG_AUTOANSWER(0), NUTAG_SESSION_TIMER(session_timeout), + TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_IF(!switch_strlen_zero(tech_pvt->rpid), SIPTAG_REMOTE_PARTY_ID_STR(tech_pvt->rpid)), TAG_IF(!switch_strlen_zero(tech_pvt->preferred_id), SIPTAG_P_PREFERRED_IDENTITY_STR(tech_pvt->preferred_id)), TAG_IF(!switch_strlen_zero(tech_pvt->asserted_id), SIPTAG_P_ASSERTED_IDENTITY_STR(tech_pvt->asserted_id)), @@ -1630,14 +1712,22 @@ private_object_t *tech_pvt = switch_core_session_get_private(session); switch_channel_t *channel = switch_core_session_get_channel(session); switch_caller_profile_t *caller_profile; - const char *sipip, *format; + const char *sipip, *format, *contact_url; switch_assert(tech_pvt != NULL); switch_mutex_lock(tech_pvt->sofia_mutex); caller_profile = switch_channel_get_caller_profile(channel); - sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; + if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { + sipip = tech_pvt->profile->extsipip; + contact_url = tech_pvt->profile->public_url; + } else { + sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; + contact_url = tech_pvt->profile->url; + } + format = strchr(sipip, ':') ? "\"%s\" " : "\"%s\" "; + if ((tech_pvt->from_str = switch_core_session_sprintf(session, format, caller_profile->caller_id_name, caller_profile->caller_id_number, sipip))) { @@ -1646,12 +1736,15 @@ tech_pvt->nh2 = nua_handle(tech_pvt->profile->nua, NULL, SIPTAG_TO_STR(tech_pvt->dest), - SIPTAG_FROM_STR(tech_pvt->from_str), SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END()); + SIPTAG_FROM_STR(tech_pvt->from_str), + SIPTAG_CONTACT_STR(contact_url), + TAG_END()); nua_handle_bind(tech_pvt->nh2, tech_pvt->sofia_private); nua_invite(tech_pvt->nh2, - SIPTAG_CONTACT_STR(tech_pvt->profile->url), + SIPTAG_CONTACT_STR(contact_url), + TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_REUSE_REJECTED(1), @@ -1761,12 +1854,20 @@ switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_audio_port); } + if (tech_pvt->local_sdp_audio_port > 0 && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { + switch_nat_del_mapping((switch_port_t)tech_pvt->local_sdp_audio_port, SWITCH_NAT_UDP); + } + if (tech_pvt->video_rtp_session) { switch_rtp_destroy(&tech_pvt->video_rtp_session); } else if (tech_pvt->local_sdp_video_port) { switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_video_port); } + + if (tech_pvt->local_sdp_video_port > 0 && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { + switch_nat_del_mapping((switch_port_t)tech_pvt->local_sdp_video_port, SWITCH_NAT_UDP); + } } switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force) @@ -2480,7 +2581,7 @@ if (map->rm_pt < 96) { match = (map->rm_pt == imp->ianacode) ? 1 : 0; } else { - if(map->rm_encoding) { + if (map->rm_encoding) { match = strcasecmp(map->rm_encoding, imp->iananame) ? 0 : 1; } else { match = 0; @@ -2488,7 +2589,7 @@ } if (match) { - if(ptime > 0) { + if (ptime > 0) { switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate, ptime); } else { switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh", imp->iananame, (unsigned int) map->rm_rate); @@ -3487,7 +3588,8 @@ " aor VARCHAR(255),\n" " profile_name VARCHAR(255),\n" " hostname VARCHAR(255),\n" - " contact_str VARCHAR(255)\n" + " contact_str VARCHAR(255),\n" + " network_ip VARCHAR(255)\n" ");\n"; char shared_appearance_dialogs_sql[] = @@ -3958,7 +4060,10 @@ { char *p, *h, *u = in; - *user = NULL; + if (user) { + *user = NULL; + } + *host = NULL; /* First isolate the host part from the user part */ @@ -3969,7 +4074,7 @@ } /* Clean out the user part of its protocol prefix (if any) */ - if ((p = strchr(u, ':'))) { + if (user && (p = strchr(u, ':'))) { *p++ = '\0'; u = p; } @@ -3987,7 +4092,10 @@ *p = '\0'; } + if (user) { *user = u; + } + *host = h; return 1; Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Wed Jun 3 16:08:34 2009 @@ -375,11 +375,11 @@ } if (for_everyone) { - sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,'%q' " + sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q' " "from sip_registrations where sip_user='%q' and sip_host='%q'", stream.data, user, host); } else if (call_id) { - sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,'%q' " + sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q' " "from sip_registrations where sip_user='%q' and sip_host='%q' and call_id='%q'", stream.data, user, host, call_id); } @@ -1401,13 +1401,14 @@ char *event = "message-summary"; char *contact, *o_contact = argv[2]; char *profile_name = argv[3]; - char *body = argv[4]; + char *network_ip = argv[4]; + char *body = argv[5]; char *id = NULL; nua_handle_t *nh; struct mwi_helper *h = (struct mwi_helper *) pArg; sofia_profile_t *ext_profile = NULL, *profile = h->profile; - char *route = NULL, *route_uri = NULL; - char *p; + char *route = NULL, *route_uri = NULL, *user_via = NULL; + char *p, *contact_str; if (profile_name && strcasecmp(profile_name, h->profile->name)) { if ((ext_profile = sofia_glue_find_profile(profile_name))) { @@ -1415,9 +1416,41 @@ } } - id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host); - contact = sofia_glue_get_url_from_contact(o_contact, 1); + + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && + !switch_check_network_list_ip(network_ip, profile->local_network)) { + char *ptr = NULL; + const char *transport_str = NULL; + + id = switch_mprintf("sip:%s@%s", sub_to_user, profile->extsipip); + + if ((ptr = sofia_glue_find_parameter(o_contact, "transport="))) { + sofia_transport_t transport = sofia_glue_str2transport(ptr); + transport_str = sofia_glue_transport2str(transport); + + switch (transport) { + case SOFIA_TRANSPORT_TCP: + contact_str = profile->tcp_public_contact; + break; + case SOFIA_TRANSPORT_TCP_TLS: + contact_str = profile->tls_public_contact; + break; + default: + contact_str = profile->public_url; + break; + } + user_via = sofia_glue_create_external_via(NULL, profile, transport); + } else { + user_via = sofia_glue_create_external_via(NULL, profile, SOFIA_TRANSPORT_UDP); + contact_str = profile->public_url; + } + + } else { + contact_str = profile->url; + id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host); + } + if ((route = strstr(contact, ";fs_path=")) && (route = strdup(route + 9))) { for (p = route; p && *p ; p++) { @@ -1455,17 +1488,24 @@ } } - nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(h->profile->url), TAG_END()); + nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact), + SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), + SIPTAG_CONTACT_STR(contact_str), TAG_END()); nua_handle_bind(nh, &mod_sofia_globals.destroy_private); nua_notify(nh, NUTAG_NEWSUB(1), TAG_IF(route_uri, NUTAG_PROXY(route_uri)), - SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END()); + TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), + SIPTAG_EVENT_STR(event), + SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), + SIPTAG_PAYLOAD_STR(body), TAG_END()); switch_safe_free(contact); switch_safe_free(id); switch_safe_free(route); + switch_safe_free(user_via); + if (ext_profile) { sofia_glue_release_profile(ext_profile); } @@ -1501,13 +1541,13 @@ switch_event_t *sevent; int sub_state; int sent_reply = 0; - su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); int network_port = 0; char network_ip[80]; const char *contact_host, *contact_user; char *port; char new_port[25] = ""; char *is_nat = NULL; + int is_auto_nat = 0; const char *ipv6; if (!(contact && sip->sip_contact->m_url)) { @@ -1515,8 +1555,12 @@ return; } - get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); - network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port); + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); + + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && + !switch_check_network_list_ip(network_ip, profile->local_network)) { + is_auto_nat = 1; + } tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END()); @@ -1777,19 +1821,35 @@ network_port, params); } + + if (is_auto_nat) { + contactstr = profile->public_url; + } else { + contactstr = profile->url; + } + if (switch_stristr("port=tcp", contact->m_url->url_params)) { - contactstr = profile->tcp_contact; + if (is_auto_nat) { + contactstr = profile->tcp_public_contact; + } else { + contactstr = profile->tcp_contact; + } } else if (switch_stristr("port=tls", contact->m_url->url_params)) { - contactstr = profile->tls_contact; + if (is_auto_nat) { + contactstr = profile->tls_contact; + } else { + contactstr = profile->tls_public_contact; + } } - if (nh && nh->nh_ds && nh->nh_ds->ds_usage) { nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta + SUB_OVERLAP, exp_delta + SUB_OVERLAP); } - nua_respond(nh, SIP_202_ACCEPTED, SIPTAG_CONTACT_STR(contactstr), NUTAG_WITH_THIS(nua), + nua_respond(nh, SIP_202_ACCEPTED, + SIPTAG_CONTACT_STR(contactstr), + NUTAG_WITH_THIS(nua), SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EXPIRES_STR(exp_delta_str), TAG_IF(sticky, NUTAG_PROXY(sticky)), TAG_END()); Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Wed Jun 3 16:08:34 2009 @@ -402,11 +402,13 @@ return 0; } -void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent) +void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent, const char *network_ip) { const char *event = "check-sync"; nua_handle_t *nh; char *contact_url = NULL; + char *contact_str = NULL; + char *user_via = NULL; char *id = NULL; if (switch_stristr("snom", user_agent)) { @@ -417,22 +419,52 @@ if ((contact_url = sofia_glue_get_url_from_contact((char *)contact, 1))) { char *p; - id = switch_mprintf("sip:%s@%s", user, host); + id = switch_mprintf("sip:%s@%s", user, network_ip); if ((p = strstr(contact_url, ";fs_"))) { *p = '\0'; } + if (sofia_glue_check_nat(profile, network_ip)) { + char *ptr = NULL; + const char *transport_str = NULL; + + if ((ptr = sofia_glue_find_parameter(contact_url, "transport="))) { + sofia_transport_t transport = sofia_glue_str2transport(ptr); + transport_str = sofia_glue_transport2str(transport); + + switch (transport) { + case SOFIA_TRANSPORT_TCP: + contact_str = profile->tcp_public_contact; + break; + case SOFIA_TRANSPORT_TCP_TLS: + contact_str = profile->tls_public_contact; + break; + default: + contact_str = profile->public_url; + break; + } + + user_via = sofia_glue_create_external_via(NULL, profile, transport); + } else { + user_via = sofia_glue_create_external_via(NULL, profile, SOFIA_TRANSPORT_UDP); + contact_str = profile->public_url; + } + } else { + contact_str = profile->url; + } + nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact_url), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), - SIPTAG_CONTACT_STR(profile->url), + SIPTAG_CONTACT_STR(contact_str), TAG_END()); nua_handle_bind(nh, &mod_sofia_globals.destroy_private); nua_notify(nh, NUTAG_NEWSUB(1), + TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(""), @@ -442,6 +474,7 @@ free(contact_url); } + switch_safe_free(user_via); switch_safe_free(id); } @@ -462,8 +495,8 @@ switch_event_t *s_event; sofia_profile_t *profile = (sofia_profile_t *) pArg; - if (argc > 11 && atoi(argv[11]) == 1) { - sofia_reg_send_reboot(profile, argv[1], argv[2], argv[3], argv[7]); + if (argc > 12 && atoi(argv[12]) == 1) { + sofia_reg_send_reboot(profile, argv[1], argv[2], argv[3], argv[7], argv[11]); } if (argc >= 3) { @@ -508,7 +541,8 @@ switch_snprintf(sqlextra, sizeof(sqlextra), " or (sip_user='%s' and sip_host='%s')", user, host); } - switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name" + switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires" + ",user_agent,server_user,server_host,profile_name,network_ip" ",%d from sip_registrations where call_id='%s' %s", reboot, call_id, sqlextra); @@ -548,10 +582,12 @@ switch_mutex_lock(profile->ireg_mutex); if (now) { - switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name" + switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires" + ",user_agent,server_user,server_host,profile_name,network_ip" ",%d from sip_registrations where expires > 0 and expires <= %ld", reboot, (long) now); } else { - switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires,user_agent,server_user,server_host,profile_name" + switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires" + ",user_agent,server_user,server_host,profile_name,network_ip" ",%d from sip_registrations where expires > 0", reboot); } @@ -725,19 +761,17 @@ char *force_user; char received_data[128] = ""; char *path_val = NULL; - su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); switch_event_t *auth_params = NULL; int r = 0; /* all callers must confirm that sip, sip->sip_request and sip->sip_contact are not NULL */ switch_assert(sip != NULL && sip->sip_contact != NULL && sip->sip_request != NULL); - get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr,my_addrinfo->ai_addrlen); - network_port = get_port(my_addrinfo->ai_addr); + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); snprintf(network_port_c, sizeof(network_port_c), "%d", network_port); - snprintf(url_ip, sizeof(url_ip), my_addrinfo->ai_addr->sa_family == AF_INET6 ? "[%s]" : "%s", network_ip); + snprintf(url_ip, sizeof(url_ip), (msg_addrinfo(nua_current_request(nua)))->ai_addr->sa_family == AF_INET6 ? "[%s]" : "%s", network_ip); expires = sip->sip_expires; authorization = sip->sip_authorization; @@ -1249,15 +1283,11 @@ char key[128] = ""; switch_event_t *v_event = NULL; char network_ip[80]; - su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua)); sofia_regtype_t type = REG_REGISTER; int network_port = 0; char *is_nat = NULL; - - get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen); - network_port = get_port(msg_addrinfo(nua_current_request(nua))->ai_addr); - + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); if (!(sip->sip_contact && sip->sip_contact->m_url)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n"); Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Wed Jun 3 16:08:34 2009 @@ -76,6 +76,10 @@ struct sla_helper sh = { { 0 } }; char *contact_str = strip_uri(full_contact); sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url); + char network_ip[80]; + int network_port = 0; + + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); sql = switch_mprintf("select call_id from sip_shared_appearance_dialogs where hostname='%q' and profile_name='%q' and contact_str='%q'", mod_sofia_globals.hostname, profile->name, contact_str); @@ -99,8 +103,13 @@ nua_handle_bind(nh, &mod_sofia_globals.keep_private); switch_snprintf(exp_str, sizeof(exp_str), "%ld", exptime + 30); - switch_snprintf(my_contact, sizeof(my_contact), "<%s;transport=%s>;expires=%s", profile->sla_contact, sofia_glue_transport2str(transport), exp_str); - + if (sofia_glue_check_nat(profile, network_ip)) { + switch_snprintf(my_contact, sizeof(my_contact), ";expires=%s", profile->sla_contact, + profile->extsipip, sofia_glue_transport2str(transport), exp_str); + } else { + switch_snprintf(my_contact, sizeof(my_contact), ";expires=%s", profile->sla_contact, + profile->sipip, sofia_glue_transport2str(transport), exp_str); + } nua_subscribe(nh, SIPTAG_TO(sip->sip_to), SIPTAG_FROM(sip->sip_to), @@ -125,8 +134,11 @@ char *sql = NULL; char *route_uri = NULL; char *sla_contact = NULL; + char network_ip[80]; + int network_port = 0; sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url); + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); /* * XXX MTK FIXME - we don't look at the tag to see if NUTAG_SUBSTATE(nua_substate_terminated) or * a Subscription-State header with state "terminated" and/or expiration of 0. So we never forget @@ -141,8 +153,9 @@ * so we do what openser's pua_bla does and... */ + /* We always store the AOR as the sipip and not the request so SLA works with NAT inside out */ aor = switch_mprintf("sip:%s@%s;transport=%s", sip->sip_contact->m_url->url_user, - sip->sip_from->a_url->url_host, sofia_glue_transport2str(transport)); + profile->sipip, sofia_glue_transport2str(transport)); /* * ok, and now that we HAVE the AOR, we REALLY should go check in the XML config and see if this particular @@ -163,9 +176,9 @@ } if ((sql = - switch_mprintf("insert into sip_shared_appearance_subscriptions (subscriber, call_id, aor, profile_name, hostname, contact_str) " - "values ('%q','%q','%q','%q','%q','%q')", - subscriber, sip->sip_call_id->i_id, aor, profile->name, mod_sofia_globals.hostname, contact_str))) { + switch_mprintf("insert into sip_shared_appearance_subscriptions (subscriber, call_id, aor, profile_name, hostname, contact_str, network_ip) " + "values ('%q','%q','%q','%q','%q','%q','%q')", + subscriber, sip->sip_call_id->i_id, aor, profile->name, mod_sofia_globals.hostname, contact_str, network_ip))) { sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); } @@ -187,8 +200,11 @@ *p++ = '\0'; } } - - sla_contact = switch_mprintf("<%s;transport=%s>", profile->sla_contact, sofia_glue_transport2str(transport)); + if (sofia_glue_check_nat(profile, network_ip)) { + sla_contact = switch_mprintf("", profile->sla_contact, profile->extsipip, sofia_glue_transport2str(transport)); + } else { + sla_contact = switch_mprintf("", profile->sla_contact, profile->sipip, sofia_glue_transport2str(transport)); + } nua_respond(nh, SIP_202_ACCEPTED, SIPTAG_CONTACT_STR(sla_contact), NUTAG_WITH_THIS(nua), TAG_IF(route_uri, NUTAG_PROXY(route_uri)), @@ -276,8 +292,9 @@ } /* calculate the AOR we're trying to tell people about. should probably double-check before derferencing XXX MTK */ + /* We always store the AOR as the sipip and not the request so SLA works with NAT inside out */ aor = switch_mprintf("sip:%s@%s;transport=%s", sip->sip_to->a_url->url_user, - sip->sip_to->a_url->url_host, sofia_glue_transport2str(transport)); + profile->sipip, sofia_glue_transport2str(transport)); /* this isn't sufficient because on things like the polycom, the subscriber is the 'main' ext number, but the * 'main' ext number isn't in ANY of the headers they send us in the notify. of course. @@ -290,10 +307,9 @@ sip->sip_contact->m_url->url_host, sofia_glue_transport2str(transport)); if (sip->sip_payload && sip->sip_payload->pl_data) { - sql = switch_mprintf("select subscriber,call_id,aor,profile_name,hostname,contact_str from sip_shared_appearance_subscriptions where " - "aor='%q' and subscriber<>'%q' and profile_name='%q' and hostname='%q'", - aor, contact, profile->name, mod_sofia_globals.hostname); - + sql = switch_mprintf("select subscriber,call_id,aor,profile_name,hostname,contact_str,network_ip from sip_shared_appearance_subscriptions where " + "aor='%q' and profile_name='%q' and hostname='%q'", + aor, profile->name, mod_sofia_globals.hostname); helper.profile = profile; helper.payload = sip->sip_payload->pl_data; /* could just send the WHOLE payload. you'd get the type that way. */ @@ -316,10 +332,11 @@ /* char *profile_name = argv[3]; */ /* char *hostname = argv[4]; */ char *contact_str = argv[5]; + char *network_ip = argv[6]; nua_handle_t *nh; char *route_uri = NULL; - - + char *xml_fixup = NULL; + char *fixup = NULL; nh = nua_handle_by_call_id(helper->profile->nua, call_id); /* that's all you need to find the subscription's nh */ if (nh) { @@ -343,13 +360,27 @@ } } + if (sofia_test_pflag(helper->profile, PFLAG_AUTO_NAT)) { + if (sofia_glue_check_nat(helper->profile, network_ip)) { + fixup = switch_string_replace(helper->payload, helper->profile->sipip, helper->profile->extsipip); + } else { + fixup = switch_string_replace(helper->payload, helper->profile->extsipip, helper->profile->sipip); + } + xml_fixup = fixup; + } else { + xml_fixup = helper->payload; + } + nua_notify(nh, SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=300"), /* XXX MTK FIXME - this is totally fake calculation */ TAG_IF(route_uri, NUTAG_PROXY(route_uri)), SIPTAG_CONTENT_TYPE_STR("application/dialog-info+xml"), /* could've just kept the type from the payload */ - SIPTAG_PAYLOAD_STR(helper->payload), + SIPTAG_PAYLOAD_STR(xml_fixup), TAG_END()); switch_safe_free(route_uri); + if (fixup && fixup != helper->payload) { + free(fixup); + } } return 0; } From brian at freeswitch.org Wed Jun 3 14:15:12 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 16:15:12 -0500 Subject: [Freeswitch-svn] [commit] r13595 - in freeswitch/trunk/conf: autoload_configs sip_profiles Message-ID: Author: brian Date: Wed Jun 3 16:15:12 2009 New Revision: 13595 Log: commit config options for new auto nat Modified: freeswitch/trunk/conf/autoload_configs/acl.conf.xml freeswitch/trunk/conf/sip_profiles/internal.xml Modified: freeswitch/trunk/conf/autoload_configs/acl.conf.xml ============================================================================== --- freeswitch/trunk/conf/autoload_configs/acl.conf.xml (original) +++ freeswitch/trunk/conf/autoload_configs/acl.conf.xml Wed Jun 3 16:15:12 2009 @@ -4,8 +4,9 @@ These ACL's are automatically created on startup. rfc1918.auto - RFC1918 Space - nat.auto - RFC1918 Minus your local lan. + nat.auto - RFC1918 Excluding your local lan. localnet.auto - ACL for your local lan. + loopback.auto - ACL for your local lan. --> Modified: freeswitch/trunk/conf/sip_profiles/internal.xml ============================================================================== --- freeswitch/trunk/conf/sip_profiles/internal.xml (original) +++ freeswitch/trunk/conf/sip_profiles/internal.xml Wed Jun 3 16:15:12 2009 @@ -56,6 +56,11 @@ + + @@ -140,6 +145,12 @@ + From brian at freeswitch.org Wed Jun 3 15:00:50 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 17:00:50 -0500 Subject: [Freeswitch-svn] [commit] r13596 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 17:00:49 2009 New Revision: 13596 Log: fix via for outbound sub and reg contacts are correct Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Wed Jun 3 17:00:49 2009 @@ -134,11 +134,14 @@ for (gw_sub_ptr = gateway_ptr->subscriptions; gw_sub_ptr; gw_sub_ptr = gw_sub_ptr->next) { int ss_state = nua_callstate_authenticating; sub_state_t ostate = gw_sub_ptr->state; + char *user_via = NULL; if (!now) { gw_sub_ptr->state = ostate = SUB_STATE_UNSUBED; gw_sub_ptr->expires_str = "0"; } + + user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); switch (ostate) { case SUB_STATE_NOSUB: @@ -152,18 +155,20 @@ /* not tested .. */ nua_unsubscribe(gateway_ptr->nh, - NUTAG_URL(gateway_ptr->register_url), - SIPTAG_EVENT_STR(gw_sub_ptr->event), - SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type), - SIPTAG_TO_STR(gateway_ptr->register_from), - SIPTAG_FROM_STR(gateway_ptr->register_from), - SIPTAG_CONTACT_STR(gateway_ptr->register_contact), - TAG_NULL()); + NUTAG_URL(gateway_ptr->register_url), + TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), + SIPTAG_EVENT_STR(gw_sub_ptr->event), + SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type), + SIPTAG_TO_STR(gateway_ptr->register_from), + SIPTAG_FROM_STR(gateway_ptr->register_from), + SIPTAG_CONTACT_STR(gateway_ptr->register_contact), + TAG_NULL()); break; case SUB_STATE_UNSUBED: gateway_ptr->sub_nh = nua_handle(gateway_ptr->profile->nua, NULL, NUTAG_URL(gateway_ptr->register_proxy), + TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_TO_STR(gateway_ptr->register_to), NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()); @@ -179,25 +184,27 @@ if (now) { nua_subscribe(gateway_ptr->sub_nh, - NUTAG_URL(gateway_ptr->register_url), - SIPTAG_EVENT_STR(gw_sub_ptr->event), - SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type), - SIPTAG_TO_STR(gateway_ptr->register_from), - SIPTAG_FROM_STR(gateway_ptr->register_from), - SIPTAG_CONTACT_STR(gateway_ptr->register_contact), - SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str), // sofia stack bases its auto-refresh stuff on this - TAG_NULL()); + NUTAG_URL(gateway_ptr->register_url), + TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), + SIPTAG_EVENT_STR(gw_sub_ptr->event), + SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type), + SIPTAG_TO_STR(gateway_ptr->register_from), + SIPTAG_FROM_STR(gateway_ptr->register_from), + SIPTAG_CONTACT_STR(gateway_ptr->register_contact), + SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str), // sofia stack bases its auto-refresh stuff on this + TAG_NULL()); gw_sub_ptr->retry = now + gw_sub_ptr->retry_seconds; } else { nua_unsubscribe(gateway_ptr->sub_nh, - NUTAG_URL(gateway_ptr->register_url), - SIPTAG_EVENT_STR(gw_sub_ptr->event), - SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type), - SIPTAG_FROM_STR(gateway_ptr->register_from), - SIPTAG_TO_STR(gateway_ptr->register_from), - SIPTAG_CONTACT_STR(gateway_ptr->register_contact), - SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str), - TAG_NULL()); + NUTAG_URL(gateway_ptr->register_url), + TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), + SIPTAG_EVENT_STR(gw_sub_ptr->event), + SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type), + SIPTAG_FROM_STR(gateway_ptr->register_from), + SIPTAG_TO_STR(gateway_ptr->register_from), + SIPTAG_CONTACT_STR(gateway_ptr->register_contact), + SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str), + TAG_NULL()); } gw_sub_ptr->state = SUB_STATE_TRYING; break; @@ -215,6 +222,7 @@ } break; } + switch_safe_free(user_via); } } } @@ -248,6 +256,7 @@ for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) { reg_state_t ostate = gateway_ptr->state; + char *user_via = NULL; if (!now) { gateway_ptr->state = ostate = REG_STATE_UNREGED; @@ -301,16 +310,19 @@ gateway_ptr->status = SOFIA_GATEWAY_DOWN; sofia_reg_new_handle(gateway_ptr, now ? 1 : 0); - + + user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Registering %s\n", gateway_ptr->name); if (now) { nua_register(gateway_ptr->nh, NUTAG_URL(gateway_ptr->register_url), TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)), + TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_TO_STR(gateway_ptr->register_from), - SIPTAG_FROM_STR(gateway_ptr->register_from), SIPTAG_CONTACT_STR(gateway_ptr->register_contact), + SIPTAG_FROM_STR(gateway_ptr->register_from), SIPTAG_EXPIRES_STR(gateway_ptr->expires_str), NUTAG_REGISTRAR(gateway_ptr->register_proxy), NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL()); @@ -318,6 +330,7 @@ } else { nua_unregister(gateway_ptr->nh, NUTAG_URL(gateway_ptr->register_url), + TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_FROM_STR(gateway_ptr->register_from), SIPTAG_TO_STR(gateway_ptr->register_from), SIPTAG_CONTACT_STR(gateway_ptr->register_contact), @@ -328,6 +341,8 @@ gateway_ptr->retry = now + gateway_ptr->retry_seconds; gateway_ptr->state = REG_STATE_TRYING; + switch_safe_free(user_via); + break; case REG_STATE_FAILED: From mikej at freeswitch.org Wed Jun 3 15:15:08 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 17:15:08 -0500 Subject: [Freeswitch-svn] [commit] r13597 - freeswitch/trunk Message-ID: Author: mikej Date: Wed Jun 3 17:15:08 2009 New Revision: 13597 Log: add configure check for getifaddrs Modified: freeswitch/trunk/configure.in Modified: freeswitch/trunk/configure.in ============================================================================== --- freeswitch/trunk/configure.in (original) +++ freeswitch/trunk/configure.in Wed Jun 3 17:15:08 2009 @@ -343,7 +343,7 @@ AC_FUNC_MALLOC AC_TYPE_SIGNAL AC_FUNC_STRFTIME -AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep]) +AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep getifaddrs]) AC_CHECK_FUNCS([sched_setscheduler setpriority setrlimit setgroups initgroups]) AC_CHECK_FUNCS([wcsncmp setgroups asprintf setenv pselect gettimeofday localtime_r gmtime_r strcasecmp stricmp _stricmp]) From brian at freeswitch.org Wed Jun 3 15:16:44 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 17:16:44 -0500 Subject: [Freeswitch-svn] [commit] r13598 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 17:16:43 2009 New Revision: 13598 Log: not sure how this flag was removed but its required in auto nat mode Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 17:16:43 2009 @@ -644,13 +644,14 @@ tech_pvt->local_sdp_audio_ip = ip; + if (!(tech_pvt->local_sdp_audio_port = switch_rtp_request_port(tech_pvt->profile->rtpip))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No RTP ports available!\n"); return SWITCH_STATUS_FALSE; } sdp_port = tech_pvt->local_sdp_audio_port; - if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_audio_ip"))) { + if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_audio_ip")) && !sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT)) { if (tech_pvt->profile->extrtpip) { use_ip = tech_pvt->profile->extrtpip; } @@ -705,8 +706,8 @@ if (tech_pvt->profile->extrtpip) { - if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &ip, &sdp_port, tech_pvt->profile->extrtpip, switch_core_session_get_pool(tech_pvt->session)) != - SWITCH_STATUS_SUCCESS) { + if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &ip, &sdp_port, tech_pvt->profile->extrtpip, + switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; } } From brian at freeswitch.org Wed Jun 3 15:30:01 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 17:30:01 -0500 Subject: [Freeswitch-svn] [commit] r13599 - freeswitch/trunk/src/mod/event_handlers/mod_event_socket Message-ID: Author: brian Date: Wed Jun 3 17:30:00 2009 New Revision: 13599 Log: not not right Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c ============================================================================== --- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original) +++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Wed Jun 3 17:30:00 2009 @@ -2244,7 +2244,7 @@ prefs.nat_map = 0; } - if (prefs.nat_map && !switch_check_network_list_ip(prefs.ip, "loopback.auto")) { + if (prefs.nat_map && switch_check_network_list_ip(prefs.ip, "loopback.auto")) { prefs.nat_map = 0; } From anthm at freeswitch.org Wed Jun 3 15:30:09 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 17:30:09 -0500 Subject: [Freeswitch-svn] [commit] r13600 - freeswitch/trunk/src Message-ID: Author: anthm Date: Wed Jun 3 17:30:09 2009 New Revision: 13600 Log: FSBUILD-168 now he has to come to cluecon Modified: freeswitch/trunk/src/switch_utils.c Modified: freeswitch/trunk/src/switch_utils.c ============================================================================== --- freeswitch/trunk/src/switch_utils.c (original) +++ freeswitch/trunk/src/switch_utils.c Wed Jun 3 17:30:09 2009 @@ -740,9 +740,8 @@ return NULL; } -#ifndef WIN32 +#ifdef HAVE_GETIFADDRS #include - static int get_netmask(struct sockaddr_in *me, int *mask) { struct ifaddrs *ifaddrs, *i = NULL; @@ -761,9 +760,78 @@ } } - + freeifaddrs(ifaddrs); + return -2; } +#elif defined(__linux__) + +#include +#include +static int get_netmask(struct sockaddr_in *me, int *mask) +{ + + static struct ifreq ifreqs[20] = { {{{0}}} }; + struct ifconf ifconf; + int nifaces, i; + int sock; + int r = -1; + + memset(&ifconf,0,sizeof(ifconf)); + ifconf.ifc_buf = (char*) (ifreqs); + ifconf.ifc_len = sizeof(ifreqs); + + + if ((sock = socket(AF_INET,SOCK_STREAM, 0)) < 0) { + goto end; + } + + if (ioctl(sock, SIOCGIFCONF, (char *) &ifconf) < 0) { + goto end; + } + + nifaces = ifconf.ifc_len / sizeof(struct ifreq); + + for(i = 0; i < nifaces; i++) { + struct sockaddr_in *sin = NULL; + struct in_addr ip; + + ioctl(sock, SIOCGIFADDR, &ifreqs[i]); + sin = (struct sockaddr_in *)&ifreqs[i].ifr_addr; + ip = sin->sin_addr; + + if (ip.s_addr == me->sin_addr.s_addr) { + ioctl(sock, SIOCGIFNETMASK, &ifreqs[i]); + sin = (struct sockaddr_in *)&ifreqs[i].ifr_addr; + //mask = sin->sin_addr; + *mask = sin->sin_addr.s_addr; + r = 0; + break; + } + + } + + end: + + close(sock); + return r; + +} + +#elif defined(WIN32) + +static int get_netmask(struct sockaddr_in *me, int *mask) +{ + return -1; +} + +#else + +static int get_netmask(struct sockaddr_in *me, int *mask) +{ + return -1; +} + #endif SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *mask, int family) From brian at freeswitch.org Wed Jun 3 18:05:53 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 20:05:53 -0500 Subject: [Freeswitch-svn] [commit] r13601 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 20:05:52 2009 New Revision: 13601 Log: forgot to convert these to use sofia_glue_check_nat Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Wed Jun 3 20:05:52 2009 @@ -1417,9 +1417,7 @@ } contact = sofia_glue_get_url_from_contact(o_contact, 1); - - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && - !switch_check_network_list_ip(network_ip, profile->local_network)) { + if (sofia_glue_check_nat(profile, network_ip)) { char *ptr = NULL; const char *transport_str = NULL; @@ -1557,8 +1555,7 @@ sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && profile->local_network && - !switch_check_network_list_ip(network_ip, profile->local_network)) { + if (sofia_glue_check_nat(profile, network_ip)) { is_auto_nat = 1; } From brian at freeswitch.org Wed Jun 3 18:18:01 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 20:18:01 -0500 Subject: [Freeswitch-svn] [commit] r13602 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 20:18:00 2009 New Revision: 13602 Log: adding test_sql and network_ip to sub callback Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 20:18:00 2009 @@ -3570,7 +3570,8 @@ " user_agent VARCHAR(255),\n" " accept VARCHAR(255),\n" " profile_name VARCHAR(255),\n" - " hostname VARCHAR(255)\n" + " hostname VARCHAR(255),\n" + " network_ip VARCHAR(255)\n" ");\n"; char auth_sql[] = @@ -3621,6 +3622,7 @@ "create index sr_sip_realm on sip_registrations (sip_realm)", "create index ss_call_id on sip_subscriptions (call_id)", "create index ss_hostname on sip_subscriptions (hostname)", + "create index ss_hostname on sip_subscriptions (network_ip)", "create index ss_sip_user on sip_subscriptions (sip_user)", "create index ss_sip_host on sip_subscriptions (sip_host)", "create index ss_presence_hosts on sip_subscriptions (presence_hosts)", @@ -3634,16 +3636,15 @@ "create index sa_nonce on sip_authentication (nonce)", "create index sa_hostname on sip_authentication (hostname)", "create index ssa_hostname on sip_shared_appearance_subscriptions (hostname)", + "create index ssa_hostname on sip_shared_appearance_subscriptions (network_ip)", "create index ssa_subscriber on sip_shared_appearance_subscriptions (subscriber)", "create index ssa_profile_name on sip_shared_appearance_subscriptions (profile_name)", "create index ssa_aor on sip_shared_appearance_subscriptions (aor)", - "create index ssd_profile_name on sip_shared_appearance_dialogs (profile_name)", "create index ssd_hostname on sip_shared_appearance_dialogs (hostname)", "create index ssd_contact_str on sip_shared_appearance_dialogs (contact_str)", "create index ssd_call_id on sip_shared_appearance_dialogs (call_id)", "create index ssd_expires on sip_shared_appearance_dialogs (expires)", - NULL }; @@ -3700,7 +3701,7 @@ } free(test_sql); - test_sql = switch_mprintf("delete from sip_shared_appearance_subscriptions where contact_str='' or hostname='%q'", mod_sofia_globals.hostname); + test_sql = switch_mprintf("delete from sip_shared_appearance_subscriptions where contact_str='' or network_ip='%q'", mod_sofia_globals.hostname); if (switch_odbc_handle_exec(profile->master_odbc, test_sql, NULL) != SWITCH_ODBC_SUCCESS) { switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_shared_appearance_subscriptions", NULL); switch_odbc_handle_exec(profile->master_odbc, shared_appearance_sql, NULL); @@ -3737,7 +3738,7 @@ switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_registrations", reg_sql); free(test_sql); - test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q'", mod_sofia_globals.hostname); + test_sql = switch_mprintf("delete from sip_subscriptions where network_ip='%q'", mod_sofia_globals.hostname); switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_subscriptions", sub_sql); free(test_sql); @@ -3754,7 +3755,7 @@ free(test_sql); - test_sql = switch_mprintf("delete from sip_shared_appearance_subscriptions where contact_str = '' or hostname='%q'", mod_sofia_globals.hostname); + test_sql = switch_mprintf("delete from sip_shared_appearance_subscriptions where contact_str = '' or network_ip='%q'", mod_sofia_globals.hostname); switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_shared_appearance_subscriptions", shared_appearance_sql); free(test_sql); @@ -3775,6 +3776,8 @@ NULL, NULL, NULL); switch_core_db_exec(profile->master_db, "create index if not exists ssd_hostname on sip_shared_appearance_dialogs (hostname)", NULL, NULL, NULL); + switch_core_db_exec(profile->master_db, "create index if not exists ssd_hostname on sip_shared_appearance_dialogs (network_ip)", + NULL, NULL, NULL); switch_core_db_exec(profile->master_db, "create index if not exists ssd_contact_str on sip_shared_appearance_dialogs (contact_str)", NULL, NULL, NULL); switch_core_db_exec(profile->master_db, "create index if not exists ssd_call_id on sip_shared_appearance_dialogs (call_id)", @@ -3801,6 +3804,7 @@ switch_core_db_exec(profile->master_db, "create index if not exists ss_call_id on sip_subscriptions (call_id)", NULL, NULL, NULL); switch_core_db_exec(profile->master_db, "create index if not exists ss_hostname on sip_subscriptions (hostname)", NULL, NULL, NULL); + switch_core_db_exec(profile->master_db, "create index if not exists ss_hostname on sip_subscriptions (network_ip)", NULL, NULL, NULL); switch_core_db_exec(profile->master_db, "create index if not exists ss_sip_user on sip_subscriptions (sip_user)", NULL, NULL, NULL); switch_core_db_exec(profile->master_db, "create index if not exists ss_sip_host on sip_subscriptions (sip_host)", NULL, NULL, NULL); switch_core_db_exec(profile->master_db, "create index if not exists ss_presence_hosts on sip_subscriptions (presence_hosts)", NULL, NULL, NULL); Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Wed Jun 3 20:18:00 2009 @@ -209,7 +209,7 @@ if ((sql = switch_mprintf( "select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from," - "full_via,expires,user_agent,accept,profile_name" + "full_via,expires,user_agent,accept,profile_name,network_ip" ",-1,'unavailable','unavailable' from sip_subscriptions where event='presence' and hostname='%q'", mod_sofia_globals.hostname))) { switch_mutex_lock(mod_sofia_globals.hash_mutex); @@ -354,13 +354,13 @@ if (for_everyone) { sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from," - "full_via,expires,user_agent,accept,profile_name" + "full_via,expires,user_agent,accept,profile_name,network_ip" ",'%q','%q' from sip_subscriptions where event='message-summary' " "and sub_to_user='%q' and (sub_to_host='%q' or presence_hosts like '%%%q%%')", stream.data, host, user, host, host); } else if (sub_call_id) { sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from," - "full_via,expires,user_agent,accept,profile_name" + "full_via,expires,user_agent,accept,profile_name,network_ip" ",'%q','%q' from sip_subscriptions where event='message-summary' " "and sub_to_user='%q' and (sub_to_host='%q' or presence_hosts like '%%%q%%' and call_id='%q')", stream.data, host, user, host, host, sub_call_id); @@ -446,7 +446,7 @@ "sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event," "sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from," "sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent," - "sip_subscriptions.accept,sip_subscriptions.profile_name" + "sip_subscriptions.accept,sip_subscriptions.profile_name,sip_subscriptions.network_ip" ",1,'%q','%q',sip_presence.status,sip_presence.rpid " "from sip_subscriptions left join sip_presence on " "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and " @@ -459,7 +459,7 @@ "sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event," "sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from," "sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent," - "sip_subscriptions.accept,sip_subscriptions.profile_name" + "sip_subscriptions.accept,sip_subscriptions.profile_name,sip_subscriptions.network_ip" ",1,'%q','%q',sip_presence.status,sip_presence.rpid " "from sip_subscriptions left join sip_presence on " "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and " @@ -1777,15 +1777,12 @@ sql = switch_mprintf("insert into sip_subscriptions " "(proto,sip_user,sip_host,sub_to_user,sub_to_host,presence_hosts,event,contact,call_id,full_from," - "full_via,expires,user_agent,accept,profile_name,hostname) " - "values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q','%q','%q')", + "full_via,expires,user_agent,accept,profile_name,hostname,network_ip) " + "values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q','%q','%q','%q')", proto, from_user, from_host, to_user, to_host, profile->presence_hosts ? profile->presence_hosts : to_host, event, contact_str, call_id, full_from, full_via, - exp_delta * -1, - //exp_abs + SUB_OVERLAP, - - full_agent, accept, profile->name,mod_sofia_globals.hostname); + full_agent, accept, profile->name,mod_sofia_globals.hostname, network_ip); if (mod_sofia_globals.debug_presence > 0) { From brian at freeswitch.org Wed Jun 3 21:04:15 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 23:04:15 -0500 Subject: [Freeswitch-svn] [commit] r13603 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 23:04:14 2009 New Revision: 13603 Log: adding network_ip to the dialogs Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 23:04:14 2009 @@ -3600,7 +3600,8 @@ " hostname VARCHAR(255),\n" " contact_str VARCHAR(255),\n" " call_id VARCHAR(255),\n" - " expires INTEGER\n" + " expires INTEGER,\n" + " network_ip VARCHAR(255)\n" ");\n"; if (profile->odbc_dsn) { @@ -3645,6 +3646,7 @@ "create index ssd_contact_str on sip_shared_appearance_dialogs (contact_str)", "create index ssd_call_id on sip_shared_appearance_dialogs (call_id)", "create index ssd_expires on sip_shared_appearance_dialogs (expires)", + "create index ssd_expires on sip_shared_appearance_dialogs (network_ip)", NULL }; @@ -3709,7 +3711,7 @@ free(test_sql); - test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str='' or hostname='%q'", mod_sofia_globals.hostname); + test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str='' or network_ip='%q'", mod_sofia_globals.hostname); if (switch_odbc_handle_exec(profile->master_odbc, test_sql, NULL) != SWITCH_ODBC_SUCCESS) { switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_shared_appearance_dialogs", NULL); switch_odbc_handle_exec(profile->master_odbc, shared_appearance_dialogs_sql, NULL); @@ -3759,7 +3761,7 @@ switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_shared_appearance_subscriptions", shared_appearance_sql); free(test_sql); - test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str = '' or hostname='%q'", mod_sofia_globals.hostname); + test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str = '' or network_ip='%q'", mod_sofia_globals.hostname); switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_shared_appearance_dialogs", shared_appearance_dialogs_sql); free(test_sql); Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Wed Jun 3 23:04:14 2009 @@ -237,13 +237,16 @@ time_t expires = switch_epoch_time_now(NULL); char *sql; char *contact_str = strip_uri(full_contact); + char network_ip[80]; + int network_port = 0; if (sip && sip->sip_expires) { expires += sip->sip_expires->ex_delta + 30; } + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); - if ((sql = switch_mprintf("insert into sip_shared_appearance_dialogs (profile_name, hostname, contact_str, call_id, expires) " - "values ('%q','%q','%q','%q','%ld')", + if ((sql = switch_mprintf("insert into sip_shared_appearance_dialogs (profile_name, hostname, contact_str, call_id, expires, network_ip) " + "values ('%q','%q','%q','%q','%ld','%q')", profile->name, mod_sofia_globals.hostname, contact_str, sip->sip_call_id->i_id, (long)expires))) { sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); } From brian at freeswitch.org Wed Jun 3 21:05:48 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 23:05:48 -0500 Subject: [Freeswitch-svn] [commit] r13604 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 23:05:48 2009 New Revision: 13604 Log: fix sql query missing network_ip for callback Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Wed Jun 3 23:05:48 2009 @@ -1866,7 +1866,7 @@ if ((sql = switch_mprintf( "select proto,sip_user,'%q',sub_to_user,sub_to_host,event,contact,call_id,full_from," - "full_via,expires,user_agent,accept,profile_name" + "full_via,expires,user_agent,accept,profile_name,network_ip" " from sip_subscriptions where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", to_host, to_user, to_host, to_host))) { sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_sub_reg_callback, profile); From brian at freeswitch.org Wed Jun 3 21:10:41 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 23:10:41 -0500 Subject: [Freeswitch-svn] [commit] r13605 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Wed Jun 3 23:10:40 2009 New Revision: 13605 Log: woops Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Wed Jun 3 23:10:40 2009 @@ -3600,8 +3600,7 @@ " hostname VARCHAR(255),\n" " contact_str VARCHAR(255),\n" " call_id VARCHAR(255),\n" - " expires INTEGER,\n" - " network_ip VARCHAR(255)\n" + " expires INTEGER\n" ");\n"; if (profile->odbc_dsn) { @@ -3646,7 +3645,6 @@ "create index ssd_contact_str on sip_shared_appearance_dialogs (contact_str)", "create index ssd_call_id on sip_shared_appearance_dialogs (call_id)", "create index ssd_expires on sip_shared_appearance_dialogs (expires)", - "create index ssd_expires on sip_shared_appearance_dialogs (network_ip)", NULL }; @@ -3711,7 +3709,7 @@ free(test_sql); - test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str='' or network_ip='%q'", mod_sofia_globals.hostname); + test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str='' or hostname='%q'", mod_sofia_globals.hostname); if (switch_odbc_handle_exec(profile->master_odbc, test_sql, NULL) != SWITCH_ODBC_SUCCESS) { switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_shared_appearance_dialogs", NULL); switch_odbc_handle_exec(profile->master_odbc, shared_appearance_dialogs_sql, NULL); @@ -3761,7 +3759,7 @@ switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_shared_appearance_subscriptions", shared_appearance_sql); free(test_sql); - test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str = '' or network_ip='%q'", mod_sofia_globals.hostname); + test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str = '' or hostname='%q'", mod_sofia_globals.hostname); switch_core_db_test_reactive(profile->master_db, test_sql, "DROP TABLE sip_shared_appearance_dialogs", shared_appearance_dialogs_sql); free(test_sql); Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c Wed Jun 3 23:10:40 2009 @@ -237,16 +237,13 @@ time_t expires = switch_epoch_time_now(NULL); char *sql; char *contact_str = strip_uri(full_contact); - char network_ip[80]; - int network_port = 0; if (sip && sip->sip_expires) { expires += sip->sip_expires->ex_delta + 30; } - sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); - if ((sql = switch_mprintf("insert into sip_shared_appearance_dialogs (profile_name, hostname, contact_str, call_id, expires, network_ip) " - "values ('%q','%q','%q','%q','%ld','%q')", + if ((sql = switch_mprintf("insert into sip_shared_appearance_dialogs (profile_name, hostname, contact_str, call_id, expires) " + "values ('%q','%q','%q','%q','%ld')", profile->name, mod_sofia_globals.hostname, contact_str, sip->sip_call_id->i_id, (long)expires))) { sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); } From robertj at freeswitch.org Wed Jun 3 21:15:06 2009 From: robertj at freeswitch.org (FreeSWITCH SVN) Date: Wed, 03 Jun 2009 23:15:06 -0500 Subject: [Freeswitch-svn] [commit] r13606 - freeswitch/trunk/src/mod/endpoints/mod_opal Message-ID: Author: robertj Date: Wed Jun 3 23:15:05 2009 New Revision: 13606 Log: Fixed call deflect, previous code was uncompilable on any version of OPAL. Sorry total brain fade there. Modified: freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp Modified: freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp (original) +++ freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp Wed Jun 3 23:15:05 2009 @@ -995,9 +995,9 @@ case SWITCH_MESSAGE_INDICATE_DEFLECT: { - char transfer_to[128] = ""; - switch_set_string(transfer_to, msg->string_arg); - GetCall().Transfer(transfer_to); + PSafePtr other = GetOtherPartyConnection(); + if (other != NULL) + other->TransferConnection(msg->string_arg); break; } From mikej at freeswitch.org Wed Jun 3 22:23:19 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 00:23:19 -0500 Subject: [Freeswitch-svn] [commit] r13607 - freeswitch/trunk/src Message-ID: Author: mikej Date: Thu Jun 4 00:23:19 2009 New Revision: 13607 Log: add netmask code for windows Modified: freeswitch/trunk/src/switch_utils.c Modified: freeswitch/trunk/src/switch_utils.c ============================================================================== --- freeswitch/trunk/src/switch_utils.c (original) +++ freeswitch/trunk/src/switch_utils.c Thu Jun 4 00:23:19 2009 @@ -822,7 +822,34 @@ static int get_netmask(struct sockaddr_in *me, int *mask) { - return -1; + SOCKET sock = WSASocket(AF_INET, SOCK_DGRAM, 0, 0, 0, 0); + INTERFACE_INFO interfaces[20]; + unsigned long bytes; + int interface_count, x; + + *mask = 0; + + if (sock == SOCKET_ERROR) { + return -1; + } + + if (WSAIoctl(sock, SIO_GET_INTERFACE_LIST, 0, 0, &interfaces, sizeof(interfaces), &bytes, 0, 0) == SOCKET_ERROR) { + return -1; + } + + interface_count = bytes / sizeof(INTERFACE_INFO); + + for (x = 0; x < interface_count; ++x) { + struct sockaddr_in *addr = (struct sockaddr_in *) & (interfaces[x].iiAddress); + + if (addr->sin_addr.s_addr == me->sin_addr.s_addr) { + struct sockaddr_in *netmask = (struct sockaddr_in *) & (interfaces[x].iiNetmask); + *mask = netmask->sin_addr.s_addr; + break; + } + } + + return 0; } #else @@ -888,17 +915,15 @@ return status; } - if (mask) { - *mask = 0; // find the right one - } closesocket(tmp_socket); freeaddrinfo(address_info); if (!getnameinfo((const struct sockaddr *) &l_address, l_address_len, buf, len, NULL, 0, NI_NUMERICHOST)) { - - status = SWITCH_STATUS_SUCCESS; - + status = SWITCH_STATUS_SUCCESS; + if (mask) { + get_netmask((struct sockaddr_in *) &l_address, mask); + } } #else From brian at freeswitch.org Wed Jun 3 22:43:35 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 00:43:35 -0500 Subject: [Freeswitch-svn] [commit] r13608 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Thu Jun 4 00:43:34 2009 New Revision: 13608 Log: check the nat Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Thu Jun 4 00:43:34 2009 @@ -311,7 +311,9 @@ sofia_reg_new_handle(gateway_ptr, now ? 1 : 0); - user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); + if (sofia_glue_check_nat(gateway_ptr->profile, gateway_ptr->register_proxy)) { + user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); + } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Registering %s\n", gateway_ptr->name); From brian at freeswitch.org Wed Jun 3 22:48:59 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 00:48:59 -0500 Subject: [Freeswitch-svn] [commit] r13609 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Thu Jun 4 00:48:59 2009 New Revision: 13609 Log: don't need contact here its already set on the nh .. this results on double contact headers on unregister Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Thu Jun 4 00:48:59 2009 @@ -335,7 +335,6 @@ TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_FROM_STR(gateway_ptr->register_from), SIPTAG_TO_STR(gateway_ptr->register_from), - SIPTAG_CONTACT_STR(gateway_ptr->register_contact), SIPTAG_EXPIRES_STR(gateway_ptr->expires_str), NUTAG_REGISTRAR(gateway_ptr->register_proxy), NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL()); From brian at freeswitch.org Wed Jun 3 22:50:17 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 00:50:17 -0500 Subject: [Freeswitch-svn] [commit] r13610 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Thu Jun 4 00:50:16 2009 New Revision: 13610 Log: missed one Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Thu Jun 4 00:50:16 2009 @@ -141,8 +141,10 @@ gw_sub_ptr->expires_str = "0"; } - user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); - + if (sofia_glue_check_nat(gateway_ptr->profile, gateway_ptr->register_proxy)) { + user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); + } + switch (ostate) { case SUB_STATE_NOSUB: break; From rupa at freeswitch.org Thu Jun 4 06:56:29 2009 From: rupa at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 08:56:29 -0500 Subject: [Freeswitch-svn] [commit] r13611 - freeswitch/trunk/src/mod/applications/mod_lcr Message-ID: Author: rupa Date: Thu Jun 4 08:56:28 2009 New Revision: 13611 Log: honor effective_caller_id_number for CID override Modified: freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c Modified: freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c (original) +++ freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c Thu Jun 4 08:56:28 2009 @@ -1086,7 +1086,10 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "LCR Lookup on %s using profile %s\n", dest, lcr_profile); routes.lookup_number = dest; if (caller_profile) { - routes.cid = (char *) caller_profile->caller_id_number; + routes.cid = (char *) switch_channel_get_variable(channel, "effective_caller_id_number"); + if (!routes.cid) { + routes.cid = (char *) caller_profile->caller_id_number; + } } if (!(routes.profile = locate_profile(lcr_profile))) { From brian at freeswitch.org Thu Jun 4 07:10:32 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 09:10:32 -0500 Subject: [Freeswitch-svn] [commit] r13612 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Thu Jun 4 09:10:31 2009 New Revision: 13612 Log: dont leak this in other cases. Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Thu Jun 4 09:10:31 2009 @@ -342,10 +342,7 @@ NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL()); } gateway_ptr->retry = now + gateway_ptr->retry_seconds; - gateway_ptr->state = REG_STATE_TRYING; - - switch_safe_free(user_via); - + gateway_ptr->state = REG_STATE_TRYING; break; case REG_STATE_FAILED: @@ -374,6 +371,7 @@ if (ostate != gateway_ptr->state) { sofia_reg_fire_custom_gateway_state_event(gateway_ptr); } + switch_safe_free(user_via); } } From brian at freeswitch.org Thu Jun 4 07:53:23 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 09:53:23 -0500 Subject: [Freeswitch-svn] [commit] r13613 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Thu Jun 4 09:53:23 2009 New Revision: 13613 Log: don't have contact str here either it'll result in double contact headers on unregister Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Thu Jun 4 09:53:23 2009 @@ -85,7 +85,6 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "UN-Registering %s\n", gateway_ptr->name); nua_unregister(gateway_ptr->nh, NUTAG_URL(gateway_ptr->register_url), - SIPTAG_CONTACT_STR(gateway_ptr->register_contact), NUTAG_REGISTRAR(gateway_ptr->register_proxy), TAG_END()); } From brian at freeswitch.org Thu Jun 4 09:53:28 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 11:53:28 -0500 Subject: [Freeswitch-svn] [commit] r13614 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Thu Jun 4 11:53:27 2009 New Revision: 13614 Log: use user_via if we send a 180 or 183 Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Thu Jun 4 11:53:27 2009 @@ -1426,7 +1426,10 @@ case SWITCH_MESSAGE_INDICATE_RINGING: if (!switch_channel_test_flag(channel, CF_RING_READY) && !sofia_test_flag(tech_pvt, TFLAG_BYE) && !switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED)) { - nua_respond(tech_pvt->nh, SIP_180_RINGING, SIPTAG_CONTACT_STR(tech_pvt->reply_contact), SIPTAG_HEADER_STR(generate_pai_str(session)), TAG_END()); + nua_respond(tech_pvt->nh, SIP_180_RINGING, + TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), + SIPTAG_CONTACT_STR(tech_pvt->reply_contact), + SIPTAG_HEADER_STR(generate_pai_str(session)), TAG_END()); switch_channel_mark_ring_ready(channel); } break; @@ -1501,6 +1504,7 @@ nua_respond(tech_pvt->nh, SIP_183_SESSION_PROGRESS, NUTAG_AUTOANSWER(0), + TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)), SIPTAG_HEADER_STR(generate_pai_str(session)), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), From mrene at freeswitch.org Thu Jun 4 10:26:05 2009 From: mrene at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 12:26:05 -0500 Subject: [Freeswitch-svn] [commit] r13615 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: mrene Date: Thu Jun 4 12:26:05 2009 New Revision: 13615 Log: mod_sofia: Move siptrace to loglevel INFO Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Thu Jun 4 12:26:05 2009 @@ -1003,9 +1003,9 @@ static void logger(void *logarg, char const *fmt, va_list ap) { if (fmt && ap) { - switch_log_vprintf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, fmt, ap); + switch_log_vprintf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, fmt, ap); } else if (fmt && !ap) { - switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "%s", fmt); + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO, "%s", fmt); } } From anthm at freeswitch.org Thu Jun 4 11:56:34 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 13:56:34 -0500 Subject: [Freeswitch-svn] [commit] r13616 - freeswitch/trunk/src Message-ID: Author: anthm Date: Thu Jun 4 13:56:34 2009 New Revision: 13616 Log: tweak rtp timing stuff Modified: freeswitch/trunk/src/switch_rtp.c Modified: freeswitch/trunk/src/switch_rtp.c ============================================================================== --- freeswitch/trunk/src/switch_rtp.c (original) +++ freeswitch/trunk/src/switch_rtp.c Thu Jun 4 13:56:34 2009 @@ -212,6 +212,7 @@ uint32_t cng_count; switch_rtp_bug_flag_t rtp_bugs; switch_rtp_stats_t stats; + int hot_hits; #ifdef ENABLE_ZRTP zrtp_session_t *zrtp_session; @@ -1764,16 +1765,27 @@ if ((switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOFLUSH) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH)) && rtp_session->read_pollfd) { if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 1) == SWITCH_STATUS_SUCCESS) { - hot_socket = 1; + if (++rtp_session->hot_hits >= 10) { + hot_socket = 1; + } + } else { + rtp_session->hot_hits = 0; } } - if (!hot_socket) { + + if (hot_socket) { + switch_core_timer_sync(&rtp_session->timer); + } else { switch_core_timer_next(&rtp_session->timer); } } recvfrom: + if (!switch_rtp_ready(rtp_session)) { + break; + } + if (!rtp_session->timer.interval && rtp_session->read_pollfd) { poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, poll_sec * 1000000); } @@ -2101,6 +2113,12 @@ if (do_cng) { uint8_t *data = (uint8_t *) rtp_session->recv_msg.body; + int fdr; + + if ((poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, 1)) == SWITCH_STATUS_SUCCESS) { + goto recvfrom; + } + memset(data, 0, 2); data[0] = 65; rtp_session->recv_msg.header.pt = (uint32_t) rtp_session->cng_pt ? rtp_session->cng_pt : SWITCH_RTP_CNG_PAYLOAD; From brian at freeswitch.org Thu Jun 4 12:04:14 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 14:04:14 -0500 Subject: [Freeswitch-svn] [commit] r13617 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Thu Jun 4 14:04:14 2009 New Revision: 13617 Log: sofia does the right thing... confused with users report of it not working Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Thu Jun 4 14:04:14 2009 @@ -1427,7 +1427,6 @@ if (!switch_channel_test_flag(channel, CF_RING_READY) && !sofia_test_flag(tech_pvt, TFLAG_BYE) && !switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED)) { nua_respond(tech_pvt->nh, SIP_180_RINGING, - TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), SIPTAG_HEADER_STR(generate_pai_str(session)), TAG_END()); switch_channel_mark_ring_ready(channel); @@ -1504,7 +1503,6 @@ nua_respond(tech_pvt->nh, SIP_183_SESSION_PROGRESS, NUTAG_AUTOANSWER(0), - TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)), SIPTAG_HEADER_STR(generate_pai_str(session)), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), From brian at freeswitch.org Thu Jun 4 12:58:37 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 14:58:37 -0500 Subject: [Freeswitch-svn] [commit] r13618 - freeswitch/trunk/conf/sip_profiles Message-ID: Author: brian Date: Thu Jun 4 14:58:36 2009 New Revision: 13618 Log: enable auto-nat by default Modified: freeswitch/trunk/conf/sip_profiles/internal.xml Modified: freeswitch/trunk/conf/sip_profiles/internal.xml ============================================================================== --- freeswitch/trunk/conf/sip_profiles/internal.xml (original) +++ freeswitch/trunk/conf/sip_profiles/internal.xml Thu Jun 4 14:58:36 2009 @@ -151,8 +151,9 @@ auto - Use guessed ip. auto-nat - Use ip learned from NAT-PMP or UPNP --> - - + + + From mikej at freeswitch.org Thu Jun 4 13:00:53 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 15:00:53 -0500 Subject: [Freeswitch-svn] [commit] r13619 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: mikej Date: Thu Jun 4 15:00:53 2009 New Revision: 13619 Log: sofia-sip: fix re-register after 423 w/ Min-Expires (SFSIP-143) Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Thu Jun 4 15:00:53 2009 @@ -310,7 +310,7 @@ case REG_STATE_UNREGED: gateway_ptr->status = SOFIA_GATEWAY_DOWN; - sofia_reg_new_handle(gateway_ptr, now ? 1 : 0); + if (!gateway_ptr->nh) sofia_reg_new_handle(gateway_ptr, now ? 1 : 0); if (sofia_glue_check_nat(gateway_ptr->profile, gateway_ptr->register_proxy)) { user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); @@ -1422,6 +1422,15 @@ if (expi > 0 && expi != sofia_private->gateway->freq) { sofia_private->gateway->freq = expi; + sofia_private->gateway->expires_str = switch_core_sprintf(sofia_private->gateway->pool, "%d", expi); + + if (expi > 60) { + sofia_private->gateway->expires = switch_epoch_time_now(NULL) + (expi - 15); + } else { + sofia_private->gateway->expires = switch_epoch_time_now(NULL) + (expi - 2); + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Changing expire time to %d by request of proxy %s\n", expi, sofia_private->gateway->register_proxy); } From brian at freeswitch.org Thu Jun 4 13:05:53 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 15:05:53 -0500 Subject: [Freeswitch-svn] [commit] r13620 - freeswitch/trunk/conf/directory/default Message-ID: Author: brian Date: Thu Jun 4 15:05:53 2009 New Revision: 13620 Log: default config tweak Modified: freeswitch/trunk/conf/directory/default/example.com.xml Modified: freeswitch/trunk/conf/directory/default/example.com.xml ============================================================================== --- freeswitch/trunk/conf/directory/default/example.com.xml (original) +++ freeswitch/trunk/conf/directory/default/example.com.xml Thu Jun 4 15:05:53 2009 @@ -14,7 +14,7 @@ - + From mikej at freeswitch.org Thu Jun 4 14:11:30 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 16:11:30 -0500 Subject: [Freeswitch-svn] [commit] r13621 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/soa Message-ID: Author: mikej Date: Thu Jun 4 16:11:29 2009 New Revision: 13621 Log: use addres, id, and version from user sdp if they exist Modified: freeswitch/trunk/libs/sofia-sip/.update freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c Modified: freeswitch/trunk/libs/sofia-sip/.update ============================================================================== --- freeswitch/trunk/libs/sofia-sip/.update (original) +++ freeswitch/trunk/libs/sofia-sip/.update Thu Jun 4 16:11:29 2009 @@ -1 +1 @@ -Mon Jun 1 17:51:14 CDT 2009 +Thu Jun 4 16:10:50 CDT 2009 Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c ============================================================================== --- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c (original) +++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c Thu Jun 4 16:11:29 2009 @@ -1291,6 +1291,17 @@ if (user->sdp_origin) o->o_username = user->sdp_origin->o_username; + if (user->sdp_origin->o_address) + o->o_address = user->sdp_origin->o_address; + + if (user->sdp_origin->o_id) + o->o_id = user->sdp_origin->o_id; + + if (user->sdp_origin->o_version && user->sdp_origin->o_version != o->o_version) { + o->o_version = user->sdp_origin->o_version; + o->o_version--; + } + if (soa_init_sdp_origin_with_session(ss, o, c0_buffer, local) < 0) { phrase = "Cannot Get IP Address for Session Description"; goto internal_error; From brian at freeswitch.org Thu Jun 4 14:39:49 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 16:39:49 -0500 Subject: [Freeswitch-svn] [commit] r13622 - freeswitch/trunk/conf/sip_profiles Message-ID: Author: brian Date: Thu Jun 4 16:39:49 2009 New Revision: 13622 Log: more auto stuff for external which now you can use ONLY for providers Modified: freeswitch/trunk/conf/sip_profiles/external.xml freeswitch/trunk/conf/sip_profiles/internal.xml Modified: freeswitch/trunk/conf/sip_profiles/external.xml ============================================================================== --- freeswitch/trunk/conf/sip_profiles/external.xml (original) +++ freeswitch/trunk/conf/sip_profiles/external.xml Thu Jun 4 16:39:49 2009 @@ -6,8 +6,10 @@ + + + --> @@ -27,6 +29,7 @@ + - - + + Modified: freeswitch/trunk/conf/sip_profiles/internal.xml ============================================================================== --- freeswitch/trunk/conf/sip_profiles/internal.xml (original) +++ freeswitch/trunk/conf/sip_profiles/internal.xml Thu Jun 4 16:39:49 2009 @@ -9,7 +9,9 @@ + From mikej at freeswitch.org Thu Jun 4 15:01:46 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 17:01:46 -0500 Subject: [Freeswitch-svn] [commit] r13623 - freeswitch/trunk/build Message-ID: Author: mikej Date: Thu Jun 4 17:01:46 2009 New Revision: 13623 Log: build: fix jobserver unavailable bug in make -j (FSBUILD-6) Modified: freeswitch/trunk/build/modmake.rules.in Modified: freeswitch/trunk/build/modmake.rules.in ============================================================================== --- freeswitch/trunk/build/modmake.rules.in (original) +++ freeswitch/trunk/build/modmake.rules.in Thu Jun 4 17:01:46 2009 @@ -57,7 +57,7 @@ RECURSE_OUR_DEPS=`test -z "$(WANT_CURL)" || if test ! -z "$(LIBCURL_DEPS)"; then echo $(CURLLA); fi ` RECURSE_OUR_CFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL_CPPFLAGS) ; $(LOCAL_INSERT_CFLAGS) ` RECURSE_OUR_LDFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL) ; $(LOCAL_INSERT_LDFLAGS) ` -RECURSE_MAKE=modname="$(RECURSE_MODNAME)" ; \ +RECURSE_MAKE=+modname="$(RECURSE_MODNAME)" ; \ sourcefile="$(RECURSE_SOURCEFILE)" ; \ osarch=`uname -s` ; \ ourdefs="$(RECURSE_OUR_DEPS)" ; \ From mcollins at freeswitch.org Thu Jun 4 15:28:38 2009 From: mcollins at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 17:28:38 -0500 Subject: [Freeswitch-svn] [commit] r13624 - freeswitch/trunk/docs/phrase Message-ID: Author: mcollins Date: Thu Jun 4 17:28:38 2009 New Revision: 13624 Log: Add Stephane Alnet's French translations to phrase_fr.xml Modified: freeswitch/trunk/docs/phrase/phrase_fr.xml Modified: freeswitch/trunk/docs/phrase/phrase_fr.xml ============================================================================== --- freeswitch/trunk/docs/phrase/phrase_fr.xml (original) +++ freeswitch/trunk/docs/phrase/phrase_fr.xml Thu Jun 4 17:28:38 2009 @@ -1,10 +1,10 @@ - - - - + + + + @@ -33,8 +33,8 @@ - - + + @@ -55,7 +55,7 @@ - + @@ -63,7 +63,7 @@ - + @@ -88,12 +88,12 @@ - + - + @@ -103,7 +103,7 @@ - + @@ -113,29 +113,28 @@ - - - - - - + + + + + - - + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From anthm at freeswitch.org Thu Jun 4 18:05:12 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 20:05:12 -0500 Subject: [Freeswitch-svn] [commit] r13625 - in freeswitch/trunk/src: . include Message-ID: Author: anthm Date: Thu Jun 4 20:05:11 2009 New Revision: 13625 Log: add hunt_caller_profile Modified: freeswitch/trunk/src/include/switch_caller.h freeswitch/trunk/src/include/switch_channel.h freeswitch/trunk/src/switch_channel.c freeswitch/trunk/src/switch_core_session.c Modified: freeswitch/trunk/src/include/switch_caller.h ============================================================================== --- freeswitch/trunk/src/include/switch_caller.h (original) +++ freeswitch/trunk/src/include/switch_caller.h Thu Jun 4 20:05:11 2009 @@ -99,6 +99,7 @@ switch_caller_profile_flag_t flags; struct switch_caller_profile *originator_caller_profile; struct switch_caller_profile *originatee_caller_profile; + struct switch_caller_profile *hunt_caller_profile; struct switch_channel_timetable *times; struct switch_caller_extension *caller_extension; switch_memory_pool_t *pool; Modified: freeswitch/trunk/src/include/switch_channel.h ============================================================================== --- freeswitch/trunk/src/include/switch_channel.h (original) +++ freeswitch/trunk/src/include/switch_channel.h Thu Jun 4 20:05:11 2009 @@ -189,6 +189,8 @@ */ SWITCH_DECLARE(void) switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); +SWITCH_DECLARE(void) switch_channel_set_hunt_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); + /*! \brief Retrive the given channel's originator caller profile \param channel channel to retrive the profile from Modified: freeswitch/trunk/src/switch_channel.c ============================================================================== --- freeswitch/trunk/src/switch_channel.c (original) +++ freeswitch/trunk/src/switch_channel.c Thu Jun 4 20:05:11 2009 @@ -1483,6 +1483,19 @@ switch_mutex_unlock(channel->profile_mutex); } +SWITCH_DECLARE(void) switch_channel_set_hunt_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile) +{ + switch_assert(channel != NULL); + switch_assert(channel->caller_profile != NULL); + + switch_mutex_lock(channel->profile_mutex); + channel->caller_profile->hunt_caller_profile = NULL; + if (channel->caller_profile && caller_profile) { + channel->caller_profile->hunt_caller_profile = caller_profile; + } + switch_mutex_unlock(channel->profile_mutex); +} + SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile) { switch_assert(channel != NULL); Modified: freeswitch/trunk/src/switch_core_session.c ============================================================================== --- freeswitch/trunk/src/switch_core_session.c (original) +++ freeswitch/trunk/src/switch_core_session.c Thu Jun 4 20:05:11 2009 @@ -1526,6 +1526,7 @@ dpstr = switch_core_session_strdup(session, new_profile->dialplan); + switch_channel_set_hunt_caller_profile(channel, new_profile); argc = switch_separate_string(dpstr, ',', dp, (sizeof(dp) / sizeof(dp[0]))); for (x = 0; x < argc; x++) { char *dpname = dp[x]; @@ -1581,6 +1582,8 @@ } done: + switch_channel_set_hunt_caller_profile(channel, NULL); + session->stack_count--; return status; } From mrene at freeswitch.org Thu Jun 4 18:16:03 2009 From: mrene at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 20:16:03 -0500 Subject: [Freeswitch-svn] [commit] r13626 - freeswitch/trunk/src Message-ID: Author: mrene Date: Thu Jun 4 20:16:02 2009 New Revision: 13626 Log: add hunt_caller_profile Modified: freeswitch/trunk/src/switch_caller.c freeswitch/trunk/src/switch_channel.c freeswitch/trunk/src/switch_core_session.c Modified: freeswitch/trunk/src/switch_caller.c ============================================================================== --- freeswitch/trunk/src/switch_caller.c (original) +++ freeswitch/trunk/src/switch_caller.c Thu Jun 4 20:16:02 2009 @@ -50,6 +50,8 @@ switch_caller_profile_t *profile = NULL; profile = switch_core_alloc(pool, sizeof(*profile)); + memset(profile, 0, sizeof(*profile)); + switch_assert(profile != NULL); if (!context) { Modified: freeswitch/trunk/src/switch_channel.c ============================================================================== --- freeswitch/trunk/src/switch_channel.c (original) +++ freeswitch/trunk/src/switch_channel.c Thu Jun 4 20:16:02 2009 @@ -495,7 +495,7 @@ switch_mutex_lock(channel->profile_mutex); if (!channel->variables || !(v = switch_event_get_header(channel->variables, varname))) { - switch_caller_profile_t *cp = channel->caller_profile; + switch_caller_profile_t *cp = switch_channel_get_caller_profile(channel); if (cp) { if (!strncmp(varname, "aleg_", 5)) { @@ -1460,7 +1460,7 @@ switch_caller_profile_t *profile; switch_assert(channel != NULL); switch_mutex_lock(channel->profile_mutex); - profile = channel->caller_profile; + profile = channel->hunt_caller_profile ? channel->hunt_caller_profile : channel->caller_profile; switch_mutex_unlock(channel->profile_mutex); return profile; } Modified: freeswitch/trunk/src/switch_core_session.c ============================================================================== --- freeswitch/trunk/src/switch_core_session.c (original) +++ freeswitch/trunk/src/switch_core_session.c Thu Jun 4 20:16:02 2009 @@ -1525,6 +1525,8 @@ } dpstr = switch_core_session_strdup(session, new_profile->dialplan); + + switch_channel_set_hunt_caller_profile(channel, new_profile); argc = switch_separate_string(dpstr, ',', dp, (sizeof(dp) / sizeof(dp[0]))); From mrene at freeswitch.org Thu Jun 4 18:17:59 2009 From: mrene at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 20:17:59 -0500 Subject: [Freeswitch-svn] [commit] r13627 - freeswitch/trunk/src Message-ID: Author: mrene Date: Thu Jun 4 20:17:59 2009 New Revision: 13627 Log: oops Modified: freeswitch/trunk/src/switch_caller.c freeswitch/trunk/src/switch_core_session.c Modified: freeswitch/trunk/src/switch_caller.c ============================================================================== --- freeswitch/trunk/src/switch_caller.c (original) +++ freeswitch/trunk/src/switch_caller.c Thu Jun 4 20:17:59 2009 @@ -50,9 +50,8 @@ switch_caller_profile_t *profile = NULL; profile = switch_core_alloc(pool, sizeof(*profile)); + switch_assert(profile != NULL); memset(profile, 0, sizeof(*profile)); - - switch_assert(profile != NULL); if (!context) { context = "default"; Modified: freeswitch/trunk/src/switch_core_session.c ============================================================================== --- freeswitch/trunk/src/switch_core_session.c (original) +++ freeswitch/trunk/src/switch_core_session.c Thu Jun 4 20:17:59 2009 @@ -1524,9 +1524,7 @@ new_profile->context = switch_core_strdup(new_profile->pool, context); } - dpstr = switch_core_session_strdup(session, new_profile->dialplan); - - + dpstr = switch_core_session_strdup(session, new_profile->dialplan); switch_channel_set_hunt_caller_profile(channel, new_profile); argc = switch_separate_string(dpstr, ',', dp, (sizeof(dp) / sizeof(dp[0]))); From mrene at freeswitch.org Thu Jun 4 18:46:09 2009 From: mrene at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 20:46:09 -0500 Subject: [Freeswitch-svn] [commit] r13628 - freeswitch/trunk/src Message-ID: Author: mrene Date: Thu Jun 4 20:46:09 2009 New Revision: 13628 Log: oops Modified: freeswitch/trunk/src/switch_channel.c Modified: freeswitch/trunk/src/switch_channel.c ============================================================================== --- freeswitch/trunk/src/switch_channel.c (original) +++ freeswitch/trunk/src/switch_channel.c Thu Jun 4 20:46:09 2009 @@ -1460,7 +1460,9 @@ switch_caller_profile_t *profile; switch_assert(channel != NULL); switch_mutex_lock(channel->profile_mutex); - profile = channel->hunt_caller_profile ? channel->hunt_caller_profile : channel->caller_profile; + if ((profile = channel->caller_profile) && profile->hunt_caller_profile) { + profile = profile->hunt_caller_profile; + } switch_mutex_unlock(channel->profile_mutex); return profile; } From mrene at freeswitch.org Thu Jun 4 19:30:44 2009 From: mrene at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 21:30:44 -0500 Subject: [Freeswitch-svn] [commit] r13629 - in freeswitch/trunk/src: . include mod/applications/mod_commands mod/endpoints/mod_sofia mod/event_handlers/mod_event_socket Message-ID: Author: mrene Date: Thu Jun 4 21:30:44 2009 New Revision: 13629 Log: add an external port output parameter to switch_nat_add_mapping and use it in sofia_glue_tech_choose_port Modified: freeswitch/trunk/src/include/switch_nat.h freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c freeswitch/trunk/src/switch_nat.c Modified: freeswitch/trunk/src/include/switch_nat.h ============================================================================== --- freeswitch/trunk/src/include/switch_nat.h (original) +++ freeswitch/trunk/src/include/switch_nat.h Thu Jun 4 21:30:44 2009 @@ -59,9 +59,22 @@ \note Generally called by the core_init */ SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool); +/*! + \brief Shuts down the NAT Traversal System +*/ SWITCH_DECLARE(void) switch_nat_shutdown(void); -SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping(switch_port_t port, switch_nat_ip_proto_t proto); +/*! + \brief Maps a port through the NAT Traversal System + \param port Internal port to map + \param proto Protocol + \param external_port [out] Mapped external port +*/ +SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port); +/*! + \brief Deletes a NAT mapping + \param proto Protocol +*/ SWITCH_DECLARE(switch_status_t) switch_nat_del_mapping(switch_port_t port, switch_nat_ip_proto_t proto); Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original) +++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Thu Jun 4 21:30:44 2009 @@ -49,6 +49,7 @@ int argc; char *mydata = NULL, *argv[4]; switch_nat_ip_proto_t proto = SWITCH_NAT_UDP; + switch_port_t external_port = 0; if (!cmd) { goto error; @@ -70,8 +71,8 @@ } if (argv[0] && switch_stristr("add", argv[0])) { - if (switch_nat_add_mapping((switch_port_t)atoi(argv[1]), proto) == SWITCH_STATUS_SUCCESS) { - stream->write_function(stream, "true"); + if (switch_nat_add_mapping((switch_port_t)atoi(argv[1]), proto, &external_port) == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "%d", (int)external_port); goto ok; } } else if (argv[0] && switch_stristr("del", argv[0])) { Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Thu Jun 4 21:30:44 2009 @@ -762,13 +762,13 @@ ); if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { - if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { + if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_UDP, NULL) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created UDP nat mapping for %s port %d\n", profile->name, profile->sip_port); } - if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_TCP, NULL) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP nat mapping for %s port %d\n", profile->name, profile->sip_port); } - if(sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_add_mapping(profile->tls_sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) { + if(sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_add_mapping(profile->tls_sip_port, SWITCH_NAT_TCP, NULL) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP/TLS nat mapping for %s port %d\n", profile->name, profile->tls_sip_port); } } Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Thu Jun 4 21:30:44 2009 @@ -630,6 +630,7 @@ switch_port_t sdp_port; char tmp[50]; const char *use_ip = NULL; + switch_port_t external_port = 0; if (!force) { if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || @@ -667,12 +668,12 @@ if (tech_pvt->profile->extrtpip && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, tech_pvt->profile->extrtpip); - switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP); + switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP, &external_port); } else { tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip); } - tech_pvt->adv_sdp_audio_port = sdp_port; + tech_pvt->adv_sdp_audio_port = external_port != 0 ? external_port : sdp_port; switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port); switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip); @@ -686,6 +687,7 @@ char *ip = tech_pvt->profile->rtpip; switch_port_t sdp_port; char tmp[50]; + switch_port_t external_port = 0; if (!force) { if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) @@ -712,11 +714,11 @@ } } - tech_pvt->adv_sdp_video_port = sdp_port; - if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { - switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP); + switch_nat_add_mapping((switch_port_t)sdp_port, SWITCH_NAT_UDP, &external_port); } + + tech_pvt->adv_sdp_video_port = external_port != 0 ? external_port : sdp_port; switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port); switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip); Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c ============================================================================== --- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original) +++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Thu Jun 4 21:30:44 2009 @@ -2291,7 +2291,7 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket up listening on %s:%u\n", prefs.ip, prefs.port); if (prefs.nat_map) { - switch_nat_add_mapping(prefs.port, SWITCH_NAT_TCP); + switch_nat_add_mapping(prefs.port, SWITCH_NAT_TCP, NULL); } break; Modified: freeswitch/trunk/src/switch_nat.c ============================================================================== --- freeswitch/trunk/src/switch_nat.c (original) +++ freeswitch/trunk/src/switch_nat.c Thu Jun 4 21:30:44 2009 @@ -170,7 +170,7 @@ } } -static switch_status_t switch_nat_add_mapping_pmp(switch_port_t port, switch_nat_ip_proto_t proto) +static switch_status_t switch_nat_add_mapping_pmp(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port) { switch_status_t status = SWITCH_STATUS_FALSE; natpmpresp_t response; @@ -198,6 +198,16 @@ response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" : (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"), response.pnu.newportmapping.privateport); + if (external_port) { + *external_port = response.pnu.newportmapping.mappedpublicport; + } else if (response.pnu.newportmapping.mappedpublicport != response.pnu.newportmapping.privateport) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "External port %hu protocol %s was not available, it was instead mapped to %hu", + response.pnu.newportmapping.privateport, + response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" : + (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"), + response.pnu.newportmapping.mappedpublicport); + } + status = SWITCH_STATUS_SUCCESS; } @@ -285,16 +295,20 @@ return status; } -SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping(switch_port_t port, switch_nat_ip_proto_t proto) +SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port) { switch_status_t status = SWITCH_STATUS_FALSE; switch (nat_globals.nat_type) { case SWITCH_NAT_TYPE_PMP: - status = switch_nat_add_mapping_pmp(port, proto); + status = switch_nat_add_mapping_pmp(port, proto, external_port); break; case SWITCH_NAT_TYPE_UPNP: - status = switch_nat_add_mapping_upnp(port, proto); + if ((status = switch_nat_add_mapping_upnp(port, proto)) && status == SWITCH_STATUS_SUCCESS) { + if (external_port) { + *external_port = port; + } + } break; default: break; From brian at freeswitch.org Thu Jun 4 21:12:26 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Thu, 04 Jun 2009 23:12:26 -0500 Subject: [Freeswitch-svn] [commit] r13630 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Thu Jun 4 23:12:26 2009 New Revision: 13630 Log: fix this cuz its wrong Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Thu Jun 4 23:12:26 2009 @@ -1319,7 +1319,7 @@ const char* format; const char *alt = NULL; - if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->profile->local_network)) { + if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { sipip = tech_pvt->profile->extsipip; } else { sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip; From buklov at freeswitch.org Fri Jun 5 00:41:22 2009 From: buklov at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 02:41:22 -0500 Subject: [Freeswitch-svn] [commit] r13631 - freeswitch/trunk/src/mod/say/mod_say_ru Message-ID: Author: buklov Date: Fri Jun 5 02:41:22 2009 New Revision: 13631 Log: add new rule Modified: freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.c freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.h Modified: freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.c ============================================================================== --- freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.c (original) +++ freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.c Fri Jun 5 02:41:22 2009 @@ -39,7 +39,7 @@ * * Anthony Minessale II * Michael B. Murdock - * Boris Buklov + * Boris Buklov (BBV) * * mod_say_ru.c -- Say for Russian * Modified: freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.h ============================================================================== --- freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.h (original) +++ freeswitch/trunk/src/mod/say/mod_say_ru/mod_say_ru.h Fri Jun 5 02:41:22 2009 @@ -1,3 +1,12 @@ +/* Contributor(s): + * + * Boris Buklov (BBV) + * + * mod_say_ru.c -- Say for Russian + * + */ + + //??????? ????? ??????? ??????? ???????? ??????? ?????? ???????? //?????? ??????? ????????? ??? 1 ???? ?? ??????? //http://ru.wiktionary.org/wiki/%D0%BE%D0%B4%D0%B8%D0%BD @@ -136,9 +145,9 @@ //??????? #define m_12 {\ - {"","","","","","","",""},\ - {"","","","","","","","","","","","","",""},\ - {"","","","","","","","","","","","","",""},\ + {"0","h-1xx","h-2xx","h-3xx","h-4xx","h-5xx","h-","xx"},\ + {"","","1xx","thousands-i","h-2xx","thousands","h-3xx","thousands","h-4xx","thousands","h-5xx","thousands","h-","xx"},\ + {"","","1x","million-a","h-2xx","millions","h-3xx","millions","h-4xx","millions","h-5xx","millions","h-","xx"},\ 0,\ }\ From buklov at freeswitch.org Fri Jun 5 00:42:00 2009 From: buklov at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 02:42:00 -0500 Subject: [Freeswitch-svn] [commit] r13632 - freeswitch/trunk/docs/phrase Message-ID: Author: buklov Date: Fri Jun 5 02:42:00 2009 New Revision: 13632 Log: small fix Modified: freeswitch/trunk/docs/phrase/phrase_ru.xml Modified: freeswitch/trunk/docs/phrase/phrase_ru.xml ============================================================================== --- freeswitch/trunk/docs/phrase/phrase_ru.xml (original) +++ freeswitch/trunk/docs/phrase/phrase_ru.xml Fri Jun 5 02:42:00 2009 @@ -77,7 +77,7 @@ - + From buklov at freeswitch.org Fri Jun 5 02:25:59 2009 From: buklov at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 04:25:59 -0500 Subject: [Freeswitch-svn] [commit] r13633 - freeswitch/trunk/docs/phrase Message-ID: Author: buklov Date: Fri Jun 5 04:25:58 2009 New Revision: 13633 Log: add translate zrtp Modified: freeswitch/trunk/docs/phrase/phrase_ru.xml Modified: freeswitch/trunk/docs/phrase/phrase_ru.xml ============================================================================== --- freeswitch/trunk/docs/phrase/phrase_ru.xml (original) +++ freeswitch/trunk/docs/phrase/phrase_ru.xml Fri Jun 5 04:25:58 2009 @@ -520,6 +520,552 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From buklov at freeswitch.org Fri Jun 5 02:39:17 2009 From: buklov at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 04:39:17 -0500 Subject: [Freeswitch-svn] [commit] r13634 - freeswitch/trunk/docs/phrase Message-ID: Author: buklov Date: Fri Jun 5 04:39:17 2009 New Revision: 13634 Log: fix Modified: freeswitch/trunk/docs/phrase/phrase_ru.xml Modified: freeswitch/trunk/docs/phrase/phrase_ru.xml ============================================================================== --- freeswitch/trunk/docs/phrase/phrase_ru.xml (original) +++ freeswitch/trunk/docs/phrase/phrase_ru.xml Fri Jun 5 04:39:17 2009 @@ -1035,17 +1035,17 @@ - + - + - + - + @@ -1053,17 +1053,17 @@ - + - + - + - + From mrene at freeswitch.org Fri Jun 5 07:39:28 2009 From: mrene at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 09:39:28 -0500 Subject: [Freeswitch-svn] [commit] r13635 - freeswitch/trunk/src Message-ID: Author: mrene Date: Fri Jun 5 09:39:28 2009 New Revision: 13635 Log: fix Modified: freeswitch/trunk/src/switch_nat.c Modified: freeswitch/trunk/src/switch_nat.c ============================================================================== --- freeswitch/trunk/src/switch_nat.c (original) +++ freeswitch/trunk/src/switch_nat.c Fri Jun 5 09:39:28 2009 @@ -184,7 +184,7 @@ do { fd_set fds; - struct timeval timeout; + struct timeval timeout = { 1, 0 }; FD_ZERO(&fds); FD_SET(nat_globals.natpmp.s, &fds); getnatpmprequesttimeout(&nat_globals.natpmp, &timeout); From mrene at freeswitch.org Fri Jun 5 08:01:55 2009 From: mrene at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 10:01:55 -0500 Subject: [Freeswitch-svn] [commit] r13636 - freeswitch/trunk/src Message-ID: Author: mrene Date: Fri Jun 5 10:01:54 2009 New Revision: 13636 Log: Use a new natpmp_t object for every request Modified: freeswitch/trunk/src/switch_nat.c Modified: freeswitch/trunk/src/switch_nat.c ============================================================================== --- freeswitch/trunk/src/switch_nat.c (original) +++ freeswitch/trunk/src/switch_nat.c Fri Jun 5 10:01:54 2009 @@ -41,7 +41,6 @@ typedef struct { switch_memory_pool_t *pool; switch_nat_type_t nat_type; - natpmp_t natpmp; struct UPNPUrls urls; struct IGDdatas data; char pub_addr[16]; @@ -105,10 +104,11 @@ natpmpresp_t response; char *pubaddr = NULL; fd_set fds; + natpmp_t natpmp; - initnatpmp(&nat_globals.natpmp); - r = sendpublicaddressrequest(&nat_globals.natpmp); + initnatpmp(&natpmp); + r = sendpublicaddressrequest(&natpmp); if (r < 0) { goto end; @@ -120,10 +120,10 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for PMP %d/%d\n", i, max); FD_ZERO(&fds); - FD_SET(nat_globals.natpmp.s, &fds); - getnatpmprequesttimeout(&nat_globals.natpmp, &timeout); + FD_SET(natpmp.s, &fds); + getnatpmprequesttimeout(&natpmp, &timeout); select(FD_SETSIZE, &fds, NULL, NULL, &timeout); - r = readnatpmpresponseorretry(&nat_globals.natpmp, &response); + r = readnatpmpresponseorretry(&natpmp, &response); } while(r == NATPMP_TRYAGAIN && i < max); if (r < 0) { @@ -134,9 +134,7 @@ switch_set_string(nat_globals.pub_addr, pubaddr); nat_globals.nat_type = SWITCH_NAT_TYPE_PMP; - if (r) { - closenatpmp(&nat_globals.natpmp); - } + closenatpmp(&natpmp); end: @@ -175,21 +173,24 @@ switch_status_t status = SWITCH_STATUS_FALSE; natpmpresp_t response; int r; + natpmp_t natpmp; + initnatpmp(&natpmp); + if (proto == SWITCH_NAT_TCP) { - sendnewportmappingrequest(&nat_globals.natpmp, NATPMP_PROTOCOL_TCP, port, port, 31104000); + sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_TCP, port, port, 31104000); } else if(proto == SWITCH_NAT_UDP) { - sendnewportmappingrequest(&nat_globals.natpmp, NATPMP_PROTOCOL_UDP, port, port, 31104000); + sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_UDP, port, port, 31104000); } do { fd_set fds; struct timeval timeout = { 1, 0 }; FD_ZERO(&fds); - FD_SET(nat_globals.natpmp.s, &fds); - getnatpmprequesttimeout(&nat_globals.natpmp, &timeout); + FD_SET(natpmp.s, &fds); + getnatpmprequesttimeout(&natpmp, &timeout); select(FD_SETSIZE, &fds, NULL, NULL, &timeout); - r = readnatpmpresponseorretry(&nat_globals.natpmp, &response); + r = readnatpmpresponseorretry(&natpmp, &response); } while(r == NATPMP_TRYAGAIN); if (r == 0) { @@ -210,7 +211,9 @@ status = SWITCH_STATUS_SUCCESS; } - + + closenatpmp(&natpmp); + return status; } @@ -244,21 +247,24 @@ switch_status_t status = SWITCH_STATUS_FALSE; natpmpresp_t response; int r; + natpmp_t natpmp; + + initnatpmp(&natpmp); if (proto == SWITCH_NAT_TCP) { - sendnewportmappingrequest(&nat_globals.natpmp, NATPMP_PROTOCOL_TCP, port, port, 0); + sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_TCP, port, port, 0); } else if(proto == SWITCH_NAT_UDP) { - sendnewportmappingrequest(&nat_globals.natpmp, NATPMP_PROTOCOL_UDP, port, port, 0); + sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_UDP, port, port, 0); } do { fd_set fds; struct timeval timeout; FD_ZERO(&fds); - FD_SET(nat_globals.natpmp.s, &fds); - getnatpmprequesttimeout(&nat_globals.natpmp, &timeout); + FD_SET(natpmp.s, &fds); + getnatpmprequesttimeout(&natpmp, &timeout); select(FD_SETSIZE, &fds, NULL, NULL, &timeout); - r = readnatpmpresponseorretry(&nat_globals.natpmp, &response); + r = readnatpmpresponseorretry(&natpmp, &response); } while(r == NATPMP_TRYAGAIN); if (r == 0) { @@ -269,6 +275,8 @@ response.pnu.newportmapping.privateport); status = SWITCH_STATUS_SUCCESS; } + + closenatpmp(&natpmp); return status; } @@ -337,9 +345,7 @@ SWITCH_DECLARE(void) switch_nat_shutdown(void) { - if (nat_globals.nat_type == SWITCH_NAT_TYPE_PMP) { - closenatpmp(&nat_globals.natpmp); - } + } From brian at freeswitch.org Fri Jun 5 08:50:31 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 10:50:31 -0500 Subject: [Freeswitch-svn] [commit] r13637 - in freeswitch/trunk: . libs libs/apr/build libs/ilbc/src libs/libg722_1/src libs/libsndfile/Cfg libs/libsndfile/M4 libs/libsndfile/programs libs/libsndfile/src libs/libsndfile/tests src/mod/applications/mod_cluechoo src/mod/codecs/mod_siren src/mod/endpoints/mod_sofia src/mod/event_handlers/mod_erlang_event src/mod/formats/mod_file_string Message-ID: Author: brian Date: Fri Jun 5 10:50:30 2009 New Revision: 13637 Log: ignore Modified: freeswitch/trunk/libs/ (props changed) freeswitch/trunk/libs/apr/build/ (props changed) freeswitch/trunk/libs/ilbc/src/ (props changed) freeswitch/trunk/libs/libg722_1/src/ (props changed) freeswitch/trunk/libs/libsndfile/Cfg/ (props changed) freeswitch/trunk/libs/libsndfile/M4/ (props changed) freeswitch/trunk/libs/libsndfile/programs/ (props changed) freeswitch/trunk/libs/libsndfile/src/ (props changed) freeswitch/trunk/libs/libsndfile/tests/ (props changed) freeswitch/trunk/src/mod/applications/mod_cluechoo/ (props changed) freeswitch/trunk/src/mod/codecs/mod_siren/ (props changed) freeswitch/trunk/src/mod/endpoints/mod_sofia/ (props changed) freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/ (props changed) freeswitch/trunk/src/mod/formats/mod_file_string/ (props changed) Changes in other areas also in this revision: Modified: freeswitch/trunk/ (props changed) From mikej at freeswitch.org Fri Jun 5 09:16:56 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 11:16:56 -0500 Subject: [Freeswitch-svn] [commit] r13638 - freeswitch/trunk/src/mod/applications/mod_conference Message-ID: Author: mikej Date: Fri Jun 5 11:16:56 2009 New Revision: 13638 Log: mod_conference: don't transfer back to the same conference Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original) +++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Fri Jun 5 11:16:56 2009 @@ -3933,15 +3933,17 @@ /* move the member from the old conference to the new one */ switch_mutex_lock(member->control_mutex); - conference_del_member(conference, member); - conference_add_member(new_conference, member); - - if (conference->rate != new_conference->rate) { - if (setup_media(member, new_conference)) { - switch_clear_flag_locked(member, MFLAG_RUNNING); - } else { - switch_channel_set_app_flag(channel, CF_APP_TAGGED); - switch_set_flag_locked(member, MFLAG_RESTART); + if (conference != new_conference) { + conference_del_member(conference, member); + conference_add_member(new_conference, member); + + if (conference->rate != new_conference->rate) { + if (setup_media(member, new_conference)) { + switch_clear_flag_locked(member, MFLAG_RUNNING); + } else { + switch_channel_set_app_flag(channel, CF_APP_TAGGED); + switch_set_flag_locked(member, MFLAG_RESTART); + } } } From mikej at freeswitch.org Fri Jun 5 09:19:03 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 11:19:03 -0500 Subject: [Freeswitch-svn] [commit] r13639 - freeswitch/trunk/src/mod/applications/mod_conference Message-ID: Author: mikej Date: Fri Jun 5 11:19:03 2009 New Revision: 13639 Log: fix prototype Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original) +++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Fri Jun 5 11:19:03 2009 @@ -4613,7 +4613,7 @@ -static void set_cflags(const char *flags, member_flag_t *f) +static void set_cflags(const char *flags, uint32_t *f) { if (flags) { char *dup = strdup(flags); From brian at freeswitch.org Fri Jun 5 10:47:52 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 12:47:52 -0500 Subject: [Freeswitch-svn] [commit] r13640 - freeswitch/trunk/conf/sip_profiles/internal Message-ID: Author: brian Date: Fri Jun 5 12:47:51 2009 New Revision: 13640 Log: you know its called a contact because you get to SPECIFY IT... if a gateway doesn't like that they are WRONG Modified: freeswitch/trunk/conf/sip_profiles/internal/example.xml Modified: freeswitch/trunk/conf/sip_profiles/internal/example.xml ============================================================================== --- freeswitch/trunk/conf/sip_profiles/internal/example.xml (original) +++ freeswitch/trunk/conf/sip_profiles/internal/example.xml Fri Jun 5 12:47:51 2009 @@ -28,6 +28,8 @@ + + From anthm at freeswitch.org Fri Jun 5 11:20:09 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 13:20:09 -0500 Subject: [Freeswitch-svn] [commit] r13641 - freeswitch/trunk/patches Message-ID: Author: anthm Date: Fri Jun 5 13:20:09 2009 New Revision: 13641 Log: update Added: freeswitch/trunk/patches/tmp.diff Added: freeswitch/trunk/patches/tmp.diff ============================================================================== --- (empty file) +++ freeswitch/trunk/patches/tmp.diff Fri Jun 5 13:20:09 2009 @@ -0,0 +1,265 @@ +Index: src/switch_core_media_bug.c +=================================================================== +--- src/switch_core_media_bug.c (revision 13639) ++++ src/switch_core_media_bug.c (working copy) +@@ -102,7 +102,7 @@ + } + } + +-SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *bug, switch_frame_t *frame) ++SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *bug, switch_frame_t *frame, switch_bool_t fill) + { + switch_size_t bytes = 0, datalen = 0; + int16_t *dp, *fp; +@@ -131,7 +131,8 @@ + + switch_mutex_lock(bug->read_mutex); + frame->datalen = (uint32_t) switch_buffer_read(bug->raw_read_buffer, frame->data, bytes); +- if (frame->datalen < bytes) { ++ if (fill && frame->datalen < bytes) { ++ printf("FILL READ %d %d\n", (int)frame->datalen, (int)bytes); + memset(((unsigned char *)frame->data) + frame->datalen, 0, bytes - frame->datalen); + frame->datalen = bytes; + } +@@ -141,7 +142,8 @@ + switch_assert(bug->raw_write_buffer); + switch_mutex_lock(bug->write_mutex); + datalen = (uint32_t) switch_buffer_read(bug->raw_write_buffer, bug->data, bytes); +- if (datalen < bytes) { ++ if (fill && datalen < bytes) { ++ printf("FILL WRITE %d %d\n", (int)datalen, (int)bytes); + memset(((unsigned char *)bug->data) + datalen, 0, bytes - datalen); + datalen = bytes; + } +@@ -154,6 +156,14 @@ + rlen = frame->datalen / 2; + wlen = datalen / 2; + blen = bytes / 2; ++ ++ if (!fill && rlen == 0 && wlen == 0) { ++ frame->datalen = 0; ++ frame->samples = 0; ++ frame->rate = read_impl.actual_samples_per_second; ++ frame->codec = NULL; ++ return SWITCH_STATUS_FALSE; ++ } + + if (switch_test_flag(bug, SMBF_STEREO)) { + for (x = 0; x < blen; x++) { +Index: src/switch_ivr_async.c +=================================================================== +--- src/switch_ivr_async.c (revision 13639) ++++ src/switch_ivr_async.c (working copy) +@@ -424,9 +424,11 @@ + return SWITCH_STATUS_SUCCESS; + } + ++#define LEAD_IN 25 + struct record_helper { + char *file; + switch_file_handle_t *fh; ++ int lead_in; + }; + + static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) +@@ -447,6 +449,22 @@ + switch_channel_set_private(channel, rh->file, NULL); + + if (rh->fh) { ++ ++ if (switch_channel_test_flag(channel, CF_ANSWERED) || !switch_core_media_bug_test_flag(bug, SMBF_RECORD_ANSWER_REQ)) { ++ switch_size_t len; ++ uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; ++ switch_frame_t frame = { 0 }; ++ ++ frame.data = data; ++ frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; ++ ++ while (switch_core_media_bug_read(bug, &frame, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS && frame.datalen) { ++ len = (switch_size_t) frame.datalen / 2; ++ //printf("POST WRITE %d\n", frame.datalen); ++ switch_core_file_write(rh->fh, data, &len); ++ } ++ } ++ + switch_core_file_close(rh->fh); + if (rh->fh->samples_out < read_impl.samples_per_second * 3) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Discarding short file %s\n", rh->file); +@@ -457,6 +475,10 @@ + + break; + case SWITCH_ABC_TYPE_READ_PING: ++ if (rh->lead_in) { ++ rh->lead_in--; ++ } else ++ + if (rh->fh) { + switch_size_t len; + uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; +@@ -465,17 +487,16 @@ + frame.data = data; + frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; + +- if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) { +- int doit = 1; +- if (!switch_channel_test_flag(channel, CF_ANSWERED) && switch_core_media_bug_test_flag(bug, SMBF_RECORD_ANSWER_REQ)) { +- doit = 0; +- } +- +- if (doit) { ++ if (switch_channel_test_flag(channel, CF_ANSWERED) || !switch_core_media_bug_test_flag(bug, SMBF_RECORD_ANSWER_REQ)) { ++ int loops = LEAD_IN; ++ while (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS && frame.datalen) { + len = (switch_size_t) frame.datalen / 2; ++ //printf("WRITE %d\n", frame.datalen); + switch_core_file_write(rh->fh, data, &len); ++ if (!--loops) break; + } + } ++ rh->lead_in = LEAD_IN; + } + break; + case SWITCH_ABC_TYPE_WRITE: +@@ -528,7 +549,7 @@ + break; + case SWITCH_ABC_TYPE_READ_PING: + if (ep->buffer) { +- if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) { ++ if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { + switch_buffer_lock(ep->buffer); + switch_buffer_zwrite(ep->buffer, frame.data, frame.datalen); + switch_buffer_unlock(ep->buffer); +@@ -949,6 +970,7 @@ + rh = switch_core_session_alloc(session, sizeof(*rh)); + rh->fh = fh; + rh->file = switch_core_session_strdup(session, file); ++ rh->lead_in = LEAD_IN; + + if ((status = switch_core_media_bug_add(session, record_callback, rh, to, flags, &bug)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error adding media bug for file %s\n", file); +@@ -991,7 +1013,7 @@ + switch_channel_queue_dtmf(channel, &dtmf); + p++; + } +- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF DETECTED: [%s]\n", digit_str); ++ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%i %s DTMF DETECTED: %s\n", (int) switch_channel_get_micro(channel), switch_core_session_get_uuid(pvt->session), digit_str); + } + switch_core_media_bug_set_read_replace_frame(bug, frame); + } +@@ -1942,7 +1964,7 @@ + break; + case SWITCH_ABC_TYPE_READ: + if (sth->ah) { +- if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) { ++ if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { + if (switch_core_asr_feed(sth->ah, frame.data, frame.datalen, &flags) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error Feeding Data\n"); + return SWITCH_FALSE; +Index: src/switch_rtp.c +=================================================================== +--- src/switch_rtp.c (revision 13639) ++++ src/switch_rtp.c (working copy) +@@ -2126,6 +2126,7 @@ + *payload_type = (switch_payload_t) rtp_session->recv_msg.header.pt; + ret = 2 + rtp_header_len; + rtp_session->stats.inbound.skip_packet_count++; ++ printf("CNG\n"); + goto end; + } + +Index: src/mod/loggers/mod_logfile/mod_logfile.c +=================================================================== +--- src/mod/loggers/mod_logfile/mod_logfile.c (revision 13639) ++++ src/mod/loggers/mod_logfile/mod_logfile.c (working copy) +@@ -93,7 +93,7 @@ + flags |= SWITCH_FOPEN_WRITE; + flags |= SWITCH_FOPEN_APPEND; + +- stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, module_pool); ++ stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_WREAD, module_pool); + if (stat != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_FALSE; + } +Index: src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +=================================================================== +--- src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (revision 13639) ++++ src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (working copy) +@@ -113,7 +113,7 @@ + + if (!switch_strlen_zero(logdir)) { + if ((path = switch_mprintf("%s%s%s%s.cdr.xml", logdir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session)))) { +- if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { ++ if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR| S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) { + int wrote; + wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); + close(fd); +@@ -222,7 +222,7 @@ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to post to web server, writing to file\n"); + + if ((path = switch_mprintf("%s%s%s%s.cdr.xml", globals.err_log_dir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session)))) { +- if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { ++ if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) { + int wrote; + wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); + close(fd); +Index: src/mod/formats/mod_shout/mod_shout.c +=================================================================== +--- src/mod/formats/mod_shout/mod_shout.c (revision 13639) ++++ src/mod/formats/mod_shout/mod_shout.c (working copy) +@@ -1159,7 +1159,7 @@ + break; + case SWITCH_ABC_TYPE_READ_PING: + if (buffer) { +- if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) { ++ if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { + switch_buffer_lock(buffer); + switch_buffer_write(buffer, frame.data, frame.datalen); + switch_buffer_unlock(buffer); +Index: src/include/switch_channel.h +=================================================================== +--- src/include/switch_channel.h (revision 13639) ++++ src/include/switch_channel.h (working copy) +@@ -69,6 +69,9 @@ + SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_state(switch_channel_t *channel); + SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_running_state(switch_channel_t *channel); + ++//Dozier -- get micro for DTMF debugging ++SWITCH_DECLARE(int32_t) switch_channel_get_micro(switch_channel_t *channel); ++ + /*! + \brief Determine if a channel is ready for io + \param channel channel to test +Index: src/include/switch_core.h +=================================================================== +--- src/include/switch_core.h (revision 13639) ++++ src/include/switch_core.h (working copy) +@@ -238,7 +238,7 @@ + \param frame the frame to write the data to + \return the amount of data + */ +-SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame); ++SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame, switch_bool_t fill); + + /*! + \brief Flush the read and write buffers for the bug +Index: src/switch_channel.c +=================================================================== +--- src/switch_channel.c (revision 13639) ++++ src/switch_channel.c (working copy) +@@ -2326,6 +2326,16 @@ + return status; + } + ++//Dozier -- getting micro time from the channel ++SWITCH_DECLARE(int32_t) switch_channel_get_micro(switch_channel_t *channel) ++{ ++ switch_time_t now = switch_micro_time_now(); ++ switch_time_exp_t tm; ++ switch_time_exp_lt(&tm, now); ++ return tm.tm_usec; ++} ++ ++ + SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *channel) + { + switch_status_t status = SWITCH_STATUS_SUCCESS; From anthm at freeswitch.org Fri Jun 5 11:21:53 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 13:21:53 -0500 Subject: [Freeswitch-svn] [commit] r13642 - freeswitch/trunk/patches Message-ID: Author: anthm Date: Fri Jun 5 13:21:53 2009 New Revision: 13642 Log: update Modified: freeswitch/trunk/patches/tmp.diff Modified: freeswitch/trunk/patches/tmp.diff ============================================================================== --- freeswitch/trunk/patches/tmp.diff (original) +++ freeswitch/trunk/patches/tmp.diff Fri Jun 5 13:21:53 2009 @@ -167,68 +167,6 @@ goto end; } -Index: src/mod/loggers/mod_logfile/mod_logfile.c -=================================================================== ---- src/mod/loggers/mod_logfile/mod_logfile.c (revision 13639) -+++ src/mod/loggers/mod_logfile/mod_logfile.c (working copy) -@@ -93,7 +93,7 @@ - flags |= SWITCH_FOPEN_WRITE; - flags |= SWITCH_FOPEN_APPEND; - -- stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, module_pool); -+ stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_WREAD, module_pool); - if (stat != SWITCH_STATUS_SUCCESS) { - return SWITCH_STATUS_FALSE; - } -Index: src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c -=================================================================== ---- src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (revision 13639) -+++ src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (working copy) -@@ -113,7 +113,7 @@ - - if (!switch_strlen_zero(logdir)) { - if ((path = switch_mprintf("%s%s%s%s.cdr.xml", logdir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session)))) { -- if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { -+ if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR| S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) { - int wrote; - wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); - close(fd); -@@ -222,7 +222,7 @@ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to post to web server, writing to file\n"); - - if ((path = switch_mprintf("%s%s%s%s.cdr.xml", globals.err_log_dir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session)))) { -- if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { -+ if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) { - int wrote; - wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); - close(fd); -Index: src/mod/formats/mod_shout/mod_shout.c -=================================================================== ---- src/mod/formats/mod_shout/mod_shout.c (revision 13639) -+++ src/mod/formats/mod_shout/mod_shout.c (working copy) -@@ -1159,7 +1159,7 @@ - break; - case SWITCH_ABC_TYPE_READ_PING: - if (buffer) { -- if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) { -+ if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { - switch_buffer_lock(buffer); - switch_buffer_write(buffer, frame.data, frame.datalen); - switch_buffer_unlock(buffer); -Index: src/include/switch_channel.h -=================================================================== ---- src/include/switch_channel.h (revision 13639) -+++ src/include/switch_channel.h (working copy) -@@ -69,6 +69,9 @@ - SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_state(switch_channel_t *channel); - SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_running_state(switch_channel_t *channel); - -+//Dozier -- get micro for DTMF debugging -+SWITCH_DECLARE(int32_t) switch_channel_get_micro(switch_channel_t *channel); -+ - /*! - \brief Determine if a channel is ready for io - \param channel channel to test Index: src/include/switch_core.h =================================================================== --- src/include/switch_core.h (revision 13639) @@ -242,24 +180,3 @@ /*! \brief Flush the read and write buffers for the bug -Index: src/switch_channel.c -=================================================================== ---- src/switch_channel.c (revision 13639) -+++ src/switch_channel.c (working copy) -@@ -2326,6 +2326,16 @@ - return status; - } - -+//Dozier -- getting micro time from the channel -+SWITCH_DECLARE(int32_t) switch_channel_get_micro(switch_channel_t *channel) -+{ -+ switch_time_t now = switch_micro_time_now(); -+ switch_time_exp_t tm; -+ switch_time_exp_lt(&tm, now); -+ return tm.tm_usec; -+} -+ -+ - SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *channel) - { - switch_status_t status = SWITCH_STATUS_SUCCESS; From anthm at freeswitch.org Fri Jun 5 11:43:13 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 13:43:13 -0500 Subject: [Freeswitch-svn] [commit] r13643 - freeswitch/trunk/patches Message-ID: Author: anthm Date: Fri Jun 5 13:43:13 2009 New Revision: 13643 Log: update Modified: freeswitch/trunk/patches/tmp.diff Modified: freeswitch/trunk/patches/tmp.diff ============================================================================== --- freeswitch/trunk/patches/tmp.diff (original) +++ freeswitch/trunk/patches/tmp.diff Fri Jun 5 13:43:13 2009 @@ -137,16 +137,15 @@ if ((status = switch_core_media_bug_add(session, record_callback, rh, to, flags, &bug)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error adding media bug for file %s\n", file); -@@ -991,7 +1013,7 @@ +@@ -991,7 +1013,6 @@ switch_channel_queue_dtmf(channel, &dtmf); p++; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF DETECTED: [%s]\n", digit_str); -+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%i %s DTMF DETECTED: %s\n", (int) switch_channel_get_micro(channel), switch_core_session_get_uuid(pvt->session), digit_str); } switch_core_media_bug_set_read_replace_frame(bug, frame); } -@@ -1942,7 +1964,7 @@ +@@ -1942,7 +1963,7 @@ break; case SWITCH_ABC_TYPE_READ: if (sth->ah) { From anthm at freeswitch.org Fri Jun 5 12:04:07 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 14:04:07 -0500 Subject: [Freeswitch-svn] [commit] r13644 - freeswitch/trunk/patches Message-ID: Author: anthm Date: Fri Jun 5 14:04:07 2009 New Revision: 13644 Log: update Modified: freeswitch/trunk/patches/tmp.diff Modified: freeswitch/trunk/patches/tmp.diff ============================================================================== --- freeswitch/trunk/patches/tmp.diff (original) +++ freeswitch/trunk/patches/tmp.diff Fri Jun 5 14:04:07 2009 @@ -179,3 +179,16 @@ /*! \brief Flush the read and write buffers for the bug +Index: src/mod/formats/mod_shout/mod_shout.c +=================================================================== +--- src/mod/formats/mod_shout/mod_shout.c (revision 13639) ++++ src/mod/formats/mod_shout/mod_shout.c (working copy) +@@ -1159,7 +1159,7 @@ + break; + case SWITCH_ABC_TYPE_READ_PING: + if (buffer) { +- if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) { ++ if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { + switch_buffer_lock(buffer); + switch_buffer_write(buffer, frame.data, frame.datalen); + switch_buffer_unlock(buffer); From anthm at freeswitch.org Fri Jun 5 12:07:59 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 14:07:59 -0500 Subject: [Freeswitch-svn] [commit] r13645 - in freeswitch/trunk/src/mod: loggers/mod_logfile xml_int/mod_xml_cdr Message-ID: Author: anthm Date: Fri Jun 5 14:07:58 2009 New Revision: 13645 Log: update Modified: freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c Modified: freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c ============================================================================== --- freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c (original) +++ freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c Fri Jun 5 14:07:58 2009 @@ -93,7 +93,7 @@ flags |= SWITCH_FOPEN_WRITE; flags |= SWITCH_FOPEN_APPEND; - stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, module_pool); + stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_WREAD, module_pool); if (stat != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; } Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c ============================================================================== --- freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (original) +++ freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c Fri Jun 5 14:07:58 2009 @@ -113,7 +113,7 @@ if (!switch_strlen_zero(logdir)) { if ((path = switch_mprintf("%s%s%s%s.cdr.xml", logdir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session)))) { - if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { + if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR| S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) { int wrote; wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); close(fd); @@ -222,7 +222,7 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to post to web server, writing to file\n"); if ((path = switch_mprintf("%s%s%s%s.cdr.xml", globals.err_log_dir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session)))) { - if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { + if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) { int wrote; wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); close(fd); From brian at freeswitch.org Fri Jun 5 12:31:25 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 14:31:25 -0500 Subject: [Freeswitch-svn] [commit] r13646 - freeswitch/trunk/src Message-ID: Author: brian Date: Fri Jun 5 14:31:25 2009 New Revision: 13646 Log: Mirror back the port so people don't ask why its ZERO Modified: freeswitch/trunk/src/switch_nat.c Modified: freeswitch/trunk/src/switch_nat.c ============================================================================== --- freeswitch/trunk/src/switch_nat.c (original) +++ freeswitch/trunk/src/switch_nat.c Fri Jun 5 14:31:25 2009 @@ -269,7 +269,7 @@ if (r == 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unmapped public port %hu protocol %s to localport %hu\n", - response.pnu.newportmapping.mappedpublicport, + response.pnu.newportmapping.privateport, /* This might be wrong but its so 0 isn't displayed */ response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" : (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"), response.pnu.newportmapping.privateport); From anthm at freeswitch.org Fri Jun 5 12:49:20 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 14:49:20 -0500 Subject: [Freeswitch-svn] [commit] r13647 - freeswitch/trunk/src Message-ID: Author: anthm Date: Fri Jun 5 14:49:19 2009 New Revision: 13647 Log: add usec delta to log Modified: freeswitch/trunk/src/switch_log.c Modified: freeswitch/trunk/src/switch_log.c ============================================================================== --- freeswitch/trunk/src/switch_log.c (original) +++ freeswitch/trunk/src/switch_log.c Fri Jun 5 14:49:19 2009 @@ -266,7 +266,8 @@ char *content = NULL; switch_time_t now = switch_micro_time_now(); uint32_t len; - const char *extra_fmt = "%s [%s] %s:%d %s()%c%s"; + //const char *extra_fmt = "%s [%s] %s:%d %s()%c%s"; + const char *extra_fmt = "%s [%s] %s:%d%c%s"; if (level > runtime.hard_log_level) { return; @@ -278,16 +279,20 @@ if (channel != SWITCH_CHANNEL_ID_LOG_CLEAN) { char date[80] = ""; - switch_size_t retsize; + //switch_size_t retsize; switch_time_exp_t tm; switch_time_exp_lt(&tm, now); - switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); + switch_snprintf(date, sizeof(date), "%0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%d", + tm.tm_year + 1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec); - len = (uint32_t) (strlen(extra_fmt) + strlen(date) + strlen(filep) + 32 + strlen(funcp) + strlen(fmt)); + //switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); + + //len = (uint32_t) (strlen(extra_fmt) + strlen(date) + strlen(filep) + 32 + strlen(funcp) + strlen(fmt)); + len = (uint32_t) (strlen(extra_fmt) + strlen(date) + strlen(filep) + 32 + strlen(fmt)); new_fmt = malloc(len + 1); switch_assert(new_fmt); - switch_snprintf(new_fmt, len, extra_fmt, date, switch_log_level2str(level), filep, line, funcp, 128, fmt); + switch_snprintf(new_fmt, len, extra_fmt, date, switch_log_level2str(level), filep, line, 128, fmt); fmt = new_fmt; } From anthm at freeswitch.org Fri Jun 5 12:52:03 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 14:52:03 -0500 Subject: [Freeswitch-svn] [commit] r13648 - in freeswitch/trunk/src: . include mod/formats/mod_shout Message-ID: Author: anthm Date: Fri Jun 5 14:52:02 2009 New Revision: 13648 Log: add padding to cycles on session_record Modified: freeswitch/trunk/src/include/switch_core.h freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c freeswitch/trunk/src/switch_core_media_bug.c freeswitch/trunk/src/switch_ivr_async.c Modified: freeswitch/trunk/src/include/switch_core.h ============================================================================== --- freeswitch/trunk/src/include/switch_core.h (original) +++ freeswitch/trunk/src/include/switch_core.h Fri Jun 5 14:52:02 2009 @@ -238,7 +238,7 @@ \param frame the frame to write the data to \return the amount of data */ -SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame); +SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame, switch_bool_t fill); /*! \brief Flush the read and write buffers for the bug Modified: freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c ============================================================================== --- freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c (original) +++ freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c Fri Jun 5 14:52:02 2009 @@ -1159,7 +1159,7 @@ break; case SWITCH_ABC_TYPE_READ_PING: if (buffer) { - if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) { + if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { switch_buffer_lock(buffer); switch_buffer_write(buffer, frame.data, frame.datalen); switch_buffer_unlock(buffer); Modified: freeswitch/trunk/src/switch_core_media_bug.c ============================================================================== --- freeswitch/trunk/src/switch_core_media_bug.c (original) +++ freeswitch/trunk/src/switch_core_media_bug.c Fri Jun 5 14:52:02 2009 @@ -102,7 +102,7 @@ } } -SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *bug, switch_frame_t *frame) +SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *bug, switch_frame_t *frame, switch_bool_t fill) { switch_size_t bytes = 0, datalen = 0; int16_t *dp, *fp; @@ -131,7 +131,7 @@ switch_mutex_lock(bug->read_mutex); frame->datalen = (uint32_t) switch_buffer_read(bug->raw_read_buffer, frame->data, bytes); - if (frame->datalen < bytes) { + if (fill && frame->datalen < bytes) { memset(((unsigned char *)frame->data) + frame->datalen, 0, bytes - frame->datalen); frame->datalen = bytes; } @@ -141,7 +141,7 @@ switch_assert(bug->raw_write_buffer); switch_mutex_lock(bug->write_mutex); datalen = (uint32_t) switch_buffer_read(bug->raw_write_buffer, bug->data, bytes); - if (datalen < bytes) { + if (fill && datalen < bytes) { memset(((unsigned char *)bug->data) + datalen, 0, bytes - datalen); datalen = bytes; } @@ -154,6 +154,14 @@ rlen = frame->datalen / 2; wlen = datalen / 2; blen = bytes / 2; + + if (!fill && rlen == 0 && wlen == 0) { + frame->datalen = 0; + frame->samples = 0; + frame->rate = read_impl.actual_samples_per_second; + frame->codec = NULL; + return SWITCH_STATUS_FALSE; + } if (switch_test_flag(bug, SMBF_STEREO)) { for (x = 0; x < blen; x++) { Modified: freeswitch/trunk/src/switch_ivr_async.c ============================================================================== --- freeswitch/trunk/src/switch_ivr_async.c (original) +++ freeswitch/trunk/src/switch_ivr_async.c Fri Jun 5 14:52:02 2009 @@ -424,9 +424,11 @@ return SWITCH_STATUS_SUCCESS; } +#define LEAD_IN 25 struct record_helper { char *file; switch_file_handle_t *fh; + int lead_in; }; static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) @@ -447,6 +449,24 @@ switch_channel_set_private(channel, rh->file, NULL); if (rh->fh) { + if (switch_channel_test_flag(channel, CF_ANSWERED) || !switch_core_media_bug_test_flag(bug, SMBF_RECORD_ANSWER_REQ)) { + switch_size_t len; + uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; + switch_frame_t frame = { 0 }; + int cnt = LEAD_IN; + + frame.data = data; + frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; + + for (; cnt; cnt--) { + if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { + len = (switch_size_t) frame.datalen / 2; + switch_core_file_write(rh->fh, data, &len); + } + } + + } + switch_core_file_close(rh->fh); if (rh->fh->samples_out < read_impl.samples_per_second * 3) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Discarding short file %s\n", rh->file); @@ -457,6 +477,10 @@ break; case SWITCH_ABC_TYPE_READ_PING: + if (rh->lead_in) { + rh->lead_in--; + } else + if (rh->fh) { switch_size_t len; uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; @@ -465,17 +489,15 @@ frame.data = data; frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; - if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) { - int doit = 1; - if (!switch_channel_test_flag(channel, CF_ANSWERED) && switch_core_media_bug_test_flag(bug, SMBF_RECORD_ANSWER_REQ)) { - doit = 0; - } - - if (doit) { + if (switch_channel_test_flag(channel, CF_ANSWERED) || !switch_core_media_bug_test_flag(bug, SMBF_RECORD_ANSWER_REQ)) { + int loops = LEAD_IN; + while (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS && frame.datalen) { len = (switch_size_t) frame.datalen / 2; switch_core_file_write(rh->fh, data, &len); + if (!--loops) break; } } + rh->lead_in = LEAD_IN; } break; case SWITCH_ABC_TYPE_WRITE: @@ -528,7 +550,7 @@ break; case SWITCH_ABC_TYPE_READ_PING: if (ep->buffer) { - if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) { + if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { switch_buffer_lock(ep->buffer); switch_buffer_zwrite(ep->buffer, frame.data, frame.datalen); switch_buffer_unlock(ep->buffer); @@ -949,6 +971,7 @@ rh = switch_core_session_alloc(session, sizeof(*rh)); rh->fh = fh; rh->file = switch_core_session_strdup(session, file); + rh->lead_in = LEAD_IN; if ((status = switch_core_media_bug_add(session, record_callback, rh, to, flags, &bug)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error adding media bug for file %s\n", file); @@ -991,8 +1014,8 @@ switch_channel_queue_dtmf(channel, &dtmf); p++; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF DETECTED: [%s]\n", digit_str); } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF DETECTED: [%s]\n", digit_str); switch_core_media_bug_set_read_replace_frame(bug, frame); } break; @@ -1942,7 +1965,7 @@ break; case SWITCH_ABC_TYPE_READ: if (sth->ah) { - if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) { + if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { if (switch_core_asr_feed(sth->ah, frame.data, frame.datalen, &flags) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error Feeding Data\n"); return SWITCH_FALSE; From anthm at freeswitch.org Fri Jun 5 12:53:07 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 14:53:07 -0500 Subject: [Freeswitch-svn] [commit] r13649 - freeswitch/trunk/patches Message-ID: Author: anthm Date: Fri Jun 5 14:53:06 2009 New Revision: 13649 Log: del patch Removed: freeswitch/trunk/patches/tmp.diff From brian at freeswitch.org Fri Jun 5 13:37:43 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 15:37:43 -0500 Subject: [Freeswitch-svn] [commit] r13650 - freeswitch/trunk/src Message-ID: Author: brian Date: Fri Jun 5 15:37:43 2009 New Revision: 13650 Log: move this debug line back to the right place Modified: freeswitch/trunk/src/switch_ivr_async.c Modified: freeswitch/trunk/src/switch_ivr_async.c ============================================================================== --- freeswitch/trunk/src/switch_ivr_async.c (original) +++ freeswitch/trunk/src/switch_ivr_async.c Fri Jun 5 15:37:43 2009 @@ -1014,8 +1014,8 @@ switch_channel_queue_dtmf(channel, &dtmf); p++; } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF DETECTED: [%s]\n", digit_str); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF DETECTED: [%s]\n", digit_str); switch_core_media_bug_set_read_replace_frame(bug, frame); } break; From anthm at freeswitch.org Fri Jun 5 13:57:34 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 15:57:34 -0500 Subject: [Freeswitch-svn] [commit] r13651 - freeswitch/trunk/src Message-ID: Author: anthm Date: Fri Jun 5 15:57:34 2009 New Revision: 13651 Log: picky compilers Modified: freeswitch/trunk/src/switch_core.c Modified: freeswitch/trunk/src/switch_core.c ============================================================================== --- freeswitch/trunk/src/switch_core.c (original) +++ freeswitch/trunk/src/switch_core.c Fri Jun 5 15:57:34 2009 @@ -107,7 +107,7 @@ switch_set_string(old_ip4, main_ip4); switch_set_string(main_ip4, guess_ip4); switch_core_set_variable("local_ip_v4", guess_ip4); - switch_core_set_variable("local_mask_v4", inet_ntoa(*(struct in_addr *)&mask)); + switch_core_set_variable("local_mask_v4", inet_ntoa(*(struct in_addr *)(intptr_t)&mask)); } } From brian at freeswitch.org Fri Jun 5 13:57:39 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 15:57:39 -0500 Subject: [Freeswitch-svn] [commit] r13652 - in freeswitch/trunk/src/mod/languages: mod_managed mod_managed/managed mod_perl Message-ID: Author: brian Date: Fri Jun 5 15:57:37 2009 New Revision: 13652 Log: swigall Modified: freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp Modified: freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx ============================================================================== --- freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx (original) +++ freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx Fri Jun 5 15:57:37 2009 @@ -5446,15 +5446,17 @@ } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_read(void * jarg1, void * jarg2) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_read(void * jarg1, void * jarg2, int jarg3) { int jresult ; switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ; switch_frame_t *arg2 = (switch_frame_t *) 0 ; + switch_bool_t arg3 ; switch_status_t result; arg1 = (switch_media_bug_t *)jarg1; arg2 = (switch_frame_t *)jarg2; - result = (switch_status_t)switch_core_media_bug_read(arg1,arg2); + arg3 = (switch_bool_t)jarg3; + result = (switch_status_t)switch_core_media_bug_read(arg1,arg2,arg3); jresult = result; return jresult; } @@ -9989,6 +9991,29 @@ } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_hunt_caller_profile_set(void * jarg1, void * jarg2) { + switch_caller_profile *arg1 = (switch_caller_profile *) 0 ; + switch_caller_profile *arg2 = (switch_caller_profile *) 0 ; + + arg1 = (switch_caller_profile *)jarg1; + arg2 = (switch_caller_profile *)jarg2; + if (arg1) (arg1)->hunt_caller_profile = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_hunt_caller_profile_get(void * jarg1) { + void * jresult ; + switch_caller_profile *arg1 = (switch_caller_profile *) 0 ; + switch_caller_profile *result = 0 ; + + arg1 = (switch_caller_profile *)jarg1; + result = (switch_caller_profile *) ((arg1)->hunt_caller_profile); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_times_set(void * jarg1, void * jarg2) { switch_caller_profile *arg1 = (switch_caller_profile *) 0 ; switch_channel_timetable *arg2 = (switch_channel_timetable *) 0 ; @@ -18797,6 +18822,16 @@ } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_hunt_caller_profile(void * jarg1, void * jarg2) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_caller_profile_t *)jarg2; + switch_channel_set_hunt_caller_profile(arg1,arg2); +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_originator_caller_profile(void * jarg1) { void * jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; Modified: freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs ============================================================================== --- freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs (original) +++ freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs Fri Jun 5 15:57:37 2009 @@ -945,8 +945,8 @@ return ret; } - public static switch_status_t switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug bug, switch_frame frame) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame)); + public static switch_status_t switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug bug, switch_frame frame, switch_bool_t fill) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame), (int)fill); return ret; } @@ -2462,6 +2462,10 @@ freeswitchPINVOKE.switch_channel_set_originator_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile)); } + public static void switch_channel_set_hunt_caller_profile(SWIGTYPE_p_switch_channel channel, switch_caller_profile caller_profile) { + freeswitchPINVOKE.switch_channel_set_hunt_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile)); + } + public static switch_caller_profile switch_channel_get_originator_caller_profile(SWIGTYPE_p_switch_channel channel) { IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_originator_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel)); switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false); @@ -5825,7 +5829,7 @@ public static extern int switch_core_media_bug_remove_all(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_read")] - public static extern int switch_core_media_bug_read(HandleRef jarg1, HandleRef jarg2); + public static extern int switch_core_media_bug_read(HandleRef jarg1, HandleRef jarg2, int jarg3); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_flush")] public static extern void switch_core_media_bug_flush(HandleRef jarg1); @@ -6811,6 +6815,12 @@ [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_originatee_caller_profile_get")] public static extern IntPtr switch_caller_profile_originatee_caller_profile_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_hunt_caller_profile_set")] + public static extern void switch_caller_profile_hunt_caller_profile_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_hunt_caller_profile_get")] + public static extern IntPtr switch_caller_profile_hunt_caller_profile_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_times_set")] public static extern void switch_caller_profile_times_set(HandleRef jarg1, HandleRef jarg2); @@ -9022,6 +9032,9 @@ [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_originator_caller_profile")] public static extern void switch_channel_set_originator_caller_profile(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_hunt_caller_profile")] + public static extern void switch_channel_set_hunt_caller_profile(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_originator_caller_profile")] public static extern IntPtr switch_channel_get_originator_caller_profile(HandleRef jarg1); @@ -17485,6 +17498,17 @@ } } + public switch_caller_profile hunt_caller_profile { + set { + freeswitchPINVOKE.switch_caller_profile_hunt_caller_profile_set(swigCPtr, switch_caller_profile.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_hunt_caller_profile_get(swigCPtr); + switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false); + return ret; + } + } + public switch_channel_timetable times { set { freeswitchPINVOKE.switch_caller_profile_times_set(swigCPtr, switch_channel_timetable.getCPtr(value)); Modified: freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp ============================================================================== --- freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp (original) +++ freeswitch/trunk/src/mod/languages/mod_perl/mod_perl_wrap.cpp Fri Jun 5 15:57:37 2009 @@ -11562,17 +11562,17 @@ SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu"); SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API"); SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t"); - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK))); SvREADONLY_on(sv); From mikej at freeswitch.org Fri Jun 5 13:57:40 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 15:57:40 -0500 Subject: [Freeswitch-svn] [commit] r13653 - freeswitch/trunk/src/mod/xml_int/mod_xml_cdr Message-ID: Author: mikej Date: Fri Jun 5 15:57:40 2009 New Revision: 13653 Log: fix msvc build error Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c ============================================================================== --- freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (original) +++ freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c Fri Jun 5 15:57:40 2009 @@ -113,7 +113,11 @@ if (!switch_strlen_zero(logdir)) { if ((path = switch_mprintf("%s%s%s%s.cdr.xml", logdir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session)))) { +#ifdef _MSC_VER + if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { +#else if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR| S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) { +#endif int wrote; wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); close(fd); @@ -222,7 +226,11 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to post to web server, writing to file\n"); if ((path = switch_mprintf("%s%s%s%s.cdr.xml", globals.err_log_dir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session)))) { +#ifdef _MSC_VER + if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { +#else if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) { +#endif int wrote; wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); close(fd); From anthm at freeswitch.org Fri Jun 5 14:03:01 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 16:03:01 -0500 Subject: [Freeswitch-svn] [commit] r13654 - freeswitch/trunk/src Message-ID: Author: anthm Date: Fri Jun 5 16:03:01 2009 New Revision: 13654 Log: picky compilers Modified: freeswitch/trunk/src/switch_core.c Modified: freeswitch/trunk/src/switch_core.c ============================================================================== --- freeswitch/trunk/src/switch_core.c (original) +++ freeswitch/trunk/src/switch_core.c Fri Jun 5 16:03:01 2009 @@ -104,10 +104,11 @@ switch_set_string(main_ip4, guess_ip4); } else { if (!(ok4 = !strcmp(main_ip4, guess_ip4))) { + switch_set_string(old_ip4, main_ip4); switch_set_string(main_ip4, guess_ip4); switch_core_set_variable("local_ip_v4", guess_ip4); - switch_core_set_variable("local_mask_v4", inet_ntoa(*(struct in_addr *)(intptr_t)&mask)); + switch_core_set_variable("local_mask_v4", inet_ntoa(mask)); } } From anthm at freeswitch.org Fri Jun 5 14:04:37 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 16:04:37 -0500 Subject: [Freeswitch-svn] [commit] r13655 - freeswitch/trunk/src Message-ID: Author: anthm Date: Fri Jun 5 16:04:37 2009 New Revision: 13655 Log: picky compilers Modified: freeswitch/trunk/src/switch_core.c Modified: freeswitch/trunk/src/switch_core.c ============================================================================== --- freeswitch/trunk/src/switch_core.c (original) +++ freeswitch/trunk/src/switch_core.c Fri Jun 5 16:04:37 2009 @@ -104,11 +104,11 @@ switch_set_string(main_ip4, guess_ip4); } else { if (!(ok4 = !strcmp(main_ip4, guess_ip4))) { - + struct in_addr in = { mask }; switch_set_string(old_ip4, main_ip4); switch_set_string(main_ip4, guess_ip4); switch_core_set_variable("local_ip_v4", guess_ip4); - switch_core_set_variable("local_mask_v4", inet_ntoa(mask)); + switch_core_set_variable("local_mask_v4", inet_ntoa(in)); } } From anthm at freeswitch.org Fri Jun 5 14:23:38 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 16:23:38 -0500 Subject: [Freeswitch-svn] [commit] r13656 - freeswitch/trunk/src Message-ID: Author: anthm Date: Fri Jun 5 16:23:37 2009 New Revision: 13656 Log: picky compilers Modified: freeswitch/trunk/src/switch_core.c Modified: freeswitch/trunk/src/switch_core.c ============================================================================== --- freeswitch/trunk/src/switch_core.c (original) +++ freeswitch/trunk/src/switch_core.c Fri Jun 5 16:23:37 2009 @@ -870,9 +870,11 @@ char guess_mask[16] = ""; char *tmp_name; int ip_tmp = 0; + struct in_addr in; switch_find_local_ip(guess_ip, sizeof(guess_ip), &mask, AF_INET); - switch_set_string(guess_mask, inet_ntoa(*(struct in_addr *)&mask)); + in.s_addr = mask; + switch_set_string(guess_mask, inet_ntoa(in)); switch_mutex_lock(runtime.global_mutex); @@ -1130,6 +1132,7 @@ char guess_ip[256]; char *dir_path; int mask = 0; + struct in_addr in; memset(&runtime, 0, sizeof(runtime)); @@ -1191,7 +1194,8 @@ switch_find_local_ip(guess_ip, sizeof(guess_ip), &mask, AF_INET); switch_core_set_variable("local_ip_v4", guess_ip); - switch_core_set_variable("local_mask_v4", inet_ntoa(*(struct in_addr *)&mask)); + in.s_addr = mask; + switch_core_set_variable("local_mask_v4", inet_ntoa(in)); switch_find_local_ip(guess_ip, sizeof(guess_ip), NULL, AF_INET6); From anthm at freeswitch.org Fri Jun 5 14:36:52 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 16:36:52 -0500 Subject: [Freeswitch-svn] [commit] r13657 - freeswitch/trunk/src Message-ID: Author: anthm Date: Fri Jun 5 16:36:52 2009 New Revision: 13657 Log: picky compilers Modified: freeswitch/trunk/src/switch_core.c Modified: freeswitch/trunk/src/switch_core.c ============================================================================== --- freeswitch/trunk/src/switch_core.c (original) +++ freeswitch/trunk/src/switch_core.c Fri Jun 5 16:36:52 2009 @@ -104,7 +104,9 @@ switch_set_string(main_ip4, guess_ip4); } else { if (!(ok4 = !strcmp(main_ip4, guess_ip4))) { - struct in_addr in = { mask }; + struct in_addr in; + + in.s_addr = mask; switch_set_string(old_ip4, main_ip4); switch_set_string(main_ip4, guess_ip4); switch_core_set_variable("local_ip_v4", guess_ip4); From anthm at freeswitch.org Fri Jun 5 14:55:02 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 16:55:02 -0500 Subject: [Freeswitch-svn] [commit] r13658 - freeswitch/trunk/src Message-ID: Author: anthm Date: Fri Jun 5 16:55:02 2009 New Revision: 13658 Log: picky compilers Modified: freeswitch/trunk/src/switch_xml.c Modified: freeswitch/trunk/src/switch_xml.c ============================================================================== --- freeswitch/trunk/src/switch_xml.c (original) +++ freeswitch/trunk/src/switch_xml.c Fri Jun 5 16:55:02 2009 @@ -768,7 +768,13 @@ *s = '\0'; /* null terminate tag name */ for (i = 0; root->attr[i] && strcmp(n, root->attr[i][0]); i++); - while (*(n = ++s + strspn(s, SWITCH_XML_WS)) && *n != '>') { + //while (*(n = ++s + strspn(s, SWITCH_XML_WS)) && *n != '>') { + // gcc 4.4 you are a creep + for(;;) { + s++; + if (!(*(n = s + strspn(s, SWITCH_XML_WS)) && *n != '>')) { + break; + } if (*(s = n + strcspn(n, SWITCH_XML_WS))) *s = '\0'; /* attr name */ else { From anthm at freeswitch.org Fri Jun 5 15:00:10 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 17:00:10 -0500 Subject: [Freeswitch-svn] [commit] r13659 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: anthm Date: Fri Jun 5 17:00:10 2009 New Revision: 13659 Log: picky compilers Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Fri Jun 5 17:00:10 2009 @@ -3195,6 +3195,7 @@ switch_chat_interface_t *chat_interface; switch_api_interface_t *api_interface; switch_management_interface_t *management_interface; + struct in_addr in; silence_frame.data = silence_data; silence_frame.datalen = sizeof(silence_data); @@ -3209,7 +3210,8 @@ switch_mutex_init(&mod_sofia_globals.mutex, SWITCH_MUTEX_NESTED, mod_sofia_globals.pool); switch_find_local_ip(mod_sofia_globals.guess_ip, sizeof(mod_sofia_globals.guess_ip), &mod_sofia_globals.guess_mask, AF_INET); - switch_set_string(mod_sofia_globals.guess_mask_str, inet_ntoa(*(struct in_addr *)&mod_sofia_globals.guess_mask)); + in.s_addr = mod_sofia_globals.guess_mask; + switch_set_string(mod_sofia_globals.guess_mask_str, inet_ntoa(in)); gethostname(mod_sofia_globals.hostname, sizeof(mod_sofia_globals.hostname)); From mikej at freeswitch.org Fri Jun 5 17:14:56 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 19:14:56 -0500 Subject: [Freeswitch-svn] [commit] r13660 - freeswitch/trunk/libs/esl/perl Message-ID: Author: mikej Date: Fri Jun 5 19:14:55 2009 New Revision: 13660 Log: silence stupid errors Modified: freeswitch/trunk/libs/esl/perl/Makefile Modified: freeswitch/trunk/libs/esl/perl/Makefile ============================================================================== --- freeswitch/trunk/libs/esl/perl/Makefile (original) +++ freeswitch/trunk/libs/esl/perl/Makefile Fri Jun 5 19:14:55 2009 @@ -3,6 +3,7 @@ PERL_LIBS=$(shell perl -MConfig -e 'print $$Config{libs}') LOCAL_CFLAGS=-w -DMULTIPLICITY $(shell $(PERL) -MExtUtils::Embed -e ccopts) -DEMBED_PERL LOCAL_LDFLAGS=$(shell $(PERL) -MExtUtils::Embed -e ldopts) $(shell $(PERL) -MConfig -e 'print $$Config{libs}') +GCC_WARNING_JUNK=-w PERL_INC=$(shell $(PERL) -MExtUtils::Embed -e perl_inc) all: ESL.so @@ -16,7 +17,7 @@ $(CC) $(CC_CFLAGS) $(CFLAGS) $(LOCAL_CFLAGS) -c perlxsi.c -o perlxsi.o esl_wrap.o: esl_wrap.cpp - $(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(PERL_INC) -c esl_wrap.cpp -o esl_wrap.o + $(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(GCC_WARNING_JUNK) $(PERL_INC) -c esl_wrap.cpp -o esl_wrap.o ESL.so: esl_wrap.o perlxsi.o $(CXX) $(SOLINK) esl_wrap.o perlxsi.o $(MYLIB) $(LOCAL_LDFLAGS) -o ESL.so -L. $(LIBS) From mrene at freeswitch.org Fri Jun 5 18:37:26 2009 From: mrene at freeswitch.org (FreeSWITCH SVN) Date: Fri, 05 Jun 2009 20:37:26 -0500 Subject: [Freeswitch-svn] [commit] r13661 - freeswitch/trunk/src Message-ID: Author: mrene Date: Fri Jun 5 20:37:26 2009 New Revision: 13661 Log: Add support for coma-delimited lists in a user's cidr attribute Modified: freeswitch/trunk/src/switch_core.c Modified: freeswitch/trunk/src/switch_core.c ============================================================================== --- freeswitch/trunk/src/switch_core.c (original) +++ freeswitch/trunk/src/switch_core.c Fri Jun 5 20:37:26 2009 @@ -1000,15 +1000,25 @@ if (id && user_cidr) { char *token = switch_mprintf("%s@%s", id, domain); - switch_assert(token); + char *argv[100] = { 0 }; + char *dup_cidr = strdup(user_cidr); + int argc, i = 0; - if (switch_network_list_add_cidr_token(list, user_cidr, ok, token) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) [%s] to list %s\n", - user_cidr, ok ? "allow" : "deny", switch_str_nil(token), name); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding %s (%s) [%s] to list %s\n", - user_cidr, ok ? "allow" : "deny", switch_str_nil(token), name); + switch_assert(token); + switch_assert(dup_cidr); + + if ((argc = switch_separate_string(dup_cidr, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) { + for (i = 0; i < argc; i++) { + if (switch_network_list_add_cidr_token(list, argv[i], ok, token) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) [%s] to list %s\n", + argv[i], ok ? "allow" : "deny", switch_str_nil(token), name); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding %s (%s) [%s] to list %s\n", + argv[i], ok ? "allow" : "deny", switch_str_nil(token), name); + } + } } + free(dup_cidr); free(token); } } @@ -1022,22 +1032,32 @@ if (id && user_cidr) { char *token = switch_mprintf("%s@%s", id, domain); - switch_assert(token); + char *argv[100] = { 0 }; + char *dup_cidr = strdup(user_cidr); + int argc, i = 0; - if (switch_network_list_add_cidr_token(list, user_cidr, ok, token) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) [%s] to list %s\n", - user_cidr, ok ? "allow" : "deny", switch_str_nil(token), name); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding %s (%s) [%s] to list %s\n", - user_cidr, ok ? "allow" : "deny", switch_str_nil(token), name); + switch_assert(token); + switch_assert(dup_cidr); + + if ((argc = switch_separate_string(dup_cidr, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) { + for (i = 0; i < argc; i++) { + if (switch_network_list_add_cidr_token(list, argv[i], ok, token) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) [%s] to list %s\n", + argv[i], ok ? "allow" : "deny", switch_str_nil(token), name); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding %s (%s) [%s] to list %s\n", + argv[i], ok ? "allow" : "deny", switch_str_nil(token), name); + } + } } + free(dup_cidr); free(token); } } } } } - + switch_xml_free(xml_root); } else if (cidr) { if (switch_network_list_add_cidr(list, cidr, ok) == SWITCH_STATUS_SUCCESS) { From mrene at freeswitch.org Sat Jun 6 04:31:38 2009 From: mrene at freeswitch.org (FreeSWITCH SVN) Date: Sat, 06 Jun 2009 06:31:38 -0500 Subject: [Freeswitch-svn] [commit] r13662 - freeswitch/trunk/src/mod/applications/mod_nibblebill Message-ID: Author: mrene Date: Sat Jun 6 06:31:37 2009 New Revision: 13662 Log: MODAPP-286 Modified: freeswitch/trunk/src/mod/applications/mod_nibblebill/mod_nibblebill.c Modified: freeswitch/trunk/src/mod/applications/mod_nibblebill/mod_nibblebill.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_nibblebill/mod_nibblebill.c (original) +++ freeswitch/trunk/src/mod/applications/mod_nibblebill/mod_nibblebill.c Sat Jun 6 06:31:37 2009 @@ -413,7 +413,7 @@ /* Get caller profile info from channel */ profile = switch_channel_get_caller_profile(channel); - if (!profile) { + if (!profile || !profile->times) { /* No caller profile (why would this happen?) */ return SWITCH_STATUS_SUCCESS; } From gmaruzz at freeswitch.org Sat Jun 6 09:36:27 2009 From: gmaruzz at freeswitch.org (FreeSWITCH SVN) Date: Sat, 06 Jun 2009 11:36:27 -0500 Subject: [Freeswitch-svn] [commit] r13663 - freeswitch/trunk/src/mod/endpoints/mod_skypiax Message-ID: Author: gmaruzz Date: Sat Jun 6 11:36:26 2009 New Revision: 13663 Log: skypiax: when repeatedly you try to connect to non-existing Skype account in a short period, the Skype client send you back the two halves of the message 'ERROR 92 CALL: Unrecognised identity' inverted in a way that breaks the flux of the API messages. Maybe an anti-spam feature? Anyway, let's try to work around it and restore sanity with a 1 second delay Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c Sat Jun 6 11:36:26 2009 @@ -1448,6 +1448,9 @@ char buffer[17000]; char *b; int i; + int continue_is_broken=0; + Atom atom_begin = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False); + Atom atom_continue = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE", False); b = buffer; @@ -1466,15 +1469,38 @@ buf[i] = '\0'; + if(an_event.xclient.message_type == atom_begin){ + + if(strlen(buffer)){ + unsigned int howmany; + howmany = strlen(b) + 1; + howmany = write(SkypiaxHandles->fdesc[1], b, howmany); + DEBUGA_SKYPE ("RECEIVED2=|||%s|||\n", SKYPIAX_P_LOG, buffer); + memset(buffer, '\0', 17000); + } + } + if(an_event.xclient.message_type == atom_continue){ + + if(!strlen(buffer)){ + WARNINGA("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||. Let's introduce a 1 second delay.\n", SKYPIAX_P_LOG, buf); + continue_is_broken=1; + skypiax_sleep(1000000); //1 sec + break; + } + } + strcat(buffer, buf); - if (i < 20) { /* last fragment */ + if (i < 20 || continue_is_broken) { /* last fragment */ unsigned int howmany; howmany = strlen(b) + 1; howmany = write(SkypiaxHandles->fdesc[1], b, howmany); + DEBUGA_SKYPE ("RECEIVED=|||%s|||\n", SKYPIAX_P_LOG, buffer); memset(buffer, '\0', 17000); + XFlush(disp); + continue_is_broken=0; } break; From gmaruzz at freeswitch.org Sat Jun 6 11:15:26 2009 From: gmaruzz at freeswitch.org (FreeSWITCH SVN) Date: Sat, 06 Jun 2009 13:15:26 -0500 Subject: [Freeswitch-svn] [commit] r13664 - freeswitch/trunk/src/mod/endpoints/mod_skypiax Message-ID: Author: gmaruzz Date: Sat Jun 6 13:15:26 2009 New Revision: 13664 Log: skypiax: the Skype client sends us BOTH inband and out_of_band DTMFs, no way to shut the inbands. Let's intercept the out_of_bands ONLY if we are not bridged (eg: IVR, so not to waste CPU in detecting inband), but not propagate the out_of_band DTMFs if we are bridged (inband ones will be propagated) Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c Sat Jun 6 13:15:26 2009 @@ -1174,14 +1174,20 @@ channel = switch_core_session_get_channel(session); if (channel) { - switch_dtmf_t dtmf = { (char) value[0], switch_core_default_dtmf_duration(0) }; - DEBUGA_SKYPE("received DTMF %c on channel %s\n", SKYPIAX_P_LOG, dtmf.digit, - switch_channel_get_name(channel)); - switch_mutex_lock(tech_pvt->flag_mutex); - //FIXME: why sometimes DTMFs from here do not seems to be get by FS? - switch_channel_queue_dtmf(channel, &dtmf); - switch_set_flag(tech_pvt, TFLAG_DTMF); - switch_mutex_unlock(tech_pvt->flag_mutex); + + if (! switch_channel_test_flag(channel, CF_BRIDGED)) { + + switch_dtmf_t dtmf = { (char) value[0], switch_core_default_dtmf_duration(0) }; + DEBUGA_SKYPE("received DTMF %c on channel %s\n", SKYPIAX_P_LOG, dtmf.digit, + switch_channel_get_name(channel)); + switch_mutex_lock(tech_pvt->flag_mutex); + //FIXME: why sometimes DTMFs from here do not seems to be get by FS? + switch_channel_queue_dtmf(channel, &dtmf); + switch_set_flag(tech_pvt, TFLAG_DTMF); + switch_mutex_unlock(tech_pvt->flag_mutex); + } else { + DEBUGA_SKYPE("received a DTMF on channel %s, but we're BRIDGED, so let's NOT relay it out of band\n", SKYPIAX_P_LOG, switch_channel_get_name(channel)); + } } else { WARNINGA("received %c DTMF, but no channel?\n", SKYPIAX_P_LOG, value[0]); } From mrene at freeswitch.org Sat Jun 6 12:10:37 2009 From: mrene at freeswitch.org (FreeSWITCH SVN) Date: Sat, 06 Jun 2009 14:10:37 -0500 Subject: [Freeswitch-svn] [commit] r13665 - freeswitch/trunk/src/include Message-ID: Author: mrene Date: Sat Jun 6 14:10:37 2009 New Revision: 13665 Log: xml_config tweaks Modified: freeswitch/trunk/src/include/switch_xml_config.h Modified: freeswitch/trunk/src/include/switch_xml_config.h ============================================================================== --- freeswitch/trunk/src/include/switch_xml_config.h (original) +++ freeswitch/trunk/src/include/switch_xml_config.h Sat Jun 6 14:10:37 2009 @@ -98,11 +98,32 @@ char *helptext; /*< Optional documentation text for this setting */ }; -#define SWITCH_CONFIG_ITEM(_key, _type, _flags, _ptr, _defaultvalue, _data, _syntax, _helptext) { _key, _type, _flags, _ptr, _defaultvalue, _data, NULL, _syntax, _helptext } -#define SWITCH_CONFIG_ITEM_STRING_STRDUP(_key, _flags, _ptr, _defaultvalue, _syntax, _helptext) { _key, SWITCH_CONFIG_STRING, _flags, _ptr, _defaultvalue, &switch_config_string_strdup, NULL, _helptext} -#define SWITCH_CONFIG_ITEM_CALLBACK(_key, _type, _flags, _ptr, _defaultvalue, _data, _functiondata, _syntax, _helptext) { _key, _type, _flags, _ptr, _defaultvalue, _functiondata, _data, _syntax, _helptext } +#define SWITCH_CONFIG_ITEM(_key, _type, _flags, _ptr, _defaultvalue, _data, _syntax, _helptext) { _key, _type, _flags, _ptr, (void*)_defaultvalue, (void*)_data, NULL, _syntax, _helptext } +#define SWITCH_CONFIG_ITEM_STRING_STRDUP(_key, _flags, _ptr, _defaultvalue, _syntax, _helptext) { _key, SWITCH_CONFIG_STRING, _flags, _ptr, (void*)_defaultvalue, &switch_config_string_strdup, NULL, _syntax, _helptext } +#define SWITCH_CONFIG_ITEM_CALLBACK(_key, _type, _flags, _ptr, _defaultvalue, _function, _functiondata, _syntax, _helptext) { _key, _type, _flags, _ptr, (void*)_defaultvalue, _functiondata, _function, _syntax, _helptext } #define SWITCH_CONFIG_ITEM_END() { NULL, SWITCH_CONFIG_LAST, 0, NULL, NULL, NULL, NULL, NULL, NULL } +#define SWITCH_CONFIG_SET_ITEM(_item, _key, _type, _flags, _ptr, _defaultvalue, _data, _syntax, _helptext) \ + _item.key = _key; \ + _item.type = _type; \ + _item.flags = _flags; \ + _item.ptr = _ptr; \ + _item.defaultvalue = (void*)_defaultvalue; \ + _item.data = (void*)_data; \ + _item.syntax = _syntax; \ + _item.helptext = _helptext + +#define SWITCH_CONFIG_SET_ITEM_CALLBACK(_item, _key, _type, _flags, _ptr, _defaultvalue, _function, _syntax, _helptext) \ + _item.key = _key; \ + _item.type = _type; \ + _item.flags = _flags; \ + _item.ptr = ptr; \ + _item.defaultvalue = (void*)_defaultvalue; \ + _item.data = (void*)_data; \ + _item.function = _function \ + _item.syntax = _syntax; \ + _item.helptext = _helptext + /*! * \brief Gets the int representation of an enum * \param enum_options the switch_xml_config_enum_item_t array for this enum From gmaruzz at freeswitch.org Sat Jun 6 13:31:01 2009 From: gmaruzz at freeswitch.org (FreeSWITCH SVN) Date: Sat, 06 Jun 2009 15:31:01 -0500 Subject: [Freeswitch-svn] [commit] r13666 - freeswitch/trunk/src/mod/endpoints/mod_skypiax Message-ID: Author: gmaruzz Date: Sat Jun 6 15:31:01 2009 New Revision: 13666 Log: skypiax: insert the delay ONLY if the broken message is 'ERROR 92 CALL: Unrecognised identity': when repeatedly you try to connect to non-existing Skype account in a short period, the Skype client send you back the two halves of the message 'ERROR 92 CALL: Unrecognised identity' inverted in a way that breaks the flux of the API messages. Maybe an anti-spam feature? Anyway, let's try to work around it and restore sanity with a 1 second delay Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c Sat Jun 6 15:31:01 2009 @@ -381,10 +381,11 @@ tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS; tech_pvt->interface_state = SKYPIAX_STATE_UP; start_audio_threads(tech_pvt); - skypiax_sleep(1000); + skypiax_sleep(1000); //FIXME sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id, tech_pvt->tcp_cli_port); skypiax_signaling_write(tech_pvt, msg_to_skype); + skypiax_sleep(1000); //FIXME sprintf(msg_to_skype, "#output ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id, tech_pvt->tcp_srv_port); skypiax_signaling_write(tech_pvt, msg_to_skype); @@ -1469,6 +1470,8 @@ buf[i] = '\0'; + DEBUGA_SKYPE ("BUF=|||%s|||\n", SKYPIAX_P_LOG, buf); + if(an_event.xclient.message_type == atom_begin){ if(strlen(buffer)){ @@ -1482,9 +1485,12 @@ if(an_event.xclient.message_type == atom_continue){ if(!strlen(buffer)){ - WARNINGA("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||. Let's introduce a 1 second delay.\n", SKYPIAX_P_LOG, buf); + DEBUGA_SKYPE("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||\n", SKYPIAX_P_LOG, buf); continue_is_broken=1; - skypiax_sleep(1000000); //1 sec + if(!strncmp(buf, "ognised identity", 15)) { + WARNINGA("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||. Let's introduce a 1 second delay.\n", SKYPIAX_P_LOG, buf); + skypiax_sleep(1000000); //1 sec + } break; } } From gmaruzz at freeswitch.org Sat Jun 6 16:59:27 2009 From: gmaruzz at freeswitch.org (FreeSWITCH SVN) Date: Sat, 06 Jun 2009 18:59:27 -0500 Subject: [Freeswitch-svn] [commit] r13667 - freeswitch/trunk/src/mod/endpoints/mod_skypiax Message-ID: Author: gmaruzz Date: Sat Jun 6 18:59:27 2009 New Revision: 13667 Log: skypiax: now it manages the REMOTEHOLD status, when the remote party puts the call on-hold Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h (original) +++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax.h Sat Jun 6 18:59:27 2009 @@ -126,6 +126,7 @@ #define SKYPIAX_STATE_HANGUP_REQUESTED 200 //FIXME CALLFLOW_INCOMING_CALLID to be removed #define CALLFLOW_INCOMING_CALLID 1019 +#define CALLFLOW_STATUS_REMOTEHOLD 201 /*********************************/ Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c Sat Jun 6 18:59:27 2009 @@ -369,40 +369,50 @@ skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); DEBUGA_SKYPE("skype_call: %s is now UNPLACED\n", SKYPIAX_P_LOG, id); - } else if (!strcasecmp(value, "INPROGRESS")) { - char msg_to_skype[1024]; + } else if (!strcasecmp(value, "INPROGRESS")) { + char msg_to_skype[1024]; - if (!strlen(tech_pvt->session_uuid_str) || !strlen(tech_pvt->skype_call_id) - || !strcasecmp(tech_pvt->skype_call_id, id)) { - skypiax_strncpy(tech_pvt->skype_call_id, id, - sizeof(tech_pvt->skype_call_id) - 1); - DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id); - if (tech_pvt->skype_callflow != CALLFLOW_STATUS_EARLYMEDIA) { - tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS; - tech_pvt->interface_state = SKYPIAX_STATE_UP; - start_audio_threads(tech_pvt); - skypiax_sleep(1000); //FIXME - sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id, - tech_pvt->tcp_cli_port); - skypiax_signaling_write(tech_pvt, msg_to_skype); - skypiax_sleep(1000); //FIXME - sprintf(msg_to_skype, "#output ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id, - tech_pvt->tcp_srv_port); - skypiax_signaling_write(tech_pvt, msg_to_skype); - } - tech_pvt->skype_callflow = SKYPIAX_STATE_UP; - if (!strlen(tech_pvt->session_uuid_str)) { - DEBUGA_SKYPE("New Inbound Channel!\n", SKYPIAX_P_LOG); - new_inbound_channel(tech_pvt); - } else { - DEBUGA_SKYPE("Outbound Channel Answered!\n", SKYPIAX_P_LOG); - outbound_channel_answered(tech_pvt); - } - } else { - DEBUGA_SKYPE("I'm on %s, skype_call %s is NOT MY call, ignoring\n", - SKYPIAX_P_LOG, tech_pvt->skype_call_id, id); - } - } else { + if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) { + if (!strlen(tech_pvt->session_uuid_str) || !strlen(tech_pvt->skype_call_id) + || !strcasecmp(tech_pvt->skype_call_id, id)) { + skypiax_strncpy(tech_pvt->skype_call_id, id, + sizeof(tech_pvt->skype_call_id) - 1); + DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id); + + if (tech_pvt->skype_callflow != CALLFLOW_STATUS_EARLYMEDIA) { + tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS; + tech_pvt->interface_state = SKYPIAX_STATE_UP; + start_audio_threads(tech_pvt); + skypiax_sleep(1000); //FIXME + sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id, + tech_pvt->tcp_cli_port); + skypiax_signaling_write(tech_pvt, msg_to_skype); + skypiax_sleep(1000); //FIXME + sprintf(msg_to_skype, "#output ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id, + tech_pvt->tcp_srv_port); + skypiax_signaling_write(tech_pvt, msg_to_skype); + } + tech_pvt->skype_callflow = SKYPIAX_STATE_UP; + if (!strlen(tech_pvt->session_uuid_str)) { + DEBUGA_SKYPE("New Inbound Channel!\n", SKYPIAX_P_LOG); + new_inbound_channel(tech_pvt); + } else { + DEBUGA_SKYPE("Outbound Channel Answered!\n", SKYPIAX_P_LOG); + outbound_channel_answered(tech_pvt); + } + } else { + DEBUGA_SKYPE("I'm on %s, skype_call %s is NOT MY call, ignoring\n", + SKYPIAX_P_LOG, tech_pvt->skype_call_id, id); + } + } else { + tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS; + WARNINGA("Back from REMOTEHOLD!\n", SKYPIAX_P_LOG); + } + + } else if (!strcasecmp(value, "REMOTEHOLD")) { + tech_pvt->skype_callflow = CALLFLOW_STATUS_REMOTEHOLD; + WARNINGA("skype_call: %s is now REMOTEHOLD\n", SKYPIAX_P_LOG, id); + } else { WARNINGA("skype_call: %s, STATUS: %s is not recognized\n", SKYPIAX_P_LOG, id, value); } @@ -485,6 +495,7 @@ while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA + || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) { unsigned int fdselect; @@ -506,61 +517,65 @@ if (rt > 0) { #ifdef FARMING - switch_sleep(500); //seems that reconnecting through a proxy leads to half the packet size, bizarrely, 158-162, never 160 :-) + switch_sleep(500); //seems that reconnecting through a proxy leads to half the packet size, bizarrely, 158-162, never 160 :-) #endif // FARMING - len = recv(fd, (char *) srv_in, 320, 0); //seems that Skype only sends 320 bytes at time - - if (len == 320) { - unsigned int howmany; - - if (samplerate_skypiax == 8000) { - /* we're downsampling from 16khz to 8khz, srv_out will contain each other sample from srv_in */ - a = 0; - for (i = 0; i < len / sizeof(short); i++) { - srv_out[a] = srv_in[i]; - i++; - a++; - } - } else if (samplerate_skypiax == 16000) { - /* we're NOT downsampling, srv_out will contain ALL samples from srv_in */ - for (i = 0; i < len / sizeof(short); i++) { - srv_out[i] = srv_in[i]; - } - } else { - ERRORA("SAMPLERATE_SKYPIAX can only be 8000 or 16000\n", SKYPIAX_P_LOG); - } - /* if not yet done, let's store the half incoming frame */ - if (!tech_pvt->audiobuf_is_loaded) { - for (i = 0; i < SAMPLES_PER_FRAME / 2; i++) { - tech_pvt->audiobuf[i] = srv_out[i]; - } - tech_pvt->audiobuf_is_loaded = 1; - } else { - /* we got a stored half frame, build a complete frame in totalbuf using the stored half frame and the current half frame */ - for (i = 0; i < SAMPLES_PER_FRAME / 2; i++) { - totalbuf[i] = tech_pvt->audiobuf[i]; - } - for (a = 0; a < SAMPLES_PER_FRAME / 2; a++) { - totalbuf[i] = srv_out[a]; - i++; - } - /* send the complete frame through the pipe to our code waiting for incoming audio */ - howmany = - skypiax_pipe_write(tech_pvt->audiopipe[1], totalbuf, - SAMPLES_PER_FRAME * sizeof(short)); - if (howmany != SAMPLES_PER_FRAME * sizeof(short)) { - ERRORA("howmany is %d, but was expected to be %d\n", SKYPIAX_P_LOG, howmany, - (int) (SAMPLES_PER_FRAME * sizeof(short))); - } - /* done with the stored half frame */ - tech_pvt->audiobuf_is_loaded = 0; - } - - } else if (len == 0) { - skypiax_sleep(1000); - } else { - ERRORA("len=%d, expected 320\n", SKYPIAX_P_LOG, len); - } + if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) { + len = recv(fd, (char *) srv_in, 320, 0); //seems that Skype only sends 320 bytes at time + } else { + len = 0; + } + + if (len == 320) { + unsigned int howmany; + + if (samplerate_skypiax == 8000) { + /* we're downsampling from 16khz to 8khz, srv_out will contain each other sample from srv_in */ + a = 0; + for (i = 0; i < len / sizeof(short); i++) { + srv_out[a] = srv_in[i]; + i++; + a++; + } + } else if (samplerate_skypiax == 16000) { + /* we're NOT downsampling, srv_out will contain ALL samples from srv_in */ + for (i = 0; i < len / sizeof(short); i++) { + srv_out[i] = srv_in[i]; + } + } else { + ERRORA("SAMPLERATE_SKYPIAX can only be 8000 or 16000\n", SKYPIAX_P_LOG); + } + /* if not yet done, let's store the half incoming frame */ + if (!tech_pvt->audiobuf_is_loaded) { + for (i = 0; i < SAMPLES_PER_FRAME / 2; i++) { + tech_pvt->audiobuf[i] = srv_out[i]; + } + tech_pvt->audiobuf_is_loaded = 1; + } else { + /* we got a stored half frame, build a complete frame in totalbuf using the stored half frame and the current half frame */ + for (i = 0; i < SAMPLES_PER_FRAME / 2; i++) { + totalbuf[i] = tech_pvt->audiobuf[i]; + } + for (a = 0; a < SAMPLES_PER_FRAME / 2; a++) { + totalbuf[i] = srv_out[a]; + i++; + } + /* send the complete frame through the pipe to our code waiting for incoming audio */ + howmany = + skypiax_pipe_write(tech_pvt->audiopipe[1], totalbuf, + SAMPLES_PER_FRAME * sizeof(short)); + if (howmany != SAMPLES_PER_FRAME * sizeof(short)) { + ERRORA("howmany is %d, but was expected to be %d\n", SKYPIAX_P_LOG, howmany, + (int) (SAMPLES_PER_FRAME * sizeof(short))); + } + /* done with the stored half frame */ + tech_pvt->audiobuf_is_loaded = 0; + } + + } else if (len == 0) { + skypiax_sleep(1000); + } else { + ERRORA("len=%d, expected 320\n", SKYPIAX_P_LOG, len); + } } else { if (rt) @@ -642,6 +657,7 @@ while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA + || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) { unsigned int fdselect; int rt; @@ -699,16 +715,18 @@ } /* send the 16khz frame to the Skype client waiting for incoming audio to be sent to the remote party */ - len = send(fd, (char *) cli_out, got, 0); - skypiax_sleep(5000); //5 msec - - if (len == -1) { - break; - } else if (len != got) { - ERRORA("len=%d\n", SKYPIAX_P_LOG, len); - skypiax_sleep(1000); - break; - } + if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) { + len = send(fd, (char *) cli_out, got, 0); + skypiax_sleep(5000); //5 msec + + if (len == -1) { + break; + } else if (len != got) { + ERRORA("len=%d\n", SKYPIAX_P_LOG, len); + skypiax_sleep(1000); + break; + } + } } else { @@ -719,9 +737,17 @@ if (rt) ERRORA("CLI rt=%d\n", SKYPIAX_P_LOG, rt); memset(cli_out, 0, sizeof(cli_out)); - len = send(fd, (char *) cli_out, sizeof(cli_out), 0); - len = send(fd, (char *) cli_out, sizeof(cli_out) / 2, 0); - //DEBUGA_SKYPE("sent %d of zeros to keep the Skype client socket busy\n", SKYPIAX_P_LOG, sizeof(cli_out) + sizeof(cli_out)/2); + if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) { + len = send(fd, (char *) cli_out, sizeof(cli_out), 0); + len = send(fd, (char *) cli_out, sizeof(cli_out) / 2, 0); + //WARNINGA("sent %d of zeros to keep the Skype client socket busy\n", SKYPIAX_P_LOG, sizeof(cli_out) + sizeof(cli_out)/2); + } else { + /* + XXX do nothing + */ + //WARNINGA("we don't send it\n", SKYPIAX_P_LOG); + } + skypiax_sleep(1000); } } From brian at freeswitch.org Sun Jun 7 14:35:56 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Sun, 07 Jun 2009 16:35:56 -0500 Subject: [Freeswitch-svn] [commit] r13668 - freeswitch/trunk/conf/sip_profiles Message-ID: Author: brian Date: Sun Jun 7 16:35:54 2009 New Revision: 13668 Log: doh Modified: freeswitch/trunk/conf/sip_profiles/internal.xml Modified: freeswitch/trunk/conf/sip_profiles/internal.xml ============================================================================== --- freeswitch/trunk/conf/sip_profiles/internal.xml (original) +++ freeswitch/trunk/conf/sip_profiles/internal.xml Sun Jun 7 16:35:54 2009 @@ -53,7 +53,7 @@ - + From mikej at freeswitch.org Mon Jun 8 07:45:40 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 09:45:40 -0500 Subject: [Freeswitch-svn] [commit] r13669 - freeswitch/trunk/src Message-ID: Author: mikej Date: Mon Jun 8 09:45:40 2009 New Revision: 13669 Log: fix div by zero Modified: freeswitch/trunk/src/switch_ivr_play_say.c Modified: freeswitch/trunk/src/switch_ivr_play_say.c ============================================================================== --- freeswitch/trunk/src/switch_ivr_play_say.c (original) +++ freeswitch/trunk/src/switch_ivr_play_say.c Mon Jun 8 09:45:40 2009 @@ -1379,7 +1379,7 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done playing file\n"); - switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_out / read_impl.samples_per_second); + if (read_impl.samples_per_second) switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_out / read_impl.samples_per_second); switch_channel_set_variable_printf(channel, "playback_samples", "%d", fh->samples_out); switch_core_file_close(fh); From rupa at freeswitch.org Mon Jun 8 08:29:20 2009 From: rupa at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 10:29:20 -0500 Subject: [Freeswitch-svn] [commit] r13670 - freeswitch/trunk/conf/sip_profiles Message-ID: Author: rupa Date: Mon Jun 8 10:29:20 2009 New Revision: 13670 Log: remove duplicate "rtp-timeout-sec" Modified: freeswitch/trunk/conf/sip_profiles/external.xml Modified: freeswitch/trunk/conf/sip_profiles/external.xml ============================================================================== --- freeswitch/trunk/conf/sip_profiles/external.xml (original) +++ freeswitch/trunk/conf/sip_profiles/external.xml Mon Jun 8 10:29:20 2009 @@ -49,7 +49,6 @@ - From mikej at freeswitch.org Mon Jun 8 08:32:36 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 10:32:36 -0500 Subject: [Freeswitch-svn] [commit] r13671 - in freeswitch/trunk/libs/apr: . build include/arch/unix Message-ID: Author: mikej Date: Mon Jun 8 10:32:35 2009 New Revision: 13671 Log: fix solaris build (FSBUILD-169) Modified: freeswitch/trunk/libs/apr/.update freeswitch/trunk/libs/apr/build/apr_threads.m4 freeswitch/trunk/libs/apr/include/arch/unix/apr_arch_proc_mutex.h freeswitch/trunk/libs/apr/include/arch/unix/apr_arch_thread_mutex.h Modified: freeswitch/trunk/libs/apr/.update ============================================================================== --- freeswitch/trunk/libs/apr/.update (original) +++ freeswitch/trunk/libs/apr/.update Mon Jun 8 10:32:35 2009 @@ -1 +1 @@ -Tue May 19 13:49:44 EDT 2009 +Mon Jun 8 11:30:01 EDT 2009 Modified: freeswitch/trunk/libs/apr/build/apr_threads.m4 ============================================================================== --- freeswitch/trunk/libs/apr/build/apr_threads.m4 (original) +++ freeswitch/trunk/libs/apr/build/apr_threads.m4 Mon Jun 8 10:32:35 2009 @@ -224,7 +224,10 @@ dnl Check for recursive mutex support (per SUSv3). AC_DEFUN([APR_CHECK_PTHREAD_RECURSIVE_MUTEX], [ AC_CACHE_CHECK([for recursive mutex support], [apr_cv_mutex_recursive], -[AC_TRY_RUN([#define _XOPEN_SOURCE 600 +[AC_TRY_RUN([ +#ifndef __sun +#define _XOPEN_SOURCE 600 +#endif #include #include #include Modified: freeswitch/trunk/libs/apr/include/arch/unix/apr_arch_proc_mutex.h ============================================================================== --- freeswitch/trunk/libs/apr/include/arch/unix/apr_arch_proc_mutex.h (original) +++ freeswitch/trunk/libs/apr/include/arch/unix/apr_arch_proc_mutex.h Mon Jun 8 10:32:35 2009 @@ -17,9 +17,11 @@ #ifndef PROC_MUTEX_H #define PROC_MUTEX_H +#ifndef __sun #ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE 600 #endif +#endif #include "apr.h" #include "apr_private.h" Modified: freeswitch/trunk/libs/apr/include/arch/unix/apr_arch_thread_mutex.h ============================================================================== --- freeswitch/trunk/libs/apr/include/arch/unix/apr_arch_thread_mutex.h (original) +++ freeswitch/trunk/libs/apr/include/arch/unix/apr_arch_thread_mutex.h Mon Jun 8 10:32:35 2009 @@ -17,9 +17,11 @@ #ifndef THREAD_MUTEX_H #define THREAD_MUTEX_H +#ifndef __sun #ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE 600 #endif +#endif #include "apr.h" #include "apr_private.h" From mikej at freeswitch.org Mon Jun 8 09:25:28 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 11:25:28 -0500 Subject: [Freeswitch-svn] [commit] r13672 - in freeswitch/trunk/libs/libg722_1: . src Message-ID: Author: mikej Date: Mon Jun 8 11:25:28 2009 New Revision: 13672 Log: don't build files that will have no contents due to ifdefs Removed: freeswitch/trunk/libs/libg722_1/configure Modified: freeswitch/trunk/libs/libg722_1/.update freeswitch/trunk/libs/libg722_1/configure.ac freeswitch/trunk/libs/libg722_1/src/Makefile.am Modified: freeswitch/trunk/libs/libg722_1/.update ============================================================================== --- freeswitch/trunk/libs/libg722_1/.update (original) +++ freeswitch/trunk/libs/libg722_1/.update Mon Jun 8 11:25:28 2009 @@ -1 +1 @@ -Wed Dec 10 12:08:07 CST 2008 +Mon Jun 8 12:13:41 EDT 2009 Modified: freeswitch/trunk/libs/libg722_1/configure.ac ============================================================================== --- freeswitch/trunk/libs/libg722_1/configure.ac (original) +++ freeswitch/trunk/libs/libg722_1/configure.ac Mon Jun 8 11:25:28 2009 @@ -289,14 +289,20 @@ if test "$enable_fixed_point" = "yes" ; then AC_DEFINE([G722_1_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point]) G722_1_USE_FIXED_POINT="#define G722_1_USE_FIXED_POINT 1" + fixed = "yes" G722_1_VECTORS_FOR_TESTS="fixed" else AX_FIXED_POINT_MACHINE([$host], - [AC_DEFINE([G722_1_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point]) - G722_1_USE_FIXED_POINT="#define G722_1_USE_FIXED_POINT 1"], + [ + AC_DEFINE([G722_1_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point]) + G722_1_USE_FIXED_POINT="#define G722_1_USE_FIXED_POINT 1" + fixed = "yes" + ], [G722_1_USE_FIXED_POINT="#undef G722_1_USE_FIXED_POINT"]) G722_1_VECTORS_FOR_TESTS="floating" fi +AM_CONDITIONAL([COND_FIXED], [test "$fixed" = "yes"]) + AX_MISALIGNED_ACCESS_FAILS([$host], [AC_DEFINE([G722_1_MISALIGNED_ACCESS_FAILS], [1], [Do not expect a misaligned memory access to work correctly]) G722_1_MISALIGNED_ACCESS_FAILS="#define G722_1_MISALIGNED_ACCESS_FAILS 1"], Modified: freeswitch/trunk/libs/libg722_1/src/Makefile.am ============================================================================== --- freeswitch/trunk/libs/libg722_1/src/Makefile.am (original) +++ freeswitch/trunk/libs/libg722_1/src/Makefile.am Mon Jun 8 11:25:28 2009 @@ -42,8 +42,7 @@ lib_LTLIBRARIES = libg722_1.la -libg722_1_la_SOURCES = basop32.c \ - bitstream.c \ +libg722_1_la_SOURCES = bitstream.c \ coef2sam.c \ common.c \ commonf.c \ @@ -58,6 +57,9 @@ sam2coef.c \ tables.c +if COND_FIXED +libg722_1_la_SOURCES += basop32.c +endif libg722_1_la_LDFLAGS = -version-info @G722_1_LT_CURRENT@:@G722_1_LT_REVISION@:@G722_1_LT_AGE@ $(COMP_VENDOR_LDFLAGS) nobase_include_HEADERS = g722_1/g722_1.h \ From mikej at freeswitch.org Mon Jun 8 09:34:00 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 11:34:00 -0500 Subject: [Freeswitch-svn] [commit] r13673 - freeswitch/trunk/libs/iksemel/doc Message-ID: Author: mikej Date: Mon Jun 8 11:33:59 2009 New Revision: 13673 Log: remove generated file Removed: freeswitch/trunk/libs/iksemel/doc/iksemel From mikej at freeswitch.org Mon Jun 8 09:42:06 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 11:42:06 -0500 Subject: [Freeswitch-svn] [commit] r13674 - freeswitch/trunk/libs/libg722_1 Message-ID: Author: mikej Date: Mon Jun 8 11:42:05 2009 New Revision: 13674 Log: svn:ignore Modified: freeswitch/trunk/libs/libg722_1/ (props changed) From mikej at freeswitch.org Mon Jun 8 09:55:18 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 11:55:18 -0500 Subject: [Freeswitch-svn] [commit] r13675 - in freeswitch/trunk/libs: apr libedit sqlite Message-ID: Author: mikej Date: Mon Jun 8 11:55:18 2009 New Revision: 13675 Log: svn:ignore Modified: freeswitch/trunk/libs/apr/ (props changed) freeswitch/trunk/libs/libedit/ (props changed) freeswitch/trunk/libs/sqlite/ (props changed) From mikej at freeswitch.org Mon Jun 8 10:12:14 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 12:12:14 -0500 Subject: [Freeswitch-svn] [commit] r13676 - in freeswitch/trunk/libs: curl iksemel/build ilbc/config sofia-sip srtp/build Message-ID: Author: mikej Date: Mon Jun 8 12:12:13 2009 New Revision: 13676 Log: remove generated files from tree, this will require re-bootstrap on updated source Removed: freeswitch/trunk/libs/curl/mkinstalldirs freeswitch/trunk/libs/iksemel/build/texinfo.tex freeswitch/trunk/libs/ilbc/config/depcomp freeswitch/trunk/libs/ilbc/config/install-sh freeswitch/trunk/libs/ilbc/config/missing freeswitch/trunk/libs/srtp/build/depcomp freeswitch/trunk/libs/srtp/build/install-sh freeswitch/trunk/libs/srtp/build/missing Modified: freeswitch/trunk/libs/sofia-sip/ (props changed) From mikej at freeswitch.org Mon Jun 8 10:33:45 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 12:33:45 -0500 Subject: [Freeswitch-svn] [commit] r13677 - freeswitch/trunk Message-ID: Author: mikej Date: Mon Jun 8 12:33:45 2009 New Revision: 13677 Log: add libg722_1 to bootstrap Modified: freeswitch/trunk/bootstrap.sh Modified: freeswitch/trunk/bootstrap.sh ============================================================================== --- freeswitch/trunk/bootstrap.sh (original) +++ freeswitch/trunk/bootstrap.sh Mon Jun 8 12:33:45 2009 @@ -5,7 +5,7 @@ LIBDIR=${BASEDIR}/libs; SUBDIRS="ilbc curl iksemel voipcodecs \ js js/nsprpub libdingaling libedit libsndfile pcre sofia-sip \ - speex sqlite srtp openzap spandsp"; + speex sqlite srtp openzap spandsp libg722_1"; if [ ! -f modules.conf ]; then From mikej at freeswitch.org Mon Jun 8 10:43:50 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 12:43:50 -0500 Subject: [Freeswitch-svn] [commit] r13678 - freeswitch/trunk/libs/libnatpmp Message-ID: Author: mikej Date: Mon Jun 8 12:43:50 2009 New Revision: 13678 Log: better soliaris ifdefs Modified: freeswitch/trunk/libs/libnatpmp/getgateway.c Modified: freeswitch/trunk/libs/libnatpmp/getgateway.c ============================================================================== --- freeswitch/trunk/libs/libnatpmp/getgateway.c (original) +++ freeswitch/trunk/libs/libnatpmp/getgateway.c Mon Jun 8 12:43:50 2009 @@ -45,7 +45,7 @@ #define USE_SYSCTL_NET_ROUTE #endif -#if (defined(sun) && defined(__SVR4)) +#if ((defined(sun) || defined(__sun)) && defined(__SVR4)) #undef USE_PROC_NET_ROUTE #define USE_SOCKET_ROUTE #undef USE_SYSCTL_NET_ROUTE From mikej at freeswitch.org Mon Jun 8 10:57:16 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 12:57:16 -0500 Subject: [Freeswitch-svn] [commit] r13679 - in freeswitch/trunk/libs: apr iksemel/build ilbc/config srtp/build Message-ID: Author: mikej Date: Mon Jun 8 12:57:15 2009 New Revision: 13679 Log: svn:ignore Modified: freeswitch/trunk/libs/apr/ (props changed) freeswitch/trunk/libs/iksemel/build/ (props changed) freeswitch/trunk/libs/ilbc/config/ (props changed) freeswitch/trunk/libs/srtp/build/ (props changed) From mikej at freeswitch.org Mon Jun 8 11:01:24 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 13:01:24 -0500 Subject: [Freeswitch-svn] [commit] r13680 - in freeswitch/trunk/libs/libg722_1: . config doc src test-data test-data/itu test-data/local tests Message-ID: Author: mikej Date: Mon Jun 8 13:01:24 2009 New Revision: 13680 Log: delete generated files Removed: freeswitch/trunk/libs/libg722_1/Makefile.in freeswitch/trunk/libs/libg722_1/aclocal.m4 freeswitch/trunk/libs/libg722_1/config/config.guess freeswitch/trunk/libs/libg722_1/config/config.sub freeswitch/trunk/libs/libg722_1/config/ltmain.sh freeswitch/trunk/libs/libg722_1/doc/Makefile.in freeswitch/trunk/libs/libg722_1/src/Makefile.in freeswitch/trunk/libs/libg722_1/test-data/Makefile.in freeswitch/trunk/libs/libg722_1/test-data/itu/Makefile.in freeswitch/trunk/libs/libg722_1/test-data/local/Makefile.in freeswitch/trunk/libs/libg722_1/tests/Makefile.in From mikej at freeswitch.org Mon Jun 8 11:08:09 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 13:08:09 -0500 Subject: [Freeswitch-svn] [commit] r13681 - in freeswitch/trunk/libs: ilbc js/nsprpub/build/autoconf libg722_1 libg722_1/config libsndfile/M4 pcre spandsp sqlite Message-ID: Author: mikej Date: Mon Jun 8 13:08:09 2009 New Revision: 13681 Log: delete generated files Removed: freeswitch/trunk/libs/ilbc/config-h.in freeswitch/trunk/libs/js/nsprpub/build/autoconf/install-sh freeswitch/trunk/libs/libg722_1/config-h.in freeswitch/trunk/libs/libg722_1/config/install-sh freeswitch/trunk/libs/libsndfile/M4/libtool.m4 freeswitch/trunk/libs/pcre/install-sh freeswitch/trunk/libs/spandsp/config-h.in freeswitch/trunk/libs/sqlite/install-sh From mikej at freeswitch.org Mon Jun 8 11:12:04 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 13:12:04 -0500 Subject: [Freeswitch-svn] [commit] r13682 - in freeswitch/trunk/libs: ilbc libg722_1 libg722_1/config libg722_1/doc libg722_1/src libg722_1/test-data libg722_1/test-data/itu libg722_1/test-data/local libg722_1/tests spandsp Message-ID: Author: mikej Date: Mon Jun 8 13:12:04 2009 New Revision: 13682 Log: svn:ignore Modified: freeswitch/trunk/libs/ilbc/ (props changed) freeswitch/trunk/libs/libg722_1/ (props changed) freeswitch/trunk/libs/libg722_1/config/ (props changed) freeswitch/trunk/libs/libg722_1/doc/ (props changed) freeswitch/trunk/libs/libg722_1/src/ (props changed) freeswitch/trunk/libs/libg722_1/test-data/ (props changed) freeswitch/trunk/libs/libg722_1/test-data/itu/ (props changed) freeswitch/trunk/libs/libg722_1/test-data/local/ (props changed) freeswitch/trunk/libs/libg722_1/tests/ (props changed) freeswitch/trunk/libs/spandsp/ (props changed) From mikej at freeswitch.org Mon Jun 8 11:13:10 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 13:13:10 -0500 Subject: [Freeswitch-svn] [commit] r13683 - in freeswitch/trunk/libs: apr/build js js/nsprpub/build/autoconf libsndfile/M4 pcre sofia-sip/m4 sqlite Message-ID: Author: mikej Date: Mon Jun 8 13:13:10 2009 New Revision: 13683 Log: svn:ignore Modified: freeswitch/trunk/libs/apr/build/ (props changed) freeswitch/trunk/libs/js/ (props changed) freeswitch/trunk/libs/js/nsprpub/build/autoconf/ (props changed) freeswitch/trunk/libs/libsndfile/M4/ (props changed) freeswitch/trunk/libs/pcre/ (props changed) freeswitch/trunk/libs/sofia-sip/m4/ (props changed) freeswitch/trunk/libs/sqlite/ (props changed) From mikej at freeswitch.org Mon Jun 8 11:39:48 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 13:39:48 -0500 Subject: [Freeswitch-svn] [commit] r13684 - in freeswitch/trunk/libs: . js js/nsprpub/build/autoconf pcre sqlite Message-ID: Author: mikej Date: Mon Jun 8 13:39:48 2009 New Revision: 13684 Log: svn:ignore Modified: freeswitch/trunk/libs/ (props changed) freeswitch/trunk/libs/js/ (props changed) freeswitch/trunk/libs/js/nsprpub/build/autoconf/ (props changed) freeswitch/trunk/libs/pcre/ (props changed) freeswitch/trunk/libs/sqlite/ (props changed) From stkn at freeswitch.org Mon Jun 8 11:57:29 2009 From: stkn at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 13:57:29 -0500 Subject: [Freeswitch-svn] [commit] r13685 - freeswitch/trunk Message-ID: Author: stkn Date: Mon Jun 8 13:57:29 2009 New Revision: 13685 Log: [bootstrap] Now that some autogenerated files have been deleted Modified: freeswitch/trunk/bootstrap.sh Modified: freeswitch/trunk/bootstrap.sh ============================================================================== --- freeswitch/trunk/bootstrap.sh (original) +++ freeswitch/trunk/bootstrap.sh Mon Jun 8 13:57:29 2009 @@ -289,7 +289,7 @@ LTTEST=`grep "AC_PROG_LIBTOOL" ${CFFILE}` LTTEST2=`grep "AM_PROG_LIBTOOL" ${CFFILE}` - AMTEST=`grep "AM_INIT_AUTOMAKE" ${CFFILE}` + AMTEST=`grep "AM_INIT_AUTOMAKE\|AC_PROG_INSTALL" ${CFFILE}` AHTEST=`grep "AC_CONFIG_HEADERS" ${CFFILE}` echo "Creating aclocal.m4" @@ -314,12 +314,11 @@ ${AUTOHEADER:-autoheader} ; fi -#only run if AM_INIT_AUTOMAKE is in configure.in/configure.ac - if [ ! -z "${AMTEST}" ] ; then - if [ -f ${LIBDIR}/${i}/Makefile.am ] ; then - echo "Creating Makefile.in" - ${AUTOMAKE:-automake} --no-force --add-missing --copy ; - fi +#run if AM_INIT_AUTOMAKE / AC_PROG_INSTALL is in configure.in/configure.ac +#or Makefile.am exists + if [ ! -z "${AMTEST}" ]; then + echo "Creating Makefile.in" + ${AUTOMAKE:-automake} --no-force --add-missing --copy ; fi rm -rf autom4te*.cache fi From stkn at freeswitch.org Mon Jun 8 12:05:13 2009 From: stkn at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 14:05:13 -0500 Subject: [Freeswitch-svn] [commit] r13686 - freeswitch/trunk Message-ID: Author: stkn Date: Mon Jun 8 14:05:12 2009 New Revision: 13686 Log: [bootstrap, missing part...] ... run automake if AC_PROG_INSTALL is used in configure.{ac,in}, even if there is no Makefile.am (or install-sh may be missing later). Fix the wrong comment too. Modified: freeswitch/trunk/bootstrap.sh Modified: freeswitch/trunk/bootstrap.sh ============================================================================== --- freeswitch/trunk/bootstrap.sh (original) +++ freeswitch/trunk/bootstrap.sh Mon Jun 8 14:05:12 2009 @@ -315,7 +315,6 @@ fi #run if AM_INIT_AUTOMAKE / AC_PROG_INSTALL is in configure.in/configure.ac -#or Makefile.am exists if [ ! -z "${AMTEST}" ]; then echo "Creating Makefile.in" ${AUTOMAKE:-automake} --no-force --add-missing --copy ; From mikej at freeswitch.org Mon Jun 8 12:24:55 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 14:24:55 -0500 Subject: [Freeswitch-svn] [commit] r13687 - freeswitch/trunk/libs/js/nsprpub Message-ID: Author: mikej Date: Mon Jun 8 14:24:54 2009 New Revision: 13687 Log: fix generation of install-sh Modified: freeswitch/trunk/libs/js/nsprpub/configure.in Modified: freeswitch/trunk/libs/js/nsprpub/configure.in ============================================================================== --- freeswitch/trunk/libs/js/nsprpub/configure.in (original) +++ freeswitch/trunk/libs/js/nsprpub/configure.in Mon Jun 8 14:24:54 2009 @@ -2208,6 +2208,7 @@ dnl ======================================================== AC_PROG_GCC_TRADITIONAL AC_PROG_LIBTOOL +AC_PROG_INSTALL AC_CHECK_FUNCS(lchown strerror) dnl AC_FUNC_MEMCMP From mikej at freeswitch.org Mon Jun 8 13:13:05 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 15:13:05 -0500 Subject: [Freeswitch-svn] [commit] r13688 - freeswitch/trunk/libs/libsndfile Message-ID: Author: mikej Date: Mon Jun 8 15:13:04 2009 New Revision: 13688 Log: fix autoreconf on libsndfile Modified: freeswitch/trunk/libs/libsndfile/acinclude.m4 Modified: freeswitch/trunk/libs/libsndfile/acinclude.m4 ============================================================================== --- freeswitch/trunk/libs/libsndfile/acinclude.m4 (original) +++ freeswitch/trunk/libs/libsndfile/acinclude.m4 Mon Jun 8 15:13:04 2009 @@ -5,6 +5,12 @@ dnl Written by Paul Eggert . + +m4_include([M4/gcc_version.m4]) +m4_include([M4/octave.m4]) +m4_include([M4/mkoctfile_version.m4]) + + dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE. dnl AC_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME) AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_FLAGS], From mikej at freeswitch.org Mon Jun 8 13:34:34 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 15:34:34 -0500 Subject: [Freeswitch-svn] [commit] r13689 - in freeswitch/trunk/libs/portaudio: . bindings/cpp bindings/cpp/bin bindings/cpp/doc bindings/cpp/include bindings/cpp/lib Message-ID: Author: mikej Date: Mon Jun 8 15:34:34 2009 New Revision: 13689 Log: remove generated files from tree Removed: freeswitch/trunk/libs/portaudio/aclocal.m4 freeswitch/trunk/libs/portaudio/bindings/cpp/Makefile.in freeswitch/trunk/libs/portaudio/bindings/cpp/aclocal.m4 freeswitch/trunk/libs/portaudio/bindings/cpp/bin/Makefile.in freeswitch/trunk/libs/portaudio/bindings/cpp/configure freeswitch/trunk/libs/portaudio/bindings/cpp/doc/Makefile.in freeswitch/trunk/libs/portaudio/bindings/cpp/include/Makefile.in freeswitch/trunk/libs/portaudio/bindings/cpp/lib/Makefile.in freeswitch/trunk/libs/portaudio/configure freeswitch/trunk/libs/portaudio/ltmain.sh From mikej at freeswitch.org Mon Jun 8 13:48:54 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 15:48:54 -0500 Subject: [Freeswitch-svn] [commit] r13690 - freeswitch/trunk Message-ID: Author: mikej Date: Mon Jun 8 15:48:54 2009 New Revision: 13690 Log: add portaudio to bootstrap Modified: freeswitch/trunk/bootstrap.sh Modified: freeswitch/trunk/bootstrap.sh ============================================================================== --- freeswitch/trunk/bootstrap.sh (original) +++ freeswitch/trunk/bootstrap.sh Mon Jun 8 15:48:54 2009 @@ -5,7 +5,7 @@ LIBDIR=${BASEDIR}/libs; SUBDIRS="ilbc curl iksemel voipcodecs \ js js/nsprpub libdingaling libedit libsndfile pcre sofia-sip \ - speex sqlite srtp openzap spandsp libg722_1"; + speex sqlite srtp openzap spandsp libg722_1 portaudio"; if [ ! -f modules.conf ]; then From mikej at freeswitch.org Mon Jun 8 13:49:15 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 15:49:15 -0500 Subject: [Freeswitch-svn] [commit] r13691 - freeswitch/trunk/libs/portaudio Message-ID: Author: mikej Date: Mon Jun 8 15:49:15 2009 New Revision: 13691 Log: remove generated files from tree Removed: freeswitch/trunk/libs/portaudio/config.guess freeswitch/trunk/libs/portaudio/config.sub From mikej at freeswitch.org Mon Jun 8 13:56:16 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 15:56:16 -0500 Subject: [Freeswitch-svn] [commit] r13692 - in freeswitch/trunk/libs/portaudio: . bindings/cpp bindings/cpp/bin bindings/cpp/doc bindings/cpp/include bindings/cpp/lib Message-ID: Author: mikej Date: Mon Jun 8 15:56:16 2009 New Revision: 13692 Log: svn:ignore Modified: freeswitch/trunk/libs/portaudio/ (props changed) freeswitch/trunk/libs/portaudio/bindings/cpp/ (props changed) freeswitch/trunk/libs/portaudio/bindings/cpp/bin/ (props changed) freeswitch/trunk/libs/portaudio/bindings/cpp/doc/ (props changed) freeswitch/trunk/libs/portaudio/bindings/cpp/include/ (props changed) freeswitch/trunk/libs/portaudio/bindings/cpp/lib/ (props changed) From mikej at freeswitch.org Mon Jun 8 14:51:45 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 16:51:45 -0500 Subject: [Freeswitch-svn] [commit] r13693 - freeswitch/trunk/libs/portaudio Message-ID: Author: mikej Date: Mon Jun 8 16:51:45 2009 New Revision: 13693 Log: fix bootstrap when pkg-config is not installed Added: freeswitch/trunk/libs/portaudio/acinclude.m4 Added: freeswitch/trunk/libs/portaudio/acinclude.m4 ============================================================================== --- (empty file) +++ freeswitch/trunk/libs/portaudio/acinclude.m4 Mon Jun 8 16:51:45 2009 @@ -0,0 +1,59 @@ + + +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN([PKG_CHECK_MODULES], [ + succeeded=no + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) + + + From anthm at freeswitch.org Mon Jun 8 14:52:50 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 16:52:50 -0500 Subject: [Freeswitch-svn] [commit] r13694 - in freeswitch/trunk: libs/speex patches src src/include src/mod/applications/mod_limit src/mod/applications/mod_voicemail src/mod/asr_tts/mod_pocketsphinx Message-ID: Author: anthm Date: Mon Jun 8 16:52:50 2009 New Revision: 13694 Log: patch Added: freeswitch/trunk/patches/asr.diff Modified: freeswitch/trunk/libs/speex/config.h.in freeswitch/trunk/src/include/switch_core.h freeswitch/trunk/src/include/switch_ivr.h freeswitch/trunk/src/include/switch_module_interfaces.h freeswitch/trunk/src/mod/applications/mod_limit/Makefile freeswitch/trunk/src/mod/applications/mod_voicemail/Makefile freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c freeswitch/trunk/src/switch_core_asr.c freeswitch/trunk/src/switch_core_speech.c freeswitch/trunk/src/switch_ivr_async.c Modified: freeswitch/trunk/libs/speex/config.h.in ============================================================================== --- freeswitch/trunk/libs/speex/config.h.in (original) +++ freeswitch/trunk/libs/speex/config.h.in Mon Jun 8 16:52:50 2009 @@ -96,13 +96,13 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* The size of a `int', as computed by sizeof. */ +/* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT -/* The size of a `long', as computed by sizeof. */ +/* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG -/* The size of a `short', as computed by sizeof. */ +/* The size of `short', as computed by sizeof. */ #undef SIZEOF_SHORT /* Version extra */ Added: freeswitch/trunk/patches/asr.diff ============================================================================== --- (empty file) +++ freeswitch/trunk/patches/asr.diff Mon Jun 8 16:52:50 2009 @@ -0,0 +1,562 @@ +Index: src/switch_ivr_async.c +=================================================================== +--- src/switch_ivr_async.c (revision 13692) ++++ src/switch_ivr_async.c (working copy) +@@ -2027,14 +2027,14 @@ + return SWITCH_STATUS_FALSE; + } + +-SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, char *grammar, char *path) ++SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, char *grammar, char *name) + { + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE; + struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY); + + if (sth) { +- if (switch_core_asr_load_grammar(sth->ah, grammar, path) != SWITCH_STATUS_SUCCESS) { ++ if (switch_core_asr_load_grammar(sth->ah, grammar, name) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n"); + switch_core_asr_close(sth->ah, &flags); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); +@@ -2045,14 +2045,14 @@ + return SWITCH_STATUS_FALSE; + } + +-SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *grammar) ++SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *name) + { + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE; + struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY); + + if (sth) { +- if (switch_core_asr_unload_grammar(sth->ah, grammar) != SWITCH_STATUS_SUCCESS) { ++ if (switch_core_asr_unload_grammar(sth->ah, name) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error unloading Grammar\n"); + switch_core_asr_close(sth->ah, &flags); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); +@@ -2065,7 +2065,7 @@ + + SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session, + const char *mod_name, +- const char *grammar, const char *path, const char *dest, switch_asr_handle_t *ah) ++ const char *grammar, const char *name, const char *dest, switch_asr_handle_t *ah) + { + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_status_t status; +@@ -2085,7 +2085,7 @@ + } + + if (sth) { +- if (switch_core_asr_load_grammar(sth->ah, grammar, path) != SWITCH_STATUS_SUCCESS) { ++ if (switch_core_asr_load_grammar(sth->ah, grammar, name) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n"); + switch_core_asr_close(sth->ah, &flags); + return SWITCH_STATUS_FALSE; +@@ -2100,7 +2100,7 @@ + read_impl.actual_samples_per_second, dest, &flags, + switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { + +- if (switch_core_asr_load_grammar(ah, grammar, path) != SWITCH_STATUS_SUCCESS) { ++ if (switch_core_asr_load_grammar(ah, grammar, name) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n"); + switch_core_asr_close(ah, &flags); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); +Index: src/switch_core_asr.c +=================================================================== +--- src/switch_core_asr.c (revision 13692) ++++ src/switch_core_asr.c (working copy) +@@ -26,6 +26,7 @@ + * Anthony Minessale II + * Michael Jerris + * Paul D. Tinsley ++ * Christopher M. Rienzo + * + * + * switch_core_asr.c -- Main Core Library (Speech Detection Interface) +@@ -79,30 +80,74 @@ + return ah->asr_interface->asr_open(ah, codec, rate, dest, flags); + } + +-SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *path) ++SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name) + { +- char *epath = NULL; +- switch_status_t status; ++ switch_status_t status = SWITCH_STATUS_SUCCESS; ++ char *param_string = NULL; ++ char *data = NULL; ++ char *lgrammar = NULL; + + switch_assert(ah != NULL); + +- if (!switch_is_file_path(path)) { +- epath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, path); +- path = epath; ++ if (switch_strlen_zero(grammar)) { ++ status = SWITCH_STATUS_FALSE; ++ goto done; + } + +- status = ah->asr_interface->asr_load_grammar(ah, grammar, path); +- switch_safe_free(epath); ++ /* Set ASR parameters from params in the grammar string ++ * Params are defined as follows {name1=val1,name2=val2,name3=val3}grammar text ++ */ ++ lgrammar = strdup(grammar); ++ data = lgrammar; + ++ /* strip leading spaces */ ++ while (data && *data == ' ') { ++ data++; ++ } ++ if (switch_strlen_zero(data)) { ++ status = SWITCH_STATUS_FALSE; ++ goto done; ++ } ++ ++ /* extract params */ ++ if (*data == '{') { ++ param_string = data + 1; ++ data = switch_find_end_paren(data, '{', '}'); ++ if (switch_strlen_zero(data)) { ++ status = SWITCH_STATUS_FALSE; ++ goto done; ++ } else { ++ *data = '\0'; ++ data++; ++ } ++ } ++ ++ /* set ASR params */ ++ if (!switch_strlen_zero(param_string)) { ++ char *param[256] = { 0 }; ++ switch_separate_string(param_string, ',', param, (sizeof(param) / sizeof(param[0]))); ++ for (int i = 0; param[i]; ++i) { ++ char *param_pair[2] = { 0 }; ++ if(switch_separate_string(param[i], '=', param_pair, (sizeof(param_pair) / sizeof(param_pair[0]))) == 2) { ++ switch_core_asr_text_param(ah, param_pair[0], param_pair[1]); ++ } ++ } ++ } ++ ++ status = ah->asr_interface->asr_load_grammar(ah, data, name); ++ ++ done: ++ ++ switch_safe_free(lgrammar); + return status; + } + +-SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *grammar) ++SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *name) + { + switch_status_t status; + + switch_assert(ah != NULL); +- status = ah->asr_interface->asr_unload_grammar(ah, grammar); ++ status = ah->asr_interface->asr_unload_grammar(ah, name); + + return status; + } +@@ -158,6 +203,46 @@ + return ah->asr_interface->asr_get_results(ah, xmlstr, flags); + } + ++SWITCH_DECLARE(switch_status_t) switch_core_asr_start_input_timers(switch_asr_handle_t *ah) ++{ ++ switch_status_t status = SWITCH_STATUS_SUCCESS; ++ ++ switch_assert(ah != NULL); ++ ++ if (ah->asr_interface->asr_start_input_timers) { ++ status = ah->asr_interface->asr_start_input_timers(ah); ++ } ++ ++ return status; ++} ++ ++SWITCH_DECLARE(void) switch_core_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val) ++{ ++ switch_assert(ah != NULL); ++ ++ if (ah->asr_interface->asr_text_param) { ++ ah->asr_interface->asr_text_param(ah, param, val); ++ } ++} ++ ++SWITCH_DECLARE(void) switch_core_asr_numeric_param(switch_asr_handle_t *ah, char *param, int val) ++{ ++ switch_assert(ah != NULL); ++ ++ if (ah->asr_interface->asr_numeric_param) { ++ ah->asr_interface->asr_numeric_param(ah, param, val); ++ } ++} ++ ++SWITCH_DECLARE(void) switch_core_asr_float_param(switch_asr_handle_t *ah, char *param, double val) ++{ ++ switch_assert(ah != NULL); ++ ++ if (ah->asr_interface->asr_float_param) { ++ ah->asr_interface->asr_float_param(ah, param, val); ++ } ++} ++ + /* For Emacs: + * Local Variables: + * mode:c +Index: src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c +=================================================================== +--- src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c (revision 13692) ++++ src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c (working copy) +@@ -111,7 +111,7 @@ + } + + /*! function to load a grammar to the asr interface */ +-static switch_status_t pocketsphinx_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *path) ++static switch_status_t pocketsphinx_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name) + { + char *jsgf, *dic, *model, *rate = NULL; + pocketsphinx_t *ps = (pocketsphinx_t *) ah->private_info; +@@ -199,7 +199,7 @@ + } + + /*! function to unload a grammar to the asr interface */ +-static switch_status_t pocketsphinx_asr_unload_grammar(switch_asr_handle_t *ah, const char *grammar) ++static switch_status_t pocketsphinx_asr_unload_grammar(switch_asr_handle_t *ah, const char *name) + { + return SWITCH_STATUS_SUCCESS; + } +@@ -506,6 +506,10 @@ + asr_interface->asr_pause = pocketsphinx_asr_pause; + asr_interface->asr_check_results = pocketsphinx_asr_check_results; + asr_interface->asr_get_results = pocketsphinx_asr_get_results; ++ asr_interface->asr_start_input_timers = NULL; ++ asr_interface->asr_text_param = NULL; ++ asr_interface->asr_numeric_param = NULL; ++ asr_interface->asr_float_param = NULL; + + err_set_logfp(NULL); + +Index: src/mod/applications/mod_voicemail/Makefile +=================================================================== +--- src/mod/applications/mod_voicemail/Makefile (revision 13692) ++++ src/mod/applications/mod_voicemail/Makefile (working copy) +@@ -1,3 +1,4 @@ + BASE=../../../.. + include $(BASE)/build/modmake.rules + LOCAL_CFLAGS += `if test -f $(BASE)/.libs/libfreeswitch_la-switch_odbc.o ; then echo -DSWITCH_HAVE_ODBC; fi ;` ++LOCAL_LIBADD += -liodbc +Index: src/mod/applications/mod_limit/Makefile +=================================================================== +--- src/mod/applications/mod_limit/Makefile (revision 13692) ++++ src/mod/applications/mod_limit/Makefile (working copy) +@@ -1,3 +1,4 @@ + BASE=../../../.. + include $(BASE)/build/modmake.rules + LOCAL_CFLAGS += `if test -f $(BASE)/.libs/libfreeswitch_la-switch_odbc.o ; then echo -DSWITCH_HAVE_ODBC; fi ;` ++LOCAL_LIBADD += -liodbc +Index: src/switch_core_speech.c +=================================================================== +--- src/switch_core_speech.c (revision 13692) ++++ src/switch_core_speech.c (working copy) +@@ -22,10 +22,11 @@ + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): +- * ++ * + * Anthony Minessale II + * Michael Jerris + * Paul D. Tinsley ++ * Christopher M. Rienzo + * + * + * switch_core_speech.c -- Main Core Library (speech functions) +@@ -92,9 +93,64 @@ + + SWITCH_DECLARE(switch_status_t) switch_core_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags) + { ++ switch_status_t status = SWITCH_STATUS_SUCCESS; ++ char *param_string = NULL; ++ char *data = NULL; ++ char *ltext = NULL; ++ + switch_assert(sh != NULL); + +- return sh->speech_interface->speech_feed_tts(sh, text, flags); ++ if (switch_strlen_zero(text)) { ++ status = SWITCH_STATUS_FALSE; ++ goto done; ++ } ++ ++ /* Set TTS parameters from params in the text string ++ * Params are defined as follows {name1=val1,name2=val2,name3=val3}text to speak ++ */ ++ ltext = strdup(text); ++ data = ltext; ++ ++ /* strip leading spaces */ ++ while (data && *data == ' ') { ++ data++; ++ } ++ if (switch_strlen_zero(data)) { ++ status = SWITCH_STATUS_FALSE; ++ goto done; ++ } ++ ++ /* extract params */ ++ if (*data == '{') { ++ param_string = data + 1; ++ data = switch_find_end_paren(data, '{', '}'); ++ if (switch_strlen_zero(data)) { ++ status = SWITCH_STATUS_FALSE; ++ goto done; ++ } else { ++ *data = '\0'; ++ data++; ++ } ++ } ++ ++ /* set TTS params */ ++ if (!switch_strlen_zero(param_string)) { ++ char *param[256] = { 0 }; ++ switch_separate_string(param_string, ',', param, (sizeof(param) / sizeof(param[0]))); ++ for (int i = 0; param[i]; ++i) { ++ char *param_pair[2] = { 0 }; ++ if(switch_separate_string(param[i], '=', param_pair, (sizeof(param_pair) / sizeof(param_pair[0]))) == 2) { ++ switch_core_speech_text_param_tts(sh, param_pair[0], param_pair[1]); ++ } ++ } ++ } ++ ++ status = sh->speech_interface->speech_feed_tts(sh, data, flags); ++ ++ done: ++ ++ switch_safe_free(ltext); ++ return status; + } + + SWITCH_DECLARE(void) switch_core_speech_flush_tts(switch_speech_handle_t *sh) +Index: src/include/switch_module_interfaces.h +=================================================================== +--- src/include/switch_module_interfaces.h (revision 13692) ++++ src/include/switch_module_interfaces.h (working copy) +@@ -342,9 +342,9 @@ + /*! function to open the asr interface */ + switch_status_t (*asr_open) (switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags); + /*! function to load a grammar to the asr interface */ +- switch_status_t (*asr_load_grammar) (switch_asr_handle_t *ah, const char *grammar, const char *path); ++ switch_status_t (*asr_load_grammar) (switch_asr_handle_t *ah, const char *grammar, const char *name); + /*! function to unload a grammar to the asr interface */ +- switch_status_t (*asr_unload_grammar) (switch_asr_handle_t *ah, const char *grammar); ++ switch_status_t (*asr_unload_grammar) (switch_asr_handle_t *ah, const char *name); + /*! function to close the asr interface */ + switch_status_t (*asr_close) (switch_asr_handle_t *ah, switch_asr_flag_t *flags); + /*! function to feed audio to the ASR */ +@@ -357,6 +357,11 @@ + switch_status_t (*asr_check_results) (switch_asr_handle_t *ah, switch_asr_flag_t *flags); + /*! function to read results from the ASR */ + switch_status_t (*asr_get_results) (switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags); ++ /*! function to start ASR input timers */ ++ switch_status_t (*asr_start_input_timers) (switch_asr_handle_t *ah); ++ void (*asr_text_param) (switch_asr_handle_t *ah, char *param, const char *val); ++ void (*asr_numeric_param) (switch_asr_handle_t *ah, char *param, int val); ++ void (*asr_float_param) (switch_asr_handle_t *ah, char *param, double val); + switch_thread_rwlock_t *rwlock; + int refs; + switch_mutex_t *reflock; +@@ -409,7 +414,7 @@ + }; + + +-/*! an abstract representation of a asr/tts speech interface. */ ++/*! an abstract representation of a tts speech interface. */ + struct switch_speech_handle { + /*! the interface of the module that implemented the current speech interface */ + switch_speech_interface_t *speech_interface; +Index: src/include/switch_ivr.h +=================================================================== +--- src/include/switch_ivr.h (revision 13692) ++++ src/include/switch_ivr.h (working copy) +@@ -148,15 +148,15 @@ + \brief Engage background Speech detection on a session + \param session the session to attach + \param mod_name the module name of the ASR library +- \param grammar the grammar name +- \param path the path to the grammar file ++ \param grammar the grammar text, URI, or local file name ++ \param name the grammar name + \param dest the destination address + \param ah an ASR handle to use (NULL to create one) + \return SWITCH_STATUS_SUCCESS if all is well + */ + SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session, + const char *mod_name, +- const char *grammar, const char *path, const char *dest, switch_asr_handle_t *ah); ++ const char *grammar, const char *name, const char *dest, switch_asr_handle_t *ah); + + /*! + \brief Stop background Speech detection on a session +@@ -182,19 +182,19 @@ + /*! + \brief Load a grammar on a background speech detection handle + \param session The session to change the grammar on +- \param grammar the grammar name +- \param path the grammar path ++ \param grammar the grammar text, URI, or local file name ++ \param name the grammar name + \return SWITCH_STATUS_SUCCESS if all is well + */ +-SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, char *grammar, char *path); ++SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, char *grammar, char *name); + + /*! + \brief Unload a grammar on a background speech detection handle + \param session The session to change the grammar on +- \param grammar the grammar name ++ \param name the grammar name + \return SWITCH_STATUS_SUCCESS if all is well + */ +-SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *grammar); ++SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *name); + + /*! + \brief Record a session to disk +Index: src/include/switch_core.h +=================================================================== +--- src/include/switch_core.h (revision 13692) ++++ src/include/switch_core.h (working copy) +@@ -1623,19 +1623,19 @@ + /*! + \brief Load a grammar to an asr handle + \param ah the handle to load to +- \param grammar the name of the grammar +- \param path the path to the grammaar file ++ \param grammar the grammar text, file path, or URI ++ \param name the grammar name + \return SWITCH_STATUS_SUCCESS + */ +-SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *path); ++SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name); + + /*! + \brief Unload a grammar from an asr handle + \param ah the handle to unload the grammar from +- \param grammar the grammar to unload ++ \param name the name of the grammar to unload + \return SWITCH_STATUS_SUCCESS + */ +-SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *grammar); ++SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *name); + + /*! + \brief Pause detection on an asr handle +@@ -1651,6 +1651,37 @@ + */ + SWITCH_DECLARE(switch_status_t) switch_core_asr_resume(switch_asr_handle_t *ah); + ++/*! ++ \brief Start input timers on an asr handle ++ \param ah the handle to start timers on ++ \return SWITCH_STATUS_SUCCESS ++*/ ++SWITCH_DECLARE(switch_status_t) switch_core_asr_start_input_timers(switch_asr_handle_t *ah); ++ ++/*! ++ \brief Set a text parameter on an asr handle ++ \param sh the asr handle ++ \param param the parameter ++ \param val the value ++*/ ++SWITCH_DECLARE(void) switch_core_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val); ++ ++/*! ++ \brief Set a numeric parameter on an asr handle ++ \param sh the asr handle ++ \param param the parameter ++ \param val the value ++*/ ++SWITCH_DECLARE(void) switch_core_asr_numeric_param(switch_asr_handle_t *ah, char *param, int val); ++ ++/*! ++ \brief Set a float parameter on an asr handle ++ \param sh the asr handle ++ \param param the parameter ++ \param val the value ++*/ ++SWITCH_DECLARE(void) switch_core_asr_float_param(switch_asr_handle_t *ah, char *param, double val); ++ + ///\} + + +@@ -1659,7 +1690,7 @@ + ///\{ + /*! + \brief Open a directory handle +- \param dh a direcotry handle to use ++ \param dh a directory handle to use + \param module_name the directory module to use + \param source the source of the db (ip, hostname, path etc) + \param dsn the username or designation of the lookup +@@ -1672,7 +1703,7 @@ + + /*! + \brief Query a directory handle +- \param dh a direcotry handle to use ++ \param dh a directory handle to use + \param base the base to query against + \param query a string of filters or query data + \return SWITCH_STATUS_SUCCESS if the query is successful +@@ -1681,23 +1712,23 @@ + + /*! + \brief Obtain the next record in a lookup +- \param dh a direcotry handle to use ++ \param dh a directory handle to use + \return SWITCH_STATUS_SUCCESS if another record exists + */ + SWITCH_DECLARE(switch_status_t) switch_core_directory_next(switch_directory_handle_t *dh); + + /*! + \brief Obtain the next name/value pair in the current record +- \param dh a direcotry handle to use ++ \param dh a directory handle to use + \param var a pointer to pointer of the name to fill in +- \param val a pointer to poinbter of the value to fill in ++ \param val a pointer to pointer of the value to fill in + \return SWITCH_STATUS_SUCCESS if an item exists + */ + SWITCH_DECLARE(switch_status_t) switch_core_directory_next_pair(switch_directory_handle_t *dh, char **var, char **val); + + /*! + \brief Close an open directory handle +- \param dh a direcotry handle to close ++ \param dh a directory handle to close + \return SWITCH_STATUS_SUCCESS if handle was closed + */ + SWITCH_DECLARE(switch_status_t) switch_core_directory_close(switch_directory_handle_t *dh); +Index: libs/speex/config.h.in +=================================================================== +--- libs/speex/config.h.in (revision 13692) ++++ libs/speex/config.h.in (working copy) +@@ -96,13 +96,13 @@ + /* Define to the version of this package. */ + #undef PACKAGE_VERSION + +-/* The size of a `int', as computed by sizeof. */ ++/* The size of `int', as computed by sizeof. */ + #undef SIZEOF_INT + +-/* The size of a `long', as computed by sizeof. */ ++/* The size of `long', as computed by sizeof. */ + #undef SIZEOF_LONG + +-/* The size of a `short', as computed by sizeof. */ ++/* The size of `short', as computed by sizeof. */ + #undef SIZEOF_SHORT + + /* Version extra */ Modified: freeswitch/trunk/src/include/switch_core.h ============================================================================== --- freeswitch/trunk/src/include/switch_core.h (original) +++ freeswitch/trunk/src/include/switch_core.h Mon Jun 8 16:52:50 2009 @@ -1623,19 +1623,19 @@ /*! \brief Load a grammar to an asr handle \param ah the handle to load to - \param grammar the name of the grammar - \param path the path to the grammaar file + \param grammar the grammar text, file path, or URI + \param name the grammar name \return SWITCH_STATUS_SUCCESS */ -SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *path); +SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name); /*! \brief Unload a grammar from an asr handle \param ah the handle to unload the grammar from - \param grammar the grammar to unload + \param name the name of the grammar to unload \return SWITCH_STATUS_SUCCESS */ -SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *grammar); +SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *name); /*! \brief Pause detection on an asr handle @@ -1651,6 +1651,37 @@ */ SWITCH_DECLARE(switch_status_t) switch_core_asr_resume(switch_asr_handle_t *ah); +/*! + \brief Start input timers on an asr handle + \param ah the handle to start timers on + \return SWITCH_STATUS_SUCCESS +*/ +SWITCH_DECLARE(switch_status_t) switch_core_asr_start_input_timers(switch_asr_handle_t *ah); + +/*! + \brief Set a text parameter on an asr handle + \param sh the asr handle + \param param the parameter + \param val the value +*/ +SWITCH_DECLARE(void) switch_core_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val); + +/*! + \brief Set a numeric parameter on an asr handle + \param sh the asr handle + \param param the parameter + \param val the value +*/ +SWITCH_DECLARE(void) switch_core_asr_numeric_param(switch_asr_handle_t *ah, char *param, int val); + +/*! + \brief Set a float parameter on an asr handle + \param sh the asr handle + \param param the parameter + \param val the value +*/ +SWITCH_DECLARE(void) switch_core_asr_float_param(switch_asr_handle_t *ah, char *param, double val); + ///\} @@ -1659,7 +1690,7 @@ ///\{ /*! \brief Open a directory handle - \param dh a direcotry handle to use + \param dh a directory handle to use \param module_name the directory module to use \param source the source of the db (ip, hostname, path etc) \param dsn the username or designation of the lookup @@ -1672,7 +1703,7 @@ /*! \brief Query a directory handle - \param dh a direcotry handle to use + \param dh a directory handle to use \param base the base to query against \param query a string of filters or query data \return SWITCH_STATUS_SUCCESS if the query is successful @@ -1681,23 +1712,23 @@ /*! \brief Obtain the next record in a lookup - \param dh a direcotry handle to use + \param dh a directory handle to use \return SWITCH_STATUS_SUCCESS if another record exists */ SWITCH_DECLARE(switch_status_t) switch_core_directory_next(switch_directory_handle_t *dh); /*! \brief Obtain the next name/value pair in the current record - \param dh a direcotry handle to use + \param dh a directory handle to use \param var a pointer to pointer of the name to fill in - \param val a pointer to poinbter of the value to fill in + \param val a pointer to pointer of the value to fill in \return SWITCH_STATUS_SUCCESS if an item exists */ SWITCH_DECLARE(switch_status_t) switch_core_directory_next_pair(switch_directory_handle_t *dh, char **var, char **val); /*! \brief Close an open directory handle - \param dh a direcotry handle to close + \param dh a directory handle to close \return SWITCH_STATUS_SUCCESS if handle was closed */ SWITCH_DECLARE(switch_status_t) switch_core_directory_close(switch_directory_handle_t *dh); Modified: freeswitch/trunk/src/include/switch_ivr.h ============================================================================== --- freeswitch/trunk/src/include/switch_ivr.h (original) +++ freeswitch/trunk/src/include/switch_ivr.h Mon Jun 8 16:52:50 2009 @@ -148,15 +148,15 @@ \brief Engage background Speech detection on a session \param session the session to attach \param mod_name the module name of the ASR library - \param grammar the grammar name - \param path the path to the grammar file + \param grammar the grammar text, URI, or local file name + \param name the grammar name \param dest the destination address \param ah an ASR handle to use (NULL to create one) \return SWITCH_STATUS_SUCCESS if all is well */ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session, const char *mod_name, - const char *grammar, const char *path, const char *dest, switch_asr_handle_t *ah); + const char *grammar, const char *name, const char *dest, switch_asr_handle_t *ah); /*! \brief Stop background Speech detection on a session @@ -182,19 +182,19 @@ /*! \brief Load a grammar on a background speech detection handle \param session The session to change the grammar on - \param grammar the grammar name - \param path the grammar path + \param grammar the grammar text, URI, or local file name + \param name the grammar name \return SWITCH_STATUS_SUCCESS if all is well */ -SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, char *grammar, char *path); +SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, char *grammar, char *name); /*! \brief Unload a grammar on a background speech detection handle \param session The session to change the grammar on - \param grammar the grammar name + \param name the grammar name \return SWITCH_STATUS_SUCCESS if all is well */ -SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *grammar); +SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *name); /*! \brief Record a session to disk Modified: freeswitch/trunk/src/include/switch_module_interfaces.h ============================================================================== --- freeswitch/trunk/src/include/switch_module_interfaces.h (original) +++ freeswitch/trunk/src/include/switch_module_interfaces.h Mon Jun 8 16:52:50 2009 @@ -342,9 +342,9 @@ /*! function to open the asr interface */ switch_status_t (*asr_open) (switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags); /*! function to load a grammar to the asr interface */ - switch_status_t (*asr_load_grammar) (switch_asr_handle_t *ah, const char *grammar, const char *path); + switch_status_t (*asr_load_grammar) (switch_asr_handle_t *ah, const char *grammar, const char *name); /*! function to unload a grammar to the asr interface */ - switch_status_t (*asr_unload_grammar) (switch_asr_handle_t *ah, const char *grammar); + switch_status_t (*asr_unload_grammar) (switch_asr_handle_t *ah, const char *name); /*! function to close the asr interface */ switch_status_t (*asr_close) (switch_asr_handle_t *ah, switch_asr_flag_t *flags); /*! function to feed audio to the ASR */ @@ -357,6 +357,11 @@ switch_status_t (*asr_check_results) (switch_asr_handle_t *ah, switch_asr_flag_t *flags); /*! function to read results from the ASR */ switch_status_t (*asr_get_results) (switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags); + /*! function to start ASR input timers */ + switch_status_t (*asr_start_input_timers) (switch_asr_handle_t *ah); + void (*asr_text_param) (switch_asr_handle_t *ah, char *param, const char *val); + void (*asr_numeric_param) (switch_asr_handle_t *ah, char *param, int val); + void (*asr_float_param) (switch_asr_handle_t *ah, char *param, double val); switch_thread_rwlock_t *rwlock; int refs; switch_mutex_t *reflock; @@ -409,7 +414,7 @@ }; -/*! an abstract representation of a asr/tts speech interface. */ +/*! an abstract representation of a tts speech interface. */ struct switch_speech_handle { /*! the interface of the module that implemented the current speech interface */ switch_speech_interface_t *speech_interface; Modified: freeswitch/trunk/src/mod/applications/mod_limit/Makefile ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_limit/Makefile (original) +++ freeswitch/trunk/src/mod/applications/mod_limit/Makefile Mon Jun 8 16:52:50 2009 @@ -1,3 +1,4 @@ BASE=../../../.. include $(BASE)/build/modmake.rules LOCAL_CFLAGS += `if test -f $(BASE)/.libs/libfreeswitch_la-switch_odbc.o ; then echo -DSWITCH_HAVE_ODBC; fi ;` +LOCAL_LIBADD += -liodbc Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/Makefile ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_voicemail/Makefile (original) +++ freeswitch/trunk/src/mod/applications/mod_voicemail/Makefile Mon Jun 8 16:52:50 2009 @@ -1,3 +1,4 @@ BASE=../../../.. include $(BASE)/build/modmake.rules LOCAL_CFLAGS += `if test -f $(BASE)/.libs/libfreeswitch_la-switch_odbc.o ; then echo -DSWITCH_HAVE_ODBC; fi ;` +LOCAL_LIBADD += -liodbc Modified: freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c ============================================================================== --- freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c (original) +++ freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c Mon Jun 8 16:52:50 2009 @@ -111,7 +111,7 @@ } /*! function to load a grammar to the asr interface */ -static switch_status_t pocketsphinx_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *path) +static switch_status_t pocketsphinx_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name) { char *jsgf, *dic, *model, *rate = NULL; pocketsphinx_t *ps = (pocketsphinx_t *) ah->private_info; @@ -199,7 +199,7 @@ } /*! function to unload a grammar to the asr interface */ -static switch_status_t pocketsphinx_asr_unload_grammar(switch_asr_handle_t *ah, const char *grammar) +static switch_status_t pocketsphinx_asr_unload_grammar(switch_asr_handle_t *ah, const char *name) { return SWITCH_STATUS_SUCCESS; } @@ -506,6 +506,10 @@ asr_interface->asr_pause = pocketsphinx_asr_pause; asr_interface->asr_check_results = pocketsphinx_asr_check_results; asr_interface->asr_get_results = pocketsphinx_asr_get_results; + asr_interface->asr_start_input_timers = NULL; + asr_interface->asr_text_param = NULL; + asr_interface->asr_numeric_param = NULL; + asr_interface->asr_float_param = NULL; err_set_logfp(NULL); Modified: freeswitch/trunk/src/switch_core_asr.c ============================================================================== --- freeswitch/trunk/src/switch_core_asr.c (original) +++ freeswitch/trunk/src/switch_core_asr.c Mon Jun 8 16:52:50 2009 @@ -26,6 +26,7 @@ * Anthony Minessale II * Michael Jerris * Paul D. Tinsley + * Christopher M. Rienzo * * * switch_core_asr.c -- Main Core Library (Speech Detection Interface) @@ -79,30 +80,74 @@ return ah->asr_interface->asr_open(ah, codec, rate, dest, flags); } -SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *path) +SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name) { - char *epath = NULL; - switch_status_t status; + switch_status_t status = SWITCH_STATUS_SUCCESS; + char *param_string = NULL; + char *data = NULL; + char *lgrammar = NULL; switch_assert(ah != NULL); - if (!switch_is_file_path(path)) { - epath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, path); - path = epath; + if (switch_strlen_zero(grammar)) { + status = SWITCH_STATUS_FALSE; + goto done; + } + + /* Set ASR parameters from params in the grammar string + * Params are defined as follows {name1=val1,name2=val2,name3=val3}grammar text + */ + lgrammar = strdup(grammar); + data = lgrammar; + + /* strip leading spaces */ + while (data && *data == ' ') { + data++; + } + if (switch_strlen_zero(data)) { + status = SWITCH_STATUS_FALSE; + goto done; + } + + /* extract params */ + if (*data == '{') { + param_string = data + 1; + data = switch_find_end_paren(data, '{', '}'); + if (switch_strlen_zero(data)) { + status = SWITCH_STATUS_FALSE; + goto done; + } else { + *data = '\0'; + data++; + } + } + + /* set ASR params */ + if (!switch_strlen_zero(param_string)) { + char *param[256] = { 0 }; + switch_separate_string(param_string, ',', param, (sizeof(param) / sizeof(param[0]))); + for (int i = 0; param[i]; ++i) { + char *param_pair[2] = { 0 }; + if(switch_separate_string(param[i], '=', param_pair, (sizeof(param_pair) / sizeof(param_pair[0]))) == 2) { + switch_core_asr_text_param(ah, param_pair[0], param_pair[1]); + } + } } - status = ah->asr_interface->asr_load_grammar(ah, grammar, path); - switch_safe_free(epath); + status = ah->asr_interface->asr_load_grammar(ah, data, name); + done: + + switch_safe_free(lgrammar); return status; } -SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *grammar) +SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *name) { switch_status_t status; switch_assert(ah != NULL); - status = ah->asr_interface->asr_unload_grammar(ah, grammar); + status = ah->asr_interface->asr_unload_grammar(ah, name); return status; } @@ -158,6 +203,46 @@ return ah->asr_interface->asr_get_results(ah, xmlstr, flags); } +SWITCH_DECLARE(switch_status_t) switch_core_asr_start_input_timers(switch_asr_handle_t *ah) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + + switch_assert(ah != NULL); + + if (ah->asr_interface->asr_start_input_timers) { + status = ah->asr_interface->asr_start_input_timers(ah); + } + + return status; +} + +SWITCH_DECLARE(void) switch_core_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val) +{ + switch_assert(ah != NULL); + + if (ah->asr_interface->asr_text_param) { + ah->asr_interface->asr_text_param(ah, param, val); + } +} + +SWITCH_DECLARE(void) switch_core_asr_numeric_param(switch_asr_handle_t *ah, char *param, int val) +{ + switch_assert(ah != NULL); + + if (ah->asr_interface->asr_numeric_param) { + ah->asr_interface->asr_numeric_param(ah, param, val); + } +} + +SWITCH_DECLARE(void) switch_core_asr_float_param(switch_asr_handle_t *ah, char *param, double val) +{ + switch_assert(ah != NULL); + + if (ah->asr_interface->asr_float_param) { + ah->asr_interface->asr_float_param(ah, param, val); + } +} + /* For Emacs: * Local Variables: * mode:c Modified: freeswitch/trunk/src/switch_core_speech.c ============================================================================== --- freeswitch/trunk/src/switch_core_speech.c (original) +++ freeswitch/trunk/src/switch_core_speech.c Mon Jun 8 16:52:50 2009 @@ -22,10 +22,11 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * + * * Anthony Minessale II * Michael Jerris * Paul D. Tinsley + * Christopher M. Rienzo * * * switch_core_speech.c -- Main Core Library (speech functions) @@ -92,9 +93,64 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags) { + switch_status_t status = SWITCH_STATUS_SUCCESS; + char *param_string = NULL; + char *data = NULL; + char *ltext = NULL; + switch_assert(sh != NULL); - return sh->speech_interface->speech_feed_tts(sh, text, flags); + if (switch_strlen_zero(text)) { + status = SWITCH_STATUS_FALSE; + goto done; + } + + /* Set TTS parameters from params in the text string + * Params are defined as follows {name1=val1,name2=val2,name3=val3}text to speak + */ + ltext = strdup(text); + data = ltext; + + /* strip leading spaces */ + while (data && *data == ' ') { + data++; + } + if (switch_strlen_zero(data)) { + status = SWITCH_STATUS_FALSE; + goto done; + } + + /* extract params */ + if (*data == '{') { + param_string = data + 1; + data = switch_find_end_paren(data, '{', '}'); + if (switch_strlen_zero(data)) { + status = SWITCH_STATUS_FALSE; + goto done; + } else { + *data = '\0'; + data++; + } + } + + /* set TTS params */ + if (!switch_strlen_zero(param_string)) { + char *param[256] = { 0 }; + switch_separate_string(param_string, ',', param, (sizeof(param) / sizeof(param[0]))); + for (int i = 0; param[i]; ++i) { + char *param_pair[2] = { 0 }; + if(switch_separate_string(param[i], '=', param_pair, (sizeof(param_pair) / sizeof(param_pair[0]))) == 2) { + switch_core_speech_text_param_tts(sh, param_pair[0], param_pair[1]); + } + } + } + + status = sh->speech_interface->speech_feed_tts(sh, data, flags); + + done: + + switch_safe_free(ltext); + return status; } SWITCH_DECLARE(void) switch_core_speech_flush_tts(switch_speech_handle_t *sh) Modified: freeswitch/trunk/src/switch_ivr_async.c ============================================================================== --- freeswitch/trunk/src/switch_ivr_async.c (original) +++ freeswitch/trunk/src/switch_ivr_async.c Mon Jun 8 16:52:50 2009 @@ -2027,14 +2027,14 @@ return SWITCH_STATUS_FALSE; } -SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, char *grammar, char *path) +SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_core_session_t *session, char *grammar, char *name) { switch_channel_t *channel = switch_core_session_get_channel(session); switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE; struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY); if (sth) { - if (switch_core_asr_load_grammar(sth->ah, grammar, path) != SWITCH_STATUS_SUCCESS) { + if (switch_core_asr_load_grammar(sth->ah, grammar, name) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n"); switch_core_asr_close(sth->ah, &flags); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); @@ -2045,14 +2045,14 @@ return SWITCH_STATUS_FALSE; } -SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *grammar) +SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *name) { switch_channel_t *channel = switch_core_session_get_channel(session); switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE; struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY); if (sth) { - if (switch_core_asr_unload_grammar(sth->ah, grammar) != SWITCH_STATUS_SUCCESS) { + if (switch_core_asr_unload_grammar(sth->ah, name) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error unloading Grammar\n"); switch_core_asr_close(sth->ah, &flags); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); @@ -2065,7 +2065,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session, const char *mod_name, - const char *grammar, const char *path, const char *dest, switch_asr_handle_t *ah) + const char *grammar, const char *name, const char *dest, switch_asr_handle_t *ah) { switch_channel_t *channel = switch_core_session_get_channel(session); switch_status_t status; @@ -2085,7 +2085,7 @@ } if (sth) { - if (switch_core_asr_load_grammar(sth->ah, grammar, path) != SWITCH_STATUS_SUCCESS) { + if (switch_core_asr_load_grammar(sth->ah, grammar, name) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n"); switch_core_asr_close(sth->ah, &flags); return SWITCH_STATUS_FALSE; @@ -2100,7 +2100,7 @@ read_impl.actual_samples_per_second, dest, &flags, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { - if (switch_core_asr_load_grammar(ah, grammar, path) != SWITCH_STATUS_SUCCESS) { + if (switch_core_asr_load_grammar(ah, grammar, name) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n"); switch_core_asr_close(ah, &flags); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); From anthm at freeswitch.org Mon Jun 8 14:53:14 2009 From: anthm at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 16:53:14 -0500 Subject: [Freeswitch-svn] [commit] r13695 - freeswitch/trunk/patches Message-ID: Author: anthm Date: Mon Jun 8 16:53:14 2009 New Revision: 13695 Log: patch Removed: freeswitch/trunk/patches/asr.diff From mikej at freeswitch.org Mon Jun 8 14:53:24 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 16:53:24 -0500 Subject: [Freeswitch-svn] [commit] r13696 - freeswitch/trunk/libs/portaudio Message-ID: Author: mikej Date: Mon Jun 8 16:53:24 2009 New Revision: 13696 Log: delete generated file Removed: freeswitch/trunk/libs/portaudio/install-sh From mikej at freeswitch.org Mon Jun 8 15:01:31 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 17:01:31 -0500 Subject: [Freeswitch-svn] [commit] r13697 - freeswitch/trunk/libs/portaudio Message-ID: Author: mikej Date: Mon Jun 8 17:01:30 2009 New Revision: 13697 Log: svn:ignore Modified: freeswitch/trunk/libs/portaudio/ (props changed) From mikej at freeswitch.org Mon Jun 8 15:04:04 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 17:04:04 -0500 Subject: [Freeswitch-svn] [commit] r13698 - freeswitch/trunk/libs/ilbc Message-ID: Author: mikej Date: Mon Jun 8 17:04:04 2009 New Revision: 13698 Log: make sure this autoreconf's properly Modified: freeswitch/trunk/libs/ilbc/configure.ac Modified: freeswitch/trunk/libs/ilbc/configure.ac ============================================================================== --- freeswitch/trunk/libs/ilbc/configure.ac (original) +++ freeswitch/trunk/libs/ilbc/configure.ac Mon Jun 8 17:04:04 2009 @@ -64,6 +64,7 @@ AC_PROG_CXX AC_PROG_GCC_TRADITIONAL AC_PROG_LIBTOOL +AC_PROG_INSTALL AC_LANG([C]) AX_COMPILER_VENDOR From brian at freeswitch.org Mon Jun 8 15:06:53 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 17:06:53 -0500 Subject: [Freeswitch-svn] [commit] r13699 - freeswitch/trunk/src/mod/applications/mod_limit Message-ID: Author: brian Date: Mon Jun 8 17:06:52 2009 New Revision: 13699 Log: fix Makefile Modified: freeswitch/trunk/src/mod/applications/mod_limit/Makefile Modified: freeswitch/trunk/src/mod/applications/mod_limit/Makefile ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_limit/Makefile (original) +++ freeswitch/trunk/src/mod/applications/mod_limit/Makefile Mon Jun 8 17:06:52 2009 @@ -1,4 +1,3 @@ BASE=../../../.. include $(BASE)/build/modmake.rules LOCAL_CFLAGS += `if test -f $(BASE)/.libs/libfreeswitch_la-switch_odbc.o ; then echo -DSWITCH_HAVE_ODBC; fi ;` -LOCAL_LIBADD += -liodbc From brian at freeswitch.org Mon Jun 8 15:10:12 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 17:10:12 -0500 Subject: [Freeswitch-svn] [commit] r13700 - freeswitch/trunk/src/mod/applications/mod_voicemail Message-ID: Author: brian Date: Mon Jun 8 17:10:11 2009 New Revision: 13700 Log: remove accidental addition Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/Makefile Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/Makefile ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_voicemail/Makefile (original) +++ freeswitch/trunk/src/mod/applications/mod_voicemail/Makefile Mon Jun 8 17:10:11 2009 @@ -1,4 +1,3 @@ BASE=../../../.. include $(BASE)/build/modmake.rules LOCAL_CFLAGS += `if test -f $(BASE)/.libs/libfreeswitch_la-switch_odbc.o ; then echo -DSWITCH_HAVE_ODBC; fi ;` -LOCAL_LIBADD += -liodbc From mikej at freeswitch.org Mon Jun 8 15:21:31 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 17:21:31 -0500 Subject: [Freeswitch-svn] [commit] r13701 - freeswitch/trunk/libs/speex Message-ID: Author: mikej Date: Mon Jun 8 17:21:31 2009 New Revision: 13701 Log: remove generated file from tree Removed: freeswitch/trunk/libs/speex/config.h.in Modified: freeswitch/trunk/libs/speex/configure.ac Modified: freeswitch/trunk/libs/speex/configure.ac ============================================================================== --- freeswitch/trunk/libs/speex/configure.ac (original) +++ freeswitch/trunk/libs/speex/configure.ac Mon Jun 8 17:21:31 2009 @@ -2,7 +2,7 @@ AC_INIT(libspeex/speex.c) -AM_CONFIG_HEADER([config.h]) +AC_CONFIG_HEADERS([config.h]) SPEEX_MAJOR_VERSION=1 SPEEX_MINOR_VERSION=1 From mikej at freeswitch.org Mon Jun 8 15:22:57 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 17:22:57 -0500 Subject: [Freeswitch-svn] [commit] r13702 - freeswitch/trunk/libs/speex Message-ID: Author: mikej Date: Mon Jun 8 17:22:57 2009 New Revision: 13702 Log: svn:ignore Modified: freeswitch/trunk/libs/speex/ (props changed) From mikej at freeswitch.org Mon Jun 8 15:28:46 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 17:28:46 -0500 Subject: [Freeswitch-svn] [commit] r13703 - freeswitch/trunk/libs/portaudio Message-ID: Author: mikej Date: Mon Jun 8 17:28:45 2009 New Revision: 13703 Log: delete generated files Removed: freeswitch/trunk/libs/portaudio/depcomp freeswitch/trunk/libs/portaudio/missing From brian at freeswitch.org Mon Jun 8 16:26:30 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 18:26:30 -0500 Subject: [Freeswitch-svn] [commit] r13704 - freeswitch/trunk/src/mod/endpoints/mod_sofia Message-ID: Author: brian Date: Mon Jun 8 18:26:30 2009 New Revision: 13704 Log: don't print misleading info when nat_type isn't set on auto_nat Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Mon Jun 8 18:26:30 2009 @@ -761,7 +761,7 @@ use_timer ? "timer, " : "" ); - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && switch_core_get_variable("nat_type")) { if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_UDP, NULL) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created UDP nat mapping for %s port %d\n", profile->name, profile->sip_port); } @@ -951,7 +951,7 @@ switch_event_fire(&s_event); } - if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && switch_core_get_variable("nat_type")) { if (switch_nat_del_mapping(profile->sip_port, SWITCH_NAT_UDP) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted UDP nat mapping for %s port %d\n", profile->name, profile->sip_port); } From brian at freeswitch.org Mon Jun 8 16:28:52 2009 From: brian at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 18:28:52 -0500 Subject: [Freeswitch-svn] [commit] r13705 - freeswitch/trunk/src/mod/event_handlers/mod_event_socket Message-ID: Author: brian Date: Mon Jun 8 18:28:51 2009 New Revision: 13705 Log: don't print misleading info here either if nat_type isn't set even if the add is a no_op Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c ============================================================================== --- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original) +++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Mon Jun 8 18:28:51 2009 @@ -2213,7 +2213,7 @@ } else if (!strcmp(var, "debug")) { globals.debug = atoi(val); } else if (!strcmp(var, "nat-map")) { - if (switch_true(val)) { + if (switch_true(val) && switch_core_get_variable("nat_type")) { prefs.nat_map = 1; } } else if (!strcmp(var, "listen-port")) { @@ -2244,7 +2244,7 @@ prefs.nat_map = 0; } - if (prefs.nat_map && switch_check_network_list_ip(prefs.ip, "loopback.auto")) { + if (prefs.nat_map) { prefs.nat_map = 0; } @@ -2345,7 +2345,7 @@ close_socket(&listen_list.sock); - if (prefs.nat_map) { + if (prefs.nat_map && switch_core_get_variable("nat_type")) { switch_nat_del_mapping(prefs.port, SWITCH_NAT_TCP); } From mikej at freeswitch.org Mon Jun 8 16:51:30 2009 From: mikej at freeswitch.org (FreeSWITCH SVN) Date: Mon, 08 Jun 2009 18:51:30 -0500 Subject: [Freeswitch-svn] [commit] r13706 - in freeswitch/trunk/libs/pcre: . cmake doc doc/html testdata Message-ID: Author: mikej Date: Mon Jun 8 18:51:30 2009 New Revision: 13706 Log: update to pcre 7.9 Added: freeswitch/trunk/libs/pcre/132html (contents, props changed) freeswitch/trunk/libs/pcre/CleanTxt (contents, props changed) freeswitch/trunk/libs/pcre/Detrail (contents, props changed) freeswitch/trunk/libs/pcre/HACKING freeswitch/trunk/libs/pcre/Makefile.am freeswitch/trunk/libs/pcre/PrepareRelease (contents, props changed) freeswitch/trunk/libs/pcre/RunTest.bat freeswitch/trunk/libs/pcre/cmake/ freeswitch/trunk/libs/pcre/cmake/COPYING-CMAKE-SCRIPTS freeswitch/trunk/libs/pcre/cmake/FindPackageHandleStandardArgs.cmake freeswitch/trunk/libs/pcre/cmake/FindReadline.cmake freeswitch/trunk/libs/pcre/config-cmake.h.in freeswitch/trunk/libs/pcre/config.h.generic freeswitch/trunk/libs/pcre/depcomp (contents, props changed) freeswitch/trunk/libs/pcre/doc/html/pcre-config.html freeswitch/trunk/libs/pcre/doc/html/pcresyntax.html freeswitch/trunk/libs/pcre/doc/index.html.src freeswitch/trunk/libs/pcre/doc/pcre-config.1 freeswitch/trunk/libs/pcre/doc/pcre-config.txt freeswitch/trunk/libs/pcre/doc/pcresyntax.3 freeswitch/trunk/libs/pcre/libpcrecpp.pc.in freeswitch/trunk/libs/pcre/makevp_c.txt freeswitch/trunk/libs/pcre/makevp_l.txt freeswitch/trunk/libs/pcre/pcre.h.generic freeswitch/trunk/libs/pcre/pcre.h.in freeswitch/trunk/libs/pcre/pcre_chartables.c.dist freeswitch/trunk/libs/pcre/pcre_newline.c freeswitch/trunk/libs/pcre/pcre_ucd.c freeswitch/trunk/libs/pcre/pcrecpp_internal.h freeswitch/trunk/libs/pcre/pcregexp.pas freeswitch/trunk/libs/pcre/perltest.pl (contents, props changed) freeswitch/trunk/libs/pcre/testdata/grepinput8 freeswitch/trunk/libs/pcre/testdata/grepinputv freeswitch/trunk/libs/pcre/testdata/grepoutput8 freeswitch/trunk/libs/pcre/testdata/grepoutputN freeswitch/trunk/libs/pcre/testdata/testinput10 freeswitch/trunk/libs/pcre/testdata/testoutput10 freeswitch/trunk/libs/pcre/testdata/wintestinput3 freeswitch/trunk/libs/pcre/testdata/wintestoutput3 Modified: freeswitch/trunk/libs/pcre/AUTHORS freeswitch/trunk/libs/pcre/CMakeLists.txt freeswitch/trunk/libs/pcre/COPYING freeswitch/trunk/libs/pcre/ChangeLog freeswitch/trunk/libs/pcre/INSTALL freeswitch/trunk/libs/pcre/LICENCE freeswitch/trunk/libs/pcre/Makefile.in freeswitch/trunk/libs/pcre/NEWS freeswitch/trunk/libs/pcre/NON-UNIX-USE freeswitch/trunk/libs/pcre/README freeswitch/trunk/libs/pcre/config.h.in freeswitch/trunk/libs/pcre/configure.ac freeswitch/trunk/libs/pcre/dftables.c freeswitch/trunk/libs/pcre/doc/html/index.html freeswitch/trunk/libs/pcre/doc/html/pcre.html freeswitch/trunk/libs/pcre/doc/html/pcre_compile.html freeswitch/trunk/libs/pcre/doc/html/pcre_compile2.html freeswitch/trunk/libs/pcre/doc/html/pcre_config.html freeswitch/trunk/libs/pcre/doc/html/pcre_copy_substring.html freeswitch/trunk/libs/pcre/doc/html/pcre_dfa_exec.html freeswitch/trunk/libs/pcre/doc/html/pcre_exec.html freeswitch/trunk/libs/pcre/doc/html/pcre_fullinfo.html freeswitch/trunk/libs/pcre/doc/html/pcre_get_named_substring.html freeswitch/trunk/libs/pcre/doc/html/pcre_get_stringnumber.html freeswitch/trunk/libs/pcre/doc/html/pcre_get_stringtable_entries.html freeswitch/trunk/libs/pcre/doc/html/pcre_get_substring.html freeswitch/trunk/libs/pcre/doc/html/pcre_get_substring_list.html freeswitch/trunk/libs/pcre/doc/html/pcreapi.html freeswitch/trunk/libs/pcre/doc/html/pcrebuild.html freeswitch/trunk/libs/pcre/doc/html/pcrecallout.html freeswitch/trunk/libs/pcre/doc/html/pcrecompat.html freeswitch/trunk/libs/pcre/doc/html/pcrecpp.html freeswitch/trunk/libs/pcre/doc/html/pcregrep.html freeswitch/trunk/libs/pcre/doc/html/pcrematching.html freeswitch/trunk/libs/pcre/doc/html/pcrepartial.html freeswitch/trunk/libs/pcre/doc/html/pcrepattern.html freeswitch/trunk/libs/pcre/doc/html/pcreperform.html freeswitch/trunk/libs/pcre/doc/html/pcreposix.html freeswitch/trunk/libs/pcre/doc/html/pcreprecompile.html freeswitch/trunk/libs/pcre/doc/html/pcresample.html freeswitch/trunk/libs/pcre/doc/html/pcrestack.html freeswitch/trunk/libs/pcre/doc/html/pcretest.html freeswitch/trunk/libs/pcre/doc/pcre.3 freeswitch/trunk/libs/pcre/doc/pcre.txt freeswitch/trunk/libs/pcre/doc/pcre_compile.3 freeswitch/trunk/libs/pcre/doc/pcre_compile2.3 freeswitch/trunk/libs/pcre/doc/pcre_config.3 freeswitch/trunk/libs/pcre/doc/pcre_copy_named_substring.3 freeswitch/trunk/libs/pcre/doc/pcre_copy_substring.3 freeswitch/trunk/libs/pcre/doc/pcre_dfa_exec.3 freeswitch/trunk/libs/pcre/doc/pcre_exec.3 freeswitch/trunk/libs/pcre/doc/pcre_free_substring.3 freeswitch/trunk/libs/pcre/doc/pcre_free_substring_list.3 freeswitch/trunk/libs/pcre/doc/pcre_fullinfo.3 freeswitch/trunk/libs/pcre/doc/pcre_get_named_substring.3 freeswitch/trunk/libs/pcre/doc/pcre_get_stringnumber.3 freeswitch/trunk/libs/pcre/doc/pcre_get_stringtable_entries.3 freeswitch/trunk/libs/pcre/doc/pcre_get_substring.3 freeswitch/trunk/libs/pcre/doc/pcre_get_substring_list.3 freeswitch/trunk/libs/pcre/doc/pcre_info.3 freeswitch/trunk/libs/pcre/doc/pcre_maketables.3 freeswitch/trunk/libs/pcre/doc/pcre_refcount.3 freeswitch/trunk/libs/pcre/doc/pcre_study.3 freeswitch/trunk/libs/pcre/doc/pcre_version.3 freeswitch/trunk/libs/pcre/doc/pcreapi.3 freeswitch/trunk/libs/pcre/doc/pcrebuild.3 freeswitch/trunk/libs/pcre/doc/pcrecallout.3 freeswitch/trunk/libs/pcre/doc/pcrecompat.3 freeswitch/trunk/libs/pcre/doc/pcrecpp.3 freeswitch/trunk/libs/pcre/doc/pcregrep.1 freeswitch/trunk/libs/pcre/doc/pcregrep.txt freeswitch/trunk/libs/pcre/doc/pcrematching.3 freeswitch/trunk/libs/pcre/doc/pcrepartial.3 freeswitch/trunk/libs/pcre/doc/pcrepattern.3 freeswitch/trunk/libs/pcre/doc/pcreperform.3 freeswitch/trunk/libs/pcre/doc/pcreposix.3 freeswitch/trunk/libs/pcre/doc/pcreprecompile.3 freeswitch/trunk/libs/pcre/doc/pcresample.3 freeswitch/trunk/libs/pcre/doc/pcrestack.3 freeswitch/trunk/libs/pcre/doc/pcretest.1 freeswitch/trunk/libs/pcre/doc/pcretest.txt freeswitch/trunk/libs/pcre/libpcre.pc.in freeswitch/trunk/libs/pcre/makevp.bat freeswitch/trunk/libs/pcre/pcre-config.in freeswitch/trunk/libs/pcre/pcre.h freeswitch/trunk/libs/pcre/pcre_compile.c freeswitch/trunk/libs/pcre/pcre_config.c freeswitch/trunk/libs/pcre/pcre_dfa_exec.c freeswitch/trunk/libs/pcre/pcre_exec.c freeswitch/trunk/libs/pcre/pcre_fullinfo.c freeswitch/trunk/libs/pcre/pcre_get.c freeswitch/trunk/libs/pcre/pcre_globals.c freeswitch/trunk/libs/pcre/pcre_info.c freeswitch/trunk/libs/pcre/pcre_internal.h freeswitch/trunk/libs/pcre/pcre_maketables.c freeswitch/trunk/libs/pcre/pcre_ord2utf8.c freeswitch/trunk/libs/pcre/pcre_printint.src freeswitch/trunk/libs/pcre/pcre_refcount.c freeswitch/trunk/libs/pcre/pcre_scanner.cc freeswitch/trunk/libs/pcre/pcre_scanner.h freeswitch/trunk/libs/pcre/pcre_scanner_unittest.cc freeswitch/trunk/libs/pcre/pcre_stringpiece.cc freeswitch/trunk/libs/pcre/pcre_stringpiece.h.in freeswitch/trunk/libs/pcre/pcre_stringpiece_unittest.cc freeswitch/trunk/libs/pcre/pcre_study.c freeswitch/trunk/libs/pcre/pcre_tables.c freeswitch/trunk/libs/pcre/pcre_try_flipped.c freeswitch/trunk/libs/pcre/pcre_valid_utf8.c freeswitch/trunk/libs/pcre/pcre_version.c freeswitch/trunk/libs/pcre/pcre_xclass.c freeswitch/trunk/libs/pcre/pcrecpp.cc freeswitch/trunk/libs/pcre/pcrecpp.h freeswitch/trunk/libs/pcre/pcrecpp_unittest.cc freeswitch/trunk/libs/pcre/pcrecpparg.h.in freeswitch/trunk/libs/pcre/pcredemo.c freeswitch/trunk/libs/pcre/pcregrep.c freeswitch/trunk/libs/pcre/pcreposix.c freeswitch/trunk/libs/pcre/pcreposix.h freeswitch/trunk/libs/pcre/pcretest.c freeswitch/trunk/libs/pcre/testdata/grepinputx freeswitch/trunk/libs/pcre/testdata/grepoutput freeswitch/trunk/libs/pcre/testdata/testinput1 freeswitch/trunk/libs/pcre/testdata/testinput2 freeswitch/trunk/libs/pcre/testdata/testinput3 freeswitch/trunk/libs/pcre/testdata/testinput4 freeswitch/trunk/libs/pcre/testdata/testinput5 freeswitch/trunk/libs/pcre/testdata/testinput6 freeswitch/trunk/libs/pcre/testdata/testinput7 freeswitch/trunk/libs/pcre/testdata/testinput8 freeswitch/trunk/libs/pcre/testdata/testinput9 freeswitch/trunk/libs/pcre/testdata/testoutput1 freeswitch/trunk/libs/pcre/testdata/testoutput2 freeswitch/trunk/libs/pcre/testdata/testoutput3 freeswitch/trunk/libs/pcre/testdata/testoutput4 freeswitch/trunk/libs/pcre/testdata/testoutput5 freeswitch/trunk/libs/pcre/testdata/testoutput6 freeswitch/trunk/libs/pcre/testdata/testoutput7 freeswitch/trunk/libs/pcre/testdata/testoutput8 freeswitch/trunk/libs/pcre/testdata/testoutput9 freeswitch/trunk/libs/pcre/ucp.h Added: freeswitch/trunk/libs/pcre/132html ============================================================================== --- (empty file) +++ freeswitch/trunk/libs/pcre/132html Mon Jun 8 18:51:30 2009 @@ -0,0 +1,296 @@ +#! /usr/bin/perl -w + +# Script to turn PCRE man pages into HTML + + +# Subroutine to handle font changes and other escapes + +sub do_line { +my($s) = $_[0]; + +$s =~ s/ +$s =~ s/>/>/g; +$s =~ s"\\fI(.*?)\\f[RP]"$1"g; +$s =~ s"\\fB(.*?)\\f[RP]"$1"g; +$s =~ s"\\e"\\"g; +$s =~ s/(?<=Copyright )\(c\)/©/g; +$s; +} + +# Subroutine to ensure not in a paragraph + +sub end_para { +if ($inpara) + { + print TEMP "\n" if ($inpre); + print TEMP "

\n"; + } +$inpara = $inpre = 0; +$wrotetext = 0; +} + +# Subroutine to start a new paragraph + +sub new_para { +&end_para(); +print TEMP "

\n"; +$inpara = 1; +} + + +# Main program + +$innf = 0; +$inpara = 0; +$inpre = 0; +$wrotetext = 0; +$toc = 0; +$ref = 1; + +while ($#ARGV >= 0 && $ARGV[0] =~ /^-/) + { + $toc = 1 if $ARGV[0] eq "-toc"; + shift; + } + +# Initial output to STDOUT + +print < + +$ARGV[0] specification + + +

$ARGV[0] man page

+

+Return to the PCRE index page. +

+

+This page is part of the PCRE HTML documentation. It was generated automatically +from the original man page. If there is any nonsense in it, please consult the +man page, in case the conversion went wrong. +
+End + +print "

    \n" if ($toc); + +open(TEMP, ">/tmp/$$") || die "Can't open /tmp/$$ for output\n"; + +while () + { + # Handle lines beginning with a dot + + if (/^\./) + { + # Some of the PCRE man pages used to contain instances of .br. However, + # they should have all been removed because they cause trouble in some + # (other) automated systems that translate man pages to HTML. Complain if + # we find .br or .in (another macro that is deprecated). + + if (/^\.br/ || /^\.in/) + { + print STDERR "\n*** Deprecated macro encountered - rewrite needed\n"; + print STDERR "*** $_\n"; + die "*** Processing abandoned\n"; + } + + # Instead of .br, relevent "literal" sections are enclosed in .nf/.fi. + + elsif (/^\.nf/) + { + $innf = 1; + } + + elsif (/^\.fi/) + { + $innf = 0; + } + + # Handling .sp is subtle. If it is inside a literal section, do nothing if + # the next line is a non literal text line; similarly, if not inside a + # literal section, do nothing if a literal follows. The point being that + # the
     and 
    that delimit literal sections will do the spacing. + # Always skip if no previous output. + + elsif (/^\.sp/) + { + if ($wrotetext) + { + $_ = ; + if ($inpre) + { + print TEMP "\n" if (/^[\s.]/); + } + else + { + print TEMP "
    \n
    \n" if (!/^[\s.]/); + } + redo; # Now process the lookahead line we just read + } + } + elsif (/^\.TP/ || /^\.PP/ || /^\.P/) + { + &new_para(); + } + elsif (/^\.SH\s*("?)(.*)\1/) + { + # Ignore the NAME section + if ($2 =~ /^NAME\b/) + { + ; + next; + } + + &end_para(); + my($title) = &do_line($2); + if ($toc) + { + printf("
  • $title\n", + $ref, $ref); + printf TEMP ("
    $title
    \n", + $ref, $ref); + $ref++; + } + else + { + print TEMP "
    \n$title\n
    \n"; + } + } + elsif (/^\.SS\s*("?)(.*)\1/) + { + &end_para(); + my($title) = &do_line($2); + print TEMP "
    \n$title\n
    \n"; + } + elsif (/^\.B\s*(.*)/) + { + &new_para() if (!$inpara); + $_ = &do_line($1); + s/"(.*?)"/$1/g; + print TEMP "$_\n"; + $wrotetext = 1; + } + elsif (/^\.I\s*(.*)/) + { + &new_para() if (!$inpara); + $_ = &do_line($1); + s/"(.*?)"/$1/g; + print TEMP "$_\n"; + $wrotetext = 1; + } + + # A comment that starts "HREF" takes the next line as a name that + # is turned into a hyperlink, using the text given, which might be + # in a special font. If it ends in () or (digits) or punctuation, they + # aren't part of the link. + + elsif (/^\.\\"\s*HREF/) + { + $_=; + chomp; + $_ = &do_line($_); + $_ =~ s/\s+$//; + $_ =~ /^(?:<.>)?([^<(]+)(?:\(\))?(?:<\/.>)?(?:\(\d+\))?[.,;:]?$/; + print TEMP "$_\n"; + } + + # A comment that starts "HTML" inserts literal HTML + + elsif (/^\.\\"\s*HTML\s*(.*)/) + { + print TEMP $1; + } + + # A comment that starts < inserts that HTML at the end of the + # *next* input line - so as not to get a newline between them. + + elsif (/^\.\\"\s*(<.*>)/) + { + my($markup) = $1; + $_=; + chomp; + $_ = &do_line($_); + $_ =~ s/\s+$//; + print TEMP "$_$markup\n"; + } + + # A comment that starts JOIN joins the next two lines together, with one + # space between them. Then that line is processed. This is used in some + # displays where two lines are needed for the "man" version. JOINSH works + # the same, except that it assumes this is a shell command, so removes + # continuation backslashes. + + elsif (/^\.\\"\s*JOIN(SH)?/) + { + my($one,$two); + $one = ; + $two = ; + $one =~ s/\s*\\e\s*$// if (defined($1)); + chomp($one); + $two =~ s/^\s+//; + $_ = "$one $two"; + redo; # Process the joined lines + } + + # Ignore anything not recognized + + next; + } + + # Line does not begin with a dot. Replace blank lines with new paragraphs + + if (/^\s*$/) + { + &end_para() if ($wrotetext); + next; + } + + # Convert fonts changes and output an ordinary line. Ensure that indented + # lines are marked as literal. + + $_ = &do_line($_); + &new_para() if (!$inpara); + + if (/^\s/) + { + if (!$inpre) + { + print TEMP "
    \n";
    +      $inpre = 1;
    +      }
    +    }
    +  elsif ($inpre)
    +    {
    +    print TEMP "
    \n"; + $inpre = 0; + } + + # Add
    to the end of a non-literal line if we are within .nf/.fi + + $_ .= "
    \n" if (!$inpre && $innf); + + print TEMP; + $wrotetext = 1; + } + +# The TOC, if present, will have been written - terminate it + +print "
\n" if ($toc); + +# Copy the remainder to the standard output + +close(TEMP); +open(TEMP, "/tmp/$$") || die "Can't open /tmp/$$ for input\n"; + +print while (); + +print < +Return to the PCRE index page. +

+End + +close(TEMP); +unlink("/tmp/$$"); + +# End Modified: freeswitch/trunk/libs/pcre/AUTHORS ============================================================================== --- freeswitch/trunk/libs/pcre/AUTHORS (original) +++ freeswitch/trunk/libs/pcre/AUTHORS Mon Jun 8 18:51:30 2009 @@ -6,9 +6,9 @@ Email domain: cam.ac.uk University of Cambridge Computing Service, -Cambridge, England. Phone: +44 1223 334714. +Cambridge, England. -Copyright (c) 1997-2006 University of Cambridge +Copyright (c) 1997-2009 University of Cambridge All rights reserved @@ -17,7 +17,7 @@ Written by: Google Inc. -Copyright (c) 2006 Google Inc +Copyright (c) 2007-2008 Google Inc All rights reserved #### Modified: freeswitch/trunk/libs/pcre/CMakeLists.txt ============================================================================== --- freeswitch/trunk/libs/pcre/CMakeLists.txt (original) +++ freeswitch/trunk/libs/pcre/CMakeLists.txt Mon Jun 8 18:51:30 2009 @@ -1,17 +1,578 @@ -cmake_minimum_required(VERSION 2.6) - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libs/pcre/include/ ${CMAKE_SOURCE_DIR}/libs/pcre/) - -SET ( pcre_SRCS pcre_compile.c pcre_tables.c pcre_config.c pcre_try_flipped.c pcre_dfa_exec.c pcre_ucp_searchfuncs.c pcre_exec.c pcre_valid_utf8.c pcre_fullinfo.c pcre_version.c dftables.c pcre_get.c pcre_xclass.c pcre_globals.c pcre_info.c pcrecpp.h pcre_internal.h pcre_maketables.c pcrecpparg.h pcre_ord2utf8.c pcredemo.c pcre_refcount.c pcregrep.c pcreposix.c pcre_scanner.h pcreposix.h pcre_scanner_unittest.cc pcretest.c pcre_stringpiece.h pcre_stringpiece.h.in ucp.h pcre.h ucpinternal.h pcre_chartables.c pcre.h ) - - - - -ADD_LIBRARY(pcre STATIC ${pcre_SRCS}) - - - - - - +# CMakeLists.txt +# +# +# This file allows building PCRE with the CMake configuration and build +# tool. Download CMake in source or binary form from http://www.cmake.org/ +# +# Original listfile by Christian Ehrlicher +# Refined and expanded by Daniel Richard G. +# 2007-09-14 mod by Sheri so 7.4 supported configuration options can be entered +# 2007-09-19 Adjusted by PH to retain previous default settings +# 2007-12-26 (a) On UNIX, use names libpcre instead of just pcre +# (b) Ensure pcretest and pcregrep link with the local library, +# not a previously-installed one. +# (c) Add PCRE_SUPPORT_LIBREADLINE, PCRE_SUPPORT_LIBZ, and +# PCRE_SUPPORT_LIBBZ2. +# 2008-01-20 Brought up to date to include several new features by Christian +# Ehrlicher. +# 2008-01-22 Sheri added options for backward compatibility of library names +# when building with minGW: +# if "ON", NON_STANDARD_LIB_PREFIX causes shared libraries to +# be built without "lib" as prefix. (The libraries will be named +# pcre.dll, pcreposix.dll and pcrecpp.dll). +# if "ON", NON_STANDARD_LIB_SUFFIX causes shared libraries to +# be built with suffix of "-0.dll". (The libraries will be named +# libpcre-0.dll, libpcreposix-0.dll and libpcrecpp-0.dll - same names +# built by default with Configure and Make. +# 2008-01-23 PH removed the automatic build of pcredemo. +# 2008-04-22 PH modified READLINE support so it finds NCURSES when needed. +# 2008-07-03 PH updated for revised UCP property support (change of files) +# 2009-03-23 PH applied Steven Van Ingelgem's patch to change the name +# CMAKE_BINARY_DIR to PROJECT_BINARY_DIR so that it works when PCRE +# is included within another project. +# 2009-03-23 PH applied a modified version of Steven Van Ingelgem's patches to +# add options to stop the building of pcregrep and the tests, and +# to disable the final configuration report. +# 2009-04-11 PH applied Christian Ehrlicher's patch to show compiler flags that +# are set by specifying a release type. + +PROJECT(PCRE C CXX) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6) + +SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # for FindReadline.cmake + +# external packages +FIND_PACKAGE( BZip2 ) +FIND_PACKAGE( ZLIB ) +FIND_PACKAGE( Readline ) + +# Configuration checks + +INCLUDE(CheckIncludeFile) +INCLUDE(CheckIncludeFileCXX) +INCLUDE(CheckFunctionExists) +INCLUDE(CheckTypeSize) + +CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H) +CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H) +CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H) +CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H) +CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H) + +CHECK_INCLUDE_FILE_CXX(type_traits.h HAVE_TYPE_TRAITS_H) +CHECK_INCLUDE_FILE_CXX(bits/type_traits.h HAVE_BITS_TYPE_TRAITS_H) + +CHECK_FUNCTION_EXISTS(bcopy HAVE_BCOPY) +CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE) +CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR) +CHECK_FUNCTION_EXISTS(strtoll HAVE_STRTOLL) +CHECK_FUNCTION_EXISTS(strtoq HAVE_STRTOQ) +CHECK_FUNCTION_EXISTS(_strtoi64 HAVE__STRTOI64) + +CHECK_TYPE_SIZE("long long" LONG_LONG) +CHECK_TYPE_SIZE("unsigned long long" UNSIGNED_LONG_LONG) + +# User-configurable options +# +# (Note: CMakeSetup displays these in alphabetical order, regardless of +# the order we use here) + +SET(BUILD_SHARED_LIBS OFF CACHE BOOL + "Build shared libraries instead of static ones.") + +OPTION(PCRE_BUILD_PCRECPP "Build the PCRE C++ library (pcrecpp)." ON) + +SET(PCRE_EBCDIC OFF CACHE BOOL + "Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems)") + +SET(PCRE_LINK_SIZE "2" CACHE STRING + "Internal link size (2, 3 or 4 allowed). See LINK_SIZE in config.h.in for details.") + +SET(PCRE_MATCH_LIMIT "10000000" CACHE STRING + "Default limit on internal looping. See MATCH_LIMIT in config.h.in for details.") + +SET(PCRE_MATCH_LIMIT_RECURSION "MATCH_LIMIT" CACHE STRING + "Default limit on internal recursion. See MATCH_LIMIT_RECURSION in config.h.in for details.") + +SET(PCRE_NEWLINE "LF" CACHE STRING + "What to recognize as a newline (one of CR, LF, CRLF, ANY, ANYCRLF).") + +SET(PCRE_NO_RECURSE OFF CACHE BOOL + "If ON, then don't use stack recursion when matching. See NO_RECURSE in config.h.in for details.") + +SET(PCRE_POSIX_MALLOC_THRESHOLD "10" CACHE STRING + "Threshold for malloc() usage. See POSIX_MALLOC_THRESHOLD in config.h.in for details.") + +SET(PCRE_SUPPORT_UNICODE_PROPERTIES OFF CACHE BOOL + "Enable support for Unicode properties. (If set, UTF-8 support will be enabled as well)") + +SET(PCRE_SUPPORT_UTF8 OFF CACHE BOOL + "Enable support for the Unicode UTF-8 encoding.") + +SET(PCRE_SUPPORT_BSR_ANYCRLF OFF CACHE BOOL + "ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks") + +OPTION(PCRE_SHOW_REPORT "Show the final configuration report" ON) +OPTION(PCRE_BUILD_PCREGREP "Build pcregrep" ON) +OPTION(PCRE_BUILD_TESTS "Build the tests" ON) + +IF (PCRE_BUILD_TESTS) + IF (NOT PCRE_BUILD_PCREGREP) + MESSAGE(STATUS "** Building tests requires pcregrep: PCRE_BUILD_PCREGREP forced ON") + SET(PCRE_BUILD_PCREGREP ON) + ENDIF(NOT PCRE_BUILD_PCREGREP) +ENDIF(PCRE_BUILD_TESTS) + +IF (MINGW) + OPTION(NON_STANDARD_LIB_PREFIX + "ON=Shared libraries built in mingw will be named pcre.dll, etc., instead of libpcre.dll, etc." + OFF) + + OPTION(NON_STANDARD_LIB_SUFFIX + "ON=Shared libraries built in mingw will be named libpcre-0.dll, etc., instead of libpcre.dll, etc." + OFF) +ENDIF(MINGW) + +# bzip2 lib +IF(BZIP2_FOUND) + OPTION (PCRE_SUPPORT_LIBBZ2 "Enable support for linking pcregrep with libbz2." ON) +ENDIF(BZIP2_FOUND) +IF(PCRE_SUPPORT_LIBBZ2) + INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR}) +ENDIF(PCRE_SUPPORT_LIBBZ2) + +# zlib +IF(ZLIB_FOUND) + OPTION (PCRE_SUPPORT_LIBZ "Enable support for linking pcregrep with libz." ON) +ENDIF(ZLIB_FOUND) +IF(PCRE_SUPPORT_LIBZ) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) +ENDIF(PCRE_SUPPORT_LIBZ) + +# readline lib +IF(READLINE_FOUND) + OPTION (PCRE_SUPPORT_LIBREADLINE "Enable support for linking pcretest with libreadline." ON) +ENDIF(READLINE_FOUND) +IF(PCRE_SUPPORT_LIBREADLINE) + INCLUDE_DIRECTORIES(${READLINE_INCLUDE_DIR}) +ENDIF(PCRE_SUPPORT_LIBREADLINE) + +# Prepare build configuration + +SET(pcre_have_type_traits 0) +SET(pcre_have_bits_type_traits 0) + +IF(HAVE_TYPE_TRAITS_H) + SET(pcre_have_type_traits 1) +ENDIF(HAVE_TYPE_TRAITS_H) + +IF(HAVE_BITS_TYPE_TRAITS_H) + SET(pcre_have_bits_type_traits 1) +ENDIF(HAVE_BITS_TYPE_TRAITS_H) + +SET(pcre_have_long_long 0) +SET(pcre_have_ulong_long 0) + +IF(HAVE_LONG_LONG) + SET(pcre_have_long_long 1) +ENDIF(HAVE_LONG_LONG) + +IF(HAVE_UNSIGNED_LONG_LONG) + SET(pcre_have_ulong_long 1) +ENDIF(HAVE_UNSIGNED_LONG_LONG) + +IF(NOT BUILD_SHARED_LIBS) + SET(PCRE_STATIC 1) +ENDIF(NOT BUILD_SHARED_LIBS) + +IF(PCRE_SUPPORT_BSR_ANYCRLF) + SET(BSR_ANYCRLF 1) +ENDIF(PCRE_SUPPORT_BSR_ANYCRLF) + +IF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES) + SET(SUPPORT_UTF8 1) +ENDIF(PCRE_SUPPORT_UTF8 OR PCRE_SUPPORT_UNICODE_PROPERTIES) + +IF(PCRE_SUPPORT_UNICODE_PROPERTIES) + SET(SUPPORT_UCP 1) +ENDIF(PCRE_SUPPORT_UNICODE_PROPERTIES) + +# This next one used to contain +# SET(PCRETEST_LIBS ${READLINE_LIBRARY}) +# but I was advised to add the NCURSES test as well, along with +# some modifications to cmake/FindReadline.cmake which should +# make it possible to override the default if necessary. PH + +IF(PCRE_SUPPORT_LIBREADLINE) + SET(SUPPORT_LIBREADLINE 1) + SET(PCRETEST_LIBS ${READLINE_LIBRARY} ${NCURSES_LIBRARY}) +ENDIF(PCRE_SUPPORT_LIBREADLINE) + +IF(PCRE_SUPPORT_LIBZ) + SET(SUPPORT_LIBZ 1) + SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${ZLIB_LIBRARIES}) +ENDIF(PCRE_SUPPORT_LIBZ) + +IF(PCRE_SUPPORT_LIBBZ2) + SET(SUPPORT_LIBBZ2 1) + SET(PCREGREP_LIBS ${PCREGREP_LIBS} ${BZIP2_LIBRARIES}) +ENDIF(PCRE_SUPPORT_LIBBZ2) + +SET(NEWLINE "") + +IF(PCRE_NEWLINE STREQUAL "LF") + SET(NEWLINE "10") +ENDIF(PCRE_NEWLINE STREQUAL "LF") +IF(PCRE_NEWLINE STREQUAL "CR") + SET(NEWLINE "13") +ENDIF(PCRE_NEWLINE STREQUAL "CR") +IF(PCRE_NEWLINE STREQUAL "CRLF") + SET(NEWLINE "3338") +ENDIF(PCRE_NEWLINE STREQUAL "CRLF") +IF(PCRE_NEWLINE STREQUAL "ANY") + SET(NEWLINE "-1") +ENDIF(PCRE_NEWLINE STREQUAL "ANY") +IF(PCRE_NEWLINE STREQUAL "ANYCRLF") + SET(NEWLINE "-2") +ENDIF(PCRE_NEWLINE STREQUAL "ANYCRLF") + +IF(NEWLINE STREQUAL "") + MESSAGE(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\".") +ENDIF(NEWLINE STREQUAL "") + +IF(PCRE_EBCDIC) + SET(EBCDIC 1) +ENDIF(PCRE_EBCDIC) + +IF(PCRE_NO_RECURSE) + SET(NO_RECURSE 1) +ENDIF(PCRE_NO_RECURSE) + +# Output files +CONFIGURE_FILE(config-cmake.h.in + ${PROJECT_BINARY_DIR}/config.h + @ONLY) + +CONFIGURE_FILE(pcre.h.generic + ${PROJECT_BINARY_DIR}/pcre.h + COPYONLY) + +# What about pcre-config and libpcre.pc? + +IF(PCRE_BUILD_PCRECPP) + CONFIGURE_FILE(pcre_stringpiece.h.in + ${PROJECT_BINARY_DIR}/pcre_stringpiece.h + @ONLY) + + CONFIGURE_FILE(pcrecpparg.h.in + ${PROJECT_BINARY_DIR}/pcrecpparg.h + @ONLY) +ENDIF(PCRE_BUILD_PCRECPP) + +# Character table generation + +OPTION(PCRE_REBUILD_CHARTABLES "Rebuild char tables" OFF) +IF(PCRE_REBUILD_CHARTABLES) + ADD_EXECUTABLE(dftables dftables.c) + + GET_TARGET_PROPERTY(DFTABLES_EXE dftables LOCATION) + + ADD_CUSTOM_COMMAND( + COMMENT "Generating character tables (pcre_chartables.c) for current locale" + DEPENDS dftables + COMMAND ${DFTABLES_EXE} + ARGS ${PROJECT_BINARY_DIR}/pcre_chartables.c + OUTPUT ${PROJECT_BINARY_DIR}/pcre_chartables.c + ) +ELSE(PCRE_REBUILD_CHARTABLES) + CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/pcre_chartables.c.dist + ${PROJECT_BINARY_DIR}/pcre_chartables.c + COPYONLY) +ENDIF(PCRE_REBUILD_CHARTABLES) + +# Source code + +SET(PCRE_HEADERS ${PROJECT_BINARY_DIR}/pcre.h) + +SET(PCRE_SOURCES + ${PROJECT_BINARY_DIR}/pcre_chartables.c + pcre_compile.c + pcre_config.c + pcre_dfa_exec.c + pcre_exec.c + pcre_fullinfo.c + pcre_get.c + pcre_globals.c + pcre_info.c + pcre_newline.c + pcre_maketables.c + pcre_ord2utf8.c + pcre_refcount.c + pcre_study.c + pcre_tables.c + pcre_try_flipped.c + pcre_ucd.c + pcre_valid_utf8.c + pcre_version.c + pcre_xclass.c +) + +SET(PCREPOSIX_HEADERS pcreposix.h) + +SET(PCREPOSIX_SOURCES pcreposix.c) + +SET(PCRECPP_HEADERS + pcrecpp.h + pcre_scanner.h + ${PROJECT_BINARY_DIR}/pcrecpparg.h + ${PROJECT_BINARY_DIR}/pcre_stringpiece.h +) + +SET(PCRECPP_SOURCES + pcrecpp.cc + pcre_scanner.cc + pcre_stringpiece.cc +) + +# Build setup + +ADD_DEFINITIONS(-DHAVE_CONFIG_H) + +IF(MSVC) + ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE) +ENDIF(MSVC) + +SET(CMAKE_INCLUDE_CURRENT_DIR 1) +# needed to make sure to not link debug libs +# against release libs and vice versa +IF(WIN32) + SET(CMAKE_DEBUG_POSTFIX "d") +ENDIF(WIN32) + +SET(targets) + +# Libraries +# pcre +ADD_LIBRARY(pcre ${PCRE_HEADERS} ${PCRE_SOURCES} ${PROJECT_BINARY_DIR}/config.h) +SET(targets ${targets} pcre) +ADD_LIBRARY(pcreposix ${PCREPOSIX_HEADERS} ${PCREPOSIX_SOURCES}) +SET(targets ${targets} pcreposix) +TARGET_LINK_LIBRARIES(pcreposix pcre) +IF(MINGW AND NOT PCRE_STATIC) + IF(NON_STANDARD_LIB_PREFIX) + SET_TARGET_PROPERTIES(pcre pcreposix + PROPERTIES PREFIX "" + ) + ENDIF(NON_STANDARD_LIB_PREFIX) + + IF(NON_STANDARD_LIB_SUFFIX) + SET_TARGET_PROPERTIES(pcre pcreposix + PROPERTIES SUFFIX "-0.dll" + ) + ENDIF(NON_STANDARD_LIB_SUFFIX) +ENDIF(MINGW AND NOT PCRE_STATIC) + + +# pcrecpp +IF(PCRE_BUILD_PCRECPP) + ADD_LIBRARY(pcrecpp ${PCRECPP_HEADERS} ${PCRECPP_SOURCES}) +SET(targets ${targets} pcrecpp) + TARGET_LINK_LIBRARIES(pcrecpp pcre) + + IF(MINGW AND NOT PCRE_STATIC) + IF(NON_STANDARD_LIB_PREFIX) + SET_TARGET_PROPERTIES(pcrecpp + PROPERTIES PREFIX "" + ) + ENDIF(NON_STANDARD_LIB_PREFIX) + + IF(NON_STANDARD_LIB_SUFFIX) + SET_TARGET_PROPERTIES(pcrecpp + PROPERTIES SUFFIX "-0.dll" + ) + ENDIF(NON_STANDARD_LIB_SUFFIX) + ENDIF(MINGW AND NOT PCRE_STATIC) +ENDIF(PCRE_BUILD_PCRECPP) + + +# Executables + +# Removed by PH (2008-01-23) because pcredemo shouldn't really be built +# automatically, and it gave trouble in some environments anyway. +# ADD_EXECUTABLE(pcredemo pcredemo.c) +# TARGET_LINK_LIBRARIES(pcredemo pcreposix) +# IF(NOT BUILD_SHARED_LIBS) +# # make sure to not use declspec(dllimport) in static mode on windows +# SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC") +# ENDIF(NOT BUILD_SHARED_LIBS) + +IF(PCRE_BUILD_PCREGREP) + ADD_EXECUTABLE(pcregrep pcregrep.c) + SET(targets ${targets} pcregrep) + TARGET_LINK_LIBRARIES(pcregrep pcreposix ${PCREGREP_LIBS}) +ENDIF(PCRE_BUILD_PCREGREP) + + +# Testing +IF(PCRE_BUILD_TESTS) + ENABLE_TESTING() + + ADD_EXECUTABLE(pcretest pcretest.c) + SET(targets ${targets} pcretest) + TARGET_LINK_LIBRARIES(pcretest pcreposix ${PCRETEST_LIBS}) + + IF(PCRE_BUILD_PCRECPP) + ADD_EXECUTABLE(pcrecpp_unittest pcrecpp_unittest.cc) + SET(targets ${targets} pcrecpp_unittest) + TARGET_LINK_LIBRARIES(pcrecpp_unittest pcrecpp) + IF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC) + SET_TARGET_PROPERTIES(pcrecpp + PROPERTIES PREFIX "" + ) + ENDIF(MINGW AND NON_STANDARD_LIB_NAMES AND NOT PCRE_STATIC) + + + ADD_EXECUTABLE(pcre_scanner_unittest pcre_scanner_unittest.cc) + SET(targets ${targets} pcre_scanner_unittest) + TARGET_LINK_LIBRARIES(pcre_scanner_unittest pcrecpp) + + ADD_EXECUTABLE(pcre_stringpiece_unittest pcre_stringpiece_unittest.cc) + SET(targets ${targets} pcre_stringpiece_unittest) + TARGET_LINK_LIBRARIES(pcre_stringpiece_unittest pcrecpp) + ENDIF(PCRE_BUILD_PCRECPP) + + GET_TARGET_PROPERTY(PCREGREP_EXE pcregrep DEBUG_LOCATION) + GET_TARGET_PROPERTY(PCRETEST_EXE pcretest DEBUG_LOCATION) + + # Write out a CTest configuration file that sets some needed environment + # variables for the test scripts. + # + FILE(WRITE ${PROJECT_BINARY_DIR}/CTestCustom.ctest + "# This is a generated file. + SET(ENV{srcdir} ${PROJECT_SOURCE_DIR}) + SET(ENV{pcregrep} ${PCREGREP_EXE}) + SET(ENV{pcretest} ${PCRETEST_EXE}) + ") + + IF(UNIX) + ADD_TEST(pcre_test ${PROJECT_SOURCE_DIR}/RunTest) + ADD_TEST(pcre_grep_test ${PROJECT_SOURCE_DIR}/RunGrepTest) + ENDIF(UNIX) + IF(WIN32) + ADD_TEST(pcre_test cmd /C ${PROJECT_SOURCE_DIR}/RunTest.bat) + ENDIF(WIN32) + + GET_TARGET_PROPERTY(PCRECPP_UNITTEST_EXE + pcrecpp_unittest + DEBUG_LOCATION) + + GET_TARGET_PROPERTY(PCRE_SCANNER_UNITTEST_EXE + pcre_scanner_unittest + DEBUG_LOCATION) + + GET_TARGET_PROPERTY(PCRE_STRINGPIECE_UNITTEST_EXE + pcre_stringpiece_unittest + DEBUG_LOCATION) + + ADD_TEST(pcrecpp_test ${PCRECPP_UNITTEST_EXE}) + ADD_TEST(pcre_scanner_test ${PCRE_SCANNER_UNITTEST_EXE}) + ADD_TEST(pcre_stringpiece_test ${PCRE_STRINGPIECE_UNITTEST_EXE}) +ENDIF(PCRE_BUILD_TESTS) + +# Installation +SET(CMAKE_INSTALL_ALWAYS 1) + +INSTALL(TARGETS ${targets} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +INSTALL(FILES ${PCRE_HEADERS} ${PCREPOSIX_HEADERS} DESTINATION include) + +FILE(GLOB html ${PROJECT_SOURCE_DIR}/doc/html/*.html) +FILE(GLOB man1 ${PROJECT_SOURCE_DIR}/doc/*.1) +FILE(GLOB man3 ${PROJECT_SOURCE_DIR}/doc/*.3) + +IF(PCRE_BUILD_PCRECPP) + INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include) +ELSE(PCRE_BUILD_PCRECPP) + # Remove pcrecpp.3 + FOREACH(man ${man3}) + GET_FILENAME_COMPONENT(man_tmp ${man} NAME) + IF(NOT man_tmp STREQUAL "pcrecpp.3") + SET(man3_new ${man3} ${man}) + ENDIF(NOT man_tmp STREQUAL "pcrecpp.3") + ENDFOREACH(man ${man3}) + SET(man3 ${man3_new}) +ENDIF(PCRE_BUILD_PCRECPP) + + +INSTALL(FILES ${man1} DESTINATION man/man1) +INSTALL(FILES ${man3} DESTINATION man/man3) +INSTALL(FILES ${html} DESTINATION share/doc/pcre/html) + +# help, only for nice output +IF(BUILD_SHARED_LIBS) + SET(BUILD_STATIC_LIBS OFF) +ELSE(BUILD_SHARED_LIBS) + SET(BUILD_STATIC_LIBS ON) +ENDIF(BUILD_SHARED_LIBS) + +IF(PCRE_SHOW_REPORT) + STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype) + IF (CMAKE_C_FLAGS) + SET(cfsp " ") + ENDIF(CMAKE_C_FLAGS) + IF (CMAKE_CXX_FLAGS) + SET(cxxfsp " ") + ENDIF(CMAKE_CXX_FLAGS) + MESSAGE(STATUS "") + MESSAGE(STATUS "") + MESSAGE(STATUS "PCRE configuration summary:") + MESSAGE(STATUS "") + MESSAGE(STATUS " Install prefix .................. : ${CMAKE_INSTALL_PREFIX}") + MESSAGE(STATUS " C compiler ...................... : ${CMAKE_C_COMPILER}") + MESSAGE(STATUS " C++ compiler .................... : ${CMAKE_CXX_COMPILER}") + MESSAGE(STATUS " C compiler flags ................ : ${CMAKE_C_FLAGS}${cfsp}${CMAKE_C_FLAGS_${buildtype}}") + MESSAGE(STATUS " C++ compiler flags .............. : ${CMAKE_CXX_FLAGS}${cxxfsp}${CMAKE_CXX_FLAGS_${buildtype}}") + MESSAGE(STATUS "") + MESSAGE(STATUS " Build C++ library ............... : ${PCRE_BUILD_PCRECPP}") + MESSAGE(STATUS " Enable UTF-8 support ............ : ${PCRE_SUPPORT_UNICODE_PROPERTIES}") + MESSAGE(STATUS " Unicode properties .............. : ${PCRE_SUPPORT_UNICODE_PROPERTIES}") + MESSAGE(STATUS " Newline char/sequence ........... : ${PCRE_NEWLINE}") + MESSAGE(STATUS " \\R matches only ANYCRLF ......... : ${PCRE_SUPPORT_BSR_ANYCRLF}") + MESSAGE(STATUS " EBCDIC coding ................... : ${PCRE_EBCDIC}") + MESSAGE(STATUS " Rebuild char tables ............. : ${PCRE_REBUILD_CHARTABLES}") + MESSAGE(STATUS " No stack recursion .............. : ${PCRE_NO_RECURSE}") + MESSAGE(STATUS " POSIX mem threshold ............. : ${PCRE_POSIX_MALLOC_THRESHOLD}") + MESSAGE(STATUS " Internal link size .............. : ${PCRE_LINK_SIZE}") + MESSAGE(STATUS " Match limit ..................... : ${PCRE_MATCH_LIMIT}") + MESSAGE(STATUS " Match limit recursion ........... : ${PCRE_MATCH_LIMIT_RECURSION}") + MESSAGE(STATUS " Build shared libs ............... : ${BUILD_SHARED_LIBS}") + MESSAGE(STATUS " Build static libs ............... : ${BUILD_STATIC_LIBS}") + MESSAGE(STATUS " Build pcregrep .................. : ${PCRE_BUILD_PCREGREP}") + MESSAGE(STATUS " Build tests (implies pcretest) .. : ${PCRE_BUILD_TESTS}") + IF(ZLIB_FOUND) + MESSAGE(STATUS " Link pcregrep with libz ......... : ${PCRE_SUPPORT_LIBZ}") + ELSE(ZLIB_FOUND) + MESSAGE(STATUS " Link pcregrep with libz ......... : None" ) + ENDIF(ZLIB_FOUND) + IF(BZIP2_FOUND) + MESSAGE(STATUS " Link pcregrep with libbz2 ....... : ${PCRE_SUPPORT_LIBBZ2}") + ELSE(BZIP2_FOUND) + MESSAGE(STATUS " Link pcregrep with libbz2 ....... : None" ) + ENDIF(BZIP2_FOUND) + IF(NOT PCRE_SUPPORT_LIBREADLINE) + MESSAGE(STATUS " Link pcretest with libreadline .. : None" ) + ELSE(NOT PCRE_SUPPORT_LIBREADLINE) + MESSAGE(STATUS " Link pcretest with libreadline .. : ${PCRE_SUPPORT_LIBREADLINE}") + ENDIF(NOT PCRE_SUPPORT_LIBREADLINE) + IF(MINGW AND NOT PCRE_STATIC) + MESSAGE(STATUS " Non-standard dll names (prefix) . : ${NON_STANDARD_LIB_PREFIX}") + MESSAGE(STATUS " Non-standard dll names (suffix) . : ${NON_STANDARD_LIB_SUFFIX}") + ENDIF(MINGW AND NOT PCRE_STATIC) + MESSAGE(STATUS "") +ENDIF(PCRE_SHOW_REPORT) +# end CMakeLists.txt Modified: freeswitch/trunk/libs/pcre/COPYING ============================================================================== --- freeswitch/trunk/libs/pcre/COPYING (original) +++ freeswitch/trunk/libs/pcre/COPYING Mon Jun 8 18:51:30 2009 @@ -1,68 +1,5 @@ PCRE LICENCE ------------- -PCRE is a library of functions to support regular expressions whose syntax -and semantics are as close as possible to those of the Perl 5 language. - -Release 6 of PCRE is distributed under the terms of the "BSD" licence, as -specified below. The documentation for PCRE, supplied in the "doc" -directory, is distributed under the same terms as the software itself. - -The basic library functions are written in C and are freestanding. Also -included in the distribution is a set of C++ wrapper functions. - - -THE BASIC LIBRARY FUNCTIONS ---------------------------- - -Written by: Philip Hazel -Email local part: ph10 -Email domain: cam.ac.uk - -University of Cambridge Computing Service, -Cambridge, England. Phone: +44 1223 334714. - -Copyright (c) 1997-2006 University of Cambridge -All rights reserved. - - -THE C++ WRAPPER FUNCTIONS -------------------------- - -Contributed by: Google Inc. - -Copyright (c) 2006, Google Inc. -All rights reserved. - - -THE "BSD" LICENCE ------------------ - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of the University of Cambridge nor the name of Google - Inc. nor the names of their contributors may be used to endorse or - promote products derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. +Please see the file LICENCE in the PCRE distribution for licensing details. End Modified: freeswitch/trunk/libs/pcre/ChangeLog ============================================================================== --- freeswitch/trunk/libs/pcre/ChangeLog (original) +++ freeswitch/trunk/libs/pcre/ChangeLog Mon Jun 8 18:51:30 2009 @@ -1,6 +1,1235 @@ ChangeLog for PCRE ------------------ +Version 7.9 11-Apr-09 +--------------------- + +1. When building with support for bzlib/zlib (pcregrep) and/or readline + (pcretest), all targets were linked against these libraries. This included + libpcre, libpcreposix, and libpcrecpp, even though they do not use these + libraries. This caused unwanted dependencies to be created. This problem + has been fixed, and now only pcregrep is linked with bzlib/zlib and only + pcretest is linked with readline. + +2. The "typedef int BOOL" in pcre_internal.h that was included inside the + "#ifndef FALSE" condition by an earlier change (probably 7.8/18) has been + moved outside it again, because FALSE and TRUE are already defined in AIX, + but BOOL is not. + +3. The pcre_config() function was treating the PCRE_MATCH_LIMIT and + PCRE_MATCH_LIMIT_RECURSION values as ints, when they should be long ints. + +4. The pcregrep documentation said spaces were inserted as well as colons (or + hyphens) following file names and line numbers when outputting matching + lines. This is not true; no spaces are inserted. I have also clarified the + wording for the --colour (or --color) option. + +5. In pcregrep, when --colour was used with -o, the list of matching strings + was not coloured; this is different to GNU grep, so I have changed it to be + the same. + +6. When --colo(u)r was used in pcregrep, only the first matching substring in + each matching line was coloured. Now it goes on to look for further matches + of any of the test patterns, which is the same behaviour as GNU grep. + +7. A pattern that could match an empty string could cause pcregrep to loop; it + doesn't make sense to accept an empty string match in pcregrep, so I have + locked it out (using PCRE's PCRE_NOTEMPTY option). By experiment, this + seems to be how GNU grep behaves. + +8. The pattern (?(?=.*b)b|^) was incorrectly compiled as "match must be at + start or after a newline", because the conditional assertion was not being + correctly handled. The rule now is that both the assertion and what follows + in the first alternative must satisfy the test. + +9. If auto-callout was enabled in a pattern with a conditional group whose + condition was an assertion, PCRE could crash during matching, both with + pcre_exec() and pcre_dfa_exec(). + +10. The PCRE_DOLLAR_ENDONLY option was not working when pcre_dfa_exec() was + used for matching. + +11. Unicode property support in character classes was not working for + characters (bytes) greater than 127 when not in UTF-8 mode. + +12. Added the -M command line option to pcretest. + +14. Added the non-standard REG_NOTEMPTY option to the POSIX interface. + +15. Added the PCRE_NO_START_OPTIMIZE match-time option. + +16. Added comments and documentation about mis-use of no_arg in the C++ + wrapper. + +17. Implemented support for UTF-8 encoding in EBCDIC environments, a patch + from Martin Jerabek that uses macro names for all relevant character and + string constants. + +18. Added to pcre_internal.h two configuration checks: (a) If both EBCDIC and + SUPPORT_UTF8 are set, give an error; (b) If SUPPORT_UCP is set without + SUPPORT_UTF8, define SUPPORT_UTF8. The "configure" script handles both of + these, but not everybody uses configure. + +19. A conditional group that had only one branch was not being correctly + recognized as an item that could match an empty string. This meant that an + enclosing group might also not be so recognized, causing infinite looping + (and probably a segfault) for patterns such as ^"((?(?=[a])[^"])|b)*"$ + with the subject "ab", where knowledge that the repeated group can match + nothing is needed in order to break the loop. + +20. If a pattern that was compiled with callouts was matched using pcre_dfa_ + exec(), but without supplying a callout function, matching went wrong. + +21. If PCRE_ERROR_MATCHLIMIT occurred during a recursion, there was a memory + leak if the size of the offset vector was greater than 30. When the vector + is smaller, the saved offsets during recursion go onto a local stack + vector, but for larger vectors malloc() is used. It was failing to free + when the recursion yielded PCRE_ERROR_MATCH_LIMIT (or any other "abnormal" + error, in fact). + +22. There was a missing #ifdef SUPPORT_UTF8 round one of the variables in the + heapframe that is used only when UTF-8 support is enabled. This caused no + problem, but was untidy. + +23. Steven Van Ingelgem's patch to CMakeLists.txt to change the name + CMAKE_BINARY_DIR to PROJECT_BINARY_DIR so that it works when PCRE is + included within another project. + +24. Steven Van Ingelgem's patches to add more options to the CMake support, + slightly modified by me: + + (a) PCRE_BUILD_TESTS can be set OFF not to build the tests, including + not building pcregrep. + + (b) PCRE_BUILD_PCREGREP can be see OFF not to build pcregrep, but only + if PCRE_BUILD_TESTS is also set OFF, because the tests use pcregrep. + +25. Forward references, both numeric and by name, in patterns that made use of + duplicate group numbers, could behave incorrectly or give incorrect errors, + because when scanning forward to find the reference group, PCRE was not + taking into account the duplicate group numbers. A pattern such as + ^X(?3)(a)(?|(b)|(q))(Y) is an example. + +26. Changed a few more instances of "const unsigned char *" to USPTR, making + the feature of a custom pointer more persuasive (as requested by a user). + +27. Wrapped the definitions of fileno and isatty for Windows, which appear in + pcretest.c, inside #ifndefs, because it seems they are sometimes already + pre-defined. + +28. Added support for (*UTF8) at the start of a pattern. + +29. Arrange for flags added by the "release type" setting in CMake to be shown + in the configuration summary. + + +Version 7.8 05-Sep-08 +--------------------- + +1. Replaced UCP searching code with optimized version as implemented for Ad + Muncher (http://www.admuncher.com/) by Peter Kankowski. This uses a two- + stage table and inline lookup instead of a function, giving speed ups of 2 + to 5 times on some simple patterns that I tested. Permission was given to + distribute the MultiStage2.py script that generates the tables (it's not in + the tarball, but is in the Subversion repository). + +2. Updated the Unicode datatables to Unicode 5.1.0. This adds yet more + scripts. + +3. Change 12 for 7.7 introduced a bug in pcre_study() when a pattern contained + a group with a zero qualifier. The result of the study could be incorrect, + or the function might crash, depending on the pattern. + +4. Caseless matching was not working for non-ASCII characters in back + references. For example, /(\x{de})\1/8i was not matching \x{de}\x{fe}. + It now works when Unicode Property Support is available. + +5. In pcretest, an escape such as \x{de} in the data was always generating + a UTF-8 string, even in non-UTF-8 mode. Now it generates a single byte in + non-UTF-8 mode. If the value is greater than 255, it gives a warning about + truncation. + +6. Minor bugfix in pcrecpp.cc (change "" == ... to NULL == ...). + +7. Added two (int) casts to pcregrep when printing the difference of two + pointers, in case they are 64-bit values. + +8. Added comments about Mac OS X stack usage to the pcrestack man page and to + test 2 if it fails. + +9. Added PCRE_CALL_CONVENTION just before the names of all exported functions, + and a #define of that name to empty if it is not externally set. This is to + allow users of MSVC to set it if necessary. + +10. The PCRE_EXP_DEFN macro which precedes exported functions was missing from + the convenience functions in the pcre_get.c source file. + +11. An option change at the start of a pattern that had top-level alternatives + could cause overwriting and/or a crash. This command provoked a crash in + some environments: + + printf "/(?i)[\xc3\xa9\xc3\xbd]|[\xc3\xa9\xc3\xbdA]/8\n" | pcretest + + This potential security problem was recorded as CVE-2008-2371. + +12. For a pattern where the match had to start at the beginning or immediately + after a newline (e.g /.*anything/ without the DOTALL flag), pcre_exec() and + pcre_dfa_exec() could read past the end of the passed subject if there was + no match. To help with detecting such bugs (e.g. with valgrind), I modified + pcretest so that it places the subject at the end of its malloc-ed buffer. + +13. The change to pcretest in 12 above threw up a couple more cases when pcre_ + exec() might read past the end of the data buffer in UTF-8 mode. + +14. A similar bug to 7.3/2 existed when the PCRE_FIRSTLINE option was set and + the data contained the byte 0x85 as part of a UTF-8 character within its + first line. This applied both to normal and DFA matching. + +15. Lazy qualifiers were not working in some cases in UTF-8 mode. For example, + /^[^d]*?$/8 failed to match "abc". + +16. Added a missing copyright notice to pcrecpp_internal.h. + +17. Make it more clear in the documentation that values returned from + pcre_exec() in ovector are byte offsets, not character counts. + +18. Tidied a few places to stop certain compilers from issuing warnings. + +19. Updated the Virtual Pascal + BCC files to compile the latest v7.7, as + supplied by Stefan Weber. I made a further small update for 7.8 because + there is a change of source arrangements: the pcre_searchfuncs.c module is + replaced by pcre_ucd.c. + + +Version 7.7 07-May-08 +--------------------- + +1. Applied Craig's patch to sort out a long long problem: "If we can't convert + a string to a long long, pretend we don't even have a long long." This is + done by checking for the strtoq, strtoll, and _strtoi64 functions. + +2. Applied Craig's patch to pcrecpp.cc to restore ABI compatibility with + pre-7.6 versions, which defined a global no_arg variable instead of putting + it in the RE class. (See also #8 below.) + +3. Remove a line of dead code, identified by coverity and reported by Nuno + Lopes. + +4. Fixed two related pcregrep bugs involving -r with --include or --exclude: + + (1) The include/exclude patterns were being applied to the whole pathnames + of files, instead of just to the final components. + + (2) If there was more than one level of directory, the subdirectories were + skipped unless they satisfied the include/exclude conditions. This is + inconsistent with GNU grep (and could even be seen as contrary to the + pcregrep specification - which I improved to make it absolutely clear). + The action now is always to scan all levels of directory, and just + apply the include/exclude patterns to regular files. + +5. Added the --include_dir and --exclude_dir patterns to pcregrep, and used + --exclude_dir in the tests to avoid scanning .svn directories. + +6. Applied Craig's patch to the QuoteMeta function so that it escapes the + NUL character as backslash + 0 rather than backslash + NUL, because PCRE + doesn't support NULs in patterns. + +7. Added some missing "const"s to declarations of static tables in + pcre_compile.c and pcre_dfa_exec.c. + +8. Applied Craig's patch to pcrecpp.cc to fix a problem in OS X that was + caused by fix #2 above. (Subsequently also a second patch to fix the + first patch. And a third patch - this was a messy problem.) + +9. Applied Craig's patch to remove the use of push_back(). + +10. Applied Alan Lehotsky's patch to add REG_STARTEND support to the POSIX + matching function regexec(). + +11. Added support for the Oniguruma syntax \g, \g, \g'name', \g'n', + which, however, unlike Perl's \g{...}, are subroutine calls, not back + references. PCRE supports relative numbers with this syntax (I don't think + Oniguruma does). + +12. Previously, a group with a zero repeat such as (...){0} was completely + omitted from the compiled regex. However, this means that if the group + was called as a subroutine from elsewhere in the pattern, things went wrong + (an internal error was given). Such groups are now left in the compiled + pattern, with a new opcode that causes them to be skipped at execution + time. + +13. Added the PCRE_JAVASCRIPT_COMPAT option. This makes the following changes + to the way PCRE behaves: + + (a) A lone ] character is dis-allowed (Perl treats it as data). + + (b) A back reference to an unmatched subpattern matches an empty string + (Perl fails the current match path). + + (c) A data ] in a character class must be notated as \] because if the + first data character in a class is ], it defines an empty class. (In + Perl it is not possible to have an empty class.) The empty class [] + never matches; it forces failure and is equivalent to (*FAIL) or (?!). + The negative empty class [^] matches any one character, independently + of the DOTALL setting. + +14. A pattern such as /(?2)[]a()b](abc)/ which had a forward reference to a + non-existent subpattern following a character class starting with ']' and + containing () gave an internal compiling error instead of "reference to + non-existent subpattern". Fortunately, when the pattern did exist, the + compiled code was correct. (When scanning forwards to check for the + existencd of the subpattern, it was treating the data ']' as terminating + the class, so got the count wrong. When actually compiling, the reference + was subsequently set up correctly.) + +15. The "always fail" assertion (?!) is optimzed to (*FAIL) by pcre_compile; + it was being rejected as not supported by pcre_dfa_exec(), even though + other assertions are supported. I have made pcre_dfa_exec() support + (*FAIL). + +16. The implementation of 13c above involved the invention of a new opcode, + OP_ALLANY, which is like OP_ANY but doesn't check the /s flag. Since /s + cannot be changed at match time, I realized I could make a small + improvement to matching performance by compiling OP_ALLANY instead of + OP_ANY for "." when DOTALL was set, and then removing the runtime tests + on the OP_ANY path. + +17. Compiling pcretest on Windows with readline support failed without the + following two fixes: (1) Make the unistd.h include conditional on + HAVE_UNISTD_H; (2) #define isatty and fileno as _isatty and _fileno. + +18. Changed CMakeLists.txt and cmake/FindReadline.cmake to arrange for the + ncurses library to be included for pcretest when ReadLine support is + requested, but also to allow for it to be overridden. This patch came from + Daniel Bergstr?m. + +19. There was a typo in the file ucpinternal.h where f0_rangeflag was defined + as 0x00f00000 instead of 0x00800000. Luckily, this would not have caused + any errors with the current Unicode tables. Thanks to Peter Kankowski for + spotting this. + + +Version 7.6 28-Jan-08 +--------------------- + +1. A character class containing a very large number of characters with + codepoints greater than 255 (in UTF-8 mode, of course) caused a buffer + overflow. + +2. Patch to cut out the "long long" test in pcrecpp_unittest when + HAVE_LONG_LONG is not defined. + +3. Applied Christian Ehrlicher's patch to update the CMake build files to + bring them up to date and include new features. This patch includes: + + - Fixed PH's badly added libz and libbz2 support. + - Fixed a problem with static linking. + - Added pcredemo. [But later removed - see 7 below.] + - Fixed dftables problem and added an option. + - Added a number of HAVE_XXX tests, including HAVE_WINDOWS_H and + HAVE_LONG_LONG. + - Added readline support for pcretest. + - Added an listing of the option settings after cmake has run. + +4. A user submitted a patch to Makefile that makes it easy to create + "pcre.dll" under mingw when using Configure/Make. I added stuff to + Makefile.am that cause it to include this special target, without + affecting anything else. Note that the same mingw target plus all + the other distribution libraries and programs are now supported + when configuring with CMake (see 6 below) instead of with + Configure/Make. + +5. Applied Craig's patch that moves no_arg into the RE class in the C++ code. + This is an attempt to solve the reported problem "pcrecpp::no_arg is not + exported in the Windows port". It has not yet been confirmed that the patch + solves the problem, but it does no harm. + +6. Applied Sheri's patch to CMakeLists.txt to add NON_STANDARD_LIB_PREFIX and + NON_STANDARD_LIB_SUFFIX for dll names built with mingw when configured + with CMake, and also correct the comment about stack recursion. + +7. Remove the automatic building of pcredemo from the ./configure system and + from CMakeLists.txt. The whole idea of pcredemo.c is that it is an example + of a program that users should build themselves after PCRE is installed, so + building it automatically is not really right. What is more, it gave + trouble in some build environments. + +8. Further tidies to CMakeLists.txt from Sheri and Christian. + + +Version 7.5 10-Jan-08 +--------------------- + +1. Applied a patch from Craig: "This patch makes it possible to 'ignore' + values in parens when parsing an RE using the C++ wrapper." + +2. Negative specials like \S did not work in character classes in UTF-8 mode. + Characters greater than 255 were excluded from the class instead of being + included. + +3. The same bug as (2) above applied to negated POSIX classes such as + [:^space:]. + +4. PCRECPP_STATIC was referenced in pcrecpp_internal.h, but nowhere was it + defined or documented. It seems to have been a typo for PCRE_STATIC, so + I have changed it. + +5. The construct (?&) was not diagnosed as a syntax error (it referenced the + first named subpattern) and a construct such as (?&a) would reference the + first named subpattern whose name started with "a" (in other words, the + length check was missing). Both these problems are fixed. "Subpattern name + expected" is now given for (?&) (a zero-length name), and this patch also + makes it give the same error for \k'' (previously it complained that that + was a reference to a non-existent subpattern). + +6. The erroneous patterns (?+-a) and (?-+a) give different error messages; + this is right because (?- can be followed by option settings as well as by + digits. I have, however, made the messages clearer. + +7. Patterns such as (?(1)a|b) (a pattern that contains fewer subpatterns + than the number used in the conditional) now cause a compile-time error. + This is actually not compatible with Perl, which accepts such patterns, but + treats the conditional as always being FALSE (as PCRE used to), but it + seems to me that giving a diagnostic is better. + +8. Change "alphameric" to the more common word "alphanumeric" in comments + and messages. + +9. Fix two occurrences of "backslash" in comments that should have been + "backspace". + +10. Remove two redundant lines of code that can never be obeyed (their function + was moved elsewhere). + +11. The program that makes PCRE's Unicode character property table had a bug + which caused it to generate incorrect table entries for sequences of + characters that have the same character type, but are in different scripts. + It amalgamated them into a single range, with the script of the first of + them. In other words, some characters were in the wrong script. There were + thirteen such cases, affecting characters in the following ranges: + + U+002b0 - U+002c1 + U+0060c - U+0060d + U+0061e - U+00612 + U+0064b - U+0065e + U+0074d - U+0076d + U+01800 - U+01805 + U+01d00 - U+01d77 + U+01d9b - U+01dbf + U+0200b - U+0200f + U+030fc - U+030fe + U+03260 - U+0327f + U+0fb46 - U+0fbb1 + U+10450 - U+1049d + +12. The -o option (show only the matching part of a line) for pcregrep was not + compatible with GNU grep in that, if there was more than one match in a + line, it showed only the first of them. It now behaves in the same way as + GNU grep. + +13. If the -o and -v options were combined for pcregrep, it printed a blank + line for every non-matching line. GNU grep prints nothing, and pcregrep now + does the same. The return code can be used to tell if there were any + non-matching lines. + +14. Added --file-offsets and --line-offsets to pcregrep. + +15. The pattern (?=something)(?R) was not being diagnosed as a potentially + infinitely looping recursion. The bug was that positive lookaheads were not + being skipped when checking for a possible empty match (negative lookaheads + and both kinds of lookbehind were skipped). + +16. Fixed two typos in the Windows-only code in pcregrep.c, and moved the + inclusion of to before rather than after the definition of + INVALID_FILE_ATTRIBUTES (patch from David Byron). + +17. Specifying a possessive quantifier with a specific limit for a Unicode + character property caused pcre_compile() to compile bad code, which led at + runtime to PCRE_ERROR_INTERNAL (-14). Examples of patterns that caused this + are: /\p{Zl}{2,3}+/8 and /\p{Cc}{2}+/8. It was the possessive "+" that + caused the error; without that there was no problem. + +18. Added --enable-pcregrep-libz and --enable-pcregrep-libbz2. + +19. Added --enable-pcretest-libreadline. + +20. In pcrecpp.cc, the variable 'count' was incremented twice in + RE::GlobalReplace(). As a result, the number of replacements returned was + double what it should be. I removed one of the increments, but Craig sent a + later patch that removed the other one (the right fix) and added unit tests + that check the return values (which was not done before). + +21. Several CMake things: + + (1) Arranged that, when cmake is used on Unix, the libraries end up with + the names libpcre and libpcreposix, not just pcre and pcreposix. + + (2) The above change means that pcretest and pcregrep are now correctly + linked with the newly-built libraries, not previously installed ones. + + (3) Added PCRE_SUPPORT_LIBREADLINE, PCRE_SUPPORT_LIBZ, PCRE_SUPPORT_LIBBZ2. + +22. In UTF-8 mode, with newline set to "any", a pattern such as .*a.*=.b.* + crashed when matching a string such as a\x{2029}b (note that \x{2029} is a + UTF-8 newline character). The key issue is that the pattern starts .*; + this means that the match must be either at the beginning, or after a + newline. The bug was in the code for advancing after a failed match and + checking that the new position followed a newline. It was not taking + account of UTF-8 characters correctly. + +23. PCRE was behaving differently from Perl in the way it recognized POSIX + character classes. PCRE was not treating the sequence [:...:] as a + character class unless the ... were all letters. Perl, however, seems to + allow any characters between [: and :], though of course it rejects as + unknown any "names" that contain non-letters, because all the known class + names consist only of letters. Thus, Perl gives an error for [[:1234:]], + for example, whereas PCRE did not - it did not recognize a POSIX character + class. This seemed a bit dangerous, so the code has been changed to be + closer to Perl. The behaviour is not identical to Perl, because PCRE will + diagnose an unknown class for, for example, [[:l\ower:]] where Perl will + treat it as [[:lower:]]. However, PCRE does now give "unknown" errors where + Perl does, and where it didn't before. + +24. Rewrite so as to remove the single use of %n from pcregrep because in some + Windows environments %n is disabled by default. + + +Version 7.4 21-Sep-07 +--------------------- + +1. Change 7.3/28 was implemented for classes by looking at the bitmap. This + means that a class such as [\s] counted as "explicit reference to CR or + LF". That isn't really right - the whole point of the change was to try to + help when there was an actual mention of one of the two characters. So now + the change happens only if \r or \n (or a literal CR or LF) character is + encountered. + +2. The 32-bit options word was also used for 6 internal flags, but the numbers + of both had grown to the point where there were only 3 bits left. + Fortunately, there was spare space in the data structure, and so I have + moved the internal flags into a new 16-bit field to free up more option + bits. + +3. The appearance of (?J) at the start of a pattern set the DUPNAMES option, + but did not set the internal JCHANGED flag - either of these is enough to + control the way the "get" function works - but the PCRE_INFO_JCHANGED + facility is supposed to tell if (?J) was ever used, so now (?J) at the + start sets both bits. + +4. Added options (at build time, compile time, exec time) to change \R from + matching any Unicode line ending sequence to just matching CR, LF, or CRLF. + +5. doc/pcresyntax.html was missing from the distribution. + +6. Put back the definition of PCRE_ERROR_NULLWSLIMIT, for backward + compatibility, even though it is no longer used. + +7. Added macro for snprintf to pcrecpp_unittest.cc and also for strtoll and + strtoull to pcrecpp.cc to select the available functions in WIN32 when the + windows.h file is present (where different names are used). [This was + reversed later after testing - see 16 below.] + +8. Changed all #include to #include "config.h". There were also + some further cases that I changed to "pcre.h". + +9. When pcregrep was used with the --colour option, it missed the line ending + sequence off the lines that it output. + +10. It was pointed out to me that arrays of string pointers cause lots of + relocations when a shared library is dynamically loaded. A technique of + using a single long string with a table of offsets can drastically reduce + these. I have refactored PCRE in four places to do this. The result is + dramatic: + + Originally: 290 + After changing UCP table: 187 + After changing error message table: 43 + After changing table of "verbs" 36 + After changing table of Posix names 22 + + Thanks to the folks working on Gregex for glib for this insight. + +11. --disable-stack-for-recursion caused compiling to fail unless -enable- + unicode-properties was also set. + +12. Updated the tests so that they work when \R is defaulted to ANYCRLF. + +13. Added checks for ANY and ANYCRLF to pcrecpp.cc where it previously + checked only for CRLF. + +14. Added casts to pcretest.c to avoid compiler warnings. + +15. Added Craig's patch to various pcrecpp modules to avoid compiler warnings. + +16. Added Craig's patch to remove the WINDOWS_H tests, that were not working, + and instead check for _strtoi64 explicitly, and avoid the use of snprintf() + entirely. This removes changes made in 7 above. + +17. The CMake files have been updated, and there is now more information about + building with CMake in the NON-UNIX-USE document. + + +Version 7.3 28-Aug-07 +--------------------- + + 1. In the rejigging of the build system that eventually resulted in 7.1, the + line "#include " was included in pcre_internal.h. The use of angle + brackets there is not right, since it causes compilers to look for an + installed pcre.h, not the version that is in the source that is being + compiled (which of course may be different). I have changed it back to: + + #include "pcre.h" + + I have a vague recollection that the change was concerned with compiling in + different directories, but in the new build system, that is taken care of + by the VPATH setting the Makefile. + + 2. The pattern .*$ when run in not-DOTALL UTF-8 mode with newline=any failed + when the subject happened to end in the byte 0x85 (e.g. if the last + character was \x{1ec5}). *Character* 0x85 is one of the "any" newline + characters but of course it shouldn't be taken as a newline when it is part + of another character. The bug was that, for an unlimited repeat of . in + not-DOTALL UTF-8 mode, PCRE was advancing by bytes rather than by + characters when looking for a newline. + + 3. A small performance improvement in the DOTALL UTF-8 mode .* case. + + 4. Debugging: adjusted the names of opcodes for different kinds of parentheses + in debug output. + + 5. Arrange to use "%I64d" instead of "%lld" and "%I64u" instead of "%llu" for + long printing in the pcrecpp unittest when running under MinGW. + + 6. ESC_K was left out of the EBCDIC table. + + 7. Change 7.0/38 introduced a new limit on the number of nested non-capturing + parentheses; I made it 1000, which seemed large enough. Unfortunately, the + limit also applies to "virtual nesting" when a pattern is recursive, and in + this case 1000 isn't so big. I have been able to remove this limit at the + expense of backing off one optimization in certain circumstances. Normally, + when pcre_exec() would call its internal match() function recursively and + immediately return the result unconditionally, it uses a "tail recursion" + feature to save stack. However, when a subpattern that can match an empty + string has an unlimited repetition quantifier, it no longer makes this + optimization. That gives it a stack frame in which to save the data for + checking that an empty string has been matched. Previously this was taken + from the 1000-entry workspace that had been reserved. So now there is no + explicit limit, but more stack is used. + + 8. Applied Daniel's patches to solve problems with the import/export magic + syntax that is required for Windows, and which was going wrong for the + pcreposix and pcrecpp parts of the library. These were overlooked when this + problem was solved for the main library. + + 9. There were some crude static tests to avoid integer overflow when computing + the size of patterns that contain repeated groups with explicit upper + limits. As the maximum quantifier is 65535, the maximum group length was + set at 30,000 so that the product of these two numbers did not overflow a + 32-bit integer. However, it turns out that people want to use groups that + are longer than 30,000 bytes (though not repeat them that many times). + Change 7.0/17 (the refactoring of the way the pattern size is computed) has + made it possible to implement the integer overflow checks in a much more + dynamic way, which I have now done. The artificial limitation on group + length has been removed - we now have only the limit on the total length of + the compiled pattern, which depends on the LINK_SIZE setting. + +10. Fixed a bug in the documentation for get/copy named substring when + duplicate names are permitted. If none of the named substrings are set, the + functions return PCRE_ERROR_NOSUBSTRING (7); the doc said they returned an + empty string. + +11. Because Perl interprets \Q...\E at a high level, and ignores orphan \E + instances, patterns such as [\Q\E] or [\E] or even [^\E] cause an error, + because the ] is interpreted as the first data character and the + terminating ] is not found. PCRE has been made compatible with Perl in this + regard. Previously, it interpreted [\Q\E] as an empty class, and [\E] could + cause memory overwriting. + +10. Like Perl, PCRE automatically breaks an unlimited repeat after an empty + string has been matched (to stop an infinite loop). It was not recognizing + a conditional subpattern that could match an empty string if that + subpattern was within another subpattern. For example, it looped when + trying to match (((?(1)X|))*) but it was OK with ((?(1)X|)*) where the + condition was not nested. This bug has been fixed. + +12. A pattern like \X?\d or \P{L}?\d in non-UTF-8 mode could cause a backtrack + past the start of the subject in the presence of bytes with the top bit + set, for example "\x8aBCD". + +13. Added Perl 5.10 experimental backtracking controls (*FAIL), (*F), (*PRUNE), + (*SKIP), (*THEN), (*COMMIT), and (*ACCEPT). + +14. Optimized (?!) to (*FAIL). + +15. Updated the test for a valid UTF-8 string to conform to the later RFC 3629. + This restricts code points to be within the range 0 to 0x10FFFF, excluding + the "low surrogate" sequence 0xD800 to 0xDFFF. Previously, PCRE allowed the + full range 0 to 0x7FFFFFFF, as defined by RFC 2279. Internally, it still + does: it's just the validity check that is more restrictive. + +16. Inserted checks for integer overflows during escape sequence (backslash) + processing, and also fixed erroneous offset values for syntax errors during + backslash processing. + +17. Fixed another case of looking too far back in non-UTF-8 mode (cf 12 above) + for patterns like [\PPP\x8a]{1,}\x80 with the subject "A\x80". + +18. An unterminated class in a pattern like (?1)\c[ with a "forward reference" + caused an overrun. + +19. A pattern like (?:[\PPa*]*){8,} which had an "extended class" (one with + something other than just ASCII characters) inside a group that had an + unlimited repeat caused a loop at compile time (while checking to see + whether the group could match an empty string). + +20. Debugging a pattern containing \p or \P could cause a crash. For example, + [\P{Any}] did so. (Error in the code for printing property names.) + +21. An orphan \E inside a character class could cause a crash. + +22. A repeated capturing bracket such as (A)? could cause a wild memory + reference during compilation. + +23. There are several functions in pcre_compile() that scan along a compiled + expression for various reasons (e.g. to see if it's fixed length for look + behind). There were bugs in these functions when a repeated \p or \P was + present in the pattern. These operators have additional parameters compared + with \d, etc, and these were not being taken into account when moving along + the compiled data. Specifically: + + (a) A item such as \p{Yi}{3} in a lookbehind was not treated as fixed + length. + + (b) An item such as \pL+ within a repeated group could cause crashes or + loops. + + (c) A pattern such as \p{Yi}+(\P{Yi}+)(?1) could give an incorrect + "reference to non-existent subpattern" error. + + (d) A pattern like (\P{Yi}{2}\277)? could loop at compile time. + +24. A repeated \S or \W in UTF-8 mode could give wrong answers when multibyte + characters were involved (for example /\S{2}/8g with "A\x{a3}BC"). + +25. Using pcregrep in multiline, inverted mode (-Mv) caused it to loop. + +26. Patterns such as [\P{Yi}A] which include \p or \P and just one other + character were causing crashes (broken optimization). + +27. Patterns such as (\P{Yi}*\277)* (group with possible zero repeat containing + \p or \P) caused a compile-time loop. + +28. More problems have arisen in unanchored patterns when CRLF is a valid line + break. For example, the unstudied pattern [\r\n]A does not match the string + "\r\nA" because change 7.0/46 below moves the current point on by two + characters after failing to match at the start. However, the pattern \nA + *does* match, because it doesn't start till \n, and if [\r\n]A is studied, + the same is true. There doesn't seem any very clean way out of this, but + what I have chosen to do makes the common cases work: PCRE now takes note + of whether there can be an explicit match for \r or \n anywhere in the + pattern, and if so, 7.0/46 no longer applies. As part of this change, + there's a new PCRE_INFO_HASCRORLF option for finding out whether a compiled + pattern has explicit CR or LF references. + +29. Added (*CR) etc for changing newline setting at start of pattern. + + +Version 7.2 19-Jun-07 +--------------------- + + 1. If the fr_FR locale cannot be found for test 3, try the "french" locale, + which is apparently normally available under Windows. + + 2. Re-jig the pcregrep tests with different newline settings in an attempt + to make them independent of the local environment's newline setting. + + 3. Add code to configure.ac to remove -g from the CFLAGS default settings. + + 4. Some of the "internals" tests were previously cut out when the link size + was not 2, because the output contained actual offsets. The recent new + "Z" feature of pcretest means that these can be cut out, making the tests + usable with all link sizes. + + 5. Implemented Stan Switzer's goto replacement for longjmp() when not using + stack recursion. This gives a massive performance boost under BSD, but just + a small improvement under Linux. However, it saves one field in the frame + in all cases. + + 6. Added more features from the forthcoming Perl 5.10: + + (a) (?-n) (where n is a string of digits) is a relative subroutine or + recursion call. It refers to the nth most recently opened parentheses. + + (b) (?+n) is also a relative subroutine call; it refers to the nth next + to be opened parentheses. + + (c) Conditions that refer to capturing parentheses can be specified + relatively, for example, (?(-2)... or (?(+3)... + + (d) \K resets the start of the current match so that everything before + is not part of it. + + (e) \k{name} is synonymous with \k and \k'name' (.NET compatible). + + (f) \g{name} is another synonym - part of Perl 5.10's unification of + reference syntax. + + (g) (?| introduces a group in which the numbering of parentheses in each + alternative starts with the same number. + + (h) \h, \H, \v, and \V match horizontal and vertical whitespace. + + 7. Added two new calls to pcre_fullinfo(): PCRE_INFO_OKPARTIAL and + PCRE_INFO_JCHANGED. + + 8. A pattern such as (.*(.)?)* caused pcre_exec() to fail by either not + terminating or by crashing. Diagnosed by Viktor Griph; it was in the code + for detecting groups that can match an empty string. + + 9. A pattern with a very large number of alternatives (more than several + hundred) was running out of internal workspace during the pre-compile + phase, where pcre_compile() figures out how much memory will be needed. A + bit of new cunning has reduced the workspace needed for groups with + alternatives. The 1000-alternative test pattern now uses 12 bytes of + workspace instead of running out of the 4096 that are available. + +10. Inserted some missing (unsigned int) casts to get rid of compiler warnings. + +11. Applied patch from Google to remove an optimization that didn't quite work. + The report of the bug said: + + pcrecpp::RE("a*").FullMatch("aaa") matches, while + pcrecpp::RE("a*?").FullMatch("aaa") does not, and + pcrecpp::RE("a*?\\z").FullMatch("aaa") does again. + +12. If \p or \P was used in non-UTF-8 mode on a character greater than 127 + it matched the wrong number of bytes. + + +Version 7.1 24-Apr-07 +--------------------- + + 1. Applied Bob Rossi and Daniel G's patches to convert the build system to one + that is more "standard", making use of automake and other Autotools. There + is some re-arrangement of the files and adjustment of comments consequent + on this. + + 2. Part of the patch fixed a problem with the pcregrep tests. The test of -r + for recursive directory scanning broke on some systems because the files + are not scanned in any specific order and on different systems the order + was different. A call to "sort" has been inserted into RunGrepTest for the + approprate test as a short-term fix. In the longer term there may be an + alternative. + + 3. I had an email from Eric Raymond about problems translating some of PCRE's + man pages to HTML (despite the fact that I distribute HTML pages, some + people do their own conversions for various reasons). The problems + concerned the use of low-level troff macros .br and .in. I have therefore + removed all such uses from the man pages (some were redundant, some could + be replaced by .nf/.fi pairs). The 132html script that I use to generate + HTML has been updated to handle .nf/.fi and to complain if it encounters + .br or .in. + + 4. Updated comments in configure.ac that get placed in config.h.in and also + arranged for config.h to be included in the distribution, with the name + config.h.generic, for the benefit of those who have to compile without + Autotools (compare pcre.h, which is now distributed as pcre.h.generic). + + 5. Updated the support (such as it is) for Virtual Pascal, thanks to Stefan + Weber: (1) pcre_internal.h was missing some function renames; (2) updated + makevp.bat for the current PCRE, using the additional files + makevp_c.txt, makevp_l.txt, and pcregexp.pas. + + 6. A Windows user reported a minor discrepancy with test 2, which turned out + to be caused by a trailing space on an input line that had got lost in his + copy. The trailing space was an accident, so I've just removed it. + + 7. Add -Wl,-R... flags in pcre-config.in for *BSD* systems, as I'm told + that is needed. + + 8. Mark ucp_table (in ucptable.h) and ucp_gentype (in pcre_ucp_searchfuncs.c) + as "const" (a) because they are and (b) because it helps the PHP + maintainers who have recently made a script to detect big data structures + in the php code that should be moved to the .rodata section. I remembered + to update Builducptable as well, so it won't revert if ucptable.h is ever + re-created. + + 9. Added some extra #ifdef SUPPORT_UTF8 conditionals into pcretest.c, + pcre_printint.src, pcre_compile.c, pcre_study.c, and pcre_tables.c, in + order to be able to cut out the UTF-8 tables in the latter when UTF-8 + support is not required. This saves 1.5-2K of code, which is important in + some applications. + + Later: more #ifdefs are needed in pcre_ord2utf8.c and pcre_valid_utf8.c + so as not to refer to the tables, even though these functions will never be + called when UTF-8 support is disabled. Otherwise there are problems with a + shared library. + +10. Fixed two bugs in the emulated memmove() function in pcre_internal.h: + + (a) It was defining its arguments as char * instead of void *. + + (b) It was assuming that all moves were upwards in memory; this was true + a long time ago when I wrote it, but is no longer the case. + + The emulated memove() is provided for those environments that have neither + memmove() nor bcopy(). I didn't think anyone used it these days, but that + is clearly not the case, as these two bugs were recently reported. + +11. The script PrepareRelease is now distributed: it calls 132html, CleanTxt, + and Detrail to create the HTML documentation, the .txt form of the man + pages, and it removes trailing spaces from listed files. It also creates + pcre.h.generic and config.h.generic from pcre.h and config.h. In the latter + case, it wraps all the #defines with #ifndefs. This script should be run + before "make dist". + +12. Fixed two fairly obscure bugs concerned with quantified caseless matching + with Unicode property support. + + (a) For a maximizing quantifier, if the two different cases of the + character were of different lengths in their UTF-8 codings (there are + some cases like this - I found 11), and the matching function had to + back up over a mixture of the two cases, it incorrectly assumed they + were both the same length. + + (b) When PCRE was configured to use the heap rather than the stack for + recursion during matching, it was not correctly preserving the data for + the other case of a UTF-8 character when checking ahead for a match + while processing a minimizing repeat. If the check also involved + matching a wide character, but failed, corruption could cause an + erroneous result when trying to check for a repeat of the original + character. + +13. Some tidying changes to the testing mechanism: + + (a) The RunTest script now detects the internal link size and whether there + is UTF-8 and UCP support by running ./pcretest -C instead of relying on + values substituted by "configure". (The RunGrepTest script already did + this for UTF-8.) The configure.ac script no longer substitutes the + relevant variables. + + (b) The debugging options /B and /D in pcretest show the compiled bytecode + with length and offset values. This means that the output is different + for different internal link sizes. Test 2 is skipped for link sizes + other than 2 because of this, bypassing the problem. Unfortunately, + there was also a test in test 3 (the locale tests) that used /B and + failed for link sizes other than 2. Rather than cut the whole test out, + I have added a new /Z option to pcretest that replaces the length and + offset values with spaces. This is now used to make test 3 independent + of link size. (Test 2 will be tidied up later.) + +14. If erroroffset was passed as NULL to pcre_compile, it provoked a + segmentation fault instead of returning the appropriate error message. + +15. In multiline mode when the newline sequence was set to "any", the pattern + ^$ would give a match between the \r and \n of a subject such as "A\r\nB". + This doesn't seem right; it now treats the CRLF combination as the line + ending, and so does not match in that case. It's only a pattern such as ^$ + that would hit this one: something like ^ABC$ would have failed after \r + and then tried again after \r\n. + +16. Changed the comparison command for RunGrepTest from "diff -u" to "diff -ub" + in an attempt to make files that differ only in their line terminators + compare equal. This works on Linux. + +17. Under certain error circumstances pcregrep might try to free random memory + as it exited. This is now fixed, thanks to valgrind. + +19. In pcretest, if the pattern /(?m)^$/g was matched against the string + "abc\r\n\r\n", it found an unwanted second match after the second \r. This + was because its rules for how to advance for /g after matching an empty + string at the end of a line did not allow for this case. They now check for + it specially. + +20. pcretest is supposed to handle patterns and data of any length, by + extending its buffers when necessary. It was getting this wrong when the + buffer for a data line had to be extended. + +21. Added PCRE_NEWLINE_ANYCRLF which is like ANY, but matches only CR, LF, or + CRLF as a newline sequence. + +22. Code for handling Unicode properties in pcre_dfa_exec() wasn't being cut + out by #ifdef SUPPORT_UCP. This did no harm, as it could never be used, but + I have nevertheless tidied it up. + +23. Added some casts to kill warnings from HP-UX ia64 compiler. + +24. Added a man page for pcre-config. + + +Version 7.0 19-Dec-06 +--------------------- + + 1. Fixed a signed/unsigned compiler warning in pcre_compile.c, shown up by + moving to gcc 4.1.1. + + 2. The -S option for pcretest uses setrlimit(); I had omitted to #include + sys/time.h, which is documented as needed for this function. It doesn't + seem to matter on Linux, but it showed up on some releases of OS X. + + 3. It seems that there are systems where bytes whose values are greater than + 127 match isprint() in the "C" locale. The "C" locale should be the + default when a C program starts up. In most systems, only ASCII printing + characters match isprint(). This difference caused the output from pcretest + to vary, making some of the tests fail. I have changed pcretest so that: + + (a) When it is outputting text in the compiled version of a pattern, bytes + other than 32-126 are always shown as hex escapes. + + (b) When it is outputting text that is a matched part of a subject string, + it does the same, unless a different locale has been set for the match + (using the /L modifier). In this case, it uses isprint() to decide. + + 4. Fixed a major bug that caused incorrect computation of the amount of memory + required for a compiled pattern when options that changed within the + pattern affected the logic of the preliminary scan that determines the + length. The relevant options are -x, and -i in UTF-8 mode. The result was + that the computed length was too small. The symptoms of this bug were + either the PCRE error "internal error: code overflow" from pcre_compile(), + or a glibc crash with a message such as "pcretest: free(): invalid next + size (fast)". Examples of patterns that provoked this bug (shown in + pcretest format) are: + + /(?-x: )/x + /(?x)(?-x: \s*#\s*)/ + /((?i)[\x{c0}])/8 + /(?i:[\x{c0}])/8 + + HOWEVER: Change 17 below makes this fix obsolete as the memory computation + is now done differently. + + 5. Applied patches from Google to: (a) add a QuoteMeta function to the C++ + wrapper classes; (b) implement a new function in the C++ scanner that is + more efficient than the old way of doing things because it avoids levels of + recursion in the regex matching; (c) add a paragraph to the documentation + for the FullMatch() function. + + 6. The escape sequence \n was being treated as whatever was defined as + "newline". Not only was this contrary to the documentation, which states + that \n is character 10 (hex 0A), but it also went horribly wrong when + "newline" was defined as CRLF. This has been fixed. + + 7. In pcre_dfa_exec.c the value of an unsigned integer (the variable called c) + was being set to -1 for the "end of line" case (supposedly a value that no + character can have). Though this value is never used (the check for end of + line is "zero bytes in current character"), it caused compiler complaints. + I've changed it to 0xffffffff. + + 8. In pcre_version.c, the version string was being built by a sequence of + C macros that, in the event of PCRE_PRERELEASE being defined as an empty + string (as it is for production releases) called a macro with an empty + argument. The C standard says the result of this is undefined. The gcc + compiler treats it as an empty string (which was what was wanted) but it is + reported that Visual C gives an error. The source has been hacked around to + avoid this problem. + + 9. On the advice of a Windows user, included and in Windows + builds of pcretest, and changed the call to _setmode() to use _O_BINARY + instead of 0x8000. Made all the #ifdefs test both _WIN32 and WIN32 (not all + of them did). + +10. Originally, pcretest opened its input and output without "b"; then I was + told that "b" was needed in some environments, so it was added for release + 5.0 to both the input and output. (It makes no difference on Unix-like + systems.) Later I was told that it is wrong for the input on Windows. I've + now abstracted the modes into two macros, to make it easier to fiddle with + them, and removed "b" from the input mode under Windows. + +11. Added pkgconfig support for the C++ wrapper library, libpcrecpp. + +12. Added -help and --help to pcretest as an official way of being reminded + of the options. + +13. Removed some redundant semicolons after macro calls in pcrecpparg.h.in + and pcrecpp.cc because they annoy compilers at high warning levels. + +14. A bit of tidying/refactoring in pcre_exec.c in the main bumpalong loop. + +15. Fixed an occurrence of == in configure.ac that should have been = (shell + scripts are not C programs :-) and which was not noticed because it works + on Linux. + +16. pcretest is supposed to handle any length of pattern and data line (as one + line or as a continued sequence of lines) by extending its input buffer if + necessary. This feature was broken for very long pattern lines, leading to + a string of junk being passed to pcre_compile() if the pattern was longer + than about 50K. + +17. I have done a major re-factoring of the way pcre_compile() computes the + amount of memory needed for a compiled pattern. Previously, there was code + that made a preliminary scan of the pattern in order to do this. That was + OK when PCRE was new, but as the facilities have expanded, it has become + harder and harder to keep it in step with the real compile phase, and there + have been a number of bugs (see for example, 4 above). I have now found a + cunning way of running the real compile function in a "fake" mode that + enables it to compute how much memory it would need, while actually only + ever using a few hundred bytes of working memory and without too many + tests of the mode. This should make future maintenance and development + easier. A side effect of this work is that the limit of 200 on the nesting + depth of parentheses has been removed (though this was never a serious + limitation, I suspect). However, there is a downside: pcre_compile() now + runs more slowly than before (30% or more, depending on the pattern). I + hope this isn't a big issue. There is no effect on runtime performance. + +18. Fixed a minor bug in pcretest: if a pattern line was not terminated by a + newline (only possible for the last line of a file) and it was a + pattern that set a locale (followed by /Lsomething), pcretest crashed. + +19. Added additional timing features to pcretest. (1) The -tm option now times + matching only, not compiling. (2) Both -t and -tm can be followed, as a + separate command line item, by a number that specifies the number of + repeats to use when timing. The default is 50000; this gives better + precision, but takes uncomfortably long for very large patterns. + +20. Extended pcre_study() to be more clever in cases where a branch of a + subpattern has no definite first character. For example, (a*|b*)[cd] would + previously give no result from pcre_study(). Now it recognizes that the + first character must be a, b, c, or d. + +21. There was an incorrect error "recursive call could loop indefinitely" if + a subpattern (or the entire pattern) that was being tested for matching an + empty string contained only one non-empty item after a nested subpattern. + For example, the pattern (?>\x{100}*)\d(?R) provoked this error + incorrectly, because the \d was being skipped in the check. + +22. The pcretest program now has a new pattern option /B and a command line + option -b, which is equivalent to adding /B to every pattern. This causes + it to show the compiled bytecode, without the additional information that + -d shows. The effect of -d is now the same as -b with -i (and similarly, /D + is the same as /B/I). + +23. A new optimization is now able automatically to treat some sequences such + as a*b as a*+b. More specifically, if something simple (such as a character + or a simple class like \d) has an unlimited quantifier, and is followed by + something that cannot possibly match the quantified thing, the quantifier + is automatically "possessified". + +24. A recursive reference to a subpattern whose number was greater than 39 + went wrong under certain circumstances in UTF-8 mode. This bug could also + have affected the operation of pcre_study(). + +25. Realized that a little bit of performance could be had by replacing + (c & 0xc0) == 0xc0 with c >= 0xc0 when processing UTF-8 characters. + +26. Timing data from pcretest is now shown to 4 decimal places instead of 3. + +27. Possessive quantifiers such as a++ were previously implemented by turning + them into atomic groups such as ($>a+). Now they have their own opcodes, + which improves performance. This includes the automatically created ones + from 23 above. + +28. A pattern such as (?=(\w+))\1: which simulates an atomic group using a + lookahead was broken if it was not anchored. PCRE was mistakenly expecting + the first matched character to be a colon. This applied both to named and + numbered groups. + +29. The ucpinternal.h header file was missing its idempotency #ifdef. + +30. I was sent a "project" file called libpcre.a.dev which I understand makes + building PCRE on Windows easier, so I have included it in the distribution. + +31. There is now a check in pcretest against a ridiculously large number being + returned by pcre_exec() or pcre_dfa_exec(). If this happens in a /g or /G + loop, the loop is abandoned. + +32. Forward references to subpatterns in conditions such as (?(2)...) where + subpattern 2 is defined later cause pcre_compile() to search forwards in + the pattern for the relevant set of parentheses. This search went wrong + when there were unescaped parentheses in a character class, parentheses + escaped with \Q...\E, or parentheses in a #-comment in /x mode. + +33. "Subroutine" calls and backreferences were previously restricted to + referencing subpatterns earlier in the regex. This restriction has now + been removed. + +34. Added a number of extra features that are going to be in Perl 5.10. On the + whole, these are just syntactic alternatives for features that PCRE had + previously implemented using the Python syntax or my own invention. The + other formats are all retained for compatibility. + + (a) Named groups can now be defined as (?...) or (?'name'...) as well + as (?P...). The new forms, as well as being in Perl 5.10, are + also .NET compatible. + + (b) A recursion or subroutine call to a named group can now be defined as + (?&name) as well as (?P>name). + + (c) A backreference to a named group can now be defined as \k or + \k'name' as well as (?P=name). The new forms, as well as being in Perl + 5.10, are also .NET compatible. + + (d) A conditional reference to a named group can now use the syntax + (?() or (?('name') as well as (?(name). + + (e) A "conditional group" of the form (?(DEFINE)...) can be used to define + groups (named and numbered) that are never evaluated inline, but can be + called as "subroutines" from elsewhere. In effect, the DEFINE condition + is always false. There may be only one alternative in such a group. + + (f) A test for recursion can be given as (?(R1).. or (?(R&name)... as well + as the simple (?(R). The condition is true only if the most recent + recursion is that of the given number or name. It does not search out + through the entire recursion stack. + + (g) The escape \gN or \g{N} has been added, where N is a positive or + negative number, specifying an absolute or relative reference. + +35. Tidied to get rid of some further signed/unsigned compiler warnings and + some "unreachable code" warnings. + +36. Updated the Unicode property tables to Unicode version 5.0.0. Amongst other + things, this adds five new scripts. + +37. Perl ignores orphaned \E escapes completely. PCRE now does the same. + There were also incompatibilities regarding the handling of \Q..\E inside + character classes, for example with patterns like [\Qa\E-\Qz\E] where the + hyphen was adjacent to \Q or \E. I hope I've cleared all this up now. + +38. Like Perl, PCRE detects when an indefinitely repeated parenthesized group + matches an empty string, and forcibly breaks the loop. There were bugs in + this code in non-simple cases. For a pattern such as ^(a()*)* matched + against aaaa the result was just "a" rather than "aaaa", for example. Two + separate and independent bugs (that affected different cases) have been + fixed. + +39. Refactored the code to abolish the use of different opcodes for small + capturing bracket numbers. This is a tidy that I avoided doing when I + removed the limit on the number of capturing brackets for 3.5 back in 2001. + The new approach is not only tidier, it makes it possible to reduce the + memory needed to fix the previous bug (38). + +40. Implemented PCRE_NEWLINE_ANY to recognize any of the Unicode newline + sequences (http://unicode.org/unicode/reports/tr18/) as "newline" when + processing dot, circumflex, or dollar metacharacters, or #-comments in /x + mode. + +41. Add \R to match any Unicode newline sequence, as suggested in the Unicode + report. + +42. Applied patch, originally from Ari Pollak, modified by Google, to allow + copy construction and assignment in the C++ wrapper. + +43. Updated pcregrep to support "--newline=any". In the process, I fixed a + couple of bugs that could have given wrong results in the "--newline=crlf" + case. + +44. Added a number of casts and did some reorganization of signed/unsigned int + variables following suggestions from Dair Grant. Also renamed the variable + "this" as "item" because it is a C++ keyword. + +45. Arranged for dftables to add + + #include "pcre_internal.h" + + to pcre_chartables.c because without it, gcc 4.x may remove the array + definition from the final binary if PCRE is built into a static library and + dead code stripping is activated. + +46. For an unanchored pattern, if a match attempt fails at the start of a + newline sequence, and the newline setting is CRLF or ANY, and the next two + characters are CRLF, advance by two characters instead of one. + + Version 6.7 04-Jul-06 --------------------- Added: freeswitch/trunk/libs/pcre/CleanTxt ============================================================================== --- (empty file) +++ freeswitch/trunk/libs/pcre/CleanTxt Mon Jun 8 18:51:30 2009 @@ -0,0 +1,113 @@ +#! /usr/bin/perl -w + +# Script to take the output of nroff -man and remove all the backspacing and +# the page footers and the screen commands etc so that it is more usefully +# readable online. In fact, in the latest nroff, intermediate footers don't +# seem to be generated any more. + +$blankcount = 0; +$lastwascut = 0; +$firstheader = 1; + +# Input on STDIN; output to STDOUT. + +while () + { + s/\x1b\[\d+m//g; # Remove screen controls "ESC [ number m" + s/.\x8//g; # Remove "char, backspace" + + # Handle header lines. Retain only the first one we encounter, but remove + # the blank line that follows. Any others (e.g. at end of document) and the + # following blank line are dropped. + + if (/^PCRE(\w*)\(([13])\)\s+PCRE\1\(\2\)$/) + { + if ($firstheader) + { + $firstheader = 0; + print; + $lastprinted = $_; + $lastwascut = 0; + } + $_=; # Remove a blank that follows + next; + } + + # Count runs of empty lines + + if (/^\s*$/) + { + $blankcount++; + $lastwascut = 0; + next; + } + + # If a chunk of lines has been cut out (page footer) and the next line + # has a different indentation, put back one blank line. + + if ($lastwascut && $blankcount < 1 && defined($lastprinted)) + { + ($a) = $lastprinted =~ /^(\s*)/; + ($b) = $_ =~ /^(\s*)/; + $blankcount++ if ($a ne $b); + } + + # We get here only when we have a non-blank line in hand. If it was preceded + # by 3 or more blank lines, read the next 3 lines and see if they are blank. + # If so, remove all 7 lines, and remember that we have just done a cut. + + if ($blankcount >= 3) + { + for ($i = 0; $i < 3; $i++) + { + $next[$i] = ; + $next[$i] = "" if !defined $next[$i]; + $next[$i] =~ s/\x1b\[\d+m//g; # Remove screen controls "ESC [ number m" + $next[$i] =~ s/.\x8//g; # Remove "char, backspace" + } + + # Cut out chunks of the form <3 blanks><3 blanks> + + if ($next[0] =~ /^\s*$/ && + $next[1] =~ /^\s*$/ && + $next[2] =~ /^\s*$/) + { + $blankcount -= 3; + $lastwascut = 1; + } + + # Otherwise output the saved blanks, the current, and the next three + # lines. Remember the last printed line. + + else + { + for ($i = 0; $i < $blankcount; $i++) { print "\n"; } + print; + for ($i = 0; $i < 3; $i++) + { + $next[$i] =~ s/.\x8//g; + print $next[$i]; + $lastprinted = $_; + } + $lastwascut = 0; + $blankcount = 0; + } + } + + # This non-blank line is not preceded by 3 or more blank lines. Output + # any blanks there are, and the line. Remember it. Force two blank lines + # before headings. + + else + { + $blankcount = 2 if /^\S/ && !/^Last updated/ && !/^Copyright/ && + defined($lastprinted); + for ($i = 0; $i < $blankcount; $i++) { print "\n"; } + print; + $lastprinted = $_; + $lastwascut = 0; + $blankcount = 0; + } + } + +# End Added: freeswitch/trunk/libs/pcre/Detrail ============================================================================== --- (empty file) +++ freeswitch/trunk/libs/pcre/Detrail Mon Jun 8 18:51:30 2009 @@ -0,0 +1,35 @@ +#!/usr/bin/perl + +# This is a script for removing trailing whitespace from lines in files that +# are listed on the command line. + +# This subroutine does the work for one file. + +sub detrail { +my($file) = $_[0]; +my($changed) = 0; +open(IN, "$file") || die "Can't open $file for input"; + at lines = ; +close(IN); +foreach (@lines) + { + if (/\s+\n$/) + { + s/\s+\n$/\n/; + $changed = 1; + } + } +if ($changed) + { + open(OUT, ">$file") || die "Can't open $file for output"; + print OUT @lines; + close(OUT); + } +} + +# This is the main program + +$, = ""; # Output field separator +for ($i = 0; $i < @ARGV; $i++) { &detrail($ARGV[$i]); } + +# End Added: freeswitch/trunk/libs/pcre/HACKING ============================================================================== --- (empty file) +++ freeswitch/trunk/libs/pcre/HACKING Mon Jun 8 18:51:30 2009 @@ -0,0 +1,418 @@ +Technical Notes about PCRE +-------------------------- + +These are very rough technical notes that record potentially useful information +about PCRE internals. + +Historical note 1 +----------------- + +Many years ago I implemented some regular expression functions to an algorithm +suggested by Martin Richards. These were not Unix-like in form, and were quite +restricted in what they could do by comparison with Perl. The interesting part +about the algorithm was that the amount of space required to hold the compiled +form of an expression was known in advance. The code to apply an expression did +not operate by backtracking, as the original Henry Spencer code and current +Perl code does, but instead checked all possibilities simultaneously by keeping +a list of current states and checking all of them as it advanced through the +subject string. In the terminology of Jeffrey Friedl's book, it was a "DFA +algorithm", though it was not a traditional Finite State Machine (FSM). When +the pattern was all used up, all remaining states were possible matches, and +the one matching the longest subset of the subject string was chosen. This did +not necessarily maximize the individual wild portions of the pattern, as is +expected in Unix and Perl-style regular expressions. + +Historical note 2 +----------------- + +By contrast, the code originally written by Henry Spencer (which was +subsequently heavily modified for Perl) compiles the expression twice: once in +a dummy mode in order to find out how much store will be needed, and then for +real. (The Perl version probably doesn't do this any more; I'm talking about +the original library.) The execution function operates by backtracking and +maximizing (or, optionally, minimizing in Perl) the amount of the subject that +matches individual wild portions of the pattern. This is an "NFA algorithm" in +Friedl's terminology. + +OK, here's the real stuff +------------------------- + +For the set of functions that form the "basic" PCRE library (which are +unrelated to those mentioned above), I tried at first to invent an algorithm +that used an amount of store bounded by a multiple of the number of characters +in the pattern, to save on compiling time. However, because of the greater +complexity in Perl regular expressions, I couldn't do this. In any case, a +first pass through the pattern is helpful for other reasons. + +Computing the memory requirement: how it was +-------------------------------------------- + +Up to and including release 6.7, PCRE worked by running a very degenerate first +pass to calculate a maximum store size, and then a second pass to do the real +compile - which might use a bit less than the predicted amount of memory. The +idea was that this would turn out faster than the Henry Spencer code because +the first pass is degenerate and the second pass can just store stuff straight +into the vector, which it knows is big enough. + +Computing the memory requirement: how it is +------------------------------------------- + +By the time I was working on a potential 6.8 release, the degenerate first pass +had become very complicated and hard to maintain. Indeed one of the early +things I did for 6.8 was to fix Yet Another Bug in the memory computation. Then +I had a flash of inspiration as to how I could run the real compile function in +a "fake" mode that enables it to compute how much memory it would need, while +actually only ever using a few hundred bytes of working memory, and without too +many tests of the mode that might slow it down. So I re-factored the compiling +functions to work this way. This got rid of about 600 lines of source. It +should make future maintenance and development easier. As this was such a major +change, I never released 6.8, instead upping the number to 7.0 (other quite +major changes are also present in the 7.0 release). + +A side effect of this work is that the previous limit of 200 on the nesting +depth of parentheses was removed. However, there is a downside: pcre_compile() +runs more slowly than before (30% or more, depending on the pattern) because it +is doing a full analysis of the pattern. My hope is that this is not a big +issue. + +Traditional matching function +----------------------------- + +The "traditional", and original, matching function is called pcre_exec(), and +it implements an NFA algorithm, similar to the original Henry Spencer algorithm +and the way that Perl works. Not surprising, since it is intended to be as +compatible with Perl as possible. This is the function most users of PCRE will +use most of the time. + +Supplementary matching function +------------------------------- + +From PCRE 6.0, there is also a supplementary matching function called +pcre_dfa_exec(). This implements a DFA matching algorithm that searches +simultaneously for all possible matches that start at one point in the subject +string. (Going back to my roots: see Historical Note 1 above.) This function +intreprets the same compiled pattern data as pcre_exec(); however, not all the +facilities are available, and those that are do not always work in quite the +same way. See the user documentation for details. + +The algorithm that is used for pcre_dfa_exec() is not a traditional FSM, +because it may have a number of states active at one time. More work would be +needed at compile time to produce a traditional FSM where only one state is +ever active at once. I believe some other regex matchers work this way. + + +Format of compiled patterns +--------------------------- + +The compiled form of a pattern is a vector of bytes, containing items of +variable length. The first byte in an item is an opcode, and the length of the +item is either implicit in the opcode or contained in the data bytes that +follow it. + +In many cases below LINK_SIZE data values are specified for offsets within the +compiled pattern. The default value for LINK_SIZE is 2, but PCRE can be +compiled to use 3-byte or 4-byte values for these offsets (impairing the +performance). This is necessary only when patterns whose compiled length is +greater than 64K are going to be processed. In this description, we assume the +"normal" compilation options. Data values that are counts (e.g. for +quantifiers) are always just two bytes long. + +A list of the opcodes follows: + +Opcodes with no following data +------------------------------ + +These items are all just one byte long + + OP_END end of pattern + OP_ANY match any one character other than newline + OP_ALLANY match any one character, including newline + OP_ANYBYTE match any single byte, even in UTF-8 mode + OP_SOD match start of data: \A + OP_SOM, start of match (subject + offset): \G + OP_SET_SOM, set start of match (\K) + OP_CIRC ^ (start of data, or after \n in multiline) + OP_NOT_WORD_BOUNDARY \W + OP_WORD_BOUNDARY \w + OP_NOT_DIGIT \D + OP_DIGIT \d + OP_NOT_HSPACE \H + OP_HSPACE \h + OP_NOT_WHITESPACE \S + OP_WHITESPACE \s + OP_NOT_VSPACE \V + OP_VSPACE \v + OP_NOT_WORDCHAR \W + OP_WORDCHAR \w + OP_EODN match end of data or \n at end: \Z + OP_EOD match end of data: \z + OP_DOLL $ (end of data, or before \n in multiline) + OP_EXTUNI match an extended Unicode character + OP_ANYNL match any Unicode newline sequence + + OP_ACCEPT ) + OP_COMMIT ) + OP_FAIL ) These are Perl 5.10's "backtracking + OP_PRUNE ) control verbs". + OP_SKIP ) + OP_THEN ) + + +Repeating single characters +--------------------------- + +The common repeats (*, +, ?) when applied to a single character use the +following opcodes: + + OP_STAR + OP_MINSTAR + OP_POSSTAR + OP_PLUS + OP_MINPLUS + OP_POSPLUS + OP_QUERY + OP_MINQUERY + OP_POSQUERY + +In ASCII mode, these are two-byte items; in UTF-8 mode, the length is variable. +Those with "MIN" in their name are the minimizing versions. Those with "POS" in +their names are possessive versions. Each is followed by the character that is +to be repeated. Other repeats make use of + + OP_UPTO + OP_MINUPTO + OP_POSUPTO + OP_EXACT + +which are followed by a two-byte count (most significant first) and the +repeated character. OP_UPTO matches from 0 to the given number. A repeat with a +non-zero minimum and a fixed maximum is coded as an OP_EXACT followed by an +OP_UPTO (or OP_MINUPTO or OPT_POSUPTO). + + +Repeating character types +------------------------- + +Repeats of things like \d are done exactly as for single characters, except +that instead of a character, the opcode for the type is stored in the data +byte. The opcodes are: + + OP_TYPESTAR + OP_TYPEMINSTAR + OP_TYPEPOSSTAR + OP_TYPEPLUS + OP_TYPEMINPLUS + OP_TYPEPOSPLUS + OP_TYPEQUERY + OP_TYPEMINQUERY + OP_TYPEPOSQUERY + OP_TYPEUPTO + OP_TYPEMINUPTO + OP_TYPEPOSUPTO + OP_TYPEEXACT + + +Match by Unicode property +------------------------- + +OP_PROP and OP_NOTPROP are used for positive and negative matches of a +character by testing its Unicode property (the \p and \P escape sequences). +Each is followed by two bytes that encode the desired property as a type and a +value. + +Repeats of these items use the OP_TYPESTAR etc. set of opcodes, followed by +three bytes: OP_PROP or OP_NOTPROP and then the desired property type and +value. + + +Matching literal characters +--------------------------- + +The OP_CHAR opcode is followed by a single character that is to be matched +casefully. For caseless matching, OP_CHARNC is used. In UTF-8 mode, the +character may be more than one byte long. (Earlier versions of PCRE used +multi-character strings, but this was changed to allow some new features to be +added.) + + +Character classes +----------------- + +If there is only one character, OP_CHAR or OP_CHARNC is used for a positive +class, and OP_NOT for a negative one (that is, for something like [^a]). +However, in UTF-8 mode, the use of OP_NOT applies only to characters with +values < 128, because OP_NOT is confined to single bytes. + +Another set of repeating opcodes (OP_NOTSTAR etc.) are used for a repeated, +negated, single-character class. The normal ones (OP_STAR etc.) are used for a +repeated positive single-character class. + +When there's more than one character in a class and all the characters are less +than 256, OP_CLASS is used for a positive class, and OP_NCLASS for a negative +one. In either case, the opcode is followed by a 32-byte bit map containing a 1 +bit for every character that is acceptable. The bits are counted from the least +significant end of each byte. + +The reason for having both OP_CLASS and OP_NCLASS is so that, in UTF-8 mode, +subject characters with values greater than 256 can be handled correctly. For +OP_CLASS they don't match, whereas for OP_NCLASS they do. + +For classes containing characters with values > 255, OP_XCLASS is used. It +optionally uses a bit map (if any characters lie within it), followed by a list +of pairs and single characters. There is a flag character than indicates +whether it's a positive or a negative class. + + +Back references +--------------- + +OP_REF is followed by two bytes containing the reference number. + + +Repeating character classes and back references +----------------------------------------------- + +Single-character classes are handled specially (see above). This section +applies to OP_CLASS and OP_REF. In both cases, the repeat information follows +the base item. The matching code looks at the following opcode to see if it is +one of + + OP_CRSTAR + OP_CRMINSTAR + OP_CRPLUS + OP_CRMINPLUS + OP_CRQUERY + OP_CRMINQUERY + OP_CRRANGE + OP_CRMINRANGE + +All but the last two are just single-byte items. The others are followed by +four bytes of data, comprising the minimum and maximum repeat counts. There are +no special possessive opcodes for these repeats; a possessive repeat is +compiled into an atomic group. + + +Brackets and alternation +------------------------ + +A pair of non-capturing (round) brackets is wrapped round each expression at +compile time, so alternation always happens in the context of brackets. + +[Note for North Americans: "bracket" to some English speakers, including +myself, can be round, square, curly, or pointy. Hence this usage.] + +Non-capturing brackets use the opcode OP_BRA. Originally PCRE was limited to 99 +capturing brackets and it used a different opcode for each one. From release +3.5, the limit was removed by putting the bracket number into the data for +higher-numbered brackets. From release 7.0 all capturing brackets are handled +this way, using the single opcode OP_CBRA. + +A bracket opcode is followed by LINK_SIZE bytes which give the offset to the +next alternative OP_ALT or, if there aren't any branches, to the matching +OP_KET opcode. Each OP_ALT is followed by LINK_SIZE bytes giving the offset to +the next one, or to the OP_KET opcode. For capturing brackets, the bracket +number immediately follows the offset, always as a 2-byte item. + +OP_KET is used for subpatterns that do not repeat indefinitely, while +OP_KETRMIN and OP_KETRMAX are used for indefinite repetitions, minimally or +maximally respectively. All three are followed by LINK_SIZE bytes giving (as a +positive number) the offset back to the matching bracket opcode. + +If a subpattern is quantified such that it is permitted to match zero times, it +is preceded by one of OP_BRAZERO, OP_BRAMINZERO, or OP_SKIPZERO. These are +single-byte opcodes that tell the matcher that skipping the following +subpattern entirely is a valid branch. In the case of the first two, not +skipping the pattern is also valid (greedy and non-greedy). The third is used +when a pattern has the quantifier {0,0}. It cannot be entirely discarded, +because it may be called as a subroutine from elsewhere in the regex. + +A subpattern with an indefinite maximum repetition is replicated in the +compiled data its minimum number of times (or once with OP_BRAZERO if the +minimum is zero), with the final copy terminating with OP_KETRMIN or OP_KETRMAX +as appropriate. + +A subpattern with a bounded maximum repetition is replicated in a nested +fashion up to the maximum number of times, with OP_BRAZERO or OP_BRAMINZERO +before each replication after the minimum, so that, for example, (abc){2,5} is +compiled as (abc)(abc)((abc)((abc)(abc)?)?)?, except that each bracketed group +has the same number. + +When a repeated subpattern has an unbounded upper limit, it is checked to see +whether it could match an empty string. If this is the case, the opcode in the +final replication is changed to OP_SBRA or OP_SCBRA. This tells the matcher +that it needs to check for matching an empty string when it hits OP_KETRMIN or +OP_KETRMAX, and if so, to break the loop. + + +Assertions +---------- + +Forward assertions are just like other subpatterns, but starting with one of +the opcodes OP_ASSERT or OP_ASSERT_NOT. Backward assertions use the opcodes +OP_ASSERTBACK and OP_ASSERTBACK_NOT, and the first opcode inside the assertion +is OP_REVERSE, followed by a two byte count of the number of characters to move +back the pointer in the subject string. When operating in UTF-8 mode, the count +is a character count rather than a byte count. A separate count is present in +each alternative of a lookbehind assertion, allowing them to have different +fixed lengths. + + +Once-only (atomic) subpatterns +------------------------------ + +These are also just like other subpatterns, but they start with the opcode +OP_ONCE. The check for matching an empty string in an unbounded repeat is +handled entirely at runtime, so there is just this one opcode. + + +Conditional subpatterns +----------------------- + +These are like other subpatterns, but they start with the opcode OP_COND, or +OP_SCOND for one that might match an empty string in an unbounded repeat. If +the condition is a back reference, this is stored at the start of the +subpattern using the opcode OP_CREF followed by two bytes containing the +reference number. If the condition is "in recursion" (coded as "(?(R)"), or "in +recursion of group x" (coded as "(?(Rx)"), the group number is stored at the +start of the subpattern using the opcode OP_RREF, and a value of zero for "the +whole pattern". For a DEFINE condition, just the single byte OP_DEF is used (it +has no associated data). Otherwise, a conditional subpattern always starts with +one of the assertions. + + +Recursion +--------- + +Recursion either matches the current regex, or some subexpression. The opcode +OP_RECURSE is followed by an value which is the offset to the starting bracket +from the start of the whole pattern. From release 6.5, OP_RECURSE is +automatically wrapped inside OP_ONCE brackets (because otherwise some patterns +broke it). OP_RECURSE is also used for "subroutine" calls, even though they +are not strictly a recursion. + + +Callout +------- + +OP_CALLOUT is followed by one byte of data that holds a callout number in the +range 0 to 254 for manual callouts, or 255 for an automatic callout. In both +cases there follows a two-byte value giving the offset in the pattern to the +start of the following item, and another two-byte item giving the length of the +next item. + + +Changing options +---------------- + +If any of the /i, /m, or /s options are changed within a pattern, an OP_OPT +opcode is compiled, followed by one byte containing the new settings of these +flags. If there are several alternatives, there is an occurrence of OP_OPT at +the start of all those following the first options change, to set appropriate +options for the start of the alternative. Immediately after the end of the +group there is another such item to reset the flags to their previous values. A +change of flag right at the very start of the pattern can be handled entirely +at compile time, and so does not cause anything to be put into the compiled +data. + +Philip Hazel +April 2008 Modified: freeswitch/trunk/libs/pcre/INSTALL ============================================================================== --- freeswitch/trunk/libs/pcre/INSTALL (original) +++ freeswitch/trunk/libs/pcre/INSTALL Mon Jun 8 18:51:30 2009 @@ -1,41 +1,54 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007, 2008 Free Software Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + Basic Installation ================== - These are generic installation instructions that apply to systems that -can run the `configure' shell script - Unix systems and any that imitate -it. They are not specific to PCRE. There are PCRE-specific instructions -for non-Unix systems in the file NON-UNIX-USE. + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. + `./configure' to configure the package for your system. - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. 2. Type `make' to compile the package. @@ -54,52 +67,69 @@ all sorts of other programs in order to regenerate files that came with the distribution. + 6. Often, you can also type `make uninstall' to remove the installed + files again. + Compilers and Options ===================== Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the +own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. Installation Names ================== - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular +options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. @@ -122,25 +152,57 @@ you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + Specifying the System Type ========================== - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + CPU-COMPANY-SYSTEM -See the file `config.sub' for the possible values of each field. If +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't -need to know the host type. +need to know the machine type. - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. Sharing Defaults ================ @@ -153,19 +215,55 @@ `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. -Operation Controls +Defining Variables ================== + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + `configure' recognizes the following options to control how it operates. -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - `--help' - Print a summary of the options to `configure', and exit. +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. `--quiet' `--silent' @@ -178,9 +276,16 @@ Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. +`--prefix=DIR' + Use DIR as the installation prefix. *Note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. -`configure' also accepts some other, not widely useful, options. - \ No newline at end of file Modified: freeswitch/trunk/libs/pcre/LICENCE ============================================================================== --- freeswitch/trunk/libs/pcre/LICENCE (original) +++ freeswitch/trunk/libs/pcre/LICENCE Mon Jun 8 18:51:30 2009 @@ -4,7 +4,7 @@ PCRE is a library of functions to support regular expressions whose syntax and semantics are as close as possible to those of the Perl 5 language. -Release 6 of PCRE is distributed under the terms of the "BSD" licence, as +Release 7 of PCRE is distributed under the terms of the "BSD" licence, as specified below. The documentation for PCRE, supplied in the "doc" directory, is distributed under the same terms as the software itself. @@ -20,9 +20,9 @@ Email domain: cam.ac.uk University of Cambridge Computing Service, -Cambridge, England. Phone: +44 1223 334714. +Cambridge, England. -Copyright (c) 1997-2006 University of Cambridge +Copyright (c) 1997-2009 University of Cambridge All rights reserved. @@ -31,7 +31,7 @@ Contributed by: Google Inc. -Copyright (c) 2006, Google Inc. +Copyright (c) 2007-2008, Google Inc. All rights reserved. Added: freeswitch/trunk/libs/pcre/Makefile.am ============================================================================== --- (empty file) +++ freeswitch/trunk/libs/pcre/Makefile.am Mon Jun 8 18:51:30 2009 @@ -0,0 +1,390 @@ +## Process this file with automake to produce Makefile.in. + +dist_doc_DATA = \ + doc/pcre.txt \ + doc/pcre-config.txt \ + doc/pcregrep.txt \ + doc/pcretest.txt \ + AUTHORS \ + COPYING \ + ChangeLog \ + LICENCE \ + NEWS \ + README + +dist_html_DATA = \ + doc/html/index.html \ + doc/html/pcre.html \ + doc/html/pcre-config.html \ + doc/html/pcre_compile.html \ + doc/html/pcre_compile2.html \ + doc/html/pcre_config.html \ + doc/html/pcre_copy_named_substring.html \ + doc/html/pcre_copy_substring.html \ + doc/html/pcre_dfa_exec.html \ + doc/html/pcre_exec.html \ + doc/html/pcre_free_substring.html \ + doc/html/pcre_free_substring_list.html \ + doc/html/pcre_fullinfo.html \ + doc/html/pcre_get_named_substring.html \ + doc/html/pcre_get_stringnumber.html \ + doc/html/pcre_get_stringtable_entries.html \ + doc/html/pcre_get_substring.html \ + doc/html/pcre_get_substring_list.html \ + doc/html/pcre_info.html \ + doc/html/pcre_maketables.html \ + doc/html/pcre_refcount.html \ + doc/html/pcre_study.html \ + doc/html/pcre_version.html \ + doc/html/pcreapi.html \ + doc/html/pcrebuild.html \ + doc/html/pcrecallout.html \ + doc/html/pcrecompat.html \ + doc/html/pcregrep.html \ + doc/html/pcrematching.html \ + doc/html/pcrepartial.html \ + doc/html/pcrepattern.html \ + doc/html/pcreperform.html \ + doc/html/pcreposix.html \ + doc/html/pcreprecompile.html \ + doc/html/pcresample.html \ + doc/html/pcrestack.html \ + doc/html/pcresyntax.html \ + doc/html/pcretest.html + +pcrecpp_html = doc/html/pcrecpp.html +dist_noinst_DATA = $(pcrecpp_html) + +if WITH_PCRE_CPP +html_DATA = $(pcrecpp_html) +endif + +# The Libtool libraries to install. We'll add to this later. +lib_LTLIBRARIES = + +# Unit tests you want to run when people type 'make check'. +# TESTS is for binary unit tests, check_SCRIPTS for script-based tests +TESTS = +check_SCRIPTS = +dist_noinst_SCRIPTS = + +# Some of the binaries we make are to be installed, and others are +# (non-user-visible) helper programs needed to build libpcre. +bin_PROGRAMS = +noinst_PROGRAMS = + +# Additional files to delete on 'make clean' and 'make maintainer-clean'. +CLEANFILES = +MAINTAINERCLEANFILES = + +# Additional files to bundle with the distribution, over and above what +# the Autotools include by default. +EXTRA_DIST = + +# These files contain maintenance information +EXTRA_DIST += \ + doc/perltest.txt \ + NON-UNIX-USE \ + HACKING + +# These files are used in the preparation of a release +EXTRA_DIST += \ + PrepareRelease \ + CleanTxt \ + Detrail \ + 132html \ + doc/index.html.src + +# These files are to do with building for Virtual Pascal +EXTRA_DIST += \ + makevp.bat \ + makevp_c.txt \ + makevp_l.txt \ + pcregexp.pas + +# These files are usable versions of pcre.h and config.h that are distributed +# for the benefit of people who are building PCRE manually, without the +# Autotools support. +EXTRA_DIST += \ + pcre.h.generic \ + config.h.generic + +pcre.h.generic: configure.ac + rm -f $@ + cp -p pcre.h $@ + +MAINTAINERCLEANFILES += pcre.h.generic + +# These are the header files we'll install. We do not distribute pcre.h because +# it is generated from pcre.h.in. +nodist_include_HEADERS = \ + pcre.h +include_HEADERS = \ + pcreposix.h + +# These additional headers will be be installed if C++ support is enabled. We +# do not distribute pcrecpparg.h or pcre_stringpiece.h, as these are generated +# from corresponding .h.in files (which we do distribute). +if WITH_PCRE_CPP +nodist_include_HEADERS += \ + pcrecpparg.h \ + pcre_stringpiece.h +include_HEADERS += \ + pcrecpp.h \ + pcre_scanner.h +endif # WITH_PCRE_CPP + +bin_SCRIPTS = pcre-config + +## --------------------------------------------------------------- +## The dftables program is used to rebuild character tables before compiling +## PCRE, if --enable-rebuild-chartables is specified. It is not a user-visible +## program. The default (when --enable-rebuild-chartables is not specified) is +## to copy a distributed set of tables that are defined for ASCII code. In this +## case, dftables is not needed. + +if WITH_REBUILD_CHARTABLES + +noinst_PROGRAMS += dftables +dftables_SOURCES = dftables.c + +pcre_chartables.c: dftables$(EXEEXT) + ./dftables$(EXEEXT) $@ +else + +pcre_chartables.c: $(srcdir)/pcre_chartables.c.dist + rm -f $@ + $(LN_S) $(srcdir)/pcre_chartables.c.dist $@ + +endif # WITH_REBUILD_CHARTABLES + + +## The main pcre library +lib_LTLIBRARIES += libpcre.la +libpcre_la_SOURCES = \ + pcre_compile.c \ + pcre_config.c \ + pcre_dfa_exec.c \ + pcre_exec.c \ + pcre_fullinfo.c \ + pcre_get.c \ + pcre_globals.c \ + pcre_info.c \ + pcre_internal.h \ + pcre_maketables.c \ + pcre_newline.c \ + pcre_ord2utf8.c \ + pcre_refcount.c \ + pcre_study.c \ + pcre_tables.c \ + pcre_try_flipped.c \ + pcre_ucd.c \ + pcre_valid_utf8.c \ + pcre_version.c \ + pcre_xclass.c \ + ucp.h + +## This file is generated as part of the building process, so don't distribute. +nodist_libpcre_la_SOURCES = \ + pcre_chartables.c + +# The pcre_printint.src file is #included by some source files, so it must be +# distributed. The pcre_chartables.c.dist file is the default version of +# pcre_chartables.c, used unless --enable-rebuild-chartables is specified. +EXTRA_DIST += pcre_printint.src pcre_chartables.c.dist + +libpcre_la_LDFLAGS = $(EXTRA_LIBPCRE_LDFLAGS) + +CLEANFILES += pcre_chartables.c + +## A version of the main pcre library that has a posix re API. +lib_LTLIBRARIES += libpcreposix.la +libpcreposix_la_SOURCES = \ + pcreposix.c +libpcreposix_la_LDFLAGS = $(EXTRA_LIBPCREPOSIX_LDFLAGS) +libpcreposix_la_LIBADD = libpcre.la + +## There's a C++ library as well. +if WITH_PCRE_CPP + +lib_LTLIBRARIES += libpcrecpp.la +libpcrecpp_la_SOURCES = \ + pcrecpp_internal.h \ + pcrecpp.cc \ + pcre_scanner.cc \ + pcre_stringpiece.cc +libpcrecpp_la_LDFLAGS = $(EXTRA_LIBPCRECPP_LDFLAGS) +libpcrecpp_la_LIBADD = libpcre.la + +TESTS += pcrecpp_unittest +noinst_PROGRAMS += pcrecpp_unittest +pcrecpp_unittest_SOURCES = pcrecpp_unittest.cc +pcrecpp_unittest_LDADD = libpcrecpp.la + +TESTS += pcre_scanner_unittest +noinst_PROGRAMS += pcre_scanner_unittest +pcre_scanner_unittest_SOURCES = pcre_scanner_unittest.cc +pcre_scanner_unittest_LDADD = libpcrecpp.la + +TESTS += pcre_stringpiece_unittest +noinst_PROGRAMS += pcre_stringpiece_unittest +pcre_stringpiece_unittest_SOURCES = pcre_stringpiece_unittest.cc +pcre_stringpiece_unittest_LDADD = libpcrecpp.la + +endif # WITH_PCRE_CPP + +## The main unit tests + +# Each unit test is a binary plus a script that runs that binary in various +# ways. We install these test binaries in case folks find it helpful. + +TESTS += RunTest +dist_noinst_SCRIPTS += RunTest +EXTRA_DIST += RunTest.bat +bin_PROGRAMS += pcretest +pcretest_SOURCES = pcretest.c +pcretest_LDADD = libpcreposix.la $(LIBREADLINE) + +TESTS += RunGrepTest +dist_noinst_SCRIPTS += RunGrepTest +bin_PROGRAMS += pcregrep +pcregrep_SOURCES = pcregrep.c +pcregrep_LDADD = libpcreposix.la $(LIBZ) $(LIBBZ2) + +EXTRA_DIST += \ + testdata/grepinput \ + testdata/grepinput8 \ + testdata/grepinputv \ + testdata/grepinputx \ + testdata/greplist \ + testdata/grepoutput \ + testdata/grepoutput8 \ + testdata/grepoutputN \ + testdata/testinput1 \ + testdata/testinput2 \ + testdata/testinput3 \ + testdata/testinput4 \ + testdata/testinput5 \ + testdata/testinput6 \ + testdata/testinput7 \ + testdata/testinput8 \ + testdata/testinput9 \ + testdata/testinput10 \ + testdata/testoutput1 \ + testdata/testoutput2 \ + testdata/testoutput3 \ + testdata/testoutput4 \ + testdata/testoutput5 \ + testdata/testoutput6 \ + testdata/testoutput7 \ + testdata/testoutput8 \ + testdata/testoutput9 \ + testdata/testoutput10 \ + testdata/wintestinput3 \ + testdata/wintestoutput3 \ + perltest.pl + +CLEANFILES += \ + testsavedregex \ + teststderr \ + testtry \ + testNinput + + +# PCRE demonstration program. No longer built automatcally. The point is that +# the users should build it themselves. So just distribute the source. +# noinst_PROGRAMS += pcredemo +# pcredemo_SOURCES = pcredemo.c +# pcredemo_LDADD = libpcre.la + +EXTRA_DIST += pcredemo.c + + +## Utility rules, documentation, etc. + +# A compatibility line, the old build system worked with 'make test' +test: check ; + + +# A PCRE user submitted the following addition, saying that it "will allow +# anyone using the 'mingw32' compiler to simply type 'make pcre.dll' and get a +# nice DLL for Windows use". (It is used by the pcre.dll target.) +DLL_OBJS= pcre_compile.o pcre_config.o \ + pcre_dfa_exec.o pcre_exec.o pcre_fullinfo.o pcre_get.o \ + pcre_globals.o pcre_info.o pcre_maketables.o \ + pcre_newline.o pcre_ord2utf8.o pcre_refcount.o \ + pcre_study.o pcre_tables.o pcre_try_flipped.o \ + pcre_ucd.o pcre_valid_utf8.o pcre_version.o \ + pcre_chartables.o \ + pcre_xclass.o + +# A PCRE user submitted the following addition, saying that it "will allow +# anyone using the 'mingw32' compiler to simply type 'make pcre.dll' and get a +# nice DLL for Windows use". +pcre.dll: $(DLL_OBJS) + $(CC) -shared -o pcre.dll -Wl,"--strip-all" -Wl,"--export-all-symbols" $(DLL_OBJS) + + +# We have .pc files for pkg-config users. +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libpcre.pc +if WITH_PCRE_CPP +pkgconfig_DATA += libpcrecpp.pc +endif + +dist_man_MANS = \ + doc/pcre.3 \ + doc/pcre-config.1 \ + doc/pcre_compile.3 \ + doc/pcre_compile2.3 \ + doc/pcre_config.3 \ + doc/pcre_copy_named_substring.3 \ + doc/pcre_copy_substring.3 \ + doc/pcre_dfa_exec.3 \ + doc/pcre_exec.3 \ + doc/pcre_free_substring.3 \ + doc/pcre_free_substring_list.3 \ + doc/pcre_fullinfo.3 \ + doc/pcre_get_named_substring.3 \ + doc/pcre_get_stringnumber.3 \ + doc/pcre_get_stringtable_entries.3 \ + doc/pcre_get_substring.3 \ + doc/pcre_get_substring_list.3 \ + doc/pcre_info.3 \ + doc/pcre_maketables.3 \ + doc/pcre_refcount.3 \ + doc/pcre_study.3 \ + doc/pcre_version.3 \ + doc/pcreapi.3 \ + doc/pcrebuild.3 \ + doc/pcrecallout.3 \ + doc/pcrecompat.3 \ + doc/pcregrep.1 \ + doc/pcrematching.3 \ + doc/pcrepartial.3 \ + doc/pcrepattern.3 \ + doc/pcreperform.3 \ + doc/pcreposix.3 \ + doc/pcreprecompile.3 \ + doc/pcresample.3 \ + doc/pcrestack.3 \ + doc/pcresyntax.3 \ + doc/pcretest.1 + +pcrecpp_man = doc/pcrecpp.3 +EXTRA_DIST += $(pcrecpp_man) + +if WITH_PCRE_CPP +man_MANS = $(pcrecpp_man) +endif + +## CMake support + +EXTRA_DIST += \ + cmake/COPYING-CMAKE-SCRIPTS \ + cmake/FindPackageHandleStandardArgs.cmake \ + cmake/FindReadline.cmake \ + CMakeLists.txt \ + config-cmake.h.in + +## end Makefile.am Modified: freeswitch/trunk/libs/pcre/Makefile.in ============================================================================== --- freeswitch/trunk/libs/pcre/Makefile.in (original) +++ freeswitch/trunk/libs/pcre/Makefile.in Mon Jun 8 18:51:30 2009 @@ -1,606 +1,1430 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ -# Makefile.in for PCRE (Perl-Compatible Regular Expression) library. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + at SET_MAKE@ -############################################################################# -# PCRE is developed on a Unix system. I do not use Windows or Macs, and know -# nothing about building software on them. Although the code of PCRE should -# be very portable, the building system in this Makefile is designed for Unix -# systems. However, there are features that have been supplied to me by various -# people that should make it work on MinGW and Cygwin systems. -# This setting enables Unix-style directory scanning in pcregrep, triggered -# by the -f option. Maybe one day someone will add code for other systems. - -PCREGREP_OSTYPE=-DIS_UNIX - -############################################################################# - - -# Libtool places .o files in the .libs directory; this can mean that "make" -# thinks is it not up-to-date when in fact it is. This setting helps when -# GNU "make" is being used. It presumably does no harm in other cases. - -VPATH=.libs - - -#---------------------------------------------------------------------------# -# The following lines are modified by "configure" to insert data that it is # -# given in its arguments, or which it finds out for itself. # -#---------------------------------------------------------------------------# - -SHELL = @SHELL@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +TESTS = $(am__EXEEXT_2) RunTest RunGrepTest +bin_PROGRAMS = pcretest$(EXEEXT) pcregrep$(EXEEXT) +noinst_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) + +# These additional headers will be be installed if C++ support is enabled. We +# do not distribute pcrecpparg.h or pcre_stringpiece.h, as these are generated +# from corresponding .h.in files (which we do distribute). + at WITH_PCRE_CPP_TRUE@am__append_1 = \ + at WITH_PCRE_CPP_TRUE@ pcrecpparg.h \ + at WITH_PCRE_CPP_TRUE@ pcre_stringpiece.h + + at WITH_PCRE_CPP_TRUE@am__append_2 = \ + at WITH_PCRE_CPP_TRUE@ pcrecpp.h \ + at WITH_PCRE_CPP_TRUE@ pcre_scanner.h + + at WITH_REBUILD_CHARTABLES_TRUE@am__append_3 = dftables + at WITH_PCRE_CPP_TRUE@am__append_4 = libpcrecpp.la + at WITH_PCRE_CPP_TRUE@am__append_5 = pcrecpp_unittest \ + at WITH_PCRE_CPP_TRUE@ pcre_scanner_unittest \ + at WITH_PCRE_CPP_TRUE@ pcre_stringpiece_unittest + at WITH_PCRE_CPP_TRUE@am__append_6 = pcrecpp_unittest \ + at WITH_PCRE_CPP_TRUE@ pcre_scanner_unittest \ + at WITH_PCRE_CPP_TRUE@ pcre_stringpiece_unittest + at WITH_PCRE_CPP_TRUE@am__append_7 = libpcrecpp.pc +subdir = . +DIST_COMMON = README $(am__configure_deps) $(am__include_HEADERS_DIST) \ + $(dist_doc_DATA) $(dist_html_DATA) $(dist_man_MANS) \ + $(dist_noinst_DATA) $(dist_noinst_SCRIPTS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/config.h.in $(srcdir)/libpcre.pc.in \ + $(srcdir)/libpcrecpp.pc.in $(srcdir)/pcre-config.in \ + $(srcdir)/pcre.h.in $(srcdir)/pcre_stringpiece.h.in \ + $(srcdir)/pcrecpparg.h.in $(top_srcdir)/configure AUTHORS \ + COPYING ChangeLog INSTALL NEWS config.guess config.sub depcomp \ + install-sh ltmain.sh missing mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs - -# NB: top_builddir is not referred to directly below, but it is used in the -# setting of $(LIBTOOL), so don't remove it! - -top_builddir = . - -# BINDIR is the directory in which the pcregrep, pcretest, and pcre-config -# commands are installed. -# INCDIR is the directory in which the public header files pcre.h and -# pcreposix.h are installed. -# LIBDIR is the directory in which the libraries are installed. -# MANDIR is the directory in which the man pages are installed. - -BINDIR = @bindir@ -LIBDIR = @libdir@ -INCDIR = @includedir@ -MANDIR = @mandir@ - -# EXEEXT is set by configure to the extention of an executable file -# OBJEXT is set by configure to the extention of an object file -# The BUILD_* equivalents are the same but for the host we're building on - -EXEEXT = @EXEEXT@ -OBJEXT = @OBJEXT@ -# Note that these are just here to have a convenient place to look at the -# outcome. -BUILD_EXEEXT = @BUILD_EXEEXT@ -BUILD_OBJEXT = @BUILD_OBJEXT@ - -# POSIX_OBJ and POSIX_LOBJ are either set empty, or to the names of the -# POSIX object files. - -POSIX_OBJ = @POSIX_OBJ@ -POSIX_LOBJ = @POSIX_LOBJ@ - -# The compiler, C flags, preprocessor flags, etc - +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = libpcre.pc libpcrecpp.pc pcre-config pcre.h \ + pcre_stringpiece.h pcrecpparg.h +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ + "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(docdir)" \ + "$(DESTDIR)$(htmldir)" "$(DESTDIR)$(htmldir)" \ + "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)" \ + "$(DESTDIR)$(includedir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +libpcre_la_LIBADD = +am_libpcre_la_OBJECTS = pcre_compile.lo pcre_config.lo \ + pcre_dfa_exec.lo pcre_exec.lo pcre_fullinfo.lo pcre_get.lo \ + pcre_globals.lo pcre_info.lo pcre_maketables.lo \ + pcre_newline.lo pcre_ord2utf8.lo pcre_refcount.lo \ + pcre_study.lo pcre_tables.lo pcre_try_flipped.lo pcre_ucd.lo \ + pcre_valid_utf8.lo pcre_version.lo pcre_xclass.lo +nodist_libpcre_la_OBJECTS = pcre_chartables.lo +libpcre_la_OBJECTS = $(am_libpcre_la_OBJECTS) \ + $(nodist_libpcre_la_OBJECTS) +libpcre_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libpcre_la_LDFLAGS) $(LDFLAGS) -o $@ + at WITH_PCRE_CPP_TRUE@libpcrecpp_la_DEPENDENCIES = libpcre.la +am__libpcrecpp_la_SOURCES_DIST = pcrecpp_internal.h pcrecpp.cc \ + pcre_scanner.cc pcre_stringpiece.cc + at WITH_PCRE_CPP_TRUE@am_libpcrecpp_la_OBJECTS = pcrecpp.lo \ + at WITH_PCRE_CPP_TRUE@ pcre_scanner.lo pcre_stringpiece.lo +libpcrecpp_la_OBJECTS = $(am_libpcrecpp_la_OBJECTS) +libpcrecpp_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(libpcrecpp_la_LDFLAGS) $(LDFLAGS) -o $@ + at WITH_PCRE_CPP_TRUE@am_libpcrecpp_la_rpath = -rpath $(libdir) +libpcreposix_la_DEPENDENCIES = libpcre.la +am_libpcreposix_la_OBJECTS = pcreposix.lo +libpcreposix_la_OBJECTS = $(am_libpcreposix_la_OBJECTS) +libpcreposix_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libpcreposix_la_LDFLAGS) $(LDFLAGS) -o $@ +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) + at WITH_REBUILD_CHARTABLES_TRUE@am__EXEEXT_1 = dftables$(EXEEXT) + at WITH_PCRE_CPP_TRUE@am__EXEEXT_2 = pcrecpp_unittest$(EXEEXT) \ + at WITH_PCRE_CPP_TRUE@ pcre_scanner_unittest$(EXEEXT) \ + at WITH_PCRE_CPP_TRUE@ pcre_stringpiece_unittest$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +am__dftables_SOURCES_DIST = dftables.c + at WITH_REBUILD_CHARTABLES_TRUE@am_dftables_OBJECTS = \ + at WITH_REBUILD_CHARTABLES_TRUE@ dftables.$(OBJEXT) +dftables_OBJECTS = $(am_dftables_OBJECTS) +dftables_LDADD = $(LDADD) +am__pcre_scanner_unittest_SOURCES_DIST = pcre_scanner_unittest.cc + at WITH_PCRE_CPP_TRUE@am_pcre_scanner_unittest_OBJECTS = \ + at WITH_PCRE_CPP_TRUE@ pcre_scanner_unittest.$(OBJEXT) +pcre_scanner_unittest_OBJECTS = $(am_pcre_scanner_unittest_OBJECTS) + at WITH_PCRE_CPP_TRUE@pcre_scanner_unittest_DEPENDENCIES = \ + at WITH_PCRE_CPP_TRUE@ libpcrecpp.la +am__pcre_stringpiece_unittest_SOURCES_DIST = \ + pcre_stringpiece_unittest.cc + at WITH_PCRE_CPP_TRUE@am_pcre_stringpiece_unittest_OBJECTS = \ + at WITH_PCRE_CPP_TRUE@ pcre_stringpiece_unittest.$(OBJEXT) +pcre_stringpiece_unittest_OBJECTS = \ + $(am_pcre_stringpiece_unittest_OBJECTS) + at WITH_PCRE_CPP_TRUE@pcre_stringpiece_unittest_DEPENDENCIES = \ + at WITH_PCRE_CPP_TRUE@ libpcrecpp.la +am__pcrecpp_unittest_SOURCES_DIST = pcrecpp_unittest.cc + at WITH_PCRE_CPP_TRUE@am_pcrecpp_unittest_OBJECTS = \ + at WITH_PCRE_CPP_TRUE@ pcrecpp_unittest.$(OBJEXT) +pcrecpp_unittest_OBJECTS = $(am_pcrecpp_unittest_OBJECTS) + at WITH_PCRE_CPP_TRUE@pcrecpp_unittest_DEPENDENCIES = libpcrecpp.la +am_pcregrep_OBJECTS = pcregrep.$(OBJEXT) +pcregrep_OBJECTS = $(am_pcregrep_OBJECTS) +am__DEPENDENCIES_1 = +pcregrep_DEPENDENCIES = libpcreposix.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_pcretest_OBJECTS = pcretest.$(OBJEXT) +pcretest_OBJECTS = $(am_pcretest_OBJECTS) +pcretest_DEPENDENCIES = libpcreposix.la $(am__DEPENDENCIES_1) +binSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(bin_SCRIPTS) $(dist_noinst_SCRIPTS) +DEFAULT_INCLUDES = -I. at am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libpcre_la_SOURCES) $(nodist_libpcre_la_SOURCES) \ + $(libpcrecpp_la_SOURCES) $(libpcreposix_la_SOURCES) \ + $(dftables_SOURCES) $(pcre_scanner_unittest_SOURCES) \ + $(pcre_stringpiece_unittest_SOURCES) \ + $(pcrecpp_unittest_SOURCES) $(pcregrep_SOURCES) \ + $(pcretest_SOURCES) +DIST_SOURCES = $(libpcre_la_SOURCES) $(am__libpcrecpp_la_SOURCES_DIST) \ + $(libpcreposix_la_SOURCES) $(am__dftables_SOURCES_DIST) \ + $(am__pcre_scanner_unittest_SOURCES_DIST) \ + $(am__pcre_stringpiece_unittest_SOURCES_DIST) \ + $(am__pcrecpp_unittest_SOURCES_DIST) $(pcregrep_SOURCES) \ + $(pcretest_SOURCES) +man1dir = $(mandir)/man1 +man3dir = $(mandir)/man3 +NROFF = nroff +MANS = $(dist_man_MANS) $(man_MANS) +dist_docDATA_INSTALL = $(INSTALL_DATA) +dist_htmlDATA_INSTALL = $(INSTALL_DATA) +htmlDATA_INSTALL = $(INSTALL_DATA) +pkgconfigDATA_INSTALL = $(INSTALL_DATA) +DATA = $(dist_doc_DATA) $(dist_html_DATA) $(dist_noinst_DATA) \ + $(html_DATA) $(pkgconfig_DATA) +am__include_HEADERS_DIST = pcreposix.h pcrecpp.h pcre_scanner.h +includeHEADERS_INSTALL = $(INSTALL_HEADER) +nodist_includeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(include_HEADERS) $(nodist_include_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 $(distdir).zip +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ CC = @CC@ -CXX = @CXX@ +CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ -LDFLAGS = @LDFLAGS@ -CXXLDFLAGS = @CXXLDFLAGS@ - -CC_FOR_BUILD = @CC_FOR_BUILD@ -CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ -CXX_FOR_BUILD = @CXX_FOR_BUILD@ -CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@ -LDFLAGS_FOR_BUILD = $(LDFLAGS) - -UCP = @UCP@ -UTF8 = @UTF8@ -NEWLINE = @NEWLINE@ -POSIX_MALLOC_THRESHOLD = @POSIX_MALLOC_THRESHOLD@ -LINK_SIZE = @LINK_SIZE@ -MATCH_LIMIT = @MATCH_LIMIT@ @MATCH_LIMIT_RECURSION@ -NO_RECURSE = @NO_RECURSE@ -EBCDIC = @EBCDIC@ - +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +EXTRA_LIBPCRECPP_LDFLAGS = @EXTRA_LIBPCRECPP_LDFLAGS@ +EXTRA_LIBPCREPOSIX_LDFLAGS = @EXTRA_LIBPCREPOSIX_LDFLAGS@ +EXTRA_LIBPCRE_LDFLAGS = @EXTRA_LIBPCRE_LDFLAGS@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ - -# LIBTOOL enables the building of shared and static libraries. It is set up -# to do one or the other or both by ./configure. - +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBBZ2 = @LIBBZ2@ +LIBOBJS = @LIBOBJS@ +LIBREADLINE = @LIBREADLINE@ +LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) -I. -I$(top_srcdir) $(NEWLINE) $(LINK_SIZE) $(MATCH_LIMIT) $(NO_RECURSE) $(EBCDIC) -LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) -c $(CXXFLAGS) -I. -I$(top_srcdir) $(NEWLINE) $(LINK_SIZE) $(MATCH_LIMIT) $(NO_RECURSE) $(EBCDIC) - at ON_WINDOWS@LINK = $(CC) $(LDFLAGS) -I. -I$(top_srcdir) -L.libs - at NOT_ON_WINDOWS@LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -I. -I$(top_srcdir) -LINKLIB = $(LIBTOOL) --mode=link $(CC) -export-symbols-regex '^[^_]' $(LDFLAGS) -I. -I$(top_srcdir) -LINK_FOR_BUILD = $(LIBTOOL) --mode=link --tag=CC $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -I. -I$(top_srcdir) - at ON_WINDOWS@CXXLINK = $(CXX) $(LDFLAGS) -I. -I$(top_srcdir) -L.libs - at NOT_ON_WINDOWS@CXXLINK = $(LIBTOOL) --mode=link $(CXX) $(CXXFLAGS) $(CXXLDFLAGS) -I. -I$(top_srcdir) -CXXLINKLIB = $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -I. -I$(top_srcdir) - -# These are the version numbers for the shared libraries - -PCRELIBVERSION = @PCRE_LIB_VERSION@ -PCREPOSIXLIBVERSION = @PCRE_POSIXLIB_VERSION@ -PCRECPPLIBVERSION = @PCRE_CPPLIB_VERSION@ - -############################################################################## - - -OBJ = pcre_chartables. at OBJEXT@ \ - pcre_compile. at OBJEXT@ \ - pcre_config. at OBJEXT@ \ - pcre_dfa_exec. at OBJEXT@ \ - pcre_exec. at OBJEXT@ \ - pcre_fullinfo. at OBJEXT@ \ - pcre_get. at OBJEXT@ \ - pcre_globals. at OBJEXT@ \ - pcre_info. at OBJEXT@ \ - pcre_maketables. at OBJEXT@ \ - pcre_ord2utf8. at OBJEXT@ \ - pcre_refcount. at OBJEXT@ \ - pcre_study. at OBJEXT@ \ - pcre_tables. at OBJEXT@ \ - pcre_try_flipped. at OBJEXT@ \ - pcre_ucp_searchfuncs. at OBJEXT@ \ - pcre_valid_utf8. at OBJEXT@ \ - pcre_version. at OBJEXT@ \ - pcre_xclass. at OBJEXT@ \ - $(POSIX_OBJ) - -LOBJ = pcre_chartables.lo \ - pcre_compile.lo \ - pcre_config.lo \ - pcre_dfa_exec.lo \ - pcre_exec.lo \ - pcre_fullinfo.lo \ - pcre_get.lo \ - pcre_globals.lo \ - pcre_info.lo \ - pcre_maketables.lo \ - pcre_ord2utf8.lo \ - pcre_refcount.lo \ - pcre_study.lo \ - pcre_tables.lo \ - pcre_try_flipped.lo \ - pcre_ucp_searchfuncs.lo \ - pcre_valid_utf8.lo \ - pcre_version.lo \ - pcre_xclass.lo \ - $(POSIX_LOBJ) - -CPPOBJ = pcrecpp. at OBJEXT@ \ - pcre_scanner. at OBJEXT@ \ - pcre_stringpiece. at OBJEXT@ - -CPPLOBJ = pcrecpp.lo \ - pcre_scanner.lo \ - pcre_stringpiece.lo - -CPP_TARGETS = libpcrecpp.la \ - pcrecpp_unittest at EXEEXT@ \ - pcre_scanner_unittest at EXEEXT@ \ - pcre_stringpiece_unittest at EXEEXT@ - -all: libpcre.la @POSIX_LIB@ pcretest at EXEEXT@ pcregrep at EXEEXT@ \ - @MAYBE_CPP_TARGETS@ @ON_WINDOWS@ winshared - -pcregrep at EXEEXT@: libpcre.la pcregrep. at OBJEXT@ @ON_WINDOWS@ winshared - $(LINK) -o pcregrep at EXEEXT@ pcregrep. at OBJEXT@ libpcre.la - -pcretest at EXEEXT@: libpcre.la @POSIX_LIB@ pcretest. at OBJEXT@ \ - @ON_WINDOWS@ winshared - $(LINK) $(PURIFY) $(EFENCE) -o pcretest at EXEEXT@ \ - pcretest. at OBJEXT@ \ - libpcre.la @POSIX_LIB@ - -pcrecpp_unittest at EXEEXT@: libpcrecpp.la pcrecpp_unittest. at OBJEXT@ \ - @ON_WINDOWS@ winshared - $(CXXLINK) $(PURIFY) $(EFENCE) -o pcrecpp_unittest at EXEEXT@ \ - pcrecpp_unittest. at OBJEXT@ \ - libpcrecpp.la @POSIX_LIB@ - -pcre_scanner_unittest at EXEEXT@: libpcrecpp.la pcre_scanner_unittest. at OBJEXT@ \ - @ON_WINDOWS@ winshared - $(CXXLINK) $(PURIFY) $(EFENCE) \ - -o pcre_scanner_unittest at EXEEXT@ \ - pcre_scanner_unittest. at OBJEXT@ \ - libpcrecpp.la @POSIX_LIB@ - -pcre_stringpiece_unittest at EXEEXT@: libpcrecpp.la \ - pcre_stringpiece_unittest. at OBJEXT@ @ON_WINDOWS@ winshared - $(CXXLINK) $(PURIFY) $(EFENCE) \ - -o pcre_stringpiece_unittest at EXEEXT@ \ - pcre_stringpiece_unittest. at OBJEXT@ \ - libpcrecpp.la @POSIX_LIB@ - -libpcre.la: $(OBJ) - -rm -f libpcre.la - $(LINKLIB) -rpath $(LIBDIR) -version-info \ - '$(PCRELIBVERSION)' -o libpcre.la $(LOBJ) - -libpcreposix.la: libpcre.la pcreposix. at OBJEXT@ - -rm -f libpcreposix.la - $(LINKLIB) -rpath $(LIBDIR) libpcre.la -version-info \ - '$(PCREPOSIXLIBVERSION)' -o libpcreposix.la pcreposix.lo - -libpcrecpp.la: libpcre.la $(CPPOBJ) - -rm -f libpcrecpp.la - $(CXXLINKLIB) -rpath $(LIBDIR) libpcre.la -version-info \ - '$(PCRECPPLIBVERSION)' -o libpcrecpp.la $(CPPLOBJ) - -# Note that files generated by ./configure and by dftables are in the current -# directory, not the source directory. - -pcre_chartables. at OBJEXT@: pcre_chartables.c - @$(LTCOMPILE) pcre_chartables.c - -pcre_compile. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_compile.c \ - $(top_srcdir)/pcre_printint.src - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_compile.c - -pcre_config. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_config.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_config.c - -pcre_dfa_exec. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_dfa_exec.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_dfa_exec.c - -pcre_exec. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_exec.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_exec.c - -pcre_fullinfo. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_fullinfo.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_fullinfo.c - -pcre_get. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_get.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_get.c - -pcre_globals. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_globals.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_globals.c - -pcre_info. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_info.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_info.c - -pcre_maketables. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_maketables.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_maketables.c - -pcre_ord2utf8. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_ord2utf8.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_ord2utf8.c - -pcre_refcount. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_refcount.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_refcount.c - -pcre_study. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_study.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_study.c - -pcre_tables. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_tables.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_tables.c - -pcre_try_flipped. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_try_flipped.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_try_flipped.c - -pcre_ucp_searchfuncs. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h \ - $(top_srcdir)/pcre_ucp_searchfuncs.c \ - $(top_srcdir)/ucptable.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_ucp_searchfuncs.c - -pcre_valid_utf8. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_valid_utf8.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_valid_utf8.c - -pcre_version. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_version.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_version.c - -pcre_xclass. at OBJEXT@: Makefile config.h $(top_srcdir)/pcre.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre_xclass.c - @$(LTCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_xclass.c - -pcreposix. at OBJEXT@: $(top_srcdir)/pcreposix.c $(top_srcdir)/pcreposix.h \ - $(top_srcdir)/pcre_internal.h $(top_srcdir)/pcre.h config.h Makefile - @$(LTCOMPILE) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcreposix.c - -pcrecpp. at OBJEXT@: $(top_srcdir)/pcrecpp.cc $(top_srcdir)/pcrecpp.h \ - pcrecpparg.h pcre_stringpiece.h $(top_srcdir)/pcre.h config.h Makefile - @$(LTCXXCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcrecpp.cc - -pcre_scanner. at OBJEXT@: $(top_srcdir)/pcre_scanner.cc \ - $(top_srcdir)/pcre_scanner.h \ - $(top_srcdir)/pcrecpp.h pcrecpparg.h pcre_stringpiece.h \ - $(top_srcdir)/pcre.h config.h Makefile - @$(LTCXXCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_scanner.cc - -pcre_stringpiece. at OBJEXT@: $(top_srcdir)/pcre_stringpiece.cc \ - pcre_stringpiece.h \ - config.h Makefile - @$(LTCXXCOMPILE) $(UTF8) $(UCP) $(POSIX_MALLOC_THRESHOLD) \ - $(top_srcdir)/pcre_stringpiece.cc - -pcretest. at OBJEXT@: $(top_srcdir)/pcretest.c $(top_srcdir)/pcre_internal.h \ - $(top_srcdir)/pcre_printint.src $(top_srcdir)/pcre.h config.h Makefile - $(CC) -c $(CFLAGS) -I. -I$(top_srcdir) $(UTF8) $(UCP) \ - $(LINK_SIZE) $(top_srcdir)/pcretest.c - -pcrecpp_unittest. at OBJEXT@: $(top_srcdir)/pcrecpp_unittest.cc \ - $(top_srcdir)/pcrecpp.h \ - pcrecpparg.h pcre_stringpiece.h $(top_srcdir)/pcre.h config.h Makefile - $(CXX) -c $(CXXFLAGS) -I. -I$(top_srcdir) $(UTF8) $(UCP) \ - $(LINK_SIZE) $(top_srcdir)/pcrecpp_unittest.cc - -pcre_stringpiece_unittest. at OBJEXT@: $(top_srcdir)/pcre_stringpiece_unittest.cc \ - pcre_stringpiece.h pcrecpparg.h config.h Makefile - $(CXX) -c $(CXXFLAGS) -I. -I$(top_srcdir) $(UTF8) $(UCP) \ - $(LINK_SIZE) $(top_srcdir)/pcre_stringpiece_unittest.cc - -pcre_scanner_unittest. at OBJEXT@: $(top_srcdir)/pcre_scanner_unittest.cc \ - $(top_srcdir)/pcre_scanner.h \ - $(top_srcdir)/pcrecpp.h pcre_stringpiece.h \ - $(top_srcdir)/pcre.h pcrecpparg.h config.h Makefile - $(CXX) -c $(CXXFLAGS) -I. -I$(top_srcdir) $(UTF8) $(UCP) \ - $(LINK_SIZE) $(top_srcdir)/pcre_scanner_unittest.cc - -pcregrep. at OBJEXT@: $(top_srcdir)/pcregrep.c $(top_srcdir)/pcre.h Makefile config.h - $(CC) -c $(CFLAGS) -I. -I$(top_srcdir) $(UTF8) $(UCP) \ - $(PCREGREP_OSTYPE) $(top_srcdir)/pcregrep.c - -# Some Windows-specific targets for MinGW. Do not use for Cygwin. - -winshared : .libs/@WIN_PREFIX at pcre.dll .libs/@WIN_PREFIX at pcreposix.dll \ - .libs/@WIN_PREFIX at pcrecpp.dll - -.libs/@WIN_PREFIX at pcre.dll : libpcre.la - $(CC) $(CFLAGS) -shared -o $@ \ - -Wl,--whole-archive .libs/libpcre.a \ - -Wl,--out-implib,.libs/libpcre.dll.a \ - -Wl,--output-def,.libs/@WIN_PREFIX at pcre.dll-def \ - -Wl,--export-all-symbols \ - -Wl,--no-whole-archive - sed -e "s#dlname=''#dlname='../bin/@WIN_PREFIX at pcre.dll'#" \ - -e "s#library_names=''#library_names='libpcre.dll.a'#" \ - < .libs/libpcre.lai > .libs/libpcre.lai.tmp && \ - mv -f .libs/libpcre.lai.tmp .libs/libpcre.lai - sed -e "s#dlname=''#dlname='../bin/@WIN_PREFIX at pcre.dll'#" \ - -e "s#library_names=''#library_names='libpcre.dll.a'#" \ - < libpcre.la > libpcre.la.tmp && \ - mv -f libpcre.la.tmp libpcre.la - - -.libs/@WIN_PREFIX at pcreposix.dll: libpcreposix.la libpcre.la - $(CC) $(CFLAGS) -shared -o $@ \ - -Wl,--whole-archive .libs/libpcreposix.a \ - -Wl,--out-implib,.libs/@WIN_PREFIX at pcreposix.dll.a \ - -Wl,--output-def,.libs/@WIN_PREFIX at libpcreposix.dll-def \ - -Wl,--export-all-symbols \ - -Wl,--no-whole-archive .libs/libpcre.a - sed -e "s#dlname=''#dlname='../bin/@WIN_PREFIX at pcreposix.dll'#" \ - -e "s#library_names=''#library_names='libpcreposix.dll.a'#"\ - < .libs/libpcreposix.lai > .libs/libpcreposix.lai.tmp && \ - mv -f .libs/libpcreposix.lai.tmp .libs/libpcreposix.lai - sed -e "s#dlname=''#dlname='../bin/@WIN_PREFIX at pcreposix.dll'#" \ - -e "s#library_names=''#library_names='libpcreposix.dll.a'#"\ - < libpcreposix.la > libpcreposix.la.tmp && \ - mv -f libpcreposix.la.tmp libpcreposix.la - -.libs/@WIN_PREFIX at pcrecpp.dll: libpcrecpp.la libpcre.la - $(CXX) $(CXXFLAGS) -shared -o $@ \ - -Wl,--whole-archive .libs/libpcrecpp.a \ - -Wl,--out-implib,.libs/@WIN_PREFIX at pcrecpp.dll.a \ - -Wl,--output-def,.libs/@WIN_PREFIX at libpcrecpp.dll-def \ - -Wl,--export-all-symbols \ - -Wl,--no-whole-archive .libs/libpcre.a - sed -e "s#dlname=''#dlname='../bin/@WIN_PREFIX at pcrecpp.dll'#" \ - -e "s#library_names=''#library_names='libpcrecpp.dll.a'#"\ - < .libs/libpcrecpp.lai > .libs/libpcrecpp.lai.tmp && \ - mv -f .libs/libpcrecpp.lai.tmp .libs/libpcrecpp.lai - sed -e "s#dlname=''#dlname='../bin/@WIN_PREFIX at pcrecpp.dll'#" \ - -e "s#library_names=''#library_names='libpcrecpp.dll.a'#"\ - < libpcrecpp.la > libpcrecpp.la.tmp && \ - mv -f libpcrecpp.la.tmp libpcrecpp.la - - -wininstall : winshared - $(mkinstalldirs) $(DESTDIR)$(LIBDIR) - $(mkinstalldirs) $(DESTDIR)$(BINDIR) - $(INSTALL) .libs/@WIN_PREFIX at pcre.dll $(DESTDIR)$(BINDIR)/@WIN_PREFIX at pcre.dll - $(INSTALL) .libs/@WIN_PREFIX at pcreposix.dll $(DESTDIR)$(BINDIR)/@WIN_PREFIX at pcreposix.dll - $(INSTALL) .libs/@WIN_PREFIX at libpcreposix.dll.a $(DESTDIR)$(LIBDIR)/@WIN_PREFIX at libpcreposix.dll.a - $(INSTALL) .libs/@WIN_PREFIX at libpcre.dll.a $(DESTDIR)$(LIBDIR)/@WIN_PREFIX at libpcre.dll.a - at HAVE_CPP@ $(INSTALL) .libs/@WIN_PREFIX at pcrecpp.dll $(DESTDIR)$(BINDIR)/@WIN_PREFIX at pcrecpp.dll - at HAVE_CPP@ $(INSTALL) .libs/@WIN_PREFIX at libpcrecpp.dll.a $(DESTDIR)$(LIBDIR)/@WIN_PREFIX at libpcrecpp.dll.a - -strip -g $(DESTDIR)$(BINDIR)/@WIN_PREFIX at pcre.dll - -strip -g $(DESTDIR)$(BINDIR)/@WIN_PREFIX at pcreposix.dll - at HAVE_CPP@ -strip -g $(DESTDIR)$(BINDIR)/@WIN_PREFIX at pcrecpp.dll - -strip $(DESTDIR)$(BINDIR)/pcregrep at EXEEXT@ - -strip $(DESTDIR)$(BINDIR)/pcretest at EXEEXT@ - -# An auxiliary program makes the default character table source. This is put -# in the current directory, NOT the $top_srcdir directory. - -pcre_chartables.c: dftables at BUILD_EXEEXT@ - ./dftables at BUILD_EXEEXT@ pcre_chartables.c - -dftables. at BUILD_OBJEXT@: $(top_srcdir)/dftables.c \ - $(top_srcdir)/pcre_maketables.c $(top_srcdir)/pcre_internal.h \ - $(top_srcdir)/pcre.h config.h Makefile - $(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) -I. $(top_srcdir)/dftables.c - -dftables at BUILD_EXEEXT@: dftables. at BUILD_OBJEXT@ - $(LINK_FOR_BUILD) -o dftables at BUILD_EXEEXT@ dftables. at OBJEXT@ - -install: all @ON_WINDOWS@ wininstall - at NOT_ON_WINDOWS@ $(mkinstalldirs) $(DESTDIR)$(LIBDIR) - at NOT_ON_WINDOWS@ echo "$(LIBTOOL) --mode=install $(INSTALL) libpcre.la $(DESTDIR)$(LIBDIR)/libpcre.la" - at NOT_ON_WINDOWS@ $(LIBTOOL) --mode=install $(INSTALL) libpcre.la $(DESTDIR)$(LIBDIR)/libpcre.la - at NOT_ON_WINDOWS@ echo "$(LIBTOOL) --mode=install $(INSTALL) libpcreposix.la $(DESTDIR)$(LIBDIR)/libpcreposix.la" - at NOT_ON_WINDOWS@ $(LIBTOOL) --mode=install $(INSTALL) libpcreposix.la $(DESTDIR)$(LIBDIR)/libpcreposix.la - at NOT_ON_WINDOWS@@HAVE_CPP@ echo "$(LIBTOOL) --mode=install $(INSTALL) libpcrecpp.la $(DESTDIR)$(LIBDIR)/libpcrecpp.la" - at NOT_ON_WINDOWS@@HAVE_CPP@ $(LIBTOOL) --mode=install $(INSTALL) libpcrecpp.la $(DESTDIR)$(LIBDIR)/libpcrecpp.la - at NOT_ON_WINDOWS@ $(LIBTOOL) --finish $(DESTDIR)$(LIBDIR) - $(mkinstalldirs) $(DESTDIR)$(INCDIR) - $(INSTALL_DATA) $(top_srcdir)/pcre.h $(DESTDIR)$(INCDIR)/pcre.h - $(INSTALL_DATA) $(top_srcdir)/pcreposix.h $(DESTDIR)$(INCDIR)/pcreposix.h - at HAVE_CPP@ $(INSTALL_DATA) $(top_srcdir)/pcrecpp.h $(DESTDIR)$(INCDIR)/pcrecpp.h - at HAVE_CPP@ $(INSTALL_DATA) pcrecpparg.h $(DESTDIR)$(INCDIR)/pcrecpparg.h - at HAVE_CPP@ $(INSTALL_DATA) pcre_stringpiece.h $(DESTDIR)$(INCDIR)/pcre_stringpiece.h - at HAVE_CPP@ $(INSTALL_DATA) $(top_srcdir)/pcre_scanner.h $(DESTDIR)$(INCDIR)/pcre_scanner.h - $(mkinstalldirs) $(DESTDIR)$(MANDIR)/man3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre.3 $(DESTDIR)$(MANDIR)/man3/pcre.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcreapi.3 $(DESTDIR)$(MANDIR)/man3/pcreapi.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcrebuild.3 $(DESTDIR)$(MANDIR)/man3/pcrebuild.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcrecallout.3 $(DESTDIR)$(MANDIR)/man3/pcrecallout.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcrecompat.3 $(DESTDIR)$(MANDIR)/man3/pcrecompat.3 - at HAVE_CPP@ $(INSTALL_DATA) $(top_srcdir)/doc/pcrecpp.3 $(DESTDIR)$(MANDIR)/man3/pcrecpp.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcrematching.3 $(DESTDIR)$(MANDIR)/man3/pcrematching.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcrepartial.3 $(DESTDIR)$(MANDIR)/man3/pcrepartial.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcrepattern.3 $(DESTDIR)$(MANDIR)/man3/pcrepattern.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcreperform.3 $(DESTDIR)$(MANDIR)/man3/pcreperform.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcreposix.3 $(DESTDIR)$(MANDIR)/man3/pcreposix.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcreprecompile.3 $(DESTDIR)$(MANDIR)/man3/pcreprecompile.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcresample.3 $(DESTDIR)$(MANDIR)/man3/pcresample.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcrestack.3 $(DESTDIR)$(MANDIR)/man3/pcrestack.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_compile.3 $(DESTDIR)$(MANDIR)/man3/pcre_compile.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_compile2.3 $(DESTDIR)$(MANDIR)/man3/pcre_compile2.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_config.3 $(DESTDIR)$(MANDIR)/man3/pcre_config.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_copy_named_substring.3 $(DESTDIR)$(MANDIR)/man3/pcre_copy_named_substring.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_copy_substring.3 $(DESTDIR)$(MANDIR)/man3/pcre_copy_substring.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_dfa_exec.3 $(DESTDIR)$(MANDIR)/man3/pcre_dfa_exec.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_exec.3 $(DESTDIR)$(MANDIR)/man3/pcre_exec.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_free_substring.3 $(DESTDIR)$(MANDIR)/man3/pcre_free_substring.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_free_substring_list.3 $(DESTDIR)$(MANDIR)/man3/pcre_free_substring_list.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_fullinfo.3 $(DESTDIR)$(MANDIR)/man3/pcre_fullinfo.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_get_named_substring.3 $(DESTDIR)$(MANDIR)/man3/pcre_get_named_substring.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_get_stringnumber.3 $(DESTDIR)$(MANDIR)/man3/pcre_get_stringnumber.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_get_stringtable_entries.3 $(DESTDIR)$(MANDIR)/man3/pcre_get_stringtable_entries.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_get_substring.3 $(DESTDIR)$(MANDIR)/man3/pcre_get_substring.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_get_substring_list.3 $(DESTDIR)$(MANDIR)/man3/pcre_get_substring_list.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_info.3 $(DESTDIR)$(MANDIR)/man3/pcre_info.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_maketables.3 $(DESTDIR)$(MANDIR)/man3/pcre_maketables.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_refcount.3 $(DESTDIR)$(MANDIR)/man3/pcre_refcount.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_study.3 $(DESTDIR)$(MANDIR)/man3/pcre_study.3 - $(INSTALL_DATA) $(top_srcdir)/doc/pcre_version.3 $(DESTDIR)$(MANDIR)/man3/pcre_version.3 - $(mkinstalldirs) $(DESTDIR)$(MANDIR)/man1 - $(INSTALL_DATA) $(top_srcdir)/doc/pcregrep.1 $(DESTDIR)$(MANDIR)/man1/pcregrep.1 - $(INSTALL_DATA) $(top_srcdir)/doc/pcretest.1 $(DESTDIR)$(MANDIR)/man1/pcretest.1 - $(mkinstalldirs) $(DESTDIR)$(BINDIR) - $(LIBTOOL) --mode=install $(INSTALL) pcregrep at EXEEXT@ $(DESTDIR)$(BINDIR)/pcregrep at EXEEXT@ - $(LIBTOOL) --mode=install $(INSTALL) pcretest at EXEEXT@ $(DESTDIR)$(BINDIR)/pcretest at EXEEXT@ - $(INSTALL) pcre-config $(DESTDIR)$(BINDIR)/pcre-config - $(mkinstalldirs) $(DESTDIR)$(LIBDIR)/pkgconfig - $(INSTALL_DATA) libpcre.pc $(DESTDIR)$(LIBDIR)/pkgconfig/libpcre.pc - -# The uninstall target removes all the files that were installed. - -uninstall:; -rm -rf \ - $(DESTDIR)$(LIBDIR)/libpcre.* \ - $(DESTDIR)$(LIBDIR)/libpcreposix.* \ - $(DESTDIR)$(LIBDIR)/libpcrecpp.* \ - $(DESTDIR)$(INCDIR)/pcre.h \ - $(DESTDIR)$(INCDIR)/pcreposix.h \ - $(DESTDIR)$(INCDIR)/pcrecpp.h \ - $(DESTDIR)$(INCDIR)/pcrecpparg.h \ - $(DESTDIR)$(INCDIR)/pcre_scanner.h \ - $(DESTDIR)$(INCDIR)/pcre_stringpiece.h \ - $(DESTDIR)$(MANDIR)/man3/pcre.3 \ - $(DESTDIR)$(MANDIR)/man3/pcreapi.3 \ - $(DESTDIR)$(MANDIR)/man3/pcrebuild.3 \ - $(DESTDIR)$(MANDIR)/man3/pcrecallout.3 \ - $(DESTDIR)$(MANDIR)/man3/pcrecompat.3 \ - $(DESTDIR)$(MANDIR)/man3/pcrecpp.3 \ - $(DESTDIR)$(MANDIR)/man3/pcrematching.3 \ - $(DESTDIR)$(MANDIR)/man3/pcrepartial.3 \ - $(DESTDIR)$(MANDIR)/man3/pcrepattern.3 \ - $(DESTDIR)$(MANDIR)/man3/pcreperform.3 \ - $(DESTDIR)$(MANDIR)/man3/pcreposix.3 \ - $(DESTDIR)$(MANDIR)/man3/pcreprecompile.3 \ - $(DESTDIR)$(MANDIR)/man3/pcresample.3 \ - $(DESTDIR)$(MANDIR)/man3/pcrestack.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_compile.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_compile2.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_config.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_copy_named_substring.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_copy_substring.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_dfa_exec.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_exec.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_free_substring.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_free_substring_list.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_fullinfo.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_get_named_substring.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_get_stringnumber.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_get_stringtable_entries.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_get_substring.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_get_substring_list.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_info.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_maketables.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_refcount.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_study.3 \ - $(DESTDIR)$(MANDIR)/man3/pcre_version.3 \ - $(DESTDIR)$(MANDIR)/man1/pcregrep.1 \ - $(DESTDIR)$(MANDIR)/man1/pcretest.1 \ - $(DESTDIR)$(BINDIR)/pcregrep at EXEEXT@ \ - $(DESTDIR)$(BINDIR)/pcretest at EXEEXT@ \ - $(DESTDIR)$(BINDIR)/pcre-config \ - $(DESTDIR)$(LIBDIR)/pkgconfig/libpcre.pc - -# We deliberately omit dftables and pcre_chartables.c from 'make clean'; once -# made pcre_chartables.c shouldn't change, and if people have edited the tables -# by hand, you don't want to throw them away. - -clean:; -rm -rf *. at OBJEXT@ *.lo *.a *.la .libs pcretest at EXEEXT@ pcre_stringpiece_unittest at EXEEXT@ pcrecpp_unittest at EXEEXT@ pcre_scanner_unittest at EXEEXT@ pcregrep at EXEEXT@ testtry - -# But "make distclean" should get back to a virgin distribution - -distclean: clean - -rm -f pcre_chartables.c libtool pcre-config libpcre.pc \ - pcre_stringpiece.h pcrecpparg.h \ - dftables at EXEEXT@ RunGrepTest RunTest \ - Makefile config.h config.status config.log config.cache - -check: runtest - - at WIN_PREFIX@pcre.dll : winshared - cp .libs/@WIN_PREFIX at pcre.dll . - -test: runtest - -runtest: all @ON_WINDOWS@ @WIN_PREFIX at pcre.dll - @./RunTest - @./RunGrepTest - at HAVE_CPP@ @echo "" - at HAVE_CPP@ @echo "Testing C++ wrapper" - at HAVE_CPP@ @echo ""; echo "Test 1++: stringpiece" - at HAVE_CPP@ @./pcre_stringpiece_unittest at EXEEXT@ - at HAVE_CPP@ @echo ""; echo "Test 2++: RE class" - at HAVE_CPP@ @./pcrecpp_unittest at EXEEXT@ - at HAVE_CPP@ @echo ""; echo "Test 3++: Scanner class" - at HAVE_CPP@ @./pcre_scanner_unittest at EXEEXT@ - -# End +LIBZ = @LIBZ@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCRE_DATE = @PCRE_DATE@ +PCRE_MAJOR = @PCRE_MAJOR@ +PCRE_MINOR = @PCRE_MINOR@ +PCRE_PRERELEASE = @PCRE_PRERELEASE@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pcre_have_bits_type_traits = @pcre_have_bits_type_traits@ +pcre_have_long_long = @pcre_have_long_long@ +pcre_have_type_traits = @pcre_have_type_traits@ +pcre_have_ulong_long = @pcre_have_ulong_long@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +dist_doc_DATA = \ + doc/pcre.txt \ + doc/pcre-config.txt \ + doc/pcregrep.txt \ + doc/pcretest.txt \ + AUTHORS \ + COPYING \ + ChangeLog \ + LICENCE \ + NEWS \ + README + +dist_html_DATA = \ + doc/html/index.html \ + doc/html/pcre.html \ + doc/html/pcre-config.html \ + doc/html/pcre_compile.html \ + doc/html/pcre_compile2.html \ + doc/html/pcre_config.html \ + doc/html/pcre_copy_named_substring.html \ + doc/html/pcre_copy_substring.html \ + doc/html/pcre_dfa_exec.html \ + doc/html/pcre_exec.html \ + doc/html/pcre_free_substring.html \ + doc/html/pcre_free_substring_list.html \ + doc/html/pcre_fullinfo.html \ + doc/html/pcre_get_named_substring.html \ + doc/html/pcre_get_stringnumber.html \ + doc/html/pcre_get_stringtable_entries.html \ + doc/html/pcre_get_substring.html \ + doc/html/pcre_get_substring_list.html \ + doc/html/pcre_info.html \ + doc/html/pcre_maketables.html \ + doc/html/pcre_refcount.html \ + doc/html/pcre_study.html \ + doc/html/pcre_version.html \ + doc/html/pcreapi.html \ + doc/html/pcrebuild.html \ + doc/html/pcrecallout.html \ + doc/html/pcrecompat.html \ + doc/html/pcregrep.html \ + doc/html/pcrematching.html \ + doc/html/pcrepartial.html \ + doc/html/pcrepattern.html \ + doc/html/pcreperform.html \ + doc/html/pcreposix.html \ + doc/html/pcreprecompile.html \ + doc/html/pcresample.html \ + doc/html/pcrestack.html \ + doc/html/pcresyntax.html \ + doc/html/pcretest.html + +pcrecpp_html = doc/html/pcrecpp.html +dist_noinst_DATA = $(pcrecpp_html) + at WITH_PCRE_CPP_TRUE@html_DATA = $(pcrecpp_html) + +# The Libtool libraries to install. We'll add to this later. +lib_LTLIBRARIES = libpcre.la libpcreposix.la $(am__append_4) +check_SCRIPTS = +dist_noinst_SCRIPTS = RunTest RunGrepTest + +# Additional files to delete on 'make clean' and 'make maintainer-clean'. +CLEANFILES = pcre_chartables.c testsavedregex teststderr testtry \ + testNinput +MAINTAINERCLEANFILES = pcre.h.generic + +# Additional files to bundle with the distribution, over and above what +# the Autotools include by default. + +# These files contain maintenance information + +# These files are used in the preparation of a release + +# These files are to do with building for Virtual Pascal + +# These files are usable versions of pcre.h and config.h that are distributed +# for the benefit of people who are building PCRE manually, without the +# Autotools support. + +# The pcre_printint.src file is #included by some source files, so it must be +# distributed. The pcre_chartables.c.dist file is the default version of +# pcre_chartables.c, used unless --enable-rebuild-chartables is specified. + +# PCRE demonstration program. No longer built automatcally. The point is that +# the users should build it themselves. So just distribute the source. +# noinst_PROGRAMS += pcredemo +# pcredemo_SOURCES = pcredemo.c +# pcredemo_LDADD = libpcre.la +EXTRA_DIST = doc/perltest.txt NON-UNIX-USE HACKING PrepareRelease \ + CleanTxt Detrail 132html doc/index.html.src makevp.bat \ + makevp_c.txt makevp_l.txt pcregexp.pas pcre.h.generic \ + config.h.generic pcre_printint.src pcre_chartables.c.dist \ + RunTest.bat testdata/grepinput testdata/grepinput8 \ + testdata/grepinputv testdata/grepinputx testdata/greplist \ + testdata/grepoutput testdata/grepoutput8 testdata/grepoutputN \ + testdata/testinput1 testdata/testinput2 testdata/testinput3 \ + testdata/testinput4 testdata/testinput5 testdata/testinput6 \ + testdata/testinput7 testdata/testinput8 testdata/testinput9 \ + testdata/testinput10 testdata/testoutput1 testdata/testoutput2 \ + testdata/testoutput3 testdata/testoutput4 testdata/testoutput5 \ + testdata/testoutput6 testdata/testoutput7 testdata/testoutput8 \ + testdata/testoutput9 testdata/testoutput10 \ + testdata/wintestinput3 testdata/wintestoutput3 perltest.pl \ + pcredemo.c $(pcrecpp_man) cmake/COPYING-CMAKE-SCRIPTS \ + cmake/FindPackageHandleStandardArgs.cmake \ + cmake/FindReadline.cmake CMakeLists.txt config-cmake.h.in + +# These are the header files we'll install. We do not distribute pcre.h because +# it is generated from pcre.h.in. +nodist_include_HEADERS = pcre.h $(am__append_1) +include_HEADERS = pcreposix.h $(am__append_2) +bin_SCRIPTS = pcre-config + at WITH_REBUILD_CHARTABLES_TRUE@dftables_SOURCES = dftables.c +libpcre_la_SOURCES = \ + pcre_compile.c \ + pcre_config.c \ + pcre_dfa_exec.c \ + pcre_exec.c \ + pcre_fullinfo.c \ + pcre_get.c \ + pcre_globals.c \ + pcre_info.c \ + pcre_internal.h \ + pcre_maketables.c \ + pcre_newline.c \ + pcre_ord2utf8.c \ + pcre_refcount.c \ + pcre_study.c \ + pcre_tables.c \ + pcre_try_flipped.c \ + pcre_ucd.c \ + pcre_valid_utf8.c \ + pcre_version.c \ + pcre_xclass.c \ + ucp.h + +nodist_libpcre_la_SOURCES = \ + pcre_chartables.c + +libpcre_la_LDFLAGS = $(EXTRA_LIBPCRE_LDFLAGS) +libpcreposix_la_SOURCES = \ + pcreposix.c + +libpcreposix_la_LDFLAGS = $(EXTRA_LIBPCREPOSIX_LDFLAGS) +libpcreposix_la_LIBADD = libpcre.la + at WITH_PCRE_CPP_TRUE@libpcrecpp_la_SOURCES = \ + at WITH_PCRE_CPP_TRUE@ pcrecpp_internal.h \ + at WITH_PCRE_CPP_TRUE@ pcrecpp.cc \ + at WITH_PCRE_CPP_TRUE@ pcre_scanner.cc \ + at WITH_PCRE_CPP_TRUE@ pcre_stringpiece.cc + + at WITH_PCRE_CPP_TRUE@libpcrecpp_la_LDFLAGS = $(EXTRA_LIBPCRECPP_LDFLAGS) + at WITH_PCRE_CPP_TRUE@libpcrecpp_la_LIBADD = libpcre.la + at WITH_PCRE_CPP_TRUE@pcrecpp_unittest_SOURCES = pcrecpp_unittest.cc + at WITH_PCRE_CPP_TRUE@pcrecpp_unittest_LDADD = libpcrecpp.la + at WITH_PCRE_CPP_TRUE@pcre_scanner_unittest_SOURCES = pcre_scanner_unittest.cc + at WITH_PCRE_CPP_TRUE@pcre_scanner_unittest_LDADD = libpcrecpp.la + at WITH_PCRE_CPP_TRUE@pcre_stringpiece_unittest_SOURCES = pcre_stringpiece_unittest.cc + at WITH_PCRE_CPP_TRUE@pcre_stringpiece_unittest_LDADD = libpcrecpp.la +pcretest_SOURCES = pcretest.c +pcretest_LDADD = libpcreposix.la $(LIBREADLINE) +pcregrep_SOURCES = pcregrep.c +pcregrep_LDADD = libpcreposix.la $(LIBZ) $(LIBBZ2) + +# A PCRE user submitted the following addition, saying that it "will allow +# anyone using the 'mingw32' compiler to simply type 'make pcre.dll' and get a +# nice DLL for Windows use". (It is used by the pcre.dll target.) +DLL_OBJS = pcre_compile.o pcre_config.o \ + pcre_dfa_exec.o pcre_exec.o pcre_fullinfo.o pcre_get.o \ + pcre_globals.o pcre_info.o pcre_maketables.o \ + pcre_newline.o pcre_ord2utf8.o pcre_refcount.o \ + pcre_study.o pcre_tables.o pcre_try_flipped.o \ + pcre_ucd.o pcre_valid_utf8.o pcre_version.o \ + pcre_chartables.o \ + pcre_xclass.o + + +# We have .pc files for pkg-config users. +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libpcre.pc $(am__append_7) +dist_man_MANS = \ + doc/pcre.3 \ + doc/pcre-config.1 \ + doc/pcre_compile.3 \ + doc/pcre_compile2.3 \ + doc/pcre_config.3 \ + doc/pcre_copy_named_substring.3 \ + doc/pcre_copy_substring.3 \ + doc/pcre_dfa_exec.3 \ + doc/pcre_exec.3 \ + doc/pcre_free_substring.3 \ + doc/pcre_free_substring_list.3 \ + doc/pcre_fullinfo.3 \ + doc/pcre_get_named_substring.3 \ + doc/pcre_get_stringnumber.3 \ + doc/pcre_get_stringtable_entries.3 \ + doc/pcre_get_substring.3 \ + doc/pcre_get_substring_list.3 \ + doc/pcre_info.3 \ + doc/pcre_maketables.3 \ + doc/pcre_refcount.3 \ + doc/pcre_study.3 \ + doc/pcre_version.3 \ + doc/pcreapi.3 \ + doc/pcrebuild.3 \ + doc/pcrecallout.3 \ + doc/pcrecompat.3 \ + doc/pcregrep.1 \ + doc/pcrematching.3 \ + doc/pcrepartial.3 \ + doc/pcrepattern.3 \ + doc/pcreperform.3 \ + doc/pcreposix.3 \ + doc/pcreprecompile.3 \ + doc/pcresample.3 \ + doc/pcrestack.3 \ + doc/pcresyntax.3 \ + doc/pcretest.1 + +pcrecpp_man = doc/pcrecpp.3 + at WITH_PCRE_CPP_TRUE@man_MANS = $(pcrecpp_man) +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .cc .lo .o .obj +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +libpcre.pc: $(top_builddir)/config.status $(srcdir)/libpcre.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +libpcrecpp.pc: $(top_builddir)/config.status $(srcdir)/libpcrecpp.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +pcre-config: $(top_builddir)/config.status $(srcdir)/pcre-config.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +pcre.h: $(top_builddir)/config.status $(srcdir)/pcre.h.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +pcre_stringpiece.h: $(top_builddir)/config.status $(srcdir)/pcre_stringpiece.h.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +pcrecpparg.h: $(top_builddir)/config.status $(srcdir)/pcrecpparg.h.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libpcre.la: $(libpcre_la_OBJECTS) $(libpcre_la_DEPENDENCIES) + $(libpcre_la_LINK) -rpath $(libdir) $(libpcre_la_OBJECTS) $(libpcre_la_LIBADD) $(LIBS) +libpcrecpp.la: $(libpcrecpp_la_OBJECTS) $(libpcrecpp_la_DEPENDENCIES) + $(libpcrecpp_la_LINK) $(am_libpcrecpp_la_rpath) $(libpcrecpp_la_OBJECTS) $(libpcrecpp_la_LIBADD) $(LIBS) +libpcreposix.la: $(libpcreposix_la_OBJECTS) $(libpcreposix_la_DEPENDENCIES) + $(libpcreposix_la_LINK) -rpath $(libdir) $(libpcreposix_la_OBJECTS) $(libpcreposix_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +dftables$(EXEEXT): $(dftables_OBJECTS) $(dftables_DEPENDENCIES) + @rm -f dftables$(EXEEXT) + $(LINK) $(dftables_OBJECTS) $(dftables_LDADD) $(LIBS) +pcre_scanner_unittest$(EXEEXT): $(pcre_scanner_unittest_OBJECTS) $(pcre_scanner_unittest_DEPENDENCIES) + @rm -f pcre_scanner_unittest$(EXEEXT) + $(CXXLINK) $(pcre_scanner_unittest_OBJECTS) $(pcre_scanner_unittest_LDADD) $(LIBS) +pcre_stringpiece_unittest$(EXEEXT): $(pcre_stringpiece_unittest_OBJECTS) $(pcre_stringpiece_unittest_DEPENDENCIES) + @rm -f pcre_stringpiece_unittest$(EXEEXT) + $(CXXLINK) $(pcre_stringpiece_unittest_OBJECTS) $(pcre_stringpiece_unittest_LDADD) $(LIBS) +pcrecpp_unittest$(EXEEXT): $(pcrecpp_unittest_OBJECTS) $(pcrecpp_unittest_DEPENDENCIES) + @rm -f pcrecpp_unittest$(EXEEXT) + $(CXXLINK) $(pcrecpp_unittest_OBJECTS) $(pcrecpp_unittest_LDADD) $(LIBS) +pcregrep$(EXEEXT): $(pcregrep_OBJECTS) $(pcregrep_DEPENDENCIES) + @rm -f pcregrep$(EXEEXT) + $(LINK) $(pcregrep_OBJECTS) $(pcregrep_LDADD) $(LIBS) +pcretest$(EXEEXT): $(pcretest_OBJECTS) $(pcretest_DEPENDENCIES) + @rm -f pcretest$(EXEEXT) + $(LINK) $(pcretest_OBJECTS) $(pcretest_LDADD) $(LIBS) +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ + else :; fi; \ + done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dftables.Po at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_chartables.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_compile.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_config.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_dfa_exec.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_exec.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_fullinfo.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_get.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_globals.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_info.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_maketables.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_newline.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_ord2utf8.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_refcount.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_scanner.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_scanner_unittest.Po at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_stringpiece.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_stringpiece_unittest.Po at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_study.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_tables.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_try_flipped.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_ucd.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_valid_utf8.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_version.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcre_xclass.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcrecpp.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcrecpp_unittest.Po at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcregrep.Po at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcreposix.Plo at am__quote@ + at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/pcretest.Po at am__quote@ + +.c.o: + at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po + at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ + at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + at am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: + at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po + at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ + at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: + at am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + at am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo + at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ + at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +.cc.o: + at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + at am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po + at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ + at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: + at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` + at am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po + at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ + at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: + at am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< + at am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo + at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ + at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + at am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ + done +install-man3: $(man3_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" + @list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.3*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 3*) ;; \ + *) ext='3' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst"; \ + done +uninstall-man3: + @$(NORMAL_UNINSTALL) + @list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.3*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 3*) ;; \ + *) ext='3' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man3dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man3dir)/$$inst"; \ + done +install-dist_docDATA: $(dist_doc_DATA) + @$(NORMAL_INSTALL) + test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)" + @list='$(dist_doc_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(dist_docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \ + $(dist_docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \ + done + +uninstall-dist_docDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_doc_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \ + rm -f "$(DESTDIR)$(docdir)/$$f"; \ + done +install-dist_htmlDATA: $(dist_html_DATA) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)" + @list='$(dist_html_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(dist_htmlDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(dist_htmlDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + done + +uninstall-dist_htmlDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_html_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(htmldir)/$$f'"; \ + rm -f "$(DESTDIR)$(htmldir)/$$f"; \ + done +install-htmlDATA: $(html_DATA) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)" + @list='$(html_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(htmlDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(htmlDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + done + +uninstall-htmlDATA: + @$(NORMAL_UNINSTALL) + @list='$(html_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(htmldir)/$$f'"; \ + rm -f "$(DESTDIR)$(htmldir)/$$f"; \ + done +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" + @list='$(pkgconfig_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ + $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \ + done +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" + @list='$(include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ + $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ + rm -f "$(DESTDIR)$(includedir)/$$f"; \ + done +install-nodist_includeHEADERS: $(nodist_include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" + @list='$(nodist_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(nodist_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ + $(nodist_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ + done + +uninstall-nodist_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nodist_include_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ + rm -f "$(DESTDIR)$(includedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d $(distdir) || mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(MANS) $(DATA) \ + $(HEADERS) config.h +install-binPROGRAMS: install-libLTLIBRARIES + +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(htmldir)" "$(DESTDIR)$(htmldir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-dist_docDATA install-dist_htmlDATA \ + install-htmlDATA install-includeHEADERS install-man \ + install-nodist_includeHEADERS install-pkgconfigDATA + +install-dvi: install-dvi-am + +install-exec-am: install-binPROGRAMS install-binSCRIPTS \ + install-libLTLIBRARIES + +install-html: install-html-am + +install-info: install-info-am + +install-man: install-man1 install-man3 + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ + uninstall-dist_docDATA uninstall-dist_htmlDATA \ + uninstall-htmlDATA uninstall-includeHEADERS \ + uninstall-libLTLIBRARIES uninstall-man \ + uninstall-nodist_includeHEADERS uninstall-pkgconfigDATA + +uninstall-man: uninstall-man1 uninstall-man3 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \ + clean clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool clean-noinstPROGRAMS ctags dist dist-all \ + dist-bzip2 dist-gzip dist-shar dist-tarZ dist-zip distcheck \ + distclean distclean-compile distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-binSCRIPTS \ + install-data install-data-am install-dist_docDATA \ + install-dist_htmlDATA install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-htmlDATA \ + install-includeHEADERS install-info install-info-am \ + install-libLTLIBRARIES install-man install-man1 install-man3 \ + install-nodist_includeHEADERS install-pdf install-pdf-am \ + install-pkgconfigDATA install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-binSCRIPTS uninstall-dist_docDATA \ + uninstall-dist_htmlDATA uninstall-htmlDATA \ + uninstall-includeHEADERS uninstall-libLTLIBRARIES \ + uninstall-man uninstall-man1 uninstall-man3 \ + uninstall-nodist_includeHEADERS uninstall-pkgconfigDATA + + +pcre.h.generic: configure.ac + rm -f $@ + cp -p pcre.h $@ + + at WITH_REBUILD_CHARTABLES_TRUE@pcre_chartables.c: dftables$(EXEEXT) + at WITH_REBUILD_CHARTABLES_TRUE@ ./dftables$(EXEEXT) $@ + + at WITH_REBUILD_CHARTABLES_FALSE@pcre_chartables.c: $(srcdir)/pcre_chartables.c.dist + at WITH_REBUILD_CHARTABLES_FALSE@ rm -f $@ + at WITH_REBUILD_CHARTABLES_FALSE@ $(LN_S) $(srcdir)/pcre_chartables.c.dist $@ + +# A compatibility line, the old build system worked with 'make test' +test: check ; + +# A PCRE user submitted the following addition, saying that it "will allow +# anyone using the 'mingw32' compiler to simply type 'make pcre.dll' and get a +# nice DLL for Windows use". +pcre.dll: $(DLL_OBJS) + $(CC) -shared -o pcre.dll -Wl,"--strip-all" -Wl,"--export-all-symbols" $(DLL_OBJS) +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Modified: freeswitch/trunk/libs/pcre/NEWS ============================================================================== --- freeswitch/trunk/libs/pcre/NEWS (original) +++ freeswitch/trunk/libs/pcre/NEWS Mon Jun 8 18:51:30 2009 @@ -1,6 +1,168 @@ News about PCRE releases ------------------------ +Release 7.9 11-Apr-09 +--------------------- + +Mostly bugfixes and tidies with just a couple of minor functional additions. + + +Release 7.8 05-Sep-08 +--------------------- + +More bug fixes, plus a performance improvement in Unicode character property +lookup. + + +Release 7.7 07-May-08 +--------------------- + +This is once again mainly a bug-fix release, but there are a couple of new +features. + + +Release 7.6 28-Jan-08 +--------------------- + +The main reason for having this release so soon after 7.5 is because it fixes a +potential buffer overflow problem in pcre_compile() when run in UTF-8 mode. In +addition, the CMake configuration files have been brought up to date. + + +Release 7.5 10-Jan-08 +--------------------- + +This is mainly a bug-fix release. However the ability to link pcregrep with +libz or libbz2 and the ability to link pcretest with libreadline have been +added. Also the --line-offsets and --file-offsets options were added to +pcregrep. + + +Release 7.4 21-Sep-07 +--------------------- + +The only change of specification is the addition of options to control whether +\R matches any Unicode line ending (the default) or just CR, LF, and CRLF. +Otherwise, the changes are bug fixes and a refactoring to reduce the number of +relocations needed in a shared library. There have also been some documentation +updates, in particular, some more information about using CMake to build PCRE +has been added to the NON-UNIX-USE file. + + +Release 7.3 28-Aug-07 +--------------------- + +Most changes are bug fixes. Some that are not: + +1. There is some support for Perl 5.10's experimental "backtracking control + verbs" such as (*PRUNE). + +2. UTF-8 checking is now as per RFC 3629 instead of RFC 2279; this is more + restrictive in the strings it accepts. + +3. Checking for potential integer overflow has been made more dynamic, and as a + consequence there is no longer a hard limit on the size of a subpattern that + has a limited repeat count. + +4. When CRLF is a valid line-ending sequence, pcre_exec() and pcre_dfa_exec() + no longer advance by two characters instead of one when an unanchored match + fails at CRLF if there are explicit CR or LF matches within the pattern. + This gets rid of some anomalous effects that previously occurred. + +5. Some PCRE-specific settings for varying the newline options at the start of + a pattern have been added. + + +Release 7.2 19-Jun-07 +--------------------- + +WARNING: saved patterns that were compiled by earlier versions of PCRE must be +recompiled for use with 7.2 (necessitated by the addition of \K, \h, \H, \v, +and \V). + +Correction to the notes for 7.1: the note about shared libraries for Windows is +wrong. Previously, three libraries were built, but each could function +independently. For example, the pcreposix library also included all the +functions from the basic pcre library. The change is that the three libraries +are no longer independent. They are like the Unix libraries. To use the +pcreposix functions, for example, you need to link with both the pcreposix and +the basic pcre library. + +Some more features from Perl 5.10 have been added: + + (?-n) and (?+n) relative references for recursion and subroutines. + + (?(-n) and (?(+n) relative references as conditions. + + \k{name} and \g{name} are synonyms for \k. + + \K to reset the start of the matched string; for example, (foo)\Kbar + matches bar preceded by foo, but only sets bar as the matched string. + + (?| introduces a group where the capturing parentheses in each alternative + start from the same number; for example, (?|(abc)|(xyz)) sets capturing + parentheses number 1 in both cases. + + \h, \H, \v, \V match horizontal and vertical whitespace, respectively. + + +Release 7.1 24-Apr-07 +--------------------- + +There is only one new feature in this release: a linebreak setting of +PCRE_NEWLINE_ANYCRLF. It is a cut-down version of PCRE_NEWLINE_ANY, which +recognizes only CRLF, CR, and LF as linebreaks. + +A few bugs are fixed (see ChangeLog for details), but the major change is a +complete re-implementation of the build system. This now has full Autotools +support and so is now "standard" in some sense. It should help with compiling +PCRE in a wide variety of environments. + +NOTE: when building shared libraries for Windows, three dlls are now built, +called libpcre, libpcreposix, and libpcrecpp. Previously, everything was +included in a single dll. + +Another important change is that the dftables auxiliary program is no longer +compiled and run at "make" time by default. Instead, a default set of character +tables (assuming ASCII coding) is used. If you want to use dftables to generate +the character tables as previously, add --enable-rebuild-chartables to the +"configure" command. You must do this if you are compiling PCRE to run on a +system that uses EBCDIC code. + +There is a discussion about character tables in the README file. The default is +not to use dftables so that that there is no problem when cross-compiling. + + +Release 7.0 19-Dec-06 +--------------------- + +This release has a new major number because there have been some internal +upheavals to facilitate the addition of new optimizations and other facilities, +and to make subsequent maintenance and extension easier. Compilation is likely +to be a bit slower, but there should be no major effect on runtime performance. +Previously compiled patterns are NOT upwards compatible with this release. If +you have saved compiled patterns from a previous release, you will have to +re-compile them. Important changes that are visible to users are: + +1. The Unicode property tables have been updated to Unicode 5.0.0, which adds + some more scripts. + +2. The option PCRE_NEWLINE_ANY causes PCRE to recognize any Unicode newline + sequence as a newline. + +3. The \R escape matches a single Unicode newline sequence as a single unit. + +4. New features that will appear in Perl 5.10 are now in PCRE. These include + alternative Perl syntax for named parentheses, and Perl syntax for + recursion. + +5. The C++ wrapper interface has been extended by the addition of a + QuoteMeta function and the ability to allow copy construction and + assignment. + +For a complete list of changes, see the ChangeLog file. + + Release 6.7 04-Jul-06 --------------------- Modified: freeswitch/trunk/libs/pcre/NON-UNIX-USE ============================================================================== --- freeswitch/trunk/libs/pcre/NON-UNIX-USE (original) +++ freeswitch/trunk/libs/pcre/NON-UNIX-USE Mon Jun 8 18:51:30 2009 @@ -1,127 +1,154 @@ Compiling PCRE on non-Unix systems ---------------------------------- -See below for comments on Cygwin or MinGW and OpenVMS usage. I (Philip Hazel) -have no knowledge of Windows or VMS sytems and how their libraries work. The -items in the PCRE Makefile that relate to anything other than Unix-like systems -have been contributed by PCRE users. There are some other comments and files in -the Contrib directory on the ftp site that you may find useful. See +This document contains the following sections: - ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib + General + Generic instructions for the PCRE C library + The C++ wrapper functions + Building for virtual Pascal + Stack size in Windows environments + Linking programs in Windows environments + Comments about Win32 builds + Building PCRE on Windows with CMake + Use of relative paths with CMake on Windows + Testing with runtest.bat + Building under Windows with BCC5.5 + Building PCRE on OpenVMS + + +GENERAL + +I (Philip Hazel) have no experience of Windows or VMS sytems and how their +libraries work. The items in the PCRE distribution and Makefile that relate to +anything other than Unix-like systems are untested by me. + +There are some other comments and files (including some documentation in CHM +format) in the Contrib directory on the FTP site: -If you want to compile PCRE for a non-Unix system (or perhaps, more strictly, -for a system that does not support "configure" and "make" files), note that -the basic PCRE library consists entirely of code written in Standard C, and so -should compile successfully on any system that has a Standard C compiler and -library. The C++ wrapper functions are a separate issue (see below). - - -GENERIC INSTRUCTIONS FOR THE C LIBRARY - -The following are generic comments about building PCRE. The interspersed -indented commands are suggestions from Mark Tetrode as to which commands you -might use on a Windows system to build a static library. - -(1) Copy or rename the file config.in as config.h, and change the macros that -define HAVE_STRERROR and HAVE_MEMMOVE to define them as 1 rather than 0. -Unfortunately, because of the way Unix autoconf works, the default setting has -to be 0. You may also want to make changes to other macros in config.h. In -particular, if you want to force a specific value for newline, you can define -the NEWLINE macro. The default is to use '\n', thereby using whatever value -your compiler gives to '\n'. - - rem Mark Tetrode's commands - copy config.in config.h - rem Use write, because notepad cannot handle UNIX files. Change values. - write config.h - -(2) Compile dftables.c as a stand-alone program, and then run it with -the single argument "pcre_chartables.c". This generates a set of standard -character tables and writes them to that file. - - rem Mark Tetrode's commands - rem Compile & run - cl -DSUPPORT_UTF8 -DSUPPORT_UCP dftables.c - dftables.exe pcre_chartables.c - -(3) Compile the following source files: - - pcre_chartables.c - pcre_compile.c - pcre_config.c - pcre_dfa_exec.c - pcre_exec.c - pcre_fullinfo.c - pcre_get.c - pcre_globals.c - pcre_info.c - pcre_maketables.c - pcre_ord2utf8.c - pcre_refcount.c - pcre_study.c - pcre_tables.c - pcre_try_flipped.c - pcre_ucp_searchfuncs.c - pcre_valid_utf8.c - pcre_version.c - pcre_xclass.c - -and link them all together into an object library in whichever form your system -keeps such libraries. This is the pcre C library. If your system has static and -shared libraries, you may have to do this once for each type. - - rem These comments are out-of-date, referring to a previous release which - rem had fewer source files. Replace with the file names from above. - rem Mark Tetrode's commands, for a static library - rem Compile & lib - cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c maketables.c get.c study.c pcre.c - lib /OUT:pcre.lib maketables.obj get.obj study.obj pcre.obj - -(4) Similarly, compile pcreposix.c and link it (on its own) as the pcreposix -library. - - rem Mark Tetrode's commands, for a static library - rem Compile & lib - cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c pcreposix.c - lib /OUT:pcreposix.lib pcreposix.obj - -(5) Compile the test program pcretest.c. This needs the functions in the -pcre and pcreposix libraries when linking. - - rem Mark Tetrode's commands - rem compile & link - cl /F0x400000 pcretest.c pcre.lib pcreposix.lib - -(6) Run pcretest on the testinput files in the testdata directory, and check -that the output matches the corresponding testoutput files. You must use the --i option when checking testinput2. Note that the supplied files are in Unix -format, with just LF characters as line terminators. You may need to edit them -to change this if your system uses a different convention. - - rem Mark Tetrode's commands - pcretest testdata\testinput1 testdata\myoutput1 - windiff testdata\testoutput1 testdata\myoutput1 - pcretest -i testdata\testinput2 testdata\myoutput2 - windiff testdata\testoutput2 testdata\myoutput2 - pcretest testdata\testinput3 testdata\myoutput3 - windiff testdata\testoutput3 testdata\myoutput3 - pcretest testdata\testinput4 testdata\myoutput4 - windiff testdata\testoutput4 testdata\myoutput4 - pcretest testdata\testinput5 testdata\myoutput5 - windiff testdata\testoutput5 testdata\myoutput5 - pcretest testdata\testinput6 testdata\myoutput6 - windiff testdata\testoutput6 testdata\myoutput6 + ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib -Note that there are now three more tests (7, 8, 9) that did not exist when Mark -wrote those comments. The test the new pcre_dfa_exec() function. +If you want to compile PCRE for a non-Unix system (especially for a system that +does not support "configure" and "make" files), note that the basic PCRE +library consists entirely of code written in Standard C, and so should compile +successfully on any system that has a Standard C compiler and library. The C++ +wrapper functions are a separate issue (see below). + +The PCRE distribution includes a "configure" file for use by the Configure/Make +build system, as found in many Unix-like environments. There is also support +support for CMake, which some users prefer, in particular in Windows +environments. There are some instructions for CMake under Windows in the +section entitled "Building PCRE with CMake" below. CMake can also be used to +build PCRE in Unix-like systems. + + +GENERIC INSTRUCTIONS FOR THE PCRE C LIBRARY + +The following are generic comments about building the PCRE C library "by hand". + + (1) Copy or rename the file config.h.generic as config.h, and edit the macro + settings that it contains to whatever is appropriate for your environment. + In particular, if you want to force a specific value for newline, you can + define the NEWLINE macro. When you compile any of the PCRE modules, you + must specify -DHAVE_CONFIG_H to your compiler so that config.h is included + in the sources. + + An alternative approach is not to edit config.h, but to use -D on the + compiler command line to make any changes that you need to the + configuration options. In this case -DHAVE_CONFIG_H must not be set. + + NOTE: There have been occasions when the way in which certain parameters + in config.h are used has changed between releases. (In the configure/make + world, this is handled automatically.) When upgrading to a new release, + you are strongly advised to review config.h.generic before re-using what + you had previously. + + (2) Copy or rename the file pcre.h.generic as pcre.h. + + (3) EITHER: + Copy or rename file pcre_chartables.c.dist as pcre_chartables.c. + + OR: + Compile dftables.c as a stand-alone program (using -DHAVE_CONFIG_H if + you have set up config.h), and then run it with the single argument + "pcre_chartables.c". This generates a set of standard character tables + and writes them to that file. The tables are generated using the default + C locale for your system. If you want to use a locale that is specified + by LC_xxx environment variables, add the -L option to the dftables + command. You must use this method if you are building on a system that + uses EBCDIC code. + + The tables in pcre_chartables.c are defaults. The caller of PCRE can + specify alternative tables at run time. + + (4) Ensure that you have the following header files: + + pcre_internal.h + ucp.h + + (5) Also ensure that you have the following file, which is #included as source + when building a debugging version of PCRE, and is also used by pcretest. + + pcre_printint.src + + (6) Compile the following source files, setting -DHAVE_CONFIG_H as a compiler + option if you have set up config.h with your configuration, or else use + other -D settings to change the configuration as required. + + pcre_chartables.c + pcre_compile.c + pcre_config.c + pcre_dfa_exec.c + pcre_exec.c + pcre_fullinfo.c + pcre_get.c + pcre_globals.c + pcre_info.c + pcre_maketables.c + pcre_newline.c + pcre_ord2utf8.c + pcre_refcount.c + pcre_study.c + pcre_tables.c + pcre_try_flipped.c + pcre_ucd.c + pcre_valid_utf8.c + pcre_version.c + pcre_xclass.c + + Make sure that you include -I. in the compiler command (or equivalent for + an unusual compiler) so that all included PCRE header files are first + sought in the current directory. Otherwise you run the risk of picking up + a previously-installed file from somewhere else. + + (7) Now link all the compiled code into an object library in whichever form + your system keeps such libraries. This is the basic PCRE C library. If + your system has static and shared libraries, you may have to do this once + for each type. + + (8) Similarly, compile pcreposix.c (remembering -DHAVE_CONFIG_H if necessary) + and link the result (on its own) as the pcreposix library. + + (9) Compile the test program pcretest.c (again, don't forget -DHAVE_CONFIG_H). + This needs the functions in the pcre and pcreposix libraries when linking. + It also needs the pcre_printint.src source file, which it #includes. + +(10) Run pcretest on the testinput files in the testdata directory, and check + that the output matches the corresponding testoutput files. Note that the + supplied files are in Unix format, with just LF characters as line + terminators. You may need to edit them to change this if your system uses + a different convention. If you are using Windows, you probably should use + the wintestinput3 file instead of testinput3 (and the corresponding output + file). This is a locale test; wintestinput3 sets the locale to "french" + rather than "fr_FR", and there some minor output differences. -(7) If you want to use the pcregrep command, compile and link pcregrep.c; it -uses only the basic PCRE library. +(11) If you want to use the pcregrep command, compile and link pcregrep.c; it + uses only the basic PCRE library (it does not need the pcreposix library). THE C++ WRAPPER FUNCTIONS -The PCRE distribution now contains some C++ wrapper functions and tests, +The PCRE distribution also contains some C++ wrapper functions and tests, contributed by Google Inc. On a system that can use "configure" and "make", the functions are automatically built into a library called pcrecpp. It should be straightforward to compile the .cc files manually on other systems. The @@ -129,77 +156,228 @@ xxx.cc files. -FURTHER REMARKS - -If you have a system without "configure" but where you can use a Makefile, edit -Makefile.in to create Makefile, substituting suitable values for the variables -at the head of the file. - -Some help in building a Win32 DLL of PCRE in GnuWin32 environments was -contributed by Paul Sokolovsky. These environments are Mingw32 -(http://www.xraylith.wisc.edu/~khan/software/gnu-win32/) and CygWin -(http://sourceware.cygnus.com/cygwin/). Paul comments: - - For CygWin, set CFLAGS=-mno-cygwin, and do 'make dll'. You'll get - pcre.dll (containing pcreposix also), libpcre.dll.a, and dynamically - linked pgrep and pcretest. If you have /bin/sh, run RunTest (three - main test go ok, locale not supported). - -Changes to do MinGW with autoconf 2.50 were supplied by Fred Cox -, who comments as follows: - - If you are using the PCRE DLL, the normal Unix style configure && make && - make check && make install should just work[*]. If you want to statically - link against the .a file, you must define PCRE_STATIC before including - pcre.h, otherwise the pcre_malloc and pcre_free exported functions will be - declared __declspec(dllimport), with hilarious results. See the configure.in - and pcretest.c for how it is done for the static test. - - Also, there will only be a libpcre.la, not a libpcreposix.la, as you - would expect from the Unix version. The single DLL includes the pcreposix - interface. - -[*] But note that the supplied test files are in Unix format, with just LF -characters as line terminators. You will have to edit them to change to CR LF -terminators. +BUILDING FOR VIRTUAL PASCAL A script for building PCRE using Borland's C++ compiler for use with VPASCAL -was contributed by Alexander Tokarev. It is called makevp.bat. +was contributed by Alexander Tokarev. Stefan Weber updated the script and added +additional files. The following files in the distribution are for building PCRE +for use with VP/Borland: makevp_c.txt, makevp_l.txt, makevp.bat, pcregexp.pas. -These are some further comments about Win32 builds from Mark Evans. They -were contributed before Fred Cox's changes were made, so it is possible that -they may no longer be relevant. - -"The documentation for Win32 builds is a bit shy. Under MSVC6 I -followed their instructions to the letter, but there were still -some things missing. - -(1) Must #define STATIC for entire project if linking statically. - (I see no reason to use DLLs for code this compact.) This of - course is a project setting in MSVC under Preprocessor. - -(2) Missing some #ifdefs relating to the function pointers - pcre_malloc and pcre_free. See my solution below. (The stubs - may not be mandatory but they made me feel better.)" -========================= -#ifdef _WIN32 -#include +STACK SIZE IN WINDOWS ENVIRONMENTS -void* malloc_stub(size_t N) -{ return malloc(N); } -void free_stub(void* p) -{ free(p); } -void *(*pcre_malloc)(size_t) = &malloc_stub; -void (*pcre_free)(void *) = &free_stub; +The default processor stack size of 1Mb in some Windows environments is too +small for matching patterns that need much recursion. In particular, test 2 may +fail because of this. Normally, running out of stack causes a crash, but there +have been cases where the test program has just died silently. See your linker +documentation for how to increase stack size if you experience problems. The +Linux default of 8Mb is a reasonable choice for the stack, though even that can +be too small for some pattern/subject combinations. -#else +PCRE has a compile configuration option to disable the use of stack for +recursion so that heap is used instead. However, pattern matching is +significantly slower when this is done. There is more about stack usage in the +"pcrestack" documentation. -void *(*pcre_malloc)(size_t) = malloc; -void (*pcre_free)(void *) = free; -#endif -========================= +LINKING PROGRAMS IN WINDOWS ENVIRONMENTS + +If you want to statically link a program against a PCRE library in the form of +a non-dll .a file, you must define PCRE_STATIC before including pcre.h, +otherwise the pcre_malloc() and pcre_free() exported functions will be declared +__declspec(dllimport), with unwanted results. + + +CALLING CONVENTIONS IN WINDOWS ENVIRONMENTS + +It is possible to compile programs to use different calling conventions using +MSVC. Search the web for "calling conventions" for more information. To make it +easier to change the calling convention for the exported functions in the +PCRE library, the macro PCRE_CALL_CONVENTION is present in all the external +definitions. It can be set externally when compiling (e.g. in CFLAGS). If it is +not set, it defaults to empty; the default calling convention is then used +(which is what is wanted most of the time). + + +COMMENTS ABOUT WIN32 BUILDS (see also "BUILDING PCRE WITH CMAKE" below) + +There are two ways of building PCRE using the "configure, make, make install" +paradigm on Windows systems: using MinGW or using Cygwin. These are not at all +the same thing; they are completely different from each other. There is also +support for building using CMake, which some users find a more straightforward +way of building PCRE under Windows. However, the tests are not run +automatically when CMake is used. + +The MinGW home page (http://www.mingw.org/) says this: + + MinGW: A collection of freely available and freely distributable Windows + specific header files and import libraries combined with GNU toolsets that + allow one to produce native Windows programs that do not rely on any + 3rd-party C runtime DLLs. + +The Cygwin home page (http://www.cygwin.com/) says this: + + Cygwin is a Linux-like environment for Windows. It consists of two parts: + + . A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing + substantial Linux API functionality + + . A collection of tools which provide Linux look and feel. + + The Cygwin DLL currently works with all recent, commercially released x86 32 + bit and 64 bit versions of Windows, with the exception of Windows CE. + +On both MinGW and Cygwin, PCRE should build correctly using: + + ./configure && make && make install + +This should create two libraries called libpcre and libpcreposix, and, if you +have enabled building the C++ wrapper, a third one called libpcrecpp. These are +independent libraries: when you like with libpcreposix or libpcrecpp you must +also link with libpcre, which contains the basic functions. (Some earlier +releases of PCRE included the basic libpcre functions in libpcreposix. This no +longer happens.) + +A user submitted a special-purpose patch that makes it easy to create +"pcre.dll" under mingw32 using the "msys" environment. It provides "pcre.dll" +as a special target. If you use this target, no other files are built, and in +particular, the pcretest and pcregrep programs are not built. An example of how +this might be used is: + + ./configure --enable-utf --disable-cpp CFLAGS="-03 -s"; make pcre.dll + +Using Cygwin's compiler generates libraries and executables that depend on +cygwin1.dll. If a library that is generated this way is distributed, +cygwin1.dll has to be distributed as well. Since cygwin1.dll is under the GPL +licence, this forces not only PCRE to be under the GPL, but also the entire +application. A distributor who wants to keep their own code proprietary must +purchase an appropriate Cygwin licence. + +MinGW has no such restrictions. The MinGW compiler generates a library or +executable that can run standalone on Windows without any third party dll or +licensing issues. + +But there is more complication: + +If a Cygwin user uses the -mno-cygwin Cygwin gcc flag, what that really does is +to tell Cygwin's gcc to use the MinGW gcc. Cygwin's gcc is only acting as a +front end to MinGW's gcc (if you install Cygwin's gcc, you get both Cygwin's +gcc and MinGW's gcc). So, a user can: + +. Build native binaries by using MinGW or by getting Cygwin and using + -mno-cygwin. + +. Build binaries that depend on cygwin1.dll by using Cygwin with the normal + compiler flags. + +The test files that are supplied with PCRE are in Unix format, with LF +characters as line terminators. It may be necessary to change the line +terminators in order to get some of the tests to work. We hope to improve +things in this area in future. + + +BUILDING PCRE ON WINDOWS WITH CMAKE + +CMake is an alternative build facility that can be used instead of the +traditional Unix "configure". CMake version 2.4.7 supports Borland makefiles, +MinGW makefiles, MSYS makefiles, NMake makefiles, UNIX makefiles, Visual Studio +6, Visual Studio 7, Visual Studio 8, and Watcom W8. The following instructions +were contributed by a PCRE user. + +1. Download CMake 2.4.7 or above from http://www.cmake.org/, install and ensure + that cmake\bin is on your path. + +2. Unzip (retaining folder structure) the PCRE source tree into a source + directory such as C:\pcre. + +3. Create a new, empty build directory: C:\pcre\build\ + +4. Run CMakeSetup from the Shell envirornment of your build tool, e.g., Msys + for Msys/MinGW or Visual Studio Command Prompt for VC/VC++ + +5. Enter C:\pcre\pcre-xx and C:\pcre\build for the source and build + directories, respectively + +6. Hit the "Configure" button. + +7. Select the particular IDE / build tool that you are using (Visual Studio, + MSYS makefiles, MinGW makefiles, etc.) + +8. The GUI will then list several configuration options. This is where you can + enable UTF-8 support, etc. + +9. Hit "Configure" again. The adjacent "OK" button should now be active. + +10. Hit "OK". + +11. The build directory should now contain a usable build system, be it a + solution file for Visual Studio, makefiles for MinGW, etc. + + +USE OF RELATIVE PATHS WITH CMAKE ON WINDOWS + +A PCRE user comments as follows: + +I thought that others may want to know the current state of +CMAKE_USE_RELATIVE_PATHS support on Windows. + +Here it is: +-- AdditionalIncludeDirectories is only partially modified (only the +first path - see below) +-- Only some of the contained file paths are modified - shown below for +pcre.vcproj +-- It properly modifies + +I am sure CMake people can fix that if they want to. Until then one will +need to replace existing absolute paths in project files with relative +paths manually (e.g. from VS) - relative to project file location. I did +just that before being told to try CMAKE_USE_RELATIVE_PATHS. Not a big +deal. + +AdditionalIncludeDirectories="E:\builds\pcre\build;E:\builds\pcre\pcre-7.5;" +AdditionalIncludeDirectories=".;E:\builds\pcre\pcre-7.5;" + +RelativePath="pcre.h"> +RelativePath="pcre_chartables.c"> +RelativePath="pcre_chartables.c.rule"> + + +TESTING WITH RUNTEST.BAT + +1. Copy RunTest.bat into the directory where pcretest.exe has been created. + +2. Edit RunTest.bat and insert a line that indentifies the relative location of + the pcre source, e.g.: + + set srcdir=..\pcre-7.4-RC3 + +3. Run RunTest.bat from a command shell environment. Test outputs will + automatically be compared to expected results, and discrepancies will + identified in the console output. + +4. To test pcrecpp, run pcrecpp_unittest.exe, pcre_stringpiece_unittest.exe and + pcre_scanner_unittest.exe. + + +BUILDING UNDER WINDOWS WITH BCC5.5 + +Michael Roy sent these comments about building PCRE under Windows with BCC5.5: + + Some of the core BCC libraries have a version of PCRE from 1998 built in, + which can lead to pcre_exec() giving an erroneous PCRE_ERROR_NULL from a + version mismatch. I'm including an easy workaround below, if you'd like to + include it in the non-unix instructions: + + When linking a project with BCC5.5, pcre.lib must be included before any of + the libraries cw32.lib, cw32i.lib, cw32mt.lib, and cw32mti.lib on the command + line. + + +BUILDING UNDER WINDOWS CE WITH VISUAL STUDIO 200x + +Vincent Richomme sent a zip archive of files to help with this process. They +can be found in the file "pcre-vsbuild.zip" in the Contrib directory of the FTP +site. BUILDING PCRE ON OPENVMS @@ -266,4 +444,5 @@ $! ========================= +Last Updated: 17 March 2009 **** Added: freeswitch/trunk/libs/pcre/PrepareRelease ============================================================================== --- (empty file) +++ freeswitch/trunk/libs/pcre/PrepareRelease Mon Jun 8 18:51:30 2009 @@ -0,0 +1,214 @@ +#/bin/sh + +# Script to prepare the files for building a PCRE release. It does some +# processing of the documentation, detrails files, and creates pcre.h.generic +# and config.h.generic (for use by builders who can't run ./configure). + +# You must run this script before runnning "make dist". It makes use of the +# following files: + +# 132html A Perl script that converts a .1 or .3 man page into HTML. It +# is called from MakeRelease. It "knows" the relevant troff +# constructs that are used in the PCRE man pages. + +# CleanTxt A Perl script that cleans up the output of "nroff -man" by +# removing backspaces and other redundant text so as to produce +# a readable .txt file. + +# Detrail A Perl script that removes trailing spaces from files. + +# doc/index.html.src +# A file that is copied as index.html into the doc/html directory +# when the HTML documentation is built. It works like this so that +# doc/html can be deleted and re-created from scratch. + + +# First, sort out the documentation + +cd doc +echo Processing documentation + +# Make Text form of the documentation. It needs some mangling to make it +# tidy for online reading. Concatenate all the .3 stuff, but omit the +# individual function pages. + +cat <pcre.txt +----------------------------------------------------------------------------- +This file contains a concatenation of the PCRE man pages, converted to plain +text format for ease of searching with a text editor, or for use on systems +that do not have a man page processor. The small individual files that give +synopses of each function in the library have not been included. There are +separate text files for the pcregrep and pcretest commands. +----------------------------------------------------------------------------- + + +End + +echo "Making pcre.txt" +for file in pcre pcrebuild pcrematching pcreapi pcrecallout pcrecompat \ + pcrepattern pcresyntax pcrepartial pcreprecompile \ + pcreperform pcreposix pcrecpp pcresample pcrestack ; do + echo " Processing $file.3" + nroff -c -man $file.3 >$file.rawtxt + ../CleanTxt <$file.rawtxt >>pcre.txt + /bin/rm $file.rawtxt + echo "------------------------------------------------------------------------------" >>pcre.txt + if [ "$file" != "pcresample" ] ; then + echo " " >>pcre.txt + echo " " >>pcre.txt + fi +done + +# The three commands +for file in pcretest pcregrep pcre-config ; do + echo Making $file.txt + nroff -c -man $file.1 >$file.rawtxt + ../CleanTxt <$file.rawtxt >$file.txt + /bin/rm $file.rawtxt +done + + +# Make HTML form of the documentation. + +echo "Making HTML documentation" +/bin/rm html/* +cp index.html.src html/index.html + +for file in *.1 ; do + base=`basename $file .1` + echo " Making $base.html" + ../132html -toc $base <$file >html/$base.html +done + +# Exclude table of contents for function summaries. It seems that expr +# forces an anchored regex. Also exclude them for small pages that have +# only one section. +for file in *.3 ; do + base=`basename $file .3` + toc=-toc + if [ `expr $base : '.*_'` -ne 0 ] ; then toc="" ; fi + if [ "$base" = "pcresample" ] || \ + [ "$base" = "pcrestack" ] || \ + [ "$base" = "pcrecompat" ] || \ + [ "$base" = "pcreperform" ] ; then + toc="" + fi + echo " Making $base.html" + ../132html $toc $base <$file >html/$base.html + if [ $? != 0 ] ; then exit 1; fi +done + +# End of documentation processing + +cd .. +echo Documentation done + +# These files are detrailed; do not detrail the test data because there may be +# significant trailing spaces. The configure files are also omitted from the +# detrailing. + +files="\ + Makefile.am \ + Makefile.in \ + configure.ac \ + README \ + LICENCE \ + COPYING \ + AUTHORS \ + NEWS \ + NON-UNIX-USE \ + INSTALL \ + 132html \ + CleanTxt \ + Detrail \ + ChangeLog \ + CMakeLists.txt \ + RunGrepTest \ + RunTest \ + RunTest.bat \ + pcre-config.in \ + libpcre.pc.in \ + libpcrecpp.pc.in \ + config.h.in \ + pcre_printint.src \ + pcre_chartables.c.dist \ + pcredemo.c \ + pcregrep.c \ + pcretest.c \ + dftables.c \ + pcreposix.c \ + pcreposix.h \ + pcre.h.in \ + pcre_internal.h + pcre_compile.c \ + pcre_config.c \ + pcre_dfa_exec.c \ + pcre_exec.c \ + pcre_fullinfo.c \ + pcre_get.c \ + pcre_globals.c \ + pcre_info.c \ + pcre_maketables.c \ + pcre_newline.c \ + pcre_ord2utf8.c \ + pcre_refcount.c \ + pcre_study.c \ + pcre_tables.c \ + pcre_try_flipped.c \ + pcre_ucp_searchfuncs.c \ + pcre_valid_utf8.c \ + pcre_version.c \ + pcre_xclass.c \ + pcre_scanner.cc \ + pcre_scanner.h \ + pcre_scanner_unittest.cc \ + pcrecpp.cc \ + pcrecpp.h \ + pcrecpparg.h.in \ + pcrecpp_unittest.cc \ + pcre_stringpiece.cc \ + pcre_stringpiece.h.in \ + pcre_stringpiece_unittest.cc \ + perltest.pl \ + ucp.h \ + ucpinternal.h \ + ucptable.h \ + makevp.bat \ + pcre.def \ + libpcre.def \ + libpcreposix.def" + +echo Detrailing +./Detrail $files doc/p* doc/html/* + +echo Doing basic configure to get default pcre.h and config.h +# This is in case the caller has set aliases (as I do - PH) +unset cp ls mv rm +./configure >/dev/null + +echo Converting pcre.h and config.h to generic forms +cp -f pcre.h pcre.h.generic + +perl <<'END' + open(IN, "config.h.generic") || die "Can't open config.h.generic: $!\n"; + while () + { + if (/^#define\s(?!PACKAGE)(\w+)/) + { + print OUT "#ifndef $1\n"; + print OUT; + print OUT "#endif\n"; + } + else + { + print OUT; + } + } + close IN; + close OUT; +END + +echo Done + +#End Modified: freeswitch/trunk/libs/pcre/README ============================================================================== --- freeswitch/trunk/libs/pcre/README (original) +++ freeswitch/trunk/libs/pcre/README Mon Jun 8 18:51:30 2009 @@ -1,55 +1,93 @@ README file for PCRE (Perl-compatible regular expression library) ----------------------------------------------------------------- -The latest release of PCRE is always available from +The latest release of PCRE is always available in three alternative formats +from: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz + ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.bz2 + ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.zip + +There is a mailing list for discussion about the development of PCRE at + + pcre-dev at exim.org Please read the NEWS file if you are upgrading from a previous release. +The contents of this README file are: + + The PCRE APIs + Documentation for PCRE + Contributions by users of PCRE + Building PCRE on non-Unix systems + Building PCRE on Unix-like systems + Retrieving configuration information on Unix-like systems + Shared libraries on Unix-like systems + Cross-compiling on Unix-like systems + Using HP's ANSI C++ compiler (aCC) + Making new tarballs + Testing PCRE + Character tables + File manifest The PCRE APIs ------------- -PCRE is written in C, and it has its own API. The distribution now includes a -set of C++ wrapper functions, courtesy of Google Inc. (see the pcrecpp man page -for details). - -Also included are a set of C wrapper functions that are based on the POSIX -API. These end up in the library called libpcreposix. Note that this just -provides a POSIX calling interface to PCRE: the regular expressions themselves -still follow Perl syntax and semantics. The header file for the POSIX-style -functions is called pcreposix.h. The official POSIX name is regex.h, but I -didn't want to risk possible problems with existing files of that name by -distributing it that way. To use it with an existing program that uses the -POSIX API, it will have to be renamed or pointed at by a link. +PCRE is written in C, and it has its own API. The distribution also includes a +set of C++ wrapper functions (see the pcrecpp man page for details), courtesy +of Google Inc. + +In addition, there is a set of C wrapper functions that are based on the POSIX +regular expression API (see the pcreposix man page). These end up in the +library called libpcreposix. Note that this just provides a POSIX calling +interface to PCRE; the regular expressions themselves still follow Perl syntax +and semantics. The POSIX API is restricted, and does not give full access to +all of PCRE's facilities. + +The header file for the POSIX-style functions is called pcreposix.h. The +official POSIX name is regex.h, but I did not want to risk possible problems +with existing files of that name by distributing it that way. To use PCRE with +an existing program that uses the POSIX API, pcreposix.h will have to be +renamed or pointed at by a link. If you are using the POSIX interface to PCRE and there is already a POSIX regex -library installed on your system, you must take care when linking programs to +library installed on your system, as well as worrying about the regex.h header +file (as mentioned above), you must also take care when linking programs to ensure that they link with PCRE's libpcreposix library. Otherwise they may pick -up the "real" POSIX functions of the same name. +up the POSIX functions of the same name from the other library. + +One way of avoiding this confusion is to compile PCRE with the addition of +-Dregcomp=PCREregcomp (and similarly for the other POSIX functions) to the +compiler flags (CFLAGS if you are using "configure" -- see below). This has the +effect of renaming the functions so that the names no longer clash. Of course, +you have to do the same thing for your applications, or write them using the +new names. Documentation for PCRE ---------------------- -If you install PCRE in the normal way, you will end up with an installed set of -man pages whose names all start with "pcre". The one that is just called "pcre" -lists all the others. In addition to these man pages, the PCRE documentation is -supplied in two other forms; however, as there is no standard place to install -them, they are left in the doc directory of the unpacked source distribution. -These forms are: - - 1. Files called doc/pcre.txt, doc/pcregrep.txt, and doc/pcretest.txt. The - first of these is a concatenation of the text forms of all the section 3 - man pages except those that summarize individual functions. The other two - are the text forms of the section 1 man pages for the pcregrep and - pcretest commands. Text forms are provided for ease of scanning with text - editors or similar tools. - - 2. A subdirectory called doc/html contains all the documentation in HTML - form, hyperlinked in various ways, and rooted in a file called - doc/index.html. +If you install PCRE in the normal way on a Unix-like system, you will end up +with a set of man pages whose names all start with "pcre". The one that is just +called "pcre" lists all the others. In addition to these man pages, the PCRE +documentation is supplied in two other forms: + + 1. There are files called doc/pcre.txt, doc/pcregrep.txt, and + doc/pcretest.txt in the source distribution. The first of these is a + concatenation of the text forms of all the section 3 man pages except + those that summarize individual functions. The other two are the text + forms of the section 1 man pages for the pcregrep and pcretest commands. + These text forms are provided for ease of scanning with text editors or + similar tools. They are installed in /share/doc/pcre, where + is the installation prefix (defaulting to /usr/local). + + 2. A set of files containing all the documentation in HTML form, hyperlinked + in various ways, and rooted in a file called index.html, is distributed in + doc/html and installed in /share/doc/pcre/html. + +Users of PCRE have contributed files containing the documentation for various +releases in CHM format. These can be found in the Contrib directory of the FTP +site (see next section). Contributions by users of PCRE @@ -59,27 +97,48 @@ ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/Contrib -where there is also a README file giving brief descriptions of what they are. -Several of them provide support for compiling PCRE on various flavours of -Windows systems (I myself do not use Windows). Some are complete in themselves; -others are pointers to URLs containing relevant files. +There is a README file giving brief descriptions of what they are. Some are +complete in themselves; others are pointers to URLs containing relevant files. +Some of this material is likely to be well out-of-date. Several of the earlier +contributions provided support for compiling PCRE on various flavours of +Windows (I myself do not use Windows). Nowadays there is more Windows support +in the standard distribution, so these contibutions have been archived. + +Building PCRE on non-Unix systems +--------------------------------- -Building PCRE on a Unix-like system ------------------------------------ +For a non-Unix system, please read the comments in the file NON-UNIX-USE, +though if your system supports the use of "configure" and "make" you may be +able to build PCRE in the same way as for Unix-like systems. PCRE can also be +configured in many platform environments using the GUI facility of CMake's +CMakeSetup. It creates Makefiles, solution files, etc. + +PCRE has been compiled on many different operating systems. It should be +straightforward to build PCRE on any system that has a Standard C compiler and +library, because it uses only Standard C functions. + + +Building PCRE on Unix-like systems +---------------------------------- If you are using HP's ANSI C++ compiler (aCC), please see the special note in the section entitled "Using HP's ANSI C++ compiler (aCC)" below. +The following instructions assume the use of the widely used "configure, make, +make install" process. There is also support for CMake in the PCRE +distribution; there are some comments about using CMake in the NON-UNIX-USE +file, though it can also be used in Unix-like systems. + To build PCRE on a Unix-like system, first run the "configure" command from the PCRE distribution directory, with your current directory set to the directory where you want the files to be created. This command is a standard GNU "autoconf" configuration script, for which generic instructions are supplied in -INSTALL. +the file INSTALL. Most commonly, people build PCRE within its own distribution directory, and in -this case, on many systems, just running "./configure" is sufficient, but the -usual methods of changing standard defaults are available. For example: +this case, on many systems, just running "./configure" is sufficient. However, +the usual methods of changing standard defaults are available. For example: CFLAGS='-O2 -Wall' ./configure --prefix=/opt/local @@ -103,13 +162,16 @@ . If you want to suppress the building of the C++ wrapper library, you can add --disable-cpp to the "configure" command. Otherwise, when "configure" is run, - will try to find a C++ compiler and C++ header files, and if it succeeds, it - will try to build the C++ wrapper. + it will try to find a C++ compiler and C++ header files, and if it succeeds, + it will try to build the C++ wrapper. -. If you want to make use of the support for UTF-8 character strings in PCRE, - you must add --enable-utf8 to the "configure" command. Without it, the code - for handling UTF-8 is not included in the library. (Even when included, it - still has to be enabled by an option at run time.) +. If you want to make use of the support for UTF-8 Unicode character strings in + PCRE, you must add --enable-utf8 to the "configure" command. Without it, the + code for handling UTF-8 is not included in the library. Even when included, + it still has to be enabled by an option at run time. When PCRE is compiled + with this option, its input can only either be ASCII or UTF-8, even when + running on EBCDIC platforms. It is not possible to use both --enable-utf8 and + --enable-ebcdic at the same time. . If, in addition to support for UTF-8 character strings, you want to include support for the \P, \p, and \X sequences that recognize Unicode character @@ -118,17 +180,31 @@ property table); only the basic two-letter properties such as Lu are supported. -. You can build PCRE to recognize either CR or LF or the sequence CRLF as - indicating the end of a line. Whatever you specify at build time is the - default; the caller of PCRE can change the selection at run time. The default - newline indicator is a single LF character (the Unix standard). You can - specify the default newline indicator by adding --newline-is-cr or - --newline-is-lf or --newline-is-crlf to the "configure" command, - respectively. +. You can build PCRE to recognize either CR or LF or the sequence CRLF or any + of the preceding, or any of the Unicode newline sequences as indicating the + end of a line. Whatever you specify at build time is the default; the caller + of PCRE can change the selection at run time. The default newline indicator + is a single LF character (the Unix standard). You can specify the default + newline indicator by adding --enable-newline-is-cr or --enable-newline-is-lf + or --enable-newline-is-crlf or --enable-newline-is-anycrlf or + --enable-newline-is-any to the "configure" command, respectively. + + If you specify --enable-newline-is-cr or --enable-newline-is-crlf, some of + the standard tests will fail, because the lines in the test files end with + LF. Even if the files are edited to change the line endings, there are likely + to be some failures. With --enable-newline-is-anycrlf or + --enable-newline-is-any, many tests should succeed, but there may be some + failures. + +. By default, the sequence \R in a pattern matches any Unicode line ending + sequence. This is independent of the option specifying what PCRE considers to + be the end of a line (see above). However, the caller of PCRE can restrict \R + to match only CR, LF, or CRLF. You can make this the default by adding + --enable-bsr-anycrlf to the "configure" command (bsr = "backslash R"). . When called via the POSIX interface, PCRE uses malloc() to get additional storage for processing capturing parentheses if there are more than 10 of - them. You can increase this threshold by setting, for example, + them in a pattern. You can increase this threshold by setting, for example, --with-posix-malloc-threshold=20 @@ -141,8 +217,8 @@ --with-match-limit=500000 on the "configure" command. This is just the default; individual calls to - pcre_exec() can supply their own value. There is discussion on the pcreapi - man page. + pcre_exec() can supply their own value. There is more discussion on the + pcreapi man page. . There is a separate counter that limits the depth of recursive function calls during a matching process. This also has a default of ten million, which is @@ -157,37 +233,92 @@ . The default maximum compiled pattern size is around 64K. You can increase this by adding --with-link-size=3 to the "configure" command. You can increase it even more by setting --with-link-size=4, but this is unlikely - ever to be necessary. If you build PCRE with an increased link size, test 2 - (and 5 if you are using UTF-8) will fail. Part of the output of these tests - is a representation of the compiled pattern, and this changes with the link - size. + ever to be necessary. Increasing the internal link size will reduce + performance. . You can build PCRE so that its internal match() function that is called from - pcre_exec() does not call itself recursively. Instead, it uses blocks of data - from the heap via special functions pcre_stack_malloc() and pcre_stack_free() - to save data that would otherwise be saved on the stack. To build PCRE like - this, use + pcre_exec() does not call itself recursively. Instead, it uses memory blocks + obtained from the heap via the special functions pcre_stack_malloc() and + pcre_stack_free() to save data that would otherwise be saved on the stack. To + build PCRE like this, use --disable-stack-for-recursion on the "configure" command. PCRE runs more slowly in this mode, but it may be necessary in environments with limited stack sizes. This applies only to the pcre_exec() function; it does not apply to pcre_dfa_exec(), which does not - use deeply nested recursion. + use deeply nested recursion. There is a discussion about stack sizes in the + pcrestack man page. + +. For speed, PCRE uses four tables for manipulating and identifying characters + whose code point values are less than 256. By default, it uses a set of + tables for ASCII encoding that is part of the distribution. If you specify + + --enable-rebuild-chartables + + a program called dftables is compiled and run in the default C locale when + you obey "make". It builds a source file called pcre_chartables.c. If you do + not specify this option, pcre_chartables.c is created as a copy of + pcre_chartables.c.dist. See "Character tables" below for further information. + +. It is possible to compile PCRE for use on systems that use EBCDIC as their + character code (as opposed to ASCII) by specifying + + --enable-ebcdic + + This automatically implies --enable-rebuild-chartables (see above). However, + when PCRE is built this way, it always operates in EBCDIC. It cannot support + both EBCDIC and UTF-8. + +. It is possible to compile pcregrep to use libz and/or libbz2, in order to + read .gz and .bz2 files (respectively), by specifying one or both of -The "configure" script builds eight files for the basic C library: + --enable-pcregrep-libz + --enable-pcregrep-libbz2 + + Of course, the relevant libraries must be installed on your system. + +. It is possible to compile pcretest so that it links with the libreadline + library, by specifying + + --enable-pcretest-libreadline + + If this is done, when pcretest's input is from a terminal, it reads it using + the readline() function. This provides line-editing and history facilities. + Note that libreadline is GPL-licenced, so if you distribute a binary of + pcretest linked in this way, there may be licensing issues. + + Setting this option causes the -lreadline option to be added to the pcretest + build. In many operating environments with a sytem-installed readline + library this is sufficient. However, in some environments (e.g. if an + unmodified distribution version of readline is in use), it may be necessary + to specify something like LIBS="-lncurses" as well. This is because, to quote + the readline INSTALL, "Readline uses the termcap functions, but does not link + with the termcap or curses library itself, allowing applications which link + with readline the to choose an appropriate library." If you get error + messages about missing functions tgetstr, tgetent, tputs, tgetflag, or tgoto, + this is the problem, and linking with the ncurses library should fix it. + +The "configure" script builds the following files for the basic C library: . Makefile is the makefile that builds the library . config.h contains build-time configuration options for the library +. pcre.h is the public PCRE header file . pcre-config is a script that shows the settings of "configure" options . libpcre.pc is data for the pkg-config command . libtool is a script that builds shared and/or static libraries -. RunTest is a script for running tests on the library +. RunTest is a script for running tests on the basic C library . RunGrepTest is a script for running tests on the pcregrep command -In addition, if a C++ compiler is found, the following are also built: +Versions of config.h and pcre.h are distributed in the PCRE tarballs under +the names config.h.generic and pcre.h.generic. These are provided for the +benefit of those who have to built PCRE without the benefit of "configure". If +you use "configure", the .generic versions are not used. -. pcrecpp.h is the header file for programs that call PCRE via the C++ wrapper +If a C++ compiler is found, the following files are also built: + +. libpcrecpp.pc is data for the pkg-config command +. pcrecpparg.h is a header file for programs that call PCRE via the C++ wrapper . pcre_stringpiece.h is the header for the C++ "stringpiece" functions The "configure" script also creates config.status, which is an executable @@ -196,17 +327,61 @@ Once "configure" has run, you can run "make". It builds two libraries, called libpcre and libpcreposix, a test program called pcretest, and the pcregrep -command. If a C++ compiler was found on your system, it also builds the C++ +command. If a C++ compiler was found on your system, "make" also builds the C++ wrapper library, which is called libpcrecpp, and some test programs called pcrecpp_unittest, pcre_scanner_unittest, and pcre_stringpiece_unittest. +Building the C++ wrapper can be disabled by adding --disable-cpp to the +"configure" command. -The command "make test" runs all the appropriate tests. Details of the PCRE -tests are given in a separate section of this document, below. +The command "make check" runs all the appropriate tests. Details of the PCRE +tests are given below in a separate section of this document. -You can use "make install" to copy the libraries, the public header files -pcre.h, pcreposix.h, pcrecpp.h, and pcre_stringpiece.h (the last two only if -the C++ wrapper was built), and the man pages to appropriate live directories -on your system, in the normal way. +You can use "make install" to install PCRE into live directories on your +system. The following are installed (file names are all relative to the + that is set when "configure" is run): + + Commands (bin): + pcretest + pcregrep + pcre-config + + Libraries (lib): + libpcre + libpcreposix + libpcrecpp (if C++ support is enabled) + + Configuration information (lib/pkgconfig): + libpcre.pc + libpcrecpp.pc (if C++ support is enabled) + + Header files (include): + pcre.h + pcreposix.h + pcre_scanner.h ) + pcre_stringpiece.h ) if C++ support is enabled + pcrecpp.h ) + pcrecpparg.h ) + + Man pages (share/man/man{1,3}): + pcregrep.1 + pcretest.1 + pcre.3 + pcre*.3 (lots more pages, all starting "pcre") + + HTML documentation (share/doc/pcre/html): + index.html + *.html (lots more pages, hyperlinked from index.html) + + Text file documentation (share/doc/pcre): + AUTHORS + COPYING + ChangeLog + LICENCE + NEWS + README + pcre.txt (a concatenation of the man(3) pages) + pcretest.txt the pcretest man page + pcregrep.txt the pcregrep man page If you want to remove PCRE from your system, you can run "make uninstall". This removes all the files that "make install" installed. However, it does not @@ -216,9 +391,8 @@ Retrieving configuration information on Unix-like systems --------------------------------------------------------- -Running "make install" also installs the command pcre-config, which can be used -to recall information about the PCRE configuration and installation. For -example: +Running "make install" installs the command pcre-config, which can be used to +recall information about the PCRE configuration and installation. For example: pcre-config --version @@ -237,7 +411,7 @@ pkg-config --cflags pcre The data is held in *.pc files that are installed in a directory called -pkgconfig. +/lib/pkgconfig. Shared libraries on Unix-like systems @@ -254,7 +428,7 @@ libraries (by means of wrapper scripts in the case of shared libraries). When you use "make install" to install shared libraries, pcregrep and pcretest are automatically re-built to use the newly installed shared libraries before being -installed themselves. However, the versions left in the source directory still +installed themselves. However, the versions left in the build directory still use the uninstalled libraries. To build PCRE using static libraries only you must use --disable-shared when @@ -266,25 +440,33 @@ build only shared libraries. -Cross-compiling on a Unix-like system -------------------------------------- +Cross-compiling on Unix-like systems +------------------------------------ You can specify CC and CFLAGS in the normal way to the "configure" command, in -order to cross-compile PCRE for some other host. However, during the building -process, the dftables.c source file is compiled *and run* on the local host, in -order to generate the default character tables (the chartables.c file). It -therefore needs to be compiled with the local compiler, not the cross compiler. -You can do this by specifying CC_FOR_BUILD (and if necessary CFLAGS_FOR_BUILD; -there are also CXX_FOR_BUILD and CXXFLAGS_FOR_BUILD for the C++ wrapper) -when calling the "configure" command. If they are not specified, they default -to the values of CC and CFLAGS. +order to cross-compile PCRE for some other host. However, you should NOT +specify --enable-rebuild-chartables, because if you do, the dftables.c source +file is compiled and run on the local host, in order to generate the inbuilt +character tables (the pcre_chartables.c file). This will probably not work, +because dftables.c needs to be compiled with the local compiler, not the cross +compiler. + +When --enable-rebuild-chartables is not specified, pcre_chartables.c is created +by making a copy of pcre_chartables.c.dist, which is a default set of tables +that assumes ASCII code. Cross-compiling with the default tables should not be +a problem. + +If you need to modify the character tables when cross-compiling, you should +move pcre_chartables.c.dist out of the way, then compile dftables.c by hand and +run it on the local host to make a new version of pcre_chartables.c.dist. +Then when you cross-compile PCRE this new version of the tables will be used. Using HP's ANSI C++ compiler (aCC) ---------------------------------- -Unless C++ support is disabled by specifiying the "--disable-cpp" option of the -"configure" script, you *must* include the "-AA" option in the CXXFLAGS +Unless C++ support is disabled by specifying the "--disable-cpp" option of the +"configure" script, you must include the "-AA" option in the CXXFLAGS environment variable in order for the C++ components to compile correctly. Also, note that the aCC compiler on PA-RISC platforms may have a defect whereby @@ -296,49 +478,48 @@ CXXLDFLAGS="-lstd_v2 -lCsup_v2" -Building on non-Unix systems ----------------------------- +Making new tarballs +------------------- -For a non-Unix system, read the comments in the file NON-UNIX-USE, though if -the system supports the use of "configure" and "make" you may be able to build -PCRE in the same way as for Unix systems. - -PCRE has been compiled on Windows systems and on Macintoshes, but I don't know -the details because I don't use those systems. It should be straightforward to -build PCRE on any system that has a Standard C compiler, because it uses only -Standard C functions. +The command "make dist" creates three PCRE tarballs, in tar.gz, tar.bz2, and +zip formats. The command "make distcheck" does the same, but then does a trial +build of the new distribution to ensure that it works. + +If you have modified any of the man page sources in the doc directory, you +should first run the PrepareRelease script before making a distribution. This +script creates the .txt and HTML forms of the documentation from the man pages. Testing PCRE ------------ -To test PCRE on a Unix system, run the RunTest script that is created by the -configuring process. There is also a script called RunGrepTest that tests the -options of the pcregrep command. If the C++ wrapper library is build, three -test programs called pcrecpp_unittest, pcre_scanner_unittest, and -pcre_stringpiece_unittest are provided. - -Both the scripts and all the program tests are run if you obey "make runtest", -"make check", or "make test". For other systems, see the instructions in -NON-UNIX-USE. +To test the basic PCRE library on a Unix system, run the RunTest script that is +created by the configuring process. There is also a script called RunGrepTest +that tests the options of the pcregrep command. If the C++ wrapper library is +built, three test programs called pcrecpp_unittest, pcre_scanner_unittest, and +pcre_stringpiece_unittest are also built. + +Both the scripts and all the program tests are run if you obey "make check" or +"make test". For other systems, see the instructions in NON-UNIX-USE. The RunTest script runs the pcretest test program (which is documented in its -own man page) on each of the testinput files (in the testdata directory) in +own man page) on each of the testinput files in the testdata directory in turn, and compares the output with the contents of the corresponding testoutput -file. A file called testtry is used to hold the main output from pcretest +files. A file called testtry is used to hold the main output from pcretest (testsavedregex is also used as a working file). To run pcretest on just one of the test files, give its number as an argument to RunTest, for example: RunTest 2 -The first file can also be fed directly into the perltest script to check that -Perl gives the same results. The only difference you should see is in the first -few lines, where the Perl version is given instead of the PCRE version. +The first test file can also be fed directly into the perltest.pl script to +check that Perl gives the same results. The only difference you should see is +in the first few lines, where the Perl version is given instead of the PCRE +version. The second set of tests check pcre_fullinfo(), pcre_info(), pcre_study(), pcre_copy_substring(), pcre_get_substring(), pcre_get_substring_list(), error detection, and run-time flags that are specific to PCRE, as well as the POSIX -wrapper API. It also uses the debugging flag to check some of the internals of +wrapper API. It also uses the debugging flags to check some of the internals of pcre_compile(). If you build PCRE with a locale setting that is not the standard C locale, the @@ -364,6 +545,12 @@ in the comparison output, it means that locale is not available on your system, despite being listed by "locale". This does not mean that PCRE is broken. +[If you are trying to run this test on Windows, you may be able to get it to +work by changing "fr_FR" to "french" everywhere it occurs. Alternatively, use +RunTest.bat. The version of RunTest.bat included with PCRE 7.4 and above uses +Windows versions of test 2. More info on using RunTest.bat is included in the +document entitled NON-UNIX-USE.] + The fourth test checks the UTF-8 support. It is not run automatically unless PCRE is built with UTF-8 support. To do this you must set --enable-utf8 when running "configure". This file can be also fed directly to the perltest script, @@ -373,8 +560,8 @@ The fifth test checks error handling with UTF-8 encoding, and internal UTF-8 features of PCRE that are not relevant to Perl. -The sixth and test checks the support for Unicode character properties. It it -not run automatically unless PCRE is built with Unicode property support. To to +The sixth test checks the support for Unicode character properties. It it not +run automatically unless PCRE is built with Unicode property support. To to this you must set --enable-unicode-properties when running "configure". The seventh, eighth, and ninth tests check the pcre_dfa_exec() alternative @@ -386,27 +573,42 @@ Character tables ---------------- -PCRE uses four tables for manipulating and identifying characters whose values -are less than 256. The final argument of the pcre_compile() function is a -pointer to a block of memory containing the concatenated tables. A call to -pcre_maketables() can be used to generate a set of tables in the current -locale. If the final argument for pcre_compile() is passed as NULL, a set of -default tables that is built into the binary is used. - -The source file called chartables.c contains the default set of tables. This is -not supplied in the distribution, but is built by the program dftables -(compiled from dftables.c), which uses the ANSI C character handling functions -such as isalnum(), isalpha(), isupper(), islower(), etc. to build the table -sources. This means that the default C locale which is set for your system will -control the contents of these default tables. You can change the default tables -by editing chartables.c and then re-building PCRE. If you do this, you should -probably also edit Makefile to ensure that the file doesn't ever get -re-generated. +For speed, PCRE uses four tables for manipulating and identifying characters +whose code point values are less than 256. The final argument of the +pcre_compile() function is a pointer to a block of memory containing the +concatenated tables. A call to pcre_maketables() can be used to generate a set +of tables in the current locale. If the final argument for pcre_compile() is +passed as NULL, a set of default tables that is built into the binary is used. + +The source file called pcre_chartables.c contains the default set of tables. By +default, this is created as a copy of pcre_chartables.c.dist, which contains +tables for ASCII coding. However, if --enable-rebuild-chartables is specified +for ./configure, a different version of pcre_chartables.c is built by the +program dftables (compiled from dftables.c), which uses the ANSI C character +handling functions such as isalnum(), isalpha(), isupper(), islower(), etc. to +build the table sources. This means that the default C locale which is set for +your system will control the contents of these default tables. You can change +the default tables by editing pcre_chartables.c and then re-building PCRE. If +you do this, you should take care to ensure that the file does not get +automatically re-generated. The best way to do this is to move +pcre_chartables.c.dist out of the way and replace it with your customized +tables. + +When the dftables program is run as a result of --enable-rebuild-chartables, +it uses the default C locale that is set on your system. It does not pay +attention to the LC_xxx environment variables. In other words, it uses the +system's default locale rather than whatever the compiling user happens to have +set. If you really do want to build a source set of character tables in a +locale that is specified by the LC_xxx variables, you can run the dftables +program by hand with the -L option. For example: + + ./dftables -L pcre_chartables.c.special The first two 256-byte tables provide lower casing and case flipping functions, respectively. The next table consists of three 32-byte bit maps which identify digits, "word" characters, and white space, respectively. These are used when -building 32-byte bit maps that represent character classes. +building 32-byte bit maps that represent character classes for code points less +than 256. The final 256-byte table has bits indicating various character types, as follows: @@ -422,107 +624,144 @@ will cause PCRE to malfunction. -Manifest --------- +File manifest +------------- The distribution should contain the following files: -(A) The actual source files of the PCRE library functions and their - headers: +(A) Source files of the PCRE library functions and their headers: - dftables.c auxiliary program for building chartables.c + dftables.c auxiliary program for building pcre_chartables.c + when --enable-rebuild-chartables is specified - pcreposix.c ) - pcre_compile.c ) - pcre_config.c ) - pcre_dfa_exec.c ) - pcre_exec.c ) - pcre_fullinfo.c ) - pcre_get.c ) sources for the functions in the library, - pcre_globals.c ) and some internal functions that they use - pcre_info.c ) - pcre_maketables.c ) - pcre_ord2utf8.c ) - pcre_refcount.c ) - pcre_study.c ) - pcre_tables.c ) - pcre_try_flipped.c ) - pcre_ucp_searchfuncs.c) - pcre_valid_utf8.c ) - pcre_version.c ) - pcre_xclass.c ) - ucptable.c ) - - pcre_printint.src ) debugging function that is #included in pcretest, and - ) can also be #included in pcre_compile() - - pcre.h the public PCRE header file - pcreposix.h header for the external POSIX wrapper API - pcre_internal.h header for internal use - ucp.h ) headers concerned with - ucpinternal.h ) Unicode property handling - config.in template for config.h, which is built by configure - - pcrecpp.h the header file for the C++ wrapper - pcrecpparg.h.in "source" for another C++ header file - pcrecpp.cc ) - pcre_scanner.cc ) source for the C++ wrapper library - - pcre_stringpiece.h.in "source" for pcre_stringpiece.h, the header for the - C++ stringpiece functions - pcre_stringpiece.cc source for the C++ stringpiece functions - -(B) Auxiliary files: - - AUTHORS information about the author of PCRE - ChangeLog log of changes to the code - INSTALL generic installation instructions - LICENCE conditions for the use of PCRE - COPYING the same, using GNU's standard name - Makefile.in template for Unix Makefile, which is built by configure - NEWS important changes in this release - NON-UNIX-USE notes on building PCRE on non-Unix systems - README this file - RunTest.in template for a Unix shell script for running tests - RunGrepTest.in template for a Unix shell script for pcregrep tests - config.guess ) files used by libtool, - config.sub ) used only when building a shared library - config.h.in "source" for the config.h header file - configure a configuring shell script (built by autoconf) - configure.ac the autoconf input used to build configure - doc/Tech.Notes notes on the encoding - doc/*.3 man page sources for the PCRE functions - doc/*.1 man page sources for pcregrep and pcretest - doc/html/* HTML documentation - doc/pcre.txt plain text version of the man pages - doc/pcretest.txt plain text documentation of test program - doc/perltest.txt plain text documentation of Perl test program - install-sh a shell script for installing files - libpcre.pc.in "source" for libpcre.pc for pkg-config - ltmain.sh file used to build a libtool script - mkinstalldirs script for making install directories - pcretest.c comprehensive test program - pcredemo.c simple demonstration of coding calls to PCRE - perltest Perl test program - pcregrep.c source of a grep utility that uses PCRE - pcre-config.in source of script which retains PCRE information - pcrecpp_unittest.c ) - pcre_scanner_unittest.c ) test programs for the C++ wrapper - pcre_stringpiece_unittest.c ) - testdata/testinput* test data for main library tests - testdata/testoutput* expected test results - testdata/grep* input and output for pcregrep tests + pcre_chartables.c.dist a default set of character tables that assume ASCII + coding; used, unless --enable-rebuild-chartables is + specified, by copying to pcre_chartables.c + + pcreposix.c ) + pcre_compile.c ) + pcre_config.c ) + pcre_dfa_exec.c ) + pcre_exec.c ) + pcre_fullinfo.c ) + pcre_get.c ) sources for the functions in the library, + pcre_globals.c ) and some internal functions that they use + pcre_info.c ) + pcre_maketables.c ) + pcre_newline.c ) + pcre_ord2utf8.c ) + pcre_refcount.c ) + pcre_study.c ) + pcre_tables.c ) + pcre_try_flipped.c ) + pcre_ucd.c ) + pcre_valid_utf8.c ) + pcre_version.c ) + pcre_xclass.c ) + pcre_printint.src ) debugging function that is #included in pcretest, + ) and can also be #included in pcre_compile() + pcre.h.in template for pcre.h when built by "configure" + pcreposix.h header for the external POSIX wrapper API + pcre_internal.h header for internal use + ucp.h header for Unicode property handling + + config.h.in template for config.h, which is built by "configure" + + pcrecpp.h public header file for the C++ wrapper + pcrecpparg.h.in template for another C++ header file + pcre_scanner.h public header file for C++ scanner functions + pcrecpp.cc ) + pcre_scanner.cc ) source for the C++ wrapper library + + pcre_stringpiece.h.in template for pcre_stringpiece.h, the header for the + C++ stringpiece functions + pcre_stringpiece.cc source for the C++ stringpiece functions + +(B) Source files for programs that use PCRE: + + pcredemo.c simple demonstration of coding calls to PCRE + pcregrep.c source of a grep utility that uses PCRE + pcretest.c comprehensive test program + +(C) Auxiliary files: + + 132html script to turn "man" pages into HTML + AUTHORS information about the author of PCRE + ChangeLog log of changes to the code + CleanTxt script to clean nroff output for txt man pages + Detrail script to remove trailing spaces + HACKING some notes about the internals of PCRE + INSTALL generic installation instructions + LICENCE conditions for the use of PCRE + COPYING the same, using GNU's standard name + Makefile.in ) template for Unix Makefile, which is built by + ) "configure" + Makefile.am ) the automake input that was used to create + ) Makefile.in + NEWS important changes in this release + NON-UNIX-USE notes on building PCRE on non-Unix systems + PrepareRelease script to make preparations for "make dist" + README this file + RunTest a Unix shell script for running tests + RunGrepTest a Unix shell script for pcregrep tests + aclocal.m4 m4 macros (generated by "aclocal") + config.guess ) files used by libtool, + config.sub ) used only when building a shared library + configure a configuring shell script (built by autoconf) + configure.ac ) the autoconf input that was used to build + ) "configure" and config.h + depcomp ) script to find program dependencies, generated by + ) automake + doc/*.3 man page sources for the PCRE functions + doc/*.1 man page sources for pcregrep and pcretest + doc/index.html.src the base HTML page + doc/html/* HTML documentation + doc/pcre.txt plain text version of the man pages + doc/pcretest.txt plain text documentation of test program + doc/perltest.txt plain text documentation of Perl test program + install-sh a shell script for installing files + libpcre.pc.in template for libpcre.pc for pkg-config + libpcrecpp.pc.in template for libpcrecpp.pc for pkg-config + ltmain.sh file used to build a libtool script + missing ) common stub for a few missing GNU programs while + ) installing, generated by automake + mkinstalldirs script for making install directories + perltest.pl Perl test program + pcre-config.in source of script which retains PCRE information + pcrecpp_unittest.cc ) + pcre_scanner_unittest.cc ) test programs for the C++ wrapper + pcre_stringpiece_unittest.cc ) + testdata/testinput* test data for main library tests + testdata/testoutput* expected test results + testdata/grep* input and output for pcregrep tests + +(D) Auxiliary files for cmake support + + cmake/COPYING-CMAKE-SCRIPTS + cmake/FindPackageHandleStandardArgs.cmake + cmake/FindReadline.cmake + CMakeLists.txt + config-cmake.h.in -(C) Auxiliary files for Win32 DLL +(E) Auxiliary files for VPASCAL - libpcre.def - libpcreposix.def + makevp.bat + makevp_c.txt + makevp_l.txt + pcregexp.pas -(D) Auxiliary file for VPASCAL +(F) Auxiliary files for building PCRE "by hand" - makevp.bat + pcre.h.generic ) a version of the public PCRE header file + ) for use in non-"configure" environments + config.h.generic ) a version of config.h for use in non-"configure" + ) environments + +(F) Miscellaneous + + RunTest.bat a script for running tests under Windows Philip Hazel Email local part: ph10 Email domain: cam.ac.uk -June 2006 +Last updated: 21 March 2009 Added: freeswitch/trunk/libs/pcre/RunTest.bat ============================================================================== --- (empty file) +++ freeswitch/trunk/libs/pcre/RunTest.bat Mon Jun 8 18:51:30 2009 @@ -0,0 +1,39 @@ + at rem This file was contributed by Ralf Junker, and touched up by + at rem Daniel Richard G. Test 10 added by Philip H. + at rem Philip H also changed test 3 to use "wintest" files. + at rem + at rem MS Windows batch file to run pcretest on testfiles with the correct + at rem options. + at rem + at rem Output is written to a newly created subfolder named "testdata". + +setlocal + +if [%srcdir%]==[] set srcdir=. +if [%pcretest%]==[] set pcretest=pcretest + +if not exist testout md testout + +%pcretest% -q %srcdir%\testdata\testinput1 > testout\testoutput1 +%pcretest% -q %srcdir%\testdata\testinput2 > testout\testoutput2 + at rem %pcretest% -q %srcdir%\testdata\testinput3 > testout\testoutput3 +%pcretest% -q %srcdir%\testdata\wintestinput3 > testout\wintestoutput3 +%pcretest% -q %srcdir%\testdata\testinput4 > testout\testoutput4 +%pcretest% -q %srcdir%\testdata\testinput5 > testout\testoutput5 +%pcretest% -q %srcdir%\testdata\testinput6 > testout\testoutput6 +%pcretest% -q -dfa %srcdir%\testdata\testinput7 > testout\testoutput7 +%pcretest% -q -dfa %srcdir%\testdata\testinput8 > testout\testoutput8 +%pcretest% -q -dfa %srcdir%\testdata\testinput9 > testout\testoutput9 +%pcretest% -q %srcdir%\testdata\testinput10 > testout\testoutput10 + +fc /n %srcdir%\testdata\testoutput1 testout\testoutput1 +fc /n %srcdir%\testdata\testoutput2 testout\testoutput2 +rem fc /n %srcdir%\testdata\testoutput3 testout\testoutput3 +fc /n %srcdir%\testdata\wintestoutput3 testout\wintestoutput3 +fc /n %srcdir%\testdata\testoutput4 testout\testoutput4 +fc /n %srcdir%\testdata\testoutput5 testout\testoutput5 +fc /n %srcdir%\testdata\testoutput6 testout\testoutput6 +fc /n %srcdir%\testdata\testoutput7 testout\testoutput7 +fc /n %srcdir%\testdata\testoutput8 testout\testoutput8 +fc /n %srcdir%\testdata\testoutput9 testout\testoutput9 +fc /n %srcdir%\testdata\testoutput10 testout\testoutput10 Added: freeswitch/trunk/libs/pcre/cmake/COPYING-CMAKE-SCRIPTS ============================================================================== --- (empty file) +++ freeswitch/trunk/libs/pcre/cmake/COPYING-CMAKE-SCRIPTS Mon Jun 8 18:51:30 2009 @@ -0,0 +1,22 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Added: freeswitch/trunk/libs/pcre/cmake/FindPackageHandleStandardArgs.cmake ============================================================================== --- (empty file) +++ freeswitch/trunk/libs/pcre/cmake/FindPackageHandleStandardArgs.cmake Mon Jun 8 18:51:30 2009 @@ -0,0 +1,58 @@ +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... ) +# This macro is intended to be used in FindXXX.cmake modules files. +# It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and +# it also sets the _FOUND variable. +# The package is found if all variables listed are TRUE. +# Example: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR) +# +# LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and +# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE. +# If it is not found and REQUIRED was used, it fails with FATAL_ERROR, +# independent whether QUIET was used or not. +# If it is found, the location is reported using the VAR1 argument, so +# here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out. +# If the second argument is DEFAULT_MSG, the message in the failure case will +# be "Could NOT find LibXml2", if you don't like this message you can specify +# your own custom failure message there. + +MACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 ) + + IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + IF (${_NAME}_FIND_REQUIRED) + SET(_FAIL_MESSAGE "Could not find REQUIRED package ${_NAME}") + ELSE (${_NAME}_FIND_REQUIRED) + SET(_FAIL_MESSAGE "Could not find OPTIONAL package ${_NAME}") + ENDIF (${_NAME}_FIND_REQUIRED) + ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + SET(_FAIL_MESSAGE "${_FAIL_MSG}") + ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + + STRING(TOUPPER ${_NAME} _NAME_UPPER) + + SET(${_NAME_UPPER}_FOUND TRUE) + IF(NOT ${_VAR1}) + SET(${_NAME_UPPER}_FOUND FALSE) + ENDIF(NOT ${_VAR1}) + + FOREACH(_CURRENT_VAR ${ARGN}) + IF(NOT ${_CURRENT_VAR}) + SET(${_NAME_UPPER}_FOUND FALSE) + ENDIF(NOT ${_CURRENT_VAR}) + ENDFOREACH(_CURRENT_VAR) + + IF (${_NAME_UPPER}_FOUND) + IF (NOT ${_NAME}_FIND_QUIETLY) + MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}") + ENDIF (NOT ${_NAME}_FIND_QUIETLY) + ELSE (${_NAME_UPPER}_FOUND) + IF (${_NAME}_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}") + ELSE (${_NAME}_FIND_REQUIRED) + IF (NOT ${_NAME}_FIND_QUIETLY) + MESSAGE(STATUS "${_FAIL_MESSAGE}") + ENDIF (NOT ${_NAME}_FIND_QUIETLY) + ENDIF (${_NAME}_FIND_REQUIRED) + ENDIF (${_NAME_UPPER}_FOUND) +ENDMACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS) Added: freeswitch/trunk/libs/pcre/cmake/FindReadline.cmake ============================================================================== --- (empty file) +++ freeswitch/trunk/libs/pcre/cmake/FindReadline.cmake Mon Jun 8 18:51:30 2009 @@ -0,0 +1,29 @@ +# from http://websvn.kde.org/trunk/KDE/kdeedu/cmake/modules/FindReadline.cmake +# http://websvn.kde.org/trunk/KDE/kdeedu/cmake/modules/COPYING-CMAKE-SCRIPTS +# --> BSD licensed +# +# GNU Readline library finder +if(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND NCURSES_LIBRARY) + set(READLINE_FOUND TRUE) +else(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND NCURSES_LIBRARY) + FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h + /usr/include/readline + ) + +# 2008-04-22 The next clause used to read like this: +# +# FIND_LIBRARY(READLINE_LIBRARY NAMES readline) +# FIND_LIBRARY(NCURSES_LIBRARY NAMES ncurses ) +# include(FindPackageHandleStandardArgs) +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG NCURSES_LIBRARY READLINE_INCLUDE_DIR READLINE_LIBRARY ) +# +# I was advised to modify it such that it will find an ncurses library if +# required, but not if one was explicitly given, that is, it allows the +# default to be overridden. PH + + FIND_LIBRARY(READLINE_LIBRARY NAMES readline) + include(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG READLINE_INCLUDE_DIR READLINE_LIBRARY ) + + MARK_AS_ADVANCED(READLINE_INCLUDE_DIR READLINE_LIBRARY) +endif(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND NCURSES_LIBRARY) Added: freeswitch/trunk/libs/pcre/config-cmake.h.in ============================================================================== --- (empty file) +++ freeswitch/trunk/libs/pcre/config-cmake.h.in Mon Jun 8 18:51:30 2009 @@ -0,0 +1,44 @@ +/* config.h for CMake builds */ + +#cmakedefine HAVE_DIRENT_H 1 +#cmakedefine HAVE_SYS_STAT_H 1 +#cmakedefine HAVE_SYS_TYPES_H 1 +#cmakedefine HAVE_UNISTD_H 1 +#cmakedefine HAVE_WINDOWS_H 1 + +#cmakedefine HAVE_TYPE_TRAITS_H 1 +#cmakedefine HAVE_BITS_TYPE_TRAITS_H 1 + +#cmakedefine HAVE_BCOPY 1 +#cmakedefine HAVE_MEMMOVE 1 +#cmakedefine HAVE_STRERROR 1 +#cmakedefine HAVE_STRTOLL 1 +#cmakedefine HAVE_STRTOQ 1 +#cmakedefine HAVE__STRTOI64 1 + +#cmakedefine PCRE_STATIC 1 + +#cmakedefine SUPPORT_UTF8 1 +#cmakedefine SUPPORT_UCP 1 +#cmakedefine EBCDIC 1 +#cmakedefine BSR_ANYCRLF 1 +#cmakedefine NO_RECURSE 1 + +#cmakedefine HAVE_LONG_LONG 1 +#cmakedefine HAVE_UNSIGNED_LONG_LONG 1 + +#cmakedefine SUPPORT_LIBBZ2 1 +#cmakedefine SUPPORT_LIBZ 1 +#cmakedefine SUPPORT_LIBREADLINE 1 + +#define NEWLINE @NEWLINE@ +#define POSIX_MALLOC_THRESHOLD @PCRE_POSIX_MALLOC_THRESHOLD@ +#define LINK_SIZE @PCRE_LINK_SIZE@ +#define MATCH_LIMIT @PCRE_MATCH_LIMIT@ +#define MATCH_LIMIT_RECURSION @PCRE_MATCH_LIMIT_RECURSION@ + + +#define MAX_NAME_SIZE 32 +#define MAX_NAME_COUNT 10000 + +/* end config.h for CMake builds */ Added: freeswitch/trunk/libs/pcre/config.h.generic ============================================================================== --- (empty file) +++ freeswitch/trunk/libs/pcre/config.h.generic Mon Jun 8 18:51:30 2009 @@ -0,0 +1,313 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + + +/* On Unix-like systems config.h.in is converted by "configure" into config.h. +Some other environments also support the use of "configure". PCRE is written in +Standard C, but there are a few non-standard things it can cope with, allowing +it to run on SunOS4 and other "close to standard" systems. + +If you are going to build PCRE "by hand" on a system without "configure" you +should copy the distributed config.h.generic to config.h, and then set up the +macro definitions the way you need them. You must then add -DHAVE_CONFIG_H to +all of your compile commands, so that config.h is included at the start of +every source. + +Alternatively, you can avoid editing by using -D on the compiler command line +to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H. + +PCRE uses memmove() if HAVE_MEMMOVE is set to 1; otherwise it uses bcopy() if +HAVE_BCOPY is set to 1. If your system has neither bcopy() nor memmove(), set +them both to 0; an emulation function will be used. */ + +/* By default, the \R escape sequence matches any Unicode line ending + character or sequence of characters. If BSR_ANYCRLF is defined, this is + changed so that backslash-R matches only CR, LF, or CRLF. The build- time + default can be overridden by the user of PCRE at runtime. On systems that + support it, "configure" can be used to override the default. */ +/* #undef BSR_ANYCRLF */ + +/* If you are compiling for a system that uses EBCDIC instead of ASCII + character codes, define this macro as 1. On systems that can use + "configure", this can be done via --enable-ebcdic. PCRE will then assume + that all input strings are in EBCDIC. If you do not define this macro, PCRE + will assume input strings are ASCII or UTF-8 Unicode. It is not possible to + build a version of PCRE that supports both EBCDIC and UTF-8. */ +/* #undef EBCDIC */ + +/* Define to 1 if you have the `bcopy' function. */ +#ifndef HAVE_BCOPY +#define HAVE_BCOPY 1 +#endif + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BITS_TYPE_TRAITS_H */ + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_BZLIB_H +#define HAVE_BZLIB_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_DIRENT_H +#define HAVE_DIRENT_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_DLFCN_H +#define HAVE_DLFCN_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_INTTYPES_H +#define HAVE_INTTYPES_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_LIMITS_H +#define HAVE_LIMITS_H 1 +#endif + +/* Define to 1 if the system has the type `long long'. */ +#ifndef HAVE_LONG_LONG +#define HAVE_LONG_LONG 1 +#endif + +/* Define to 1 if you have the `memmove' function. */ +#ifndef HAVE_MEMMOVE +#define HAVE_MEMMOVE 1 +#endif + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_MEMORY_H +#define HAVE_MEMORY_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_READLINE_HISTORY_H +#define HAVE_READLINE_HISTORY_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_READLINE_READLINE_H +#define HAVE_READLINE_READLINE_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_STDINT_H +#define HAVE_STDINT_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_STDLIB_H +#define HAVE_STDLIB_H 1 +#endif + +/* Define to 1 if you have the `strerror' function. */ +#ifndef HAVE_STRERROR +#define HAVE_STRERROR 1 +#endif + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_STRING +#define HAVE_STRING 1 +#endif + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_STRINGS_H +#define HAVE_STRINGS_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_STRING_H +#define HAVE_STRING_H 1 +#endif + +/* Define to 1 if you have the `strtoll' function. */ +/* #undef HAVE_STRTOLL */ + +/* Define to 1 if you have the `strtoq' function. */ +#ifndef HAVE_STRTOQ +#define HAVE_STRTOQ 1 +#endif + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_SYS_STAT_H +#define HAVE_SYS_STAT_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_SYS_TYPES_H +#define HAVE_SYS_TYPES_H 1 +#endif + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TYPE_TRAITS_H */ + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_UNISTD_H +#define HAVE_UNISTD_H 1 +#endif + +/* Define to 1 if the system has the type `unsigned long long'. */ +#ifndef HAVE_UNSIGNED_LONG_LONG +#define HAVE_UNSIGNED_LONG_LONG 1 +#endif + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define to 1 if you have the header file. */ +#ifndef HAVE_ZLIB_H +#define HAVE_ZLIB_H 1 +#endif + +/* Define to 1 if you have the `_strtoi64' function. */ +/* #undef HAVE__STRTOI64 */ + +/* The value of LINK_SIZE determines the number of bytes used to store links + as offsets within the compiled regex. The default is 2, which allows for + compiled patterns up to 64K long. This covers the vast majority of cases. + However, PCRE can also be compiled to use 3 or 4 bytes instead. This allows + for longer patterns in extreme cases. On systems that support it, + "configure" can be used to override this default. */ +#ifndef LINK_SIZE +#define LINK_SIZE 2 +#endif + +/* The value of MATCH_LIMIT determines the default number of times the + internal match() function can be called during a single execution of + pcre_exec(). There is a runtime interface for setting a different limit. + The limit exists in order to catch runaway regular expressions that take + for ever to determine that they do not match. The default is set very large + so that it does not accidentally catch legitimate cases. On systems that + support it, "configure" can be used to override this default default. */ +#ifndef MATCH_LIMIT +#define MATCH_LIMIT 10000000 +#endif + +/* The above limit applies to all calls of match(), whether or not they + increase the recursion depth. In some environments it is desirable to limit + the depth of recursive calls of match() more strictly, in order to restrict + the maximum amount of stack (or heap, if NO_RECURSE is defined) that is + used. The value of MATCH_LIMIT_RECURSION applies only to recursive calls of + match(). To have any useful effect, it must be less than the value of + MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT. There is + a runtime method for setting a different limit. On systems that support it, + "configure" can be used to override the default. */ +#ifndef MATCH_LIMIT_RECURSION +#define MATCH_LIMIT_RECURSION MATCH_LIMIT +#endif + +/* This limit is parameterized just in case anybody ever wants to change it. + Care must be taken if it is increased, because it guards against integer + overflow caused by enormously large patterns. */ +#ifndef MAX_NAME_COUNT +#define MAX_NAME_COUNT 10000 +#endif + +/* This limit is parameterized just in case anybody ever wants to change it. + Care must be taken if it is increased, because it guards against integer + overflow caused by enormously large patterns. */ +#ifndef MAX_NAME_SIZE +#define MAX_NAME_SIZE 32 +#endif + +/* The value of NEWLINE determines the newline character sequence. On systems + that support it, "configure" can be used to override the default, which is + 10. The possible values are 10 (LF), 13 (CR), 3338 (CRLF), -1 (ANY), or -2 + (ANYCRLF). */ +#ifndef NEWLINE +#define NEWLINE 10 +#endif + +/* PCRE uses recursive function calls to handle backtracking while matching. + This can sometimes be a problem on systems that have stacks of limited + size. Define NO_RECURSE to get a version that doesn't use recursion in the + match() function; instead it creates its own stack by steam using + pcre_recurse_malloc() to obtain memory from the heap. For more detail, see + the comments and other stuff just above the match() function. On systems + that support it, "configure" can be used to set this in the Makefile (use + --disable-stack-for-recursion). */ +/* #undef NO_RECURSE */ + +/* Name of package */ +#define PACKAGE "pcre" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "PCRE" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "PCRE 7.9" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "pcre" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "7.9" + + +/* If you are compiling for a system other than a Unix-like system or + Win32, and it needs some magic to be inserted before the definition + of a function that is exported by the library, define this macro to + contain the relevant magic. If you do not define this macro, it + defaults to "extern" for a C compiler and "extern C" for a C++ + compiler on non-Win32 systems. This macro apears at the start of + every exported function that is part of the external API. It does + not appear on functions that are "external" in the C sense, but + which are internal to the library. */ +/* #undef PCRE_EXP_DEFN */ + +/* Define if linking statically (TODO: make nice with Libtool) */ +/* #undef PCRE_STATIC */ + +/* When calling PCRE via the POSIX interface, additional working storage is + required for holding the pointers to capturing substrings because PCRE + requires three integers per substring, whereas the POSIX interface provides + only two. If the number of expected substrings is small, the wrapper + function uses space on the stack, because this is faster than using + malloc() for each call. The threshold above which the stack is no longer + used is defined by POSIX_MALLOC_THRESHOLD. On systems that support it, + "configure" can be used to override this default. */ +#ifndef POSIX_MALLOC_THRESHOLD +#define POSIX_MALLOC_THRESHOLD 10 +#endif + +/* Define to 1 if you have the ANSI C header files. */ +#ifndef STDC_HEADERS +#define STDC_HEADERS 1 +#endif + +/* Define to allow pcregrep to be linked with libbz2, so that it is able to + handle .bz2 files. */ +/* #undef SUPPORT_LIBBZ2 */ + +/* Define to allow pcretest to be linked with libreadline. */ +/* #undef SUPPORT_LIBREADLINE */ + +/* Define to allow pcregrep to be linked with libz, so that it is able to + handle .gz files. */ +/* #undef SUPPORT_LIBZ */ + +/* Define to enable support for Unicode properties */ +/* #undef SUPPORT_UCP */ + +/* Define to enable support for the UTF-8 Unicode encoding. This will work + even in an EBCDIC environment, but it is incompatible with the EBCDIC + macro. That is, PCRE can support *either* EBCDIC code *or* ASCII/UTF-8, but + not both at once. */ +/* #undef SUPPORT_UTF8 */ + +/* Version number of package */ +#ifndef VERSION +#define VERSION "7.9" +#endif + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ Modified: freeswitch/trunk/libs/pcre/config.h.in ============================================================================== --- freeswitch/trunk/libs/pcre/config.h.in (original) +++ freeswitch/trunk/libs/pcre/config.h.in Mon Jun 8 18:51:30 2009 @@ -1,143 +1,248 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ -/* On Unix-like systems config.in is converted by "configure" into config.h. + +/* On Unix-like systems config.h.in is converted by "configure" into config.h. Some other environments also support the use of "configure". PCRE is written in Standard C, but there are a few non-standard things it can cope with, allowing it to run on SunOS4 and other "close to standard" systems. -On a non-Unix-like system you should just copy this file into config.h, and set -up the macros the way you need them. You should normally change the definitions -of HAVE_STRERROR and HAVE_MEMMOVE to 1. Unfortunately, because of the way -autoconf works, these cannot be made the defaults. If your system has bcopy() -and not memmove(), change the definition of HAVE_BCOPY instead of HAVE_MEMMOVE. -If your system has neither bcopy() nor memmove(), leave them both as 0; an -emulation function will be used. */ +If you are going to build PCRE "by hand" on a system without "configure" you +should copy the distributed config.h.generic to config.h, and then set up the +macro definitions the way you need them. You must then add -DHAVE_CONFIG_H to +all of your compile commands, so that config.h is included at the start of +every source. + +Alternatively, you can avoid editing by using -D on the compiler command line +to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H. + +PCRE uses memmove() if HAVE_MEMMOVE is set to 1; otherwise it uses bcopy() if +HAVE_BCOPY is set to 1. If your system has neither bcopy() nor memmove(), set +them both to 0; an emulation function will be used. */ + +/* By default, the \R escape sequence matches any Unicode line ending + character or sequence of characters. If BSR_ANYCRLF is defined, this is + changed so that backslash-R matches only CR, LF, or CRLF. The build- time + default can be overridden by the user of PCRE at runtime. On systems that + support it, "configure" can be used to override the default. */ +#undef BSR_ANYCRLF /* If you are compiling for a system that uses EBCDIC instead of ASCII -character codes, define this macro as 1. On systems that can use "configure", -this can be done via --enable-ebcdic. */ + character codes, define this macro as 1. On systems that can use + "configure", this can be done via --enable-ebcdic. PCRE will then assume + that all input strings are in EBCDIC. If you do not define this macro, PCRE + will assume input strings are ASCII or UTF-8 Unicode. It is not possible to + build a version of PCRE that supports both EBCDIC and UTF-8. */ +#undef EBCDIC -#ifndef EBCDIC -#define EBCDIC 0 -#endif - -/* If you are compiling for a system other than a Unix-like system or Win32, -and it needs some magic to be inserted before the definition of a function that -is exported by the library, define this macro to contain the relevant magic. If -you do not define this macro, it defaults to "extern" for a C compiler and -"extern C" for a C++ compiler on non-Win32 systems. This macro apears at the -start of every exported function that is part of the external API. It does not -appear on functions that are "external" in the C sense, but which are internal -to the library. */ +/* Define to 1 if you have the `bcopy' function. */ +#undef HAVE_BCOPY -/* #define PCRE_DATA_SCOPE */ +/* Define to 1 if you have the header file. */ +#undef HAVE_BITS_TYPE_TRAITS_H -/* Define the following macro to empty if the "const" keyword does not work. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_BZLIB_H -#undef const +/* Define to 1 if you have the header file. */ +#undef HAVE_DIRENT_H -/* Define the following macro to "unsigned" if does not define -size_t. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H -#undef size_t +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H -/* The following two definitions are mainly for the benefit of SunOS4, which -does not have the strerror() or memmove() functions that should be present in -all Standard C libraries. The macros HAVE_STRERROR and HAVE_MEMMOVE should -normally be defined with the value 1 for other systems, but unfortunately we -cannot make this the default because "configure" files generated by autoconf -will only change 0 to 1; they won't change 1 to 0 if the functions are not -found. */ - -#define HAVE_STRERROR 0 -#define HAVE_MEMMOVE 0 - -/* There are some non-Unix-like systems that don't even have bcopy(). If this -macro is false, an emulation is used. If HAVE_MEMMOVE is set to 1, the value of -HAVE_BCOPY is not relevant. */ - -#define HAVE_BCOPY 0 - -/* The value of NEWLINE determines the newline character. The default is to -leave it up to the compiler, but some sites want to force a particular value. -On Unix-like systems, "configure" can be used to override this default. */ - -#ifndef NEWLINE -#define NEWLINE '\n' -#endif - -/* The value of LINK_SIZE determines the number of bytes used to store links as -offsets within the compiled regex. The default is 2, which allows for compiled -patterns up to 64K long. This covers the vast majority of cases. However, PCRE -can also be compiled to use 3 or 4 bytes instead. This allows for longer -patterns in extreme cases. On systems that support it, "configure" can be used -to override this default. */ - -#ifndef LINK_SIZE -#define LINK_SIZE 2 -#endif +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H -/* When calling PCRE via the POSIX interface, additional working storage is -required for holding the pointers to capturing substrings because PCRE requires -three integers per substring, whereas the POSIX interface provides only two. If -the number of expected substrings is small, the wrapper function uses space on -the stack, because this is faster than using malloc() for each call. The -threshold above which the stack is no longer used is defined by POSIX_MALLOC_ -THRESHOLD. On systems that support it, "configure" can be used to override this -default. */ - -#ifndef POSIX_MALLOC_THRESHOLD -#define POSIX_MALLOC_THRESHOLD 10 -#endif +/* Define to 1 if the system has the type `long long'. */ +#undef HAVE_LONG_LONG -/* PCRE uses recursive function calls to handle backtracking while matching. -This can sometimes be a problem on systems that have stacks of limited size. -Define NO_RECURSE to get a version that doesn't use recursion in the match() -function; instead it creates its own stack by steam using pcre_recurse_malloc() -to obtain memory from the heap. For more detail, see the comments and other -stuff just above the match() function. On systems that support it, "configure" -can be used to set this in the Makefile (use --disable-stack-for-recursion). */ - -/* #define NO_RECURSE */ - -/* The value of MATCH_LIMIT determines the default number of times the internal -match() function can be called during a single execution of pcre_exec(). There -is a runtime interface for setting a different limit. The limit exists in order -to catch runaway regular expressions that take for ever to determine that they -do not match. The default is set very large so that it does not accidentally -catch legitimate cases. On systems that support it, "configure" can be used to -override this default default. */ - -#ifndef MATCH_LIMIT -#define MATCH_LIMIT 10000000 -#endif +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_READLINE_HISTORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_READLINE_READLINE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strtoll' function. */ +#undef HAVE_STRTOLL + +/* Define to 1 if you have the `strtoq' function. */ +#undef HAVE_STRTOQ + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TYPE_TRAITS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if the system has the type `unsigned long long'. */ +#undef HAVE_UNSIGNED_LONG_LONG + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINDOWS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ZLIB_H + +/* Define to 1 if you have the `_strtoi64' function. */ +#undef HAVE__STRTOI64 + +/* The value of LINK_SIZE determines the number of bytes used to store links + as offsets within the compiled regex. The default is 2, which allows for + compiled patterns up to 64K long. This covers the vast majority of cases. + However, PCRE can also be compiled to use 3 or 4 bytes instead. This allows + for longer patterns in extreme cases. On systems that support it, + "configure" can be used to override this default. */ +#undef LINK_SIZE + +/* The value of MATCH_LIMIT determines the default number of times the + internal match() function can be called during a single execution of + pcre_exec(). There is a runtime interface for setting a different limit. + The limit exists in order to catch runaway regular expressions that take + for ever to determine that they do not match. The default is set very large + so that it does not accidentally catch legitimate cases. On systems that + support it, "configure" can be used to override this default default. */ +#undef MATCH_LIMIT /* The above limit applies to all calls of match(), whether or not they -increase the recursion depth. In some environments it is desirable to limit the -depth of recursive calls of match() more strictly, in order to restrict the -maximum amount of stack (or heap, if NO_RECURSE is defined) that is used. The -value of MATCH_LIMIT_RECURSION applies only to recursive calls of match(). To -have any useful effect, it must be less than the value of MATCH_LIMIT. There is -a runtime method for setting a different limit. On systems that support it, -"configure" can be used to override this default default. */ - -#ifndef MATCH_LIMIT_RECURSION -#define MATCH_LIMIT_RECURSION MATCH_LIMIT -#endif - -/* These three limits are parameterized just in case anybody ever wants to -change them. Care must be taken if they are increased, because they guard -against integer overflow caused by enormously large patterns. */ - -#ifndef MAX_NAME_SIZE -#define MAX_NAME_SIZE 32 -#endif - -#ifndef MAX_NAME_COUNT -#define MAX_NAME_COUNT 10000 -#endif - -#ifndef MAX_DUPLENGTH -#define MAX_DUPLENGTH 30000 -#endif + increase the recursion depth. In some environments it is desirable to limit + the depth of recursive calls of match() more strictly, in order to restrict + the maximum amount of stack (or heap, if NO_RECURSE is defined) that is + used. The value of MATCH_LIMIT_RECURSION applies only to recursive calls of + match(). To have any useful effect, it must be less than the value of + MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT. There is + a runtime method for setting a different limit. On systems that support it, + "configure" can be used to override the default. */ +#undef MATCH_LIMIT_RECURSION + +/* This limit is parameterized just in case anybody ever wants to change it. + Care must be taken if it is increased, because it guards against integer + overflow caused by enormously large patterns. */ +#undef MAX_NAME_COUNT + +/* This limit is parameterized just in case anybody ever wants to change it. + Care must be taken if it is increased, because it guards against integer + overflow caused by enormously large patterns. */ +#undef MAX_NAME_SIZE + +/* The value of NEWLINE determines the newline character sequence. On systems + that support it, "configure" can be used to override the default, which is + 10. The possible values are 10 (LF), 13 (CR), 3338 (CRLF), -1 (ANY), or -2 + (ANYCRLF). */ +#undef NEWLINE -/* End */ +/* PCRE uses recursive function calls to handle backtracking while matching. + This can sometimes be a problem on systems that have stacks of limited + size. Define NO_RECURSE to get a version that doesn't use recursion in the + match() function; instead it creates its own stack by steam using + pcre_recurse_malloc() to obtain memory from the heap. For more detail, see + the comments and other stuff just above the match() function. On systems + that support it, "configure" can be used to set this in the Makefile (use + --disable-stack-for-recursion). */ +#undef NO_RECURSE + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + + +/* If you are compiling for a system other than a Unix-like system or + Win32, and it needs some magic to be inserted before the definition + of a function that is exported by the library, define this macro to + contain the relevant magic. If you do not define this macro, it + defaults to "extern" for a C compiler and "extern C" for a C++ + compiler on non-Win32 systems. This macro apears at the start of + every exported function that is part of the external API. It does + not appear on functions that are "external" in the C sense, but + which are internal to the library. */ +#undef PCRE_EXP_DEFN + +/* Define if linking statically (TODO: make nice with Libtool) */ +#undef PCRE_STATIC + +/* When calling PCRE via the POSIX interface, additional working storage is + required for holding the pointers to capturing substrings because PCRE + requires three integers per substring, whereas the POSIX interface provides + only two. If the number of expected substrings is small, the wrapper + function uses space on the stack, because this is faster than using + malloc() for each call. The threshold above which the stack is no longer + used is defined by POSIX_MALLOC_THRESHOLD. On systems that support it, + "configure" can be used to override this default. */ +#undef POSIX_MALLOC_THRESHOLD + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to allow pcregrep to be linked with libbz2, so that it is able to + handle .bz2 files. */ +#undef SUPPORT_LIBBZ2 + +/* Define to allow pcretest to be linked with libreadline. */ +#undef SUPPORT_LIBREADLINE + +/* Define to allow pcregrep to be linked with libz, so that it is able to + handle .gz files. */ +#undef SUPPORT_LIBZ + +/* Define to enable support for Unicode properties */ +#undef SUPPORT_UCP + +/* Define to enable support for the UTF-8 Unicode encoding. This will work + even in an EBCDIC environment, but it is incompatible with the EBCDIC + macro. That is, PCRE can support *either* EBCDIC code *or* ASCII/UTF-8, but + not both at once. */ +#undef SUPPORT_UTF8 + +/* Version number of package */ +#undef VERSION + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `unsigned int' if does not define. */ +#undef size_t Modified: freeswitch/trunk/libs/pcre/configure.ac ============================================================================== --- freeswitch/trunk/libs/pcre/configure.ac (original) +++ freeswitch/trunk/libs/pcre/configure.ac Mon Jun 8 18:51:30 2009 @@ -1,91 +1,282 @@ - dnl Process this file with autoconf to produce a configure script. -dnl This configure.in file has been hacked around quite a lot as a result of -dnl patches that various people have sent to me (PH). Sometimes the information -dnl I get is contradictory. I've tried to put in comments that explain things, -dnl but in some cases the information is second-hand and I have no way of -dnl verifying it. I am not an autoconf or libtool expert! +dnl NOTE FOR MAINTAINERS: Do not use major or minor version numbers with +dnl leading zeros, because they may be treated as octal constants. The +dnl PCRE_PRERELEASE feature is for identifying release candidates. It might +dnl be defined as -RC2, for example. For real releases, it should be defined +dnl empty. + +m4_define(pcre_major, [7]) +m4_define(pcre_minor, [9]) +m4_define(pcre_prerelease, []) +m4_define(pcre_date, [2009-04-11]) + +# Libtool shared library interface versions (current:revision:age) +m4_define(libpcre_version, [0:1:0]) +m4_define(libpcreposix_version, [0:0:0]) +m4_define(libpcrecpp_version, [0:0:0]) -dnl This is required at the start; the name is the name of a file -dnl it should be seeing, to verify it is in the same directory. +AC_PREREQ(2.57) +AC_INIT(PCRE, pcre_major.pcre_minor[]pcre_prerelease, , pcre) +AC_CONFIG_SRCDIR([pcre.h.in]) +AM_INIT_AUTOMAKE([dist-bzip2 dist-zip]) +AC_CONFIG_HEADERS(config.h) + +# The default CFLAGS and CXXFLAGS in Autoconf are "-g -O2" for gcc and just +# "-g" for any other compiler. There doesn't seem to be a standard way of +# getting rid of the -g (which I don't think is needed for a production +# library). This fudge seems to achieve the necessary. First, we remember the +# externally set values of CFLAGS and CXXFLAGS. Then call the AC_PROG_CC and +# AC_PROG_CXX macros to find the compilers - if CFLAGS and CXXFLAGS are not +# set, they will be set to Autoconf's defaults. Afterwards, if the original +# values were not set, remove the -g from the Autoconf defaults. +# (PH 02-May-07) -AC_INIT(dftables.c) -AC_CONFIG_SRCDIR([pcre.h]) +remember_set_CFLAGS="$CFLAGS" +remember_set_CXXFLAGS="$CXXFLAGS" -dnl A safety precaution +AC_PROG_CC +AC_PROG_CXX -AC_PREREQ(2.57) +if test "x$remember_set_CFLAGS" = "x" +then + if test "$CFLAGS" = "-g -O2" + then + CFLAGS="-O2" + elif test "$CFLAGS" = "-g" + then + CFLAGS="" + fi +fi -dnl Arrange to build config.h from config.h.in. -dnl Manual says this macro should come right after AC_INIT. -AC_CONFIG_HEADER(config.h) +if test "x$remember_set_CXXFLAGS" = "x" +then + if test "$CXXFLAGS" = "-g -O2" + then + CXXFLAGS="-O2" + elif test "$CXXFLAGS" = "-g" + then + CXXFLAGS="" + fi +fi -dnl Default values for miscellaneous macros +# AC_PROG_CXX will return "g++" even if no c++ compiler is installed. +# Check for that case, and just disable c++ code if g++ doesn't run. +AC_LANG_PUSH(C++) +AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[]),, CXX=""; CXXCP=""; CXXFLAGS="") +AC_LANG_POP -POSIX_MALLOC_THRESHOLD=-DPOSIX_MALLOC_THRESHOLD=10 +AC_PROG_INSTALL +AC_LIBTOOL_WIN32_DLL +AC_PROG_LIBTOOL +AC_PROG_LN_S -dnl Provide versioning information for libtool shared libraries that -dnl are built by default on Unix systems. +PCRE_MAJOR="pcre_major" +PCRE_MINOR="pcre_minor" +PCRE_PRERELEASE="pcre_prerelease" +PCRE_DATE="pcre_date" + +AC_SUBST(PCRE_MAJOR) +AC_SUBST(PCRE_MINOR) +AC_SUBST(PCRE_PRERELEASE) +AC_SUBST(PCRE_DATE) -PCRE_LIB_VERSION=0:1:0 -PCRE_POSIXLIB_VERSION=0:0:0 -PCRE_CPPLIB_VERSION=0:0:0 +# Set a more sensible default value for $(htmldir). +if test "x$htmldir" = 'x${docdir}' +then + htmldir='${docdir}/html' +fi -dnl Find the PCRE version from the pcre.h file. The PCRE_VERSION variable is -dnl substituted in pcre-config.in. +# Handle --disable-cpp +AC_ARG_ENABLE(cpp, + AS_HELP_STRING([--disable-cpp], + [disable C++ support]), + , enable_cpp=yes) + +# Handle --enable-rebuild-chartables +AC_ARG_ENABLE(rebuild-chartables, + AS_HELP_STRING([--enable-rebuild-chartables], + [rebuild character tables in current locale]), + , enable_rebuild_chartables=no) -PCRE_MAJOR=`grep '#define PCRE_MAJOR' ${srcdir}/pcre.h | cut -c 29-` -PCRE_MINOR=`grep '#define PCRE_MINOR' ${srcdir}/pcre.h | cut -c 29-` -PCRE_PRERELEASE=`grep '#define PCRE_PRERELEASE' ${srcdir}/pcre.h | cut -c 29-` -PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR}${PCRE_PRERELEASE} +# Handle --enable-utf8 (disabled by default) +AC_ARG_ENABLE(utf8, + AS_HELP_STRING([--enable-utf8], + [enable UTF-8 support (incompatible with --enable-ebcdic)]), + , enable_utf8=unset) -dnl Handle --disable-cpp +# Handle --enable-unicode-properties +AC_ARG_ENABLE(unicode-properties, + AS_HELP_STRING([--enable-unicode-properties], + [enable Unicode properties support (implies --enable-utf8)]), + , enable_unicode_properties=no) + +# Handle --enable-newline=NL +dnl AC_ARG_ENABLE(newline, +dnl AS_HELP_STRING([--enable-newline=NL], +dnl [use NL as newline (lf, cr, crlf, anycrlf, any; default=lf)]), +dnl , enable_newline=lf) -AC_ARG_ENABLE(cpp, -[ --disable-cpp disable C++ support], -want_cpp="$enableval", want_cpp=yes) +# Separate newline options +ac_pcre_newline=lf +AC_ARG_ENABLE(newline-is-cr, + AS_HELP_STRING([--enable-newline-is-cr], + [use CR as newline character]), + ac_pcre_newline=cr) +AC_ARG_ENABLE(newline-is-lf, + AS_HELP_STRING([--enable-newline-is-lf], + [use LF as newline character (default)]), + ac_pcre_newline=lf) +AC_ARG_ENABLE(newline-is-crlf, + AS_HELP_STRING([--enable-newline-is-crlf], + [use CRLF as newline sequence]), + ac_pcre_newline=crlf) +AC_ARG_ENABLE(newline-is-anyc