Freeswitch-svn
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
April 2007
- 5 participants
- 221 discussions
13 Apr '07
Author: anthm
Date: Fri Apr 13 19:19:51 2007
New Revision: 4930
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
Log:
fix shutdown
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 Apr 13 19:19:51 2007
@@ -1002,8 +1002,13 @@
switch_core_hash_init(&mod_sofia_globals.gateway_hash, module_pool);
switch_mutex_init(&mod_sofia_globals.hash_mutex, SWITCH_MUTEX_NESTED, module_pool);
- config_sofia(0);
+ if (config_sofia(0) != SWITCH_STATUS_SUCCESS) {
+ return SWITCH_STATUS_GENERR;
+ }
+ switch_mutex_lock(mod_sofia_globals.mutex);
+ mod_sofia_globals.running = 1;
+ switch_mutex_unlock(mod_sofia_globals.mutex);
if (switch_event_bind((char *) modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, sofia_presence_event_handler, NULL)
!= SWITCH_STATUS_SUCCESS) {
@@ -1045,17 +1050,21 @@
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
{
-
+ int sanity = 0;
+
sofia_presence_cancel();
switch_mutex_lock(mod_sofia_globals.mutex);
if (mod_sofia_globals.running == 1) {
- mod_sofia_globals.running = -1;
+ mod_sofia_globals.running = 0;
}
switch_mutex_unlock(mod_sofia_globals.mutex);
- while (mod_sofia_globals.running) {
+ while (mod_sofia_globals.threads) {
switch_yield(1000);
+ if (++sanity >= 5000) {
+ break;
+ }
}
su_deinit();
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 Fri Apr 13 19:19:51 2007
@@ -146,6 +146,7 @@
switch_mutex_t *hash_mutex;
uint32_t callid;
int32_t running;
+ int32_t threads;
switch_mutex_t *mutex;
char guess_ip[80];
};
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 Fri Apr 13 19:19:51 2007
@@ -240,6 +240,10 @@
uint32_t gateway_loops = 0;
switch_event_t *s_event;
+ switch_mutex_lock(mod_sofia_globals.mutex);
+ mod_sofia_globals.threads++;
+ switch_mutex_unlock(mod_sofia_globals.mutex);
+
profile->s_root = su_root_create(NULL);
profile->home = su_home_new(sizeof(*profile->home));
@@ -287,7 +291,7 @@
if (!sofia_glue_init_sql(profile)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database!\n");
- return NULL;
+ goto end;
}
@@ -350,8 +354,11 @@
su_root_destroy(profile->s_root);
pool = profile->pool;
switch_core_destroy_memory_pool(&pool);
+
+ end:
+
switch_mutex_lock(mod_sofia_globals.mutex);
- mod_sofia_globals.running = 0;
+ mod_sofia_globals.threads--;
switch_mutex_unlock(mod_sofia_globals.mutex);
return NULL;
@@ -402,9 +409,7 @@
switch_status_t status = SWITCH_STATUS_SUCCESS;
sofia_profile_t *profile = NULL;
char url[512] = "";
- switch_mutex_lock(mod_sofia_globals.mutex);
- mod_sofia_globals.running = 1;
- switch_mutex_unlock(mod_sofia_globals.mutex);
+
if (!reload) {
su_init();
1
0
13 Apr '07
Author: anthm
Date: Fri Apr 13 19:04:24 2007
New Revision: 4929
Modified:
freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
Log:
update
Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c (original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c Fri Apr 13 19:04:24 2007
@@ -104,7 +104,7 @@
}
config_data.name = filename;
- if ((config_data.fd = open(filename, O_CREAT | O_RDWR | O_TRUNC)) > -1) {
+ if ((config_data.fd = open(filename, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
if (!switch_strlen_zero(binding->cred)) {
curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_easy_setopt(curl_handle, CURLOPT_USERPWD, binding->cred);
1
0
13 Apr '07
Author: mikej
Date: Fri Apr 13 18:59:07 2007
New Revision: 4928
Modified:
freeswitch/trunk/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp
Log:
commit patch from http://jira.freeswitch.org/browse/MODAPP-7, thanks Marcel.
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp Fri Apr 13 18:59:07 2007
@@ -245,7 +245,10 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot connect to MySQL Server. The error was: %s\n", error1);
}
else
+ {
connectionstate = 1;
+ conn->reconnect = false;
+ }
mysql_autocommit(conn,0);
stmt = mysql_stmt_init(conn);
1
0
13 Apr '07
Author: mikej
Date: Fri Apr 13 18:51:18 2007
New Revision: 4927
Modified:
freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/socket2me/socket2me.c
freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_ivr.h
freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_types.h
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_bridgecall/mod_bridgecall.c
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_commands/mod_commands.c
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_conference/mod_conference.c
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.h
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_presence.c
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_perl/fs_perl.pm
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_perl/switch_swig_wrap.c
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/branches/mikej/sofiasip-upgrade/src/switch_channel.c
freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr.c
freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr_bridge.c
freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr_originate.c
freeswitch/branches/mikej/sofiasip-upgrade/src/switch_swig.c
Log:
merged changes from trunk revisions 4924-4926.
Modified: freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/socket2me/socket2me.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/socket2me/socket2me.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/socket2me/socket2me.c Fri Apr 13 18:51:18 2007
@@ -42,6 +42,7 @@
#include <unistd.h>
#include <spandsp.h>
+
#define SOCKET2ME_DEBUG 0
#define MAXPENDING 10000
#define RCVBUFSIZE 4198
@@ -178,7 +179,9 @@
fax_state_t fax;
char tmp[512], fn[512], *file_name = "/tmp/test.tiff";
int send_fax = FALSE;
-
+ int g711 = 0;
+ int pcmu = 0;
+
snprintf(sendbuf, sizeof(sendbuf), "connect\n\n");
send(client_socket, sendbuf, strlen(sendbuf), 0);
@@ -189,17 +192,32 @@
#if SOCKET2ME_DEBUG
printf("READ [%s]\n", infobuf);
#endif
+
+ if (cheezy_get_var(infobuf, "Channel-Read-Codec-Name", tmp, sizeof(tmp))) {
+ if (!strcasecmp(tmp, "pcmu")) {
+ g711 = 1;
+ pcmu = 1;
+ } else if (!strcasecmp(tmp, "pcma")) {
+ g711 = 1;
+ }
+ }
+
+
snprintf(sendbuf, sizeof(sendbuf), "sendmsg\n"
"call-command: unicast\n"
"local_ip: %s\n"
"local_port: %d\n"
"remote_ip: %s\n"
"remote_port: %d\n"
- "transport: udp\n\n",
+ "transport: udp\n"
+ "%s"
+ "\n",
local_ip, local_port,
- remote_ip, remote_port
+ remote_ip, remote_port,
+ g711 ? "flags: native\n" : ""
);
+
if (cheezy_get_var(infobuf, "variable_fax_file_name", fn, sizeof(fn))) {
file_name = fn;
}
@@ -267,8 +285,9 @@
for (;;) {
struct sockaddr_in local_addr = {0};
int cliAddrLen = sizeof(local_addr);
- short audioBuffer[1024], outbuf[1024];
- int tx, bigger;
+ unsigned char audiobuf[1024], rawbuf[1024], outbuf[1024];
+ short *usebuf = NULL;
+ int tx, tx_bytes, bigger, sample_count;
fd_set ready;
FD_ZERO(&ready);
@@ -297,23 +316,62 @@
continue;
}
- if ((read_bytes = recvfrom(usock, audioBuffer, sizeof(audioBuffer), 0, (struct sockaddr *) &local_addr, &cliAddrLen)) < 0) {
+ if ((read_bytes = recvfrom(usock, audiobuf, sizeof(audiobuf), 0, (struct sockaddr *) &local_addr, &cliAddrLen)) < 0) {
die("recvfrom() failed");
}
- fax_rx(&fax, (int16_t *)audioBuffer, read_bytes / 2);
+ if (g711) {
+ int i;
+ short *rp = (short *) rawbuf;
+
+ for (i = 0; i < read_bytes; i++) {
+ if (pcmu) {
+ rp[i] = ulaw_to_linear(audiobuf[i]);
+ } else {
+ rp[i] = alaw_to_linear(audiobuf[i]);
+ }
+ }
+ usebuf = rp;
+ sample_count = read_bytes;
+ } else {
+ usebuf = (short *) audiobuf;
+ sample_count = read_bytes / 2;
+ }
+
+ fax_rx(&fax, usebuf, sample_count);
#if SOCKET2ME_DEBUG
printf("Handling client %s:%d %d bytes\n", inet_ntoa(local_addr.sin_addr), ntohs(local_addr.sin_port), read_bytes);
#endif
- if ((tx = fax_tx(&fax, (int16_t *) &outbuf, read_bytes / 2)) < 0) {
+
+
+ if ((tx = fax_tx(&fax, (short *)outbuf, sample_count)) < 0) {
printf("Fax Error\n");
break;
} else if (!tx) {
continue;
}
+
+ if (g711) {
+ int i;
+ short *bp = (short *) outbuf;
+ for (i = 0; i < tx; i++) {
+ if (pcmu) {
+ rawbuf[i] = linear_to_ulaw(bp[i]);
+ } else {
+ rawbuf[i] = linear_to_alaw(bp[i]);
+ }
+ }
+ usebuf = (short *) rawbuf;
+ tx_bytes = tx;
+ } else {
+ usebuf = (short *)outbuf;
+ tx_bytes = tx * 2;
+ }
+
+
cliAddrLen = sizeof(sendaddr);
- if (sendto(usock, outbuf, tx * 2, 0, (struct sockaddr *) &sendaddr, sizeof(sendaddr)) != tx * 2) {
+ if (sendto(usock, usebuf, tx_bytes, 0, (struct sockaddr *) &sendaddr, sizeof(sendaddr)) != sample_count) {
die("sendto() sent a different number of bytes than expected");
}
}
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_ivr.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_ivr.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_ivr.h Fri Apr 13 18:51:18 2007
@@ -78,7 +78,8 @@
switch_port_t local_port,
char *remote_ip,
switch_port_t remote_port,
- char *transport);
+ char *transport,
+ char *flags);
/*!
\brief Generate an XML CDR report.
@@ -282,6 +283,7 @@
\param cid_num_override override the caller id number
\param caller_profile_override override the entire calling caller profile
\return SWITCH_STATUS_SUCCESS if bleg is a running session.
+ \note bleg will be read locked which must be unlocked with switch_core_session_rwunlock() before losing scope
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *session,
switch_core_session_t **bleg,
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_types.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_types.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_types.h Fri Apr 13 18:51:18 2007
@@ -121,7 +121,8 @@
typedef enum {
SUF_NONE = 0,
SUF_THREAD_RUNNING = (1 << 0),
- SUF_READY = (1 << 1)
+ SUF_READY = (1 << 1),
+ SUF_NATIVE = (1 << 2)
} switch_unicast_flag_t;
typedef enum {
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_bridgecall/mod_bridgecall.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_bridgecall/mod_bridgecall.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_bridgecall/mod_bridgecall.c Fri Apr 13 18:51:18 2007
@@ -39,7 +39,7 @@
static void audio_bridge_function(switch_core_session_t *session, char *data)
{
switch_channel_t *caller_channel;
- switch_core_session_t *peer_session;
+ switch_core_session_t *peer_session = NULL;
unsigned int timelimit = 60;
char *var;
uint8_t no_media_bridge = 0;
@@ -98,7 +98,7 @@
if (bad) {
switch_channel_hangup(caller_channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_channel_hangup(peer_channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- return;
+ goto end;
}
}
@@ -113,6 +113,10 @@
switch_ivr_multi_threaded_bridge(session, peer_session, NULL, NULL, NULL);
}
}
+ end:
+ if (peer_session) {
+ switch_core_session_rwunlock(peer_session);
+ }
}
}
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_commands/mod_commands.c Fri Apr 13 18:51:18 2007
@@ -590,7 +590,7 @@
static switch_status_t originate_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream)
{
switch_channel_t *caller_channel;
- switch_core_session_t *caller_session;
+ switch_core_session_t *caller_session = NULL;
char *argv[7] = { 0 };
int i = 0, x, argc = 0;
char *aleg, *exten, *dp, *context, *cid_name, *cid_num;
@@ -684,6 +684,10 @@
stream->write_function(stream, "Created Session: %s\n", switch_core_session_get_uuid(caller_session));
}
+ if (caller_session) {
+ switch_core_session_rwunlock(caller_session);
+ }
+
return SWITCH_STATUS_SUCCESS;;
}
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_conference/mod_conference.c Fri Apr 13 18:51:18 2007
@@ -3476,12 +3476,12 @@
switch_core_session_t *session,
char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause)
{
- switch_core_session_t *peer_session;
+ switch_core_session_t *peer_session = NULL;
switch_channel_t *peer_channel;
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_channel_t *caller_channel = NULL;
char appdata[512];
-
+ int rdlock = 0;
*cause = SWITCH_CAUSE_NORMAL_CLEARING;
@@ -3498,7 +3498,7 @@
peer_channel = switch_core_session_get_channel(peer_session);
assert(peer_channel != NULL);
-
+ rdlock = 1;
goto callup;
}
@@ -3534,7 +3534,7 @@
goto done;
}
-
+ rdlock = 1;
peer_channel = switch_core_session_get_channel(peer_session);
assert(peer_channel != NULL);
@@ -3585,6 +3585,10 @@
if (conference) {
switch_thread_rwlock_unlock(conference->rwlock);
}
+ if (rdlock && peer_session) {
+ switch_core_session_rwunlock(peer_session);
+ }
+
return status;
}
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.c Fri Apr 13 18:51:18 2007
@@ -242,11 +242,6 @@
switch_clear_flag_locked(tech_pvt, TFLAG_IO);
- if (tech_pvt->home) {
- su_home_unref(tech_pvt->home);
- tech_pvt->home = NULL;
- }
-
if (tech_pvt->sofia_private) {
*tech_pvt->sofia_private->uuid = '\0';
}
@@ -847,6 +842,7 @@
sofia_glue_terminate_session(&nsession, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER, __LINE__);
goto done;
}
+ switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(nsession));
data = switch_core_session_strdup(nsession, outbound_profile->destination_number);
profile_name = data;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.h Fri Apr 13 18:51:18 2007
@@ -54,11 +54,6 @@
typedef struct sofia_profile sofia_profile_t;
#define NUA_MAGIC_T sofia_profile_t
-struct sofia_private {
- char uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
- outbound_reg_t *gateway;
-};
-
typedef struct sofia_private sofia_private_t;
struct private_object;
@@ -85,6 +80,13 @@
#include <sofia-sip/nea.h>
#include <sofia-sip/msg_addr.h>
+struct sofia_private {
+ char uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
+ outbound_reg_t *gateway;
+ su_home_t *home;
+};
+
+
#define set_param(ptr,val) if (ptr) {free(ptr) ; ptr = NULL;} if (val) {ptr = strdup(val);}
#define set_anchor(t,m) if (t->Anchor) {delete t->Anchor;} t->Anchor = new SipMessage(m);
@@ -305,7 +307,6 @@
switch_payload_t bcng_pt;
nua_handle_t *nh;
nua_handle_t *nh2;
- su_home_t *home;
sip_contact_t *contact;
};
@@ -330,95 +331,95 @@
/*************************************************************************************************************************************************************/
-switch_status_t sofia_glue_activate_rtp(private_object_t * tech_pvt);
+switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt);
-void sofia_glue_deactivate_rtp(private_object_t * tech_pvt);
+void sofia_glue_deactivate_rtp(private_object_t *tech_pvt);
-void sofia_glue_set_local_sdp(private_object_t * tech_pvt, char *ip, uint32_t port, char *sr, int force);
+void sofia_glue_set_local_sdp(private_object_t *tech_pvt, char *ip, uint32_t port, char *sr, int force);
-void sofia_glue_sofia_glue_tech_set_codecs(private_object_t * tech_pvt);
+void sofia_glue_sofia_glue_tech_set_codecs(private_object_t *tech_pvt);
-void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t * profile, private_object_t * tech_pvt, const char *channame);
+void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *profile, private_object_t *tech_pvt, const char *channame);
void sofia_glue_terminate_session(switch_core_session_t **session, switch_call_cause_t cause, int line);
-switch_status_t sofia_glue_tech_choose_port(private_object_t * tech_pvt);
+switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt);
switch_status_t sofia_glue_do_invite(switch_core_session_t *session);
-uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t * sdp);
+uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp);
-void sofia_presence_establish_presence(sofia_profile_t * profile);
+void sofia_presence_establish_presence(sofia_profile_t *profile);
void sofia_handle_sip_i_state(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
-void sofia_handle_sip_i_refer(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
+void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
-void sofia_handle_sip_i_info(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
+void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
-void sofia_handle_sip_i_invite(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
-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[]);
+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[]);
void sofia_event_callback(nua_event_t event,
int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
-void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t * thread, void *obj);
+void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void *obj);
-void launch_sofia_profile_thread(sofia_profile_t * profile);
+void launch_sofia_profile_thread(sofia_profile_t *profile);
switch_status_t sofia_presence_chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint);
-void sofia_glue_tech_absorb_sdp(private_object_t * tech_pvt);
-switch_status_t sofia_glue_tech_media(private_object_t * tech_pvt, char *r_sdp);
-char *sofia_reg_find_reg_url(sofia_profile_t * profile, const char *user, const char *host, char *val, switch_size_t len);
+void sofia_glue_tech_absorb_sdp(private_object_t *tech_pvt);
+switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, char *r_sdp);
+char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const char *host, char *val, switch_size_t len);
void event_handler(switch_event_t *event);
void sofia_presence_event_handler(switch_event_t *event);
void sofia_presence_mwi_event_handler(switch_event_t *event);
void sofia_presence_cancel(void);
switch_status_t config_sofia(int reload);
-auth_res_t parse_auth(sofia_profile_t * profile, sip_authorization_t const *authorization, const char *regstr, char *np, size_t nplen);
+auth_res_t parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, const char *regstr, char *np, size_t nplen);
void sofia_reg_handle_sip_r_challenge(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
void sofia_reg_handle_sip_r_register(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
void sofia_handle_sip_i_options(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
-void sofia_presence_handle_sip_i_publish(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
+void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
void sofia_presence_handle_sip_i_message(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
void sofia_presence_handle_sip_r_subscribe(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
void sofia_presence_handle_sip_i_subscribe(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
sofia_profile_t *sofia_glue_find_profile(char *key);
-void sofia_glue_add_profile(char *key, sofia_profile_t * profile);
+void sofia_glue_add_profile(char *key, sofia_profile_t *profile);
void sofia_glue_execute_sql(sofia_profile_t *profile, switch_bool_t master, char *sql, switch_mutex_t *mutex);
-void sofia_reg_check_expire(sofia_profile_t * profile, time_t now);
-void sofia_reg_check_gateway(sofia_profile_t * profile, time_t now);
-void sofia_reg_unregister(sofia_profile_t * profile);
+void sofia_reg_check_expire(sofia_profile_t *profile, time_t now);
+void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now);
+void sofia_reg_unregister(sofia_profile_t *profile);
switch_status_t sofia_glue_ext_address_lookup(char **ip, switch_port_t *port, char *sourceip, switch_memory_pool_t *pool);
outbound_reg_t *sofia_reg_find_gateway(char *key);
-void sofia_reg_add_gateway(char *key, outbound_reg_t * gateway);
-void sofia_glue_pass_sdp(private_object_t * tech_pvt, char *sdp);
+void sofia_reg_add_gateway(char *key, outbound_reg_t *gateway);
+void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp);
int sofia_glue_get_user_host(char *in, char **user, char **host);
switch_call_cause_t sofia_glue_sip_cause_to_freeswitch(int status);
void sofia_glue_do_xfer_invite(switch_core_session_t *session);
-uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sip_t const *sip, sofia_regtype_t regtype, char *key, uint32_t keylen);
+uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, sofia_regtype_t regtype, char *key, uint32_t keylen);
const switch_endpoint_interface_t sofia_endpoint_interface;
-void sofia_presence_set_chat_hash(private_object_t * tech_pvt, sip_t const *sip);
+void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip);
switch_status_t sofia_on_hangup(switch_core_session_t *session);
char *sofia_glue_get_url_from_contact(char *buf, uint8_t to_dup);
void sofia_presence_set_hash_key(char *hash_key, int32_t len, sip_t const *sip);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia.c Fri Apr 13 18:51:18 2007
@@ -40,7 +40,7 @@
void sofia_event_callback(nua_event_t event,
int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
struct private_object *tech_pvt = NULL;
auth_res_t auth_res = AUTH_FORBIDDEN;
@@ -231,7 +231,7 @@
-void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t * thread, void *obj)
+void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void *obj)
{
sofia_profile_t *profile = (sofia_profile_t *) obj;
switch_memory_pool_t *pool;
@@ -357,7 +357,7 @@
return NULL;
}
-void launch_sofia_profile_thread(sofia_profile_t * profile)
+void launch_sofia_profile_thread(sofia_profile_t *profile)
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
@@ -798,7 +798,7 @@
void sofia_handle_sip_i_state(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
const char *l_sdp = NULL, *r_sdp = NULL;
int offer_recv = 0, answer_recv = 0, offer_sent = 0, answer_sent = 0;
@@ -838,6 +838,8 @@
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
assert(tech_pvt->nh != NULL);
+
+
if (switch_channel_test_flag(channel, CF_NOMEDIA)) {
switch_set_flag(tech_pvt, TFLAG_NOMEDIA);
@@ -935,7 +937,7 @@
switch_core_session_thread_launch(session);
goto done;
} else {
- sdp_parser_t *parser = sdp_parse(tech_pvt->home, r_sdp, (int) strlen(r_sdp), 0);
+ sdp_parser_t *parser = sdp_parse(tech_pvt->sofia_private->home, r_sdp, (int) strlen(r_sdp), 0);
sdp_session_t *sdp;
uint8_t match = 0;
@@ -958,7 +960,7 @@
switch_core_session_thread_launch(session);
- if (replaces_str && (replaces = sip_replaces_make(tech_pvt->home, replaces_str))
+ if (replaces_str && (replaces = sip_replaces_make(tech_pvt->sofia_private->home, replaces_str))
&& (bnh = nua_handle_by_replaces(nua, replaces))) {
sofia_private_t *b_private;
@@ -1016,7 +1018,7 @@
if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) {
goto done;
} else {
- sdp_parser_t *parser = sdp_parse(tech_pvt->home, r_sdp, (int) strlen(r_sdp), 0);
+ sdp_parser_t *parser = sdp_parse(tech_pvt->sofia_private->home, r_sdp, (int) strlen(r_sdp), 0);
sdp_session_t *sdp;
uint8_t match = 0;
@@ -1084,7 +1086,7 @@
}
goto done;
} else {
- sdp_parser_t *parser = sdp_parse(tech_pvt->home, r_sdp, (int) strlen(r_sdp), 0);
+ sdp_parser_t *parser = sdp_parse(tech_pvt->sofia_private->home, r_sdp, (int) strlen(r_sdp), 0);
sdp_session_t *sdp;
uint8_t match = 0;
@@ -1121,7 +1123,7 @@
case nua_callstate_terminated:
if (session) {
if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
-
+
switch_set_flag_locked(tech_pvt, TFLAG_BYE);
if (switch_test_flag(tech_pvt, TFLAG_NOHUP)) {
switch_clear_flag_locked(tech_pvt, TFLAG_NOHUP);
@@ -1131,13 +1133,19 @@
sofia_glue_terminate_session(&session, sofia_glue_sip_cause_to_freeswitch(status), __LINE__);
}
}
-
+
if (tech_pvt->sofia_private) {
+ if (sofia_private->home) {
+ su_home_unref(sofia_private->home);
+ }
free(tech_pvt->sofia_private);
tech_pvt->sofia_private = NULL;
}
tech_pvt->nh = NULL;
} else if (sofia_private) {
+ if (sofia_private->home) {
+ su_home_unref(sofia_private->home);
+ }
free(sofia_private);
}
@@ -1157,7 +1165,7 @@
/*---------------------------------------*/
-void sofia_handle_sip_i_refer(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[])
+void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[])
{
/* Incoming refer */
sip_from_t const *from;
@@ -1213,7 +1221,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
goto done;
}
- if ((replaces = sip_replaces_make(tech_pvt->home, rep))
+ if ((replaces = sip_replaces_make(tech_pvt->sofia_private->home, rep))
&& (bnh = nua_handle_by_replaces(nua, replaces))) {
sofia_private_t *b_private = NULL;
private_object_t *b_tech_pvt = NULL;
@@ -1319,6 +1327,7 @@
switch_set_flag_locked(tech_pvt, TFLAG_BYE);
nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
+ switch_core_session_rwunlock(tsession);
} else {
goto error;
}
@@ -1396,7 +1405,7 @@
}
-void sofia_handle_sip_i_info(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[])
+void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[])
{
//placeholder for string searching
@@ -1449,7 +1458,7 @@
}
#define url_set_chanvars(session, url, varprefix) _url_set_chanvars(session, url, #varprefix "_user", #varprefix "_host", #varprefix "_port", #varprefix "_uri")
-const char *_url_set_chanvars(switch_core_session_t *session, url_t * url, const char *user_var,
+const char *_url_set_chanvars(switch_core_session_t *session, url_t *url, const char *user_var,
const char *host_var, const char *port_var, const char *uri_var)
{
const char *user = NULL, *host = NULL, *port = NULL;
@@ -1484,7 +1493,7 @@
return uri;
}
-void process_rpid(sip_unknown_t * un, private_object_t * tech_pvt)
+void process_rpid(sip_unknown_t *un, private_object_t *tech_pvt)
{
int argc, x, screen = 1;
char *mydata, *argv[10] = { 0 };
@@ -1530,7 +1539,7 @@
}
}
-void sofia_handle_sip_i_invite(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
switch_core_session_t *session = NULL;
char key[128] = "";
@@ -1575,6 +1584,7 @@
sofia_glue_terminate_session(&session, SWITCH_CAUSE_SWITCH_CONGESTION, __LINE__);
return;
}
+ switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
if (!switch_strlen_zero(key)) {
tech_pvt->key = switch_core_session_strdup(session, key);
@@ -1723,6 +1733,8 @@
abort();
}
memset(tech_pvt->sofia_private, 0, sizeof(*tech_pvt->sofia_private));
+ tech_pvt->sofia_private->home = su_home_new(sizeof(*tech_pvt->sofia_private->home));
+
switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid));
nua_handle_bind(nh, tech_pvt->sofia_private);
tech_pvt->nh = nh;
@@ -1730,7 +1742,7 @@
void sofia_handle_sip_i_options(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
nua_respond(nh, SIP_200_OK,
//SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_glue.c Fri Apr 13 18:51:18 2007
@@ -139,7 +139,7 @@
tech_pvt->local_sdp_str = switch_core_session_strdup(tech_pvt->session, buf);
}
-void sofia_glue_sofia_glue_tech_set_codecs(private_object_t * tech_pvt)
+void sofia_glue_sofia_glue_tech_set_codecs(private_object_t *tech_pvt)
{
switch_channel_t *channel;
char *abs, *codec_string = NULL;
@@ -195,7 +195,7 @@
}
-void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t * profile, private_object_t * tech_pvt, const char *channame)
+void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *profile, private_object_t *tech_pvt, const char *channame)
{
switch_channel_t *channel;
char name[256];
@@ -209,7 +209,7 @@
//switch_channel_set_flag(channel, CF_ACCEPT_CNG);
- switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+
switch_mutex_lock(tech_pvt->flag_mutex);
tech_pvt->flags = profile->flags;
switch_mutex_unlock(tech_pvt->flag_mutex);
@@ -227,8 +227,6 @@
}
tech_pvt->session = session;
- tech_pvt->home = su_home_new(sizeof(*tech_pvt->home));
-
switch_core_session_set_private(session, tech_pvt);
@@ -288,7 +286,7 @@
}
-switch_status_t sofia_glue_tech_choose_port(private_object_t * tech_pvt)
+switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt)
{
char *ip = tech_pvt->profile->rtpip;
switch_channel_t *channel;
@@ -428,6 +426,7 @@
abort();
}
memset(tech_pvt->sofia_private, 0, sizeof(*tech_pvt->sofia_private));
+ tech_pvt->sofia_private->home = su_home_new(sizeof(*tech_pvt->sofia_private->home));
switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid));
nua_handle_bind(tech_pvt->nh, tech_pvt->sofia_private);
@@ -530,7 +529,7 @@
}
-void sofia_glue_tech_absorb_sdp(private_object_t * tech_pvt)
+void sofia_glue_tech_absorb_sdp(private_object_t *tech_pvt)
{
switch_channel_t *channel;
char *sdp_str;
@@ -544,7 +543,7 @@
sdp_media_t *m;
sdp_connection_t *connection;
- if ((parser = sdp_parse(tech_pvt->home, sdp_str, (int) strlen(sdp_str), 0))) {
+ if ((parser = sdp_parse(tech_pvt->sofia_private->home, sdp_str, (int) strlen(sdp_str), 0))) {
if ((sdp = sdp_session(parser))) {
for (m = sdp->sdp_media; m; m = m->m_next) {
if (m->m_type != sdp_media_audio) {
@@ -571,7 +570,7 @@
}
}
-void sofia_glue_deactivate_rtp(private_object_t * tech_pvt)
+void sofia_glue_deactivate_rtp(private_object_t *tech_pvt)
{
int loops = 0; //, sock = -1;
if (switch_rtp_ready(tech_pvt->rtp_session)) {
@@ -583,7 +582,7 @@
}
}
-switch_status_t sofia_glue_tech_set_codec(private_object_t * tech_pvt, int force)
+switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
{
switch_channel_t *channel;
@@ -654,7 +653,7 @@
}
-switch_status_t sofia_glue_activate_rtp(private_object_t * tech_pvt)
+switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt)
{
int bw, ms;
switch_channel_t *channel;
@@ -773,9 +772,9 @@
return SWITCH_STATUS_SUCCESS;
}
-switch_status_t sofia_glue_tech_media(private_object_t * tech_pvt, char *r_sdp)
+switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, char *r_sdp)
{
- sdp_parser_t *parser = sdp_parse(tech_pvt->home, r_sdp, (int) strlen(r_sdp), 0);
+ sdp_parser_t *parser = sdp_parse(tech_pvt->sofia_private->home, r_sdp, (int) strlen(r_sdp), 0);
sdp_session_t *sdp;
uint8_t match = 0;
switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session);
@@ -812,7 +811,7 @@
-uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t * sdp)
+uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp)
{
uint8_t match = 0;
switch_payload_t te = 0, cng_pt = 0;
@@ -1062,7 +1061,7 @@
}
-void sofia_glue_pass_sdp(private_object_t * tech_pvt, char *sdp)
+void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp)
{
char *val;
switch_channel_t *channel;
@@ -1120,7 +1119,7 @@
return profile;
}
-void sofia_glue_add_profile(char *key, sofia_profile_t * profile)
+void sofia_glue_add_profile(char *key, sofia_profile_t *profile)
{
switch_mutex_lock(mod_sofia_globals.hash_mutex);
switch_core_hash_insert(mod_sofia_globals.profile_hash, key, profile);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_presence.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_presence.c Fri Apr 13 18:51:18 2007
@@ -128,7 +128,7 @@
}
}
-void sofia_presence_establish_presence(sofia_profile_t * profile)
+void sofia_presence_establish_presence(sofia_profile_t *profile)
{
if (sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex,
@@ -612,7 +612,7 @@
void sofia_presence_handle_sip_i_subscribe(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
if (sip) {
long exp, exp_raw;
@@ -792,12 +792,12 @@
void sofia_presence_handle_sip_r_subscribe(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
}
-void sofia_presence_handle_sip_i_publish(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
if (sip) {
sip_from_t const *from = sip->sip_from;
@@ -917,7 +917,7 @@
void sofia_presence_handle_sip_i_message(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
if (sip) {
sip_from_t const *from = sip->sip_from;
@@ -1028,7 +1028,7 @@
}
}
-void sofia_presence_set_chat_hash(private_object_t * tech_pvt, sip_t const *sip)
+void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip)
{
char hash_key[256] = "";
char buf[512];
@@ -1038,7 +1038,7 @@
}
if (sofia_reg_find_reg_url(tech_pvt->profile, sip->sip_from->a_url->url_user, sip->sip_from->a_url->url_host, buf, sizeof(buf))) {
- tech_pvt->chat_from = sip_header_as_string(tech_pvt->home, (const sip_header_t *) sip->sip_to);
+ tech_pvt->chat_from = sip_header_as_string(tech_pvt->sofia_private->home, (const sip_header_t *) sip->sip_to);
tech_pvt->chat_to = switch_core_session_strdup(tech_pvt->session, buf);
sofia_presence_set_hash_key(hash_key, sizeof(hash_key), sip);
} else {
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_perl/fs_perl.pm
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_perl/fs_perl.pm (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_perl/fs_perl.pm Fri Apr 13 18:51:18 2007
@@ -76,4 +76,8 @@
package fs_perl;
+*FREESWITCH_PEN = *fs_perlc::FREESWITCH_PEN;
+*FREESWITCH_OID_PREFIX = *fs_perlc::FREESWITCH_OID_PREFIX;
+*FREESWITCH_ITAD = *fs_perlc::FREESWITCH_ITAD;
+*__EXTENSIONS__ = *fs_perlc::__EXTENSIONS__;
1;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_perl/switch_swig_wrap.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_perl/switch_swig_wrap.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_perl/switch_swig_wrap.c Fri Apr 13 18:51:18 2007
@@ -15,8 +15,7 @@
* clashes if multiple interpreters are included
*
************************************************************************/
-#include <switch.h>
-
+#include "switch.h"
#define SWIG_TypeRegister SWIG_Perl_TypeRegister
#define SWIG_TypeCheck SWIG_Perl_TypeCheck
#define SWIG_TypeCast SWIG_Perl_TypeCast
@@ -24,8 +23,8 @@
#define SWIG_TypeName SWIG_Perl_TypeName
#define SWIG_TypeQuery SWIG_Perl_TypeQuery
#define SWIG_TypeClientData SWIG_Perl_TypeClientData
-#define SWIG_PackData SWIG_Perl_PackData
-#define SWIG_UnpackData SWIG_Perl_UnpackData
+#define SWIG_PackData SWIG_Perl_PackData
+#define SWIG_UnpackData SWIG_Perl_UnpackData
/***********************************************************************
@@ -78,205 +77,194 @@
extern "C" {
#endif
- typedef void *(*swig_converter_func) (void *);
- typedef struct swig_type_info *(*swig_dycast_func) (void **);
+typedef void *(*swig_converter_func)(void *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
- typedef struct swig_type_info {
- const char *name;
- swig_converter_func converter;
- const char *str;
- void *clientdata;
- swig_dycast_func dcast;
- struct swig_type_info *next;
- struct swig_type_info *prev;
- } swig_type_info;
+typedef struct swig_type_info {
+ const char *name;
+ swig_converter_func converter;
+ const char *str;
+ void *clientdata;
+ swig_dycast_func dcast;
+ struct swig_type_info *next;
+ struct swig_type_info *prev;
+} swig_type_info;
#ifdef SWIG_NOINCLUDE
- SWIGIMPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *);
- SWIGIMPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *);
- SWIGIMPORT(void *) SWIG_TypeCast(swig_type_info *, void *);
- SWIGIMPORT(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *, void **);
- SWIGIMPORT(const char *) SWIG_TypeName(const swig_type_info *);
- SWIGIMPORT(swig_type_info *) SWIG_TypeQuery(const char *);
- SWIGIMPORT(void) SWIG_TypeClientData(swig_type_info *, void *);
- SWIGIMPORT(char *) SWIG_PackData(char *, void *, int);
- SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int);
+SWIGIMPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *);
+SWIGIMPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *);
+SWIGIMPORT(void *) SWIG_TypeCast(swig_type_info *, void *);
+SWIGIMPORT(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *, void **);
+SWIGIMPORT(const char *) SWIG_TypeName(const swig_type_info *);
+SWIGIMPORT(swig_type_info *) SWIG_TypeQuery(const char *);
+SWIGIMPORT(void) SWIG_TypeClientData(swig_type_info *, void *);
+SWIGIMPORT(char *) SWIG_PackData(char *, void *, int);
+SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int);
#else
- static swig_type_info *swig_type_list = 0;
+static swig_type_info *swig_type_list = 0;
/* Register a type mapping with the type-checking */
- SWIGRUNTIME(swig_type_info *)
- SWIG_TypeRegister(swig_type_info * ti) {
- swig_type_info *tc, *head, *ret, *next;
- /* Check to see if this type has already been registered */
- tc = swig_type_list;
- while (tc) {
- if (strcmp(tc->name, ti->name) == 0) {
- /* Already exists in the table. Just add additional types to the list */
- if (tc->clientdata)
- ti->clientdata = tc->clientdata;
- head = tc;
- next = tc->next;
- goto l1;
- }
- tc = tc->prev;
- }
- head = ti;
- next = 0;
-
- /* Place in list */
- ti->prev = swig_type_list;
- swig_type_list = ti;
-
- /* Build linked lists */
- l1:
- ret = head;
- tc = ti + 1;
- /* Patch up the rest of the links */
- while (tc->name) {
- head->next = tc;
- tc->prev = head;
- head = tc;
- tc++;
- }
- if (next)
- next->prev = head;
- head->next = next;
- return ret;
- }
+SWIGRUNTIME(swig_type_info *)
+SWIG_TypeRegister(swig_type_info *ti) {
+ swig_type_info *tc, *head, *ret, *next;
+ /* Check to see if this type has already been registered */
+ tc = swig_type_list;
+ while (tc) {
+ if (strcmp(tc->name, ti->name) == 0) {
+ /* Already exists in the table. Just add additional types to the list */
+ if (tc->clientdata) ti->clientdata = tc->clientdata;
+ head = tc;
+ next = tc->next;
+ goto l1;
+ }
+ tc = tc->prev;
+ }
+ head = ti;
+ next = 0;
+
+ /* Place in list */
+ ti->prev = swig_type_list;
+ swig_type_list = ti;
+
+ /* Build linked lists */
+ l1:
+ ret = head;
+ tc = ti + 1;
+ /* Patch up the rest of the links */
+ while (tc->name) {
+ head->next = tc;
+ tc->prev = head;
+ head = tc;
+ tc++;
+ }
+ if (next) next->prev = head;
+ head->next = next;
+ return ret;
+}
/* Check the typename */
- SWIGRUNTIME(swig_type_info *)
- SWIG_TypeCheck(char *c, swig_type_info * ty) {
- swig_type_info *s;
- if (!ty)
- return 0; /* Void pointer */
- s = ty->next; /* First element always just a name */
- do {
- if (strcmp(s->name, c) == 0) {
- if (s == ty->next)
- return s;
- /* Move s to the top of the linked list */
- s->prev->next = s->next;
- if (s->next) {
- s->next->prev = s->prev;
- }
- /* Insert s as second element in the list */
- s->next = ty->next;
- if (ty->next)
- ty->next->prev = s;
- ty->next = s;
- s->prev = ty;
- return s;
- }
- s = s->next;
- } while (s && (s != ty->next));
- return 0;
- }
+SWIGRUNTIME(swig_type_info *)
+SWIG_TypeCheck(char *c, swig_type_info *ty) {
+ swig_type_info *s;
+ if (!ty) return 0; /* Void pointer */
+ s = ty->next; /* First element always just a name */
+ do {
+ if (strcmp(s->name,c) == 0) {
+ if (s == ty->next) return s;
+ /* Move s to the top of the linked list */
+ s->prev->next = s->next;
+ if (s->next) {
+ s->next->prev = s->prev;
+ }
+ /* Insert s as second element in the list */
+ s->next = ty->next;
+ if (ty->next) ty->next->prev = s;
+ ty->next = s;
+ s->prev = ty;
+ return s;
+ }
+ s = s->next;
+ } while (s && (s != ty->next));
+ return 0;
+}
/* Cast a pointer up an inheritance hierarchy */
- SWIGRUNTIME(void *)
- SWIG_TypeCast(swig_type_info * ty, void *ptr) {
- if ((!ty) || (!ty->converter))
- return ptr;
- return (*ty->converter) (ptr);
- }
+SWIGRUNTIME(void *)
+SWIG_TypeCast(swig_type_info *ty, void *ptr) {
+ if ((!ty) || (!ty->converter)) return ptr;
+ return (*ty->converter)(ptr);
+}
/* Dynamic pointer casting. Down an inheritance hierarchy */
- SWIGRUNTIME(swig_type_info *)
- SWIG_TypeDynamicCast(swig_type_info * ty, void **ptr) {
- swig_type_info *lastty = ty;
- if (!ty || !ty->dcast)
- return ty;
- while (ty && (ty->dcast)) {
- ty = (*ty->dcast) (ptr);
- if (ty)
- lastty = ty;
- }
- return lastty;
- }
+SWIGRUNTIME(swig_type_info *)
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+ swig_type_info *lastty = ty;
+ if (!ty || !ty->dcast) return ty;
+ while (ty && (ty->dcast)) {
+ ty = (*ty->dcast)(ptr);
+ if (ty) lastty = ty;
+ }
+ return lastty;
+}
/* Return the name associated with this type */
- SWIGRUNTIME(const char *)
- SWIG_TypeName(const swig_type_info * ty) {
- return ty->name;
- }
+SWIGRUNTIME(const char *)
+SWIG_TypeName(const swig_type_info *ty) {
+ return ty->name;
+}
/* Search for a swig_type_info structure */
- SWIGRUNTIME(swig_type_info *)
- SWIG_TypeQuery(const char *name) {
- swig_type_info *ty = swig_type_list;
- while (ty) {
- if (ty->str && (strcmp(name, ty->str) == 0))
- return ty;
- if (ty->name && (strcmp(name, ty->name) == 0))
- return ty;
- ty = ty->prev;
- }
- return 0;
- }
+SWIGRUNTIME(swig_type_info *)
+SWIG_TypeQuery(const char *name) {
+ swig_type_info *ty = swig_type_list;
+ while (ty) {
+ if (ty->str && (strcmp(name,ty->str) == 0)) return ty;
+ if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
+ ty = ty->prev;
+ }
+ return 0;
+}
/* Set the clientdata field for a type */
- SWIGRUNTIME(void)
- SWIG_TypeClientData(swig_type_info * ti, void *clientdata) {
- swig_type_info *tc, *equiv;
- if (ti->clientdata == clientdata)
- return;
- ti->clientdata = clientdata;
- equiv = ti->next;
- while (equiv) {
- if (!equiv->converter) {
- tc = swig_type_list;
- while (tc) {
- if ((strcmp(tc->name, equiv->name) == 0))
- SWIG_TypeClientData(tc, clientdata);
- tc = tc->prev;
- }
- }
- equiv = equiv->next;
- }
- }
+SWIGRUNTIME(void)
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+ swig_type_info *tc, *equiv;
+ if (ti->clientdata == clientdata) return;
+ ti->clientdata = clientdata;
+ equiv = ti->next;
+ while (equiv) {
+ if (!equiv->converter) {
+ tc = swig_type_list;
+ while (tc) {
+ if ((strcmp(tc->name, equiv->name) == 0))
+ SWIG_TypeClientData(tc,clientdata);
+ tc = tc->prev;
+ }
+ }
+ equiv = equiv->next;
+ }
+}
/* Pack binary data into a string */
- SWIGRUNTIME(char *)
- SWIG_PackData(char *c, void *ptr, int sz) {
- static char hex[17] = "0123456789abcdef";
- int i;
- unsigned char *u = (unsigned char *) ptr;
- register unsigned char uu;
- for (i = 0; i < sz; i++, u++) {
- uu = *u;
- *(c++) = hex[(uu & 0xf0) >> 4];
- *(c++) = hex[uu & 0xf];
- }
- return c;
- }
+SWIGRUNTIME(char *)
+SWIG_PackData(char *c, void *ptr, int sz) {
+ static char hex[17] = "0123456789abcdef";
+ int i;
+ unsigned char *u = (unsigned char *) ptr;
+ register unsigned char uu;
+ for (i = 0; i < sz; i++,u++) {
+ uu = *u;
+ *(c++) = hex[(uu & 0xf0) >> 4];
+ *(c++) = hex[uu & 0xf];
+ }
+ return c;
+}
/* Unpack binary data from a string */
- SWIGRUNTIME(char *)
- SWIG_UnpackData(char *c, void *ptr, int sz) {
- register unsigned char uu = 0;
- register int d;
- unsigned char *u = (unsigned char *) ptr;
- int i;
- for (i = 0; i < sz; i++, u++) {
- d = *(c++);
- if ((d >= '0') && (d <= '9'))
- uu = ((d - '0') << 4);
- else if ((d >= 'a') && (d <= 'f'))
- uu = ((d - ('a' - 10)) << 4);
- d = *(c++);
- if ((d >= '0') && (d <= '9'))
- uu |= (d - '0');
- else if ((d >= 'a') && (d <= 'f'))
- uu |= (d - ('a' - 10));
- *u = uu;
- }
- return c;
- }
+SWIGRUNTIME(char *)
+SWIG_UnpackData(char *c, void *ptr, int sz) {
+ register unsigned char uu = 0;
+ register int d;
+ unsigned char *u = (unsigned char *) ptr;
+ int i;
+ for (i = 0; i < sz; i++, u++) {
+ d = *(c++);
+ if ((d >= '0') && (d <= '9'))
+ uu = ((d - '0') << 4);
+ else if ((d >= 'a') && (d <= 'f'))
+ uu = ((d - ('a'-10)) << 4);
+ d = *(c++);
+ if ((d >= '0') && (d <= '9'))
+ uu |= (d - '0');
+ else if ((d >= 'a') && (d <= 'f'))
+ uu |= (d - ('a'-10));
+ *u = uu;
+ }
+ return c;
+}
#endif
@@ -315,30 +303,37 @@
#ifdef __cplusplus
}
#endif
+
/* Macro to call an XS function */
-#ifdef PERL_OBJECT
-# define SWIG_CALLXS(_name) _name(cv,pPerl)
-#else
-# ifndef MULTIPLICITY
-# define SWIG_CALLXS(_name) _name(cv)
-# else
-# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv)
-# endif
-#endif
+
+#ifdef PERL_OBJECT
+# define SWIG_CALLXS(_name) _name(cv,pPerl)
+#else
+# ifndef MULTIPLICITY
+# define SWIG_CALLXS(_name) _name(cv)
+# else
+# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv)
+# endif
+#endif
+
/* Contract support */
+
#define SWIG_contract_assert(expr,msg) if (!(expr)) { SWIG_croak(msg); } else
+
/* Note: SwigMagicFuncHack is a typedef used to get the C++ compiler to just shut up already */
+
#ifdef PERL_OBJECT
#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this;
-typedef int (CPerlObj::*SwigMagicFunc) (SV *, MAGIC *);
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
- typedef int (CPerlObj::*SwigMagicFuncHack) (SV *, MAGIC *);
+typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
+
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
#define SWIGCLASS_STATIC
#else
@@ -346,31 +341,37 @@
#define SWIGCLASS_STATIC static
#ifndef MULTIPLICITY
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
-typedef int (*SwigMagicFunc) (SV *, MAGIC *);
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
- typedef int (*SwigMagicFuncHack) (SV *, MAGIC *);
+typedef int (*SwigMagicFuncHack)(SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
+
+
#else
#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
-typedef int (*SwigMagicFunc) (struct interpreter *, SV *, MAGIC *);
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
- typedef int (*SwigMagicFuncHack) (struct interpreter *, SV *, MAGIC *);
+typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
+
#endif
#endif
+
#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
#endif
+
/* Modifications for newer Perl 5.005 releases */
+
#if !defined(PERL_REVISION) || ((PERL_REVISION >= 5) && ((PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 50))))
# ifndef PL_sv_yes
# define PL_sv_yes sv_yes
@@ -382,7 +383,9 @@
# define PL_na na
# endif
#endif
+
#include <stdlib.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -443,195 +446,187 @@
#ifdef SWIG_NOINCLUDE
- SWIGIMPORT(int) SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *, void **, swig_type_info *, int flags);
- SWIGIMPORT(void) SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *, void *, swig_type_info *, int flags);
- SWIGIMPORT(SV *) SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *, swig_type_info *, int flags);
- SWIGIMPORT(void) SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *, void *, int, swig_type_info *);
- SWIGIMPORT(int) SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *, void *, int, swig_type_info *, int flags);
- SWIGIMPORT(swig_type_info *) SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV * rv, swig_type_info * ty);
- SWIGIMPORT(SV *) SWIG_Perl_SetError(SWIG_MAYBE_PERL_OBJECT char *);
+SWIGIMPORT(int) SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *, void **, swig_type_info *, int flags);
+SWIGIMPORT(void) SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *, void *, swig_type_info *, int flags);
+SWIGIMPORT(SV *) SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *, swig_type_info *, int flags);
+SWIGIMPORT(void) SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *, void *, int, swig_type_info *);
+SWIGIMPORT(int) SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *, void *, int, swig_type_info *, int flags);
+SWIGIMPORT(swig_type_info *) SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV *rv, swig_type_info *ty);
+SWIGIMPORT(SV *) SWIG_Perl_SetError(SWIG_MAYBE_PERL_OBJECT char *);
#else
- SWIGRUNTIME(swig_type_info *)
- SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV * rv, swig_type_info * ty) {
- swig_type_info *s;
- if (!ty)
- return 0; /* Void pointer */
- s = ty->next; /* First element always just a name */
- do {
- if (sv_derived_from(rv, (char *) s->name)) {
- if (s == ty->next)
- return s;
- /* Move s to the top of the linked list */
- s->prev->next = s->next;
- if (s->next) {
- s->next->prev = s->prev;
- }
- /* Insert s as second element in the list */
- s-> next = ty->next;
- if (ty->next)
- ty->next->prev = s;
- ty->next = s;
- s->prev = ty;
- return s;
- }
- s = s->next;
- } while (s && (s != ty->next));
- return 0;
- }
+SWIGRUNTIME(swig_type_info *)
+SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV *rv, swig_type_info *ty) {
+ swig_type_info *s;
+ if (!ty) return 0; /* Void pointer */
+ s = ty->next; /* First element always just a name */
+ do {
+ if (sv_derived_from(rv, (char *) s->name)) {
+ if (s == ty->next) return s;
+ /* Move s to the top of the linked list */
+ s->prev->next = s->next;
+ if (s->next) {
+ s->next->prev = s->prev;
+ }
+ /* Insert s as second element in the list */
+ s->next = ty->next;
+ if (ty->next) ty->next->prev = s;
+ ty->next = s;
+ s->prev = ty;
+ return s;
+ }
+ s = s->next;
+ } while (s && (s != ty->next));
+ return 0;
+}
/* Function for getting a pointer value */
- SWIGRUNTIME(int)
- SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV * sv, void **ptr, swig_type_info * _t, int flags) {
- swig_type_info *tc;
- void *voidptr = (void *) 0;
-
- /* If magical, apply more magic */
- if (SvGMAGICAL(sv))
- mg_get(sv);
-
- /* Check to see if this is an object */
- if (sv_isobject(sv)) {
- SV *tsv = (SV *) SvRV(sv);
- IV tmp = 0;
- if ((SvTYPE(tsv) == SVt_PVHV)) {
- MAGIC *mg;
- if (SvMAGICAL(tsv)) {
- mg = mg_find(tsv, 'P');
- if (mg) {
- SV *rsv = mg->mg_obj;
- if (sv_isobject(rsv)) {
- tmp = SvIV((SV *) SvRV(rsv));
- }
- }
- } else {
- return -1;
- }
- } else {
- tmp = SvIV((SV *) SvRV(sv));
- }
- voidptr = (void *) tmp;
- if (!_t) {
- *(ptr) = voidptr;
- return 0;
- }
- } else if (!SvOK(sv)) { /* Check for undef */
- *(ptr) = (void *) 0;
- return 0;
- } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */
- *(ptr) = (void *) 0;
- if (!SvROK(sv))
- return 0;
- else
- return -1;
- } else { /* Don't know what it is */
- *(ptr) = (void *) 0;
- return -1;
- }
- if (_t) {
- /* Now see if the types match */
- tc = SWIG_TypeCheckRV(sv, _t);
- if (!tc) {
- *ptr = voidptr;
- return -1;
- }
- *ptr = SWIG_TypeCast(tc, voidptr);
- return 0;
- }
- *ptr = voidptr;
- return 0;
- }
-
- SWIGRUNTIME(void)
- SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV * sv, void *ptr, swig_type_info * t, int flags) {
- if (ptr && (flags & SWIG_SHADOW)) {
- SV *self;
- SV *obj = newSV(0);
- HV *hash = newHV();
- HV *stash;
- sv_setref_pv(obj, (char *) t->name, ptr);
- stash = SvSTASH(SvRV(obj));
- if (flags & SWIG_OWNER) {
- HV *hv;
- GV *gv = *(GV **) hv_fetch(stash, "OWNER", 5, TRUE);
- if (!isGV(gv))
- gv_init(gv, stash, "OWNER", 5, FALSE);
- hv = GvHVn(gv);
- hv_store_ent(hv, obj, newSViv(1), 0);
- }
- sv_magic((SV *) hash, (SV *) obj, 'P', Nullch, 0);
- SvREFCNT_dec(obj);
- self = newRV_noinc((SV *) hash);
- sv_setsv(sv, self);
- SvREFCNT_dec((SV *) self);
- sv_bless(sv, stash);
- } else {
- sv_setref_pv(sv, (char *) t->name, ptr);
- }
- }
-
- SWIGRUNTIME(SV *)
- SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info * t, int flags) {
- SV *result = sv_newmortal();
- SWIG_MakePtr(result, ptr, t, flags);
- return result;
- }
-
- SWIGRUNTIME(void)
- SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV * sv, void *ptr, int sz, swig_type_info * type) {
- char result[1024];
- char *r = result;
- if ((2 * sz + 1 + strlen(type->name)) > 1000)
- return;
- *(r++) = '_';
- r = SWIG_PackData(r, ptr, sz);
- strcpy(r, type->name);
- sv_setpv(sv, result);
- }
+SWIGRUNTIME(int)
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+ swig_type_info *tc;
+ void *voidptr = (void *)0;
+
+ /* If magical, apply more magic */
+ if (SvGMAGICAL(sv))
+ mg_get(sv);
+
+ /* Check to see if this is an object */
+ if (sv_isobject(sv)) {
+ SV *tsv = (SV*) SvRV(sv);
+ IV tmp = 0;
+ if ((SvTYPE(tsv) == SVt_PVHV)) {
+ MAGIC *mg;
+ if (SvMAGICAL(tsv)) {
+ mg = mg_find(tsv,'P');
+ if (mg) {
+ SV *rsv = mg->mg_obj;
+ if (sv_isobject(rsv)) {
+ tmp = SvIV((SV*)SvRV(rsv));
+ }
+ }
+ } else {
+ return -1;
+ }
+ } else {
+ tmp = SvIV((SV*)SvRV(sv));
+ }
+ voidptr = (void *)tmp;
+ if (!_t) {
+ *(ptr) = voidptr;
+ return 0;
+ }
+ } else if (! SvOK(sv)) { /* Check for undef */
+ *(ptr) = (void *) 0;
+ return 0;
+ } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */
+ *(ptr) = (void *) 0;
+ if (!SvROK(sv))
+ return 0;
+ else
+ return -1;
+ } else { /* Don't know what it is */
+ *(ptr) = (void *) 0;
+ return -1;
+ }
+ if (_t) {
+ /* Now see if the types match */
+ tc = SWIG_TypeCheckRV(sv,_t);
+ if (!tc) {
+ *ptr = voidptr;
+ return -1;
+ }
+ *ptr = SWIG_TypeCast(tc,voidptr);
+ return 0;
+ }
+ *ptr = voidptr;
+ return 0;
+}
+
+SWIGRUNTIME(void)
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+ if (ptr && (flags & SWIG_SHADOW)) {
+ SV *self;
+ SV *obj=newSV(0);
+ HV *hash=newHV();
+ HV *stash;
+ sv_setref_pv(obj, (char *) t->name, ptr);
+ stash=SvSTASH(SvRV(obj));
+ if (flags & SWIG_OWNER) {
+ HV *hv;
+ GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+ if (!isGV(gv))
+ gv_init(gv, stash, "OWNER", 5, FALSE);
+ hv=GvHVn(gv);
+ hv_store_ent(hv, obj, newSViv(1), 0);
+ }
+ sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+ SvREFCNT_dec(obj);
+ self=newRV_noinc((SV *)hash);
+ sv_setsv(sv, self);
+ SvREFCNT_dec((SV *)self);
+ sv_bless(sv, stash);
+ }
+ else {
+ sv_setref_pv(sv, (char *) t->name, ptr);
+ }
+}
+
+SWIGRUNTIME(SV *)
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+ SV *result = sv_newmortal();
+ SWIG_MakePtr(result, ptr, t, flags);
+ return result;
+}
+
+SWIGRUNTIME(void)
+ SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+ char result[1024];
+ char *r = result;
+ if ((2*sz + 1 + strlen(type->name)) > 1000) return;
+ *(r++) = '_';
+ r = SWIG_PackData(r,ptr,sz);
+ strcpy(r,type->name);
+ sv_setpv(sv, result);
+}
/* Convert a packed value value */
- SWIGRUNTIME(int)
- SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV * obj, void *ptr, int sz, swig_type_info * ty, int flags) {
- swig_type_info *tc;
- char *c = 0;
-
- if ((!obj) || (!SvOK(obj)))
- return -1;
- c = SvPV(obj, PL_na);
- /* Pointer values must start with leading underscore */
- if (*c != '_')
- return -1;
- c++;
- c = SWIG_UnpackData(c, ptr, sz);
- if (ty) {
- tc = SWIG_TypeCheck(c, ty);
- if (!tc)
- return -1;
- }
- return 0;
- }
-
- SWIGRUNTIME(void)
- SWIG_Perl_SetError(SWIG_MAYBE_PERL_OBJECT const char *error) {
- if (error)
- sv_setpv(perl_get_sv("@", TRUE), error);
- }
-
- SWIGRUNTIME(void)
- SWIG_Perl_SetErrorSV(SWIG_MAYBE_PERL_OBJECT SV * error) {
- if (error)
- sv_setsv(perl_get_sv("@", TRUE), error);
- }
-
- SWIGRUNTIME(void)
- SWIG_Perl_SetErrorf(const char *fmt, ...) {
- va_list args;
- va_start(args, fmt);
- sv_vsetpvfn(perl_get_sv("@", TRUE), fmt, strlen(fmt), &args, Null(SV **), 0, Null(bool *));
- va_end(args);
- }
+SWIGRUNTIME(int)
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty, int flags) {
+ swig_type_info *tc;
+ char *c = 0;
+
+ if ((!obj) || (!SvOK(obj))) return -1;
+ c = SvPV(obj, PL_na);
+ /* Pointer values must start with leading underscore */
+ if (*c != '_') return -1;
+ c++;
+ c = SWIG_UnpackData(c,ptr,sz);
+ if (ty) {
+ tc = SWIG_TypeCheck(c,ty);
+ if (!tc) return -1;
+ }
+ return 0;
+}
+
+SWIGRUNTIME(void)
+SWIG_Perl_SetError(SWIG_MAYBE_PERL_OBJECT const char *error) {
+ if (error) sv_setpv(perl_get_sv("@", TRUE), error);
+}
+
+SWIGRUNTIME(void)
+SWIG_Perl_SetErrorSV(SWIG_MAYBE_PERL_OBJECT SV *error) {
+ if (error) sv_setsv(perl_get_sv("@", TRUE), error);
+}
+
+SWIGRUNTIME(void)
+SWIG_Perl_SetErrorf(const char *fmt, ...) {
+ va_list args;
+ va_start(args, fmt);
+ sv_vsetpvfn(perl_get_sv("@", TRUE), fmt, strlen(fmt), &args, Null(SV**), 0, Null(bool*));
+ va_end(args);
+}
#endif
@@ -643,14 +638,14 @@
/* #define SWIG_croakf(x...) { SWIG_SetErrorf(x); goto fail; } */
- typedef XS(SwigPerlWrapper);
- typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+typedef XS(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
/* Structure for command table */
- typedef struct {
- const char *name;
- SwigPerlWrapperPtr wrapper;
- } swig_command_info;
+typedef struct {
+ const char *name;
+ SwigPerlWrapperPtr wrapper;
+} swig_command_info;
/* Information for constant table */
@@ -661,14 +656,14 @@
#define SWIG_BINARY 5
/* Constant information structure */
- typedef struct swig_constant_info {
- int type;
- const char *name;
- long lvalue;
- double dvalue;
- void *pvalue;
- swig_type_info **ptype;
- } swig_constant_info;
+typedef struct swig_constant_info {
+ int type;
+ const char *name;
+ long lvalue;
+ double dvalue;
+ void *pvalue;
+ swig_type_info **ptype;
+} swig_constant_info;
#ifdef __cplusplus
}
@@ -676,36 +671,33 @@
/* Structure for variable table */
typedef struct {
- const char *name;
- SwigMagicFunc set;
- SwigMagicFunc get;
- swig_type_info **type;
+ const char *name;
+ SwigMagicFunc set;
+ SwigMagicFunc get;
+ swig_type_info **type;
} swig_variable_info;
/* Magic variable code */
#ifndef PERL_OBJECT
#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
-#ifndef MULTIPLICITY
-static void _swig_create_magic(SV * sv, char *name, int (*set) (SV *, MAGIC *), int (*get) (SV *, MAGIC *))
-{
-#else
-static void _swig_create_magic(SV * sv, char *name, int (*set) (struct interpreter *, SV *, MAGIC *), int (*get) (struct interpreter *, SV *, MAGIC *))
-{
-#endif
+ #ifndef MULTIPLICITY
+ static void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) {
+ #else
+ static void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) {
+ #endif
#else
# define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
-static void _swig_create_magic(CPerlObj * pPerl, SV * sv, const char *name, int (CPerlObj::*set) (SV *, MAGIC *), int (CPerlObj::*get) (SV *, MAGIC *))
-{
+static void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) {
#endif
- MAGIC *mg;
- sv_magic(sv, sv, 'U', (char *) name, strlen(name));
- mg = mg_find(sv, 'U');
- mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
- mg->mg_virtual->svt_get = (SwigMagicFuncHack) get;
- mg->mg_virtual->svt_set = (SwigMagicFuncHack) set;
- mg->mg_virtual->svt_len = 0;
- mg->mg_virtual->svt_clear = 0;
- mg->mg_virtual->svt_free = 0;
+ MAGIC *mg;
+ sv_magic(sv,sv,'U',(char *) name,strlen(name));
+ mg = mg_find(sv,'U');
+ mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+ mg->mg_virtual->svt_get = (SwigMagicFuncHack) get;
+ mg->mg_virtual->svt_set = (SwigMagicFuncHack) set;
+ mg->mg_virtual->svt_len = 0;
+ mg->mg_virtual->svt_clear = 0;
+ mg->mg_virtual->svt_free = 0;
}
@@ -714,69 +706,69 @@
#ifdef do_open
-#undef do_open
+ #undef do_open
#endif
#ifdef do_close
-#undef do_close
+ #undef do_close
#endif
#ifdef scalar
-#undef scalar
+ #undef scalar
#endif
#ifdef list
-#undef list
+ #undef list
#endif
#ifdef apply
-#undef apply
+ #undef apply
#endif
#ifdef convert
-#undef convert
+ #undef convert
#endif
#ifdef Error
-#undef Error
+ #undef Error
#endif
#ifdef form
-#undef form
+ #undef form
#endif
#ifdef vform
-#undef vform
+ #undef vform
#endif
#ifdef LABEL
-#undef LABEL
+ #undef LABEL
#endif
#ifdef METHOD
-#undef METHOD
+ #undef METHOD
#endif
#ifdef Move
-#undef Move
+ #undef Move
#endif
#ifdef yylex
-#undef yylex
+ #undef yylex
#endif
#ifdef yyparse
-#undef yyparse
+ #undef yyparse
#endif
#ifdef yyerror
-#undef yyerror
+ #undef yyerror
#endif
#ifdef invert
-#undef invert
+ #undef invert
#endif
#ifdef ref
-#undef ref
+ #undef ref
#endif
#ifdef ENTER
-#undef ENTER
+ #undef ENTER
#endif
/* -------- TYPES TABLE (BEGIN) -------- */
-#define SWIGTYPE_p_switch_channel_t swig_types[0]
-#define SWIGTYPE_p_switch_file_handle_t swig_types[1]
-#define SWIGTYPE_p_switch_core_session_t swig_types[2]
-#define SWIGTYPE_p_p_switch_core_session_t swig_types[3]
-#define SWIGTYPE_p_uint32_t swig_types[4]
-#define SWIGTYPE_p_switch_input_callback_function_t swig_types[5]
+#define SWIGTYPE_p_switch_channel_t swig_types[0]
+#define SWIGTYPE_p_switch_file_handle_t swig_types[1]
+#define SWIGTYPE_p_switch_core_session_t swig_types[2]
+#define SWIGTYPE_p_p_switch_core_session_t swig_types[3]
+#define SWIGTYPE_p_uint32_t swig_types[4]
+#define SWIGTYPE_p_switch_input_args_t swig_types[5]
static swig_type_info *swig_types[7];
/* -------- TYPES TABLE (END) -------- */
@@ -791,57 +783,55 @@
#endif
#ifndef PERL_OBJECT
#ifndef MULTIPLICITY
-SWIGEXPORT(void) SWIG_init(CV * cv);
+SWIGEXPORT(void) SWIG_init (CV* cv);
#else
-SWIGEXPORT(void) SWIG_init(pTHXo_ CV * cv);
+SWIGEXPORT(void) SWIG_init (pTHXo_ CV* cv);
#endif
#else
-SWIGEXPORT(void) SWIG_init(CV * cv, CPerlObj *);
+SWIGEXPORT(void) SWIG_init (CV *cv, CPerlObj *);
#endif
- extern void fs_core_set_globals(void);
- extern int fs_core_init(char *);
- extern int fs_core_destroy(void);
- extern int fs_loadable_module_init(void);
- extern int fs_loadable_module_shutdown(void);
- extern int fs_console_loop(void);
- extern void fs_consol_log(char *, char *);
- extern void fs_consol_clean(char *);
- extern switch_core_session_t *fs_core_session_locate(char *);
- extern void fs_channel_answer(switch_core_session_t *);
- extern void fs_channel_pre_answer(switch_core_session_t *);
- extern void fs_channel_hangup(switch_core_session_t *, char *);
- extern void fs_channel_set_variable(switch_core_session_t *, char *, char *);
- extern void fs_channel_get_variable(switch_core_session_t *, char *);
- extern void fs_channel_set_state(switch_core_session_t *, char *);
- extern int fs_ivr_play_file(switch_core_session_t *, char *);
- extern int fs_switch_ivr_record_file(switch_core_session_t *, switch_file_handle_t *, char *,
- switch_input_callback_function_t, void *, unsigned int, unsigned int);
- extern int fs_switch_ivr_sleep(switch_core_session_t *, uint32_t);
- extern int fs_ivr_play_file2(switch_core_session_t *, char *);
- extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *, switch_input_callback_function_t, void *, unsigned int, unsigned int);
- extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *, char *, unsigned int, unsigned int, char const *, char *, unsigned int);
- extern int fs_switch_ivr_originate(switch_core_session_t *, switch_core_session_t **, char *, uint32_t);
- extern int fs_switch_ivr_session_transfer(switch_core_session_t *, char *, char *, char *);
- extern int fs_switch_ivr_speak_text(switch_core_session_t *, char *, char *, uint32_t, char *);
- extern char *fs_switch_channel_get_variable(switch_channel_t *, char *);
- extern int fs_switch_channel_set_variable(switch_channel_t *, char *, char *);
+extern void fs_core_set_globals(void);
+extern int fs_core_init(char *);
+extern int fs_core_destroy(void);
+extern int fs_loadable_module_init(void);
+extern int fs_loadable_module_shutdown(void);
+extern int fs_console_loop(void);
+extern void fs_consol_log(char *,char *);
+extern void fs_consol_clean(char *);
+extern switch_core_session_t *fs_core_session_locate(char *);
+extern void fs_channel_answer(switch_core_session_t *);
+extern void fs_channel_pre_answer(switch_core_session_t *);
+extern void fs_channel_hangup(switch_core_session_t *,char *);
+extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
+extern void fs_channel_get_variable(switch_core_session_t *,char *);
+extern void fs_channel_set_state(switch_core_session_t *,char *);
+extern int fs_ivr_play_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_args_t *);
+extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_args_t *,unsigned int);
+extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
+extern int fs_ivr_play_file2(switch_core_session_t *,char *);
+extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *,switch_input_args_t *,unsigned int);
+extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *,char *,unsigned int,unsigned int,char const *,char *,unsigned int);
+extern int fs_switch_ivr_originate(switch_core_session_t *,switch_core_session_t **,char *,uint32_t);
+extern int fs_switch_ivr_session_transfer(switch_core_session_t *,char *,char *,char *);
+extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,uint32_t,char *);
+extern char *fs_switch_channel_get_variable(switch_channel_t *,char *);
+extern int fs_switch_channel_set_variable(switch_channel_t *,char *,char *);
+
-#include "switch.h"
#ifdef PERL_OBJECT
#define MAGIC_CLASS _wrap_fs_perl_var::
- class _wrap_fs_perl_var:public CPerlObj {
- public:
+class _wrap_fs_perl_var : public CPerlObj {
+public:
#else
#define MAGIC_CLASS
#endif
- SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV * sv, MAGIC * mg)
-{
- MAGIC_PPERL sv = sv;
- mg = mg;
- croak("Value is read-only.");
- return 0;
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *sv, MAGIC *mg) {
+ MAGIC_PPERL
+ sv = sv; mg = mg;
+ croak("Value is read-only.");
+ return 0;
}
@@ -852,974 +842,913 @@
#ifdef __cplusplus
extern "C" {
#endif
- XS(_wrap_fs_core_set_globals) {
- {
- int argvi = 0;
- dXSARGS;
-
- if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: fs_core_set_globals();");
- }
- fs_core_set_globals();
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_core_init) {
- {
- char *arg1;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: fs_core_init(path);");
- }
- if (!SvOK((SV *) ST(0)))
- arg1 = 0;
- else
- arg1 = (char *) SvPV(ST(0), PL_na);
- result = (int) fs_core_init(arg1);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_core_destroy) {
- {
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: fs_core_destroy();");
- }
- result = (int) fs_core_destroy();
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_loadable_module_init) {
- {
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: fs_loadable_module_init();");
- }
- result = (int) fs_loadable_module_init();
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_loadable_module_shutdown) {
- {
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: fs_loadable_module_shutdown();");
- }
- result = (int) fs_loadable_module_shutdown();
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_console_loop) {
- {
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: fs_console_loop();");
- }
- result = (int) fs_console_loop();
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_consol_log) {
- {
- char *arg1;
- char *arg2;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_consol_log(level_str,msg);");
- }
- if (!SvOK((SV *) ST(0)))
- arg1 = 0;
- else
- arg1 = (char *) SvPV(ST(0), PL_na);
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- fs_consol_log(arg1, arg2);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_consol_clean) {
- {
- char *arg1;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: fs_consol_clean(msg);");
- }
- if (!SvOK((SV *) ST(0)))
- arg1 = 0;
- else
- arg1 = (char *) SvPV(ST(0), PL_na);
- fs_consol_clean(arg1);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_core_session_locate) {
- {
- char *arg1;
- switch_core_session_t *result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: fs_core_session_locate(uuid);");
- }
- if (!SvOK((SV *) ST(0)))
- arg1 = 0;
- else
- arg1 = (char *) SvPV(ST(0), PL_na);
- result = (switch_core_session_t *) fs_core_session_locate(arg1);
-
- ST(argvi) = sv_newmortal();
- SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_switch_core_session_t, 0 | 0);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_channel_answer) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: fs_channel_answer(session);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_channel_answer. Expected _p_switch_core_session_t");
- }
- }
- fs_channel_answer(arg1);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_channel_pre_answer) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: fs_channel_pre_answer(session);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_channel_pre_answer. Expected _p_switch_core_session_t");
- }
- }
- fs_channel_pre_answer(arg1);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_channel_hangup) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_channel_hangup(session,cause);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_channel_hangup. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- fs_channel_hangup(arg1, arg2);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_channel_set_variable) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- char *arg3;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: fs_channel_set_variable(session,var,val);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_channel_set_variable. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- if (!SvOK((SV *) ST(2)))
- arg3 = 0;
- else
- arg3 = (char *) SvPV(ST(2), PL_na);
- fs_channel_set_variable(arg1, arg2, arg3);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_channel_get_variable) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_channel_get_variable(session,var);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_channel_get_variable. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- fs_channel_get_variable(arg1, arg2);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_channel_set_state) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_channel_set_state(session,state);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_channel_set_state. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- fs_channel_set_state(arg1, arg2);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_ivr_play_file) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_ivr_play_file(session,file);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_ivr_play_file. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- result = (int) fs_ivr_play_file(arg1, arg2);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_ivr_record_file) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- switch_file_handle_t *arg2 = (switch_file_handle_t *) 0;
- char *arg3;
- switch_input_callback_function_t arg4;
- void *arg5 = (void *) 0;
- unsigned int arg6;
- unsigned int arg7;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 7) || (items > 7)) {
- SWIG_croak("Usage: fs_switch_ivr_record_file(session,fh,file,dtmf_callback,buf,buflen,limit);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_ivr_record_file. Expected _p_switch_core_session_t");
- }
- }
- {
- if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_switch_file_handle_t, 0) < 0) {
- SWIG_croak("Type error in argument 2 of fs_switch_ivr_record_file. Expected _p_switch_file_handle_t");
- }
- }
- if (!SvOK((SV *) ST(2)))
- arg3 = 0;
- else
- arg3 = (char *) SvPV(ST(2), PL_na);
- {
- switch_input_callback_function_t *argp;
- if (SWIG_ConvertPtr(ST(3), (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t, 0) < 0) {
- SWIG_croak("Type error in argument 4 of fs_switch_ivr_record_file. Expected _p_switch_input_callback_function_t");
- }
- arg4 = *argp;
- }
- {
- if (SWIG_ConvertPtr(ST(4), (void **) &arg5, 0, 0) < 0) {
- SWIG_croak("Type error in argument 5 of fs_switch_ivr_record_file. Expected _p_void");
- }
- }
- arg6 = (unsigned int) SvUV(ST(5));
- arg7 = (unsigned int) SvUV(ST(6));
- result = (int) fs_switch_ivr_record_file(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_ivr_sleep) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- uint32_t arg2;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_switch_ivr_sleep(session,ms);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_ivr_sleep. Expected _p_switch_core_session_t");
- }
- }
- {
- uint32_t *argp;
- if (SWIG_ConvertPtr(ST(1), (void **) &argp, SWIGTYPE_p_uint32_t, 0) < 0) {
- SWIG_croak("Type error in argument 2 of fs_switch_ivr_sleep. Expected _p_uint32_t");
- }
- arg2 = *argp;
- }
- result = (int) fs_switch_ivr_sleep(arg1, arg2);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_ivr_play_file2) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_ivr_play_file2(session,file);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_ivr_play_file2. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- result = (int) fs_ivr_play_file2(arg1, arg2);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_ivr_collect_digits_callback) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- switch_input_callback_function_t arg2;
- void *arg3 = (void *) 0;
- unsigned int arg4;
- unsigned int arg5;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 5) || (items > 5)) {
- SWIG_croak("Usage: fs_switch_ivr_collect_digits_callback(session,dtmf_callback,buf,buflen,timeout);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_ivr_collect_digits_callback. Expected _p_switch_core_session_t");
- }
- }
- {
- switch_input_callback_function_t *argp;
- if (SWIG_ConvertPtr(ST(1), (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t, 0) < 0) {
- SWIG_croak("Type error in argument 2 of fs_switch_ivr_collect_digits_callback. Expected _p_switch_input_callback_function_t");
- }
- arg2 = *argp;
- }
- {
- if (SWIG_ConvertPtr(ST(2), (void **) &arg3, 0, 0) < 0) {
- SWIG_croak("Type error in argument 3 of fs_switch_ivr_collect_digits_callback. Expected _p_void");
- }
- }
- arg4 = (unsigned int) SvUV(ST(3));
- arg5 = (unsigned int) SvUV(ST(4));
- result = (int) fs_switch_ivr_collect_digits_callback(arg1, arg2, arg3, arg4, arg5);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_ivr_collect_digits_count) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- unsigned int arg3;
- unsigned int arg4;
- char *arg5;
- char *arg6;
- unsigned int arg7;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 7) || (items > 7)) {
- SWIG_croak("Usage: fs_switch_ivr_collect_digits_count(session,buf,buflen,maxdigits,terminators,terminator,timeout);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_ivr_collect_digits_count. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- arg3 = (unsigned int) SvUV(ST(2));
- arg4 = (unsigned int) SvUV(ST(3));
- if (!SvOK((SV *) ST(4)))
- arg5 = 0;
- else
- arg5 = (char *) SvPV(ST(4), PL_na);
- if (!SvOK((SV *) ST(5)))
- arg6 = 0;
- else
- arg6 = (char *) SvPV(ST(5), PL_na);
- arg7 = (unsigned int) SvUV(ST(6));
- result = (int) fs_switch_ivr_collect_digits_count(arg1, arg2, arg3, arg4, (char const *) arg5, arg6, arg7);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_ivr_originate) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- switch_core_session_t **arg2 = (switch_core_session_t **) 0;
- char *arg3;
- uint32_t arg4;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 4) || (items > 4)) {
- SWIG_croak("Usage: fs_switch_ivr_originate(session,bleg,bridgeto,timelimit_sec);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_ivr_originate. Expected _p_switch_core_session_t");
- }
- }
- {
- if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 2 of fs_switch_ivr_originate. Expected _p_p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(2)))
- arg3 = 0;
- else
- arg3 = (char *) SvPV(ST(2), PL_na);
- {
- uint32_t *argp;
- if (SWIG_ConvertPtr(ST(3), (void **) &argp, SWIGTYPE_p_uint32_t, 0) < 0) {
- SWIG_croak("Type error in argument 4 of fs_switch_ivr_originate. Expected _p_uint32_t");
- }
- arg4 = *argp;
- }
- result = (int) fs_switch_ivr_originate(arg1, arg2, arg3, arg4);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_ivr_session_transfer) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- char *arg3;
- char *arg4;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 4) || (items > 4)) {
- SWIG_croak("Usage: fs_switch_ivr_session_transfer(session,extension,dialplan,context);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_ivr_session_transfer. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- if (!SvOK((SV *) ST(2)))
- arg3 = 0;
- else
- arg3 = (char *) SvPV(ST(2), PL_na);
- if (!SvOK((SV *) ST(3)))
- arg4 = 0;
- else
- arg4 = (char *) SvPV(ST(3), PL_na);
- result = (int) fs_switch_ivr_session_transfer(arg1, arg2, arg3, arg4);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_ivr_speak_text) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- char *arg3;
- uint32_t arg4;
- char *arg5;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 5) || (items > 5)) {
- SWIG_croak("Usage: fs_switch_ivr_speak_text(session,tts_name,voice_name,rate,text);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_ivr_speak_text. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- if (!SvOK((SV *) ST(2)))
- arg3 = 0;
- else
- arg3 = (char *) SvPV(ST(2), PL_na);
- {
- uint32_t *argp;
- if (SWIG_ConvertPtr(ST(3), (void **) &argp, SWIGTYPE_p_uint32_t, 0) < 0) {
- SWIG_croak("Type error in argument 4 of fs_switch_ivr_speak_text. Expected _p_uint32_t");
- }
- arg4 = *argp;
- }
- if (!SvOK((SV *) ST(4)))
- arg5 = 0;
- else
- arg5 = (char *) SvPV(ST(4), PL_na);
- result = (int) fs_switch_ivr_speak_text(arg1, arg2, arg3, arg4, arg5);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_channel_get_variable) {
- {
- switch_channel_t *arg1 = (switch_channel_t *) 0;
- char *arg2;
- char *result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_switch_channel_get_variable(channel,varname);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_channel_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_channel_get_variable. Expected _p_switch_channel_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- result = (char *) fs_switch_channel_get_variable(arg1, arg2);
-
- ST(argvi) = sv_newmortal();
- if (result) {
- sv_setpv((SV *) ST(argvi++), (char *) result);
- } else {
- sv_setsv((SV *) ST(argvi++), &PL_sv_undef);
- }
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_channel_set_variable) {
- {
- switch_channel_t *arg1 = (switch_channel_t *) 0;
- char *arg2;
- char *arg3;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: fs_switch_channel_set_variable(channel,varname,value);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_channel_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_channel_set_variable. Expected _p_switch_channel_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- if (!SvOK((SV *) ST(2)))
- arg3 = 0;
- else
- arg3 = (char *) SvPV(ST(2), PL_na);
- result = (int) fs_switch_channel_set_variable(arg1, arg2, arg3);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
+XS(_wrap_fs_core_set_globals) {
+ {
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: fs_core_set_globals();");
+ }
+ fs_core_set_globals();
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_core_init) {
+ {
+ char *arg1 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: fs_core_init(path);");
+ }
+ if (!SvOK((SV*) ST(0))) arg1 = 0;
+ else arg1 = (char *) SvPV(ST(0), PL_na);
+ result = (int)fs_core_init(arg1);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_core_destroy) {
+ {
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: fs_core_destroy();");
+ }
+ result = (int)fs_core_destroy();
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_loadable_module_init) {
+ {
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: fs_loadable_module_init();");
+ }
+ result = (int)fs_loadable_module_init();
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_loadable_module_shutdown) {
+ {
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: fs_loadable_module_shutdown();");
+ }
+ result = (int)fs_loadable_module_shutdown();
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_console_loop) {
+ {
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: fs_console_loop();");
+ }
+ result = (int)fs_console_loop();
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_consol_log) {
+ {
+ char *arg1 ;
+ char *arg2 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: fs_consol_log(level_str,msg);");
+ }
+ if (!SvOK((SV*) ST(0))) arg1 = 0;
+ else arg1 = (char *) SvPV(ST(0), PL_na);
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ fs_consol_log(arg1,arg2);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_consol_clean) {
+ {
+ char *arg1 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: fs_consol_clean(msg);");
+ }
+ if (!SvOK((SV*) ST(0))) arg1 = 0;
+ else arg1 = (char *) SvPV(ST(0), PL_na);
+ fs_consol_clean(arg1);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_core_session_locate) {
+ {
+ char *arg1 ;
+ switch_core_session_t *result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: fs_core_session_locate(uuid);");
+ }
+ if (!SvOK((SV*) ST(0))) arg1 = 0;
+ else arg1 = (char *) SvPV(ST(0), PL_na);
+ result = (switch_core_session_t *)fs_core_session_locate(arg1);
+
+ ST(argvi) = sv_newmortal();
+ SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_switch_core_session_t, 0|0);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_channel_answer) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: fs_channel_answer(session);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_channel_answer. Expected _p_switch_core_session_t");
+ }
+ }
+ fs_channel_answer(arg1);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_channel_pre_answer) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: fs_channel_pre_answer(session);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_channel_pre_answer. Expected _p_switch_core_session_t");
+ }
+ }
+ fs_channel_pre_answer(arg1);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_channel_hangup) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: fs_channel_hangup(session,cause);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_channel_hangup. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ fs_channel_hangup(arg1,arg2);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_channel_set_variable) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ char *arg3 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: fs_channel_set_variable(session,var,val);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_channel_set_variable. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ if (!SvOK((SV*) ST(2))) arg3 = 0;
+ else arg3 = (char *) SvPV(ST(2), PL_na);
+ fs_channel_set_variable(arg1,arg2,arg3);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_channel_get_variable) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: fs_channel_get_variable(session,var);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_channel_get_variable. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ fs_channel_get_variable(arg1,arg2);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_channel_set_state) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: fs_channel_set_state(session,state);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_channel_set_state. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ fs_channel_set_state(arg1,arg2);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_ivr_play_file) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ switch_file_handle_t *arg2 = (switch_file_handle_t *) 0 ;
+ char *arg3 ;
+ switch_input_args_t *arg4 = (switch_input_args_t *) 0 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: fs_ivr_play_file(session,fh,file,args);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_ivr_play_file. Expected _p_switch_core_session_t");
+ }
+ }
+ {
+ if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_switch_file_handle_t,0) < 0) {
+ SWIG_croak("Type error in argument 2 of fs_ivr_play_file. Expected _p_switch_file_handle_t");
+ }
+ }
+ if (!SvOK((SV*) ST(2))) arg3 = 0;
+ else arg3 = (char *) SvPV(ST(2), PL_na);
+ {
+ if (SWIG_ConvertPtr(ST(3), (void **) &arg4, SWIGTYPE_p_switch_input_args_t,0) < 0) {
+ SWIG_croak("Type error in argument 4 of fs_ivr_play_file. Expected _p_switch_input_args_t");
+ }
+ }
+ result = (int)fs_ivr_play_file(arg1,arg2,arg3,arg4);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_ivr_record_file) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ switch_file_handle_t *arg2 = (switch_file_handle_t *) 0 ;
+ char *arg3 ;
+ switch_input_args_t *arg4 = (switch_input_args_t *) 0 ;
+ unsigned int arg5 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 5) || (items > 5)) {
+ SWIG_croak("Usage: fs_switch_ivr_record_file(session,fh,file,args,limit);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_ivr_record_file. Expected _p_switch_core_session_t");
+ }
+ }
+ {
+ if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_switch_file_handle_t,0) < 0) {
+ SWIG_croak("Type error in argument 2 of fs_switch_ivr_record_file. Expected _p_switch_file_handle_t");
+ }
+ }
+ if (!SvOK((SV*) ST(2))) arg3 = 0;
+ else arg3 = (char *) SvPV(ST(2), PL_na);
+ {
+ if (SWIG_ConvertPtr(ST(3), (void **) &arg4, SWIGTYPE_p_switch_input_args_t,0) < 0) {
+ SWIG_croak("Type error in argument 4 of fs_switch_ivr_record_file. Expected _p_switch_input_args_t");
+ }
+ }
+ arg5 = (unsigned int) SvUV(ST(4));
+ result = (int)fs_switch_ivr_record_file(arg1,arg2,arg3,arg4,arg5);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_ivr_sleep) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ uint32_t arg2 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: fs_switch_ivr_sleep(session,ms);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_ivr_sleep. Expected _p_switch_core_session_t");
+ }
+ }
+ {
+ uint32_t * argp;
+ if (SWIG_ConvertPtr(ST(1),(void **) &argp, SWIGTYPE_p_uint32_t,0) < 0) {
+ SWIG_croak("Type error in argument 2 of fs_switch_ivr_sleep. Expected _p_uint32_t");
+ }
+ arg2 = *argp;
+ }
+ result = (int)fs_switch_ivr_sleep(arg1,arg2);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_ivr_play_file2) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: fs_ivr_play_file2(session,file);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_ivr_play_file2. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ result = (int)fs_ivr_play_file2(arg1,arg2);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_ivr_collect_digits_callback) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ switch_input_args_t *arg2 = (switch_input_args_t *) 0 ;
+ unsigned int arg3 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: fs_switch_ivr_collect_digits_callback(session,args,timeout);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_ivr_collect_digits_callback. Expected _p_switch_core_session_t");
+ }
+ }
+ {
+ if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_switch_input_args_t,0) < 0) {
+ SWIG_croak("Type error in argument 2 of fs_switch_ivr_collect_digits_callback. Expected _p_switch_input_args_t");
+ }
+ }
+ arg3 = (unsigned int) SvUV(ST(2));
+ result = (int)fs_switch_ivr_collect_digits_callback(arg1,arg2,arg3);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_ivr_collect_digits_count) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ unsigned int arg3 ;
+ unsigned int arg4 ;
+ char *arg5 ;
+ char *arg6 ;
+ unsigned int arg7 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 7) || (items > 7)) {
+ SWIG_croak("Usage: fs_switch_ivr_collect_digits_count(session,buf,buflen,maxdigits,terminators,terminator,timeout);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_ivr_collect_digits_count. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ arg3 = (unsigned int) SvUV(ST(2));
+ arg4 = (unsigned int) SvUV(ST(3));
+ if (!SvOK((SV*) ST(4))) arg5 = 0;
+ else arg5 = (char *) SvPV(ST(4), PL_na);
+ if (!SvOK((SV*) ST(5))) arg6 = 0;
+ else arg6 = (char *) SvPV(ST(5), PL_na);
+ arg7 = (unsigned int) SvUV(ST(6));
+ result = (int)fs_switch_ivr_collect_digits_count(arg1,arg2,arg3,arg4,(char const *)arg5,arg6,arg7);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_ivr_originate) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ switch_core_session_t **arg2 = (switch_core_session_t **) 0 ;
+ char *arg3 ;
+ uint32_t arg4 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: fs_switch_ivr_originate(session,bleg,bridgeto,timelimit_sec);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_ivr_originate. Expected _p_switch_core_session_t");
+ }
+ }
+ {
+ if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 2 of fs_switch_ivr_originate. Expected _p_p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(2))) arg3 = 0;
+ else arg3 = (char *) SvPV(ST(2), PL_na);
+ {
+ uint32_t * argp;
+ if (SWIG_ConvertPtr(ST(3),(void **) &argp, SWIGTYPE_p_uint32_t,0) < 0) {
+ SWIG_croak("Type error in argument 4 of fs_switch_ivr_originate. Expected _p_uint32_t");
+ }
+ arg4 = *argp;
+ }
+ result = (int)fs_switch_ivr_originate(arg1,arg2,arg3,arg4);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_ivr_session_transfer) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ char *arg3 ;
+ char *arg4 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: fs_switch_ivr_session_transfer(session,extension,dialplan,context);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_ivr_session_transfer. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ if (!SvOK((SV*) ST(2))) arg3 = 0;
+ else arg3 = (char *) SvPV(ST(2), PL_na);
+ if (!SvOK((SV*) ST(3))) arg4 = 0;
+ else arg4 = (char *) SvPV(ST(3), PL_na);
+ result = (int)fs_switch_ivr_session_transfer(arg1,arg2,arg3,arg4);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_ivr_speak_text) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ char *arg3 ;
+ uint32_t arg4 ;
+ char *arg5 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 5) || (items > 5)) {
+ SWIG_croak("Usage: fs_switch_ivr_speak_text(session,tts_name,voice_name,rate,text);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_ivr_speak_text. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ if (!SvOK((SV*) ST(2))) arg3 = 0;
+ else arg3 = (char *) SvPV(ST(2), PL_na);
+ {
+ uint32_t * argp;
+ if (SWIG_ConvertPtr(ST(3),(void **) &argp, SWIGTYPE_p_uint32_t,0) < 0) {
+ SWIG_croak("Type error in argument 4 of fs_switch_ivr_speak_text. Expected _p_uint32_t");
+ }
+ arg4 = *argp;
+ }
+ if (!SvOK((SV*) ST(4))) arg5 = 0;
+ else arg5 = (char *) SvPV(ST(4), PL_na);
+ result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_channel_get_variable) {
+ {
+ switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+ char *arg2 ;
+ char *result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: fs_switch_channel_get_variable(channel,varname);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_channel_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_channel_get_variable. Expected _p_switch_channel_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ result = (char *)fs_switch_channel_get_variable(arg1,arg2);
+
+ ST(argvi) = sv_newmortal();
+ if (result) {
+ sv_setpv((SV*)ST(argvi++), (char *) result);
+ } else {
+ sv_setsv((SV*)ST(argvi++), &PL_sv_undef);
+ }
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_channel_set_variable) {
+ {
+ switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+ char *arg2 ;
+ char *arg3 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: fs_switch_channel_set_variable(channel,varname,value);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_channel_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_channel_set_variable. Expected _p_switch_channel_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ if (!SvOK((SV*) ST(2))) arg3 = 0;
+ else arg3 = (char *) SvPV(ST(2), PL_na);
+ result = (int)fs_switch_channel_set_variable(arg1,arg2,arg3);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
- static swig_type_info _swigt__p_switch_channel_t[] = { {"_p_switch_channel_t", 0, "switch_channel_t *", 0}, {"_p_switch_channel_t"}, {0} };
- static swig_type_info _swigt__p_switch_file_handle_t[] =
- { {"_p_switch_file_handle_t", 0, "switch_file_handle_t *", 0}, {"_p_switch_file_handle_t"}, {0} };
- static swig_type_info _swigt__p_switch_core_session_t[] =
- { {"_p_switch_core_session_t", 0, "switch_core_session_t *", 0}, {"_p_switch_core_session_t"}, {0} };
- static swig_type_info _swigt__p_p_switch_core_session_t[] =
- { {"_p_p_switch_core_session_t", 0, "switch_core_session_t **", 0}, {"_p_p_switch_core_session_t"}, {0} };
- static swig_type_info _swigt__p_uint32_t[] = { {"_p_uint32_t", 0, "uint32_t *", 0}, {"_p_uint32_t"}, {0} };
- static swig_type_info _swigt__p_switch_input_callback_function_t[] =
- { {"_p_switch_input_callback_function_t", 0, "switch_input_callback_function_t *", 0},
- {"_p_switch_input_callback_function_t"}, {0}
- };
-
- static swig_type_info *swig_types_initial[] = {
- _swigt__p_switch_channel_t,
- _swigt__p_switch_file_handle_t,
- _swigt__p_switch_core_session_t,
- _swigt__p_p_switch_core_session_t,
- _swigt__p_uint32_t,
- _swigt__p_switch_input_callback_function_t,
- 0
- };
+static swig_type_info _swigt__p_switch_channel_t[] = {{"_p_switch_channel_t", 0, "switch_channel_t *", 0},{"_p_switch_channel_t"},{0}};
+static swig_type_info _swigt__p_switch_file_handle_t[] = {{"_p_switch_file_handle_t", 0, "switch_file_handle_t *", 0},{"_p_switch_file_handle_t"},{0}};
+static swig_type_info _swigt__p_switch_core_session_t[] = {{"_p_switch_core_session_t", 0, "switch_core_session_t *", 0},{"_p_switch_core_session_t"},{0}};
+static swig_type_info _swigt__p_p_switch_core_session_t[] = {{"_p_p_switch_core_session_t", 0, "switch_core_session_t **", 0},{"_p_p_switch_core_session_t"},{0}};
+static swig_type_info _swigt__p_uint32_t[] = {{"_p_uint32_t", 0, "uint32_t *", 0},{"_p_uint32_t"},{0}};
+static swig_type_info _swigt__p_switch_input_args_t[] = {{"_p_switch_input_args_t", 0, "switch_input_args_t *", 0},{"_p_switch_input_args_t"},{0}};
+
+static swig_type_info *swig_types_initial[] = {
+_swigt__p_switch_channel_t,
+_swigt__p_switch_file_handle_t,
+_swigt__p_switch_core_session_t,
+_swigt__p_p_switch_core_session_t,
+_swigt__p_uint32_t,
+_swigt__p_switch_input_args_t,
+0
+};
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
- static swig_constant_info swig_constants[] = {
- {0}
- };
+static swig_constant_info swig_constants[] = {
+{ SWIG_STRING, (char *) SWIG_prefix "FREESWITCH_PEN", 0, 0, (void *)"27880", 0},
+{ SWIG_STRING, (char *) SWIG_prefix "FREESWITCH_OID_PREFIX", 0, 0, (void *)".1.3.6.1.4.1.27880", 0},
+{ SWIG_STRING, (char *) SWIG_prefix "FREESWITCH_ITAD", 0, 0, (void *)"543", 0},
+{ SWIG_INT, (char *) SWIG_prefix "__EXTENSIONS__", (long) 1, 0, 0, 0},
+{0}
+};
#ifdef __cplusplus
}
#endif
static swig_variable_info swig_variables[] = {
- {0}
+{0}
};
static swig_command_info swig_commands[] = {
- {"fs_perlc::fs_core_set_globals", _wrap_fs_core_set_globals},
- {"fs_perlc::fs_core_init", _wrap_fs_core_init},
- {"fs_perlc::fs_core_destroy", _wrap_fs_core_destroy},
- {"fs_perlc::fs_loadable_module_init", _wrap_fs_loadable_module_init},
- {"fs_perlc::fs_loadable_module_shutdown", _wrap_fs_loadable_module_shutdown},
- {"fs_perlc::fs_console_loop", _wrap_fs_console_loop},
- {"fs_perlc::fs_consol_log", _wrap_fs_consol_log},
- {"fs_perlc::fs_consol_clean", _wrap_fs_consol_clean},
- {"fs_perlc::fs_core_session_locate", _wrap_fs_core_session_locate},
- {"fs_perlc::fs_channel_answer", _wrap_fs_channel_answer},
- {"fs_perlc::fs_channel_pre_answer", _wrap_fs_channel_pre_answer},
- {"fs_perlc::fs_channel_hangup", _wrap_fs_channel_hangup},
- {"fs_perlc::fs_channel_set_variable", _wrap_fs_channel_set_variable},
- {"fs_perlc::fs_channel_get_variable", _wrap_fs_channel_get_variable},
- {"fs_perlc::fs_channel_set_state", _wrap_fs_channel_set_state},
- {"fs_perlc::fs_ivr_play_file", _wrap_fs_ivr_play_file},
- {"fs_perlc::fs_switch_ivr_record_file", _wrap_fs_switch_ivr_record_file},
- {"fs_perlc::fs_switch_ivr_sleep", _wrap_fs_switch_ivr_sleep},
- {"fs_perlc::fs_ivr_play_file2", _wrap_fs_ivr_play_file2},
- {"fs_perlc::fs_switch_ivr_collect_digits_callback", _wrap_fs_switch_ivr_collect_digits_callback},
- {"fs_perlc::fs_switch_ivr_collect_digits_count", _wrap_fs_switch_ivr_collect_digits_count},
- {"fs_perlc::fs_switch_ivr_originate", _wrap_fs_switch_ivr_originate},
- {"fs_perlc::fs_switch_ivr_session_transfer", _wrap_fs_switch_ivr_session_transfer},
- {"fs_perlc::fs_switch_ivr_speak_text", _wrap_fs_switch_ivr_speak_text},
- {"fs_perlc::fs_switch_channel_get_variable", _wrap_fs_switch_channel_get_variable},
- {"fs_perlc::fs_switch_channel_set_variable", _wrap_fs_switch_channel_set_variable},
- {0, 0}
+{"fs_perlc::fs_core_set_globals", _wrap_fs_core_set_globals},
+{"fs_perlc::fs_core_init", _wrap_fs_core_init},
+{"fs_perlc::fs_core_destroy", _wrap_fs_core_destroy},
+{"fs_perlc::fs_loadable_module_init", _wrap_fs_loadable_module_init},
+{"fs_perlc::fs_loadable_module_shutdown", _wrap_fs_loadable_module_shutdown},
+{"fs_perlc::fs_console_loop", _wrap_fs_console_loop},
+{"fs_perlc::fs_consol_log", _wrap_fs_consol_log},
+{"fs_perlc::fs_consol_clean", _wrap_fs_consol_clean},
+{"fs_perlc::fs_core_session_locate", _wrap_fs_core_session_locate},
+{"fs_perlc::fs_channel_answer", _wrap_fs_channel_answer},
+{"fs_perlc::fs_channel_pre_answer", _wrap_fs_channel_pre_answer},
+{"fs_perlc::fs_channel_hangup", _wrap_fs_channel_hangup},
+{"fs_perlc::fs_channel_set_variable", _wrap_fs_channel_set_variable},
+{"fs_perlc::fs_channel_get_variable", _wrap_fs_channel_get_variable},
+{"fs_perlc::fs_channel_set_state", _wrap_fs_channel_set_state},
+{"fs_perlc::fs_ivr_play_file", _wrap_fs_ivr_play_file},
+{"fs_perlc::fs_switch_ivr_record_file", _wrap_fs_switch_ivr_record_file},
+{"fs_perlc::fs_switch_ivr_sleep", _wrap_fs_switch_ivr_sleep},
+{"fs_perlc::fs_ivr_play_file2", _wrap_fs_ivr_play_file2},
+{"fs_perlc::fs_switch_ivr_collect_digits_callback", _wrap_fs_switch_ivr_collect_digits_callback},
+{"fs_perlc::fs_switch_ivr_collect_digits_count", _wrap_fs_switch_ivr_collect_digits_count},
+{"fs_perlc::fs_switch_ivr_originate", _wrap_fs_switch_ivr_originate},
+{"fs_perlc::fs_switch_ivr_session_transfer", _wrap_fs_switch_ivr_session_transfer},
+{"fs_perlc::fs_switch_ivr_speak_text", _wrap_fs_switch_ivr_speak_text},
+{"fs_perlc::fs_switch_channel_get_variable", _wrap_fs_switch_channel_get_variable},
+{"fs_perlc::fs_switch_channel_set_variable", _wrap_fs_switch_channel_set_variable},
+{0,0}
};
#ifdef __cplusplus
extern "C"
#endif
-XS(SWIG_init)
-{
- dXSARGS;
- int i;
- static int _init = 0;
- if (!_init) {
- for (i = 0; swig_types_initial[i]; i++) {
- swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
- }
- _init = 1;
- }
-
- /* Install commands */
- for (i = 0; swig_commands[i].name; i++) {
- newXS((char *) swig_commands[i].name, swig_commands[i].wrapper, (char *) __FILE__);
- }
-
- /* Install variables */
- for (i = 0; swig_variables[i].name; i++) {
- SV *sv;
- sv = perl_get_sv((char *) swig_variables[i].name, TRUE | 0x2);
- if (swig_variables[i].type) {
- SWIG_MakePtr(sv, (void *) 1, *swig_variables[i].type, 0);
- } else {
- sv_setiv(sv, (IV) 0);
- }
- swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get);
- }
-
- /* Install constant */
- for (i = 0; swig_constants[i].type; i++) {
- SV *sv;
- sv = perl_get_sv((char *) swig_constants[i].name, TRUE | 0x2);
- switch (swig_constants[i].type) {
- case SWIG_INT:
- sv_setiv(sv, (IV) swig_constants[i].lvalue);
- break;
- case SWIG_FLOAT:
- sv_setnv(sv, (double) swig_constants[i].dvalue);
- break;
- case SWIG_STRING:
- sv_setpv(sv, (char *) swig_constants[i].pvalue);
- break;
- case SWIG_POINTER:
- SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype), 0);
- break;
- case SWIG_BINARY:
- SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
- break;
- default:
- break;
- }
- SvREADONLY_on(sv);
- }
- ST(0) = &PL_sv_yes;
- XSRETURN(1);
+XS(SWIG_init) {
+ dXSARGS;
+ int i;
+ static int _init = 0;
+ if (!_init) {
+ for (i = 0; swig_types_initial[i]; i++) {
+ swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
+ }
+ _init = 1;
+ }
+
+ /* Install commands */
+ for (i = 0; swig_commands[i].name; i++) {
+ newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
+ }
+
+ /* Install variables */
+ for (i = 0; swig_variables[i].name; i++) {
+ SV *sv;
+ sv = perl_get_sv((char*) swig_variables[i].name, TRUE | 0x2);
+ if (swig_variables[i].type) {
+ SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+ } else {
+ sv_setiv(sv,(IV) 0);
+ }
+ swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get);
+ }
+
+ /* Install constant */
+ for (i = 0; swig_constants[i].type; i++) {
+ SV *sv;
+ sv = perl_get_sv((char*)swig_constants[i].name, TRUE | 0x2);
+ switch(swig_constants[i].type) {
+ case SWIG_INT:
+ sv_setiv(sv, (IV) swig_constants[i].lvalue);
+ break;
+ case SWIG_FLOAT:
+ sv_setnv(sv, (double) swig_constants[i].dvalue);
+ break;
+ case SWIG_STRING:
+ sv_setpv(sv, (char *) swig_constants[i].pvalue);
+ break;
+ case SWIG_POINTER:
+ SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+ break;
+ case SWIG_BINARY:
+ SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+ break;
+ default:
+ break;
+ }
+ SvREADONLY_on(sv);
+ }
+
+ ST(0) = &PL_sv_yes;
+ XSRETURN(1);
}
+
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Fri Apr 13 18:51:18 2007
@@ -81,7 +81,8 @@
typedef enum {
S_HUP = (1 << 0),
- S_FREE = (1 << 1)
+ S_FREE = (1 << 1),
+ S_RDLOCK = (1 << 2)
} session_flag_t;
struct input_callback_state {
@@ -2146,7 +2147,7 @@
}
jss->session = peer_session;
- jss->flags = 0;
+ jss->flags = S_RDLOCK;
*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
@@ -2177,6 +2178,10 @@
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
}
+ if (jss->session && switch_test_flag(jss, S_RDLOCK)) {
+ switch_core_session_rwunlock(jss->session);
+ }
+
if (switch_test_flag(jss, S_FREE)) {
free(jss);
}
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/switch_channel.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/switch_channel.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/switch_channel.c Fri Apr 13 18:51:18 2007
@@ -745,12 +745,12 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", switch_channel_get_name(channel));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", switch_core_session_get_uuid(channel->session));
- if ((codec = switch_core_session_get_read_codec(channel->session))) {
+ if ((codec = switch_core_session_get_read_codec(channel->session)) && codec->implementation) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Name", "%s", switch_str_nil(codec->implementation->iananame));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Rate", "%u", codec->implementation->samples_per_second);
}
- if ((codec = switch_core_session_get_write_codec(channel->session))) {
+ if ((codec = switch_core_session_get_write_codec(channel->session)) && codec->implementation) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", "%s", switch_str_nil(codec->implementation->iananame));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%u", codec->implementation->samples_per_second);
}
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr.c Fri Apr 13 18:51:18 2007
@@ -140,7 +140,9 @@
break;
}
}
- switch_core_codec_destroy(&conninfo->read_codec);
+ if (conninfo->read_codec.implementation) {
+ switch_core_codec_destroy(&conninfo->read_codec);
+ }
switch_socket_close(conninfo->socket);
}
switch_channel_clear_flag(channel, CF_UNICAST);
@@ -156,7 +158,8 @@
switch_port_t local_port,
char *remote_ip,
switch_port_t remote_port,
- char *transport)
+ char *transport,
+ char *flags)
{
switch_channel_t *channel;
switch_unicast_conninfo_t *conninfo;
@@ -186,29 +189,37 @@
goto fail;
}
+ if (flags) {
+ if (strstr(flags, "native")) {
+ switch_set_flag(conninfo, SUF_NATIVE);
+ }
+ }
+
switch_mutex_init(&conninfo->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
read_codec = switch_core_session_get_read_codec(session);
- if (switch_core_codec_init(&conninfo->read_codec,
- "L16",
- NULL,
- read_codec->implementation->samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000,
- 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
- NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
- "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
- read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
- read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
- goto fail;
+ if (!switch_test_flag(conninfo, SUF_NATIVE)) {
+ if (switch_core_codec_init(&conninfo->read_codec,
+ "L16",
+ NULL,
+ read_codec->implementation->samples_per_second,
+ read_codec->implementation->microseconds_per_frame / 1000,
+ 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+ NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+ "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
+ read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
+ read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
+ goto fail;
+ }
}
conninfo->write_frame.data = conninfo->write_frame_data;
conninfo->write_frame.buflen = sizeof(conninfo->write_frame_data);
- conninfo->write_frame.codec = &conninfo->read_codec;
+ conninfo->write_frame.codec = switch_test_flag(conninfo, SUF_NATIVE) ? read_codec : &conninfo->read_codec;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "connect %s:%d->%s:%d\n",
@@ -307,6 +318,7 @@
char *remote_ip = switch_event_get_header(event, "remote_ip");
char *remote_port = switch_event_get_header(event, "remote_port");
char *transport = switch_event_get_header(event, "transport");
+ char *flags = switch_event_get_header(event, "flags");
if (switch_strlen_zero(local_ip)) {
local_ip = "127.0.0.1";
@@ -324,7 +336,7 @@
transport = "udp";
}
- switch_ivr_activate_unicast(session, local_ip, (switch_port_t)atoi(local_port), remote_ip, (switch_port_t)atoi(remote_port), transport);
+ switch_ivr_activate_unicast(session, local_ip, (switch_port_t)atoi(local_port), remote_ip, (switch_port_t)atoi(remote_port), transport, flags);
} else if (cmd_hash == CMD_HANGUP) {
char *cause_name = switch_event_get_header(event, "hangup-cause");
@@ -383,9 +395,9 @@
unicast_thread_launch(conninfo);
}
}
-
+
if (conninfo) {
- switch_size_t len;
+ switch_size_t len = 0;
uint32_t flags = 0;
switch_byte_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE];
uint32_t rate = read_codec->implementation->samples_per_second;
@@ -400,14 +412,17 @@
sendbuf = decoded;
status = SWITCH_STATUS_SUCCESS;
} else {
-
- status = switch_core_codec_decode(
- read_codec,
- &conninfo->read_codec,
- read_frame->data,
- read_frame->datalen,
- read_codec->implementation->samples_per_second,
- decoded, &dlen, &rate, &flags);
+ if (switch_test_flag(conninfo, SUF_NATIVE)) {
+ status = SWITCH_STATUS_NOOP;
+ } else {
+ status = switch_core_codec_decode(
+ read_codec,
+ &conninfo->read_codec,
+ read_frame->data,
+ read_frame->datalen,
+ read_codec->implementation->samples_per_second,
+ decoded, &dlen, &rate, &flags);
+ }
switch (status) {
case SWITCH_STATUS_NOOP:
case SWITCH_STATUS_BREAK:
@@ -435,7 +450,7 @@
}
}
}
-
+
if (switch_core_session_dequeue_private_event(session, &event) == SWITCH_STATUS_SUCCESS) {
switch_ivr_parse_event(session, event);
switch_channel_event_set_data(switch_core_session_get_channel(session), event);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr_bridge.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr_bridge.c Fri Apr 13 18:51:18 2007
@@ -34,16 +34,20 @@
/* Bridge Related Stuff*/
/*********************************************************************************/
-struct audio_bridge_data {
- switch_core_session_t *session_a;
- switch_core_session_t *session_b;
- int running;
+struct switch_ivr_bridge_data {
+ switch_core_session_t *session;
+ char *b_uuid;
+ int stream_id;
+ switch_input_callback_function_t input_callback;
+ void *session_data;
};
+typedef struct switch_ivr_bridge_data switch_ivr_bridge_data_t;
+
+
static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
{
- switch_core_thread_session_t *his_thread, *data = obj;
- int *stream_id_p;
+ switch_ivr_bridge_data_t *data = obj;
int stream_id = 0, pre_b = 0, ans_a = 0, ans_b = 0, originator = 0;
switch_input_callback_function_t input_callback;
switch_core_session_message_t *message, msg = { 0 };
@@ -53,19 +57,14 @@
switch_frame_t *read_frame;
switch_core_session_t *session_a, *session_b;
- assert(!thread || thread);
-
- session_a = data->objs[0];
- session_b = data->objs[1];
-
- stream_id_p = data->objs[2];
- input_callback = data->input_callback;
- user_data = data->objs[4];
- his_thread = data->objs[5];
-
- if (stream_id_p) {
- stream_id = *stream_id_p;
+ session_a = data->session;
+ if (!(session_b = switch_core_session_locate(data->b_uuid))) {
+ return NULL;
}
+
+ input_callback = data->input_callback;
+ user_data = data->session_data;
+ stream_id = data->stream_id;
chan_a = switch_core_session_get_channel(session_a);
chan_b = switch_core_session_get_channel(session_b);
@@ -75,8 +74,6 @@
pre_b = switch_channel_test_flag(chan_a, CF_EARLY_MEDIA);
ans_b = switch_channel_test_flag(chan_b, CF_ANSWERED);
}
- switch_core_session_read_lock(session_a);
- switch_core_session_read_lock(session_b);
switch_channel_set_flag(chan_a, CF_BRIDGED);
@@ -85,10 +82,6 @@
switch_status_t status;
switch_event_t *event;
- if (!(data->running > 0 && his_thread->running > 0)) {
- break;
- }
-
/* if you really want to make sure it's not ready, test it twice because it might be just a break */
if (!switch_channel_ready(chan_a) && !switch_channel_ready(chan_a)) {
break;
@@ -99,10 +92,6 @@
switch (b_state) {
case CS_HANGUP:
case CS_DONE:
- switch_mutex_lock(data->mutex);
- data->running = -1;
- switch_mutex_unlock(data->mutex);
- continue;
default:
break;
}
@@ -129,9 +118,6 @@
if (input_callback) {
if (input_callback(session_a, dtmf, SWITCH_INPUT_TYPE_DTMF, user_data, 0) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s ended call via DTMF\n", switch_channel_get_name(chan_a));
- switch_mutex_lock(data->mutex);
- data->running = -1;
- switch_mutex_unlock(data->mutex);
break;
}
}
@@ -186,49 +172,40 @@
if (switch_core_session_write_frame(session_b, read_frame, -1, stream_id) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "write: %s Bad Frame....[%u] Bubye!\n",
switch_channel_get_name(chan_b), read_frame->datalen);
- switch_mutex_lock(data->mutex);
- data->running = -1;
- switch_mutex_unlock(data->mutex);
+ break;
}
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "read: %s Bad Frame.... Bubye!\n", switch_channel_get_name(chan_a));
- switch_mutex_lock(data->mutex);
- data->running = -1;
- switch_mutex_unlock(data->mutex);
+ break;
}
}
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
-
+ msg.string_arg = data->b_uuid;
msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
msg.from = __FILE__;
switch_core_session_receive_message(session_a, &msg);
switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a));
-
switch_channel_clear_flag(chan_a, CF_BRIDGED);
- switch_mutex_lock(data->mutex);
- data->running = 0;
- switch_mutex_unlock(data->mutex);
-
- switch_core_session_rwunlock(session_a);
switch_core_session_rwunlock(session_b);
+
return NULL;
}
static switch_status_t audio_bridge_on_loopback(switch_core_session_t *session)
{
switch_channel_t *channel = NULL;
- void *arg;
+ switch_ivr_bridge_data_t *bd;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
- if ((arg = switch_channel_get_private(channel, "_bridge_"))) {
+ if ((bd = (switch_ivr_bridge_data_t *) switch_channel_get_private(channel, "_bridge_"))) {
switch_channel_set_private(channel, "_bridge_", NULL);
- audio_bridge_thread(NULL, (void *) arg);
+ audio_bridge_thread(NULL, (void *) bd);
} else {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
@@ -516,17 +493,16 @@
return SWITCH_STATUS_SUCCESS;
}
-
SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_session_t *session,
switch_core_session_t *peer_session,
switch_input_callback_function_t input_callback, void *session_data,
void *peer_session_data)
{
- switch_core_thread_session_t *this_audio_thread, *other_audio_thread;
+ switch_ivr_bridge_data_t *a_leg, *b_leg;
switch_channel_t *caller_channel, *peer_channel;
int stream_id = 0;
switch_status_t status = SWITCH_STATUS_SUCCESS;
-
+
caller_channel = switch_core_session_get_channel(session);
assert(caller_channel != NULL);
@@ -535,26 +511,20 @@
peer_channel = switch_core_session_get_channel(peer_session);
assert(peer_channel != NULL);
- other_audio_thread = switch_core_session_alloc(peer_session, sizeof(switch_core_thread_session_t));
- this_audio_thread = switch_core_session_alloc(peer_session, sizeof(switch_core_thread_session_t));
-
- other_audio_thread->objs[0] = session;
- other_audio_thread->objs[1] = peer_session;
- other_audio_thread->objs[2] = &stream_id;
- other_audio_thread->input_callback = input_callback;
- other_audio_thread->objs[4] = session_data;
- other_audio_thread->objs[5] = this_audio_thread;
- other_audio_thread->running = 5;
- switch_mutex_init(&other_audio_thread->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
-
- this_audio_thread->objs[0] = peer_session;
- this_audio_thread->objs[1] = session;
- this_audio_thread->objs[2] = &stream_id;
- this_audio_thread->input_callback = input_callback;
- this_audio_thread->objs[4] = peer_session_data;
- this_audio_thread->objs[5] = other_audio_thread;
- this_audio_thread->running = 2;
- switch_mutex_init(&this_audio_thread->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(peer_session));
+ a_leg = switch_core_session_alloc(session, sizeof(*a_leg));
+ b_leg = switch_core_session_alloc(peer_session, sizeof(*b_leg));
+
+ b_leg->session = peer_session;
+ b_leg->b_uuid = switch_core_session_strdup(peer_session, switch_core_session_get_uuid(session));
+ b_leg->stream_id = stream_id;
+ b_leg->input_callback = input_callback;
+ b_leg->session_data = session_data;
+
+ a_leg->session = session;
+ a_leg->b_uuid = switch_core_session_strdup(session, switch_core_session_get_uuid(peer_session));
+ b_leg->stream_id = stream_id;
+ b_leg->input_callback = input_callback;
+ b_leg->session_data = peer_session_data;
switch_channel_add_state_handler(peer_channel, &audio_bridge_peer_state_handlers);
@@ -579,54 +549,34 @@
msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE;
msg.from = __FILE__;
- msg.pointer_arg = session;
-
- switch_core_session_receive_message(peer_session, &msg);
+ msg.string_arg = switch_core_session_strdup(peer_session, switch_core_session_get_uuid(session));
- if (!msg.pointer_arg) {
+ if (switch_core_session_receive_message(peer_session, &msg) != SWITCH_STATUS_SUCCESS) {
status = SWITCH_STATUS_FALSE;
switch_core_session_rwunlock(peer_session);
goto done;
}
- msg.pointer_arg = peer_session;
- switch_core_session_receive_message(session, &msg);
-
- if (!msg.pointer_arg) {
+ msg.string_arg = switch_core_session_strdup(session, switch_core_session_get_uuid(peer_session));
+ if (switch_core_session_receive_message(session, &msg) != SWITCH_STATUS_SUCCESS) {
status = SWITCH_STATUS_FALSE;
switch_core_session_rwunlock(peer_session);
goto done;
}
- switch_channel_set_private(peer_channel, "_bridge_", other_audio_thread);
+ switch_channel_set_private(peer_channel, "_bridge_", b_leg);
switch_channel_set_state(peer_channel, CS_LOOPBACK);
- audio_bridge_thread(NULL, (void *) this_audio_thread);
+ audio_bridge_thread(NULL, (void *) a_leg);
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(caller_channel, event);
switch_event_fire(&event);
}
- this_audio_thread->objs[0] = NULL;
- this_audio_thread->objs[1] = NULL;
- this_audio_thread->objs[2] = NULL;
- this_audio_thread->input_callback = NULL;
- this_audio_thread->objs[4] = NULL;
- this_audio_thread->objs[5] = NULL;
- switch_mutex_lock(this_audio_thread->mutex);
- this_audio_thread->running = 0;
- switch_mutex_unlock(this_audio_thread->mutex);
-
switch_channel_clear_flag(caller_channel, CF_ORIGINATOR);
-
- if (other_audio_thread->running > 0) {
- switch_mutex_lock(other_audio_thread->mutex);
- other_audio_thread->running = -1;
- switch_mutex_unlock(other_audio_thread->mutex);
- while (other_audio_thread->running) {
- switch_yield(1000);
- }
+ while (switch_channel_get_state(peer_channel) == CS_LOOPBACK) {
+ switch_yield(1000);
}
switch_core_session_rwunlock(peer_session);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr_originate.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr_originate.c Fri Apr 13 18:51:18 2007
@@ -156,7 +156,7 @@
static uint8_t check_channel_status(switch_channel_t **peer_channels,
switch_core_session_t **peer_sessions,
- uint32_t len, int32_t *idx, uint32_t * hups, char *file, char *key, uint8_t early_ok, uint8_t * ring_ready)
+ uint32_t len, int32_t *idx, uint32_t * hups, char *file, char *key, uint8_t early_ok, uint8_t *ring_ready)
{
uint32_t i;
@@ -901,9 +901,12 @@
if (!peer_channels[i]) {
continue;
}
+ if (status == SWITCH_STATUS_SUCCESS && bleg && *bleg && *bleg == peer_sessions[i]) {
+ continue;
+ }
switch_core_session_rwunlock(peer_sessions[i]);
}
-
+
if (status == SWITCH_STATUS_SUCCESS) {
goto outer_for;
}
@@ -912,5 +915,10 @@
outer_for:
switch_safe_free(loop_data);
switch_safe_free(odata);
+
+ if (bleg && status != SWITCH_STATUS_SUCCESS) {
+ *bleg = NULL;
+ }
+
return status;
}
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/switch_swig.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/switch_swig.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/switch_swig.c Fri Apr 13 18:51:18 2007
@@ -246,6 +246,7 @@
return;
} else {
switch_ivr_multi_threaded_bridge(session, peer_session, NULL, NULL, NULL);
+ switch_core_session_rwunlock(peer_session);
}
1
0
[commit] r4926 - in freeswitch/trunk/src: . include mod/applications/mod_bridgecall mod/applications/mod_commands mod/applications/mod_conference mod/endpoints/mod_sofia mod/languages/mod_perl mod/languages/mod_spidermonkey
by Freeswitch SVN 13 Apr '07
by Freeswitch SVN 13 Apr '07
13 Apr '07
Author: anthm
Date: Fri Apr 13 18:15:58 2007
New Revision: 4926
Modified:
freeswitch/trunk/src/include/switch_ivr.h
freeswitch/trunk/src/mod/applications/mod_bridgecall/mod_bridgecall.c
freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.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_glue.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
freeswitch/trunk/src/mod/languages/mod_perl/fs_perl.pm
freeswitch/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c
freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_ivr_bridge.c
freeswitch/trunk/src/switch_ivr_originate.c
freeswitch/trunk/src/switch_swig.c
Log:
refactor to avoid some potential issues with channels that are hungup instantly after being answered
Modified: freeswitch/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_ivr.h (original)
+++ freeswitch/trunk/src/include/switch_ivr.h Fri Apr 13 18:15:58 2007
@@ -283,6 +283,7 @@
\param cid_num_override override the caller id number
\param caller_profile_override override the entire calling caller profile
\return SWITCH_STATUS_SUCCESS if bleg is a running session.
+ \note bleg will be read locked which must be unlocked with switch_core_session_rwunlock() before losing scope
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *session,
switch_core_session_t **bleg,
Modified: freeswitch/trunk/src/mod/applications/mod_bridgecall/mod_bridgecall.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_bridgecall/mod_bridgecall.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_bridgecall/mod_bridgecall.c Fri Apr 13 18:15:58 2007
@@ -39,7 +39,7 @@
static void audio_bridge_function(switch_core_session_t *session, char *data)
{
switch_channel_t *caller_channel;
- switch_core_session_t *peer_session;
+ switch_core_session_t *peer_session = NULL;
unsigned int timelimit = 60;
char *var;
uint8_t no_media_bridge = 0;
@@ -98,7 +98,7 @@
if (bad) {
switch_channel_hangup(caller_channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_channel_hangup(peer_channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- return;
+ goto end;
}
}
@@ -113,6 +113,10 @@
switch_ivr_multi_threaded_bridge(session, peer_session, NULL, NULL, NULL);
}
}
+ end:
+ if (peer_session) {
+ switch_core_session_rwunlock(peer_session);
+ }
}
}
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 Fri Apr 13 18:15:58 2007
@@ -590,7 +590,7 @@
static switch_status_t originate_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream)
{
switch_channel_t *caller_channel;
- switch_core_session_t *caller_session;
+ switch_core_session_t *caller_session = NULL;
char *argv[7] = { 0 };
int i = 0, x, argc = 0;
char *aleg, *exten, *dp, *context, *cid_name, *cid_num;
@@ -684,6 +684,10 @@
stream->write_function(stream, "Created Session: %s\n", switch_core_session_get_uuid(caller_session));
}
+ if (caller_session) {
+ switch_core_session_rwunlock(caller_session);
+ }
+
return SWITCH_STATUS_SUCCESS;;
}
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 Apr 13 18:15:58 2007
@@ -3476,12 +3476,12 @@
switch_core_session_t *session,
char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause)
{
- switch_core_session_t *peer_session;
+ switch_core_session_t *peer_session = NULL;
switch_channel_t *peer_channel;
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_channel_t *caller_channel = NULL;
char appdata[512];
-
+ int rdlock = 0;
*cause = SWITCH_CAUSE_NORMAL_CLEARING;
@@ -3498,7 +3498,7 @@
peer_channel = switch_core_session_get_channel(peer_session);
assert(peer_channel != NULL);
-
+ rdlock = 1;
goto callup;
}
@@ -3534,7 +3534,7 @@
goto done;
}
-
+ rdlock = 1;
peer_channel = switch_core_session_get_channel(peer_session);
assert(peer_channel != NULL);
@@ -3585,6 +3585,10 @@
if (conference) {
switch_thread_rwlock_unlock(conference->rwlock);
}
+ if (rdlock && peer_session) {
+ switch_core_session_rwunlock(peer_session);
+ }
+
return status;
}
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 Apr 13 18:15:58 2007
@@ -242,11 +242,6 @@
switch_clear_flag_locked(tech_pvt, TFLAG_IO);
- if (tech_pvt->home) {
- su_home_unref(tech_pvt->home);
- tech_pvt->home = NULL;
- }
-
if (tech_pvt->sofia_private) {
*tech_pvt->sofia_private->uuid = '\0';
}
@@ -847,6 +842,7 @@
sofia_glue_terminate_session(&nsession, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER, __LINE__);
goto done;
}
+ switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(nsession));
data = switch_core_session_strdup(nsession, outbound_profile->destination_number);
profile_name = data;
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 Fri Apr 13 18:15:58 2007
@@ -54,11 +54,6 @@
typedef struct sofia_profile sofia_profile_t;
#define NUA_MAGIC_T sofia_profile_t
-struct sofia_private {
- char uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
- outbound_reg_t *gateway;
-};
-
typedef struct sofia_private sofia_private_t;
struct private_object;
@@ -85,6 +80,13 @@
#include <sofia-sip/nea.h>
#include <sofia-sip/msg_addr.h>
+struct sofia_private {
+ char uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
+ outbound_reg_t *gateway;
+ su_home_t *home;
+};
+
+
#define set_param(ptr,val) if (ptr) {free(ptr) ; ptr = NULL;} if (val) {ptr = strdup(val);}
#define set_anchor(t,m) if (t->Anchor) {delete t->Anchor;} t->Anchor = new SipMessage(m);
@@ -305,7 +307,6 @@
switch_payload_t bcng_pt;
nua_handle_t *nh;
nua_handle_t *nh2;
- su_home_t *home;
sip_contact_t *contact;
};
@@ -330,95 +331,95 @@
/*************************************************************************************************************************************************************/
-switch_status_t sofia_glue_activate_rtp(private_object_t * tech_pvt);
+switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt);
-void sofia_glue_deactivate_rtp(private_object_t * tech_pvt);
+void sofia_glue_deactivate_rtp(private_object_t *tech_pvt);
-void sofia_glue_set_local_sdp(private_object_t * tech_pvt, char *ip, uint32_t port, char *sr, int force);
+void sofia_glue_set_local_sdp(private_object_t *tech_pvt, char *ip, uint32_t port, char *sr, int force);
-void sofia_glue_sofia_glue_tech_set_codecs(private_object_t * tech_pvt);
+void sofia_glue_sofia_glue_tech_set_codecs(private_object_t *tech_pvt);
-void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t * profile, private_object_t * tech_pvt, const char *channame);
+void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *profile, private_object_t *tech_pvt, const char *channame);
void sofia_glue_terminate_session(switch_core_session_t **session, switch_call_cause_t cause, int line);
-switch_status_t sofia_glue_tech_choose_port(private_object_t * tech_pvt);
+switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt);
switch_status_t sofia_glue_do_invite(switch_core_session_t *session);
-uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t * sdp);
+uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp);
-void sofia_presence_establish_presence(sofia_profile_t * profile);
+void sofia_presence_establish_presence(sofia_profile_t *profile);
void sofia_handle_sip_i_state(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
-void sofia_handle_sip_i_refer(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
+void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
-void sofia_handle_sip_i_info(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
+void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
-void sofia_handle_sip_i_invite(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
-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[]);
+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[]);
void sofia_event_callback(nua_event_t event,
int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
-void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t * thread, void *obj);
+void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void *obj);
-void launch_sofia_profile_thread(sofia_profile_t * profile);
+void launch_sofia_profile_thread(sofia_profile_t *profile);
switch_status_t sofia_presence_chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint);
-void sofia_glue_tech_absorb_sdp(private_object_t * tech_pvt);
-switch_status_t sofia_glue_tech_media(private_object_t * tech_pvt, char *r_sdp);
-char *sofia_reg_find_reg_url(sofia_profile_t * profile, const char *user, const char *host, char *val, switch_size_t len);
+void sofia_glue_tech_absorb_sdp(private_object_t *tech_pvt);
+switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, char *r_sdp);
+char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const char *host, char *val, switch_size_t len);
void event_handler(switch_event_t *event);
void sofia_presence_event_handler(switch_event_t *event);
void sofia_presence_mwi_event_handler(switch_event_t *event);
void sofia_presence_cancel(void);
switch_status_t config_sofia(int reload);
-auth_res_t parse_auth(sofia_profile_t * profile, sip_authorization_t const *authorization, const char *regstr, char *np, size_t nplen);
+auth_res_t parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, const char *regstr, char *np, size_t nplen);
void sofia_reg_handle_sip_r_challenge(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
void sofia_reg_handle_sip_r_register(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
void sofia_handle_sip_i_options(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
-void sofia_presence_handle_sip_i_publish(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
+void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
void sofia_presence_handle_sip_i_message(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
void sofia_presence_handle_sip_r_subscribe(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
void sofia_presence_handle_sip_i_subscribe(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
sofia_profile_t *sofia_glue_find_profile(char *key);
-void sofia_glue_add_profile(char *key, sofia_profile_t * profile);
+void sofia_glue_add_profile(char *key, sofia_profile_t *profile);
void sofia_glue_execute_sql(sofia_profile_t *profile, switch_bool_t master, char *sql, switch_mutex_t *mutex);
-void sofia_reg_check_expire(sofia_profile_t * profile, time_t now);
-void sofia_reg_check_gateway(sofia_profile_t * profile, time_t now);
-void sofia_reg_unregister(sofia_profile_t * profile);
+void sofia_reg_check_expire(sofia_profile_t *profile, time_t now);
+void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now);
+void sofia_reg_unregister(sofia_profile_t *profile);
switch_status_t sofia_glue_ext_address_lookup(char **ip, switch_port_t *port, char *sourceip, switch_memory_pool_t *pool);
outbound_reg_t *sofia_reg_find_gateway(char *key);
-void sofia_reg_add_gateway(char *key, outbound_reg_t * gateway);
-void sofia_glue_pass_sdp(private_object_t * tech_pvt, char *sdp);
+void sofia_reg_add_gateway(char *key, outbound_reg_t *gateway);
+void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp);
int sofia_glue_get_user_host(char *in, char **user, char **host);
switch_call_cause_t sofia_glue_sip_cause_to_freeswitch(int status);
void sofia_glue_do_xfer_invite(switch_core_session_t *session);
-uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sip_t const *sip, sofia_regtype_t regtype, char *key, uint32_t keylen);
+uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, sofia_regtype_t regtype, char *key, uint32_t keylen);
const switch_endpoint_interface_t sofia_endpoint_interface;
-void sofia_presence_set_chat_hash(private_object_t * tech_pvt, sip_t const *sip);
+void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip);
switch_status_t sofia_on_hangup(switch_core_session_t *session);
char *sofia_glue_get_url_from_contact(char *buf, uint8_t to_dup);
void sofia_presence_set_hash_key(char *hash_key, int32_t len, sip_t const *sip);
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 Fri Apr 13 18:15:58 2007
@@ -40,7 +40,7 @@
void sofia_event_callback(nua_event_t event,
int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
struct private_object *tech_pvt = NULL;
auth_res_t auth_res = AUTH_FORBIDDEN;
@@ -231,7 +231,7 @@
-void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t * thread, void *obj)
+void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void *obj)
{
sofia_profile_t *profile = (sofia_profile_t *) obj;
switch_memory_pool_t *pool;
@@ -357,7 +357,7 @@
return NULL;
}
-void launch_sofia_profile_thread(sofia_profile_t * profile)
+void launch_sofia_profile_thread(sofia_profile_t *profile)
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
@@ -798,7 +798,7 @@
void sofia_handle_sip_i_state(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
const char *l_sdp = NULL, *r_sdp = NULL;
int offer_recv = 0, answer_recv = 0, offer_sent = 0, answer_sent = 0;
@@ -838,6 +838,8 @@
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
assert(tech_pvt->nh != NULL);
+
+
if (switch_channel_test_flag(channel, CF_NOMEDIA)) {
switch_set_flag(tech_pvt, TFLAG_NOMEDIA);
@@ -935,7 +937,7 @@
switch_core_session_thread_launch(session);
goto done;
} else {
- sdp_parser_t *parser = sdp_parse(tech_pvt->home, r_sdp, (int) strlen(r_sdp), 0);
+ sdp_parser_t *parser = sdp_parse(tech_pvt->sofia_private->home, r_sdp, (int) strlen(r_sdp), 0);
sdp_session_t *sdp;
uint8_t match = 0;
@@ -958,7 +960,7 @@
switch_core_session_thread_launch(session);
- if (replaces_str && (replaces = sip_replaces_make(tech_pvt->home, replaces_str))
+ if (replaces_str && (replaces = sip_replaces_make(tech_pvt->sofia_private->home, replaces_str))
&& (bnh = nua_handle_by_replaces(nua, replaces))) {
sofia_private_t *b_private;
@@ -1016,7 +1018,7 @@
if (switch_test_flag(tech_pvt, TFLAG_NOMEDIA)) {
goto done;
} else {
- sdp_parser_t *parser = sdp_parse(tech_pvt->home, r_sdp, (int) strlen(r_sdp), 0);
+ sdp_parser_t *parser = sdp_parse(tech_pvt->sofia_private->home, r_sdp, (int) strlen(r_sdp), 0);
sdp_session_t *sdp;
uint8_t match = 0;
@@ -1084,7 +1086,7 @@
}
goto done;
} else {
- sdp_parser_t *parser = sdp_parse(tech_pvt->home, r_sdp, (int) strlen(r_sdp), 0);
+ sdp_parser_t *parser = sdp_parse(tech_pvt->sofia_private->home, r_sdp, (int) strlen(r_sdp), 0);
sdp_session_t *sdp;
uint8_t match = 0;
@@ -1121,7 +1123,7 @@
case nua_callstate_terminated:
if (session) {
if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
-
+
switch_set_flag_locked(tech_pvt, TFLAG_BYE);
if (switch_test_flag(tech_pvt, TFLAG_NOHUP)) {
switch_clear_flag_locked(tech_pvt, TFLAG_NOHUP);
@@ -1131,13 +1133,19 @@
sofia_glue_terminate_session(&session, sofia_glue_sip_cause_to_freeswitch(status), __LINE__);
}
}
-
+
if (tech_pvt->sofia_private) {
+ if (sofia_private->home) {
+ su_home_unref(sofia_private->home);
+ }
free(tech_pvt->sofia_private);
tech_pvt->sofia_private = NULL;
}
tech_pvt->nh = NULL;
} else if (sofia_private) {
+ if (sofia_private->home) {
+ su_home_unref(sofia_private->home);
+ }
free(sofia_private);
}
@@ -1157,7 +1165,7 @@
/*---------------------------------------*/
-void sofia_handle_sip_i_refer(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[])
+void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[])
{
/* Incoming refer */
sip_from_t const *from;
@@ -1213,7 +1221,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
goto done;
}
- if ((replaces = sip_replaces_make(tech_pvt->home, rep))
+ if ((replaces = sip_replaces_make(tech_pvt->sofia_private->home, rep))
&& (bnh = nua_handle_by_replaces(nua, replaces))) {
sofia_private_t *b_private = NULL;
private_object_t *b_tech_pvt = NULL;
@@ -1319,6 +1327,7 @@
switch_set_flag_locked(tech_pvt, TFLAG_BYE);
nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
+ switch_core_session_rwunlock(tsession);
} else {
goto error;
}
@@ -1396,7 +1405,7 @@
}
-void sofia_handle_sip_i_info(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[])
+void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[])
{
//placeholder for string searching
@@ -1449,7 +1458,7 @@
}
#define url_set_chanvars(session, url, varprefix) _url_set_chanvars(session, url, #varprefix "_user", #varprefix "_host", #varprefix "_port", #varprefix "_uri")
-const char *_url_set_chanvars(switch_core_session_t *session, url_t * url, const char *user_var,
+const char *_url_set_chanvars(switch_core_session_t *session, url_t *url, const char *user_var,
const char *host_var, const char *port_var, const char *uri_var)
{
const char *user = NULL, *host = NULL, *port = NULL;
@@ -1484,7 +1493,7 @@
return uri;
}
-void process_rpid(sip_unknown_t * un, private_object_t * tech_pvt)
+void process_rpid(sip_unknown_t *un, private_object_t *tech_pvt)
{
int argc, x, screen = 1;
char *mydata, *argv[10] = { 0 };
@@ -1530,7 +1539,7 @@
}
}
-void sofia_handle_sip_i_invite(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
switch_core_session_t *session = NULL;
char key[128] = "";
@@ -1575,6 +1584,7 @@
sofia_glue_terminate_session(&session, SWITCH_CAUSE_SWITCH_CONGESTION, __LINE__);
return;
}
+ switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
if (!switch_strlen_zero(key)) {
tech_pvt->key = switch_core_session_strdup(session, key);
@@ -1723,6 +1733,8 @@
abort();
}
memset(tech_pvt->sofia_private, 0, sizeof(*tech_pvt->sofia_private));
+ tech_pvt->sofia_private->home = su_home_new(sizeof(*tech_pvt->sofia_private->home));
+
switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid));
nua_handle_bind(nh, tech_pvt->sofia_private);
tech_pvt->nh = nh;
@@ -1730,7 +1742,7 @@
void sofia_handle_sip_i_options(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
nua_respond(nh, SIP_200_OK,
//SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
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 Fri Apr 13 18:15:58 2007
@@ -139,7 +139,7 @@
tech_pvt->local_sdp_str = switch_core_session_strdup(tech_pvt->session, buf);
}
-void sofia_glue_sofia_glue_tech_set_codecs(private_object_t * tech_pvt)
+void sofia_glue_sofia_glue_tech_set_codecs(private_object_t *tech_pvt)
{
switch_channel_t *channel;
char *abs, *codec_string = NULL;
@@ -195,7 +195,7 @@
}
-void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t * profile, private_object_t * tech_pvt, const char *channame)
+void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *profile, private_object_t *tech_pvt, const char *channame)
{
switch_channel_t *channel;
char name[256];
@@ -209,7 +209,7 @@
//switch_channel_set_flag(channel, CF_ACCEPT_CNG);
- switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+
switch_mutex_lock(tech_pvt->flag_mutex);
tech_pvt->flags = profile->flags;
switch_mutex_unlock(tech_pvt->flag_mutex);
@@ -227,8 +227,6 @@
}
tech_pvt->session = session;
- tech_pvt->home = su_home_new(sizeof(*tech_pvt->home));
-
switch_core_session_set_private(session, tech_pvt);
@@ -288,7 +286,7 @@
}
-switch_status_t sofia_glue_tech_choose_port(private_object_t * tech_pvt)
+switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt)
{
char *ip = tech_pvt->profile->rtpip;
switch_channel_t *channel;
@@ -428,6 +426,7 @@
abort();
}
memset(tech_pvt->sofia_private, 0, sizeof(*tech_pvt->sofia_private));
+ tech_pvt->sofia_private->home = su_home_new(sizeof(*tech_pvt->sofia_private->home));
switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid));
nua_handle_bind(tech_pvt->nh, tech_pvt->sofia_private);
@@ -530,7 +529,7 @@
}
-void sofia_glue_tech_absorb_sdp(private_object_t * tech_pvt)
+void sofia_glue_tech_absorb_sdp(private_object_t *tech_pvt)
{
switch_channel_t *channel;
char *sdp_str;
@@ -544,7 +543,7 @@
sdp_media_t *m;
sdp_connection_t *connection;
- if ((parser = sdp_parse(tech_pvt->home, sdp_str, (int) strlen(sdp_str), 0))) {
+ if ((parser = sdp_parse(tech_pvt->sofia_private->home, sdp_str, (int) strlen(sdp_str), 0))) {
if ((sdp = sdp_session(parser))) {
for (m = sdp->sdp_media; m; m = m->m_next) {
if (m->m_type != sdp_media_audio) {
@@ -571,7 +570,7 @@
}
}
-void sofia_glue_deactivate_rtp(private_object_t * tech_pvt)
+void sofia_glue_deactivate_rtp(private_object_t *tech_pvt)
{
int loops = 0; //, sock = -1;
if (switch_rtp_ready(tech_pvt->rtp_session)) {
@@ -583,7 +582,7 @@
}
}
-switch_status_t sofia_glue_tech_set_codec(private_object_t * tech_pvt, int force)
+switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
{
switch_channel_t *channel;
@@ -654,7 +653,7 @@
}
-switch_status_t sofia_glue_activate_rtp(private_object_t * tech_pvt)
+switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt)
{
int bw, ms;
switch_channel_t *channel;
@@ -773,9 +772,9 @@
return SWITCH_STATUS_SUCCESS;
}
-switch_status_t sofia_glue_tech_media(private_object_t * tech_pvt, char *r_sdp)
+switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, char *r_sdp)
{
- sdp_parser_t *parser = sdp_parse(tech_pvt->home, r_sdp, (int) strlen(r_sdp), 0);
+ sdp_parser_t *parser = sdp_parse(tech_pvt->sofia_private->home, r_sdp, (int) strlen(r_sdp), 0);
sdp_session_t *sdp;
uint8_t match = 0;
switch_channel_t *channel = switch_core_session_get_channel(tech_pvt->session);
@@ -812,7 +811,7 @@
-uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t * sdp)
+uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp)
{
uint8_t match = 0;
switch_payload_t te = 0, cng_pt = 0;
@@ -1062,7 +1061,7 @@
}
-void sofia_glue_pass_sdp(private_object_t * tech_pvt, char *sdp)
+void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp)
{
char *val;
switch_channel_t *channel;
@@ -1120,7 +1119,7 @@
return profile;
}
-void sofia_glue_add_profile(char *key, sofia_profile_t * profile)
+void sofia_glue_add_profile(char *key, sofia_profile_t *profile)
{
switch_mutex_lock(mod_sofia_globals.hash_mutex);
switch_core_hash_insert(mod_sofia_globals.profile_hash, key, profile);
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 Fri Apr 13 18:15:58 2007
@@ -128,7 +128,7 @@
}
}
-void sofia_presence_establish_presence(sofia_profile_t * profile)
+void sofia_presence_establish_presence(sofia_profile_t *profile)
{
if (sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex,
@@ -612,7 +612,7 @@
void sofia_presence_handle_sip_i_subscribe(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
if (sip) {
long exp, exp_raw;
@@ -792,12 +792,12 @@
void sofia_presence_handle_sip_r_subscribe(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
}
-void sofia_presence_handle_sip_i_publish(nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
if (sip) {
sip_from_t const *from = sip->sip_from;
@@ -917,7 +917,7 @@
void sofia_presence_handle_sip_i_message(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t * profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
if (sip) {
sip_from_t const *from = sip->sip_from;
@@ -1028,7 +1028,7 @@
}
}
-void sofia_presence_set_chat_hash(private_object_t * tech_pvt, sip_t const *sip)
+void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip)
{
char hash_key[256] = "";
char buf[512];
@@ -1038,7 +1038,7 @@
}
if (sofia_reg_find_reg_url(tech_pvt->profile, sip->sip_from->a_url->url_user, sip->sip_from->a_url->url_host, buf, sizeof(buf))) {
- tech_pvt->chat_from = sip_header_as_string(tech_pvt->home, (const sip_header_t *) sip->sip_to);
+ tech_pvt->chat_from = sip_header_as_string(tech_pvt->sofia_private->home, (const sip_header_t *) sip->sip_to);
tech_pvt->chat_to = switch_core_session_strdup(tech_pvt->session, buf);
sofia_presence_set_hash_key(hash_key, sizeof(hash_key), sip);
} else {
Modified: freeswitch/trunk/src/mod/languages/mod_perl/fs_perl.pm
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/fs_perl.pm (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/fs_perl.pm Fri Apr 13 18:15:58 2007
@@ -76,4 +76,8 @@
package fs_perl;
+*FREESWITCH_PEN = *fs_perlc::FREESWITCH_PEN;
+*FREESWITCH_OID_PREFIX = *fs_perlc::FREESWITCH_OID_PREFIX;
+*FREESWITCH_ITAD = *fs_perlc::FREESWITCH_ITAD;
+*__EXTENSIONS__ = *fs_perlc::__EXTENSIONS__;
1;
Modified: freeswitch/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/switch_swig_wrap.c Fri Apr 13 18:15:58 2007
@@ -15,8 +15,7 @@
* clashes if multiple interpreters are included
*
************************************************************************/
-#include <switch.h>
-
+#include "switch.h"
#define SWIG_TypeRegister SWIG_Perl_TypeRegister
#define SWIG_TypeCheck SWIG_Perl_TypeCheck
#define SWIG_TypeCast SWIG_Perl_TypeCast
@@ -24,8 +23,8 @@
#define SWIG_TypeName SWIG_Perl_TypeName
#define SWIG_TypeQuery SWIG_Perl_TypeQuery
#define SWIG_TypeClientData SWIG_Perl_TypeClientData
-#define SWIG_PackData SWIG_Perl_PackData
-#define SWIG_UnpackData SWIG_Perl_UnpackData
+#define SWIG_PackData SWIG_Perl_PackData
+#define SWIG_UnpackData SWIG_Perl_UnpackData
/***********************************************************************
@@ -78,205 +77,194 @@
extern "C" {
#endif
- typedef void *(*swig_converter_func) (void *);
- typedef struct swig_type_info *(*swig_dycast_func) (void **);
+typedef void *(*swig_converter_func)(void *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
- typedef struct swig_type_info {
- const char *name;
- swig_converter_func converter;
- const char *str;
- void *clientdata;
- swig_dycast_func dcast;
- struct swig_type_info *next;
- struct swig_type_info *prev;
- } swig_type_info;
+typedef struct swig_type_info {
+ const char *name;
+ swig_converter_func converter;
+ const char *str;
+ void *clientdata;
+ swig_dycast_func dcast;
+ struct swig_type_info *next;
+ struct swig_type_info *prev;
+} swig_type_info;
#ifdef SWIG_NOINCLUDE
- SWIGIMPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *);
- SWIGIMPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *);
- SWIGIMPORT(void *) SWIG_TypeCast(swig_type_info *, void *);
- SWIGIMPORT(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *, void **);
- SWIGIMPORT(const char *) SWIG_TypeName(const swig_type_info *);
- SWIGIMPORT(swig_type_info *) SWIG_TypeQuery(const char *);
- SWIGIMPORT(void) SWIG_TypeClientData(swig_type_info *, void *);
- SWIGIMPORT(char *) SWIG_PackData(char *, void *, int);
- SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int);
+SWIGIMPORT(swig_type_info *) SWIG_TypeRegister(swig_type_info *);
+SWIGIMPORT(swig_type_info *) SWIG_TypeCheck(char *c, swig_type_info *);
+SWIGIMPORT(void *) SWIG_TypeCast(swig_type_info *, void *);
+SWIGIMPORT(swig_type_info *) SWIG_TypeDynamicCast(swig_type_info *, void **);
+SWIGIMPORT(const char *) SWIG_TypeName(const swig_type_info *);
+SWIGIMPORT(swig_type_info *) SWIG_TypeQuery(const char *);
+SWIGIMPORT(void) SWIG_TypeClientData(swig_type_info *, void *);
+SWIGIMPORT(char *) SWIG_PackData(char *, void *, int);
+SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int);
#else
- static swig_type_info *swig_type_list = 0;
+static swig_type_info *swig_type_list = 0;
/* Register a type mapping with the type-checking */
- SWIGRUNTIME(swig_type_info *)
- SWIG_TypeRegister(swig_type_info * ti) {
- swig_type_info *tc, *head, *ret, *next;
- /* Check to see if this type has already been registered */
- tc = swig_type_list;
- while (tc) {
- if (strcmp(tc->name, ti->name) == 0) {
- /* Already exists in the table. Just add additional types to the list */
- if (tc->clientdata)
- ti->clientdata = tc->clientdata;
- head = tc;
- next = tc->next;
- goto l1;
- }
- tc = tc->prev;
- }
- head = ti;
- next = 0;
-
- /* Place in list */
- ti->prev = swig_type_list;
- swig_type_list = ti;
-
- /* Build linked lists */
- l1:
- ret = head;
- tc = ti + 1;
- /* Patch up the rest of the links */
- while (tc->name) {
- head->next = tc;
- tc->prev = head;
- head = tc;
- tc++;
- }
- if (next)
- next->prev = head;
- head->next = next;
- return ret;
- }
+SWIGRUNTIME(swig_type_info *)
+SWIG_TypeRegister(swig_type_info *ti) {
+ swig_type_info *tc, *head, *ret, *next;
+ /* Check to see if this type has already been registered */
+ tc = swig_type_list;
+ while (tc) {
+ if (strcmp(tc->name, ti->name) == 0) {
+ /* Already exists in the table. Just add additional types to the list */
+ if (tc->clientdata) ti->clientdata = tc->clientdata;
+ head = tc;
+ next = tc->next;
+ goto l1;
+ }
+ tc = tc->prev;
+ }
+ head = ti;
+ next = 0;
+
+ /* Place in list */
+ ti->prev = swig_type_list;
+ swig_type_list = ti;
+
+ /* Build linked lists */
+ l1:
+ ret = head;
+ tc = ti + 1;
+ /* Patch up the rest of the links */
+ while (tc->name) {
+ head->next = tc;
+ tc->prev = head;
+ head = tc;
+ tc++;
+ }
+ if (next) next->prev = head;
+ head->next = next;
+ return ret;
+}
/* Check the typename */
- SWIGRUNTIME(swig_type_info *)
- SWIG_TypeCheck(char *c, swig_type_info * ty) {
- swig_type_info *s;
- if (!ty)
- return 0; /* Void pointer */
- s = ty->next; /* First element always just a name */
- do {
- if (strcmp(s->name, c) == 0) {
- if (s == ty->next)
- return s;
- /* Move s to the top of the linked list */
- s->prev->next = s->next;
- if (s->next) {
- s->next->prev = s->prev;
- }
- /* Insert s as second element in the list */
- s->next = ty->next;
- if (ty->next)
- ty->next->prev = s;
- ty->next = s;
- s->prev = ty;
- return s;
- }
- s = s->next;
- } while (s && (s != ty->next));
- return 0;
- }
+SWIGRUNTIME(swig_type_info *)
+SWIG_TypeCheck(char *c, swig_type_info *ty) {
+ swig_type_info *s;
+ if (!ty) return 0; /* Void pointer */
+ s = ty->next; /* First element always just a name */
+ do {
+ if (strcmp(s->name,c) == 0) {
+ if (s == ty->next) return s;
+ /* Move s to the top of the linked list */
+ s->prev->next = s->next;
+ if (s->next) {
+ s->next->prev = s->prev;
+ }
+ /* Insert s as second element in the list */
+ s->next = ty->next;
+ if (ty->next) ty->next->prev = s;
+ ty->next = s;
+ s->prev = ty;
+ return s;
+ }
+ s = s->next;
+ } while (s && (s != ty->next));
+ return 0;
+}
/* Cast a pointer up an inheritance hierarchy */
- SWIGRUNTIME(void *)
- SWIG_TypeCast(swig_type_info * ty, void *ptr) {
- if ((!ty) || (!ty->converter))
- return ptr;
- return (*ty->converter) (ptr);
- }
+SWIGRUNTIME(void *)
+SWIG_TypeCast(swig_type_info *ty, void *ptr) {
+ if ((!ty) || (!ty->converter)) return ptr;
+ return (*ty->converter)(ptr);
+}
/* Dynamic pointer casting. Down an inheritance hierarchy */
- SWIGRUNTIME(swig_type_info *)
- SWIG_TypeDynamicCast(swig_type_info * ty, void **ptr) {
- swig_type_info *lastty = ty;
- if (!ty || !ty->dcast)
- return ty;
- while (ty && (ty->dcast)) {
- ty = (*ty->dcast) (ptr);
- if (ty)
- lastty = ty;
- }
- return lastty;
- }
+SWIGRUNTIME(swig_type_info *)
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+ swig_type_info *lastty = ty;
+ if (!ty || !ty->dcast) return ty;
+ while (ty && (ty->dcast)) {
+ ty = (*ty->dcast)(ptr);
+ if (ty) lastty = ty;
+ }
+ return lastty;
+}
/* Return the name associated with this type */
- SWIGRUNTIME(const char *)
- SWIG_TypeName(const swig_type_info * ty) {
- return ty->name;
- }
+SWIGRUNTIME(const char *)
+SWIG_TypeName(const swig_type_info *ty) {
+ return ty->name;
+}
/* Search for a swig_type_info structure */
- SWIGRUNTIME(swig_type_info *)
- SWIG_TypeQuery(const char *name) {
- swig_type_info *ty = swig_type_list;
- while (ty) {
- if (ty->str && (strcmp(name, ty->str) == 0))
- return ty;
- if (ty->name && (strcmp(name, ty->name) == 0))
- return ty;
- ty = ty->prev;
- }
- return 0;
- }
+SWIGRUNTIME(swig_type_info *)
+SWIG_TypeQuery(const char *name) {
+ swig_type_info *ty = swig_type_list;
+ while (ty) {
+ if (ty->str && (strcmp(name,ty->str) == 0)) return ty;
+ if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
+ ty = ty->prev;
+ }
+ return 0;
+}
/* Set the clientdata field for a type */
- SWIGRUNTIME(void)
- SWIG_TypeClientData(swig_type_info * ti, void *clientdata) {
- swig_type_info *tc, *equiv;
- if (ti->clientdata == clientdata)
- return;
- ti->clientdata = clientdata;
- equiv = ti->next;
- while (equiv) {
- if (!equiv->converter) {
- tc = swig_type_list;
- while (tc) {
- if ((strcmp(tc->name, equiv->name) == 0))
- SWIG_TypeClientData(tc, clientdata);
- tc = tc->prev;
- }
- }
- equiv = equiv->next;
- }
- }
+SWIGRUNTIME(void)
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+ swig_type_info *tc, *equiv;
+ if (ti->clientdata == clientdata) return;
+ ti->clientdata = clientdata;
+ equiv = ti->next;
+ while (equiv) {
+ if (!equiv->converter) {
+ tc = swig_type_list;
+ while (tc) {
+ if ((strcmp(tc->name, equiv->name) == 0))
+ SWIG_TypeClientData(tc,clientdata);
+ tc = tc->prev;
+ }
+ }
+ equiv = equiv->next;
+ }
+}
/* Pack binary data into a string */
- SWIGRUNTIME(char *)
- SWIG_PackData(char *c, void *ptr, int sz) {
- static char hex[17] = "0123456789abcdef";
- int i;
- unsigned char *u = (unsigned char *) ptr;
- register unsigned char uu;
- for (i = 0; i < sz; i++, u++) {
- uu = *u;
- *(c++) = hex[(uu & 0xf0) >> 4];
- *(c++) = hex[uu & 0xf];
- }
- return c;
- }
+SWIGRUNTIME(char *)
+SWIG_PackData(char *c, void *ptr, int sz) {
+ static char hex[17] = "0123456789abcdef";
+ int i;
+ unsigned char *u = (unsigned char *) ptr;
+ register unsigned char uu;
+ for (i = 0; i < sz; i++,u++) {
+ uu = *u;
+ *(c++) = hex[(uu & 0xf0) >> 4];
+ *(c++) = hex[uu & 0xf];
+ }
+ return c;
+}
/* Unpack binary data from a string */
- SWIGRUNTIME(char *)
- SWIG_UnpackData(char *c, void *ptr, int sz) {
- register unsigned char uu = 0;
- register int d;
- unsigned char *u = (unsigned char *) ptr;
- int i;
- for (i = 0; i < sz; i++, u++) {
- d = *(c++);
- if ((d >= '0') && (d <= '9'))
- uu = ((d - '0') << 4);
- else if ((d >= 'a') && (d <= 'f'))
- uu = ((d - ('a' - 10)) << 4);
- d = *(c++);
- if ((d >= '0') && (d <= '9'))
- uu |= (d - '0');
- else if ((d >= 'a') && (d <= 'f'))
- uu |= (d - ('a' - 10));
- *u = uu;
- }
- return c;
- }
+SWIGRUNTIME(char *)
+SWIG_UnpackData(char *c, void *ptr, int sz) {
+ register unsigned char uu = 0;
+ register int d;
+ unsigned char *u = (unsigned char *) ptr;
+ int i;
+ for (i = 0; i < sz; i++, u++) {
+ d = *(c++);
+ if ((d >= '0') && (d <= '9'))
+ uu = ((d - '0') << 4);
+ else if ((d >= 'a') && (d <= 'f'))
+ uu = ((d - ('a'-10)) << 4);
+ d = *(c++);
+ if ((d >= '0') && (d <= '9'))
+ uu |= (d - '0');
+ else if ((d >= 'a') && (d <= 'f'))
+ uu |= (d - ('a'-10));
+ *u = uu;
+ }
+ return c;
+}
#endif
@@ -315,30 +303,37 @@
#ifdef __cplusplus
}
#endif
+
/* Macro to call an XS function */
-#ifdef PERL_OBJECT
-# define SWIG_CALLXS(_name) _name(cv,pPerl)
-#else
-# ifndef MULTIPLICITY
-# define SWIG_CALLXS(_name) _name(cv)
-# else
-# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv)
-# endif
-#endif
+
+#ifdef PERL_OBJECT
+# define SWIG_CALLXS(_name) _name(cv,pPerl)
+#else
+# ifndef MULTIPLICITY
+# define SWIG_CALLXS(_name) _name(cv)
+# else
+# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv)
+# endif
+#endif
+
/* Contract support */
+
#define SWIG_contract_assert(expr,msg) if (!(expr)) { SWIG_croak(msg); } else
+
/* Note: SwigMagicFuncHack is a typedef used to get the C++ compiler to just shut up already */
+
#ifdef PERL_OBJECT
#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this;
-typedef int (CPerlObj::*SwigMagicFunc) (SV *, MAGIC *);
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
- typedef int (CPerlObj::*SwigMagicFuncHack) (SV *, MAGIC *);
+typedef int (CPerlObj::*SwigMagicFuncHack)(SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
+
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
#define SWIGCLASS_STATIC
#else
@@ -346,31 +341,37 @@
#define SWIGCLASS_STATIC static
#ifndef MULTIPLICITY
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
-typedef int (*SwigMagicFunc) (SV *, MAGIC *);
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
- typedef int (*SwigMagicFuncHack) (SV *, MAGIC *);
+typedef int (*SwigMagicFuncHack)(SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
+
+
#else
#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
-typedef int (*SwigMagicFunc) (struct interpreter *, SV *, MAGIC *);
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
#ifdef __cplusplus
extern "C" {
#endif
- typedef int (*SwigMagicFuncHack) (struct interpreter *, SV *, MAGIC *);
+typedef int (*SwigMagicFuncHack)(struct interpreter *, SV *, MAGIC *);
#ifdef __cplusplus
}
#endif
+
#endif
#endif
+
#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
#endif
+
/* Modifications for newer Perl 5.005 releases */
+
#if !defined(PERL_REVISION) || ((PERL_REVISION >= 5) && ((PERL_VERSION < 5) || ((PERL_VERSION == 5) && (PERL_SUBVERSION < 50))))
# ifndef PL_sv_yes
# define PL_sv_yes sv_yes
@@ -382,7 +383,9 @@
# define PL_na na
# endif
#endif
+
#include <stdlib.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -443,195 +446,187 @@
#ifdef SWIG_NOINCLUDE
- SWIGIMPORT(int) SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *, void **, swig_type_info *, int flags);
- SWIGIMPORT(void) SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *, void *, swig_type_info *, int flags);
- SWIGIMPORT(SV *) SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *, swig_type_info *, int flags);
- SWIGIMPORT(void) SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *, void *, int, swig_type_info *);
- SWIGIMPORT(int) SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *, void *, int, swig_type_info *, int flags);
- SWIGIMPORT(swig_type_info *) SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV * rv, swig_type_info * ty);
- SWIGIMPORT(SV *) SWIG_Perl_SetError(SWIG_MAYBE_PERL_OBJECT char *);
+SWIGIMPORT(int) SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *, void **, swig_type_info *, int flags);
+SWIGIMPORT(void) SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *, void *, swig_type_info *, int flags);
+SWIGIMPORT(SV *) SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *, swig_type_info *, int flags);
+SWIGIMPORT(void) SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *, void *, int, swig_type_info *);
+SWIGIMPORT(int) SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *, void *, int, swig_type_info *, int flags);
+SWIGIMPORT(swig_type_info *) SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV *rv, swig_type_info *ty);
+SWIGIMPORT(SV *) SWIG_Perl_SetError(SWIG_MAYBE_PERL_OBJECT char *);
#else
- SWIGRUNTIME(swig_type_info *)
- SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV * rv, swig_type_info * ty) {
- swig_type_info *s;
- if (!ty)
- return 0; /* Void pointer */
- s = ty->next; /* First element always just a name */
- do {
- if (sv_derived_from(rv, (char *) s->name)) {
- if (s == ty->next)
- return s;
- /* Move s to the top of the linked list */
- s->prev->next = s->next;
- if (s->next) {
- s->next->prev = s->prev;
- }
- /* Insert s as second element in the list */
- s-> next = ty->next;
- if (ty->next)
- ty->next->prev = s;
- ty->next = s;
- s->prev = ty;
- return s;
- }
- s = s->next;
- } while (s && (s != ty->next));
- return 0;
- }
+SWIGRUNTIME(swig_type_info *)
+SWIG_Perl_TypeCheckRV(SWIG_MAYBE_PERL_OBJECT SV *rv, swig_type_info *ty) {
+ swig_type_info *s;
+ if (!ty) return 0; /* Void pointer */
+ s = ty->next; /* First element always just a name */
+ do {
+ if (sv_derived_from(rv, (char *) s->name)) {
+ if (s == ty->next) return s;
+ /* Move s to the top of the linked list */
+ s->prev->next = s->next;
+ if (s->next) {
+ s->next->prev = s->prev;
+ }
+ /* Insert s as second element in the list */
+ s->next = ty->next;
+ if (ty->next) ty->next->prev = s;
+ ty->next = s;
+ s->prev = ty;
+ return s;
+ }
+ s = s->next;
+ } while (s && (s != ty->next));
+ return 0;
+}
/* Function for getting a pointer value */
- SWIGRUNTIME(int)
- SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV * sv, void **ptr, swig_type_info * _t, int flags) {
- swig_type_info *tc;
- void *voidptr = (void *) 0;
-
- /* If magical, apply more magic */
- if (SvGMAGICAL(sv))
- mg_get(sv);
-
- /* Check to see if this is an object */
- if (sv_isobject(sv)) {
- SV *tsv = (SV *) SvRV(sv);
- IV tmp = 0;
- if ((SvTYPE(tsv) == SVt_PVHV)) {
- MAGIC *mg;
- if (SvMAGICAL(tsv)) {
- mg = mg_find(tsv, 'P');
- if (mg) {
- SV *rsv = mg->mg_obj;
- if (sv_isobject(rsv)) {
- tmp = SvIV((SV *) SvRV(rsv));
- }
- }
- } else {
- return -1;
- }
- } else {
- tmp = SvIV((SV *) SvRV(sv));
- }
- voidptr = (void *) tmp;
- if (!_t) {
- *(ptr) = voidptr;
- return 0;
- }
- } else if (!SvOK(sv)) { /* Check for undef */
- *(ptr) = (void *) 0;
- return 0;
- } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */
- *(ptr) = (void *) 0;
- if (!SvROK(sv))
- return 0;
- else
- return -1;
- } else { /* Don't know what it is */
- *(ptr) = (void *) 0;
- return -1;
- }
- if (_t) {
- /* Now see if the types match */
- tc = SWIG_TypeCheckRV(sv, _t);
- if (!tc) {
- *ptr = voidptr;
- return -1;
- }
- *ptr = SWIG_TypeCast(tc, voidptr);
- return 0;
- }
- *ptr = voidptr;
- return 0;
- }
-
- SWIGRUNTIME(void)
- SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV * sv, void *ptr, swig_type_info * t, int flags) {
- if (ptr && (flags & SWIG_SHADOW)) {
- SV *self;
- SV *obj = newSV(0);
- HV *hash = newHV();
- HV *stash;
- sv_setref_pv(obj, (char *) t->name, ptr);
- stash = SvSTASH(SvRV(obj));
- if (flags & SWIG_OWNER) {
- HV *hv;
- GV *gv = *(GV **) hv_fetch(stash, "OWNER", 5, TRUE);
- if (!isGV(gv))
- gv_init(gv, stash, "OWNER", 5, FALSE);
- hv = GvHVn(gv);
- hv_store_ent(hv, obj, newSViv(1), 0);
- }
- sv_magic((SV *) hash, (SV *) obj, 'P', Nullch, 0);
- SvREFCNT_dec(obj);
- self = newRV_noinc((SV *) hash);
- sv_setsv(sv, self);
- SvREFCNT_dec((SV *) self);
- sv_bless(sv, stash);
- } else {
- sv_setref_pv(sv, (char *) t->name, ptr);
- }
- }
-
- SWIGRUNTIME(SV *)
- SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info * t, int flags) {
- SV *result = sv_newmortal();
- SWIG_MakePtr(result, ptr, t, flags);
- return result;
- }
-
- SWIGRUNTIME(void)
- SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV * sv, void *ptr, int sz, swig_type_info * type) {
- char result[1024];
- char *r = result;
- if ((2 * sz + 1 + strlen(type->name)) > 1000)
- return;
- *(r++) = '_';
- r = SWIG_PackData(r, ptr, sz);
- strcpy(r, type->name);
- sv_setpv(sv, result);
- }
+SWIGRUNTIME(int)
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+ swig_type_info *tc;
+ void *voidptr = (void *)0;
+
+ /* If magical, apply more magic */
+ if (SvGMAGICAL(sv))
+ mg_get(sv);
+
+ /* Check to see if this is an object */
+ if (sv_isobject(sv)) {
+ SV *tsv = (SV*) SvRV(sv);
+ IV tmp = 0;
+ if ((SvTYPE(tsv) == SVt_PVHV)) {
+ MAGIC *mg;
+ if (SvMAGICAL(tsv)) {
+ mg = mg_find(tsv,'P');
+ if (mg) {
+ SV *rsv = mg->mg_obj;
+ if (sv_isobject(rsv)) {
+ tmp = SvIV((SV*)SvRV(rsv));
+ }
+ }
+ } else {
+ return -1;
+ }
+ } else {
+ tmp = SvIV((SV*)SvRV(sv));
+ }
+ voidptr = (void *)tmp;
+ if (!_t) {
+ *(ptr) = voidptr;
+ return 0;
+ }
+ } else if (! SvOK(sv)) { /* Check for undef */
+ *(ptr) = (void *) 0;
+ return 0;
+ } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */
+ *(ptr) = (void *) 0;
+ if (!SvROK(sv))
+ return 0;
+ else
+ return -1;
+ } else { /* Don't know what it is */
+ *(ptr) = (void *) 0;
+ return -1;
+ }
+ if (_t) {
+ /* Now see if the types match */
+ tc = SWIG_TypeCheckRV(sv,_t);
+ if (!tc) {
+ *ptr = voidptr;
+ return -1;
+ }
+ *ptr = SWIG_TypeCast(tc,voidptr);
+ return 0;
+ }
+ *ptr = voidptr;
+ return 0;
+}
+
+SWIGRUNTIME(void)
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+ if (ptr && (flags & SWIG_SHADOW)) {
+ SV *self;
+ SV *obj=newSV(0);
+ HV *hash=newHV();
+ HV *stash;
+ sv_setref_pv(obj, (char *) t->name, ptr);
+ stash=SvSTASH(SvRV(obj));
+ if (flags & SWIG_OWNER) {
+ HV *hv;
+ GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+ if (!isGV(gv))
+ gv_init(gv, stash, "OWNER", 5, FALSE);
+ hv=GvHVn(gv);
+ hv_store_ent(hv, obj, newSViv(1), 0);
+ }
+ sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+ SvREFCNT_dec(obj);
+ self=newRV_noinc((SV *)hash);
+ sv_setsv(sv, self);
+ SvREFCNT_dec((SV *)self);
+ sv_bless(sv, stash);
+ }
+ else {
+ sv_setref_pv(sv, (char *) t->name, ptr);
+ }
+}
+
+SWIGRUNTIME(SV *)
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+ SV *result = sv_newmortal();
+ SWIG_MakePtr(result, ptr, t, flags);
+ return result;
+}
+
+SWIGRUNTIME(void)
+ SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+ char result[1024];
+ char *r = result;
+ if ((2*sz + 1 + strlen(type->name)) > 1000) return;
+ *(r++) = '_';
+ r = SWIG_PackData(r,ptr,sz);
+ strcpy(r,type->name);
+ sv_setpv(sv, result);
+}
/* Convert a packed value value */
- SWIGRUNTIME(int)
- SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV * obj, void *ptr, int sz, swig_type_info * ty, int flags) {
- swig_type_info *tc;
- char *c = 0;
-
- if ((!obj) || (!SvOK(obj)))
- return -1;
- c = SvPV(obj, PL_na);
- /* Pointer values must start with leading underscore */
- if (*c != '_')
- return -1;
- c++;
- c = SWIG_UnpackData(c, ptr, sz);
- if (ty) {
- tc = SWIG_TypeCheck(c, ty);
- if (!tc)
- return -1;
- }
- return 0;
- }
-
- SWIGRUNTIME(void)
- SWIG_Perl_SetError(SWIG_MAYBE_PERL_OBJECT const char *error) {
- if (error)
- sv_setpv(perl_get_sv("@", TRUE), error);
- }
-
- SWIGRUNTIME(void)
- SWIG_Perl_SetErrorSV(SWIG_MAYBE_PERL_OBJECT SV * error) {
- if (error)
- sv_setsv(perl_get_sv("@", TRUE), error);
- }
-
- SWIGRUNTIME(void)
- SWIG_Perl_SetErrorf(const char *fmt, ...) {
- va_list args;
- va_start(args, fmt);
- sv_vsetpvfn(perl_get_sv("@", TRUE), fmt, strlen(fmt), &args, Null(SV **), 0, Null(bool *));
- va_end(args);
- }
+SWIGRUNTIME(int)
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty, int flags) {
+ swig_type_info *tc;
+ char *c = 0;
+
+ if ((!obj) || (!SvOK(obj))) return -1;
+ c = SvPV(obj, PL_na);
+ /* Pointer values must start with leading underscore */
+ if (*c != '_') return -1;
+ c++;
+ c = SWIG_UnpackData(c,ptr,sz);
+ if (ty) {
+ tc = SWIG_TypeCheck(c,ty);
+ if (!tc) return -1;
+ }
+ return 0;
+}
+
+SWIGRUNTIME(void)
+SWIG_Perl_SetError(SWIG_MAYBE_PERL_OBJECT const char *error) {
+ if (error) sv_setpv(perl_get_sv("@", TRUE), error);
+}
+
+SWIGRUNTIME(void)
+SWIG_Perl_SetErrorSV(SWIG_MAYBE_PERL_OBJECT SV *error) {
+ if (error) sv_setsv(perl_get_sv("@", TRUE), error);
+}
+
+SWIGRUNTIME(void)
+SWIG_Perl_SetErrorf(const char *fmt, ...) {
+ va_list args;
+ va_start(args, fmt);
+ sv_vsetpvfn(perl_get_sv("@", TRUE), fmt, strlen(fmt), &args, Null(SV**), 0, Null(bool*));
+ va_end(args);
+}
#endif
@@ -643,14 +638,14 @@
/* #define SWIG_croakf(x...) { SWIG_SetErrorf(x); goto fail; } */
- typedef XS(SwigPerlWrapper);
- typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+typedef XS(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
/* Structure for command table */
- typedef struct {
- const char *name;
- SwigPerlWrapperPtr wrapper;
- } swig_command_info;
+typedef struct {
+ const char *name;
+ SwigPerlWrapperPtr wrapper;
+} swig_command_info;
/* Information for constant table */
@@ -661,14 +656,14 @@
#define SWIG_BINARY 5
/* Constant information structure */
- typedef struct swig_constant_info {
- int type;
- const char *name;
- long lvalue;
- double dvalue;
- void *pvalue;
- swig_type_info **ptype;
- } swig_constant_info;
+typedef struct swig_constant_info {
+ int type;
+ const char *name;
+ long lvalue;
+ double dvalue;
+ void *pvalue;
+ swig_type_info **ptype;
+} swig_constant_info;
#ifdef __cplusplus
}
@@ -676,36 +671,33 @@
/* Structure for variable table */
typedef struct {
- const char *name;
- SwigMagicFunc set;
- SwigMagicFunc get;
- swig_type_info **type;
+ const char *name;
+ SwigMagicFunc set;
+ SwigMagicFunc get;
+ swig_type_info **type;
} swig_variable_info;
/* Magic variable code */
#ifndef PERL_OBJECT
#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
-#ifndef MULTIPLICITY
-static void _swig_create_magic(SV * sv, char *name, int (*set) (SV *, MAGIC *), int (*get) (SV *, MAGIC *))
-{
-#else
-static void _swig_create_magic(SV * sv, char *name, int (*set) (struct interpreter *, SV *, MAGIC *), int (*get) (struct interpreter *, SV *, MAGIC *))
-{
-#endif
+ #ifndef MULTIPLICITY
+ static void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) {
+ #else
+ static void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) {
+ #endif
#else
# define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
-static void _swig_create_magic(CPerlObj * pPerl, SV * sv, const char *name, int (CPerlObj::*set) (SV *, MAGIC *), int (CPerlObj::*get) (SV *, MAGIC *))
-{
+static void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) {
#endif
- MAGIC *mg;
- sv_magic(sv, sv, 'U', (char *) name, strlen(name));
- mg = mg_find(sv, 'U');
- mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
- mg->mg_virtual->svt_get = (SwigMagicFuncHack) get;
- mg->mg_virtual->svt_set = (SwigMagicFuncHack) set;
- mg->mg_virtual->svt_len = 0;
- mg->mg_virtual->svt_clear = 0;
- mg->mg_virtual->svt_free = 0;
+ MAGIC *mg;
+ sv_magic(sv,sv,'U',(char *) name,strlen(name));
+ mg = mg_find(sv,'U');
+ mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+ mg->mg_virtual->svt_get = (SwigMagicFuncHack) get;
+ mg->mg_virtual->svt_set = (SwigMagicFuncHack) set;
+ mg->mg_virtual->svt_len = 0;
+ mg->mg_virtual->svt_clear = 0;
+ mg->mg_virtual->svt_free = 0;
}
@@ -714,69 +706,69 @@
#ifdef do_open
-#undef do_open
+ #undef do_open
#endif
#ifdef do_close
-#undef do_close
+ #undef do_close
#endif
#ifdef scalar
-#undef scalar
+ #undef scalar
#endif
#ifdef list
-#undef list
+ #undef list
#endif
#ifdef apply
-#undef apply
+ #undef apply
#endif
#ifdef convert
-#undef convert
+ #undef convert
#endif
#ifdef Error
-#undef Error
+ #undef Error
#endif
#ifdef form
-#undef form
+ #undef form
#endif
#ifdef vform
-#undef vform
+ #undef vform
#endif
#ifdef LABEL
-#undef LABEL
+ #undef LABEL
#endif
#ifdef METHOD
-#undef METHOD
+ #undef METHOD
#endif
#ifdef Move
-#undef Move
+ #undef Move
#endif
#ifdef yylex
-#undef yylex
+ #undef yylex
#endif
#ifdef yyparse
-#undef yyparse
+ #undef yyparse
#endif
#ifdef yyerror
-#undef yyerror
+ #undef yyerror
#endif
#ifdef invert
-#undef invert
+ #undef invert
#endif
#ifdef ref
-#undef ref
+ #undef ref
#endif
#ifdef ENTER
-#undef ENTER
+ #undef ENTER
#endif
/* -------- TYPES TABLE (BEGIN) -------- */
-#define SWIGTYPE_p_switch_channel_t swig_types[0]
-#define SWIGTYPE_p_switch_file_handle_t swig_types[1]
-#define SWIGTYPE_p_switch_core_session_t swig_types[2]
-#define SWIGTYPE_p_p_switch_core_session_t swig_types[3]
-#define SWIGTYPE_p_uint32_t swig_types[4]
-#define SWIGTYPE_p_switch_input_callback_function_t swig_types[5]
+#define SWIGTYPE_p_switch_channel_t swig_types[0]
+#define SWIGTYPE_p_switch_file_handle_t swig_types[1]
+#define SWIGTYPE_p_switch_core_session_t swig_types[2]
+#define SWIGTYPE_p_p_switch_core_session_t swig_types[3]
+#define SWIGTYPE_p_uint32_t swig_types[4]
+#define SWIGTYPE_p_switch_input_args_t swig_types[5]
static swig_type_info *swig_types[7];
/* -------- TYPES TABLE (END) -------- */
@@ -791,57 +783,55 @@
#endif
#ifndef PERL_OBJECT
#ifndef MULTIPLICITY
-SWIGEXPORT(void) SWIG_init(CV * cv);
+SWIGEXPORT(void) SWIG_init (CV* cv);
#else
-SWIGEXPORT(void) SWIG_init(pTHXo_ CV * cv);
+SWIGEXPORT(void) SWIG_init (pTHXo_ CV* cv);
#endif
#else
-SWIGEXPORT(void) SWIG_init(CV * cv, CPerlObj *);
+SWIGEXPORT(void) SWIG_init (CV *cv, CPerlObj *);
#endif
- extern void fs_core_set_globals(void);
- extern int fs_core_init(char *);
- extern int fs_core_destroy(void);
- extern int fs_loadable_module_init(void);
- extern int fs_loadable_module_shutdown(void);
- extern int fs_console_loop(void);
- extern void fs_consol_log(char *, char *);
- extern void fs_consol_clean(char *);
- extern switch_core_session_t *fs_core_session_locate(char *);
- extern void fs_channel_answer(switch_core_session_t *);
- extern void fs_channel_pre_answer(switch_core_session_t *);
- extern void fs_channel_hangup(switch_core_session_t *, char *);
- extern void fs_channel_set_variable(switch_core_session_t *, char *, char *);
- extern void fs_channel_get_variable(switch_core_session_t *, char *);
- extern void fs_channel_set_state(switch_core_session_t *, char *);
- extern int fs_ivr_play_file(switch_core_session_t *, char *);
- extern int fs_switch_ivr_record_file(switch_core_session_t *, switch_file_handle_t *, char *,
- switch_input_callback_function_t, void *, unsigned int, unsigned int);
- extern int fs_switch_ivr_sleep(switch_core_session_t *, uint32_t);
- extern int fs_ivr_play_file2(switch_core_session_t *, char *);
- extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *, switch_input_callback_function_t, void *, unsigned int, unsigned int);
- extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *, char *, unsigned int, unsigned int, char const *, char *, unsigned int);
- extern int fs_switch_ivr_originate(switch_core_session_t *, switch_core_session_t **, char *, uint32_t);
- extern int fs_switch_ivr_session_transfer(switch_core_session_t *, char *, char *, char *);
- extern int fs_switch_ivr_speak_text(switch_core_session_t *, char *, char *, uint32_t, char *);
- extern char *fs_switch_channel_get_variable(switch_channel_t *, char *);
- extern int fs_switch_channel_set_variable(switch_channel_t *, char *, char *);
+extern void fs_core_set_globals(void);
+extern int fs_core_init(char *);
+extern int fs_core_destroy(void);
+extern int fs_loadable_module_init(void);
+extern int fs_loadable_module_shutdown(void);
+extern int fs_console_loop(void);
+extern void fs_consol_log(char *,char *);
+extern void fs_consol_clean(char *);
+extern switch_core_session_t *fs_core_session_locate(char *);
+extern void fs_channel_answer(switch_core_session_t *);
+extern void fs_channel_pre_answer(switch_core_session_t *);
+extern void fs_channel_hangup(switch_core_session_t *,char *);
+extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
+extern void fs_channel_get_variable(switch_core_session_t *,char *);
+extern void fs_channel_set_state(switch_core_session_t *,char *);
+extern int fs_ivr_play_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_args_t *);
+extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_args_t *,unsigned int);
+extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
+extern int fs_ivr_play_file2(switch_core_session_t *,char *);
+extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *,switch_input_args_t *,unsigned int);
+extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *,char *,unsigned int,unsigned int,char const *,char *,unsigned int);
+extern int fs_switch_ivr_originate(switch_core_session_t *,switch_core_session_t **,char *,uint32_t);
+extern int fs_switch_ivr_session_transfer(switch_core_session_t *,char *,char *,char *);
+extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,uint32_t,char *);
+extern char *fs_switch_channel_get_variable(switch_channel_t *,char *);
+extern int fs_switch_channel_set_variable(switch_channel_t *,char *,char *);
+
-#include "switch.h"
#ifdef PERL_OBJECT
#define MAGIC_CLASS _wrap_fs_perl_var::
- class _wrap_fs_perl_var:public CPerlObj {
- public:
+class _wrap_fs_perl_var : public CPerlObj {
+public:
#else
#define MAGIC_CLASS
#endif
- SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV * sv, MAGIC * mg)
-{
- MAGIC_PPERL sv = sv;
- mg = mg;
- croak("Value is read-only.");
- return 0;
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *sv, MAGIC *mg) {
+ MAGIC_PPERL
+ sv = sv; mg = mg;
+ croak("Value is read-only.");
+ return 0;
}
@@ -852,974 +842,913 @@
#ifdef __cplusplus
extern "C" {
#endif
- XS(_wrap_fs_core_set_globals) {
- {
- int argvi = 0;
- dXSARGS;
-
- if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: fs_core_set_globals();");
- }
- fs_core_set_globals();
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_core_init) {
- {
- char *arg1;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: fs_core_init(path);");
- }
- if (!SvOK((SV *) ST(0)))
- arg1 = 0;
- else
- arg1 = (char *) SvPV(ST(0), PL_na);
- result = (int) fs_core_init(arg1);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_core_destroy) {
- {
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: fs_core_destroy();");
- }
- result = (int) fs_core_destroy();
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_loadable_module_init) {
- {
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: fs_loadable_module_init();");
- }
- result = (int) fs_loadable_module_init();
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_loadable_module_shutdown) {
- {
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: fs_loadable_module_shutdown();");
- }
- result = (int) fs_loadable_module_shutdown();
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_console_loop) {
- {
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: fs_console_loop();");
- }
- result = (int) fs_console_loop();
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_consol_log) {
- {
- char *arg1;
- char *arg2;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_consol_log(level_str,msg);");
- }
- if (!SvOK((SV *) ST(0)))
- arg1 = 0;
- else
- arg1 = (char *) SvPV(ST(0), PL_na);
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- fs_consol_log(arg1, arg2);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_consol_clean) {
- {
- char *arg1;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: fs_consol_clean(msg);");
- }
- if (!SvOK((SV *) ST(0)))
- arg1 = 0;
- else
- arg1 = (char *) SvPV(ST(0), PL_na);
- fs_consol_clean(arg1);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_core_session_locate) {
- {
- char *arg1;
- switch_core_session_t *result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: fs_core_session_locate(uuid);");
- }
- if (!SvOK((SV *) ST(0)))
- arg1 = 0;
- else
- arg1 = (char *) SvPV(ST(0), PL_na);
- result = (switch_core_session_t *) fs_core_session_locate(arg1);
-
- ST(argvi) = sv_newmortal();
- SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_switch_core_session_t, 0 | 0);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_channel_answer) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: fs_channel_answer(session);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_channel_answer. Expected _p_switch_core_session_t");
- }
- }
- fs_channel_answer(arg1);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_channel_pre_answer) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: fs_channel_pre_answer(session);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_channel_pre_answer. Expected _p_switch_core_session_t");
- }
- }
- fs_channel_pre_answer(arg1);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_channel_hangup) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_channel_hangup(session,cause);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_channel_hangup. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- fs_channel_hangup(arg1, arg2);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_channel_set_variable) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- char *arg3;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: fs_channel_set_variable(session,var,val);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_channel_set_variable. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- if (!SvOK((SV *) ST(2)))
- arg3 = 0;
- else
- arg3 = (char *) SvPV(ST(2), PL_na);
- fs_channel_set_variable(arg1, arg2, arg3);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_channel_get_variable) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_channel_get_variable(session,var);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_channel_get_variable. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- fs_channel_get_variable(arg1, arg2);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_channel_set_state) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_channel_set_state(session,state);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_channel_set_state. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- fs_channel_set_state(arg1, arg2);
-
-
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_ivr_play_file) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_ivr_play_file(session,file);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_ivr_play_file. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- result = (int) fs_ivr_play_file(arg1, arg2);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_ivr_record_file) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- switch_file_handle_t *arg2 = (switch_file_handle_t *) 0;
- char *arg3;
- switch_input_callback_function_t arg4;
- void *arg5 = (void *) 0;
- unsigned int arg6;
- unsigned int arg7;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 7) || (items > 7)) {
- SWIG_croak("Usage: fs_switch_ivr_record_file(session,fh,file,dtmf_callback,buf,buflen,limit);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_ivr_record_file. Expected _p_switch_core_session_t");
- }
- }
- {
- if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_switch_file_handle_t, 0) < 0) {
- SWIG_croak("Type error in argument 2 of fs_switch_ivr_record_file. Expected _p_switch_file_handle_t");
- }
- }
- if (!SvOK((SV *) ST(2)))
- arg3 = 0;
- else
- arg3 = (char *) SvPV(ST(2), PL_na);
- {
- switch_input_callback_function_t *argp;
- if (SWIG_ConvertPtr(ST(3), (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t, 0) < 0) {
- SWIG_croak("Type error in argument 4 of fs_switch_ivr_record_file. Expected _p_switch_input_callback_function_t");
- }
- arg4 = *argp;
- }
- {
- if (SWIG_ConvertPtr(ST(4), (void **) &arg5, 0, 0) < 0) {
- SWIG_croak("Type error in argument 5 of fs_switch_ivr_record_file. Expected _p_void");
- }
- }
- arg6 = (unsigned int) SvUV(ST(5));
- arg7 = (unsigned int) SvUV(ST(6));
- result = (int) fs_switch_ivr_record_file(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_ivr_sleep) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- uint32_t arg2;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_switch_ivr_sleep(session,ms);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_ivr_sleep. Expected _p_switch_core_session_t");
- }
- }
- {
- uint32_t *argp;
- if (SWIG_ConvertPtr(ST(1), (void **) &argp, SWIGTYPE_p_uint32_t, 0) < 0) {
- SWIG_croak("Type error in argument 2 of fs_switch_ivr_sleep. Expected _p_uint32_t");
- }
- arg2 = *argp;
- }
- result = (int) fs_switch_ivr_sleep(arg1, arg2);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_ivr_play_file2) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_ivr_play_file2(session,file);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_ivr_play_file2. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- result = (int) fs_ivr_play_file2(arg1, arg2);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_ivr_collect_digits_callback) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- switch_input_callback_function_t arg2;
- void *arg3 = (void *) 0;
- unsigned int arg4;
- unsigned int arg5;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 5) || (items > 5)) {
- SWIG_croak("Usage: fs_switch_ivr_collect_digits_callback(session,dtmf_callback,buf,buflen,timeout);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_ivr_collect_digits_callback. Expected _p_switch_core_session_t");
- }
- }
- {
- switch_input_callback_function_t *argp;
- if (SWIG_ConvertPtr(ST(1), (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t, 0) < 0) {
- SWIG_croak("Type error in argument 2 of fs_switch_ivr_collect_digits_callback. Expected _p_switch_input_callback_function_t");
- }
- arg2 = *argp;
- }
- {
- if (SWIG_ConvertPtr(ST(2), (void **) &arg3, 0, 0) < 0) {
- SWIG_croak("Type error in argument 3 of fs_switch_ivr_collect_digits_callback. Expected _p_void");
- }
- }
- arg4 = (unsigned int) SvUV(ST(3));
- arg5 = (unsigned int) SvUV(ST(4));
- result = (int) fs_switch_ivr_collect_digits_callback(arg1, arg2, arg3, arg4, arg5);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_ivr_collect_digits_count) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- unsigned int arg3;
- unsigned int arg4;
- char *arg5;
- char *arg6;
- unsigned int arg7;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 7) || (items > 7)) {
- SWIG_croak("Usage: fs_switch_ivr_collect_digits_count(session,buf,buflen,maxdigits,terminators,terminator,timeout);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_ivr_collect_digits_count. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- arg3 = (unsigned int) SvUV(ST(2));
- arg4 = (unsigned int) SvUV(ST(3));
- if (!SvOK((SV *) ST(4)))
- arg5 = 0;
- else
- arg5 = (char *) SvPV(ST(4), PL_na);
- if (!SvOK((SV *) ST(5)))
- arg6 = 0;
- else
- arg6 = (char *) SvPV(ST(5), PL_na);
- arg7 = (unsigned int) SvUV(ST(6));
- result = (int) fs_switch_ivr_collect_digits_count(arg1, arg2, arg3, arg4, (char const *) arg5, arg6, arg7);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_ivr_originate) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- switch_core_session_t **arg2 = (switch_core_session_t **) 0;
- char *arg3;
- uint32_t arg4;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 4) || (items > 4)) {
- SWIG_croak("Usage: fs_switch_ivr_originate(session,bleg,bridgeto,timelimit_sec);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_ivr_originate. Expected _p_switch_core_session_t");
- }
- }
- {
- if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 2 of fs_switch_ivr_originate. Expected _p_p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(2)))
- arg3 = 0;
- else
- arg3 = (char *) SvPV(ST(2), PL_na);
- {
- uint32_t *argp;
- if (SWIG_ConvertPtr(ST(3), (void **) &argp, SWIGTYPE_p_uint32_t, 0) < 0) {
- SWIG_croak("Type error in argument 4 of fs_switch_ivr_originate. Expected _p_uint32_t");
- }
- arg4 = *argp;
- }
- result = (int) fs_switch_ivr_originate(arg1, arg2, arg3, arg4);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_ivr_session_transfer) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- char *arg3;
- char *arg4;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 4) || (items > 4)) {
- SWIG_croak("Usage: fs_switch_ivr_session_transfer(session,extension,dialplan,context);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_ivr_session_transfer. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- if (!SvOK((SV *) ST(2)))
- arg3 = 0;
- else
- arg3 = (char *) SvPV(ST(2), PL_na);
- if (!SvOK((SV *) ST(3)))
- arg4 = 0;
- else
- arg4 = (char *) SvPV(ST(3), PL_na);
- result = (int) fs_switch_ivr_session_transfer(arg1, arg2, arg3, arg4);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_ivr_speak_text) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0;
- char *arg2;
- char *arg3;
- uint32_t arg4;
- char *arg5;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 5) || (items > 5)) {
- SWIG_croak("Usage: fs_switch_ivr_speak_text(session,tts_name,voice_name,rate,text);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_ivr_speak_text. Expected _p_switch_core_session_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- if (!SvOK((SV *) ST(2)))
- arg3 = 0;
- else
- arg3 = (char *) SvPV(ST(2), PL_na);
- {
- uint32_t *argp;
- if (SWIG_ConvertPtr(ST(3), (void **) &argp, SWIGTYPE_p_uint32_t, 0) < 0) {
- SWIG_croak("Type error in argument 4 of fs_switch_ivr_speak_text. Expected _p_uint32_t");
- }
- arg4 = *argp;
- }
- if (!SvOK((SV *) ST(4)))
- arg5 = 0;
- else
- arg5 = (char *) SvPV(ST(4), PL_na);
- result = (int) fs_switch_ivr_speak_text(arg1, arg2, arg3, arg4, arg5);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_channel_get_variable) {
- {
- switch_channel_t *arg1 = (switch_channel_t *) 0;
- char *arg2;
- char *result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: fs_switch_channel_get_variable(channel,varname);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_channel_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_channel_get_variable. Expected _p_switch_channel_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- result = (char *) fs_switch_channel_get_variable(arg1, arg2);
-
- ST(argvi) = sv_newmortal();
- if (result) {
- sv_setpv((SV *) ST(argvi++), (char *) result);
- } else {
- sv_setsv((SV *) ST(argvi++), &PL_sv_undef);
- }
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
-
-
- XS(_wrap_fs_switch_channel_set_variable) {
- {
- switch_channel_t *arg1 = (switch_channel_t *) 0;
- char *arg2;
- char *arg3;
- int result;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: fs_switch_channel_set_variable(channel,varname,value);");
- }
- {
- if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_channel_t, 0) < 0) {
- SWIG_croak("Type error in argument 1 of fs_switch_channel_set_variable. Expected _p_switch_channel_t");
- }
- }
- if (!SvOK((SV *) ST(1)))
- arg2 = 0;
- else
- arg2 = (char *) SvPV(ST(1), PL_na);
- if (!SvOK((SV *) ST(2)))
- arg3 = 0;
- else
- arg3 = (char *) SvPV(ST(2), PL_na);
- result = (int) fs_switch_channel_set_variable(arg1, arg2, arg3);
-
- ST(argvi) = sv_newmortal();
- sv_setiv(ST(argvi++), (IV) result);
- XSRETURN(argvi);
- fail:
- ;
- }
- croak(Nullch);
- }
+XS(_wrap_fs_core_set_globals) {
+ {
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: fs_core_set_globals();");
+ }
+ fs_core_set_globals();
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_core_init) {
+ {
+ char *arg1 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: fs_core_init(path);");
+ }
+ if (!SvOK((SV*) ST(0))) arg1 = 0;
+ else arg1 = (char *) SvPV(ST(0), PL_na);
+ result = (int)fs_core_init(arg1);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_core_destroy) {
+ {
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: fs_core_destroy();");
+ }
+ result = (int)fs_core_destroy();
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_loadable_module_init) {
+ {
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: fs_loadable_module_init();");
+ }
+ result = (int)fs_loadable_module_init();
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_loadable_module_shutdown) {
+ {
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: fs_loadable_module_shutdown();");
+ }
+ result = (int)fs_loadable_module_shutdown();
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_console_loop) {
+ {
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: fs_console_loop();");
+ }
+ result = (int)fs_console_loop();
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_consol_log) {
+ {
+ char *arg1 ;
+ char *arg2 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: fs_consol_log(level_str,msg);");
+ }
+ if (!SvOK((SV*) ST(0))) arg1 = 0;
+ else arg1 = (char *) SvPV(ST(0), PL_na);
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ fs_consol_log(arg1,arg2);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_consol_clean) {
+ {
+ char *arg1 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: fs_consol_clean(msg);");
+ }
+ if (!SvOK((SV*) ST(0))) arg1 = 0;
+ else arg1 = (char *) SvPV(ST(0), PL_na);
+ fs_consol_clean(arg1);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_core_session_locate) {
+ {
+ char *arg1 ;
+ switch_core_session_t *result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: fs_core_session_locate(uuid);");
+ }
+ if (!SvOK((SV*) ST(0))) arg1 = 0;
+ else arg1 = (char *) SvPV(ST(0), PL_na);
+ result = (switch_core_session_t *)fs_core_session_locate(arg1);
+
+ ST(argvi) = sv_newmortal();
+ SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE_p_switch_core_session_t, 0|0);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_channel_answer) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: fs_channel_answer(session);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_channel_answer. Expected _p_switch_core_session_t");
+ }
+ }
+ fs_channel_answer(arg1);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_channel_pre_answer) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: fs_channel_pre_answer(session);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_channel_pre_answer. Expected _p_switch_core_session_t");
+ }
+ }
+ fs_channel_pre_answer(arg1);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_channel_hangup) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: fs_channel_hangup(session,cause);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_channel_hangup. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ fs_channel_hangup(arg1,arg2);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_channel_set_variable) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ char *arg3 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: fs_channel_set_variable(session,var,val);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_channel_set_variable. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ if (!SvOK((SV*) ST(2))) arg3 = 0;
+ else arg3 = (char *) SvPV(ST(2), PL_na);
+ fs_channel_set_variable(arg1,arg2,arg3);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_channel_get_variable) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: fs_channel_get_variable(session,var);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_channel_get_variable. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ fs_channel_get_variable(arg1,arg2);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_channel_set_state) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: fs_channel_set_state(session,state);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_channel_set_state. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ fs_channel_set_state(arg1,arg2);
+
+
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_ivr_play_file) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ switch_file_handle_t *arg2 = (switch_file_handle_t *) 0 ;
+ char *arg3 ;
+ switch_input_args_t *arg4 = (switch_input_args_t *) 0 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: fs_ivr_play_file(session,fh,file,args);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_ivr_play_file. Expected _p_switch_core_session_t");
+ }
+ }
+ {
+ if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_switch_file_handle_t,0) < 0) {
+ SWIG_croak("Type error in argument 2 of fs_ivr_play_file. Expected _p_switch_file_handle_t");
+ }
+ }
+ if (!SvOK((SV*) ST(2))) arg3 = 0;
+ else arg3 = (char *) SvPV(ST(2), PL_na);
+ {
+ if (SWIG_ConvertPtr(ST(3), (void **) &arg4, SWIGTYPE_p_switch_input_args_t,0) < 0) {
+ SWIG_croak("Type error in argument 4 of fs_ivr_play_file. Expected _p_switch_input_args_t");
+ }
+ }
+ result = (int)fs_ivr_play_file(arg1,arg2,arg3,arg4);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_ivr_record_file) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ switch_file_handle_t *arg2 = (switch_file_handle_t *) 0 ;
+ char *arg3 ;
+ switch_input_args_t *arg4 = (switch_input_args_t *) 0 ;
+ unsigned int arg5 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 5) || (items > 5)) {
+ SWIG_croak("Usage: fs_switch_ivr_record_file(session,fh,file,args,limit);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_ivr_record_file. Expected _p_switch_core_session_t");
+ }
+ }
+ {
+ if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_switch_file_handle_t,0) < 0) {
+ SWIG_croak("Type error in argument 2 of fs_switch_ivr_record_file. Expected _p_switch_file_handle_t");
+ }
+ }
+ if (!SvOK((SV*) ST(2))) arg3 = 0;
+ else arg3 = (char *) SvPV(ST(2), PL_na);
+ {
+ if (SWIG_ConvertPtr(ST(3), (void **) &arg4, SWIGTYPE_p_switch_input_args_t,0) < 0) {
+ SWIG_croak("Type error in argument 4 of fs_switch_ivr_record_file. Expected _p_switch_input_args_t");
+ }
+ }
+ arg5 = (unsigned int) SvUV(ST(4));
+ result = (int)fs_switch_ivr_record_file(arg1,arg2,arg3,arg4,arg5);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_ivr_sleep) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ uint32_t arg2 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: fs_switch_ivr_sleep(session,ms);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_ivr_sleep. Expected _p_switch_core_session_t");
+ }
+ }
+ {
+ uint32_t * argp;
+ if (SWIG_ConvertPtr(ST(1),(void **) &argp, SWIGTYPE_p_uint32_t,0) < 0) {
+ SWIG_croak("Type error in argument 2 of fs_switch_ivr_sleep. Expected _p_uint32_t");
+ }
+ arg2 = *argp;
+ }
+ result = (int)fs_switch_ivr_sleep(arg1,arg2);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_ivr_play_file2) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: fs_ivr_play_file2(session,file);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_ivr_play_file2. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ result = (int)fs_ivr_play_file2(arg1,arg2);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_ivr_collect_digits_callback) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ switch_input_args_t *arg2 = (switch_input_args_t *) 0 ;
+ unsigned int arg3 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: fs_switch_ivr_collect_digits_callback(session,args,timeout);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_ivr_collect_digits_callback. Expected _p_switch_core_session_t");
+ }
+ }
+ {
+ if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_switch_input_args_t,0) < 0) {
+ SWIG_croak("Type error in argument 2 of fs_switch_ivr_collect_digits_callback. Expected _p_switch_input_args_t");
+ }
+ }
+ arg3 = (unsigned int) SvUV(ST(2));
+ result = (int)fs_switch_ivr_collect_digits_callback(arg1,arg2,arg3);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_ivr_collect_digits_count) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ unsigned int arg3 ;
+ unsigned int arg4 ;
+ char *arg5 ;
+ char *arg6 ;
+ unsigned int arg7 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 7) || (items > 7)) {
+ SWIG_croak("Usage: fs_switch_ivr_collect_digits_count(session,buf,buflen,maxdigits,terminators,terminator,timeout);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_ivr_collect_digits_count. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ arg3 = (unsigned int) SvUV(ST(2));
+ arg4 = (unsigned int) SvUV(ST(3));
+ if (!SvOK((SV*) ST(4))) arg5 = 0;
+ else arg5 = (char *) SvPV(ST(4), PL_na);
+ if (!SvOK((SV*) ST(5))) arg6 = 0;
+ else arg6 = (char *) SvPV(ST(5), PL_na);
+ arg7 = (unsigned int) SvUV(ST(6));
+ result = (int)fs_switch_ivr_collect_digits_count(arg1,arg2,arg3,arg4,(char const *)arg5,arg6,arg7);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_ivr_originate) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ switch_core_session_t **arg2 = (switch_core_session_t **) 0 ;
+ char *arg3 ;
+ uint32_t arg4 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: fs_switch_ivr_originate(session,bleg,bridgeto,timelimit_sec);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_ivr_originate. Expected _p_switch_core_session_t");
+ }
+ }
+ {
+ if (SWIG_ConvertPtr(ST(1), (void **) &arg2, SWIGTYPE_p_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 2 of fs_switch_ivr_originate. Expected _p_p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(2))) arg3 = 0;
+ else arg3 = (char *) SvPV(ST(2), PL_na);
+ {
+ uint32_t * argp;
+ if (SWIG_ConvertPtr(ST(3),(void **) &argp, SWIGTYPE_p_uint32_t,0) < 0) {
+ SWIG_croak("Type error in argument 4 of fs_switch_ivr_originate. Expected _p_uint32_t");
+ }
+ arg4 = *argp;
+ }
+ result = (int)fs_switch_ivr_originate(arg1,arg2,arg3,arg4);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_ivr_session_transfer) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ char *arg3 ;
+ char *arg4 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: fs_switch_ivr_session_transfer(session,extension,dialplan,context);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_ivr_session_transfer. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ if (!SvOK((SV*) ST(2))) arg3 = 0;
+ else arg3 = (char *) SvPV(ST(2), PL_na);
+ if (!SvOK((SV*) ST(3))) arg4 = 0;
+ else arg4 = (char *) SvPV(ST(3), PL_na);
+ result = (int)fs_switch_ivr_session_transfer(arg1,arg2,arg3,arg4);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_ivr_speak_text) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+ char *arg2 ;
+ char *arg3 ;
+ uint32_t arg4 ;
+ char *arg5 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 5) || (items > 5)) {
+ SWIG_croak("Usage: fs_switch_ivr_speak_text(session,tts_name,voice_name,rate,text);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_ivr_speak_text. Expected _p_switch_core_session_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ if (!SvOK((SV*) ST(2))) arg3 = 0;
+ else arg3 = (char *) SvPV(ST(2), PL_na);
+ {
+ uint32_t * argp;
+ if (SWIG_ConvertPtr(ST(3),(void **) &argp, SWIGTYPE_p_uint32_t,0) < 0) {
+ SWIG_croak("Type error in argument 4 of fs_switch_ivr_speak_text. Expected _p_uint32_t");
+ }
+ arg4 = *argp;
+ }
+ if (!SvOK((SV*) ST(4))) arg5 = 0;
+ else arg5 = (char *) SvPV(ST(4), PL_na);
+ result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_channel_get_variable) {
+ {
+ switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+ char *arg2 ;
+ char *result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: fs_switch_channel_get_variable(channel,varname);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_channel_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_channel_get_variable. Expected _p_switch_channel_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ result = (char *)fs_switch_channel_get_variable(arg1,arg2);
+
+ ST(argvi) = sv_newmortal();
+ if (result) {
+ sv_setpv((SV*)ST(argvi++), (char *) result);
+ } else {
+ sv_setsv((SV*)ST(argvi++), &PL_sv_undef);
+ }
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
+
+
+XS(_wrap_fs_switch_channel_set_variable) {
+ {
+ switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+ char *arg2 ;
+ char *arg3 ;
+ int result;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: fs_switch_channel_set_variable(channel,varname,value);");
+ }
+ {
+ if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_channel_t,0) < 0) {
+ SWIG_croak("Type error in argument 1 of fs_switch_channel_set_variable. Expected _p_switch_channel_t");
+ }
+ }
+ if (!SvOK((SV*) ST(1))) arg2 = 0;
+ else arg2 = (char *) SvPV(ST(1), PL_na);
+ if (!SvOK((SV*) ST(2))) arg3 = 0;
+ else arg3 = (char *) SvPV(ST(2), PL_na);
+ result = (int)fs_switch_channel_set_variable(arg1,arg2,arg3);
+
+ ST(argvi) = sv_newmortal();
+ sv_setiv(ST(argvi++), (IV) result);
+ XSRETURN(argvi);
+ fail:
+ ;
+ }
+ croak(Nullch);
+}
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
- static swig_type_info _swigt__p_switch_channel_t[] = { {"_p_switch_channel_t", 0, "switch_channel_t *", 0}, {"_p_switch_channel_t"}, {0} };
- static swig_type_info _swigt__p_switch_file_handle_t[] =
- { {"_p_switch_file_handle_t", 0, "switch_file_handle_t *", 0}, {"_p_switch_file_handle_t"}, {0} };
- static swig_type_info _swigt__p_switch_core_session_t[] =
- { {"_p_switch_core_session_t", 0, "switch_core_session_t *", 0}, {"_p_switch_core_session_t"}, {0} };
- static swig_type_info _swigt__p_p_switch_core_session_t[] =
- { {"_p_p_switch_core_session_t", 0, "switch_core_session_t **", 0}, {"_p_p_switch_core_session_t"}, {0} };
- static swig_type_info _swigt__p_uint32_t[] = { {"_p_uint32_t", 0, "uint32_t *", 0}, {"_p_uint32_t"}, {0} };
- static swig_type_info _swigt__p_switch_input_callback_function_t[] =
- { {"_p_switch_input_callback_function_t", 0, "switch_input_callback_function_t *", 0},
- {"_p_switch_input_callback_function_t"}, {0}
- };
-
- static swig_type_info *swig_types_initial[] = {
- _swigt__p_switch_channel_t,
- _swigt__p_switch_file_handle_t,
- _swigt__p_switch_core_session_t,
- _swigt__p_p_switch_core_session_t,
- _swigt__p_uint32_t,
- _swigt__p_switch_input_callback_function_t,
- 0
- };
+static swig_type_info _swigt__p_switch_channel_t[] = {{"_p_switch_channel_t", 0, "switch_channel_t *", 0},{"_p_switch_channel_t"},{0}};
+static swig_type_info _swigt__p_switch_file_handle_t[] = {{"_p_switch_file_handle_t", 0, "switch_file_handle_t *", 0},{"_p_switch_file_handle_t"},{0}};
+static swig_type_info _swigt__p_switch_core_session_t[] = {{"_p_switch_core_session_t", 0, "switch_core_session_t *", 0},{"_p_switch_core_session_t"},{0}};
+static swig_type_info _swigt__p_p_switch_core_session_t[] = {{"_p_p_switch_core_session_t", 0, "switch_core_session_t **", 0},{"_p_p_switch_core_session_t"},{0}};
+static swig_type_info _swigt__p_uint32_t[] = {{"_p_uint32_t", 0, "uint32_t *", 0},{"_p_uint32_t"},{0}};
+static swig_type_info _swigt__p_switch_input_args_t[] = {{"_p_switch_input_args_t", 0, "switch_input_args_t *", 0},{"_p_switch_input_args_t"},{0}};
+
+static swig_type_info *swig_types_initial[] = {
+_swigt__p_switch_channel_t,
+_swigt__p_switch_file_handle_t,
+_swigt__p_switch_core_session_t,
+_swigt__p_p_switch_core_session_t,
+_swigt__p_uint32_t,
+_swigt__p_switch_input_args_t,
+0
+};
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
- static swig_constant_info swig_constants[] = {
- {0}
- };
+static swig_constant_info swig_constants[] = {
+{ SWIG_STRING, (char *) SWIG_prefix "FREESWITCH_PEN", 0, 0, (void *)"27880", 0},
+{ SWIG_STRING, (char *) SWIG_prefix "FREESWITCH_OID_PREFIX", 0, 0, (void *)".1.3.6.1.4.1.27880", 0},
+{ SWIG_STRING, (char *) SWIG_prefix "FREESWITCH_ITAD", 0, 0, (void *)"543", 0},
+{ SWIG_INT, (char *) SWIG_prefix "__EXTENSIONS__", (long) 1, 0, 0, 0},
+{0}
+};
#ifdef __cplusplus
}
#endif
static swig_variable_info swig_variables[] = {
- {0}
+{0}
};
static swig_command_info swig_commands[] = {
- {"fs_perlc::fs_core_set_globals", _wrap_fs_core_set_globals},
- {"fs_perlc::fs_core_init", _wrap_fs_core_init},
- {"fs_perlc::fs_core_destroy", _wrap_fs_core_destroy},
- {"fs_perlc::fs_loadable_module_init", _wrap_fs_loadable_module_init},
- {"fs_perlc::fs_loadable_module_shutdown", _wrap_fs_loadable_module_shutdown},
- {"fs_perlc::fs_console_loop", _wrap_fs_console_loop},
- {"fs_perlc::fs_consol_log", _wrap_fs_consol_log},
- {"fs_perlc::fs_consol_clean", _wrap_fs_consol_clean},
- {"fs_perlc::fs_core_session_locate", _wrap_fs_core_session_locate},
- {"fs_perlc::fs_channel_answer", _wrap_fs_channel_answer},
- {"fs_perlc::fs_channel_pre_answer", _wrap_fs_channel_pre_answer},
- {"fs_perlc::fs_channel_hangup", _wrap_fs_channel_hangup},
- {"fs_perlc::fs_channel_set_variable", _wrap_fs_channel_set_variable},
- {"fs_perlc::fs_channel_get_variable", _wrap_fs_channel_get_variable},
- {"fs_perlc::fs_channel_set_state", _wrap_fs_channel_set_state},
- {"fs_perlc::fs_ivr_play_file", _wrap_fs_ivr_play_file},
- {"fs_perlc::fs_switch_ivr_record_file", _wrap_fs_switch_ivr_record_file},
- {"fs_perlc::fs_switch_ivr_sleep", _wrap_fs_switch_ivr_sleep},
- {"fs_perlc::fs_ivr_play_file2", _wrap_fs_ivr_play_file2},
- {"fs_perlc::fs_switch_ivr_collect_digits_callback", _wrap_fs_switch_ivr_collect_digits_callback},
- {"fs_perlc::fs_switch_ivr_collect_digits_count", _wrap_fs_switch_ivr_collect_digits_count},
- {"fs_perlc::fs_switch_ivr_originate", _wrap_fs_switch_ivr_originate},
- {"fs_perlc::fs_switch_ivr_session_transfer", _wrap_fs_switch_ivr_session_transfer},
- {"fs_perlc::fs_switch_ivr_speak_text", _wrap_fs_switch_ivr_speak_text},
- {"fs_perlc::fs_switch_channel_get_variable", _wrap_fs_switch_channel_get_variable},
- {"fs_perlc::fs_switch_channel_set_variable", _wrap_fs_switch_channel_set_variable},
- {0, 0}
+{"fs_perlc::fs_core_set_globals", _wrap_fs_core_set_globals},
+{"fs_perlc::fs_core_init", _wrap_fs_core_init},
+{"fs_perlc::fs_core_destroy", _wrap_fs_core_destroy},
+{"fs_perlc::fs_loadable_module_init", _wrap_fs_loadable_module_init},
+{"fs_perlc::fs_loadable_module_shutdown", _wrap_fs_loadable_module_shutdown},
+{"fs_perlc::fs_console_loop", _wrap_fs_console_loop},
+{"fs_perlc::fs_consol_log", _wrap_fs_consol_log},
+{"fs_perlc::fs_consol_clean", _wrap_fs_consol_clean},
+{"fs_perlc::fs_core_session_locate", _wrap_fs_core_session_locate},
+{"fs_perlc::fs_channel_answer", _wrap_fs_channel_answer},
+{"fs_perlc::fs_channel_pre_answer", _wrap_fs_channel_pre_answer},
+{"fs_perlc::fs_channel_hangup", _wrap_fs_channel_hangup},
+{"fs_perlc::fs_channel_set_variable", _wrap_fs_channel_set_variable},
+{"fs_perlc::fs_channel_get_variable", _wrap_fs_channel_get_variable},
+{"fs_perlc::fs_channel_set_state", _wrap_fs_channel_set_state},
+{"fs_perlc::fs_ivr_play_file", _wrap_fs_ivr_play_file},
+{"fs_perlc::fs_switch_ivr_record_file", _wrap_fs_switch_ivr_record_file},
+{"fs_perlc::fs_switch_ivr_sleep", _wrap_fs_switch_ivr_sleep},
+{"fs_perlc::fs_ivr_play_file2", _wrap_fs_ivr_play_file2},
+{"fs_perlc::fs_switch_ivr_collect_digits_callback", _wrap_fs_switch_ivr_collect_digits_callback},
+{"fs_perlc::fs_switch_ivr_collect_digits_count", _wrap_fs_switch_ivr_collect_digits_count},
+{"fs_perlc::fs_switch_ivr_originate", _wrap_fs_switch_ivr_originate},
+{"fs_perlc::fs_switch_ivr_session_transfer", _wrap_fs_switch_ivr_session_transfer},
+{"fs_perlc::fs_switch_ivr_speak_text", _wrap_fs_switch_ivr_speak_text},
+{"fs_perlc::fs_switch_channel_get_variable", _wrap_fs_switch_channel_get_variable},
+{"fs_perlc::fs_switch_channel_set_variable", _wrap_fs_switch_channel_set_variable},
+{0,0}
};
#ifdef __cplusplus
extern "C"
#endif
-XS(SWIG_init)
-{
- dXSARGS;
- int i;
- static int _init = 0;
- if (!_init) {
- for (i = 0; swig_types_initial[i]; i++) {
- swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
- }
- _init = 1;
- }
-
- /* Install commands */
- for (i = 0; swig_commands[i].name; i++) {
- newXS((char *) swig_commands[i].name, swig_commands[i].wrapper, (char *) __FILE__);
- }
-
- /* Install variables */
- for (i = 0; swig_variables[i].name; i++) {
- SV *sv;
- sv = perl_get_sv((char *) swig_variables[i].name, TRUE | 0x2);
- if (swig_variables[i].type) {
- SWIG_MakePtr(sv, (void *) 1, *swig_variables[i].type, 0);
- } else {
- sv_setiv(sv, (IV) 0);
- }
- swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get);
- }
-
- /* Install constant */
- for (i = 0; swig_constants[i].type; i++) {
- SV *sv;
- sv = perl_get_sv((char *) swig_constants[i].name, TRUE | 0x2);
- switch (swig_constants[i].type) {
- case SWIG_INT:
- sv_setiv(sv, (IV) swig_constants[i].lvalue);
- break;
- case SWIG_FLOAT:
- sv_setnv(sv, (double) swig_constants[i].dvalue);
- break;
- case SWIG_STRING:
- sv_setpv(sv, (char *) swig_constants[i].pvalue);
- break;
- case SWIG_POINTER:
- SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype), 0);
- break;
- case SWIG_BINARY:
- SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
- break;
- default:
- break;
- }
- SvREADONLY_on(sv);
- }
- ST(0) = &PL_sv_yes;
- XSRETURN(1);
+XS(SWIG_init) {
+ dXSARGS;
+ int i;
+ static int _init = 0;
+ if (!_init) {
+ for (i = 0; swig_types_initial[i]; i++) {
+ swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]);
+ }
+ _init = 1;
+ }
+
+ /* Install commands */
+ for (i = 0; swig_commands[i].name; i++) {
+ newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
+ }
+
+ /* Install variables */
+ for (i = 0; swig_variables[i].name; i++) {
+ SV *sv;
+ sv = perl_get_sv((char*) swig_variables[i].name, TRUE | 0x2);
+ if (swig_variables[i].type) {
+ SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+ } else {
+ sv_setiv(sv,(IV) 0);
+ }
+ swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get);
+ }
+
+ /* Install constant */
+ for (i = 0; swig_constants[i].type; i++) {
+ SV *sv;
+ sv = perl_get_sv((char*)swig_constants[i].name, TRUE | 0x2);
+ switch(swig_constants[i].type) {
+ case SWIG_INT:
+ sv_setiv(sv, (IV) swig_constants[i].lvalue);
+ break;
+ case SWIG_FLOAT:
+ sv_setnv(sv, (double) swig_constants[i].dvalue);
+ break;
+ case SWIG_STRING:
+ sv_setpv(sv, (char *) swig_constants[i].pvalue);
+ break;
+ case SWIG_POINTER:
+ SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+ break;
+ case SWIG_BINARY:
+ SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+ break;
+ default:
+ break;
+ }
+ SvREADONLY_on(sv);
+ }
+
+ ST(0) = &PL_sv_yes;
+ XSRETURN(1);
}
+
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Fri Apr 13 18:15:58 2007
@@ -81,7 +81,8 @@
typedef enum {
S_HUP = (1 << 0),
- S_FREE = (1 << 1)
+ S_FREE = (1 << 1),
+ S_RDLOCK = (1 << 2)
} session_flag_t;
struct input_callback_state {
@@ -2146,7 +2147,7 @@
}
jss->session = peer_session;
- jss->flags = 0;
+ jss->flags = S_RDLOCK;
*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
@@ -2177,6 +2178,10 @@
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
}
+ if (jss->session && switch_test_flag(jss, S_RDLOCK)) {
+ switch_core_session_rwunlock(jss->session);
+ }
+
if (switch_test_flag(jss, S_FREE)) {
free(jss);
}
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Fri Apr 13 18:15:58 2007
@@ -745,12 +745,12 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", switch_channel_get_name(channel));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", switch_core_session_get_uuid(channel->session));
- if ((codec = switch_core_session_get_read_codec(channel->session))) {
+ if ((codec = switch_core_session_get_read_codec(channel->session)) && codec->implementation) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Name", "%s", switch_str_nil(codec->implementation->iananame));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Rate", "%u", codec->implementation->samples_per_second);
}
- if ((codec = switch_core_session_get_write_codec(channel->session))) {
+ if ((codec = switch_core_session_get_write_codec(channel->session)) && codec->implementation) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", "%s", switch_str_nil(codec->implementation->iananame));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%u", codec->implementation->samples_per_second);
}
Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c (original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c Fri Apr 13 18:15:58 2007
@@ -34,16 +34,20 @@
/* Bridge Related Stuff*/
/*********************************************************************************/
-struct audio_bridge_data {
- switch_core_session_t *session_a;
- switch_core_session_t *session_b;
- int running;
+struct switch_ivr_bridge_data {
+ switch_core_session_t *session;
+ char *b_uuid;
+ int stream_id;
+ switch_input_callback_function_t input_callback;
+ void *session_data;
};
+typedef struct switch_ivr_bridge_data switch_ivr_bridge_data_t;
+
+
static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
{
- switch_core_thread_session_t *his_thread, *data = obj;
- int *stream_id_p;
+ switch_ivr_bridge_data_t *data = obj;
int stream_id = 0, pre_b = 0, ans_a = 0, ans_b = 0, originator = 0;
switch_input_callback_function_t input_callback;
switch_core_session_message_t *message, msg = { 0 };
@@ -53,19 +57,14 @@
switch_frame_t *read_frame;
switch_core_session_t *session_a, *session_b;
- assert(!thread || thread);
-
- session_a = data->objs[0];
- session_b = data->objs[1];
-
- stream_id_p = data->objs[2];
- input_callback = data->input_callback;
- user_data = data->objs[4];
- his_thread = data->objs[5];
-
- if (stream_id_p) {
- stream_id = *stream_id_p;
+ session_a = data->session;
+ if (!(session_b = switch_core_session_locate(data->b_uuid))) {
+ return NULL;
}
+
+ input_callback = data->input_callback;
+ user_data = data->session_data;
+ stream_id = data->stream_id;
chan_a = switch_core_session_get_channel(session_a);
chan_b = switch_core_session_get_channel(session_b);
@@ -75,8 +74,6 @@
pre_b = switch_channel_test_flag(chan_a, CF_EARLY_MEDIA);
ans_b = switch_channel_test_flag(chan_b, CF_ANSWERED);
}
- switch_core_session_read_lock(session_a);
- switch_core_session_read_lock(session_b);
switch_channel_set_flag(chan_a, CF_BRIDGED);
@@ -85,10 +82,6 @@
switch_status_t status;
switch_event_t *event;
- if (!(data->running > 0 && his_thread->running > 0)) {
- break;
- }
-
/* if you really want to make sure it's not ready, test it twice because it might be just a break */
if (!switch_channel_ready(chan_a) && !switch_channel_ready(chan_a)) {
break;
@@ -99,10 +92,6 @@
switch (b_state) {
case CS_HANGUP:
case CS_DONE:
- switch_mutex_lock(data->mutex);
- data->running = -1;
- switch_mutex_unlock(data->mutex);
- continue;
default:
break;
}
@@ -129,9 +118,6 @@
if (input_callback) {
if (input_callback(session_a, dtmf, SWITCH_INPUT_TYPE_DTMF, user_data, 0) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s ended call via DTMF\n", switch_channel_get_name(chan_a));
- switch_mutex_lock(data->mutex);
- data->running = -1;
- switch_mutex_unlock(data->mutex);
break;
}
}
@@ -186,49 +172,40 @@
if (switch_core_session_write_frame(session_b, read_frame, -1, stream_id) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "write: %s Bad Frame....[%u] Bubye!\n",
switch_channel_get_name(chan_b), read_frame->datalen);
- switch_mutex_lock(data->mutex);
- data->running = -1;
- switch_mutex_unlock(data->mutex);
+ break;
}
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "read: %s Bad Frame.... Bubye!\n", switch_channel_get_name(chan_a));
- switch_mutex_lock(data->mutex);
- data->running = -1;
- switch_mutex_unlock(data->mutex);
+ break;
}
}
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
-
+ msg.string_arg = data->b_uuid;
msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
msg.from = __FILE__;
switch_core_session_receive_message(session_a, &msg);
switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a));
-
switch_channel_clear_flag(chan_a, CF_BRIDGED);
- switch_mutex_lock(data->mutex);
- data->running = 0;
- switch_mutex_unlock(data->mutex);
-
- switch_core_session_rwunlock(session_a);
switch_core_session_rwunlock(session_b);
+
return NULL;
}
static switch_status_t audio_bridge_on_loopback(switch_core_session_t *session)
{
switch_channel_t *channel = NULL;
- void *arg;
+ switch_ivr_bridge_data_t *bd;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
- if ((arg = switch_channel_get_private(channel, "_bridge_"))) {
+ if ((bd = (switch_ivr_bridge_data_t *) switch_channel_get_private(channel, "_bridge_"))) {
switch_channel_set_private(channel, "_bridge_", NULL);
- audio_bridge_thread(NULL, (void *) arg);
+ audio_bridge_thread(NULL, (void *) bd);
} else {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
@@ -516,17 +493,16 @@
return SWITCH_STATUS_SUCCESS;
}
-
SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_session_t *session,
switch_core_session_t *peer_session,
switch_input_callback_function_t input_callback, void *session_data,
void *peer_session_data)
{
- switch_core_thread_session_t *this_audio_thread, *other_audio_thread;
+ switch_ivr_bridge_data_t *a_leg, *b_leg;
switch_channel_t *caller_channel, *peer_channel;
int stream_id = 0;
switch_status_t status = SWITCH_STATUS_SUCCESS;
-
+
caller_channel = switch_core_session_get_channel(session);
assert(caller_channel != NULL);
@@ -535,26 +511,20 @@
peer_channel = switch_core_session_get_channel(peer_session);
assert(peer_channel != NULL);
- other_audio_thread = switch_core_session_alloc(peer_session, sizeof(switch_core_thread_session_t));
- this_audio_thread = switch_core_session_alloc(peer_session, sizeof(switch_core_thread_session_t));
-
- other_audio_thread->objs[0] = session;
- other_audio_thread->objs[1] = peer_session;
- other_audio_thread->objs[2] = &stream_id;
- other_audio_thread->input_callback = input_callback;
- other_audio_thread->objs[4] = session_data;
- other_audio_thread->objs[5] = this_audio_thread;
- other_audio_thread->running = 5;
- switch_mutex_init(&other_audio_thread->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
-
- this_audio_thread->objs[0] = peer_session;
- this_audio_thread->objs[1] = session;
- this_audio_thread->objs[2] = &stream_id;
- this_audio_thread->input_callback = input_callback;
- this_audio_thread->objs[4] = peer_session_data;
- this_audio_thread->objs[5] = other_audio_thread;
- this_audio_thread->running = 2;
- switch_mutex_init(&this_audio_thread->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(peer_session));
+ a_leg = switch_core_session_alloc(session, sizeof(*a_leg));
+ b_leg = switch_core_session_alloc(peer_session, sizeof(*b_leg));
+
+ b_leg->session = peer_session;
+ b_leg->b_uuid = switch_core_session_strdup(peer_session, switch_core_session_get_uuid(session));
+ b_leg->stream_id = stream_id;
+ b_leg->input_callback = input_callback;
+ b_leg->session_data = session_data;
+
+ a_leg->session = session;
+ a_leg->b_uuid = switch_core_session_strdup(session, switch_core_session_get_uuid(peer_session));
+ b_leg->stream_id = stream_id;
+ b_leg->input_callback = input_callback;
+ b_leg->session_data = peer_session_data;
switch_channel_add_state_handler(peer_channel, &audio_bridge_peer_state_handlers);
@@ -579,54 +549,34 @@
msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE;
msg.from = __FILE__;
- msg.pointer_arg = session;
-
- switch_core_session_receive_message(peer_session, &msg);
+ msg.string_arg = switch_core_session_strdup(peer_session, switch_core_session_get_uuid(session));
- if (!msg.pointer_arg) {
+ if (switch_core_session_receive_message(peer_session, &msg) != SWITCH_STATUS_SUCCESS) {
status = SWITCH_STATUS_FALSE;
switch_core_session_rwunlock(peer_session);
goto done;
}
- msg.pointer_arg = peer_session;
- switch_core_session_receive_message(session, &msg);
-
- if (!msg.pointer_arg) {
+ msg.string_arg = switch_core_session_strdup(session, switch_core_session_get_uuid(peer_session));
+ if (switch_core_session_receive_message(session, &msg) != SWITCH_STATUS_SUCCESS) {
status = SWITCH_STATUS_FALSE;
switch_core_session_rwunlock(peer_session);
goto done;
}
- switch_channel_set_private(peer_channel, "_bridge_", other_audio_thread);
+ switch_channel_set_private(peer_channel, "_bridge_", b_leg);
switch_channel_set_state(peer_channel, CS_LOOPBACK);
- audio_bridge_thread(NULL, (void *) this_audio_thread);
+ audio_bridge_thread(NULL, (void *) a_leg);
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(caller_channel, event);
switch_event_fire(&event);
}
- this_audio_thread->objs[0] = NULL;
- this_audio_thread->objs[1] = NULL;
- this_audio_thread->objs[2] = NULL;
- this_audio_thread->input_callback = NULL;
- this_audio_thread->objs[4] = NULL;
- this_audio_thread->objs[5] = NULL;
- switch_mutex_lock(this_audio_thread->mutex);
- this_audio_thread->running = 0;
- switch_mutex_unlock(this_audio_thread->mutex);
-
switch_channel_clear_flag(caller_channel, CF_ORIGINATOR);
-
- if (other_audio_thread->running > 0) {
- switch_mutex_lock(other_audio_thread->mutex);
- other_audio_thread->running = -1;
- switch_mutex_unlock(other_audio_thread->mutex);
- while (other_audio_thread->running) {
- switch_yield(1000);
- }
+ while (switch_channel_get_state(peer_channel) == CS_LOOPBACK) {
+ switch_yield(1000);
}
switch_core_session_rwunlock(peer_session);
Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c (original)
+++ freeswitch/trunk/src/switch_ivr_originate.c Fri Apr 13 18:15:58 2007
@@ -156,7 +156,7 @@
static uint8_t check_channel_status(switch_channel_t **peer_channels,
switch_core_session_t **peer_sessions,
- uint32_t len, int32_t *idx, uint32_t * hups, char *file, char *key, uint8_t early_ok, uint8_t * ring_ready)
+ uint32_t len, int32_t *idx, uint32_t * hups, char *file, char *key, uint8_t early_ok, uint8_t *ring_ready)
{
uint32_t i;
@@ -901,9 +901,12 @@
if (!peer_channels[i]) {
continue;
}
+ if (status == SWITCH_STATUS_SUCCESS && bleg && *bleg && *bleg == peer_sessions[i]) {
+ continue;
+ }
switch_core_session_rwunlock(peer_sessions[i]);
}
-
+
if (status == SWITCH_STATUS_SUCCESS) {
goto outer_for;
}
@@ -912,5 +915,10 @@
outer_for:
switch_safe_free(loop_data);
switch_safe_free(odata);
+
+ if (bleg && status != SWITCH_STATUS_SUCCESS) {
+ *bleg = NULL;
+ }
+
return status;
}
Modified: freeswitch/trunk/src/switch_swig.c
==============================================================================
--- freeswitch/trunk/src/switch_swig.c (original)
+++ freeswitch/trunk/src/switch_swig.c Fri Apr 13 18:15:58 2007
@@ -246,6 +246,7 @@
return;
} else {
switch_ivr_multi_threaded_bridge(session, peer_session, NULL, NULL, NULL);
+ switch_core_session_rwunlock(peer_session);
}
1
0
[commit] r4925 - in freeswitch/trunk: scripts/socket/socket2me src src/include
by Freeswitch SVN 13 Apr '07
by Freeswitch SVN 13 Apr '07
13 Apr '07
Author: anthm
Date: Fri Apr 13 12:24:02 2007
New Revision: 4925
Modified:
freeswitch/trunk/scripts/socket/socket2me/socket2me.c
freeswitch/trunk/src/include/switch_ivr.h
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/switch_ivr.c
Log:
let unicast mode operate on the native codec if desired
Modified: freeswitch/trunk/scripts/socket/socket2me/socket2me.c
==============================================================================
--- freeswitch/trunk/scripts/socket/socket2me/socket2me.c (original)
+++ freeswitch/trunk/scripts/socket/socket2me/socket2me.c Fri Apr 13 12:24:02 2007
@@ -42,6 +42,7 @@
#include <unistd.h>
#include <spandsp.h>
+
#define SOCKET2ME_DEBUG 0
#define MAXPENDING 10000
#define RCVBUFSIZE 4198
@@ -178,7 +179,9 @@
fax_state_t fax;
char tmp[512], fn[512], *file_name = "/tmp/test.tiff";
int send_fax = FALSE;
-
+ int g711 = 0;
+ int pcmu = 0;
+
snprintf(sendbuf, sizeof(sendbuf), "connect\n\n");
send(client_socket, sendbuf, strlen(sendbuf), 0);
@@ -189,17 +192,32 @@
#if SOCKET2ME_DEBUG
printf("READ [%s]\n", infobuf);
#endif
+
+ if (cheezy_get_var(infobuf, "Channel-Read-Codec-Name", tmp, sizeof(tmp))) {
+ if (!strcasecmp(tmp, "pcmu")) {
+ g711 = 1;
+ pcmu = 1;
+ } else if (!strcasecmp(tmp, "pcma")) {
+ g711 = 1;
+ }
+ }
+
+
snprintf(sendbuf, sizeof(sendbuf), "sendmsg\n"
"call-command: unicast\n"
"local_ip: %s\n"
"local_port: %d\n"
"remote_ip: %s\n"
"remote_port: %d\n"
- "transport: udp\n\n",
+ "transport: udp\n"
+ "%s"
+ "\n",
local_ip, local_port,
- remote_ip, remote_port
+ remote_ip, remote_port,
+ g711 ? "flags: native\n" : ""
);
+
if (cheezy_get_var(infobuf, "variable_fax_file_name", fn, sizeof(fn))) {
file_name = fn;
}
@@ -267,8 +285,9 @@
for (;;) {
struct sockaddr_in local_addr = {0};
int cliAddrLen = sizeof(local_addr);
- short audioBuffer[1024], outbuf[1024];
- int tx, bigger;
+ unsigned char audiobuf[1024], rawbuf[1024], outbuf[1024];
+ short *usebuf = NULL;
+ int tx, tx_bytes, bigger, sample_count;
fd_set ready;
FD_ZERO(&ready);
@@ -297,23 +316,62 @@
continue;
}
- if ((read_bytes = recvfrom(usock, audioBuffer, sizeof(audioBuffer), 0, (struct sockaddr *) &local_addr, &cliAddrLen)) < 0) {
+ if ((read_bytes = recvfrom(usock, audiobuf, sizeof(audiobuf), 0, (struct sockaddr *) &local_addr, &cliAddrLen)) < 0) {
die("recvfrom() failed");
}
- fax_rx(&fax, (int16_t *)audioBuffer, read_bytes / 2);
+ if (g711) {
+ int i;
+ short *rp = (short *) rawbuf;
+
+ for (i = 0; i < read_bytes; i++) {
+ if (pcmu) {
+ rp[i] = ulaw_to_linear(audiobuf[i]);
+ } else {
+ rp[i] = alaw_to_linear(audiobuf[i]);
+ }
+ }
+ usebuf = rp;
+ sample_count = read_bytes;
+ } else {
+ usebuf = (short *) audiobuf;
+ sample_count = read_bytes / 2;
+ }
+
+ fax_rx(&fax, usebuf, sample_count);
#if SOCKET2ME_DEBUG
printf("Handling client %s:%d %d bytes\n", inet_ntoa(local_addr.sin_addr), ntohs(local_addr.sin_port), read_bytes);
#endif
- if ((tx = fax_tx(&fax, (int16_t *) &outbuf, read_bytes / 2)) < 0) {
+
+
+ if ((tx = fax_tx(&fax, (short *)outbuf, sample_count)) < 0) {
printf("Fax Error\n");
break;
} else if (!tx) {
continue;
}
+
+ if (g711) {
+ int i;
+ short *bp = (short *) outbuf;
+ for (i = 0; i < tx; i++) {
+ if (pcmu) {
+ rawbuf[i] = linear_to_ulaw(bp[i]);
+ } else {
+ rawbuf[i] = linear_to_alaw(bp[i]);
+ }
+ }
+ usebuf = (short *) rawbuf;
+ tx_bytes = tx;
+ } else {
+ usebuf = (short *)outbuf;
+ tx_bytes = tx * 2;
+ }
+
+
cliAddrLen = sizeof(sendaddr);
- if (sendto(usock, outbuf, tx * 2, 0, (struct sockaddr *) &sendaddr, sizeof(sendaddr)) != tx * 2) {
+ if (sendto(usock, usebuf, tx_bytes, 0, (struct sockaddr *) &sendaddr, sizeof(sendaddr)) != sample_count) {
die("sendto() sent a different number of bytes than expected");
}
}
Modified: freeswitch/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_ivr.h (original)
+++ freeswitch/trunk/src/include/switch_ivr.h Fri Apr 13 12:24:02 2007
@@ -78,7 +78,8 @@
switch_port_t local_port,
char *remote_ip,
switch_port_t remote_port,
- char *transport);
+ char *transport,
+ char *flags);
/*!
\brief Generate an XML CDR report.
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Fri Apr 13 12:24:02 2007
@@ -121,7 +121,8 @@
typedef enum {
SUF_NONE = 0,
SUF_THREAD_RUNNING = (1 << 0),
- SUF_READY = (1 << 1)
+ SUF_READY = (1 << 1),
+ SUF_NATIVE = (1 << 2)
} switch_unicast_flag_t;
typedef enum {
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Fri Apr 13 12:24:02 2007
@@ -140,7 +140,9 @@
break;
}
}
- switch_core_codec_destroy(&conninfo->read_codec);
+ if (conninfo->read_codec.implementation) {
+ switch_core_codec_destroy(&conninfo->read_codec);
+ }
switch_socket_close(conninfo->socket);
}
switch_channel_clear_flag(channel, CF_UNICAST);
@@ -156,7 +158,8 @@
switch_port_t local_port,
char *remote_ip,
switch_port_t remote_port,
- char *transport)
+ char *transport,
+ char *flags)
{
switch_channel_t *channel;
switch_unicast_conninfo_t *conninfo;
@@ -186,29 +189,37 @@
goto fail;
}
+ if (flags) {
+ if (strstr(flags, "native")) {
+ switch_set_flag(conninfo, SUF_NATIVE);
+ }
+ }
+
switch_mutex_init(&conninfo->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
read_codec = switch_core_session_get_read_codec(session);
- if (switch_core_codec_init(&conninfo->read_codec,
- "L16",
- NULL,
- read_codec->implementation->samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000,
- 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
- NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
- "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
- read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
- read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
- goto fail;
+ if (!switch_test_flag(conninfo, SUF_NATIVE)) {
+ if (switch_core_codec_init(&conninfo->read_codec,
+ "L16",
+ NULL,
+ read_codec->implementation->samples_per_second,
+ read_codec->implementation->microseconds_per_frame / 1000,
+ 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+ NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+ "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
+ read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
+ read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
+ goto fail;
+ }
}
conninfo->write_frame.data = conninfo->write_frame_data;
conninfo->write_frame.buflen = sizeof(conninfo->write_frame_data);
- conninfo->write_frame.codec = &conninfo->read_codec;
+ conninfo->write_frame.codec = switch_test_flag(conninfo, SUF_NATIVE) ? read_codec : &conninfo->read_codec;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "connect %s:%d->%s:%d\n",
@@ -307,6 +318,7 @@
char *remote_ip = switch_event_get_header(event, "remote_ip");
char *remote_port = switch_event_get_header(event, "remote_port");
char *transport = switch_event_get_header(event, "transport");
+ char *flags = switch_event_get_header(event, "flags");
if (switch_strlen_zero(local_ip)) {
local_ip = "127.0.0.1";
@@ -324,7 +336,7 @@
transport = "udp";
}
- switch_ivr_activate_unicast(session, local_ip, (switch_port_t)atoi(local_port), remote_ip, (switch_port_t)atoi(remote_port), transport);
+ switch_ivr_activate_unicast(session, local_ip, (switch_port_t)atoi(local_port), remote_ip, (switch_port_t)atoi(remote_port), transport, flags);
} else if (cmd_hash == CMD_HANGUP) {
char *cause_name = switch_event_get_header(event, "hangup-cause");
@@ -383,9 +395,9 @@
unicast_thread_launch(conninfo);
}
}
-
+
if (conninfo) {
- switch_size_t len;
+ switch_size_t len = 0;
uint32_t flags = 0;
switch_byte_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE];
uint32_t rate = read_codec->implementation->samples_per_second;
@@ -400,14 +412,17 @@
sendbuf = decoded;
status = SWITCH_STATUS_SUCCESS;
} else {
-
- status = switch_core_codec_decode(
- read_codec,
- &conninfo->read_codec,
- read_frame->data,
- read_frame->datalen,
- read_codec->implementation->samples_per_second,
- decoded, &dlen, &rate, &flags);
+ if (switch_test_flag(conninfo, SUF_NATIVE)) {
+ status = SWITCH_STATUS_NOOP;
+ } else {
+ status = switch_core_codec_decode(
+ read_codec,
+ &conninfo->read_codec,
+ read_frame->data,
+ read_frame->datalen,
+ read_codec->implementation->samples_per_second,
+ decoded, &dlen, &rate, &flags);
+ }
switch (status) {
case SWITCH_STATUS_NOOP:
case SWITCH_STATUS_BREAK:
@@ -435,7 +450,7 @@
}
}
}
-
+
if (switch_core_session_dequeue_private_event(session, &event) == SWITCH_STATUS_SUCCESS) {
switch_ivr_parse_event(session, event);
switch_channel_event_set_data(switch_core_session_get_channel(session), event);
1
0
Author: mikej
Date: Fri Apr 13 10:44:28 2007
New Revision: 4924
Added:
freeswitch/branches/mikej/sofiasip-upgrade/build/config/libcurl.m4
- copied unchanged from r4923, /freeswitch/trunk/build/config/libcurl.m4
freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/socket2me/
- copied from r4923, /freeswitch/trunk/scripts/socket/socket2me/
freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/socket2me/Makefile
- copied unchanged from r4923, /freeswitch/trunk/scripts/socket/socket2me/Makefile
freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/socket2me/README
- copied unchanged from r4923, /freeswitch/trunk/scripts/socket/socket2me/README
freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/socket2me/socket2me.c
- copied unchanged from r4923, /freeswitch/trunk/scripts/socket/socket2me/socket2me.c
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/lib_api.c
- copied unchanged from r4923, /freeswitch/trunk/src/mod/endpoints/mod_wanpipe/lib_api.c
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/testapp.c
- copied unchanged from r4923, /freeswitch/trunk/src/mod/endpoints/mod_wanpipe/testapp.c
Removed:
freeswitch/branches/mikej/sofiasip-upgrade/libs/apr/include/arch/unix/apr_private.h.in
freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/docs/
freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/tests/
Modified:
freeswitch/branches/mikej/sofiasip-upgrade/acinclude.m4
freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build-outputs.mk
freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build.conf
freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/configure.in
freeswitch/branches/mikej/sofiasip-upgrade/libs/apr/include/arch/unix/ (props changed)
freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/ (props changed)
freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/Makefile.am
freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/configure.ac
freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/lib/config.h.in
freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.am
freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.inc
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/Makefile.in
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/Makefile.in
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prfdcach.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/pripv6.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prlog.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/Makefile.in
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/prmem.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/Makefile.in
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/objs.mk
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/memory/Makefile.in
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/Makefile.in
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/prinit.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/Makefile.in
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptio.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptthread.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/Makefile.in
freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/prcthr.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/udns/udns_resolver.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/win32/js/js.vcproj
freeswitch/branches/mikej/sofiasip-upgrade/libs/xmlrpc-c/src/Makefile
freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/FreeSWITCH/Client.pm
freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_core_db.h
freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_ivr.h
freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_types.h
freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_utils.h
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/Makefile.am
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_enum/Makefile
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.h
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/Makefile
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.c
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.h
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/basecdr.cpp
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/cdrcontainer.cpp
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/csvcdr.cpp
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/curlcdr.cpp
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/mod_cdr.cpp
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/odbccdr.cpp
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/pddcdr.cpp
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/sqlitecdr.cpp
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/xmlcdr.cpp
freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
freeswitch/branches/mikej/sofiasip-upgrade/src/switch_core_db.c
freeswitch/branches/mikej/sofiasip-upgrade/src/switch_core_session.c
freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr.c
Log:
merged changes from trunk revisions 4899-4923.
Modified: freeswitch/branches/mikej/sofiasip-upgrade/acinclude.m4
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/acinclude.m4 (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/acinclude.m4 Fri Apr 13 10:44:28 2007
@@ -6,4 +6,4 @@
m4_include([build/config/ac_gcc_x86_cpuid.m4])
m4_include([build/config/ax_lib_mysql.m4])
m4_include([libs/apr/build/apr_common.m4])
-m4_include([libs/curl/docs/libcurl/libcurl.m4])
+m4_include([build/config/libcurl.m4])
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build-outputs.mk
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build-outputs.mk (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build-outputs.mk Fri Apr 13 10:44:28 2007
@@ -38,7 +38,6 @@
misc/apu_version.lo: misc/apu_version.c .make.dirs include/apu_version.h
misc/apr_queue.lo: misc/apr_queue.c .make.dirs include/apr_queue.h
uri/apr_uri.lo: uri/apr_uri.c .make.dirs include/apr_uri.h
-xml/apr_xml.lo: xml/apr_xml.c .make.dirs include/apr_xml.h include/apr_xlate.h
strmatch/apr_strmatch.lo: strmatch/apr_strmatch.c .make.dirs include/apr_strmatch.h
xlate/xlate.lo: xlate/xlate.c .make.dirs include/apr_xlate.h
dbd/apr_dbd_sqlite2.lo: dbd/apr_dbd_sqlite2.c .make.dirs
@@ -46,7 +45,7 @@
dbd/apr_dbd.lo: dbd/apr_dbd.c .make.dirs include/apr_dbd.h
dbd/apr_dbd_sqlite3.lo: dbd/apr_dbd_sqlite3.c .make.dirs
-OBJECTS_all = buckets/apr_buckets_file.lo buckets/apr_brigade.lo buckets/apr_buckets_mmap.lo buckets/apr_buckets_heap.lo buckets/apr_buckets.lo buckets/apr_buckets_socket.lo buckets/apr_buckets_pool.lo buckets/apr_buckets_alloc.lo buckets/apr_buckets_pipe.lo buckets/apr_buckets_eos.lo buckets/apr_buckets_flush.lo buckets/apr_buckets_refcount.lo buckets/apr_buckets_simple.lo crypto/apr_md5.lo crypto/uuid.lo crypto/apr_sha1.lo crypto/getuuid.lo crypto/apr_md4.lo dbm/apr_dbm_berkeleydb.lo dbm/apr_dbm_gdbm.lo dbm/apr_dbm_ndbm.lo dbm/apr_dbm.lo dbm/apr_dbm_sdbm.lo dbm/sdbm/sdbm_hash.lo dbm/sdbm/sdbm.lo dbm/sdbm/sdbm_lock.lo dbm/sdbm/sdbm_pair.lo encoding/apr_base64.lo hooks/apr_hooks.lo ldap/apr_ldap_option.lo ldap/apr_ldap_init.lo ldap/apr_ldap_url.lo misc/apr_reslist.lo misc/apr_rmm.lo misc/apr_date.lo misc/apu_version.lo misc/apr_queue.lo uri/apr_uri.lo xml/apr_xml.lo strmatch/apr_strmatch.lo xlate/xlate.lo dbd/apr_dbd_sqlite2.lo dbd/apr_dbd_pgsql.lo dbd/apr_dbd.lo dbd/apr_dbd_sqlite3.lo
+OBJECTS_all = buckets/apr_buckets_file.lo buckets/apr_brigade.lo buckets/apr_buckets_mmap.lo buckets/apr_buckets_heap.lo buckets/apr_buckets.lo buckets/apr_buckets_socket.lo buckets/apr_buckets_pool.lo buckets/apr_buckets_alloc.lo buckets/apr_buckets_pipe.lo buckets/apr_buckets_eos.lo buckets/apr_buckets_flush.lo buckets/apr_buckets_refcount.lo buckets/apr_buckets_simple.lo crypto/apr_md5.lo crypto/uuid.lo crypto/apr_sha1.lo crypto/getuuid.lo crypto/apr_md4.lo dbm/apr_dbm_berkeleydb.lo dbm/apr_dbm_gdbm.lo dbm/apr_dbm_ndbm.lo dbm/apr_dbm.lo dbm/apr_dbm_sdbm.lo dbm/sdbm/sdbm_hash.lo dbm/sdbm/sdbm.lo dbm/sdbm/sdbm_lock.lo dbm/sdbm/sdbm_pair.lo encoding/apr_base64.lo hooks/apr_hooks.lo ldap/apr_ldap_option.lo ldap/apr_ldap_init.lo ldap/apr_ldap_url.lo misc/apr_reslist.lo misc/apr_rmm.lo misc/apr_date.lo misc/apu_version.lo misc/apr_queue.lo uri/apr_uri.lo strmatch/apr_strmatch.lo xlate/xlate.lo dbd/apr_dbd_sqlite2.lo dbd/apr_dbd_pgsql.lo dbd/apr_dbd.lo dbd/apr_dbd_sqlite3.lo
OBJECTS_unix = $(OBJECTS_all)
@@ -58,11 +57,11 @@
OBJECTS_os390 = $(OBJECTS_all)
-HEADERS = $(top_srcdir)/include/apr_optional.h $(top_srcdir)/include/apu_version.h $(top_srcdir)/include/apr_dbm.h $(top_srcdir)/include/apr_strmatch.h $(top_srcdir)/include/apr_buckets.h $(top_srcdir)/include/apr_optional_hooks.h $(top_srcdir)/include/apr_sdbm.h $(top_srcdir)/include/apr_md4.h $(top_srcdir)/include/apr_reslist.h $(top_srcdir)/include/apr_base64.h $(top_srcdir)/include/apr_ldap_option.h $(top_srcdir)/include/apr_xml.h $(top_srcdir)/include/apr_anylock.h $(top_srcdir)/include/apr_rmm.h $(top_srcdir)/include/apr_ldap_init.h $(top_srcdir)/include/apr_ldap_url.h $(top_srcdir)/include/apr_md5.h $(top_srcdir)/include/apr_date.h $(top_srcdir)/include/apr_hooks.h $(top_srcdir)/include/apr_xlate.h $(top_srcdir)/include/apr_queue.h $(top_srcdir)/include/apr_uri.h $(top_srcdir)/include/apr_uuid.h $(top_srcdir)/include/apr_sha1.h $(top_srcdir)/include/apr_dbd.h
+HEADERS = $(top_srcdir)/include/apr_optional.h $(top_srcdir)/include/apu_version.h $(top_srcdir)/include/apr_dbm.h $(top_srcdir)/include/apr_strmatch.h $(top_srcdir)/include/apr_buckets.h $(top_srcdir)/include/apr_optional_hooks.h $(top_srcdir)/include/apr_sdbm.h $(top_srcdir)/include/apr_md4.h $(top_srcdir)/include/apr_reslist.h $(top_srcdir)/include/apr_base64.h $(top_srcdir)/include/apr_ldap_option.h $(top_srcdir)/include/apr_anylock.h $(top_srcdir)/include/apr_rmm.h $(top_srcdir)/include/apr_ldap_init.h $(top_srcdir)/include/apr_ldap_url.h $(top_srcdir)/include/apr_md5.h $(top_srcdir)/include/apr_date.h $(top_srcdir)/include/apr_hooks.h $(top_srcdir)/include/apr_xlate.h $(top_srcdir)/include/apr_queue.h $(top_srcdir)/include/apr_uri.h $(top_srcdir)/include/apr_uuid.h $(top_srcdir)/include/apr_sha1.h $(top_srcdir)/include/apr_dbd.h
-SOURCE_DIRS = xml dbd dbm encoding hooks buckets misc crypto uri strmatch dbm/sdbm ldap xlate $(EXTRA_SOURCE_DIRS)
+SOURCE_DIRS = dbd dbm encoding hooks buckets misc crypto uri strmatch dbm/sdbm ldap xlate $(EXTRA_SOURCE_DIRS)
-BUILD_DIRS = buckets crypto dbd dbm dbm/sdbm encoding hooks ldap misc strmatch uri xlate xml
+BUILD_DIRS = buckets crypto dbd dbm dbm/sdbm encoding hooks ldap misc strmatch uri xlate
.make.dirs: $(srcdir)/build-outputs.mk
@for d in $(BUILD_DIRS); do test -d $$d || mkdir $$d; done
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build.conf
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build.conf (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/build.conf Fri Apr 13 10:44:28 2007
@@ -15,10 +15,10 @@
ldap/*.c
misc/*.c
uri/apr_uri.c
- xml/*.c
strmatch/*.c
xlate/*.c
dbd/*.c
+# xml/*.c
# we have no platform-specific subdirs
platform_dirs =
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/configure.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/configure.in (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/apr-util/configure.in Fri Apr 13 10:44:28 2007
@@ -122,7 +122,7 @@
APU_CHECK_DBD_MYSQL
APU_CHECK_DBD_SQLITE3
APU_CHECK_DBD_SQLITE2
-APU_FIND_EXPAT
+#APU_FIND_EXPAT
APU_FIND_ICONV
AC_SEARCH_LIBS(crypt, crypt ufc)
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/Makefile.am
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/Makefile.am (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/Makefile.am Fri Apr 13 10:44:28 2007
@@ -29,13 +29,12 @@
bin_SCRIPTS = curl-config
SUBDIRS = lib src
-DIST_SUBDIRS = $(SUBDIRS) tests include packages docs
+DIST_SUBDIRS = $(SUBDIRS) include packages
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libcurl.pc
dist-hook:
- rm -rf $(top_builddir)/tests/log
find $(distdir) -name "*.dist" -exec rm {} \;
(distit=`find $(srcdir) -name "*.dist"`; \
for file in $$distit; do \
@@ -43,88 +42,11 @@
cp $$file $(distdir)$$strip; \
done)
-html:
- cd docs; make html
-
-pdf:
- cd docs; make pdf
-
-check: test
-
-if CROSSCOMPILING
-test-full: test
-test-torture: test
-
-test:
- @echo "NOTICE: we can't run the tests when cross-compiling!"
-
-else
-
-test:
- @(cd tests; $(MAKE) all quiet-test)
-
-test-full:
- @(cd tests; $(MAKE) all full-test)
-
-test-torture:
- @(cd tests; $(MAKE) all torture-test)
-
-endif
-
-#
-# Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros
-# must contain the following line:
-# %_topdir /home/loic/local/rpm
-# and that /home/loic/local/rpm contains the directory SOURCES, BUILD etc.
-#
-# cd /home/loic/local/rpm ; mkdir -p SOURCES BUILD RPMS/i386 SPECS SRPMS
-#
-# If additional configure flags are needed to build the package, add the
-# following in ~/.rpmmacros
-# %configure CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix} ${AM_CONFIGFLAGS}
-# and run make rpm in the following way:
-# AM_CONFIGFLAGS='--with-uri=/home/users/loic/local/RedHat-6.2' make rpm
-#
-
-rpms:
- $(MAKE) RPMDIST=curl rpm
- $(MAKE) RPMDIST=curl-ssl rpm
-
-rpm:
- RPM_TOPDIR=`rpm --showrc | $(PERL) -n -e 'print if(s/.*_topdir\s+(.*)/$$1/)'` ; \
- cp $(srcdir)/packages/Linux/RPM/$(RPMDIST).spec $$RPM_TOPDIR/SPECS ; \
- cp $(PACKAGE)-$(VERSION).tar.gz $$RPM_TOPDIR/SOURCES ; \
- rpm -ba --clean --rmsource $$RPM_TOPDIR/SPECS/$(RPMDIST).spec ; \
- mv $$RPM_TOPDIR/RPMS/i386/$(RPMDIST)-*.rpm . ; \
- mv $$RPM_TOPDIR/SRPMS/$(RPMDIST)-*.src.rpm .
-
-#
-# Build a Solaris pkkgadd format file
-# run 'make pkgadd' once you've done './configure' and 'make' to make a Solaris pkgadd format
-# file (which ends up back in this directory).
-# The pkgadd file is in 'pkgtrans' format, so to install on Solaris, do
-# pkgadd -d ./HAXXcurl-*
-#
-
-# gak - libtool requires an absoulte directory, hence the pwd below...
-pkgadd:
- umask 022 ; \
- make install DESTDIR=`/bin/pwd`/packages/Solaris/root ; \
- cat COPYING > $(srcdir)/packages/Solaris/copyright ; \
- cd $(srcdir)/packages/Solaris && $(MAKE) package
-
-#
-# Build a cygwin binary tarball installation file
-# resulting .tar.bz2 file will end up at packages/Win32/cygwin
-cygwinbin:
- $(MAKE) -C packages/Win32/cygwin cygwinbin
-
# We extend the standard install with a custom hook:
install-data-hook:
cd include && $(MAKE) install
- cd docs && $(MAKE) install
# We extend the standard uninstall with a custom hook:
uninstall-hook:
cd include && $(MAKE) uninstall
- cd docs && $(MAKE) uninstall
+
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/configure.ac
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/configure.ac (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/configure.ac Fri Apr 13 10:44:28 2007
@@ -34,7 +34,7 @@
AC_CONFIG_SRCDIR([lib/urldata.h])
AM_CONFIG_HEADER(lib/config.h src/config.h)
-AM_MAINTAINER_MODE
+#AM_MAINTAINER_MODE
dnl SED is needed by some of the tools
AC_PATH_PROG( SED, sed, sed-was-not-found-by-configure,
@@ -2038,17 +2038,10 @@
AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
AC_CONFIG_FILES([Makefile \
- docs/Makefile \
- docs/examples/Makefile \
- docs/libcurl/Makefile \
include/Makefile \
include/curl/Makefile \
src/Makefile \
lib/Makefile \
- tests/Makefile \
- tests/data/Makefile \
- tests/server/Makefile \
- tests/libtest/Makefile \
packages/Makefile \
packages/Win32/Makefile \
packages/Win32/cygwin/Makefile \
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/lib/config.h.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/lib/config.h.in (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/lib/config.h.in Fri Apr 13 10:44:28 2007
@@ -621,16 +621,16 @@
/* Define to the function return type for send. */
#undef SEND_TYPE_RETV
-/* The size of `curl_off_t', as computed by sizeof. */
+/* The size of a `curl_off_t', as computed by sizeof. */
#undef SIZEOF_CURL_OFF_T
-/* The size of `long', as computed by sizeof. */
+/* The size of a `long', as computed by sizeof. */
#undef SIZEOF_LONG
-/* The size of `size_t', as computed by sizeof. */
+/* The size of a `size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T
-/* The size of `time_t', as computed by sizeof. */
+/* The size of a `time_t', as computed by sizeof. */
#undef SIZEOF_TIME_T
/* Define to 1 if you have the ANSI C header files. */
@@ -685,7 +685,7 @@
/* type to use in place of in_addr_t if not defined */
#undef in_addr_t
-/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t
/* type to use in place of socklen_t if not defined */
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.am
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.am (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.am Fri Apr 13 10:44:28 2007
@@ -33,50 +33,11 @@
-I$(top_srcdir)/lib \
-I$(top_srcdir)/src
-bin_PROGRAMS = curl
-
include Makefile.inc
-curl_LDADD = ../lib/libcurl.la
-curl_DEPENDENCIES = ../lib/libcurl.la
-BUILT_SOURCES = hugehelp.c
-CLEANFILES = hugehelp.c
-NROFF=@NROFF@ @MANOPT@ # figured out by the configure script
-
EXTRA_DIST = mkhelp.pl makefile.dj Makefile.vc6 Makefile.b32 Makefile.m32 \
Makefile.riscos config.h.in macos/curl.mcp.xml.sit.hqx \
macos/MACINSTALL.TXT macos/src/curl_GUSIConfig.cpp \
macos/src/macos_main.cpp config-amigaos.h makefile.amiga curl.rc \
Makefile.netware Makefile.inc Makefile.Watcom
-MANPAGE=$(top_srcdir)/docs/curl.1
-README=$(top_srcdir)/docs/MANUAL
-MKHELP=$(top_srcdir)/src/mkhelp.pl
-HUGE=hugehelp.c
-
-if USE_MANUAL
-# Here are the stuff to create a built-in manual
-
-if HAVE_LIBZ
-# This generates the hugehelp.c file in both uncompressed and compressed formats
-$(HUGE): $(README) $(MANPAGE) mkhelp.pl
- echo '#include "setup.h"' > $(HUGE)
- echo '#ifndef HAVE_LIBZ' >> $(HUGE)
- $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE)
- echo '#else' >> $(HUGE)
- $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) -c $(README) >> $(HUGE)
- echo '#endif /* HAVE_LIBZ */' >> $(HUGE)
-else # HAVE_LIBZ
-# This generates the hugehelp.c file uncompressed only
-$(HUGE): $(README) $(MANPAGE) mkhelp.pl
- echo '#include "setup.h"' > $(HUGE)
- $(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) $(README) >> $(HUGE)
-endif
-
-else # USE_MANUAL
-# built-in manual has been disabled, make a blank file
-$(HUGE):
- echo "/* built-in manual is disabled, blank function */" > $(HUGE)
- echo '#include "hugehelp.h"' >> $(HUGE)
- echo "void hugehelp(void) {}" >>$(HUGE)
-endif
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.inc
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.inc (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/curl/src/Makefile.inc Fri Apr 13 10:44:28 2007
@@ -5,13 +5,13 @@
CURLX_ONES = $(top_srcdir)/lib/strtoofft.c $(top_srcdir)/lib/timeval.c \
$(top_srcdir)/lib/strdup.c
-CURL_SOURCES = main.c hugehelp.c urlglob.c writeout.c writeenv.c \
- getpass.c homedir.c
+#CURL_SOURCES = main.c hugehelp.c urlglob.c writeout.c writeenv.c \
+# getpass.c homedir.c
CURL_HFILES = hugehelp.h setup.h config-win32.h config-mac.h \
config-riscos.h urlglob.h version.h \
writeout.h writeenv.h getpass.h homedir.h
-curl_SOURCES = $(CURL_SOURCES) $(CURLX_ONES) $(CURL_HFILES)
+#curl_SOURCES = $(CURL_SOURCES) $(CURLX_ONES) $(CURL_HFILES)
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/Makefile.in (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/Makefile.in Fri Apr 13 10:44:28 2007
@@ -46,7 +46,7 @@
include $(topsrcdir)/config/config.mk
-DIRS = io linking malloc md memory misc threads
+DIRS = io malloc md memory misc threads
# For VAC++ 4 geticcdata rule in config/OS2.mk
ifeq ($(MOZ_OS2_TOOLS),VACPP)
@@ -62,7 +62,7 @@
endif
ifeq ($(USE_CPLUS), 1)
- DIRS += cplus
+# DIRS += cplus
endif
#
@@ -222,50 +222,29 @@
$(OBJDIR)/prvrsion.$(OBJ_SUFFIX) \
io/$(OBJDIR)/prfdcach.$(OBJ_SUFFIX) \
io/$(OBJDIR)/prmwait.$(OBJ_SUFFIX) \
- io/$(OBJDIR)/prmapopt.$(OBJ_SUFFIX) \
io/$(OBJDIR)/priometh.$(OBJ_SUFFIX) \
- io/$(OBJDIR)/pripv6.$(OBJ_SUFFIX) \
+ io/$(OBJDIR)/prmapopt.$(OBJ_SUFFIX) \
io/$(OBJDIR)/prlayer.$(OBJ_SUFFIX) \
io/$(OBJDIR)/prlog.$(OBJ_SUFFIX) \
io/$(OBJDIR)/prmmap.$(OBJ_SUFFIX) \
- io/$(OBJDIR)/prpolevt.$(OBJ_SUFFIX) \
+ io/$(OBJDIR)/pripv6.$(OBJ_SUFFIX) \
io/$(OBJDIR)/prprf.$(OBJ_SUFFIX) \
- io/$(OBJDIR)/prscanf.$(OBJ_SUFFIX) \
- io/$(OBJDIR)/prstdio.$(OBJ_SUFFIX) \
- threads/$(OBJDIR)/prcmon.$(OBJ_SUFFIX) \
- threads/$(OBJDIR)/prrwlock.$(OBJ_SUFFIX) \
threads/$(OBJDIR)/prtpd.$(OBJ_SUFFIX) \
- linking/$(OBJDIR)/prlink.$(OBJ_SUFFIX) \
malloc/$(OBJDIR)/prmem.$(OBJ_SUFFIX) \
md/$(OBJDIR)/prosdep.$(OBJ_SUFFIX) \
- memory/$(OBJDIR)/prshm.$(OBJ_SUFFIX) \
- memory/$(OBJDIR)/prshma.$(OBJ_SUFFIX) \
memory/$(OBJDIR)/prseg.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/pralarm.$(OBJ_SUFFIX) \
+ misc/$(OBJDIR)/prnetdb.$(OBJ_SUFFIX) \
misc/$(OBJDIR)/pratom.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/prcountr.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/prdtoa.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/prenv.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/prerr.$(OBJ_SUFFIX) \
misc/$(OBJDIR)/prerror.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/prerrortable.$(OBJ_SUFFIX) \
misc/$(OBJDIR)/prinit.$(OBJ_SUFFIX) \
+ misc/$(OBJDIR)/pripc.$(OBJ_SUFFIX) \
misc/$(OBJDIR)/prinrval.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/pripc.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/prlog2.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/prlong.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/prnetdb.$(OBJ_SUFFIX) \
misc/$(OBJDIR)/prolock.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/prrng.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/prsystem.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/prthinfo.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/prtpool.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/prtrace.$(OBJ_SUFFIX) \
misc/$(OBJDIR)/prtime.$(OBJ_SUFFIX)
# ilib now rejects empty objects
ifneq ($(MOZ_OS2_TOOLS),VACPP)
-OBJS += malloc/$(OBJDIR)/prmalloc.$(OBJ_SUFFIX)
+#OBJS += malloc/$(OBJDIR)/prmalloc.$(OBJ_SUFFIX)
endif
ifdef USE_PTHREADS
@@ -278,16 +257,12 @@
OBJS += \
io/$(OBJDIR)/prdir.$(OBJ_SUFFIX) \
io/$(OBJDIR)/prfile.$(OBJ_SUFFIX) \
- io/$(OBJDIR)/prio.$(OBJ_SUFFIX) \
- io/$(OBJDIR)/prsocket.$(OBJ_SUFFIX) \
- misc/$(OBJDIR)/pripcsem.$(OBJ_SUFFIX)
+ io/$(OBJDIR)/prio.$(OBJ_SUFFIX)
+
ifndef USE_BTHREADS
OBJS += \
threads/$(OBJDIR)/prcthr.$(OBJ_SUFFIX) \
- threads/$(OBJDIR)/prdump.$(OBJ_SUFFIX) \
- threads/$(OBJDIR)/prmon.$(OBJ_SUFFIX) \
- threads/$(OBJDIR)/prsem.$(OBJ_SUFFIX) \
threads/combined/$(OBJDIR)/prucpu.$(OBJ_SUFFIX) \
threads/combined/$(OBJDIR)/prucv.$(OBJ_SUFFIX) \
threads/combined/$(OBJDIR)/prulock.$(OBJ_SUFFIX) \
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/Makefile.in (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/Makefile.in Fri Apr 13 10:44:28 2007
@@ -58,14 +58,11 @@
prmwait.c \
priometh.c \
pripv6.c \
- prmapopt.c \
+ prmapopt.c \
prlayer.c \
prlog.c \
prmmap.c \
- prpolevt.c \
prprf.c \
- prscanf.c \
- prstdio.c \
$(NULL)
ifndef USE_PTHREADS
@@ -73,7 +70,6 @@
prdir.c \
prfile.c \
prio.c \
- prsocket.c \
$(NULL)
endif
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prfdcach.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prfdcach.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prfdcach.c Fri Apr 13 10:44:28 2007
@@ -259,8 +259,8 @@
** be overridden at runtime using environment variables
** or a super-wiz-bang API.
*/
- const char *low = PR_GetEnv("NSPR_FD_CACHE_SIZE_LOW");
- const char *high = PR_GetEnv("NSPR_FD_CACHE_SIZE_HIGH");
+ //const char *low = PR_GetEnv("NSPR_FD_CACHE_SIZE_LOW");
+ //const char *high = PR_GetEnv("NSPR_FD_CACHE_SIZE_HIGH");
/*
** _low is allowed to be zero, _high is not.
@@ -274,8 +274,8 @@
_pr_fd_cache.limit_high = 0;
#endif /* defined(DEBUG) */
- if (NULL != low) _pr_fd_cache.limit_low = atoi(low);
- if (NULL != high) _pr_fd_cache.limit_high = atoi(high);
+ //if (NULL != low) _pr_fd_cache.limit_low = atoi(low);
+ //if (NULL != high) _pr_fd_cache.limit_high = atoi(high);
if (_pr_fd_cache.limit_high < _pr_fd_cache.limit_low)
_pr_fd_cache.limit_high = _pr_fd_cache.limit_low;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/pripv6.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/pripv6.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/pripv6.c Fri Apr 13 10:44:28 2007
@@ -279,7 +279,6 @@
#if defined(_PR_INET6_PROBE)
PRBool _pr_ipv6_is_present;
-extern PRBool _pr_test_ipv6_socket(void);
#if !defined(_PR_INET6) && defined(_PR_HAVE_GETIPNODEBYNAME)
extern PRStatus _pr_find_getipnodebyname(void);
@@ -292,17 +291,7 @@
static PRBool
_pr_probe_ipv6_presence(void)
{
-#if !defined(_PR_INET6) && defined(_PR_HAVE_GETIPNODEBYNAME)
- if (_pr_find_getipnodebyname() != PR_SUCCESS)
return PR_FALSE;
-#endif
-
-#if !defined(_PR_INET6) && defined(_PR_HAVE_GETADDRINFO)
- if (_pr_find_getaddrinfo() != PR_SUCCESS)
- return PR_FALSE;
-#endif
-
- return _pr_test_ipv6_socket();
}
#endif /* _PR_INET6_PROBE */
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prlog.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prlog.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/io/prlog.c Fri Apr 13 10:44:28 2007
@@ -204,11 +204,11 @@
void _PR_InitLog(void)
{
- char *ev;
+ char *ev = NULL;
_pr_logLock = PR_NewLock();
- ev = PR_GetEnv("NSPR_LOG_MODULES");
+// ev = PR_GetEnv("NSPR_LOG_MODULES");
if (ev && ev[0]) {
char module[64]; /* Security-Critical: If you change this
* size, you must also change the sscanf
@@ -255,7 +255,7 @@
}
PR_SetLogBuffering(isSync ? bufSize : 0);
- ev = PR_GetEnv("NSPR_LOG_FILE");
+ //ev = PR_GetEnv("NSPR_LOG_FILE");
if (ev && ev[0]) {
if (!PR_SetLogFile(ev)) {
#ifdef XP_PC
@@ -316,9 +316,9 @@
static void _PR_SetLogModuleLevel( PRLogModuleInfo *lm )
{
- char *ev;
+ char *ev = NULL;
- ev = PR_GetEnv("NSPR_LOG_MODULES");
+ //ev = PR_GetEnv("NSPR_LOG_MODULES");
if (ev && ev[0]) {
char module[64]; /* Security-Critical: If you change this
* size, you must also change the sscanf
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/Makefile.in (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/Makefile.in Fri Apr 13 10:44:28 2007
@@ -59,7 +59,7 @@
DEFINES += -D_NSPR_BUILD_
-CSRCS = prmalloc.c prmem.c
+CSRCS = prmem.c
include $(topsrcdir)/config/rules.mk
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/prmem.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/prmem.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/malloc/prmem.c Fri Apr 13 10:44:28 2007
@@ -210,25 +210,6 @@
return;
}
-PR_IMPLEMENT(void)
-PR_FPrintZoneStats(PRFileDesc *debug_out)
-{
- int i, j;
-
- for (j = 0; j < THREAD_POOLS; j++) {
- for (i = 0; i < MEM_ZONES; i++) {
- MemoryZone *mz = &zones[i][j];
- MemoryZone zone = *mz;
- if (zone.elements || zone.misses || zone.hits) {
- PR_fprintf(debug_out,
-"pool: %d, zone: %d, size: %d, free: %d, hit: %d, miss: %d, contend: %d\n",
- j, i, zone.blockSize, zone.elements,
- zone.hits, zone.misses, zone.contention);
- }
- }
- }
-}
-
static void *
pr_ZoneMalloc(PRUint32 size)
{
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/Makefile.in (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/Makefile.in Fri Apr 13 10:44:28 2007
@@ -49,8 +49,6 @@
unix.c \
unix_errors.c \
uxproces.c \
- uxrng.c \
- uxshm.c \
uxwrap.c \
$(NULL)
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/objs.mk
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/objs.mk (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/md/unix/objs.mk Fri Apr 13 10:44:28 2007
@@ -42,8 +42,6 @@
unix.c \
unix_errors.c \
uxproces.c \
- uxrng.c \
- uxshm.c \
uxwrap.c \
$(NULL)
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/memory/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/memory/Makefile.in (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/memory/Makefile.in Fri Apr 13 10:44:28 2007
@@ -46,7 +46,7 @@
include $(topsrcdir)/config/config.mk
-CSRCS = prseg.c prshm.c prshma.c
+CSRCS = prseg.c
ifdef GC_LEAK_DETECTOR
CSRCS += prgcleak.c
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/Makefile.in (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/Makefile.in Fri Apr 13 10:44:28 2007
@@ -47,35 +47,16 @@
include $(topsrcdir)/config/config.mk
CSRCS = \
- pralarm.c \
pratom.c \
- prcountr.c \
- prdtoa.c \
- prenv.c \
- prerr.c \
prerror.c \
- prerrortable.c \
+ pripc.c \
prinit.c \
+ prnetdb.c \
prinrval.c \
- pripc.c \
- prlog2.c \
- prlong.c \
- prnetdb.c \
prolock.c \
- prrng.c \
- prsystem.c \
prtime.c \
- prthinfo.c \
- prtpool.c \
- prtrace.c \
$(NULL)
-ifndef USE_PTHREADS
-CSRCS += \
- pripcsem.c \
- $(NULL)
-endif
-
TARGETS = $(OBJS)
INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/prinit.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/prinit.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/misc/prinit.c Fri Apr 13 10:44:28 2007
@@ -202,7 +202,7 @@
_PR_InitSegs();
_PR_InitStacks();
_PR_InitTPD();
- _PR_InitEnv();
+ //_PR_InitEnv();
_PR_InitLayerCache();
_PR_InitClock();
@@ -234,20 +234,20 @@
_PR_InitMem();
#endif
- _PR_InitCMon();
+ //_PR_InitCMon();
_PR_InitIO();
- _PR_InitNet();
+ //_PR_InitNet();
_PR_InitLog();
- _PR_InitLinker();
+ //_PR_InitLinker();
_PR_InitCallOnce();
- _PR_InitDtoa();
+ //_PR_InitDtoa();
_PR_InitMW();
- _PR_InitRWLocks();
+ //_PR_InitRWLocks();
- nspr_InitializePRErrorTable();
+ //nspr_InitializePRErrorTable();
#if !defined(_PR_INET6) || defined(_PR_INET6_PROBE)
- _pr_init_ipv6();
+ //_pr_init_ipv6();
#endif
_PR_MD_FINAL_INIT();
@@ -420,9 +420,9 @@
#endif
_PR_CleanupMW();
- _PR_CleanupDtoa();
+ //_PR_CleanupDtoa();
_PR_CleanupCallOnce();
- _PR_ShutdownLinker();
+ //_PR_ShutdownLinker();
/* Release the primordial thread's private data, etc. */
_PR_CleanupThread(me);
@@ -452,7 +452,7 @@
* Ideally, for each _PR_InitXXX(), there should be a corresponding
* _PR_XXXCleanup() that we can call here.
*/
- _PR_CleanupNet();
+ //_PR_CleanupNet();
_PR_CleanupIO();
#ifdef WINNT
_PR_CleanupCPUs();
@@ -461,7 +461,7 @@
PR_DestroyLock(_pr_sleeplock);
_pr_sleeplock = NULL;
_PR_CleanupLayerCache();
- _PR_CleanupEnv();
+ //_PR_CleanupEnv();
_PR_CleanupStacks();
_PR_CleanupBeforeExit();
_pr_initialized = PR_FALSE;
@@ -543,25 +543,6 @@
}
}
-/*
- * OBSOLETE
- */
-PR_IMPLEMENT(void)
-PR_SetStdioRedirect(
- PRProcessAttr *attr,
- PRSpecialFD stdioFd,
- PRFileDesc *redirectFd)
-{
-#if defined(DEBUG)
- static PRBool warn = PR_TRUE;
- if (warn) {
- warn = _PR_Obsolete("PR_SetStdioRedirect()",
- "PR_ProcessAttrSetStdioRedirect()");
- }
-#endif
- PR_ProcessAttrSetStdioRedirect(attr, stdioFd, redirectFd);
-}
-
PR_IMPLEMENT(PRStatus)
PR_ProcessAttrSetCurrentDirectory(
PRProcessAttr *attr,
@@ -659,75 +640,6 @@
return PR_SUCCESS;
}
-PR_IMPLEMENT(PRFileDesc *) PR_GetInheritedFD(
- const char *name)
-{
- PRFileDesc *fd;
- const char *envVar;
- const char *ptr;
- int len = strlen(name);
- PROsfd osfd;
- int nColons;
- PRIntn fileType;
-
- envVar = PR_GetEnv("NSPR_INHERIT_FDS");
- if (NULL == envVar || '\0' == envVar[0]) {
- PR_SetError(PR_UNKNOWN_ERROR, 0);
- return NULL;
- }
-
- ptr = envVar;
- while (1) {
- if ((ptr[len] == ':') && (strncmp(ptr, name, len) == 0)) {
- ptr += len + 1;
- PR_sscanf(ptr, "%d:0x%" PR_SCNxOSFD, &fileType, &osfd);
- switch ((PRDescType)fileType) {
- case PR_DESC_FILE:
- fd = PR_ImportFile(osfd);
- break;
- case PR_DESC_PIPE:
- fd = PR_ImportPipe(osfd);
- break;
- case PR_DESC_SOCKET_TCP:
- fd = PR_ImportTCPSocket(osfd);
- break;
- case PR_DESC_SOCKET_UDP:
- fd = PR_ImportUDPSocket(osfd);
- break;
- default:
- PR_ASSERT(0);
- PR_SetError(PR_UNKNOWN_ERROR, 0);
- fd = NULL;
- break;
- }
- if (fd) {
- /*
- * An inherited FD is inheritable by default.
- * The child process needs to call PR_SetFDInheritable
- * to make it non-inheritable if so desired.
- */
- fd->secret->inheritable = _PR_TRI_TRUE;
- }
- return fd;
- }
- /* Skip three colons */
- nColons = 0;
- while (*ptr) {
- if (*ptr == ':') {
- if (++nColons == 3) {
- break;
- }
- }
- ptr++;
- }
- if (*ptr == '\0') {
- PR_SetError(PR_UNKNOWN_ERROR, 0);
- return NULL;
- }
- ptr++;
- }
-}
-
PR_IMPLEMENT(PRProcess*) PR_CreateProcess(
const char *path,
char *const *argv,
@@ -850,19 +762,9 @@
}
return once->status;
}
-
PRBool _PR_Obsolete(const char *obsolete, const char *preferred)
{
-#if defined(DEBUG)
-#ifndef XP_MAC
- PR_fprintf(
- PR_STDERR, "'%s' is obsolete. Use '%s' instead.\n",
- obsolete, (NULL == preferred) ? "something else" : preferred);
-#else
-#pragma unused (obsolete, preferred)
-#endif
-#endif
- return PR_FALSE;
+ return PR_FALSE;
} /* _PR_Obsolete */
/* prinit.c */
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/Makefile.in (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/Makefile.in Fri Apr 13 10:44:28 2007
@@ -55,8 +55,8 @@
endif
CSRCS = \
+ ptsynch.c \
ptio.c \
- ptsynch.c \
ptthread.c \
ptmisc.c \
$(NULL)
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptio.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptio.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptio.c Fri Apr 13 10:44:28 2007
@@ -374,46 +374,13 @@
PTDebug pt_debug; /* this is shared between several modules */
-PR_IMPLEMENT(void) PT_FPrintStats(PRFileDesc *debug_out, const char *msg)
-{
- PTDebug stats;
- char buffer[100];
- PRExplodedTime tod;
- PRInt64 elapsed, aMil;
- stats = pt_debug; /* a copy */
- PR_ExplodeTime(stats.timeStarted, PR_LocalTimeParameters, &tod);
- (void)PR_FormatTime(buffer, sizeof(buffer), "%T", &tod);
-
- LL_SUB(elapsed, PR_Now(), stats.timeStarted);
- LL_I2L(aMil, 1000000);
- LL_DIV(elapsed, elapsed, aMil);
-
- if (NULL != msg) PR_fprintf(debug_out, "%s", msg);
- PR_fprintf(
- debug_out, "\tstarted: %s[%lld]\n", buffer, elapsed);
- PR_fprintf(
- debug_out, "\tlocks [created: %u, destroyed: %u]\n",
- stats.locks_created, stats.locks_destroyed);
- PR_fprintf(
- debug_out, "\tlocks [acquired: %u, released: %u]\n",
- stats.locks_acquired, stats.locks_released);
- PR_fprintf(
- debug_out, "\tcvars [created: %u, destroyed: %u]\n",
- stats.cvars_created, stats.cvars_destroyed);
- PR_fprintf(
- debug_out, "\tcvars [notified: %u, delayed_delete: %u]\n",
- stats.cvars_notified, stats.delayed_cv_deletes);
-} /* PT_FPrintStats */
-
-#else
+#endif /* DEBUG */
PR_IMPLEMENT(void) PT_FPrintStats(PRFileDesc *debug_out, const char *msg)
{
/* do nothing */
} /* PT_FPrintStats */
-#endif /* DEBUG */
-
#if defined(_PR_POLL_WITH_SELECT)
/*
* OSF1 and HPUX report the POLLHUP event for a socket when the
@@ -3374,6 +3341,8 @@
return fd;
} /* PR_AllocFileDesc */
+#if 0
+
#if !defined(_PR_INET6) || defined(_PR_INET6_PROBE)
PR_EXTERN(PRStatus) _pr_push_ipv6toipv4_layer(PRFileDesc *fd);
#if defined(_PR_INET6_PROBE)
@@ -3484,7 +3453,7 @@
#endif
return fd;
} /* PR_Socket */
-
+#endif
/*****************************************************************************/
/****************************** I/O public methods ***************************/
/*****************************************************************************/
@@ -4312,6 +4281,7 @@
return &dir->d;
} /* PR_ReadDir */
+#if 0
PR_IMPLEMENT(PRFileDesc*) PR_NewUDPSocket(void)
{
PRIntn domain = PF_INET;
@@ -4336,6 +4306,8 @@
return PR_Socket(af, SOCK_STREAM, 0);
} /* PR_NewTCPSocket */
+#endif
+
PR_IMPLEMENT(PRStatus) PR_NewTCPSocketPair(PRFileDesc *fds[2])
{
PRInt32 osfd[2];
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptthread.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptthread.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/pthreads/ptthread.c Fri Apr 13 10:44:28 2007
@@ -938,9 +938,9 @@
PR_Unlock(pt_book.ml);
_PR_CleanupMW();
- _PR_CleanupDtoa();
+ //_PR_CleanupDtoa();
_PR_CleanupCallOnce();
- _PR_ShutdownLinker();
+ //_PR_ShutdownLinker();
_PR_LogCleanup();
_PR_CleanupNet();
/* Close all the fd's before calling _PR_CleanupIO */
@@ -963,7 +963,7 @@
PR_DestroyLock(_pr_sleeplock);
_pr_sleeplock = NULL;
_PR_CleanupLayerCache();
- _PR_CleanupEnv();
+ //_PR_CleanupEnv();
#ifdef _PR_ZONE_ALLOCATOR
_PR_DestroyZones();
#endif
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/Makefile.in
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/Makefile.in (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/Makefile.in Fri Apr 13 10:44:28 2007
@@ -58,24 +58,15 @@
ifdef USE_PTHREADS
CSRCS = \
- prcmon.c \
- prrwlock.c \
prtpd.c \
$(NULL)
else
ifdef USE_BTHREADS
CSRCS = \
- prcmon.c \
- prrwlock.c \
prtpd.c \
$(NULL)
else
CSRCS = \
- prcmon.c \
- prdump.c \
- prmon.c \
- prsem.c \
- prrwlock.c \
prcthr.c \
prtpd.c \
$(NULL)
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/prcthr.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/prcthr.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/js/nsprpub/pr/src/threads/prcthr.c Fri Apr 13 10:44:28 2007
@@ -73,14 +73,6 @@
thread->environment = NULL;
}
-PR_IMPLEMENT(PRStatus) PR_Yield()
-{
- static PRBool warning = PR_TRUE;
- if (warning) warning = _PR_Obsolete(
- "PR_Yield()", "PR_Sleep(PR_INTERVAL_NO_WAIT)");
- return (PR_Sleep(PR_INTERVAL_NO_WAIT));
-}
-
/*
** Make the current thread sleep until "timeout" ticks amount of time
** has expired. If "timeout" is PR_INTERVAL_NO_WAIT then the call is
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/udns/udns_resolver.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/udns/udns_resolver.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/udns/udns_resolver.c Fri Apr 13 10:44:28 2007
@@ -46,9 +46,6 @@
# include <unistd.h>
# include <fcntl.h>
# include <sys/time.h>
-# ifdef HAVE_CONFIG_H
-# include <config.h>
-# endif
# ifdef HAVE_POLL
# include <sys/poll.h>
# endif
@@ -77,7 +74,7 @@
# define EAFNOSUPPORT EINVAL
#endif
-union sockaddr_ns {
+union usockaddr_ns {
struct sockaddr sa;
struct sockaddr_in sin;
#if HAVE_INET6
@@ -184,7 +181,7 @@
unsigned dnsc_port; /* default port (DNS_PORT) */
unsigned dnsc_udpbuf; /* size of UDP buffer */
/* array of nameserver addresses */
- union sockaddr_ns dnsc_serv[DNS_MAXSERV];
+ union usockaddr_ns dnsc_serv[DNS_MAXSERV];
unsigned dnsc_nserv; /* number of nameservers */
unsigned dnsc_salen; /* length of socket addresses */
/* search list for unqualified names */
@@ -272,7 +269,7 @@
};
static int dns_add_serv_internal(struct dns_ctx *ctx, const char *serv) {
- union sockaddr_ns *sns;
+ union usockaddr_ns *sns;
if (!serv)
return (ctx->dnsc_nserv = 0);
if (ctx->dnsc_nserv >= DNS_MAXSERV)
@@ -688,7 +685,7 @@
dns_socket sock;
unsigned i;
int port;
- union sockaddr_ns *sns;
+ union usockaddr_ns *sns;
#if HAVE_INET6
unsigned have_inet6 = 0;
#endif
@@ -922,7 +919,7 @@
return;
}
DNS_DBGQ(ctx, q, 1,
- &ctx->dnsc_serv[q->dnsq_servi].sa, sizeof(union sockaddr_ns),
+ &ctx->dnsc_serv[q->dnsq_servi].sa, sizeof(union usockaddr_ns),
q->dnsq_buf, q->dnsq_len);
q->dnsq_servwait |= 1 << q->dnsq_servi; /* expect reply from this ns */
@@ -1045,7 +1042,7 @@
dnsc_t *pbuf;
dnscc_t *pend, *pcur;
void *result;
- union sockaddr_ns sns;
+ union usockaddr_ns sns;
socklen_t slen;
SETCTX(ctx);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/win32/js/js.vcproj
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/win32/js/js.vcproj (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/win32/js/js.vcproj Fri Apr 13 10:44:28 2007
@@ -693,84 +693,107 @@
Name="NSPR Source"
>
<File
- RelativePath="..\..\js\nsprpub\pr\src\md\windows\ntgc.c"
- >
- </File>
- <File
RelativePath="..\..\js\nsprpub\pr\src\md\windows\ntinrval.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\md\windows\ntio.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\md\windows\ntmisc.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\md\windows\ntsec.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\md\windows\ntsem.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\md\windows\ntthread.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\pralarm.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\misc\pratom.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\threads\prcmon.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\prcountr.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\threads\prcthr.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\io\prdir.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\prdtoa.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\threads\prdump.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\prenv.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\prerr.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\misc\prerror.c"
>
</File>
<File
- RelativePath="..\..\js\nsprpub\pr\src\misc\prerrortable.c"
- >
- </File>
- <File
RelativePath="..\..\js\nsprpub\pr\src\io\prfdcach.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\io\prfile.c"
@@ -779,78 +802,101 @@
<File
RelativePath="..\..\js\nsprpub\pr\src\misc\prinit.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\misc\prinrval.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\io\prio.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\io\priometh.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\pripc.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\pripcsem.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\io\pripv6.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\io\prlayer.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\linking\prlink.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\io\prlog.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\prlog2.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\prlong.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\malloc\prmalloc.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\io\prmapopt.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\malloc\prmem.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\io\prmmap.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\threads\prmon.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\io\prmwait.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\prnetdb.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\misc\prolock.c"
@@ -859,82 +905,79 @@
<File
RelativePath="..\..\js\nsprpub\pr\src\md\prosdep.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\io\prpolevt.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\io\prprf.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\prrng.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\threads\prrwlock.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\io\prscanf.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\memory\prseg.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\threads\prsem.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\memory\prshm.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\memory\prshma.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\io\prsocket.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\io\prstdio.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\prsystem.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\prthinfo.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\misc\prtime.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\threads\prtpd.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\prtpool.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\misc\prtrace.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\threads\combined\prucpu.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\threads\combined\prucv.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\threads\combined\prulock.c"
@@ -943,26 +986,35 @@
<File
RelativePath="..\..\js\nsprpub\pr\src\threads\combined\prustack.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\threads\combined\pruthr.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\md\windows\w32ipcsem.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\md\windows\w32poll.c"
>
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\md\windows\w32rng.c"
- >
- </File>
- <File
- RelativePath="..\..\js\nsprpub\pr\src\md\windows\w32shm.c"
- >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\js\nsprpub\pr\src\md\windows\win32_errors.c"
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/xmlrpc-c/src/Makefile
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/xmlrpc-c/src/Makefile (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/xmlrpc-c/src/Makefile Fri Apr 13 10:44:28 2007
@@ -10,9 +10,11 @@
default: all
SUBDIRS =
+CPPCLEAN =
ifeq ($(ENABLE_CPLUSPLUS),yes)
SUBDIRS += cpp
+ CPPCLEAN += cpp/clean
endif
WININET_TRANSPORT_DIR = $(SRCDIR)/lib/wininet_transport
@@ -131,7 +133,7 @@
.PHONY: clean clean-local distclean
clean: clean-common clean-local
-clean-local: cpp/clean
+clean-local: $(CPPCLEAN)
distclean: clean distclean-common
Modified: freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/FreeSWITCH/Client.pm
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/FreeSWITCH/Client.pm (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/scripts/socket/FreeSWITCH/Client.pm Fri Apr 13 10:44:28 2007
@@ -208,6 +208,22 @@
return $self->sendmsg($hash);
}
+sub unicast($$$$$$) {
+ my $self = shift;
+
+ my $hash = {
+ 'command' => "sendmsg",
+ 'call-command' => "unicast",
+ 'local_ip' => $_[0],
+ 'local_port' => $_[1],
+ 'remote_ip' => $_[2],
+ 'remote_port' => $_[3],
+ 'transport' => $_[4]
+ };
+
+ return $self->sendmsg($hash);
+}
+
sub call_data($) {
my $self = shift;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_core_db.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_core_db.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_core_db.h Fri Apr 13 10:44:28 2007
@@ -457,6 +457,11 @@
*/
SWITCH_DECLARE(void) switch_core_db_free(char *z);
+/**
+ * Call this routine to find the number of rows changed by the last statement.
+ */
+SWITCH_DECLARE(int) switch_core_db_changes(switch_core_db_t *db);
+
/** Return values for switch_core_db_exec() and switch_core_db_step()*/
#define SWITCH_CORE_DB_OK 0 /* Successful result */
/* beginning-of-error-codes */
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_ivr.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_ivr.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_ivr.h Fri Apr 13 10:44:28 2007
@@ -42,6 +42,28 @@
#include <switch.h>
SWITCH_BEGIN_EXTERN_C
+
+struct switch_unicast_conninfo {
+ switch_core_session_t *session;
+ switch_codec_t read_codec;
+ switch_frame_t write_frame;
+ switch_byte_t write_frame_data[SWITCH_RECOMMENDED_BUFFER_SIZE];
+ switch_socket_t *socket;
+ char *local_ip;
+ switch_port_t local_port;
+ char *remote_ip;
+ switch_port_t remote_port;
+ switch_sockaddr_t *local_addr;
+ switch_sockaddr_t *remote_addr;
+ switch_mutex_t *flag_mutex;
+ int32_t flags;
+ int type;
+ int transport;
+ int stream_id;
+};
+typedef struct switch_unicast_conninfo switch_unicast_conninfo_t;
+
+
/**
* @defgroup switch_ivr IVR Library
* @ingroup core1
@@ -49,6 +71,15 @@
* building blocks for a higher level IVR interface.
* @{
*/
+
+SWITCH_DECLARE(switch_status_t) switch_ivr_deactivate_unicast(switch_core_session_t *session);
+SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session,
+ char *local_ip,
+ switch_port_t local_port,
+ char *remote_ip,
+ switch_port_t remote_port,
+ char *transport);
+
/*!
\brief Generate an XML CDR report.
\param session the session to get the data from.
@@ -79,9 +110,7 @@
/*!
\brief Wait for DTMF digits calling a pluggable callback function when digits are collected.
\param session the session to read.
- \param dtmf_callback code to execute if any dtmf is dialed during the recording
- \param buf an object to maintain across calls
- \param buflen the size of buf
+ \param args arguements to pass for callbacks etc
\param timeout a timeout in milliseconds
\return SWITCH_STATUS_SUCCESS to keep the collection moving.
*/
@@ -179,11 +208,8 @@
\param session the session to play the file too
\param fh file handle to use (NULL for builtin one)
\param file the path to the file
- \param dtmf_callback code to execute if any dtmf is dialed during the playback
- \param buf an object to maintain across calls
- \param buflen the size of buf
+ \param args arguements to pass for callbacks etc
\return SWITCH_STATUS_SUCCESS if all is well
- \note passing a NULL dtmf_callback nad a not NULL buf indicates to copy any dtmf to buf and stop playback.
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, char *file, switch_input_args_t *args);
@@ -193,12 +219,9 @@
\param session the session to record from
\param fh file handle to use
\param file the path to the file
- \param dtmf_callback code to execute if any dtmf is dialed during the recording
- \param buf an object to maintain across calls
- \param buflen the size of buf
+ \param args arguements to pass for callbacks etc
\param limit max limit to record for (0 for infinite)
\return SWITCH_STATUS_SUCCESS if all is well
- \note passing a NULL dtmf_callback nad a not NULL buf indicates to copy any dtmf to buf and stop recording.
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *session,
switch_file_handle_t *fh, char *file, switch_input_args_t *args, uint32_t limit);
@@ -240,10 +263,8 @@
\param tts_name the desired tts module
\param voice_name the desired voice
\param rate the sample rate
- \param dtmf_callback code to execute if any dtmf is dialed during the audio
\param text the text to speak
- \param buf an option data pointer to pass to the callback or a string to put encountered digits in
- \param buflen the len of buf
+ \param args arguements to pass for callbacks etc
\return SWITCH_STATUS_SUCCESS if all is well
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *session,
@@ -274,7 +295,7 @@
\brief Bridge Audio from one session to another
\param session one session
\param peer_session the other session
- \param dtmf_callback code to execute if any dtmf is dialed during the bridge
+ \param dtmf_callback a callback for messages and dtmf
\param session_data data to pass to the DTMF callback for session
\param peer_session_data data to pass to the DTMF callback for peer_session
\return SWITCH_STATUS_SUCCESS if all is well
@@ -460,6 +481,7 @@
/*!
\brief Feed digits collected into the stream for event match testing
\param parser a pointer to the parser object created by switch_ivr_digit_stream_parser_new
+ \param stream a stream to write data to
\param digit a digit to collect and test against the map of digit strings
\return NULL if no match found or consumer data that was associated with a given digit string when matched
*/
@@ -525,14 +547,15 @@
*\param name A pointer to the name of this menu.
*\param greeting_sound Optional pointer to a main sound (press 1 for this 2 for that).
*\param short_greeting_sound Optional pointer to a shorter main sound for subsequent loops.
- *\param exit_sound Optional pointer to a sound to play upon exiting the menu
+ *\param exit_sound Optional pointer to a sound to play upon exiting the menu.
*\param invalid_sound Optional pointer to a sound to play after invalid input.
- *\param tts_engine Text To Speech engine name
- *\param tts_voice Text To Speech engine voice name
+ *\param tts_engine Text To Speech engine name.
+ *\param tts_voice Text To Speech engine voice name.
+ *\param phrase_lang the language to use for the phrase macros.
*\param timeout A number of milliseconds to pause before looping.
*\param max_failures Maximum number of failures to withstand before hangingup This resets everytime you enter the menu.
- *\param pool memory pool (NULL to create one)
- *\return SWITCH_STATUS_SUCCESS if the menu was created
+ *\param pool memory pool (NULL to create one).
+ *\return SWITCH_STATUS_SUCCESS if the menu was created.
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_menu,
switch_ivr_menu_t * main,
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_types.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_types.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_types.h Fri Apr 13 10:44:28 2007
@@ -117,6 +117,13 @@
#define SWITCH_BITS_PER_BYTE 8
typedef uint8_t switch_byte_t;
+
+typedef enum {
+ SUF_NONE = 0,
+ SUF_THREAD_RUNNING = (1 << 0),
+ SUF_READY = (1 << 1)
+} switch_unicast_flag_t;
+
typedef enum {
SWITCH_FALSE = 0,
SWITCH_TRUE = 1
@@ -531,6 +538,7 @@
CF_RING_READY = (1 << 18) - Channel is ready to send ringback
CF_BREAK = (1 << 19) - Channel should stop what it's doing
CF_BROADCAST = (1 << 20) - Channel is broadcasting
+CF_UNICAST = (1 << 21) - Channel has a unicast connection
</pre>
*/
@@ -555,7 +563,8 @@
CF_GEN_RINGBACK = (1 << 17),
CF_RING_READY = (1 << 18),
CF_BREAK = (1 << 19),
- CF_BROADCAST = (1 << 20)
+ CF_BROADCAST = (1 << 20),
+ CF_UNICAST = (1 << 21)
} switch_channel_flag_t;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_utils.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_utils.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/include/switch_utils.h Fri Apr 13 10:44:28 2007
@@ -90,7 +90,7 @@
\brief find the char representation of an ip adress
\param buf the buffer to write the ip adress found into
\param len the length of the buf
- \param the struct in_addr * to get the adress from
+ \param in the struct in_addr * to get the adress from
\return the ip adress string
*/
SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct in_addr *in);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/Makefile.am
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/Makefile.am (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/Makefile.am Fri Apr 13 10:44:28 2007
@@ -7,7 +7,7 @@
@set fnord $$MAKEFLAGS; amf=$$2; \
target=`echo $@ | sed -e 's|^.*-||'`; \
modname=`echo $@ | sed -e 's|-.*||'`; \
- confmoddir=`cat $(switch_builddir)/modules.conf | grep $$modname | sed -e 's|#||' `; \
+ confmoddir=`cat $(switch_builddir)/modules.conf | grep $$modname$$ | sed -e 's|#||' `; \
if test -z "$$confmoddir" ; then moddir=$@ ; else \
if test -d "$(switch_srcdir)/src/mod/$$confmoddir" ; then \
moddir="$(switch_srcdir)/src/mod/$$confmoddir" ; else \
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_enum/Makefile
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_enum/Makefile (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/applications/mod_enum/Makefile Fri Apr 13 10:44:28 2007
@@ -1,11 +1,10 @@
BASE=../../../..
UDNS_DIR=$(BASE)/libs/udns
-UDNSA=$(UDNS_DIR)/libudns.a
-LOCAL_CFLAGS=-I$(UDNS_DIR)
-LOCAL_LIBADD=$(UDNSA)
-include $(BASE)/build/modmake.rules
+LOCAL_CFLAGS=-I$(UDNS_DIR) -DHAVE_POLL
+LOCAL_OBJS=$(UDNS_DIR)/udns_dn.o $(UDNS_DIR)/udns_dntosp.o $(UDNS_DIR)/udns_parse.o $(UDNS_DIR)/udns_misc.o \
+$(UDNS_DIR)/udns_rr_a.o $(UDNS_DIR)/udns_rr_ptr.o $(UDNS_DIR)/udns_rr_mx.o $(UDNS_DIR)/udns_rr_txt.o $(UDNS_DIR)/udns_bl.o \
+$(UDNS_DIR)/udns_rr_srv.o $(UDNS_DIR)/udns_rr_naptr.o $(UDNS_DIR)/udns_codes.o $(UDNS_DIR)/udns_resolver.o
+
-$(UDNSA): $(UDNS_DIR) $(UDNS_DIR)/.update
- cd $(UDNS_DIR) && $(MAKE) staticlib
- $(TOUCH_TARGET)
+include $(BASE)/build/modmake.rules
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.c Fri Apr 13 10:44:28 2007
@@ -882,7 +882,7 @@
}
profile = gateway_ptr->profile;
- tech_pvt->from_str = switch_core_session_strdup(nsession, gateway_ptr->register_from);
+ tech_pvt->gateway_from_str = switch_core_session_strdup(nsession, gateway_ptr->register_from);
if (!strchr(dest, '@')) {
tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s@%s", dest, gateway_ptr->register_proxy + 4);
} else {
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/mod_sofia.h Fri Apr 13 10:44:28 2007
@@ -278,6 +278,7 @@
char *far_end_contact;
char *contact_url;
char *from_str;
+ char *gateway_from_str;
char *rm_encoding;
char *rm_fmtp;
char *fmtp_out;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_sofia/sofia_glue.c Fri Apr 13 10:44:28 2007
@@ -417,7 +417,8 @@
tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL,
NUTAG_URL(url),
SIPTAG_TO_STR(tech_pvt->dest_to),
- SIPTAG_FROM_STR(tech_pvt->from_str),
+ TAG_IF(tech_pvt->gateway_from_str, SIPTAG_FROM_STR(tech_pvt->gateway_from_str)),
+ TAG_IF(!tech_pvt->gateway_from_str, SIPTAG_FROM_STR(tech_pvt->from_str)),
TAG_IF(tech_pvt->invite_contact, SIPTAG_CONTACT_STR(tech_pvt->invite_contact)),
TAG_IF(!tech_pvt->invite_contact, SIPTAG_CONTACT_STR(tech_pvt->profile->url)),
TAG_END());
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/Makefile
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/Makefile (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/Makefile Fri Apr 13 10:44:28 2007
@@ -3,20 +3,23 @@
LIBPRI=libpri-1.2.4
LIBPRI_FILE=$(LIBPRI).tar.gz
LIBPRI_DIR=$(BASE)/libs/$(LIBPRI)
-WANPIPE=wanpipe-3.1.0.p13
+WANPIPE=wanpipe-3.1.0.p15
WANPIPE_HOST=ftp://ftp.sangoma.com/linux/custom/3.1
WANPIPE_FILE=$(WANPIPE).tgz
WANPIPE_DIR=$(BASE)/libs/$(WANPIPE)
WANPIPE_INCLUDE=$(WANPIPE_DIR)/patches/kdrivers/include
WANPIPE_KO=$(WANPIPE_DIR)/patches/kdrivers/src/net/wanpipe.ko
WANPIPE_INSTALLED_KO=$(shell echo "/lib/modules/`uname -r`/kernel/drivers/net/wan/wanpipe.ko")
-LIBSANGOMA_DIR=$(WANPIPE_DIR)/api/libsangoma
+LIBSANGOMA_DIR=./libsangoma
LOCAL_CFLAGS =-w -I$(WANPIPE_INCLUDE) -I$(LIBSANGOMA_DIR) -I/usr/local/include -I$(LIBPRI_DIR) -I/usr/src/linux/include -I. -I/usr/include
LOCAL_CFLAGS +=-D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -DAFT_A104 -DWANPIPE_TDM_API -I$(switch_srcdir)/libs/libteletone/src -D_GNUC_ -DWANPIPE_TDM_API
LOCAL_OBJS = ss7boost_client.o $(LIBPRI_DIR)/copy_string.o $(LIBPRI_DIR)/pri.o $(LIBPRI_DIR)/q921.o $(LIBPRI_DIR)/prisched.o $(LIBPRI_DIR)/q931.o $(LIBPRI_DIR)/pri_facility.o $(LIBSANGOMA_DIR)/libsangoma.o $(LIBSANGOMA_DIR)/sangoma_pri.o
include $(BASE)/build/modmake.rules
+testapp: testapp.c $(LIBSANGOMA_DIR)/libsangoma.o
+ $(CC) -I$(WANPIPE_DIR)/api/lib $(CFLAGS) $(LOCAL_CFLAGS) lib_api.c testapp.c $(LIBSANGOMA_DIR)/libsangoma.o -o testapp
+
$(LIBPRI_DIR):
$(GETLIB) $(LIBPRI_HOST) $(LIBPRI_FILE)
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.c Fri Apr 13 10:44:28 2007
@@ -23,96 +23,99 @@
#define DFT_CARD "wanpipe1"
#if defined(WIN32)
-//extern int verbose;
+//extern int verbose;
#define DEV_NAME_LEN 100
char device_name[DEV_NAME_LEN];
/* IOCTL management structures and variables*/
-wan_udp_hdr_t wan_udp;
+wan_udp_hdr_t wan_udp;
#include "win_api_common.h"
static wan_cmd_api_t api_cmd;
-static api_tx_hdr_t *tx_hdr = (api_tx_hdr_t *) api_cmd.data;
+static api_tx_hdr_t *tx_hdr = (api_tx_hdr_t *)api_cmd.data;
/* keeps the LAST (and single) event received */
static wp_tdm_api_rx_hdr_t last_tdm_api_event_buffer;
-#endif /* WIN32 */
+#endif /* WIN32 */
-void sangoma_socket_close(sng_fd_t * sp)
+void sangoma_socket_close(sng_fd_t *sp)
{
#if defined(WIN32)
- if (*sp != INVALID_HANDLE_VALUE) {
+ if( *sp != INVALID_HANDLE_VALUE){
CloseHandle(*sp);
*sp = INVALID_HANDLE_VALUE;
}
#else
- if (*sp > -1) {
- close(*sp);
- *sp = -1;
- }
+ if (*sp > -1) {
+ close(*sp);
+ *sp = -1;
+ }
#endif
}
int sangoma_socket_waitfor(sng_fd_t fd, int timeout, int flags)
{
#if defined(WIN32)
- API_POLL_STRUCT api_poll;
+ API_POLL_STRUCT api_poll;
memset(&api_poll, 0x00, sizeof(API_POLL_STRUCT));
-
+
api_poll.user_flags_bitmap = flags;
- if (DoApiPollCommand(fd, &api_poll)) {
+ if(DoApiPollCommand(fd, &api_poll)){
//failed
return 0;
}
- switch (api_poll.operation_status) {
- case SANG_STATUS_RX_DATA_AVAILABLE:
- break;
-
- default:
- prn(1, "Error: sangoma_socket_waitfor(): Unknown Operation Status: %d\n", api_poll.operation_status);
- return 0;
- } //switch()
+ switch(api_poll.operation_status)
+ {
+ case SANG_STATUS_RX_DATA_AVAILABLE:
+ break;
- if (api_poll.poll_events_bitmap == 0) {
- prn(1, "Error: invalid Poll Events bitmap: 0x%X\n", api_poll.poll_events_bitmap);
+ default:
+ prn(1, "Error: sangoma_socket_waitfor(): Unknown Operation Status: %d\n",
+ api_poll.operation_status);
+ return 0;
+ }//switch()
+
+ if(api_poll.poll_events_bitmap == 0){
+ prn(1, "Error: invalid Poll Events bitmap: 0x%X\n",
+ api_poll.poll_events_bitmap);
}
return api_poll.poll_events_bitmap;
#else
- struct pollfd pfds[1];
- int res;
+ struct pollfd pfds[1];
+ int res;
- memset(&pfds[0], 0, sizeof(pfds[0]));
- pfds[0].fd = fd;
- pfds[0].events = flags;
- res = poll(pfds, 1, timeout);
- if (res > 0) {
- if ((pfds[0].revents & POLLERR)) {
- res = -1;
- } else if ((pfds[0].revents)) {
- res = 1;
- }
+ memset(&pfds[0], 0, sizeof(pfds[0]));
+ pfds[0].fd = fd;
+ pfds[0].events = flags;
+ res = poll(pfds, 1, timeout);
+ if (res > 0) {
+ if ((pfds[0].revents & POLLERR)) {
+ res = -1;
+ } else if((pfds[0].revents)) {
+ res = 1;
}
+ }
- return res;
+ return res;
#endif
}
int sangoma_span_chan_toif(int span, int chan, char *interface_name)
{
- sprintf(interface_name, "s%ic%i", span, chan);
+ sprintf(interface_name,"s%ic%i",span,chan);
return 0;
}
int sangoma_interface_toi(char *interface_name, int *span, int *chan)
{
- char *p = NULL, *sp = NULL, *ch = NULL;
+ char *p=NULL, *sp = NULL, *ch = NULL;
int ret = 0;
char data[FNAME_LEN];
@@ -128,7 +131,7 @@
}
}
- if (ch && sp) {
+ if(ch && sp) {
*span = atoi(sp);
*chan = atoi(ch);
ret = 1;
@@ -159,7 +162,7 @@
}
}
- if (ch && sp) {
+ if(ch && sp) {
*span = atoi(sp);
*chan = atoi(ch);
ret = 1;
@@ -172,123 +175,132 @@
return ret;
}
-sng_fd_t sangoma_open_tdmapi_span_chan(int span, int chan)
+sng_fd_t sangoma_open_tdmapi_span_chan(int span, int chan)
{
- char fname[FNAME_LEN];
+ char fname[FNAME_LEN];
#if defined(WIN32)
//NOTE: under Windows Interfaces are zero based but 'chan' is 1 based.
- // Subtract 1 from 'chan'.
- _snprintf(fname, FNAME_LEN, "\\\\.\\WANPIPE%d_IF%d", span, chan - 1);
+ // Subtract 1 from 'chan'.
+ _snprintf(fname , FNAME_LEN, "\\\\.\\WANPIPE%d_IF%d", span, chan - 1);
//prn(verbose, "Opening device: %s...\n", fname);
- return CreateFile(fname,
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- (LPSECURITY_ATTRIBUTES) NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH, (HANDLE) NULL);
+ return CreateFile( fname,
+ GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ (LPSECURITY_ATTRIBUTES)NULL,
+ OPEN_EXISTING,
+ FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH,
+ (HANDLE)NULL
+ );
#else
- int fd = -1;
+ int fd=-1;
- sprintf(fname, "/dev/wptdm_s%dc%d", span, chan);
+ sprintf(fname,"/dev/wptdm_s%dc%d",span,chan);
fd = open(fname, O_RDWR);
- return fd;
+ return fd;
#endif
-}
+}
-sng_fd_t sangoma_create_socket_by_name(char *device, char *card)
+sng_fd_t sangoma_create_socket_by_name(char *device, char *card)
{
- int span, chan;
- sangoma_interface_toi(device, &span, &chan);
-
- return sangoma_open_tdmapi_span_chan(span, chan);
+ int span,chan;
+ sangoma_interface_toi(device,&span,&chan);
+
+ return sangoma_open_tdmapi_span_chan(span,chan);
}
-
-sng_fd_t sangoma_open_tdmapi_span(int span)
+
+sng_fd_t sangoma_open_tdmapi_span(int span)
{
- int i = 0;
+ int i=0;
#if defined(WIN32)
sng_fd_t fd = INVALID_HANDLE_VALUE;
- for (i = 1; i < 32; i++) {
- if ((fd = sangoma_open_tdmapi_span_chan(span, i)) == INVALID_HANDLE_VALUE) {
+ for(i = 1; i < 32; i++){
+ if((fd = sangoma_open_tdmapi_span_chan(span, i)) == INVALID_HANDLE_VALUE){
//prn(verbose, "Span: %d, chan: %d: is not running, consider 'busy'\n",
- // span, i);
+ // span, i);
continue;
}
+
//get the open handle counter
- wan_udp.wan_udphdr_command = GET_OPEN_HANDLES_COUNTER;
+ wan_udp.wan_udphdr_command = GET_OPEN_HANDLES_COUNTER;
wan_udp.wan_udphdr_data_len = 0;
DoManagementCommand(fd, &wan_udp);
- if (wan_udp.wan_udphdr_return_code) {
- prn(1, "Error: command GET_OPEN_HANDLES_COUNTER failed! Span: %d, chan: %d\n", span, i);
+ if(wan_udp.wan_udphdr_return_code){
+ prn(1, "Error: command GET_OPEN_HANDLES_COUNTER failed! Span: %d, chan: %d\n",
+ span, i);
//don't forget to close!! otherwize counter will stay incremented.
sangoma_socket_close(&fd);
continue;
}
+
//prn(verbose, "open handles counter: %d\n", *(int*)&wan_udp.wan_udphdr_data[0]);
- if (*(int *) &wan_udp.wan_udphdr_data[0] == 1) {
+ if(*(int*)&wan_udp.wan_udphdr_data[0] == 1){
//this is the only process using this chan/span, so it is 'free'
//prn(verbose, "Found 'free' Span: %d, chan: %d\n",span, i);
break;
}
//don't forget to close!! otherwize counter will stay incremented.
sangoma_socket_close(&fd);
- } //for()
+ }//for()
#else
- unsigned char fname[FNAME_LEN];
- int fd = 0;
- for (i = 1; i < 32; i++) {
- sprintf(fname, "/dev/wptdm_s%dc%d", span, i);
+ unsigned char fname[FNAME_LEN];
+ int fd=0;
+ for (i=1;i<32;i++){
+ sprintf(fname,"/dev/wptdm_s%dc%d",span,i);
fd = open(fname, O_RDWR);
- if (fd < 0) {
- continue;
+ if (fd < 0){
+ continue;
}
break;
}
-#endif
- return fd;
-}
+#endif
+ return fd;
+}
int sangoma_readmsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, int datalen, int flag)
{
- int rx_len = 0;
+ int rx_len=0;
#if defined(WIN32)
- static RX_DATA_STRUCT rx_data;
- api_header_t *pri;
- wp_tdm_api_rx_hdr_t *tdm_api_rx_hdr;
- wp_tdm_api_rx_hdr_t *user_buf = (wp_tdm_api_rx_hdr_t *) hdrbuf;
+ static RX_DATA_STRUCT rx_data;
+ api_header_t *pri;
+ wp_tdm_api_rx_hdr_t *tdm_api_rx_hdr;
+ wp_tdm_api_rx_hdr_t *user_buf = (wp_tdm_api_rx_hdr_t*)hdrbuf;
- if (hdrlen != sizeof(wp_tdm_api_rx_hdr_t)) {
+ if(hdrlen != sizeof(wp_tdm_api_rx_hdr_t)){
//error
prn(1, "Error: sangoma_readmsg_tdm(): invalid size of user's 'header buffer'.\
Should be 'sizeof(wp_tdm_api_rx_hdr_t)'.\n");
return -1;
}
- if (DoReadCommand(fd, &rx_data)) {
+ if(DoReadCommand(fd, &rx_data) ){
//error
prn(1, "Error: DoReadCommand() failed! Check messages log.\n");
return -1;
}
+
//use our special buffer at rxdata to hold received data
pri = &rx_data.api_header;
- tdm_api_rx_hdr = (wp_tdm_api_rx_hdr_t *) rx_data.data;
+ tdm_api_rx_hdr = (wp_tdm_api_rx_hdr_t*)rx_data.data;
user_buf->wp_tdm_api_event_type = pri->operation_status;
- switch (pri->operation_status) {
+ switch(pri->operation_status)
+ {
case SANG_STATUS_RX_DATA_AVAILABLE:
//prn(verbose, "SANG_STATUS_RX_DATA_AVAILABLE\n");
- if (pri->data_length > datalen) {
- rx_len = 0;
+ if(pri->data_length > datalen){
+ rx_len=0;
break;
}
memcpy(databuf, rx_data.data, pri->data_length);
@@ -303,11 +315,12 @@
rx_len = pri->data_length;
//make copy for use with sangoma_tdm_read_event() - indirect access.
- memcpy(&last_tdm_api_event_buffer, tdm_api_rx_hdr, sizeof(wp_tdm_api_rx_hdr_t));
+ memcpy( &last_tdm_api_event_buffer, tdm_api_rx_hdr, sizeof(wp_tdm_api_rx_hdr_t));
break;
default:
- switch (pri->operation_status) {
+ switch(pri->operation_status)
+ {
case SANG_STATUS_RX_DATA_TIMEOUT:
//no data in READ_CMD_TIMEOUT, try again.
prn(1, "Error: Timeout on read.\n");
@@ -331,43 +344,43 @@
default:
prn(1, "Rx:Unknown Operation Status: %d\n", pri->operation_status);
break;
- } //switch()
+ }//switch()
return 0;
- } //switch()
+ }//switch()
#else
struct msghdr msg;
struct iovec iov[2];
- memset(&msg, 0, sizeof(struct msghdr));
+ memset(&msg,0,sizeof(struct msghdr));
- iov[0].iov_len = hdrlen;
- iov[0].iov_base = hdrbuf;
+ iov[0].iov_len=hdrlen;
+ iov[0].iov_base=hdrbuf;
- iov[1].iov_len = datalen;
- iov[1].iov_base = databuf;
+ iov[1].iov_len=datalen;
+ iov[1].iov_base=databuf;
- msg.msg_iovlen = 2;
- msg.msg_iov = iov;
+ msg.msg_iovlen=2;
+ msg.msg_iov=iov;
- rx_len = read(fd, &msg, datalen + hdrlen);
+ rx_len = read(fd,&msg,datalen+hdrlen);
- if (rx_len <= sizeof(wp_tdm_api_rx_hdr_t)) {
+ if (rx_len <= sizeof(wp_tdm_api_rx_hdr_t)){
return -EINVAL;
}
- rx_len -= sizeof(wp_tdm_api_rx_hdr_t);
+ rx_len-=sizeof(wp_tdm_api_rx_hdr_t);
#endif
- return rx_len;
-}
+ return rx_len;
+}
int sangoma_writemsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, unsigned short datalen, int flag)
{
int bsent;
#if defined(WIN32)
- static TX_DATA_STRUCT local_tx_data;
- api_header_t *pri;
+ static TX_DATA_STRUCT local_tx_data;
+ api_header_t *pri;
pri = &local_tx_data.api_header;
@@ -375,35 +388,36 @@
memcpy(local_tx_data.data, databuf, pri->data_length);
//queue data for transmission
- if (DoWriteCommand(fd, &local_tx_data)) {
+ if( DoWriteCommand(fd, &local_tx_data)){
//error
prn(1, "Error: DoWriteCommand() failed!! Check messages log.\n");
return -1;
}
- bsent = 0;
+ bsent=0;
//check that frame was transmitted
- switch (local_tx_data.api_header.operation_status) {
+ switch(local_tx_data.api_header.operation_status)
+ {
case SANG_STATUS_SUCCESS:
bsent = datalen;
break;
-
+
case SANG_STATUS_TX_TIMEOUT:
//error
prn(1, "****** Error: SANG_STATUS_TX_TIMEOUT ******\n");
//Check messages log or look at statistics.
break;
-
+
case SANG_STATUS_TX_DATA_TOO_LONG:
//Attempt to transmit data longer than the pre-configured maximum.
//Maximum length is set in 'Interface Properties',
//in the 'Device Manager'.
prn(1, "****** SANG_STATUS_TX_DATA_TOO_LONG ******\n");
break;
-
+
case SANG_STATUS_TX_DATA_TOO_SHORT:
//Minimum is 1 byte for Primary port,
- // 2 bytes for Secondary port
+ // 2 bytes for Secondary port
prn(1, "****** SANG_STATUS_TX_DATA_TOO_SHORT ******\n");
break;
@@ -416,27 +430,28 @@
break;
default:
- prn(1, "Unknown return code (0x%X) on transmission!\n", local_tx_data.api_header.operation_status);
+ prn(1, "Unknown return code (0x%X) on transmission!\n",
+ local_tx_data.api_header.operation_status);
break;
- } //switch()
+ }//switch()
#else
struct msghdr msg;
struct iovec iov[2];
- memset(&msg, 0, sizeof(struct msghdr));
+ memset(&msg,0,sizeof(struct msghdr));
- iov[0].iov_len = hdrlen;
- iov[0].iov_base = hdrbuf;
+ iov[0].iov_len=hdrlen;
+ iov[0].iov_base=hdrbuf;
- iov[1].iov_len = datalen;
- iov[1].iov_base = databuf;
+ iov[1].iov_len=datalen;
+ iov[1].iov_base=databuf;
- msg.msg_iovlen = 2;
- msg.msg_iov = iov;
+ msg.msg_iovlen=2;
+ msg.msg_iov=iov;
- bsent = write(fd, &msg, datalen + hdrlen);
- if (bsent > 0) {
- bsent -= sizeof(wp_tdm_api_tx_hdr_t);
+ bsent = write(fd,&msg,datalen+hdrlen);
+ if (bsent > 0){
+ bsent-=sizeof(wp_tdm_api_tx_hdr_t);
}
#endif
return bsent;
@@ -449,17 +464,17 @@
* Execute TDM command
*
*/
-static int sangoma_tdm_cmd_exec(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_cmd_exec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
int err;
#if defined(WIN32)
err = tdmv_api_ioctl(fd, &tdm_api->wp_tdm_cmd);
#else
- err = ioctl(fd, SIOC_WANPIPE_TDM_API, &tdm_api->wp_tdm_cmd);
- if (err < 0) {
+ err = ioctl(fd,SIOC_WANPIPE_TDM_API,&tdm_api->wp_tdm_cmd);
+ if (err < 0){
char tmp[50];
- sprintf(tmp, "TDM API: CMD: %i\n", tdm_api->wp_tdm_cmd.cmd);
+ sprintf(tmp,"TDM API: CMD: %i\n",tdm_api->wp_tdm_cmd.cmd);
perror(tmp);
return -1;
}
@@ -471,35 +486,40 @@
* Get Full TDM API configuration per channel
*
*/
-int sangoma_get_full_cfg(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_get_full_cfg(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_FULL_CFG;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
printf("TDM API CFG:\n");
- printf("\thw_tdm_coding:\t%d\n", tdm_api->wp_tdm_cmd.hw_tdm_coding);
- printf("\tusr_mtu_mru:\t%d\n", tdm_api->wp_tdm_cmd.hw_mtu_mru);
- printf("\tusr_period:\t%d\n", tdm_api->wp_tdm_cmd.usr_period);
- printf("\ttdm_codec:\t%d\n", tdm_api->wp_tdm_cmd.tdm_codec);
- printf("\tpower_level:\t%d\n", tdm_api->wp_tdm_cmd.power_level);
- printf("\trx_disable:\t%d\n", tdm_api->wp_tdm_cmd.rx_disable);
- printf("\ttx_disable:\t%d\n", tdm_api->wp_tdm_cmd.tx_disable);
- printf("\tusr_mtu_mru:\t%d\n", tdm_api->wp_tdm_cmd.usr_mtu_mru);
- printf("\tidle flag:\t0x%02X\n", tdm_api->wp_tdm_cmd.idle_flag);
- printf("\tfe alarms:\t0x%02X\n", tdm_api->wp_tdm_cmd.fe_alarms);
-
- printf("\trx pkt\t%d\ttx pkt\t%d\n", tdm_api->wp_tdm_cmd.stats.rx_packets, tdm_api->wp_tdm_cmd.stats.tx_packets);
- printf("\trx err\t%d\ttx err\t%d\n", tdm_api->wp_tdm_cmd.stats.rx_errors, tdm_api->wp_tdm_cmd.stats.tx_errors);
+ printf("\thw_tdm_coding:\t%d\n",tdm_api->wp_tdm_cmd.hw_tdm_coding);
+ printf("\tusr_mtu_mru:\t%d\n",tdm_api->wp_tdm_cmd.hw_mtu_mru);
+ printf("\tusr_period:\t%d\n",tdm_api->wp_tdm_cmd.usr_period);
+ printf("\ttdm_codec:\t%d\n",tdm_api->wp_tdm_cmd.tdm_codec);
+ printf("\tpower_level:\t%d\n",tdm_api->wp_tdm_cmd.power_level);
+ printf("\trx_disable:\t%d\n",tdm_api->wp_tdm_cmd.rx_disable);
+ printf("\ttx_disable:\t%d\n",tdm_api->wp_tdm_cmd.tx_disable);
+ printf("\tusr_mtu_mru:\t%d\n",tdm_api->wp_tdm_cmd.usr_mtu_mru);
+ printf("\tidle flag:\t0x%02X\n",tdm_api->wp_tdm_cmd.idle_flag);
+ printf("\tfe alarms:\t0x%02X\n",tdm_api->wp_tdm_cmd.fe_alarms);
+
+ printf("\trx pkt\t%d\ttx pkt\t%d\n",tdm_api->wp_tdm_cmd.stats.rx_packets,
+ tdm_api->wp_tdm_cmd.stats.tx_packets);
+ printf("\trx err\t%d\ttx err\t%d\n",
+ tdm_api->wp_tdm_cmd.stats.rx_errors,
+ tdm_api->wp_tdm_cmd.stats.tx_errors);
#ifndef __WINDOWS__
- printf("\trx ovr\t%d\ttx idl\t%d\n", tdm_api->wp_tdm_cmd.stats.rx_fifo_errors, tdm_api->wp_tdm_cmd.stats.tx_carrier_errors);
-#endif
-
+ printf("\trx ovr\t%d\ttx idl\t%d\n",
+ tdm_api->wp_tdm_cmd.stats.rx_fifo_errors,
+ tdm_api->wp_tdm_cmd.stats.tx_carrier_errors);
+#endif
+
return 0;
}
@@ -515,14 +535,14 @@
* }
*
*/
-int sangoma_tdm_set_codec(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int codec)
+int sangoma_tdm_set_codec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int codec)
{
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_SET_CODEC;
tdm_api->wp_tdm_cmd.tdm_codec = codec;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
return err;
}
@@ -539,18 +559,18 @@
* }
*
*/
-int sangoma_tdm_get_codec(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_get_codec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_CODEC;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
- return tdm_api->wp_tdm_cmd.tdm_codec;
+ return tdm_api->wp_tdm_cmd.tdm_codec;
}
@@ -561,14 +581,14 @@
* 10,20,30,40,50 ms
*
*/
-int sangoma_tdm_set_usr_period(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int period)
+int sangoma_tdm_set_usr_period(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int period)
{
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_SET_USR_PERIOD;
tdm_api->wp_tdm_cmd.usr_period = period;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
return err;
}
@@ -580,14 +600,14 @@
* 10,20,30,40,50 ms
*
*/
-int sangoma_tdm_get_usr_period(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_get_usr_period(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_USR_PERIOD;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
@@ -600,15 +620,15 @@
* Coding Format will be ULAW/ALAW based on T1/E1
*/
-int sangoma_tdm_get_hw_coding(int fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_get_hw_coding(int fd, wanpipe_tdm_api_t *tdm_api)
{
- int err;
- tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_HW_CODING;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
- return err;
- }
- return tdm_api->wp_tdm_cmd.hw_tdm_coding;
+ int err;
+ tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_HW_CODING;
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
+ return err;
+ }
+ return tdm_api->wp_tdm_cmd.hw_tdm_coding;
}
@@ -618,14 +638,14 @@
* The USER MTU/MRU values will change each time a PERIOD
* or CODEC is adjusted.
*/
-int sangoma_tdm_get_usr_mtu_mru(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_get_usr_mtu_mru(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_USR_MTU_MRU;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
@@ -638,14 +658,14 @@
* This option is not implemented yet
*
*/
-int sangoma_tdm_set_power_level(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int power)
+int sangoma_tdm_set_power_level(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int power)
{
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_SET_POWER_LEVEL;
tdm_api->wp_tdm_cmd.power_level = power;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
return err;
}
@@ -656,43 +676,42 @@
* This option is not implemented yet
*
*/
-int sangoma_tdm_get_power_level(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_get_power_level(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_POWER_LEVEL;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
return tdm_api->wp_tdm_cmd.power_level;
}
-int sangoma_tdm_flush_bufs(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_flush_bufs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
#if 0
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_FLUSH_BUFFERS;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
#endif
return 0;
}
-int sangoma_tdm_enable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int poll_in_sec)
-{
-
+int sangoma_tdm_enable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int poll_in_sec) {
+
int err;
-
+
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_ENABLE_RBS_EVENTS;
- tdm_api->wp_tdm_cmd.rbs_poll = poll_in_sec;
-
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ tdm_api->wp_tdm_cmd.rbs_poll=poll_in_sec;
+
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
@@ -700,180 +719,185 @@
}
-int sangoma_tdm_disable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
-{
+int sangoma_tdm_disable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) {
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_DISABLE_RBS_EVENTS;
-
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
return 0;
}
-int sangoma_tdm_write_rbs(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, unsigned char rbs)
+int sangoma_tdm_write_rbs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char rbs)
{
-
+
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_WRITE_RBS_BITS;
- tdm_api->wp_tdm_cmd.rbs_tx_bits = rbs;
-
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ tdm_api->wp_tdm_cmd.rbs_tx_bits=rbs;
+
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
return 0;
-}
+}
-int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
wp_tdm_api_rx_hdr_t *rx_event;
-#if defined(WIN32)
+#if defined(WIN32)
rx_event = &last_tdm_api_event_buffer;
#else
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_READ_EVENT;
-
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
rx_event = &tdm_api->wp_tdm_cmd.event;
#endif
- switch (rx_event->wp_tdm_api_event_type) {
-
+ switch (rx_event->wp_tdm_api_event_type){
+
case WP_TDM_EVENT_RBS:
- printf("%d: GOT RBS EVENT %p\n", (int) fd, tdm_api->wp_tdm_event.wp_rbs_event);
+ printf("%d: GOT RBS EVENT %p\n",(int)fd,tdm_api->wp_tdm_event.wp_rbs_event);
if (tdm_api->wp_tdm_event.wp_rbs_event) {
- tdm_api->wp_tdm_event.wp_rbs_event(fd, rx_event->wp_tdm_api_event_rbs_rx_bits);
+ tdm_api->wp_tdm_event.wp_rbs_event(fd,rx_event->wp_tdm_api_event_rbs_rx_bits);
}
-
+
break;
-
+
case WP_TDM_EVENT_DTMF:
- printf("%d: GOT DTMF EVENT\n", (int) fd);
+ printf("%d: GOT DTMF EVENT\n",(int)fd);
if (tdm_api->wp_tdm_event.wp_dtmf_event) {
tdm_api->wp_tdm_event.wp_dtmf_event(fd,
- rx_event->wp_tdm_api_event_dtmf_digit,
- rx_event->wp_tdm_api_event_dtmf_type, rx_event->wp_tdm_api_event_dtmf_port);
+ rx_event->wp_tdm_api_event_dtmf_digit,
+ rx_event->wp_tdm_api_event_dtmf_type,
+ rx_event->wp_tdm_api_event_dtmf_port);
}
break;
-
+
case WP_TDM_EVENT_RXHOOK:
- printf("%d: GOT RXHOOK EVENT\n", (int) fd);
+ printf("%d: GOT RXHOOK EVENT\n",(int)fd);
if (tdm_api->wp_tdm_event.wp_rxhook_event) {
- tdm_api->wp_tdm_event.wp_rxhook_event(fd, rx_event->wp_tdm_api_event_rxhook_state);
+ tdm_api->wp_tdm_event.wp_rxhook_event(fd,
+ rx_event->wp_tdm_api_event_rxhook_state);
}
break;
case WP_TDM_EVENT_RING_DETECT:
- printf("%d: GOT RXRING EVENT\n", (int) fd);
+ printf("%d: GOT RXRING EVENT\n",(int)fd);
if (tdm_api->wp_tdm_event.wp_rxring_event) {
- tdm_api->wp_tdm_event.wp_rxring_event(fd, rx_event->wp_tdm_api_event_ring_state);
+ tdm_api->wp_tdm_event.wp_rxring_event(fd,
+ rx_event->wp_tdm_api_event_ring_state);
}
break;
case WP_TDM_EVENT_RING_TRIP:
- printf("%d: GOT RING TRIP EVENT\n", (int) fd);
+ printf("%d: GOT RING TRIP EVENT\n",(int)fd);
if (tdm_api->wp_tdm_event.wp_ringtrip_event) {
- tdm_api->wp_tdm_event.wp_ringtrip_event(fd, rx_event->wp_tdm_api_event_ring_state);
+ tdm_api->wp_tdm_event.wp_ringtrip_event(fd,
+ rx_event->wp_tdm_api_event_ring_state);
}
break;
case WP_TDM_EVENT_FE_ALARM:
- printf("%d: GOT FE ALARMS EVENT %i\n", (int) fd, rx_event->wp_tdm_api_event_fe_alarm);
+ printf("%d: GOT FE ALARMS EVENT %i\n",(int)fd,
+ rx_event->wp_tdm_api_event_fe_alarm);
if (tdm_api->wp_tdm_event.wp_fe_alarm_event) {
- tdm_api->wp_tdm_event.wp_fe_alarm_event(fd, rx_event->wp_tdm_api_event_fe_alarm);
- }
-
+ tdm_api->wp_tdm_event.wp_fe_alarm_event(fd,
+ rx_event->wp_tdm_api_event_fe_alarm);
+ }
+
default:
- printf("%d: Unknown TDM event!", (int) fd);
+ printf("%d: Unknown TDM event!", (int)fd);
break;
}
-
+
return 0;
-}
+}
-int sangoma_tdm_enable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_enable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
int err;
-
+
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_ENABLE_DTMF_EVENTS;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
return 0;
}
-int sangoma_tdm_disable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_disable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_DISABLE_DTMF_EVENTS;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
return 0;
}
-int sangoma_tdm_enable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_enable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
int err;
-
+
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_ENABLE_RM_DTMF_EVENTS;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
return 0;
}
-int sangoma_tdm_disable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_disable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_DISABLE_RM_DTMF_EVENTS;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
return 0;
}
-int sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_ENABLE_RXHOOK_EVENTS;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
return 0;
}
-int sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_DISABLE_RXHOOK_EVENTS;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
@@ -884,18 +908,18 @@
* GET Front End Alarms
*
*/
-int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api)
+int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api)
{
int err;
tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_FE_ALARMS;
- err = sangoma_tdm_cmd_exec(fd, tdm_api);
- if (err) {
+ err=sangoma_tdm_cmd_exec(fd,tdm_api);
+ if (err){
return err;
}
return tdm_api->wp_tdm_cmd.fe_alarms;
-}
+}
#endif /* WANPIPE_TDM_API */
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/libsangoma/libsangoma.h Fri Apr 13 10:44:28 2007
@@ -34,7 +34,7 @@
#ifdef WANPIPE_TDM_API
#include <wanpipe_tdm_api.h> //for TDMV API
#endif
-#include <sang_status_defines.h> //return codes
+#include <sang_status_defines.h>//return codes
#include <sang_api.h> //for IOCTL codes
#include <sdla_te1_pmc.h> //RBS definitions
#include <sdla_te1.h> //TE1 macros
@@ -94,7 +94,7 @@
/* Open Span/Chan devices
* open_tdmapi_span_chan: open device based on span chan values
* sangoma_open_tdmapi_span: open first available device on span
- */
+ */
sng_fd_t sangoma_open_tdmapi_span_chan(int span, int chan);
sng_fd_t sangoma_open_tdmapi_span(int span);
@@ -104,65 +104,68 @@
/* Device Rx/Tx functions
* writemsg_tdm: tx header + data from separate buffers
* readmsg_tdm: rx header + data to separate buffers
- */
-int sangoma_writemsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, unsigned short datalen, int flag);
-int sangoma_readmsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen, void *databuf, int datalen, int flag);
+ */
+int sangoma_writemsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen,
+ void *databuf, unsigned short datalen, int flag);
+int sangoma_readmsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen,
+ void *databuf, int datalen, int flag);
#define sangoma_readmsg_socket sangoma_readmsg_tdm
#define sangoma_sendmsg_socket sangoma_writemsg_tdm
#ifdef WANPIPE_TDM_API
-void sangoma_socket_close(sng_fd_t * sp);
+void sangoma_socket_close(sng_fd_t *sp);
int sangoma_socket_waitfor(sng_fd_t fd, int timeout, int flags);
/* Get Full TDM API configuration per chan */
-int sangoma_get_full_cfg(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_get_full_cfg(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
/* Get/Set TDM Codec per chan */
-int sangoma_tdm_set_codec(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int codec);
-int sangoma_tdm_get_codec(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_set_codec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int codec);
+int sangoma_tdm_get_codec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
/* Get/Set USR Tx/Rx Period in milliseconds */
-int sangoma_tdm_set_usr_period(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int period);
-int sangoma_tdm_get_usr_period(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_set_usr_period(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int period);
+int sangoma_tdm_get_usr_period(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
/* Get user MTU/MRU values in bytes */
-int sangoma_tdm_get_usr_mtu_mru(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_get_usr_mtu_mru(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
/* Not supported yet */
-int sangoma_tdm_set_power_level(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int power);
-int sangoma_tdm_get_power_level(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_set_power_level(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int power);
+int sangoma_tdm_get_power_level(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
/* Flush buffers from current channel */
-int sangoma_tdm_flush_bufs(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_flush_bufs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
-int sangoma_tdm_enable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, int poll_in_sec);
-int sangoma_tdm_disable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_enable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, int poll_in_sec);
+int sangoma_tdm_disable_rbs_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
-int sangoma_tdm_write_rbs(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api, unsigned char rbs);
+int sangoma_tdm_write_rbs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char rbs);
-int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
/* DTMF Detection on Octasic chip */
-int sangoma_tdm_enable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
-int sangoma_tdm_disable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_enable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
+int sangoma_tdm_disable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
/* DTMF Detection on A200 (SLIC) chip */
-int sangoma_tdm_enable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
-int sangoma_tdm_disable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_enable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
+int sangoma_tdm_disable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
/* On/Off hook events on A200 (Analog) card */
-int sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
-int sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
+int sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
-int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
+int sangoma_tdm_cmd_exec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api);
#ifndef LIBSANGOMA_GET_HWCODING
#define LIBSANGOMA_GET_HWCODING 1
#endif
-int sangoma_tdm_get_hw_coding(int fd, wanpipe_tdm_api_t * tdm_api);
+int sangoma_tdm_get_hw_coding(int fd, wanpipe_tdm_api_t *tdm_api);
-#endif /* WANPIPE_TDM_API */
+#endif /* WANPIPE_TDM_API */
#endif
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c Fri Apr 13 10:44:28 2007
@@ -80,8 +80,8 @@
char map[SANGOMA_MAX_CHAN_PER_SPAN][SWITCH_UUID_FORMATTED_LENGTH + 1];
};
-unsigned int txseq = 0;
-unsigned int rxseq = 0;
+unsigned int txseq=0;
+unsigned int rxseq=0;
#define SETUP_LEN CORE_MAX_CHAN_PER_SPAN*CORE_MAX_SPANS+1
@@ -99,7 +99,7 @@
typedef struct ss7boost_handle ss7boost_handle_t;
-static int isup_exec_command(ss7boost_handle_t * ss7boost_handle, int span, int chan, int id, int cmd, int cause);
+static int isup_exec_command(ss7boost_handle_t *ss7boost_handle, int span, int chan, int id, int cmd, int cause);
static struct {
int debug;
@@ -210,38 +210,38 @@
-static int local_sangoma_tdm_read_event(sng_fd_t fd, wp_tdm_api_rx_hdr_t * rx_event)
+static int local_sangoma_tdm_read_event(sng_fd_t fd, wp_tdm_api_rx_hdr_t *rx_event)
{
wanpipe_tdm_api_t tdm_api[1];
-
+
#if defined(WIN32)
- rx_event = &last_tdm_api_event_buffer;
+ rx_event = &last_tdm_api_event_buffer;
#else
- int err;
+ int err;
- tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_READ_EVENT;
+ tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_READ_EVENT;
- if ((err = sangoma_tdm_cmd_exec(fd, tdm_api))) {
- return err;
- }
+ if ((err = sangoma_tdm_cmd_exec(fd, tdm_api))) {
+ return err;
+ }
- rx_event = &tdm_api->wp_tdm_cmd.event;
+ rx_event = &tdm_api->wp_tdm_cmd.event;
#endif
return 0;
}
-static int analog_set_state(analog_channel_t * alc, analog_state_t state)
+static int analog_set_state(analog_channel_t *alc, analog_state_t state)
{
alc->state = state;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Changing State to %d\n", state);
}
-static void analog_check_state(analog_channel_t * alc)
+static void analog_check_state(analog_channel_t *alc)
{
wanpipe_tdm_api_t tdm_api;
- switch (alc->state) {
+ switch(alc->state) {
case ANALOG_STATE_DOWN:
sangoma_tdm_enable_rxhook_events(alc->sock->fd, &tdm_api);
analog_set_state(alc, ANALOG_STATE_ONHOOK);
@@ -251,11 +251,11 @@
}
}
-static void analog_parse_event(analog_channel_t * alc)
+static void analog_parse_event(analog_channel_t *alc)
{
wp_tdm_api_rx_hdr_t rx_event;
int err = local_sangoma_tdm_read_event(alc->sock->fd, &rx_event);
-
+
if (err < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error reading event!\n");
return;
@@ -269,21 +269,21 @@
}
-static void *SWITCH_THREAD_FUNC fxs_thread_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC fxs_thread_run(switch_thread_t *thread, void *obj)
{
- for (;;) {
+ for(;;) {
int i = 0, sel_on = -1;
fd_set oob;
FD_ZERO(&oob);
-
- for (i = 0; i < globals.fxs_index; i++) {
+
+ for(i = 0; i < globals.fxs_index; i++) {
int fd;
assert(FXS_ANALOG_CHANNELS[i]);
assert(FXS_ANALOG_CHANNELS[i]->sock);
fd = FXS_ANALOG_CHANNELS[i]->sock->fd;
-
+
analog_check_state(FXS_ANALOG_CHANNELS[i]);
FD_SET(fd, &oob);
@@ -295,7 +295,7 @@
if (sel_on > -1) {
if (select(++sel_on, NULL, NULL, &oob, NULL)) {
- for (i = 0; i < globals.fxs_index; i++) {
+ for(i = 0; i < globals.fxs_index; i++) {
int fd = FXS_ANALOG_CHANNELS[i]->sock->fd;
if (FD_ISSET(fd, &oob)) {
analog_parse_event(FXS_ANALOG_CHANNELS[i]);
@@ -307,7 +307,7 @@
}
-static int wp_close(private_object_t * tech_pvt)
+static int wp_close(private_object_t *tech_pvt)
{
int ret = 0;
@@ -317,16 +317,16 @@
ret = 1;
}
switch_mutex_unlock(globals.hash_mutex);
-
+
return ret;
}
-static wpsock_t *wp_open(private_object_t * tech_pvt, int span, int chan)
+static wpsock_t *wp_open(private_object_t *tech_pvt, int span, int chan)
{
sng_fd_t fd;
wpsock_t *sock;
char name[25];
-
+
snprintf(name, sizeof(name), "s%dc%d", span, chan);
switch_mutex_lock(globals.hash_mutex);
@@ -364,7 +364,7 @@
wpsock_t *sock;
sng_fd_t fd;
char name[25];
-
+
snprintf(name, sizeof(name), "s%dc%d", span, chan);
switch_mutex_lock(globals.hash_mutex);
@@ -380,7 +380,7 @@
sangoma_socket_close(&fd);
return 0;
}
-
+
return -1;
}
@@ -444,7 +444,7 @@
if (!strcasecmp(dp, "local"))
return PRI_LOCAL_ISDN;
if (!strcasecmp(dp, "private"))
- return PRI_PRIVATE;
+ return PRI_PRIVATE;
if (!strcasecmp(dp, "unknown"))
return PRI_UNKNOWN;
@@ -460,25 +460,26 @@
static switch_status_t wanpipe_on_hangup(switch_core_session_t *session);
static switch_status_t wanpipe_on_loopback(switch_core_session_t *session);
static switch_status_t wanpipe_on_transmit(switch_core_session_t *session);
-static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session,
- switch_caller_profile_t *outbound_profile,
+static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool);
-static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id);
-static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id);
-static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
-static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
-static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
+static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
+ switch_io_flag_t flags, int stream_id);
+static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
+ switch_io_flag_t flags, int stream_id);
+static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
+static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
+static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
static int check_flags(struct sangoma_pri *spri);
-static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
-static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
-static void *SWITCH_THREAD_FUNC pri_thread_run(switch_thread_t * thread, void *obj);
+static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
+static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
+static void *SWITCH_THREAD_FUNC pri_thread_run(switch_thread_t *thread, void *obj);
static switch_status_t config_wanpipe(int reload);
-static switch_status_t wanpipe_codec_init(private_object_t * tech_pvt)
+static switch_status_t wanpipe_codec_init(private_object_t *tech_pvt)
{
int err = 0;
- wanpipe_tdm_api_t tdm_api = { {0} };
+ wanpipe_tdm_api_t tdm_api = {{0}};
unsigned int rate = 8000;
switch_channel_t *channel = NULL;
@@ -491,21 +492,21 @@
assert(channel != NULL);
err = sangoma_tdm_set_codec(tech_pvt->wpsock->fd, &tdm_api, WP_SLINEAR);
-
+
sangoma_tdm_set_usr_period(tech_pvt->wpsock->fd, &tdm_api, globals.samples_per_frame / 8);
tech_pvt->frame_size = sangoma_tdm_get_usr_mtu_mru(tech_pvt->wpsock->fd, &tdm_api);
if (switch_core_codec_init
- (&tech_pvt->read_codec, "L16", NULL, rate, globals.samples_per_frame / 8, 1,
- SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
+ (&tech_pvt->read_codec, "L16", NULL, rate, globals.samples_per_frame / 8, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+ switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set read codec\n", switch_channel_get_name(channel));
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return SWITCH_STATUS_FALSE;
}
if (switch_core_codec_init
- (&tech_pvt->write_codec, "L16", NULL, rate, globals.samples_per_frame / 8, 1,
- SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
+ (&tech_pvt->write_codec, "L16", NULL, rate, globals.samples_per_frame / 8, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+ switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set read codec\n", switch_channel_get_name(channel));
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return SWITCH_STATUS_FALSE;
@@ -515,25 +516,25 @@
switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec);
switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec);
-#ifdef DOTRACE
- tech_pvt->fd = open("/tmp/wp-in.raw", O_WRONLY | O_TRUNC | O_CREAT);
- tech_pvt->fd2 = open("/tmp/wp-out.raw", O_WRONLY | O_TRUNC | O_CREAT);
+#ifdef DOTRACE
+ tech_pvt->fd = open("/tmp/wp-in.raw", O_WRONLY | O_TRUNC | O_CREAT);
+ tech_pvt->fd2 = open("/tmp/wp-out.raw", O_WRONLY | O_TRUNC | O_CREAT);
#endif
/* Setup artificial DTMF stuff */
memset(&tech_pvt->tone_session, 0, sizeof(tech_pvt->tone_session));
teletone_init_session(&tech_pvt->tone_session, 1024, NULL, NULL);
-
+
if (globals.debug) {
tech_pvt->tone_session.debug = globals.debug;
tech_pvt->tone_session.debug_stream = stdout;
}
-
+
tech_pvt->tone_session.rate = rate;
tech_pvt->tone_session.duration = globals.dtmf_on * (tech_pvt->tone_session.rate / 1000);
tech_pvt->tone_session.wait = globals.dtmf_off * (tech_pvt->tone_session.rate / 1000);
-
- teletone_dtmf_detect_init(&tech_pvt->dtmf_detect, rate);
+
+ teletone_dtmf_detect_init (&tech_pvt->dtmf_detect, rate);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio init %s\n", switch_channel_get_name(channel));
switch_set_flag(tech_pvt, TFLAG_CODEC);
@@ -562,46 +563,46 @@
tech_pvt->read_frame.data = tech_pvt->databuf;
- if (tech_pvt->ss7boost_handle) {
+ if (tech_pvt->ss7boost_handle) {
if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
ss7boost_client_event_t event;
event.calling_number_presentation = tech_pvt->boost_pres;
event.trunk_group = tech_pvt->boost_trunk_group;
-
+
switch_mutex_lock(tech_pvt->ss7boost_handle->mutex);
tech_pvt->setup_index = ++tech_pvt->ss7boost_handle->setup_index;
if (tech_pvt->ss7boost_handle->setup_index == SETUP_LEN - 1) {
tech_pvt->ss7boost_handle->setup_index = 0;
}
switch_mutex_unlock(tech_pvt->ss7boost_handle->mutex);
-
+
switch_copy_string(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index],
- switch_core_session_get_uuid(session), sizeof(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index]));
-
-
- ss7boost_client_call_init(&event, tech_pvt->caller_profile->caller_id_number, tech_pvt->caller_profile->destination_number,
- tech_pvt->setup_index);
-
+ switch_core_session_get_uuid(session),
+ sizeof(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index]));
+
+
+ ss7boost_client_call_init(&event, tech_pvt->caller_profile->caller_id_number, tech_pvt->caller_profile->destination_number, tech_pvt->setup_index);
+
if (ss7boost_client_connection_write(&tech_pvt->ss7boost_handle->mcon, &event) <= 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Critical System Error: Failed to tx on ISUP socket [%s]\n", strerror(errno));
}
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call Called Event TG=%d\n", tech_pvt->boost_trunk_group);
goto done;
}
- }
+ }
if ((status = wanpipe_codec_init(tech_pvt)) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return status;
}
-
+
if (switch_test_flag(tech_pvt, TFLAG_NOSIG)) {
switch_channel_mark_answered(channel);
}
- done:
+ done:
/* Move Channel's State Machine to RING */
switch_channel_set_state(channel, CS_RING);
@@ -621,7 +622,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WANPIPE RING\n");
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -632,7 +633,7 @@
switch_channel_t *channel = NULL;
struct channel_map *chanmap = NULL;
-
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -655,20 +656,24 @@
switch_mutex_unlock(tech_pvt->ss7boost_handle->mutex);
if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
isup_exec_command(tech_pvt->ss7boost_handle,
- tech_pvt->boost_span_number, tech_pvt->boost_chan_number, -1, SIGBOOST_EVENT_CALL_STOPPED, SIGBOOST_RELEASE_CAUSE_NORMAL);
+ tech_pvt->boost_span_number,
+ tech_pvt->boost_chan_number,
+ -1,
+ SIGBOOST_EVENT_CALL_STOPPED,
+ SIGBOOST_RELEASE_CAUSE_NORMAL);
}
} else if (tech_pvt->spri) {
chanmap = tech_pvt->spri->private_info;
- if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
+ //if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
pri_hangup(tech_pvt->spri->pri, tech_pvt->call, switch_channel_get_cause(channel));
pri_destroycall(tech_pvt->spri->pri, tech_pvt->call);
- }
+ //}
switch_mutex_lock(globals.channel_mutex);
*chanmap->map[tech_pvt->callno] = '\0';
switch_mutex_unlock(globals.channel_mutex);
-
+
}
switch_set_flag_locked(tech_pvt, TFLAG_BYE);
@@ -676,7 +681,7 @@
teletone_destroy_session(&tech_pvt->tone_session);
switch_buffer_destroy(&tech_pvt->dtmf_buffer);
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -720,7 +725,12 @@
pri_answer(tech_pvt->spri->pri, tech_pvt->call, 0, 1);
}
} else if (tech_pvt->ss7boost_handle) {
- isup_exec_command(tech_pvt->ss7boost_handle, tech_pvt->boost_span_number, tech_pvt->boost_chan_number, -1, SIGBOOST_EVENT_CALL_ANSWERED, 0);
+ isup_exec_command(tech_pvt->ss7boost_handle,
+ tech_pvt->boost_span_number,
+ tech_pvt->boost_chan_number,
+ -1,
+ SIGBOOST_EVENT_CALL_ANSWERED,
+ 0);
}
return SWITCH_STATUS_SUCCESS;
@@ -728,7 +738,8 @@
-static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
+static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
+ switch_io_flag_t flags, int stream_id)
{
private_object_t *tech_pvt;
switch_channel_t *channel = NULL;
@@ -761,7 +772,8 @@
}
if ((bread = sangoma_readmsg_socket(tech_pvt->wpsock->fd,
- &tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), bp, sizeof(tech_pvt->databuf) - bytes, 0)) < 0) {
+ &tech_pvt->hdrframe,
+ sizeof(tech_pvt->hdrframe), bp, sizeof(tech_pvt->databuf) - bytes, 0)) < 0) {
if (errno == EBUSY) {
continue;
} else {
@@ -780,10 +792,10 @@
tech_pvt->read_frame.datalen = bytes;
tech_pvt->read_frame.samples = bytes / 2;
- teletone_dtmf_detect(&tech_pvt->dtmf_detect, tech_pvt->read_frame.data, tech_pvt->read_frame.samples);
+ teletone_dtmf_detect (&tech_pvt->dtmf_detect, tech_pvt->read_frame.data, tech_pvt->read_frame.samples);
teletone_dtmf_get(&tech_pvt->dtmf_detect, digit_str, sizeof(digit_str));
-
- if (digit_str[0]) {
+
+ if(digit_str[0]) {
switch_channel_queue_dtmf(channel, digit_str);
if (globals.debug) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF DETECTED: [%s]\n", digit_str);
@@ -797,7 +809,8 @@
memset(tech_pvt->read_frame.data, 0, tech_pvt->read_frame.datalen);
tech_pvt->skip_read_frames--;
}
-#ifdef DOTRACE
+
+#ifdef DOTRACE
write(tech_pvt->fd2, tech_pvt->read_frame.data, (int) tech_pvt->read_frame.datalen);
#endif
//printf("read %d\n", tech_pvt->read_frame.datalen);
@@ -805,7 +818,8 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
+static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
+ switch_io_flag_t flags, int stream_id)
{
private_object_t *tech_pvt;
uint32_t dtmf_blen;
@@ -822,24 +836,25 @@
if (tech_pvt->dtmf_buffer && (dtmf_blen = switch_buffer_inuse(tech_pvt->dtmf_buffer))) {
uint32_t len = dtmf_blen > frame->datalen ? frame->datalen : dtmf_blen;
- switch_buffer_read(tech_pvt->dtmf_buffer, tech_pvt->auxbuf, len);
+ switch_buffer_read(tech_pvt->dtmf_buffer, tech_pvt->auxbuf, len);
if (len < frame->datalen) {
uint8_t *data = frame->data;
memcpy(data + len, tech_pvt->auxbuf + len, frame->datalen - len);
}
- data = tech_pvt->auxbuf;
- }
-
+ data= tech_pvt->auxbuf;
+ }
+
if (tech_pvt->skip_write_frames) {
tech_pvt->skip_write_frames--;
return SWITCH_STATUS_SUCCESS;
}
+
#ifdef DOTRACE
write(tech_pvt->fd, data, frame->datalen);
#endif
result = sangoma_sendmsg_socket(tech_pvt->wpsock->fd, &tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), data, frame->datalen, 0);
-
+
if (result < 0 && errno != EBUSY) {
return SWITCH_STATUS_GENERR;
}
@@ -871,13 +886,13 @@
}
}
for (cur = digits; *cur; cur++) {
- if ((wrote = teletone_mux_tones(&tech_pvt->tone_session, &tech_pvt->tone_session.TONES[(int) *cur]))) {
+ if ((wrote = teletone_mux_tones(&tech_pvt->tone_session, &tech_pvt->tone_session.TONES[(int)*cur]))) {
switch_buffer_write(tech_pvt->dtmf_buffer, tech_pvt->tone_session.buffer, wrote * 2);
}
}
tech_pvt->skip_read_frames = 200;
-
+
return status;
}
@@ -888,7 +903,7 @@
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
-
+
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
assert(tech_pvt != NULL);
@@ -930,7 +945,7 @@
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
- switch (sig) {
+ switch(sig) {
case SWITCH_SIG_KILL:
switch_clear_flag_locked(tech_pvt, TFLAG_MEDIA);
break;
@@ -953,8 +968,8 @@
/*.kill_channel */ wanpipe_kill_channel,
/*.waitfor_read */ NULL,
/*.waitfor_read */ NULL,
- /*.send_dtmf */ wanpipe_send_dtmf,
- /*.receive_message */ wanpipe_receive_message
+ /*.send_dtmf*/ wanpipe_send_dtmf,
+ /*.receive_message*/ wanpipe_receive_message
};
static const switch_state_handler_table_t wanpipe_state_handlers = {
@@ -984,8 +999,7 @@
};
-static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session,
- switch_caller_profile_t *outbound_profile,
+static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool)
{
char *bchan = NULL;
@@ -994,7 +1008,7 @@
char *dest;
int ready = 0, is_pri = 0, is_boost = 0, is_raw = 0;
switch_call_cause_t cause = SWITCH_CAUSE_SUCCESS;
-
+
if (!outbound_profile) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh! no caller profile\n");
cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
@@ -1008,7 +1022,7 @@
cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
goto error;
}
-
+
*dest++ = '\0';
if (!strcasecmp(protocol, "raw")) {
@@ -1027,7 +1041,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error No SS7BOOST Spans Configured.\n");
}
}
-
+
if (!ready) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Continue!\n");
cause = SWITCH_CAUSE_NETWORK_OUT_OF_ORDER;
@@ -1061,7 +1075,7 @@
goto error;
}
-
+
caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
if (is_pri) {
@@ -1124,7 +1138,7 @@
}
switch_set_flag_locked(tech_pvt, TFLAG_NOSIG);
snprintf(name, sizeof(name), "wanpipe/%s/nosig", bchan);
- switch_channel_set_name(channel, name);
+ switch_channel_set_name(channel, name);
switch_channel_set_caller_profile(channel, caller_profile);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid address\n");
@@ -1146,18 +1160,18 @@
if (SPANS[span] && (spri = &SPANS[span]->spri) && switch_test_flag(spri, SANGOMA_PRI_READY)) {
chanmap = spri->private_info;
-
+
if (autochan > 0) {
- for (callno = 1; callno < SANGOMA_MAX_CHAN_PER_SPAN; callno++) {
- if ((SPANS[span]->bchans & (1 << callno)) && !*chanmap->map[callno]) {
+ for(callno = 1; callno < SANGOMA_MAX_CHAN_PER_SPAN; callno++) {
+ if ((SPANS[span]->bchans & (1 << callno)) && ! *chanmap->map[callno]) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel s%dc%d\n", span, callno);
goto done;
}
}
callno = 0;
} else if (autochan < 0) {
- for (callno = SANGOMA_MAX_CHAN_PER_SPAN; callno > 0; callno--) {
- if ((SPANS[span]->bchans & (1 << callno)) && !*chanmap->map[callno]) {
+ for(callno = SANGOMA_MAX_CHAN_PER_SPAN; callno > 0; callno--) {
+ if ((SPANS[span]->bchans & (1 << callno)) && ! *chanmap->map[callno]) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel s%dc%d\n", span, callno);
goto done;
}
@@ -1172,7 +1186,7 @@
span--;
}
}
- done:
+ done:
switch_mutex_unlock(globals.channel_mutex);
if (!spri || callno == 0 || callno == (SANGOMA_MAX_CHAN_PER_SPAN)) {
@@ -1181,26 +1195,31 @@
cause = SWITCH_CAUSE_SWITCH_CONGESTION;
goto error;
}
-
+
tech_pvt->callno = callno;
-
+
if (spri && (tech_pvt->call = pri_new_call(spri->pri))) {
struct pri_sr *sr;
-
+
snprintf(name, sizeof(name), "wanpipe/pri/s%dc%d/%s", spri->span, callno, caller_profile->destination_number);
- switch_channel_set_name(channel, name);
+ switch_channel_set_name(channel, name);
switch_channel_set_caller_profile(channel, caller_profile);
sr = pri_sr_new();
pri_sr_set_channel(sr, callno, 0, 0);
pri_sr_set_bearer(sr, 0, SPANS[span]->l1);
pri_sr_set_called(sr, caller_profile->destination_number, SPANS[span]->dp, 1);
pri_sr_set_caller(sr,
- caller_profile->caller_id_number, caller_profile->caller_id_name, SPANS[span]->dp,
+ caller_profile->caller_id_number,
+ caller_profile->caller_id_name,
+ SPANS[span]->dp,
PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
- pri_sr_set_redirecting(sr, caller_profile->caller_id_number, SPANS[span]->dp, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN,
+ pri_sr_set_redirecting(sr,
+ caller_profile->caller_id_number,
+ SPANS[span]->dp,
+ PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN,
PRI_REDIR_UNCONDITIONAL);
-
- if (pri_setup(spri->pri, tech_pvt->call, sr)) {
+
+ if (pri_setup(spri->pri, tech_pvt->call , sr)) {
switch_core_session_destroy(new_session);
pri_sr_free(sr);
cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
@@ -1215,7 +1234,9 @@
goto error;
}
pri_sr_free(sr);
- switch_copy_string(chanmap->map[callno], switch_core_session_get_uuid(*new_session), sizeof(chanmap->map[callno]));
+ switch_copy_string(chanmap->map[callno],
+ switch_core_session_get_uuid(*new_session),
+ sizeof(chanmap->map[callno]));
tech_pvt->spri = spri;
}
} else if (is_boost) {
@@ -1224,8 +1245,8 @@
if ((p = strchr(caller_profile->destination_number, '/'))) {
char *grp = caller_profile->destination_number;
*p = '\0';
- caller_profile->destination_number = p + 1;
- tech_pvt->boost_trunk_group = atoi(grp + 1) - 1;
+ caller_profile->destination_number = p+1;
+ tech_pvt->boost_trunk_group = atoi(grp+1) - 1;
if (tech_pvt->boost_trunk_group < 0) {
tech_pvt->boost_trunk_group = 0;
}
@@ -1248,7 +1269,7 @@
cause = SWITCH_CAUSE_SUCCESS;
}
- error:
+ error:
switch_safe_free(protocol);
return cause;
}
@@ -1310,7 +1331,7 @@
/*event Handlers */
-static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
+static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "number is: %s\n", pevent->ring.callednum);
if (strlen(pevent->ring.callednum) > 3) {
@@ -1320,7 +1341,7 @@
return 0;
}
-static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
+static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
{
struct channel_map *chanmap;
switch_core_session_t *session;
@@ -1343,7 +1364,7 @@
tech_pvt->cause = pevent->hangup.cause;
switch_set_flag_locked(tech_pvt, TFLAG_BYE);
switch_channel_hangup(channel, tech_pvt->cause);
-
+
switch_mutex_lock(globals.channel_mutex);
*chanmap->map[pevent->hangup.channel] = '\0';
switch_mutex_unlock(globals.channel_mutex);
@@ -1355,7 +1376,7 @@
return 0;
}
-static int on_answer(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
+static int on_answer(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
{
switch_core_session_t *session;
switch_channel_t *channel;
@@ -1373,12 +1394,12 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Answer on channel s%dc%d but it's not in use?\n", spri->span, pevent->answer.channel);
}
-
+
return 0;
}
-static int on_proceed(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
+static int on_proceed(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
{
switch_core_session_t *session;
switch_channel_t *channel;
@@ -1390,10 +1411,10 @@
switch_core_session_message_t *msg;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d\n", spri->span, pevent->proceeding.channel);
-
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
-
+
if ((msg = malloc(sizeof(*msg)))) {
memset(msg, 0, sizeof(*msg));
msg->message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;
@@ -1404,18 +1425,18 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
}
-
+
switch_core_session_rwunlock(session);
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
- "-- Proceeding on channel s%dc%d but it's not in use?\n", spri->span, pevent->proceeding.channel);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d but it's not in use?\n",
+ spri->span, pevent->proceeding.channel);
}
return 0;
}
-static int on_ringing(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
+static int on_ringing(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
{
switch_core_session_t *session;
switch_channel_t *channel;
@@ -1434,35 +1455,34 @@
switch_core_session_rwunlock(session);
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
- "-- Ringing on channel s%dc%d %s but it's not in use?\n", spri->span, pevent->ringing.channel,
- chanmap->map[pevent->ringing.channel]);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Ringing on channel s%dc%d %s but it's not in use?\n", spri->span, pevent->ringing.channel, chanmap->map[pevent->ringing.channel]);
}
return 0;
}
-static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
+static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
{
char name[128];
switch_core_session_t *session;
switch_channel_t *channel;
struct channel_map *chanmap;
int ret = 0;
-
+
switch_mutex_lock(globals.channel_mutex);
chanmap = spri->private_info;
if (switch_core_session_locate(chanmap->map[pevent->ring.channel])) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--Duplicate Ring on channel s%dc%d (ignored)\n", spri->span, pevent->ring.channel);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--Duplicate Ring on channel s%dc%d (ignored)\n",
+ spri->span, pevent->ring.channel);
switch_core_session_rwunlock(session);
ret = 0;
goto done;
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Ring on channel s%dc%d (from %s to %s)\n", spri->span,
- pevent->ring.channel, pevent->ring.callingnum, pevent->ring.callednum);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Ring on channel s%dc%d (from %s to %s)\n", spri->span, pevent->ring.channel,
+ pevent->ring.callingnum, pevent->ring.callednum);
pri_proceeding(spri->pri, pevent->ring.call, pevent->ring.channel, 0);
@@ -1494,14 +1514,21 @@
}
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
- NULL, globals.dialplan, "FreeSWITCH", pevent->ring.callingnum,
+ NULL,
+ globals.dialplan,
+ "FreeSWITCH",
+ pevent->ring.callingnum,
#ifdef WIN32
NULL,
#else
pevent->ring.callingani,
#endif
switch_strlen_zero(ani2str) ? NULL : ani2str,
- NULL, NULL, (char *) modname, NULL, pevent->ring.callednum))) {
+ NULL,
+ NULL,
+ (char *)modname,
+ NULL,
+ pevent->ring.callednum))) {
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
}
@@ -1512,7 +1539,7 @@
if (!tech_pvt->call) {
tech_pvt->call = pevent->ring.call;
}
-
+
tech_pvt->callno = pevent->ring.channel;
tech_pvt->span = spri->span;
@@ -1521,16 +1548,16 @@
}
switch_copy_string(chanmap->map[pevent->ring.channel], switch_core_session_get_uuid(session), sizeof(chanmap->map[pevent->ring.channel]));
-
+
switch_channel_set_state(channel, CS_INIT);
switch_core_session_thread_launch(session);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create new Inbound Channel!\n");
}
- done:
+ done:
switch_mutex_unlock(globals.channel_mutex);
-
+
return ret;
}
@@ -1540,7 +1567,7 @@
return 0;
}
-static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
+static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
{
switch_core_session_t *session;
struct channel_map *chanmap;
@@ -1554,7 +1581,7 @@
chanmap = spri->private_info;
-
+
if ((session = switch_core_session_locate(chanmap->map[pevent->restart.channel]))) {
switch_channel_t *channel;
channel = switch_core_session_get_channel(session);
@@ -1562,13 +1589,13 @@
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
switch_core_session_rwunlock(session);
}
-
+
wp_restart(spri->span, pevent->restart.channel);
return 0;
}
-static int on_dchan_up(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
+static int on_dchan_up(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
{
if (!switch_test_flag(spri, SANGOMA_PRI_READY)) {
@@ -1579,26 +1606,27 @@
return 0;
}
-static int on_dchan_down(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
+static int on_dchan_down(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
{
if (switch_test_flag(spri, SANGOMA_PRI_READY)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Span %d D-Chan DOWN!\n", spri->span);
switch_clear_flag(spri, SANGOMA_PRI_READY);
}
-
+
return 0;
}
-static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
+static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span, event_type, sangoma_pri_event_str(event_type));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span, event_type,
+ sangoma_pri_event_str(event_type));
return 0;
}
-static void *SWITCH_THREAD_FUNC pri_thread_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC pri_thread_run(switch_thread_t *thread, void *obj)
{
struct sangoma_pri *spri = obj;
struct channel_map chanmap;
@@ -1637,7 +1665,7 @@
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
-
+
switch_threadattr_create(&thd_attr, module_pool);
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -1646,7 +1674,7 @@
}
-static int isup_exec_command(ss7boost_handle_t * ss7boost_handle, int span, int chan, int id, int cmd, int cause)
+static int isup_exec_command(ss7boost_handle_t *ss7boost_handle, int span, int chan, int id, int cmd, int cause)
{
ss7boost_client_event_t oevent;
int r = 0;
@@ -1654,12 +1682,12 @@
switch_mutex_lock(ss7boost_handle->mutex);
ss7boost_client_event_init(&oevent, cmd, chan, span);
oevent.release_cause = cause;
-
+
if (id >= 0) {
oevent.call_setup_id = id;
}
-
- if (ss7boost_client_connection_write(&ss7boost_handle->mcon, &oevent) <= 0) {
+
+ if (ss7boost_client_connection_write(&ss7boost_handle->mcon, &oevent) <= 0){
r = -1;
}
@@ -1671,26 +1699,26 @@
#ifdef USE_WAITFOR_SOCKET
static int waitfor_socket(int fd, int timeout, int flags)
{
- struct pollfd pfds[1];
- int res;
-
- memset(&pfds[0], 0, sizeof(pfds[0]));
- pfds[0].fd = fd;
- pfds[0].events = flags;
- res = poll(pfds, 1, timeout);
-
- if (res > 0) {
- if (pfds[0].revents & POLLIN) {
- res = 1;
- } else if ((pfds[0].revents & POLLERR)) {
- res = -1;
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "System Error: Poll Event Error no event!\n");
- res = -1;
- }
+ struct pollfd pfds[1];
+ int res;
+
+ memset(&pfds[0], 0, sizeof(pfds[0]));
+ pfds[0].fd = fd;
+ pfds[0].events = flags;
+ res = poll(pfds, 1, timeout);
+
+ if (res > 0) {
+ if(pfds[0].revents & POLLIN) {
+ res = 1;
+ } else if ((pfds[0].revents & POLLERR)) {
+ res = -1;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"System Error: Poll Event Error no event!\n");
+ res = -1;
}
+ }
- return res;
+ return res;
}
#endif
@@ -1708,7 +1736,7 @@
}
-static void handle_call_stop(ss7boost_handle_t * ss7boost_handle, ss7boost_client_event_t * event)
+static void handle_call_stop(ss7boost_handle_t *ss7boost_handle, ss7boost_client_event_t *event)
{
char *uuid = ss7boost_handle->span_chanmap[event->span].map[event->chan];
@@ -1718,7 +1746,7 @@
if ((session = switch_core_session_locate(uuid))) {
private_object_t *tech_pvt;
switch_channel_t *channel;
-
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -1730,25 +1758,35 @@
}
*uuid = '\0';
- }
+ }
- isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_STOPPED_ACK, 0);
+ isup_exec_command(ss7boost_handle,
+ event->span,
+ event->chan,
+ -1,
+ SIGBOOST_EVENT_CALL_STOPPED_ACK,
+ 0);
}
-static void handle_call_start(ss7boost_handle_t * ss7boost_handle, ss7boost_client_event_t * event)
+static void handle_call_start(ss7boost_handle_t *ss7boost_handle, ss7boost_client_event_t *event)
{
switch_core_session_t *session = NULL;
switch_channel_t *channel = NULL;
char name[128];
if (*ss7boost_handle->span_chanmap[event->span].map[event->chan]) {
- isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_START_NACK, SIGBOOST_RELEASE_CAUSE_BUSY);
+ isup_exec_command(ss7boost_handle,
+ event->span,
+ event->chan,
+ -1,
+ SIGBOOST_EVENT_CALL_START_NACK,
+ SIGBOOST_RELEASE_CAUSE_BUSY);
return;
}
-
+
if ((session = switch_core_session_request(&wanpipe_endpoint_interface, NULL))) {
private_object_t *tech_pvt;
@@ -1758,7 +1796,7 @@
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
channel = switch_core_session_get_channel(session);
switch_core_session_set_private(session, tech_pvt);
- sprintf(name, "wanpipe/ss7boost/s%dc%d", event->span + 1, event->chan + 1);
+ sprintf(name, "wanpipe/ss7boost/s%dc%d", event->span+1, event->chan+1);
switch_channel_set_name(channel, name);
tech_pvt->session = session;
} else {
@@ -1768,13 +1806,21 @@
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
- NULL, globals.dialplan, "FreeSWITCH(boost)", (char *) event->calling_number_digits,
+ NULL,
+ globals.dialplan,
+ "FreeSWITCH(boost)",
+ (char *)event->calling_number_digits,
#ifdef WIN32
NULL,
#else
- (char *) event->calling_number_digits,
+ (char *)event->calling_number_digits,
#endif
- NULL, NULL, NULL, (char *) modname, NULL, (char *) event->called_number_digits))) {
+ NULL,
+ NULL,
+ NULL,
+ (char *)modname,
+ NULL,
+ (char *)event->called_number_digits))) {
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
}
@@ -1786,73 +1832,88 @@
tech_pvt->boost_span_number = event->span;
tech_pvt->boost_chan_number = event->chan;
tech_pvt->boost_pres = event->calling_number_presentation;
-
- if (!wp_open(tech_pvt, event->span + 1, event->chan + 1)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open channel %d:%d\n", event->span + 1, event->chan + 1);
+
+ if (!wp_open(tech_pvt, event->span+1, event->chan+1)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open channel %d:%d\n", event->span+1, event->chan+1);
goto fail;
}
- switch_copy_string(ss7boost_handle->span_chanmap[event->span].map[event->chan],
- switch_core_session_get_uuid(session), sizeof(ss7boost_handle->span_chanmap[event->span].map[event->chan]));
-
+ switch_copy_string(ss7boost_handle->span_chanmap[event->span].map[event->chan], switch_core_session_get_uuid(session),
+ sizeof(ss7boost_handle->span_chanmap[event->span].map[event->chan]));
+
switch_channel_set_state(channel, CS_INIT);
- isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_START_ACK, 0);
+ isup_exec_command(ss7boost_handle,
+ event->span,
+ event->chan,
+ -1,
+ SIGBOOST_EVENT_CALL_START_ACK,
+ 0);
switch_core_session_thread_launch(session);
return;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create new Inbound Channel!\n");
}
-
- fail:
+
+ fail:
if (session) {
switch_core_session_destroy(&session);
}
- isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_STOPPED, SIGBOOST_RELEASE_CAUSE_BUSY);
+ isup_exec_command(ss7boost_handle,
+ event->span,
+ event->chan,
+ -1,
+ SIGBOOST_EVENT_CALL_STOPPED,
+ SIGBOOST_RELEASE_CAUSE_BUSY);
}
-static void handle_heartbeat(ss7boost_handle_t * ss7boost_handle, ss7boost_client_event_t * event)
+static void handle_heartbeat(ss7boost_handle_t *ss7boost_handle, ss7boost_client_event_t *event)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Heartbeat!\n");
- isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_HEARTBEAT, 0);
+ isup_exec_command(ss7boost_handle,
+ event->span,
+ event->chan,
+ -1,
+ SIGBOOST_EVENT_HEARTBEAT,
+ 0);
}
-static void handle_call_start_ack(ss7boost_handle_t * ss7boost_handle, ss7boost_client_event_t * event)
+static void handle_call_start_ack(ss7boost_handle_t *ss7boost_handle, ss7boost_client_event_t *event)
{
char *uuid = ss7boost_handle->setup_array[event->call_setup_id];
-
+
if (*uuid) {
switch_core_session_t *session;
if ((session = switch_core_session_locate(uuid))) {
private_object_t *tech_pvt;
switch_channel_t *channel;
-
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
-
+
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
-
+
tech_pvt->ss7boost_handle = ss7boost_handle;
tech_pvt->boost_span_number = event->span;
tech_pvt->boost_chan_number = event->chan;
-
- switch_copy_string(ss7boost_handle->span_chanmap[event->span].map[event->chan],
- switch_core_session_get_uuid(session), sizeof(ss7boost_handle->span_chanmap[event->span].map[event->chan]));
+
+ switch_copy_string(ss7boost_handle->span_chanmap[event->span].map[event->chan], switch_core_session_get_uuid(session),
+ sizeof(ss7boost_handle->span_chanmap[event->span].map[event->chan]));
if (!tech_pvt->wpsock) {
- if (!wp_open(tech_pvt, tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n",
- tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1, strerror(errno));
+ if (!wp_open(tech_pvt, tech_pvt->boost_span_number+1, tech_pvt->boost_chan_number+1)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n",
+ tech_pvt->boost_span_number+1, tech_pvt->boost_chan_number+1, strerror(errno));
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return;
}
@@ -1863,29 +1924,29 @@
}
switch_channel_mark_pre_answered(channel);
-
+
switch_core_session_rwunlock(session);
}
*uuid = '\0';
}
}
-static void handle_call_start_nack_ack(ss7boost_handle_t * ss7boost_handle, ss7boost_client_event_t * event)
+static void handle_call_start_nack_ack(ss7boost_handle_t *ss7boost_handle, ss7boost_client_event_t *event)
{
// WTF IS THIS! ?
}
-static void handle_call_answer(ss7boost_handle_t * ss7boost_handle, ss7boost_client_event_t * event)
+static void handle_call_answer(ss7boost_handle_t *ss7boost_handle, ss7boost_client_event_t *event)
{
char *uuid = ss7boost_handle->span_chanmap[event->span].map[event->chan];
if (*uuid) {
switch_core_session_t *session;
-
+
if ((session = switch_core_session_locate(uuid))) {
private_object_t *tech_pvt;
switch_channel_t *channel;
-
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -1893,9 +1954,9 @@
assert(tech_pvt != NULL);
if (!tech_pvt->wpsock) {
- if (!wp_open(tech_pvt, tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n",
- tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1, strerror(errno));
+ if (!wp_open(tech_pvt, tech_pvt->boost_span_number+1, tech_pvt->boost_chan_number+1)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n",
+ tech_pvt->boost_span_number+1, tech_pvt->boost_chan_number+1, strerror(errno));
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return;
}
@@ -1904,7 +1965,7 @@
return;
}
}
-
+
switch_channel_mark_answered(channel);
switch_core_session_rwunlock(session);
} else {
@@ -1917,36 +1978,41 @@
}
}
-static void handle_call_stop_ack(ss7boost_handle_t * ss7boost_handle, ss7boost_client_event_t * event)
+static void handle_call_stop_ack(ss7boost_handle_t *ss7boost_handle, ss7boost_client_event_t *event)
{
// TODO anything here?
}
-static void handle_call_start_nack(ss7boost_handle_t * ss7boost_handle, ss7boost_client_event_t * event)
+static void handle_call_start_nack(ss7boost_handle_t *ss7boost_handle, ss7boost_client_event_t *event)
{
char *uuid = ss7boost_handle->setup_array[event->call_setup_id];
-
+
if (*uuid) {
switch_core_session_t *session;
if ((session = switch_core_session_locate(uuid))) {
private_object_t *tech_pvt;
switch_channel_t *channel;
-
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
-
+
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
-
+
tech_pvt->ss7boost_handle = ss7boost_handle;
tech_pvt->boost_span_number = event->span;
tech_pvt->boost_chan_number = event->chan;
-
+
switch_channel_hangup(channel, event->release_cause);
-
- isup_exec_command(ss7boost_handle, event->span, event->chan, event->call_setup_id, SIGBOOST_EVENT_CALL_START_NACK_ACK, 0);
+
+ isup_exec_command(ss7boost_handle,
+ event->span,
+ event->chan,
+ event->call_setup_id,
+ SIGBOOST_EVENT_CALL_START_NACK_ACK,
+ 0);
switch_core_session_rwunlock(session);
} else {
@@ -1956,14 +2022,14 @@
}
}
-static int parse_ss7_event(ss7boost_handle_t * ss7boost_handle, ss7boost_client_event_t * event)
+static int parse_ss7_event(ss7boost_handle_t *ss7boost_handle, ss7boost_client_event_t *event)
{
int ret = 0;
switch_mutex_lock(ss7boost_handle->mutex);
-
- validate_number((unsigned char *) event->called_number_digits);
- validate_number((unsigned char *) event->calling_number_digits);
+
+ validate_number((unsigned char*)event->called_number_digits);
+ validate_number((unsigned char*)event->calling_number_digits);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"\nRX EVENT\n"
@@ -1982,16 +2048,21 @@
"\n",
ss7boost_client_event_id_name(event->event_id),
event->event_id,
- event->span + 1,
- event->chan + 1,
+ event->span+1,
+ event->chan+1,
(event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"),
(event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A"),
- switch_channel_cause2str(event->release_cause), event->span + 1, event->chan + 1, event->event_id, event->call_setup_id,
- event->seqno);
-
-
- switch (event->event_id) {
+ switch_channel_cause2str(event->release_cause),
+ event->span+1,
+ event->chan+1,
+ event->event_id,
+ event->call_setup_id,
+ event->seqno
+ );
+
+ switch(event->event_id) {
+
case SIGBOOST_EVENT_CALL_START:
handle_call_start(ss7boost_handle, event);
break;
@@ -2017,7 +2088,7 @@
handle_call_stop_ack(ss7boost_handle, event);
break;
default:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Warning no handler implemented for [%s]\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Warning no handler implemented for [%s]\n",
ss7boost_client_event_id_name(event->event_id));
break;
}
@@ -2025,40 +2096,48 @@
return ret;
}
-static void *SWITCH_THREAD_FUNC boost_thread_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC boost_thread_run(switch_thread_t *thread, void *obj)
{
ss7boost_handle_t *ss7boost_handle = (ss7boost_handle_t *) obj;
ss7boost_client_event_t *event;
if (ss7boost_client_connection_open(&ss7boost_handle->mcon,
- ss7boost_handle->local_ip,
- ss7boost_handle->local_port,
- ss7boost_handle->remote_ip, ss7boost_handle->remote_port, module_pool) != SWITCH_STATUS_SUCCESS) {
+ ss7boost_handle->local_ip,
+ ss7boost_handle->local_port,
+ ss7boost_handle->remote_ip,
+ ss7boost_handle->remote_port,
+ module_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FATAL ERROR CREATING CLIENT CONNECTION\n");
return NULL;
}
-
- isup_exec_command(ss7boost_handle, 0, 0, -1, SIGBOOST_EVENT_SYSTEM_RESTART, 0);
-
-
+
+ isup_exec_command(ss7boost_handle,
+ 0,
+ 0,
+ -1,
+ SIGBOOST_EVENT_SYSTEM_RESTART,
+ 0);
+
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Monitor Thread Started\n");
-
+
switch_mutex_lock(globals.hash_mutex);
globals.configured_boost_spans++;
switch_mutex_unlock(globals.hash_mutex);
globals.ss7boost_handle = ss7boost_handle;
-
- for (;;) {
+
+ for(;;) {
if (ss7boost_client_connection_read(&ss7boost_handle->mcon, &event) == SWITCH_STATUS_SUCCESS) {
- struct timeval current;
- struct timeval difftime;
- gettimeofday(¤t, NULL);
- timersub(¤t, &event->tv, &difftime);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket Event [%s] T=%d:%d\n",
- ss7boost_client_event_id_name(event->event_id), (int) difftime.tv_sec, (int) difftime.tv_usec);
-
- parse_ss7_event(ss7boost_handle, event);
+ struct timeval current;
+ struct timeval difftime;
+ gettimeofday(¤t,NULL);
+ timersub (¤t, &event->tv, &difftime);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket Event [%s] T=%d:%d\n",
+ ss7boost_client_event_id_name(event->event_id),
+ (int)difftime.tv_sec, (int)difftime.tv_usec);
+
+ parse_ss7_event(ss7boost_handle, event);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: Reading from Boost Socket! %s\n", strerror(errno));
break;
@@ -2067,17 +2146,17 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Close udp socket\n");
ss7boost_client_connection_close(&ss7boost_handle->mcon);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Monitor Thread Ended\n");
-
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Monitor Thread Ended\n");
+
return NULL;
}
-static void launch_ss7boost_handle(ss7boost_handle_t * ss7boost_handle)
+static void launch_ss7boost_handle(ss7boost_handle_t *ss7boost_handle)
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
-
+
switch_threadattr_create(&thd_attr, module_pool);
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -2134,7 +2213,7 @@
for (param = switch_xml_child(span, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
-
+
if (!strcasecmp(var, "local-ip")) {
local_ip = val;
} else if (!strcasecmp(var, "local-port")) {
@@ -2165,7 +2244,7 @@
}
analog_channels = switch_xml_child(cfg, "analog_channels");
- for (channel = switch_xml_child(analog_channels, "channel"); channel; channel = channel->next) {
+ for(channel = switch_xml_child(analog_channels, "channel"); channel; channel = channel->next) {
char *c_type = (char *) switch_xml_attr(channel, "type");
char *c_dev = (char *) switch_xml_attr(channel, "device");
char *user = NULL;
@@ -2175,7 +2254,7 @@
analog_type_t a_type = ANALOG_TYPE_UNKNOWN;
wpsock_t *sock;
int chan, span;
-
+
if (!c_type) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing required attribute 'type'\n");
continue;
@@ -2199,16 +2278,16 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid device name '%s'\n", c_dev);
continue;
}
-
+
if (!(sock = wp_open(NULL, span, chan))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open device '%s' (%s)\n", c_dev, strerror(errno));
continue;
}
for (param = switch_xml_child(channel, "param"); param; param = param->next) {
- char *var = (char *) switch_xml_attr_soft(param, "name");
- char *val = (char *) switch_xml_attr_soft(param, "value");
-
+ char *var = (char *) switch_xml_attr_soft(param, "name");
+ char *val = (char *) switch_xml_attr_soft(param, "value");
+
if (!strcasecmp(var, "user")) {
user = var;
} else if (!strcasecmp(var, "domain")) {
@@ -2234,7 +2313,7 @@
if (cid_num) {
alc->cid_name = strdup(cid_num);
}
-
+
alc->a_type = a_type;
alc->sock = sock;
alc->chan = chan;
@@ -2251,7 +2330,7 @@
if (globals.fxs_index) {
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
-
+
switch_threadattr_create(&thd_attr, module_pool);
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -2266,10 +2345,10 @@
int32_t i = 0;
current_span = 0;
-
+
if (id) {
char *p;
-
+
min_span = atoi(id);
if ((p = strchr(id, '-'))) {
p++;
@@ -2285,16 +2364,16 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Missing SPAN ID!\n");
continue;
}
-
+
for (i = min_span; i <= max_span; i++) {
current_span = i;
-
+
if (current_span <= 0 || current_span > MAX_SPANS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid SPAN %d!\n", current_span);
current_span = 0;
continue;
}
-
+
if (!SPANS[current_span]) {
if (!(SPANS[current_span] = switch_core_alloc(module_pool, sizeof(*SPANS[current_span])))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "MEMORY ERROR\n");
@@ -2302,12 +2381,12 @@
}
SPANS[current_span]->span = current_span;
}
-
+
for (param = switch_xml_child(span, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
-
+
if (!strcmp(var, "dchan")) {
SPANS[current_span]->dchan = atoi(val);
} else if (!strcmp(var, "bchan")) {
@@ -2320,7 +2399,7 @@
fromi = atoi(from);
toi = atoi(to);
if (fromi > 0 && toi > 0 && fromi < toi && fromi < MAX_SPANS && toi < MAX_SPANS) {
- for (x = fromi; x <= toi; x++) {
+ for(x = fromi; x <= toi; x++) {
SPANS[current_span]->bchans |= (1 << x);
}
} else {
@@ -2354,14 +2433,18 @@
globals.configured_spans = 0;
- for (current_span = 1; current_span < MAX_SPANS; current_span++) {
+ for(current_span = 1; current_span < MAX_SPANS; current_span++) {
if (SPANS[current_span]) {
if (!SPANS[current_span]->l1) {
SPANS[current_span]->l1 = PRI_LAYER_1_ULAW;
}
if (sangoma_init_pri(&SPANS[current_span]->spri,
- current_span, SPANS[current_span]->dchan, SPANS[current_span]->pswitch, SPANS[current_span]->node, globals.debug)) {
+ current_span,
+ SPANS[current_span]->dchan,
+ SPANS[current_span]->pswitch,
+ SPANS[current_span]->node,
+ globals.debug)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot launch span %d\n", current_span);
continue;
}
@@ -2378,3 +2461,6 @@
return SWITCH_STATUS_SUCCESS;
}
+
+
+
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/basecdr.cpp
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/basecdr.cpp (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/basecdr.cpp Fri Apr 13 10:44:28 2007
@@ -24,6 +24,7 @@
* Contributor(s):
*
* Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu(a)gmail.com>
*
* Description: This C++ source file describes the BaseCDR class that all other CDR classes inherit from.
* It handles the bulk of the processing of data from the switch_channel_t objects.
@@ -214,7 +215,7 @@
{
if(fixed)
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Wildcards are not allow in the fixed chanvars list. Item removed.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Wildcards are not allow in the fixed chanvars list. Item removed.\n");
iItr = chanvarlist.erase(iItr);
}
else
@@ -271,19 +272,19 @@
sql_type = CDR_TINY;
break;
default:
- switch_console_printf(SWITCH_CHANNEL_LOG,"Valid fixed channel variable types are x (decimal), d (double), i (integer), t (tiny), s (string). You tried to give a type of %s to chanvar %s.\nReverting this chanvar type to a string type.\n",tempstring2.c_str(),tempstring.c_str());
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Valid fixed channel variable types are x (decimal), d (double), i (integer), t (tiny), s (string). You tried to give a type of %s to chanvar %s.\nReverting this chanvar type to a string type.\n", tempstring2.c_str(), tempstring.c_str());
sql_type = CDR_STRING;
}
}
else
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Valid fixed channel variable types are x (decimal), d (double), i (integer), t (tiny), s (string). You tried to give a type of %s to chanvar %s.\nReverting this chanvar type to a string type.\n",tempstring2.c_str(),tempstring.c_str());
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Valid fixed channel variable types are x (decimal), d (double), i (integer), t (tiny), s (string). You tried to give a type of %s to chanvar %s.\nReverting this chanvar type to a string type.\n", tempstring2.c_str(), tempstring.c_str());
sql_type = CDR_STRING;
}
}
else
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"No parameter set, for channel variable %s, using default type of string.\n",iItr->c_str());
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No parameter set, for channel variable %s, using default type of string.\n", iItr->c_str());
sql_type = CDR_STRING;
tempstring = *iItr;
}
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/cdrcontainer.cpp
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/cdrcontainer.cpp (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/cdrcontainer.cpp Fri Apr 13 10:44:28 2007
@@ -24,6 +24,7 @@
* Contributor(s):
*
* Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu(a)gmail.com>
*
* Description: This C++ source file describes the CDRContainer singleton object used by mod_cdr to control
* the creation, processing, and destruction of various CDR logger objects.
@@ -53,7 +54,7 @@
newchannel = 0;
if (!(xml = switch_xml_open_cfg(configfile, &cfg, NULL)))
- switch_console_printf(SWITCH_CHANNEL_LOG,"open of %s failed\n", configfile);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", configfile);
else
{
BaseRegistry& registry(BaseRegistry::get());
@@ -89,7 +90,7 @@
ptr->disconnect();
}
- switch_console_printf(SWITCH_CHANNEL_LOG,"mod_cdr shutdown gracefully.");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mod_cdr shutdown gracefully.");
}
#ifdef SWITCH_QUEUE_ENHANCED
@@ -225,7 +226,7 @@
basecdr_creator func = *it;
BaseCDR* newloggerobject = func(newchannel);
- switch_console_printf(SWITCH_CHANNEL_LOG,"Adding a new logger object to the queue.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Adding a new logger object to the queue.\n");
switch_queue_push(cdrqueue,newloggerobject);
}
newchannel->callerprofile = newchannel->callerprofile->next;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/csvcdr.cpp
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/csvcdr.cpp (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/csvcdr.cpp Fri Apr 13 10:44:28 2007
@@ -24,6 +24,7 @@
* Contributor(s):
*
* Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu(a)gmail.com>
*
* Description: This C++ source file describes the CsvCDR class that handles processing CDRs to a CSV format.
* This is the standard CSV module, and has a list of predefined variables to log out which can be
@@ -101,7 +102,7 @@
void CsvCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param)
{
- switch_console_printf(SWITCH_CHANNEL_LOG, "CsvCDR::connect() - Loading configuration file.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CsvCDR::connect() - Loading configuration file.\n");
activated = 0; // Set it as inactive initially
connectionstate = 0; // Initialize it to false to show that we aren't yet connected.
@@ -170,7 +171,7 @@
convert_time = switch_time_exp_lt;
else
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n", val);
convert_time = switch_time_exp_lt;
}
}
@@ -182,11 +183,11 @@
if(outputfile.good())
{
activated = 1;
- switch_console_printf(SWITCH_CHANNEL_LOG,"CsvCDR activated, log rotation will occur at or after %d MB\n",(int)(filesize_limit >> 20));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CsvCDR activated, log rotation will occur at or after %d MB\n", (int)(filesize_limit >> 20));
}
}
else
- switch_console_printf(SWITCH_CHANNEL_LOG,"CsvCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a path to have the records logged to.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CsvCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a path to have the records logged to.\n");
}
}
@@ -228,7 +229,7 @@
outputfile.open(filename.c_str(),std::ios_base::app|std::ios_base::binary);
if(outputfile.fail())
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Could not open the CSV file %s . CsvCDR logger will not be functional until this is resolved and a reload is issued. Failbit is set to %d.\n",filename.c_str(),outputfile.fail());
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open the CSV file %s . CsvCDR logger will not be functional until this is resolved and a reload is issued. Failbit is set to %d.\n", filename.c_str(), outputfile.fail());
activated = 0;
}
else
@@ -332,7 +333,7 @@
chanvars_fixed_list.clear();
chanvars_supp_list.clear();
connectionstate = 0;
- switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down CsvCDR... Done!\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down CsvCDR... Done!\n");
}
AUTO_REGISTER_BASECDR(CsvCDR);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/curlcdr.cpp
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/curlcdr.cpp (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/curlcdr.cpp Fri Apr 13 10:44:28 2007
@@ -28,6 +28,7 @@
* Yossi Neiman <freeswitch AT cartissolutions.com>
* Bret McDanel <trixter AT 0xdecafbad.com>
* Anthony Minessale II <anthmct(a)yahoo.com>
+ * Marcel Barbulescu <marcelbarbulescu(a)gmail.com>
*
* Description: This C++ source file describes the CurlCDR class that handles processing CDRs to HTTP endpoint.
* This is the standard Curl module, and has a list of predefined variables to log out which can be
@@ -106,14 +107,14 @@
void CurlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param)
{
- switch_console_printf(SWITCH_CHANNEL_LOG, "CurlCDR::connect() - Loading configuration file.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CurlCDR::connect() - Loading configuration file.\n");
activated = 0; // Set it as inactive initially
connectionstate = 0; // Initialize it to false to show that we aren't yet connected.
- switch_console_printf(SWITCH_CHANNEL_LOG,"Checking to see if curlcdr is valid\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking to see if curlcdr is valid\n");
if ((settings = switch_xml_child(cfg, "curlcdr")))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"curlcdr appears to be!!!\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "curlcdr appears to be!!!\n");
int count_config_params = 0; // Need to make sure all params are set before we load
for (param = switch_xml_child(settings, "param"); param; param = param->next)
{
@@ -168,7 +169,7 @@
convert_time = switch_time_exp_lt;
else
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n", val);
convert_time = switch_time_exp_lt;
}
}
@@ -179,13 +180,13 @@
if(strlen(gateway_url))
{
activated = 1;
- switch_console_printf(SWITCH_CHANNEL_LOG,"CurlCDR activated");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CurlCDR activated");
}
else
- switch_console_printf(SWITCH_CHANNEL_LOG,"CurlCDR::connect(): You must specify a gateway_url to have the records logged to.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CurlCDR::connect(): You must specify a gateway_url to have the records logged to.\n");
}
else
- switch_console_printf(SWITCH_CHANNEL_LOG,"CurlCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a gateway_url to have the records logged to.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CurlCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a gateway_url to have the records logged to.\n");
}
}
@@ -370,7 +371,7 @@
chanvars_fixed_list.clear();
chanvars_supp_list.clear();
connectionstate = 0;
- switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down CurlCDR... Done!");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down CurlCDR... Done!");
}
AUTO_REGISTER_BASECDR(CurlCDR);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/mod_cdr.cpp
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/mod_cdr.cpp (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/mod_cdr.cpp Fri Apr 13 10:44:28 2007
@@ -24,6 +24,7 @@
* Contributor(s):
*
* Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu(a)gmail.com>
*
* Description: This source file describes the most basic portions of the CDR module. These are the functions
* and structures that the Freeswitch core looks for when opening up the DSO file to create the load, shutdown
@@ -130,7 +131,7 @@
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS)
{
- switch_console_printf(SWITCH_CHANNEL_LOG, "OH OH - Can't swim, no pool\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH - Can't swim, no pool\n");
return SWITCH_STATUS_TERM;
}
@@ -144,7 +145,7 @@
SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
{
RUNNING = 1;
- switch_console_printf(SWITCH_CHANNEL_LOG, "mod_cdr made it to runtime. Wee!\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mod_cdr made it to runtime. Wee!\n");
newcdrcontainer->process_records();
return RUNNING ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_TERM;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/mysqlcdr.cpp Fri Apr 13 10:44:28 2007
@@ -24,6 +24,7 @@
* Contributor(s):
*
* Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu(a)gmail.com>
*
* Description: This C++ source file describes the MysqlCDR class which handles formatting a CDR out to
* a MySQL 4.1.x or greater server using prepared statements.
@@ -183,7 +184,7 @@
convert_time = switch_time_exp_lt;
else
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n", val);
convert_time = switch_time_exp_lt;
}
}
@@ -192,7 +193,7 @@
if (count_config_params==4)
activated = 1;
else
- switch_console_printf(SWITCH_CHANNEL_LOG,"You did not specify the minimum parameters for using this module. You must specify a hostname, username, password, and database to use MysqlCDR. You only supplied %d parameters.\n",count_config_params);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "You did not specify the minimum parameters for using this module. You must specify a hostname, username, password, and database to use MysqlCDR. You only supplied %d parameters.\n", count_config_params);
if(activated)
{
@@ -241,7 +242,7 @@
if(mysql_real_connect(conn,hostname,username,password,dbname,0,NULL,0) == NULL)
{
const char *error1 = mysql_error(conn);
- switch_console_printf(SWITCH_CHANNEL_LOG,"Cannot connect to MySQL Server. The error was: %s\n",error1);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot connect to MySQL Server. The error was: %s\n", error1);
}
else
connectionstate = 1;
@@ -446,7 +447,7 @@
break;
}
default:
- switch_console_printf(SWITCH_CHANNEL_LOG,"We should not get to this point in this switch/case statement.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We should not get to this point in this switch/case statement.\n");
}
i++;
}
@@ -466,13 +467,13 @@
case CR_SERVER_GONE_ERROR:
case CR_SERVER_LOST:
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"We lost connection to the MySQL server. Trying to reconnect.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "We lost connection to the MySQL server. Trying to reconnect.\n");
connect_to_database();
break;
}
default:
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"We have encountered an unknown error when pinging the MySQL server. Attempting to reconnect anyways.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "We have encountered an unknown error when pinging the MySQL server. Attempting to reconnect anyways.\n");
connect_to_database();
}
}
@@ -485,10 +486,10 @@
if(mysql_stmt_error_code != 0)
{
errorstate = 1;
- switch_console_printf(SWITCH_CHANNEL_LOG,"MysqlCDR::process_record() - Statement executed? Error: %d\n",mysql_stmt_error_code);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MysqlCDR::process_record() - Statement executed? Error: %d\n", mysql_stmt_error_code);
const char* mysql_stmt_error_string = mysql_stmt_error(stmt);
- switch_console_printf(SWITCH_CHANNEL_LOG,"MySQL encountered error: %s\n",mysql_stmt_error_string);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MySQL encountered error: %s\n", mysql_stmt_error_string);
}
else
errorstate = 0;
@@ -585,7 +586,7 @@
break;
}
default:
- switch_console_printf(SWITCH_CHANNEL_LOG,"We should not get to this point in this switch/case statement.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We should not get to this point in this switch/case statement.\n");
}
bool* tempbool = (bool*) temp_chanvars_holder.front();
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/odbccdr.cpp
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/odbccdr.cpp (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/odbccdr.cpp Fri Apr 13 10:44:28 2007
@@ -24,6 +24,7 @@
* Contributor(s):
*
* Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu(a)gmail.com>
*
* Description: This C++ source file describes the OdbcCDR class which handles formatting a CDR out to
* an ODBC backend using prepared statements.
@@ -201,7 +202,7 @@
convert_time = switch_time_exp_lt;
else
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n", val);
convert_time = switch_time_exp_lt;
}
}
@@ -216,7 +217,7 @@
if (count_config_params==4)
activated = 1;
else
- switch_console_printf(SWITCH_CHANNEL_LOG,"You did not specify the minimum parameters for using this module. You must specify a DSN,hostname, username, password, and database to use OdbcCDR. You only supplied %d parameters.\n",count_config_params);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You did not specify the minimum parameters for using this module. You must specify a DSN,hostname, username, password, and database to use OdbcCDR. You only supplied %d parameters.\n", count_config_params);
if(activated)
{
@@ -275,7 +276,7 @@
ODBC_res = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &ODBC_env);
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Error allocating a new ODBC handle.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error allocating a new ODBC handle.\n");
connectionstate = 0;
}
}
@@ -284,7 +285,7 @@
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Error with ODBCSetEnv\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error with ODBCSetEnv\n");
SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env);
connectionstate = 0;
}
@@ -293,7 +294,7 @@
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Error AllocHDB %d\n",ODBC_res);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error AllocHDB %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env);
connectionstate = 0;
}
@@ -306,14 +307,14 @@
ODBC_res = SQLConnect(ODBC_con, (SQLCHAR*)dsn, SQL_NTS, (SQLCHAR*)username, SQL_NTS, (SQLCHAR*)password, SQL_NTS);
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Error connecting to the ODBC database on %d\n",ODBC_res);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error connecting to the ODBC database on %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_DBC, ODBC_con);
SQLFreeHandle(SQL_HANDLE_ENV, ODBC_env);
connectionstate = 0;
}
else
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Connected to %s\n", dsn);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connected to %s\n", dsn);
connectionstate = 1;
}
@@ -325,7 +326,7 @@
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Failure in allocating a prepared statement %d\n", ODBC_res);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure in allocating a prepared statement %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
}
@@ -333,7 +334,7 @@
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Error in preparing a statement: %d\n", ODBC_res);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error in preparing a statement: %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
}
@@ -343,7 +344,7 @@
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Failure in allocating a prepared statement %d\n", ODBC_res);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure in allocating a prepared statement %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt_chanvars);
}
@@ -351,7 +352,7 @@
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Error in preparing a statement: %d\n", ODBC_res);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error in preparing a statement: %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
}
}
@@ -360,7 +361,7 @@
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Failure in allocating a prepared statement %d\n", ODBC_res);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure in allocating a prepared statement %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt_ping);
}
@@ -368,7 +369,7 @@
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Error in preparing a statement: %d\n", ODBC_res);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error in preparing a statement: %d\n", ODBC_res);
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt_ping);
}
@@ -400,7 +401,7 @@
if(ODBC_res != SQL_SUCCESS && ODBC_res != SQL_SUCCESS_WITH_INFO)
{
// Try to reconnect and reprepare
- switch_console_printf(SWITCH_CHANNEL_LOG,"Error pinging the ODBC backend. Attempt #%d to reconnect.\n",count+1);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error pinging the ODBC backend. Attempt #%d to reconnect.\n", count+1);
connect_to_database();
}
}
@@ -502,7 +503,7 @@
break;
}
default:
- switch_console_printf(SWITCH_CHANNEL_LOG,"We should not get to this point in this switch/case statement.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We should not get to this point in this switch/case statement.\n");
}
i++;
}
@@ -585,7 +586,7 @@
break;
}
default:
- switch_console_printf(SWITCH_CHANNEL_LOG,"We should not get to this point in this switch/case statement.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We should not get to this point in this switch/case statement.\n");
}
}
}
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/pddcdr.cpp
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/pddcdr.cpp (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/pddcdr.cpp Fri Apr 13 10:44:28 2007
@@ -24,6 +24,7 @@
* Contributor(s):
*
* Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu(a)gmail.com>
*
* Description: This C++ source file describes the PddCDR class which handles formatting a CDR out to
* individual text files in a Perl Data Dumper format.
@@ -101,7 +102,7 @@
void PddCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param)
{
- switch_console_printf(SWITCH_CHANNEL_LOG, "PddCDR::connect() - Loading configuration file.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PddCDR::connect() - Loading configuration file.\n");
activated = 0; // Set it as inactive initially
connectionstate = 0; // Initialize it to false to show that we aren't yet connected.
@@ -135,11 +136,11 @@
}
else if (!strcmp(var, "chanvars_fixed"))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"PddCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "PddCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n");
}
else if (!strcmp(var, "chanvars_supp"))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"PddCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "PddCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n");
}
else if(!strcmp(var,"timezone"))
{
@@ -149,7 +150,7 @@
convert_time = switch_time_exp_lt;
else
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n", val);
convert_time = switch_time_exp_lt;
}
}
@@ -158,7 +159,7 @@
if(count_config_params > 0)
activated = 1;
else
- switch_console_printf(SWITCH_CHANNEL_LOG,"PddCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a path to have the records logged to.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PddCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a path to have the records logged to.\n");
}
}
@@ -168,7 +169,7 @@
bool retval = 0;
if(!outputfile)
- switch_console_printf(SWITCH_CHANNEL_LOG, "PddCDR::process_record(): Unable to open file %s to commit the call record to. Invalid path name, invalid permissions, or no space available?\n",outputfile_name.c_str());
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PddCDR::process_record(): Unable to open file %s to commit the call record to. Invalid path name, invalid permissions, or no space available?\n",outputfile_name.c_str());
else
{
// Format the call record and proceed from here...
@@ -247,7 +248,7 @@
logchanvars = 0;
outputfile_path.clear();
chanvars_supp_list.clear();
- switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down PddCDR... Done!");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down PddCDR... Done!");
}
AUTO_REGISTER_BASECDR(PddCDR);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/sqlitecdr.cpp
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/sqlitecdr.cpp (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/sqlitecdr.cpp Fri Apr 13 10:44:28 2007
@@ -24,6 +24,7 @@
* Contributor(s):
*
* Yossi Neiman <freeswitch AT cartissolutions.com>
+ * Marcel Barbulescu <marcelbarbulescu(a)gmail.com>
*
* Description: his C++ header file describes the SqliteCDR class which handles formatting a CDR out to
* a SQLite database using prepared statements.
@@ -141,7 +142,7 @@
use_utc_time = 0;
else
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n", val);
use_utc_time = 0;
}
}
@@ -150,7 +151,7 @@
if (count_config_params==1)
activated = 1;
else
- switch_console_printf(SWITCH_CHANNEL_LOG,"You did not specify the minimum parameters for using this module. You must specify an explicit (complete) path to the location of the database file in order to use SqliteCDR.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You did not specify the minimum parameters for using this module. You must specify an explicit (complete) path to the location of the database file in order to use SqliteCDR.\n");
if(activated)
{
@@ -192,7 +193,7 @@
if(sql_rc != SWITCH_CORE_DB_OK)
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"There was an error opening database filename %s. The error was: %s. SqliteCDR logging has been disabled until the problem is resolved and modcdr_reload is initiated.\n",db_filename.c_str(),switch_core_db_errmsg(db));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "There was an error opening database filename %s. The error was: %s. SqliteCDR logging has been disabled until the problem is resolved and modcdr_reload is initiated.\n", db_filename.c_str(), switch_core_db_errmsg(db));
activated = 0;
switch_core_db_close(db);
}
@@ -223,13 +224,13 @@
}
}
else
- switch_console_printf(SWITCH_CHANNEL_LOG,"There was an error in executing query %s: The error was %s.\n",sql_query_check_tables,errormessage);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "There was an error in executing query %s: The error was %s.\n", sql_query_check_tables, errormessage);
switch_core_db_free_table(result);
if(!temp_sql_tables["freeswitchcdr"])
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Creating the freeswitchcdr table in the SQLite mod_cdr database file.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating the freeswitchcdr table in the SQLite mod_cdr database file.\n");
// Must create the missing freeswitchcdr table.
char sql_query_create_freeswitchcdr[] = "CREATE TABLE freeswitchcdr (\n"
"callid INTEGER PRIMARY KEY AUTOINCREMENT,\n"
@@ -262,7 +263,7 @@
if(!temp_sql_tables["chanvars"])
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Creating the chanvars table in the SQLite mod_cdr database file.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating the chanvars table in the SQLite mod_cdr database file.\n");
// Must create the missing chanvars table.
char sql_query_create_chanvars[] = "CREATE TABLE chanvars (\n"
"callid INTEGER default 0,\n"
@@ -321,13 +322,13 @@
tempstring2 = resultstring.substr(i,(j-i));
freeswitchcdr_columns[tempstring1] = tempstring2;
- // switch_console_printf(SWITCH_CHANNEL_LOG,"tempstring1 = %s, tempstring2 = %s\n",tempstring1.c_str(),tempstring2.c_str());
+ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tempstring1 = %s, tempstring2 = %s\n", tempstring1.c_str(), tempstring2.c_str());
if(resultstring.find('\n',j+1) == (j+1))
j++;
i = j+1;
}
else
- switch_console_printf(SWITCH_CHANNEL_LOG,"There has been a parsing problem with the freeswitchcdr schema.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "There has been a parsing problem with the freeswitchcdr schema.\n");
}
}
}
@@ -346,9 +347,9 @@
case CDR_TINY:
if(freeswitchcdr_columns.find(*iItr) != freeswitchcdr_columns.end())
{
- //switch_console_printf(SWITCH_CHANNEL_LOG,"freeswitchcdr_columns[%s] == %s.\n",iItr->c_str(),freeswitchcdr_columns[*iItr].c_str());
+ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "freeswitchcdr_columns[%s] == %s.\n", iItr->c_str(), freeswitchcdr_columns[*iItr].c_str());
if(freeswitchcdr_columns[*iItr].find("INTEGER",0) == std::string::npos)
- switch_console_printf(SWITCH_CHANNEL_LOG,"WARNING: SqliteCDR freeswitchcdr table column type mismatch: Column \"%s\" is not of an INTEGER type. This is not necessarily fatal, but may result in unexpected behavior.\n",iItr->c_str());
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SqliteCDR freeswitchcdr table column type mismatch: Column \"%s\" is not of an INTEGER type. This is not necessarily fatal, but may result in unexpected behavior.\n", iItr->c_str());
}
else
freeswitchcdr_add_columns[*iItr] = "INTEGER";
@@ -357,7 +358,7 @@
if(freeswitchcdr_columns.find(*iItr) != freeswitchcdr_columns.end())
{
if(freeswitchcdr_columns[*iItr].find("REAL",0) == std::string::npos)
- switch_console_printf(SWITCH_CHANNEL_LOG,"WARNING: SqliteCDR freeswitchcdr table column type mismatch: Column \"%s\" is not of a REAL type. This is not necessarily fatal, but may result in unexpected behavior.\n",iItr->c_str());
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SqliteCDR freeswitchcdr table column type mismatch: Column \"%s\" is not of a REAL type. This is not necessarily fatal, but may result in unexpected behavior.\n", iItr->c_str());
}
else
freeswitchcdr_add_columns[*iItr] = "REAL";
@@ -367,19 +368,19 @@
if(freeswitchcdr_columns.find(*iItr) != freeswitchcdr_columns.end())
{
if(freeswitchcdr_columns[*iItr].find("TEXT",0) == std::string::npos)
- switch_console_printf(SWITCH_CHANNEL_LOG,"WARNING: SqliteCDR freeswitchcdr table column type mismatch: Column \"%s\" is not of a TEXT type. This is not necessarily fatal, but may result in unexpected behavior.\n",iItr->c_str());
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SqliteCDR freeswitchcdr table column type mismatch: Column \"%s\" is not of a TEXT type. This is not necessarily fatal, but may result in unexpected behavior.\n", iItr->c_str());
}
else
freeswitchcdr_add_columns[*iItr] = "TEXT";
break;
default:
- switch_console_printf(SWITCH_CHANNEL_LOG,"Oh bother, I should not have fallen into this hole in the switch/case statement. Please notify the author.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oh bother, I should not have fallen into this hole in the switch/case statement. Please notify the author.\n");
}
}
if(freeswitchcdr_add_columns.size())
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Updating the freeswitchcdr table schema.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Updating the freeswitchcdr table schema.\n");
std::string tempsql_freeswitchcdr_alter_table = "ALTER TABLE freeswitchcdr ADD ";
std::map<std::string, std::string>::iterator iItr, iEnd;
for(iItr = freeswitchcdr_add_columns.begin(), iEnd = freeswitchcdr_add_columns.end(); iItr != iEnd; iItr++)
@@ -388,7 +389,7 @@
sql_query_freeswitchcdr_alter_table.append(iItr->first);
sql_query_freeswitchcdr_alter_table.append(" ");
sql_query_freeswitchcdr_alter_table.append(iItr->second);
- switch_console_printf(SWITCH_CHANNEL_LOG,"Updating the freeswitchcdr table with the following SQL command: %s.\n",sql_query_freeswitchcdr_alter_table.c_str());
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Updating the freeswitchcdr table with the following SQL command: %s.\n", sql_query_freeswitchcdr_alter_table.c_str());
switch_core_db_exec(db, sql_query_freeswitchcdr_alter_table.c_str(), NULL, NULL, NULL);
}
}
@@ -514,7 +515,7 @@
break;
}
default:
- switch_console_printf(SWITCH_CHANNEL_LOG,"Oh bother, I should not have fallen into this hole in the switch/case statement. Please notify the author.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oh bother, I should not have fallen into this hole in the switch/case statement. Please notify the author.\n");
}
}
}
@@ -525,7 +526,7 @@
if(sql_rc == SWITCH_CORE_DB_BUSY)
sql_rc = switch_core_db_step(stmt);
else if (sql_rc == SWITCH_CORE_DB_ERROR || sql_rc == SWITCH_CORE_DB_MISUSE)
- switch_console_printf(SWITCH_CHANNEL_LOG,"There was an error executing switch_core_db_step on SqliteCDR::stmt. The error was: %s\n",switch_core_db_errmsg(db));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "There was an error executing switch_core_db_step on SqliteCDR::stmt. The error was: %s\n", switch_core_db_errmsg(db));
}
sql_rc = switch_core_db_reset(stmt);
@@ -546,7 +547,7 @@
if(sql_rc == SWITCH_CORE_DB_BUSY)
sql_rc = switch_core_db_step(stmt_chanvars);
else if (sql_rc == SWITCH_CORE_DB_ERROR || sql_rc == SWITCH_CORE_DB_MISUSE)
- switch_console_printf(SWITCH_CHANNEL_LOG,"There was an error executing switch_core_db_step on SqliteCDR::stmt_chanvars. The error was: %s\n",switch_core_db_errmsg(db));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "There was an error executing switch_core_db_step on SqliteCDR::stmt_chanvars. The error was: %s\n", switch_core_db_errmsg(db));
}
switch_core_db_reset(stmt_chanvars);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/xmlcdr.cpp
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/xmlcdr.cpp (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/event_handlers/mod_cdr/xmlcdr.cpp Fri Apr 13 10:44:28 2007
@@ -25,6 +25,7 @@
*
* Yossi Neiman <freeswitch AT cartissolutions.com>
* Ken Rice of Asteria Solutions Group, INC <ken AT asteriasgi.com>
+ * Marcel Barbulescu <marcelbarbulescu(a)gmail.com>
*
* Description: This C++ source file describes the XmlCDR class which handles formatting a CDR out to
* individual text files in a XML format.
@@ -103,7 +104,7 @@
void XmlCDR::connect(switch_xml_t& cfg, switch_xml_t& xml, switch_xml_t& settings, switch_xml_t& param)
{
- switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::connect() - Loading configuration file.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "XmlCDR::connect() - Loading configuration file.\n");
activated = 0; // Set it as inactive initially
connectionstate = 0; // Initialize it to false to show that we aren't yet connected.
@@ -137,11 +138,11 @@
}
else if (!strcmp(var, "chanvars_fixed"))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"XmlCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "XmlCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n");
}
else if (!strcmp(var, "chanvars_supp"))
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"XmlCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "XmlCDR has no need for a fixed or supplemental list of channel variables due to the nature of the format. Please use the setting parameter of \"chanvars\" instead and try again.\n");
}
else if(!strcmp(var,"timezone"))
{
@@ -151,7 +152,7 @@
convert_time = switch_time_exp_lt;
else
{
- switch_console_printf(SWITCH_CHANNEL_LOG,"Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n",val);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid configuration parameter for timezone. Possible values are utc and local. You entered: %s\nDefaulting to local.\n", val);
convert_time = switch_time_exp_lt;
}
}
@@ -160,7 +161,7 @@
if(count_config_params > 0)
activated = 1;
else
- switch_console_printf(SWITCH_CHANNEL_LOG,"XmlCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a path to have the records logged to.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "XmlCDR::connect(): You did not specify the minimum parameters for using this module. You must specify at least a path to have the records logged to.\n");
}
}
@@ -170,10 +171,10 @@
outputfile.open(outputfile_name.c_str());
if(!outputfile)
- switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::process_record(): Unable to open file %s to commit the call record to. Invalid path name, invalid permissions, or no space available?\n",outputfile_name.c_str());
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "XmlCDR::process_record(): Unable to open file %s to commit the call record to. Invalid path name, invalid permissions, or no space available?\n", outputfile_name.c_str());
else
{
- //switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::process_record(): Preping the CDR to %s.\n",outputfile_name.c_str());
+ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "XmlCDR::process_record(): Preping the CDR to %s.\n", outputfile_name.c_str());
// Format the call record and proceed from here...
outputfile << "<?xml version=\"1.0\"?>" << std::endl;
outputfile << "<document type=\"freeswitch-cdr/xml\">" << std::endl;
@@ -215,7 +216,7 @@
}
outputfile << "\t</chanvars>" << std::endl << "</document>" << std::endl << std::endl;
- //switch_console_printf(SWITCH_CHANNEL_LOG, "XmlCDR::process_record(): Dumping the CDR to %s.\n",outputfile_name.c_str());
+ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "XmlCDR::process_record(): Dumping the CDR to %s.\n", outputfile_name.c_str());
retval = 1;
}
@@ -249,7 +250,7 @@
logchanvars = 0;
outputfile_path.clear();
chanvars_supp_list.clear();
- switch_console_printf(SWITCH_CHANNEL_LOG,"Shutting down XmlCDR... Done!");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down XmlCDR... Done!");
}
AUTO_REGISTER_BASECDR(XmlCDR);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c Fri Apr 13 10:44:28 2007
@@ -117,7 +117,7 @@
static JSBool db_exec(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
struct db_obj *dbo = JS_GetPrivate(cx, obj);
- *rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+ *rval = INT_TO_JSVAL(0);
if (argc > 0) {
char *sql = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
@@ -137,7 +137,11 @@
if (err) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error %s\n", err);
switch_core_db_free(err);
- *rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+ *rval = INT_TO_JSVAL(-1);
+ } else {
+ int count = switch_core_db_changes(dbo->db);
+
+ *rval = INT_TO_JSVAL(count);
}
}
return JS_TRUE;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/switch_core_db.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/switch_core_db.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/switch_core_db.c Fri Apr 13 10:44:28 2007
@@ -142,6 +142,10 @@
sqlite3_free(z);
}
+SWITCH_DECLARE(int) switch_core_db_changes(switch_core_db_t *db) {
+ return sqlite3_changes(db);
+}
+
SWITCH_DECLARE(char *) switch_mprintf(const char *zFormat, ...)
{
va_list ap;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/switch_core_session.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/switch_core_session.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/switch_core_session.c Fri Apr 13 10:44:28 2007
@@ -599,6 +599,8 @@
switch_channel_dequeue_dtmf(channel, buf, sizeof(buf));
}
+ switch_ivr_deactivate_unicast(session);
+
switch_channel_clear_flag(channel, CF_BREAK);
}
@@ -647,6 +649,8 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Close Channel %s\n", switch_channel_get_name((*session)->channel));
+ switch_ivr_deactivate_unicast(*session);
+
switch_scheduler_del_task_group((*session)->uuid_str);
switch_mutex_lock(runtime.session_table_mutex);
@@ -667,6 +671,9 @@
switch_channel_uninit((*session)->channel);
pool = (*session)->pool;
+#ifndef NDEBUG
+ memset(*session, 0, sizeof(switch_core_session_t));
+#endif
*session = NULL;
apr_pool_destroy(pool);
pool = NULL;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/src/switch_ivr.c Fri Apr 13 10:44:28 2007
@@ -80,6 +80,176 @@
}
+static void *SWITCH_THREAD_FUNC unicast_thread_run(switch_thread_t *thread, void *obj)
+{
+ switch_unicast_conninfo_t *conninfo = (switch_unicast_conninfo_t *) obj;
+ switch_size_t len;
+ switch_channel_t *channel;
+
+ if (!conninfo) {
+ return NULL;
+ }
+
+ channel = switch_core_session_get_channel(conninfo->session);
+
+ while(switch_test_flag(conninfo, SUF_READY) && switch_test_flag(conninfo, SUF_THREAD_RUNNING)) {
+ len = conninfo->write_frame.buflen;
+ if (switch_socket_recv(conninfo->socket, conninfo->write_frame.data, &len) != SWITCH_STATUS_SUCCESS || len == 0) {
+ break;
+ }
+ conninfo->write_frame.datalen = (uint32_t)len;
+ conninfo->write_frame.samples = conninfo->write_frame.datalen / 2;
+ switch_core_session_write_frame(conninfo->session, &conninfo->write_frame, -1, conninfo->stream_id);
+ }
+
+ switch_clear_flag_locked(conninfo, SUF_READY);
+ switch_clear_flag_locked(conninfo, SUF_THREAD_RUNNING);
+
+ return NULL;
+}
+
+static void unicast_thread_launch(switch_unicast_conninfo_t *conninfo)
+{
+ switch_thread_t *thread;
+ switch_threadattr_t *thd_attr = NULL;
+
+ switch_threadattr_create(&thd_attr, switch_core_session_get_pool(conninfo->session));
+ switch_threadattr_detach_set(thd_attr, 1);
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_set_flag_locked(conninfo, SUF_THREAD_RUNNING);
+ switch_thread_create(&thread, thd_attr, unicast_thread_run, conninfo, switch_core_session_get_pool(conninfo->session));
+}
+
+SWITCH_DECLARE(switch_status_t) switch_ivr_deactivate_unicast(switch_core_session_t *session)
+{
+ switch_channel_t *channel;
+ switch_unicast_conninfo_t *conninfo;
+ int sanity = 0;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ if (switch_channel_test_flag(channel, CF_UNICAST)) {
+ if ((conninfo = switch_channel_get_private(channel, "unicast"))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down unicast connection\n");
+ switch_clear_flag_locked(conninfo, SUF_READY);
+ switch_socket_shutdown(conninfo->socket, SWITCH_SHUTDOWN_READWRITE);
+ while(switch_test_flag(conninfo, SUF_THREAD_RUNNING)) {
+ switch_yield(10000);
+ if (++sanity >= 10000) {
+ break;
+ }
+ }
+ switch_core_codec_destroy(&conninfo->read_codec);
+ switch_socket_close(conninfo->socket);
+ }
+ switch_channel_clear_flag(channel, CF_UNICAST);
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ return SWITCH_STATUS_FALSE;
+
+}
+
+SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session,
+ char *local_ip,
+ switch_port_t local_port,
+ char *remote_ip,
+ switch_port_t remote_port,
+ char *transport)
+{
+ switch_channel_t *channel;
+ switch_unicast_conninfo_t *conninfo;
+ switch_codec_t *read_codec;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ conninfo = switch_core_session_alloc(session, sizeof(*conninfo));
+ assert(conninfo != NULL);
+
+ conninfo->local_ip = switch_core_session_strdup(session, local_ip);
+ conninfo->local_port = local_port;
+
+ conninfo->remote_ip = switch_core_session_strdup(session, remote_ip);
+ conninfo->remote_port = remote_port;
+ conninfo->session = session;
+
+ if (!strcasecmp(transport, "udp")) {
+ conninfo->type = AF_INET;
+ conninfo->transport = SOCK_DGRAM;
+ } else if (!strcasecmp(transport, "tcp")) {
+ conninfo->type = AF_INET;
+ conninfo->transport = SOCK_STREAM;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid transport %s\n", transport);
+ goto fail;
+ }
+
+ switch_mutex_init(&conninfo->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+
+ read_codec = switch_core_session_get_read_codec(session);
+
+ if (switch_core_codec_init(&conninfo->read_codec,
+ "L16",
+ NULL,
+ read_codec->implementation->samples_per_second,
+ read_codec->implementation->microseconds_per_frame / 1000,
+ 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+ NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+ "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
+ read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
+ read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
+ goto fail;
+ }
+
+ conninfo->write_frame.data = conninfo->write_frame_data;
+ conninfo->write_frame.buflen = sizeof(conninfo->write_frame_data);
+ conninfo->write_frame.codec = &conninfo->read_codec;
+
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "connect %s:%d->%s:%d\n",
+ conninfo->local_ip, conninfo->local_port, conninfo->remote_ip, conninfo->remote_port);
+
+ if (switch_sockaddr_info_get(&conninfo->local_addr,
+ conninfo->local_ip, SWITCH_UNSPEC, conninfo->local_port, 0,
+ switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+ goto fail;
+ }
+
+ if (switch_sockaddr_info_get(&conninfo->remote_addr,
+ conninfo->remote_ip, SWITCH_UNSPEC, conninfo->remote_port, 0,
+ switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+ goto fail;
+ }
+
+ if (switch_socket_create(&conninfo->socket, AF_INET, SOCK_DGRAM, 0, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+ if (switch_socket_bind(conninfo->socket, conninfo->local_addr) != SWITCH_STATUS_SUCCESS) {
+ goto fail;
+ }
+ } else {
+ goto fail;
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Created unicast connection %s:%d->%s:%d\n",
+ conninfo->local_ip, conninfo->local_port, conninfo->remote_ip, conninfo->remote_port);
+ switch_channel_set_private(channel, "unicast", conninfo);
+ switch_channel_set_flag(channel, CF_UNICAST);
+ switch_set_flag_locked(conninfo, SUF_READY);
+ return SWITCH_STATUS_SUCCESS;
+
+ fail:
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure creating unicast connection %s:%d->%s:%d\n",
+ conninfo->local_ip, conninfo->local_port, conninfo->remote_ip, conninfo->remote_port);
+ return SWITCH_STATUS_FALSE;
+
+
+}
+
SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *session, switch_event_t *event)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -89,6 +259,7 @@
unsigned long CMD_EXECUTE = switch_hashfunc_default("execute", &hlen);
unsigned long CMD_HANGUP = switch_hashfunc_default("hangup", &hlen);
unsigned long CMD_NOMEDIA = switch_hashfunc_default("nomedia", &hlen);
+ unsigned long CMD_UNICAST = switch_hashfunc_default("unicast", &hlen);
assert(channel != NULL);
assert(event != NULL);
@@ -109,7 +280,7 @@
char *app_name = switch_event_get_header(event, "execute-app-name");
char *app_arg = switch_event_get_header(event, "execute-app-arg");
char *loop_h = switch_event_get_header(event, "loops");
- int loops = 0;
+ int loops = 1;
if (loop_h) {
loops = atoi(loop_h);
@@ -130,6 +301,31 @@
}
}
}
+ } else if (cmd_hash == CMD_UNICAST) {
+ char *local_ip = switch_event_get_header(event, "local_ip");
+ char *local_port = switch_event_get_header(event, "local_port");
+ char *remote_ip = switch_event_get_header(event, "remote_ip");
+ char *remote_port = switch_event_get_header(event, "remote_port");
+ char *transport = switch_event_get_header(event, "transport");
+
+ if (switch_strlen_zero(local_ip)) {
+ local_ip = "127.0.0.1";
+ }
+ if (switch_strlen_zero(remote_ip)) {
+ remote_ip = "127.0.0.1";
+ }
+ if (switch_strlen_zero(local_port)) {
+ local_port = "8025";
+ }
+ if (switch_strlen_zero(remote_port)) {
+ remote_port = "8026";
+ }
+ if (switch_strlen_zero(transport)) {
+ transport = "udp";
+ }
+
+ switch_ivr_activate_unicast(session, local_ip, (switch_port_t)atoi(local_port), remote_ip, (switch_port_t)atoi(remote_port), transport);
+
} else if (cmd_hash == CMD_HANGUP) {
char *cause_name = switch_event_get_header(event, "hangup-cause");
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
@@ -154,10 +350,11 @@
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_channel_t *channel;
- switch_frame_t *frame;
+ switch_frame_t *read_frame;
int stream_id = 0;
switch_event_t *event;
-
+ switch_unicast_conninfo_t *conninfo = NULL;
+ switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -171,10 +368,73 @@
switch_channel_set_flag(channel, CF_CONTROLLED);
while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_CONTROLLED)) {
- if ((status = switch_core_session_read_frame(session, &frame, -1, stream_id)) == SWITCH_STATUS_SUCCESS) {
+ if ((status = switch_core_session_read_frame(session, &read_frame, -1, stream_id)) == SWITCH_STATUS_SUCCESS) {
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
+
+ if (switch_channel_test_flag(channel, CF_UNICAST)) {
+ if (!conninfo) {
+ if (!(conninfo = switch_channel_get_private(channel, "unicast"))) {
+ switch_channel_clear_flag(channel, CF_UNICAST);
+ }
+
+ if (conninfo) {
+ unicast_thread_launch(conninfo);
+ }
+ }
+
+ if (conninfo) {
+ switch_size_t len;
+ uint32_t flags = 0;
+ switch_byte_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE];
+ uint32_t rate = read_codec->implementation->samples_per_second;
+ uint32_t dlen = sizeof(decoded);
+ switch_status_t status;
+ switch_byte_t *sendbuf = NULL;
+ uint32_t sendlen = 0;
+
+ if (switch_test_flag(read_frame, SFF_CNG)) {
+ sendlen = read_codec->implementation->bytes_per_frame;
+ memset(decoded, 255, sendlen);
+ sendbuf = decoded;
+ status = SWITCH_STATUS_SUCCESS;
+ } else {
+
+ status = switch_core_codec_decode(
+ read_codec,
+ &conninfo->read_codec,
+ read_frame->data,
+ read_frame->datalen,
+ read_codec->implementation->samples_per_second,
+ decoded, &dlen, &rate, &flags);
+ switch (status) {
+ case SWITCH_STATUS_NOOP:
+ case SWITCH_STATUS_BREAK:
+ sendbuf = read_frame->data;
+ sendlen = read_frame->datalen;
+ status = SWITCH_STATUS_SUCCESS;
+ break;
+ case SWITCH_STATUS_SUCCESS:
+ sendbuf = decoded;
+ sendlen = dlen;
+ status = SWITCH_STATUS_SUCCESS;
+ break;
+ default:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Codec Error\n");
+ switch_ivr_deactivate_unicast(session);
+ break;
+ }
+ }
+
+ if (status == SWITCH_STATUS_SUCCESS) {
+ len = sendlen;
+ if (switch_socket_sendto(conninfo->socket, conninfo->remote_addr, 0, (void *)sendbuf, &len) != SWITCH_STATUS_SUCCESS) {
+ switch_ivr_deactivate_unicast(session);
+ }
+ }
+ }
+ }
if (switch_core_session_dequeue_private_event(session, &event) == SWITCH_STATUS_SUCCESS) {
switch_ivr_parse_event(session, event);
@@ -212,6 +472,10 @@
switch_event_fire(&event);
}
+ if (switch_channel_test_flag(channel, CF_UNICAST)) {
+ switch_ivr_deactivate_unicast(session);
+ }
+
return status;
}
1
0
[commit] r4923 - in freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua: iptsec iptsec/sofia-sip nta nua nua/sofia-sip sdp sip
by Freeswitch SVN 13 Apr '07
by Freeswitch SVN 13 Apr '07
13 Apr '07
Author: mikej
Date: Fri Apr 13 10:33:30 2007
New Revision: 4923
Modified:
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/Doxyfile
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_extension.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua.h
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_100rel.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_call_reject.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_offer_answer.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.h
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_session_timer.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_simple.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sdp/run_test_sdp
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c
freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c
Log:
sync with current darcs tree
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/Doxyfile
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/Doxyfile (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/Doxyfile Fri Apr 13 10:33:30 2007
@@ -19,3 +19,6 @@
GENERATE_TAGFILE = ../docs/iptsec.doxytags
ALIASES +=
+
+PREDEFINED += SOFIA_EXTEND_AUTH_CLIENT=1
+
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c Fri Apr 13 10:33:30 2007
@@ -31,6 +31,8 @@
#include "config.h"
+#define SOFIA_EXTEND_AUTH_CLIENT 1
+
#include <sofia-sip/su.h>
#include <sofia-sip/su_md5.h>
@@ -77,9 +79,7 @@
char const *user,
char const *pass);
-static int ca_clear_credentials(auth_client_t *ca,
- char const *scheme,
- char const *realm);
+static int ca_clear_credentials(auth_client_t *ca);
/** Initialize authenticators.
@@ -340,8 +340,8 @@
* @param[in] user username
* @param[in] pass password
*
- * @retval number of matching clients
- * @retval 0 when no matching client was found
+ * @retval number of updated clients
+ * @retval 0 when no client was updated
* @retval -1 upon an error
*/
int auc_all_credentials(auth_client_t **auc_list,
@@ -375,6 +375,9 @@
char const *user,
char const *pass)
{
+ char *new_user, *new_pass;
+ char *old_user, *old_pass;
+
assert(ca);
if (!ca || !ca->ca_scheme || !ca->ca_realm)
@@ -384,12 +387,24 @@
(realm != NULL && strcmp(realm, ca->ca_realm)))
return -1;
- ca->ca_user = su_strdup(ca->ca_home, user);
- ca->ca_pass = su_strdup(ca->ca_home, pass);
+ old_user = ca->ca_user, old_pass = ca->ca_pass;
+
+ if (str0cmp(user, old_user) == 0 && str0cmp(pass, old_pass) == 0)
+ return 0;
+
+ new_user = su_strdup(ca->ca_home, user);
+ new_pass = su_strdup(ca->ca_home, pass);
- if (!ca->ca_user || !ca->ca_pass)
+ if (!new_user || !new_pass)
return -1;
+ ca->ca_user = new_user, ca->ca_pass = new_pass;
+ if (AUTH_CLIENT_IS_EXTENDED(ca))
+ ca->ca_clear = 0;
+
+ su_free(ca->ca_home, old_user);
+ su_free(ca->ca_home, old_pass);
+
return 1;
}
@@ -416,12 +431,15 @@
char *u, *p;
if (!ca->ca_user || !ca->ca_pass)
continue;
+ if (AUTH_CLIENT_IS_EXTENDED(ca) && ca->ca_clear)
+ continue;
if (!ca->ca_scheme[0] || strcmp(ca->ca_scheme, d->ca_scheme))
continue;
if (!ca->ca_realm[0] || strcmp(ca->ca_realm, d->ca_realm))
continue;
- if (d->ca_user && strcmp(d->ca_user, ca->ca_user) == 0 &&
+ if (!(AUTH_CLIENT_IS_EXTENDED(d) && d->ca_clear) &&
+ d->ca_user && strcmp(d->ca_user, ca->ca_user) == 0 &&
d->ca_pass && strcmp(d->ca_pass, ca->ca_pass) == 0) {
retval++;
break;
@@ -435,6 +453,9 @@
if (d->ca_user) su_free(d->ca_home, (void *)d->ca_user);
if (d->ca_pass) su_free(d->ca_home, (void *)d->ca_pass);
d->ca_user = u, d->ca_pass = p;
+ if (AUTH_CLIENT_IS_EXTENDED(d))
+ d->ca_clear = 0;
+
retval++;
break;
}
@@ -457,13 +478,24 @@
* @retval -1 upon an error
*/
int auc_clear_credentials(auth_client_t **auc_list,
- char const *scheme,
- char const *realm)
+ char const *scheme,
+ char const *realm)
{
int retval = 0;
+ int match;
for (; *auc_list; auc_list = &(*auc_list)->ca_next) {
- int match = ca_clear_credentials(*auc_list, scheme, realm);
+ auth_client_t *ca = *auc_list;
+
+ if (!AUTH_CLIENT_IS_EXTENDED(ca))
+ continue;
+
+ if ((scheme != NULL && strcasecmp(scheme, ca->ca_scheme)) ||
+ (realm != NULL && strcmp(realm, ca->ca_realm)))
+ continue;
+
+ match = ca->ca_auc->auc_clear(*auc_list);
+
if (match < 0) {
retval = -1;
break;
@@ -476,21 +508,14 @@
}
static
-int ca_clear_credentials(auth_client_t *ca,
- char const *scheme,
- char const *realm)
+int ca_clear_credentials(auth_client_t *ca)
{
- assert(ca);
-
- if (!ca || !ca->ca_scheme || !ca->ca_realm)
- return -1;
+ assert(ca); assert(ca->ca_home->suh_size >= (int)(sizeof *ca));
- if ((scheme != NULL && strcasecmp(scheme, ca->ca_scheme)) ||
- (realm != NULL && strcmp(realm, ca->ca_realm)))
+ if (!ca)
return -1;
- su_free(ca->ca_home, (void *)ca->ca_user), ca->ca_user = NULL;
- su_free(ca->ca_home, (void *)ca->ca_pass), ca->ca_pass = NULL;
+ ca->ca_clear = 1;
return 1;
}
@@ -513,6 +538,8 @@
for (ca = *auc_list; ca; ca = ca->ca_next) {
if (!ca->ca_user || !ca->ca_pass || !ca->ca_credential_class)
return 0;
+ if (AUTH_CLIENT_IS_EXTENDED(ca) && ca->ca_clear)
+ return 0;
}
return 1;
@@ -570,8 +597,11 @@
if (!ca->ca_auc)
continue;
- if (ca->ca_auc->auc_authorize(ca, home, method, url, body, &h) < 0
- || msg_header_insert(msg, pub, h) < 0)
+ if (ca->ca_auc->auc_authorize(ca, home, method, url, body, &h) < 0)
+ return -1;
+ if (h == NULL)
+ continue;
+ if (msg_header_insert(msg, pub, h) < 0)
return -1;
}
@@ -639,14 +669,15 @@
msg_payload_t const *body,
msg_header_t **);
-const auth_client_plugin_t ca_basic_plugin =
+static const auth_client_plugin_t ca_basic_plugin =
{
/* auc_plugin_size: */ sizeof ca_basic_plugin,
/* auc_size: */ sizeof (auth_client_t),
/* auc_name: */ "Basic",
/* auc_challenge: */ NULL,
/* auc_authorize: */ auc_basic_authorization,
- /* auc_info: */ NULL
+ /* auc_info: */ NULL,
+ /* auc_clear: */ ca_clear_credentials
};
/**Create a basic authorization header.
@@ -683,6 +714,9 @@
if (user == NULL || pass == NULL)
return -1;
+ if (AUTH_CLIENT_IS_EXTENDED(ca) && ca->ca_clear)
+ return 0;
+
ulen = strlen(user), plen = strlen(pass), uplen = ulen + 1 + plen;
b64len = BASE64_SIZE(uplen);
basiclen = strlen("Basic ") + b64len;
@@ -746,7 +780,8 @@
/* auc_name: */ "Digest",
/* auc_challenge: */ auc_digest_challenge,
/* auc_authorize: */ auc_digest_authorization,
- /* auc_info: */ auc_digest_info
+ /* auc_info: */ auc_digest_info,
+ /* auc_clear: */ ca_clear_credentials
};
/** Store a digest authorization challenge.
@@ -826,9 +861,9 @@
* sip_authorization_class or sip_proxy_authorization_class, as well as
* http_authorization_class or http_proxy_authorization_class.
*
- * @return
- * Returns a pointer to newly created authorization header, or NULL upon an
- * error.
+ * @retval 1 when authorization headers has been created
+ * @retval 0 when there is no credentials
+ * @retval -1 upon an error
*/
static
int auc_digest_authorization(auth_client_t *ca,
@@ -854,6 +889,9 @@
auth_response_t ar[1] = {{ 0 }};
char ncount[17];
+ if (!user || !pass || (AUTH_CLIENT_IS_EXTENDED(ca) && ca->ca_clear))
+ return 0;
+
ar->ar_size = sizeof(ar);
ar->ar_username = user;
ar->ar_realm = ac->ac_realm;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h Fri Apr 13 10:33:30 2007
@@ -29,6 +29,9 @@
/**@file sofia-sip/auth_client_plugin.h
* @brief Client-side plugin interface for authentication
*
+ * @note For extensions in 1.12.6 or later,
+ * you have to #define SOFIA_EXTEND_AUTH_CLIENT to 1.
+ *
* @author Pekka Pessi <Pekka.Pessi(a)nokia.com>
*
* @date Created: Fri May 19 16:18:21 EEST 2006
@@ -58,6 +61,10 @@
char *ca_pass;
msg_hclass_t *ca_credential_class;
+
+#if SOFIA_EXTEND_AUTH_CLIENT
+ int ca_clear;
+#endif
};
struct auth_client_plugin
@@ -81,8 +88,19 @@
/** Store nextnonce from Authentication-Info or Proxy-Authentication-Info. */
int (*auc_info)(auth_client_t *ca, msg_auth_info_t const *ai);
+
+#if SOFIA_EXTEND_AUTH_CLIENT
+ /** Clear credentials (user/pass). @NEW_1_12_6 */
+ int (*auc_clear)(auth_client_t *ca);
+#endif
};
+/** Check if authentication client has been extended. @NEW_1_12_6 */
+#define AUTH_CLIENT_IS_EXTENDED(ca) \
+ ((ca)->ca_auc->auc_plugin_size > \
+ offsetof(auth_client_plugin_t, auc_clear) \
+ && (ca)->ca_auc->auc_clear != NULL)
+
SOFIA_END_DECLS
#endif /* !defined AUTH_CLIENT_PLUGIN_H */
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/nta.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/nta.c Fri Apr 13 10:33:30 2007
@@ -8016,7 +8016,7 @@
{
nta_agent_t *sa = orq->orq_agent;
short orq_status = orq->orq_status;
- int internal = sip == NULL || (sip->sip_flags & NTA_INTERNAL_MSG) == 0;
+ int internal = sip == NULL || (sip->sip_flags & NTA_INTERNAL_MSG) != 0;
if (status < 100) status = 100;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c Fri Apr 13 10:33:30 2007
@@ -216,6 +216,50 @@
return su_strdup(home, str);
}
+/** Check if event is a request that can be responded with nua_respond().
+ *
+ * Note that if event status is 200 or greater, it already has been
+ * responded. This function is provided for compatibility with future
+ * versions of nua. An unknown event can always be handled in the event
+ * callback like this:
+ * @code
+ * switch (event) {
+ * ...
+ * default:
+ * if (status < 200 && nua_event_is_incoming_request(event))
+ * nua_respond(nh, SIP_501_NOT_IMPLEMENTED,
+ * NUTAG_WITH_THIS(nua), TAG_END());
+ * if (hmagic == NULL)
+ * nua_handle_destroy(nh);
+ * return;
+ * ...
+ * @endcode
+ *
+ * @sa #nua_event_t, nua_respond()
+ *
+ * @NEW_1_12_6
+ */
+int nua_event_is_incoming_request(nua_event_t event)
+{
+ switch (event) {
+ case nua_i_invite: return 1;
+ case nua_i_cancel: return 1;
+ case nua_i_register: return 1;
+ case nua_i_bye: return 1;
+ case nua_i_options: return 1;
+ case nua_i_refer: return 1;
+ case nua_i_publish: return 1;
+ case nua_i_prack: return 1;
+ case nua_i_info: return 1;
+ case nua_i_update: return 1;
+ case nua_i_message: return 1;
+ case nua_i_subscribe: return 1;
+ case nua_i_notify: return 1;
+ case nua_i_method: return 1;
+ default: return 0;
+ }
+}
+
/** Get name for a NUA event. */
char const *nua_event_name(nua_event_t event)
{
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c Fri Apr 13 10:33:30 2007
@@ -443,24 +443,6 @@
ds->ds_terminating = 0;
}
-
-/**@internal
- * Set expiration time.
- */
-void nua_dialog_usage_set_expires(nua_dialog_usage_t *du,
- unsigned delta)
-{
- if (delta) {
- sip_time_t now = sip_now(), expires = now + delta;
- if (expires < now)
- expires = SIP_TIME_MAX;
- du->du_expires = expires;
- nua_dialog_usage_set_refresh(du, delta);
- }
- else
- du->du_expires = 0, du->du_refresh = 0;
-}
-
/**@internal
* Set refresh value suitably.
*
@@ -514,6 +496,15 @@
du->du_refresh = target;
}
+/** Set absolute refresh time */
+void nua_dialog_usage_refresh_at(nua_dialog_usage_t *du,
+ sip_time_t target)
+{
+ SU_DEBUG_7(("nua(): refresh %s after %lu seconds\n",
+ nua_dialog_usage_name(du), target - sip_now()));
+ du->du_refresh = target;
+}
+
/**@internal Do not refresh. */
void nua_dialog_usage_reset_refresh(nua_dialog_usage_t *du)
{
@@ -561,8 +552,13 @@
return 1;
}
-/** (Gracefully) terminate usage */
-void nua_dialog_usage_shutdown(nua_owner_t *owner,
+/** (Gracefully) terminate usage.
+ *
+ * @retval >0 shutdown done
+ * @retval 0 shutdown in progress
+ * @retval <0 try again later
+ */
+int nua_dialog_usage_shutdown(nua_owner_t *owner,
nua_dialog_state_t *ds,
nua_dialog_usage_t *du)
{
@@ -570,6 +566,8 @@
du->du_refresh = 0;
du->du_shutdown = 1;
assert(du->du_class->usage_shutdown);
- du->du_class->usage_shutdown(owner, ds, du);
+ return du->du_class->usage_shutdown(owner, ds, du);
}
+ else
+ return 200;
}
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h Fri Apr 13 10:33:30 2007
@@ -112,6 +112,7 @@
unsigned sr_event:1; /**< Reported to application */
unsigned sr_initial:1; /**< Handle was created by this request */
unsigned sr_add_contact:1; /**< Add Contact header to the response */
+ unsigned sr_target_refresh:1; /**< Refresh target */
unsigned sr_terminating:1; /**< Terminate usage after final response */
unsigned sr_gracefully:1; /**< Terminate usage gracefully */
@@ -299,6 +300,7 @@
unsigned cr_auto:1; /**< Request was generated by stack */
unsigned cr_has_contact:1; /**< Request has user Contact */
unsigned cr_contactize:1; /**< Request needs Contact */
+ unsigned cr_dialog:1; /**< Request can initiate dialog */
/* Current state */
unsigned cr_challenged:1; /**< Request was challenged */
@@ -396,7 +398,6 @@
* Non-zero if the usage is established, SIP_TIME_MAX if there no
* expiration time.
*/
- sip_time_t du_expires;
sip_time_t du_refresh; /**< When to refresh */
@@ -439,13 +440,14 @@
int nua_dialog_shutdown(nua_owner_t *owner, nua_dialog_state_t *ds);
-void nua_dialog_usage_set_expires(nua_dialog_usage_t *du, unsigned delta);
-
void nua_dialog_usage_set_refresh(nua_dialog_usage_t *du, unsigned delta);
void nua_dialog_usage_refresh_range(nua_dialog_usage_t *du,
unsigned min, unsigned max);
+void nua_dialog_usage_refresh_at(nua_dialog_usage_t *du,
+ sip_time_t target);
+
void nua_dialog_usage_reset_refresh(nua_dialog_usage_t *du);
void nua_dialog_usage_refresh(nua_owner_t *owner,
@@ -453,9 +455,9 @@
nua_dialog_usage_t *du,
sip_time_t now);
-void nua_dialog_usage_shutdown(nua_owner_t *owner,
- nua_dialog_state_t *ds,
- nua_dialog_usage_t *du);
+int nua_dialog_usage_shutdown(nua_owner_t *owner,
+ nua_dialog_state_t *ds,
+ nua_dialog_usage_t *du);
static inline
int nua_dialog_is_established(nua_dialog_state_t const *ds)
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_extension.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_extension.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_extension.c Fri Apr 13 10:33:30 2007
@@ -75,7 +75,7 @@
{
/* create_dialog */ 0,
/* in_dialog */ 0,
- /* target_refresh */ 0
+ /* target_refresh */ 1,
},
/* nua_method_client_template */ NULL,
/* nua_method_client_init */ NULL,
@@ -146,7 +146,7 @@
SIP_METHOD_UNKNOWN,
nua_i_method, /* Event */
{
- 0, /* Do not create dialog */
+ 1, /* Do create dialog */
0, /* Can be an initial request */
1, /* Perhaps a target refresh request? */
1, /* Add a contact? */
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c Fri Apr 13 10:33:30 2007
@@ -135,7 +135,7 @@
* (or SIPTAG_ALLOW_EVENTS() or SIPTAG_ALLOW_EVENTS_STR()). The application
* can decide whether to accept the SUBSCRIBE request or reject it. The
* nua_response() call responding to a SUBSCRIBE request must have
- * NUTAG_WITH() (or NUTAG_WITH_CURRENT()/NUTAG_WITH_SAVED()) tag.
+ * NUTAG_WITH() (or NUTAG_WITH_THIS()/NUTAG_WITH_SAVED()) tag.
*
* If the application accepts the SUBSCRIBE request, it must immediately
* send an initial NOTIFY establishing the dialog. This is because the
@@ -690,9 +690,15 @@
SIPTAG_EVENT(du ? du->du_event : NULL),
TAG_NEXT(tags));
- if (nu && nu->nu_requested && du->du_cr == cr)
- /* Re-SUBSCRIBEd while NOTIFY was in progress, resend NOTIFY */
- nua_client_resend_request(cr, 0);
+ if (du && du->du_cr == cr && !cr->cr_terminated) {
+ if (nu->nu_requested) {
+ /* Re-SUBSCRIBEd while NOTIFY was in progress, resend NOTIFY */
+ nua_client_resend_request(cr, 0);
+ }
+ else if (nu->nu_expires) {
+ nua_dialog_usage_refresh_at(du, nu->nu_expires);
+ }
+ }
return 0;
}
@@ -710,7 +716,7 @@
if (cr) {
int terminating = 0;
- if (du->du_expires && du->du_expires <= now)
+ if (nu->nu_expires && nu->nu_expires <= now)
terminating = 1;
else if (nu->nu_requested && nu->nu_requested <= now)
terminating = 1;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c Fri Apr 13 10:33:30 2007
@@ -149,9 +149,10 @@
NHP_SET(nhp, auto_ack, 1);
NHP_SET(nhp, invite_timeout, 120);
- NHP_SET(nhp, session_timer, 1800);
+ nhp->nhp_session_timer = 1800;
+ nhp->nhp_refresher = nua_no_refresher;
+
NHP_SET(nhp, min_se, 120);
- NHP_SET(nhp, refresher, nua_no_refresher);
NHP_SET(nhp, update_refresh, 0);
NHP_SET(nhp, message_enable, 1);
@@ -1503,6 +1504,11 @@
#define TIF(TAG, pref) \
TAG_IF(nhp->nhp_set.nhb_##pref, TAG(nhp->nhp_##pref))
+ /* Include tag in the list returned to user
+ * if it has been earlier set (by user) returning default parameters */
+#define TIFD(TAG, pref) \
+ TAG_IF(nh == dnh || nhp->nhp_set.nhb_##pref, TAG(nhp->nhp_##pref))
+
/* Include string tag made out of SIP header
* if it has been earlier set (by user) */
#define TIF_STR(TAG, pref) \
@@ -1540,9 +1546,9 @@
TIF(NUTAG_AUTOACK, auto_ack),
TIF(NUTAG_INVITE_TIMER, invite_timeout),
- TIF(NUTAG_SESSION_TIMER, session_timer),
+ TIFD(NUTAG_SESSION_TIMER, session_timer),
TIF(NUTAG_MIN_SE, min_se),
- TIF(NUTAG_SESSION_REFRESHER, refresher),
+ TIFD(NUTAG_SESSION_REFRESHER, refresher),
TIF(NUTAG_UPDATE_REFRESH, update_refresh),
TIF(NUTAG_ENABLEMESSAGE, message_enable),
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h Fri Apr 13 10:33:30 2007
@@ -169,8 +169,8 @@
unsigned nhb_allow:1;
unsigned nhb_supported:1;
- unsigned nhb_allow_events:1;
unsigned :0; /* at most 32 bits ... */
+ unsigned nhb_allow_events:1;
unsigned nhb_user_agent:1;
unsigned nhb_organization:1;
@@ -226,4 +226,9 @@
(NHP_ISSET((nh)->nh_prefs, pref) && \
(nh)->nh_nua->nua_dhandle->nh_prefs != (nh)->nh_prefs)
+/* Check if preference has been set by applicationx */
+#define NUA_PISSET(nua, nh, pref) \
+ (NHP_ISSET((nua)->nua_dhandle->nh_prefs, pref) || \
+ ((nh) && NHP_ISSET((nh)->nh_prefs, pref)))
+
#endif /* NUA_PARAMS_H */
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c Fri Apr 13 10:33:30 2007
@@ -443,7 +443,7 @@
* events with nua_set_params() tag NUTAG_ALLOW_EVENTS().
*
* The nua_response() call responding to a PUBLISH request must have
- * NUTAG_WITH() (or NUTAG_WITH_CURRENT()/NUTAG_WITH_SAVED()) tag. Note that
+ * NUTAG_WITH() (or NUTAG_WITH_THIS()/NUTAG_WITH_SAVED()) tag. Note that
* a successful response to PUBLISH @b MUST include @Expires and @SIPETag
* headers.
*
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c Fri Apr 13 10:33:30 2007
@@ -881,7 +881,7 @@
if (mindelta == SIP_TIME_MAX)
mindelta = 3600;
- nua_dialog_usage_set_expires(du, mindelta);
+ nua_dialog_usage_set_refresh(du, mindelta);
/* RFC 3608 Section 6.1 Procedures at the UA
@@ -935,7 +935,7 @@
nua_registration_set_ready(nr, 1);
}
else if (du) {
- nua_dialog_usage_set_expires(du, 0);
+ nua_dialog_usage_set_refresh(du, 0);
su_free(nh->nh_home, nr->nr_route);
nr->nr_route = NULL;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_registrar.c Fri Apr 13 10:33:30 2007
@@ -60,7 +60,7 @@
* the REGISTER method with NUTAG_ALLOW() tag.
*
* The nua_response() call responding to a REGISTER request must have
- * NUTAG_WITH() (or NUTAG_WITH_CURRENT()/NUTAG_WITH_SAVED()) tag. Note that
+ * NUTAG_WITH() (or NUTAG_WITH_THIS()/NUTAG_WITH_SAVED()) tag. Note that
* a successful response to REGISTER @b MUST include the @Contact header
* bound to the the AoR URI (in @To header).
*
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c Fri Apr 13 10:33:30 2007
@@ -149,14 +149,23 @@
unsigned ss_precondition:1; /**< Precondition required */
- unsigned ss_timer_set:1; /**< We have active session timer. */
-
unsigned ss_reporting:1; /**< True if reporting state */
unsigned : 0;
-
- unsigned ss_session_timer; /**< Value of Session-Expires (delta) */
- unsigned ss_min_se; /**< Minimum session expires */
- enum nua_session_refresher ss_refresher; /**< none, local or remote */
+
+ struct session_timer {
+ unsigned interval; /**< Negotiated expiration time */
+ enum nua_session_refresher refresher; /**< Our Negotiated role */
+
+ struct {
+ unsigned expires, defaults; /**< Value of Session-Expires (delta) */
+ unsigned min_se; /**< Minimum session expires */
+ /** none, local or remote */
+ enum nua_session_refresher refresher;
+ unsigned supported:1, require:1, :0;
+ } local, remote;
+
+ unsigned timer_set:1; /**< We have active session timer. */
+ } ss_timer[1];
char const *ss_reason; /**< Reason for termination. */
@@ -204,11 +213,16 @@
nua_dialog_state_t *ds,
nua_dialog_usage_t *du)
{
+ nua_session_usage_t *ss = nua_dialog_usage_private(du);
+
if (ds->ds_has_session)
return -1;
ds->ds_has_session = 1;
ds->ds_got_session = 1;
+ ss->ss_timer->local.refresher = nua_any_refresher;
+ ss->ss_timer->remote.refresher = nua_any_refresher;
+
return 0;
}
@@ -297,19 +311,29 @@
int nua_stack_prack(nua_t *nua, nua_handle_t *nh, nua_event_t e,
tagi_t const *tags);
-static void session_timer_preferences(nua_session_usage_t *ss,
- unsigned expires,
- unsigned min_se,
- enum nua_session_refresher refresher);
-
-static int session_timer_is_supported(nua_handle_t const *nh);
-
-static int prefer_session_timer(nua_handle_t const *nh);
-
-static int use_session_timer(nua_session_usage_t *ss, int uas, int always,
- msg_t *msg, sip_t *);
-static int init_session_timer(nua_session_usage_t *ss, sip_t const *, int refresher);
-static void set_session_timer(nua_session_usage_t *ss);
+static int session_timer_is_supported(struct session_timer const *t);
+
+static void session_timer_preferences(struct session_timer *t,
+ sip_t const *sip,
+ sip_supported_t const *supported,
+ unsigned expires, int isset,
+ enum nua_session_refresher refresher,
+ unsigned min_se);
+
+static void session_timer_store(struct session_timer *t,
+ sip_t const *sip);
+
+static int session_timer_check_min_se(msg_t *msg, sip_t *sip,
+ sip_t const *request,
+ unsigned long min_se);
+
+static int session_timer_add_headers(struct session_timer *t,
+ int initial,
+ msg_t *msg, sip_t *sip);
+
+static void session_timer_negotiate(struct session_timer *t);
+
+static void session_timer_set(nua_session_usage_t *ss);
static int session_timer_check_restart(nua_client_request_t *cr,
int status, char const *phrase,
@@ -551,6 +575,7 @@
{
nua_handle_t *nh = cr->cr_owner;
nua_dialog_usage_t *du;
+ nua_session_usage_t *ss;
cr->cr_usage = du = nua_dialog_usage_for_session(nh->nh_ds);
/* Errors returned by nua_invite_client_init()
@@ -573,16 +598,22 @@
}
else
du = nua_dialog_usage_add(nh, nh->nh_ds, nua_session_usage, NULL);
+
if (!du)
return -1;
if (nua_client_bind(cr, du) < 0)
return nua_client_return(cr, 900, "INVITE already in progress", msg);
- session_timer_preferences(nua_dialog_usage_private(du),
+ ss = nua_dialog_usage_private(du);
+
+ session_timer_preferences(ss->ss_timer,
+ sip,
+ NH_PGET(nh, supported),
NH_PGET(nh, session_timer),
- NH_PGET(nh, min_se),
- NH_PGET(nh, refresher));
+ NUA_PISSET(nh->nh_nua, nh, session_timer),
+ NH_PGET(nh, refresher),
+ NH_PGET(nh, min_se));
cr->cr_neutral = 0;
@@ -608,12 +639,13 @@
if (invite_timeout == 0)
invite_timeout = UINT_MAX;
/* Send CANCEL if we don't get response within timeout*/
- nua_dialog_usage_set_expires(du, invite_timeout);
+ /* nua_dialog_usage_set_expires(du, invite_timeout); Xyzzy */
nua_dialog_usage_set_refresh(du, 0);
/* Add session timer headers */
- if (session_timer_is_supported(nh))
- use_session_timer(ss, 0, prefer_session_timer(nh), msg, sip);
+ if (session_timer_is_supported(ss->ss_timer))
+ session_timer_add_headers(ss->ss_timer, ss->ss_state == nua_callstate_init,
+ msg, sip);
ss->ss_100rel = NH_PGET(nh, early_media);
ss->ss_precondition = sip_has_feature(sip->sip_require, "precondition");
@@ -672,7 +704,6 @@
int status, char const *phrase,
sip_t const *sip)
{
- nua_handle_t *nh = cr->cr_owner;
nua_dialog_usage_t *du = cr->cr_usage;
nua_session_usage_t *ss = nua_dialog_usage_private(du);
@@ -682,8 +713,10 @@
else if (status < 300) {
du->du_ready = 1;
- init_session_timer(ss, sip, NH_PGET(nh, refresher));
- set_session_timer(ss);
+ if (session_timer_is_supported(ss->ss_timer))
+ session_timer_store(ss->ss_timer, sip);
+
+ session_timer_set(ss);
}
return nua_session_client_response(cr, status, phrase, sip);
@@ -1263,42 +1296,37 @@
nua_client_request_t const *cr = du->du_cr;
nua_server_request_t const *sr;
- assert(cr);
-
if (ss->ss_state >= nua_callstate_terminating ||
- /* No INVITE template */
- cr == NULL ||
/* INVITE is in progress or being authenticated */
- cr->cr_orq || cr->cr_wait_for_cred)
+ (cr && (cr->cr_orq || cr->cr_wait_for_cred)))
return;
- /* UPDATE in progress or being authenticated */
+ /* UPDATE has been queued */
for (cr = ds->ds_cr; cr; cr = cr->cr_next)
if (cr->cr_method == sip_method_update)
return;
- /* INVITE or UPDATE in progress */
+ /* INVITE or UPDATE in progress on server side */
for (sr = ds->ds_sr; sr; sr = sr->sr_next)
if (sr->sr_usage == du &&
(sr->sr_method == sip_method_invite ||
sr->sr_method == sip_method_update))
return;
- if (!ss->ss_refresher) {
- if (du->du_expires == 0 || now < du->du_expires)
- /* Refresh contact & route set using re-INVITE */
- nua_client_resend_request(du->du_cr, 0);
- else {
- ss->ss_reason = "SIP;cause=408;text=\"Session timeout\"";
- nua_stack_bye(nh->nh_nua, nh, nua_r_bye, NULL);
- }
+ if (ss->ss_timer->refresher == nua_remote_refresher) {
+ ss->ss_reason = "SIP;cause=408;text=\"Session timeout\"";
+ nua_stack_bye(nh->nh_nua, nh, nua_r_bye, NULL);
+ return;
}
else if (NH_PGET(nh, update_refresh)) {
nua_stack_update(nh->nh_nua, nh, nua_r_update, NULL);
}
- else {
+ else if (du->du_cr) {
nua_client_resend_request(du->du_cr, 0);
}
+ else {
+ nua_stack_invite(nh->nh_nua, nh, nua_r_invite, NULL);
+ }
}
/** @interal Shut down session usage.
@@ -1787,8 +1815,6 @@
sip_t const *request = sr->sr_request.sip;
- unsigned min = NH_PGET(nh, min_se);
-
if (!sr->sr_initial)
sr->sr_usage = nua_dialog_usage_get(nh->nh_ds, nua_session_usage, NULL);
@@ -1817,21 +1843,15 @@
}
if (request->sip_session_expires &&
- nta_check_session_expires(NULL, request, min, TAG_END())) {
- sip_min_se_t *min_se, min_se0[1];
-
- min_se = sip_min_se_init(min_se0);
- min_se->min_delta = min;
-
- if (request->sip_min_se && request->sip_min_se->min_delta > min)
- min_se = request->sip_min_se;
-
- sip_add_dup(msg, sip, (sip_header_t *)min_se);
-
- return SR_STATUS1(sr, SIP_422_SESSION_TIMER_TOO_SMALL);
+ sip_has_feature(NH_PGET(nh, supported), "timer") &&
+ session_timer_check_min_se(msg, sip, request, NH_PGET(nh, min_se))) {
+ if (sip->sip_min_se)
+ return SR_STATUS1(sr, SIP_422_SESSION_TIMER_TOO_SMALL);
+ else
+ return SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
}
- session_get_description(sr->sr_request.sip, &sr->sr_sdp, &sr->sr_sdp_len);
+ session_get_description(request, &sr->sr_sdp, &sr->sr_sdp_len);
return 0;
}
@@ -1885,14 +1905,7 @@
if (ss->ss_precondition)
ss->ss_100rel = 1;
- session_timer_preferences(ss,
- NH_PGET(nh, session_timer),
- NH_PGET(nh, min_se),
- NH_PGET(nh, refresher));
-
- /* Session Timer negotiation */
- if (sip_has_supported(NH_PGET(nh, supported), "timer"))
- init_session_timer(ss, request, ss->ss_refresher);
+ session_timer_store(ss->ss_timer, request);
assert(ss->ss_state >= nua_callstate_ready ||
ss->ss_state == nua_callstate_init);
@@ -2043,9 +2056,18 @@
return 0;
}
- if (ss->ss_refresher && 200 <= sr->sr_status && sr->sr_status < 300)
- if (session_timer_is_supported(nh))
- use_session_timer(ss, 1, 1, msg, sip);
+ if (200 <= sr->sr_status && sr->sr_status < 300) {
+ session_timer_preferences(ss->ss_timer,
+ sip,
+ NH_PGET(nh, supported),
+ NH_PGET(nh, session_timer),
+ NUA_PISSET(nh->nh_nua, nh, session_timer),
+ NH_PGET(nh, refresher),
+ NH_PGET(nh, min_se));
+
+ if (session_timer_is_supported(ss->ss_timer))
+ session_timer_add_headers(ss->ss_timer, 0, msg, sip);
+ }
return nua_base_server_respond(sr, tags);
}
@@ -2249,7 +2271,7 @@
nua_stack_event(nh->nh_nua, nh, msg, nua_i_ack, SIP_200_OK, NULL);
signal_call_state_change(nh, ss, 200, "OK", nua_callstate_ready);
- set_session_timer(ss);
+ session_timer_set(ss);
nua_server_request_destroy(sr);
@@ -2560,171 +2582,6 @@
}
/* ---------------------------------------------------------------------- */
-/* Session timer - RFC 4028 */
-
-static int session_timer_is_supported(nua_handle_t const *nh)
-{
- /* Is timer feature supported? */
- return sip_has_supported(NH_PGET(nh, supported), "timer");
-}
-
-static int prefer_session_timer(nua_handle_t const *nh)
-{
- return
- NH_PGET(nh, refresher) != nua_no_refresher ||
- NH_PGET(nh, session_timer) != 0;
-}
-
-/* Initialize session timer */
-static
-void session_timer_preferences(nua_session_usage_t *ss,
- unsigned expires,
- unsigned min_se,
- enum nua_session_refresher refresher)
-{
- if (expires < min_se)
- expires = min_se;
- if (refresher && expires == 0)
- expires = 3600;
-
- ss->ss_min_se = min_se;
- ss->ss_session_timer = expires;
- ss->ss_refresher = refresher;
-}
-
-
-/** Add timer featuretag and Session-Expires/Min-SE headers */
-static int
-use_session_timer(nua_session_usage_t *ss, int uas, int always,
- msg_t *msg, sip_t *sip)
-{
- sip_min_se_t min_se[1];
- sip_session_expires_t session_expires[1];
-
- static sip_param_t const x_params_uac[] = {"refresher=uac", NULL};
- static sip_param_t const x_params_uas[] = {"refresher=uas", NULL};
-
- /* Session-Expires timer */
- if (ss->ss_refresher == nua_no_refresher && !always)
- return 0;
-
- sip_min_se_init(min_se)->min_delta = ss->ss_min_se;
- sip_session_expires_init(session_expires)->x_delta = ss->ss_session_timer;
-
- if (ss->ss_refresher == nua_remote_refresher)
- session_expires->x_params = uas ? x_params_uac : x_params_uas;
- else if (ss->ss_refresher == nua_local_refresher)
- session_expires->x_params = uas ? x_params_uas : x_params_uac;
-
- sip_add_tl(msg, sip,
- TAG_IF(ss->ss_session_timer,
- SIPTAG_SESSION_EXPIRES(session_expires)),
- TAG_IF(ss->ss_min_se != 0
- /* Min-SE: 0 is optional with initial INVITE */
- || ss->ss_state != nua_callstate_init,
- SIPTAG_MIN_SE(min_se)),
- TAG_IF(ss->ss_refresher == nua_remote_refresher,
- SIPTAG_REQUIRE_STR("timer")),
- TAG_END());
-
- return 1;
-}
-
-static int
-init_session_timer(nua_session_usage_t *ss,
- sip_t const *sip,
- int refresher)
-{
- int server;
-
- /* Session timer is not needed */
- if (!sip->sip_session_expires) {
- if (!sip_has_supported(sip->sip_supported, "timer"))
- ss->ss_refresher = nua_local_refresher;
- return 0;
- }
-
- ss->ss_refresher = nua_no_refresher;
- ss->ss_session_timer = sip->sip_session_expires->x_delta;
-
- if (sip->sip_min_se != NULL
- && sip->sip_min_se->min_delta > ss->ss_min_se)
- ss->ss_min_se = sip->sip_min_se->min_delta;
-
- server = sip->sip_request != NULL;
-
- if (!sip_has_supported(sip->sip_supported, "timer"))
- ss->ss_refresher = nua_local_refresher;
- else if (!str0casecmp("uac", sip->sip_session_expires->x_refresher))
- ss->ss_refresher = server ? nua_remote_refresher : nua_local_refresher;
- else if (!str0casecmp("uas", sip->sip_session_expires->x_refresher))
- ss->ss_refresher = server ? nua_local_refresher : nua_remote_refresher;
- else if (!server)
- return 0; /* XXX */
- /* User preferences */
- else if (refresher == nua_local_refresher)
- ss->ss_refresher = nua_local_refresher;
- else
- ss->ss_refresher = nua_remote_refresher;
-
- SU_DEBUG_7(("nua session: session expires in %u refreshed by %s (%s %s)\n",
- ss->ss_session_timer,
- ss->ss_refresher == nua_local_refresher ? "local" : "remote",
- server ? sip->sip_request->rq_method_name : "response to",
- server ? "request" : sip->sip_cseq->cs_method_name));
-
- return 1;
-}
-
-static int session_timer_check_restart(nua_client_request_t *cr,
- int status, char const *phrase,
- sip_t const *sip)
-{
- if (cr->cr_usage && status == 422) {
- nua_session_usage_t *ss = nua_dialog_usage_private(cr->cr_usage);
-
- if (sip->sip_min_se && ss->ss_min_se < sip->sip_min_se->min_delta)
- ss->ss_min_se = sip->sip_min_se->min_delta;
- if (ss->ss_min_se > ss->ss_session_timer)
- ss->ss_session_timer = ss->ss_min_se;
-
- return nua_client_restart(cr, 100, "Re-Negotiating Session Timer");
- }
-
- return nua_base_client_check_restart(cr, status, phrase, sip);
-}
-
-static void
-set_session_timer(nua_session_usage_t *ss)
-{
- nua_dialog_usage_t *du = nua_dialog_usage_public(ss);
-
- if (ss == NULL)
- return;
-
- if (ss->ss_refresher == nua_local_refresher) {
- ss->ss_timer_set = 1;
- nua_dialog_usage_set_expires(du, ss->ss_session_timer);
- }
- else if (ss->ss_refresher == nua_remote_refresher) {
- ss->ss_timer_set = 1;
- nua_dialog_usage_set_expires(du, ss->ss_session_timer + 32);
- nua_dialog_usage_reset_refresh(du);
- }
- else {
- ss->ss_timer_set = 0;
- nua_dialog_usage_set_expires(du, UINT_MAX);
- nua_dialog_usage_reset_refresh(du);
- }
-}
-
-static inline int
-is_session_timer_set(nua_session_usage_t *ss)
-{
- return ss->ss_timer_set;
-}
-
-/* ---------------------------------------------------------------------- */
/* Automatic notifications from a referral */
static int
@@ -2787,7 +2644,6 @@
return 0;
}
-
static void
nh_referral_respond(nua_handle_t *nh, int status, char const *phrase)
{
@@ -3099,8 +2955,17 @@
}
/* Add session timer headers */
- if (session_timer_is_supported(nh))
- use_session_timer(ss, 0, prefer_session_timer(nh), msg, sip);
+ session_timer_preferences(ss->ss_timer,
+ sip,
+ NH_PGET(nh, supported),
+ NH_PGET(nh, session_timer),
+ NUA_PISSET(nh->nh_nua, nh, session_timer),
+ NH_PGET(nh, refresher),
+ NH_PGET(nh, min_se));
+
+ if (session_timer_is_supported(ss->ss_timer))
+ session_timer_add_headers(ss->ss_timer, ss->ss_state < nua_callstate_ready,
+ msg, sip);
retval = nua_base_client_request(cr, msg, sip, NULL);
@@ -3109,9 +2974,15 @@
ss->ss_update_needed = 0;
if (!cr->cr_restarting) {
+ enum nua_callstate state = ss->ss_state;
+
+ if (state == nua_callstate_ready)
+ state = nua_callstate_calling;
+
if (offer_sent)
ss->ss_oa_sent = "offer";
- signal_call_state_change(nh, ss, 0, "UPDATE sent", ss->ss_state);
+
+ signal_call_state_change(nh, ss, 0, "UPDATE sent", state);
}
}
@@ -3129,9 +3000,18 @@
assert(200 <= status);
if (ss && sip && status < 300) {
- if (is_session_timer_set(ss)) {
- init_session_timer(ss, sip, NH_PGET(nh, refresher));
- set_session_timer(ss);
+ if (session_timer_is_supported(ss->ss_timer)) {
+ nua_server_request_t *sr;
+
+ for (sr = nh->nh_ds->ds_sr; sr; sr = sr->sr_next)
+ if (sr->sr_method == sip_method_invite ||
+ sr->sr_method == sip_method_update)
+ break;
+
+ if (!sr && (!du->du_cr || !du->du_cr->cr_orq)) {
+ session_timer_store(ss->ss_timer, sip);
+ session_timer_set(ss);
+ }
}
}
@@ -3225,7 +3105,7 @@
/* Do session timer negotiation */
if (request->sip_session_expires)
- init_session_timer(ss, request, NH_PGET(nh, refresher));
+ session_timer_store(ss->ss_timer, request);
if (sr->sr_sdp) { /* Check for overlap */
nua_client_request_t *cr;
@@ -3306,11 +3186,28 @@
}
}
- if (ss->ss_refresher && 200 <= sr->sr_status && sr->sr_status < 300)
- if (session_timer_is_supported(nh)) {
- use_session_timer(ss, 1, 1, msg, sip);
- set_session_timer(ss); /* XXX */
+ if (200 <= sr->sr_status && sr->sr_status < 300) {
+ session_timer_preferences(ss->ss_timer,
+ sip,
+ NH_PGET(nh, supported),
+ NH_PGET(nh, session_timer),
+ NUA_PISSET(nh->nh_nua, nh, session_timer),
+ NH_PGET(nh, refresher),
+ NH_PGET(nh, min_se));
+
+ if (ss && session_timer_is_supported(ss->ss_timer)) {
+ nua_server_request_t *sr0;
+
+ session_timer_add_headers(ss->ss_timer, 0, msg, sip);
+
+ for (sr0 = nh->nh_ds->ds_sr; sr0; sr0 = sr0->sr_next)
+ if (sr0->sr_method == sip_method_invite)
+ break;
+
+ if (!sr0 && (!sr->sr_usage->du_cr || !sr->sr_usage->du_cr->cr_orq))
+ session_timer_set(ss);
}
+ }
return nua_base_server_respond(sr, tags);
}
@@ -3348,9 +3245,15 @@
return retval;
}
- if (offer_recv_or_answer_sent)
+ if (offer_recv_or_answer_sent) {
/* signal offer received, answer sent */
- signal_call_state_change(nh, ss, status, phrase, ss->ss_state);
+ enum nua_callstate state = ss->ss_state;
+
+ if (state == nua_callstate_ready && status < 200)
+ state = nua_callstate_received;
+
+ signal_call_state_change(nh, ss, status, phrase, state);
+ }
if (200 <= status && status < 300
&& ss->ss_state < nua_callstate_ready
@@ -3900,6 +3803,287 @@
}
/* ======================================================================== */
+/* Session timer - RFC 4028 */
+
+static int session_timer_is_supported(struct session_timer const *t)
+{
+ return t->local.supported;
+}
+
+/** Set session timer preferences */
+static
+void session_timer_preferences(struct session_timer *t,
+ sip_t const *sip,
+ sip_supported_t const *supported,
+ unsigned expires,
+ int isset,
+ enum nua_session_refresher refresher,
+ unsigned min_se)
+{
+ memset(&t->local, 0, sizeof t->local);
+
+ t->local.require = sip_has_feature(sip->sip_require, "timer");
+ t->local.supported =
+ sip_has_feature(supported, "timer") ||
+ sip_has_feature(sip->sip_supported, "timer");
+ if (isset || refresher != nua_no_refresher)
+ t->local.expires = expires;
+ else
+ t->local.defaults = expires;
+ t->local.min_se = min_se;
+ t->local.refresher = refresher;
+}
+
+static int session_timer_check_restart(nua_client_request_t *cr,
+ int status, char const *phrase,
+ sip_t const *sip)
+{
+ if (status == 422) {
+ nua_session_usage_t *ss = nua_dialog_usage_private(cr->cr_usage);
+
+ if (ss && session_timer_is_supported(ss->ss_timer)) {
+ struct session_timer *t = ss->ss_timer;
+
+ if (sip->sip_min_se && t->local.min_se < sip->sip_min_se->min_delta)
+ t->local.min_se = sip->sip_min_se->min_delta;
+ if (t->local.expires != 0 && t->local.min_se > t->local.expires)
+ t->local.expires = t->local.min_se;
+
+ return nua_client_restart(cr, 100, "Re-Negotiating Session Timer");
+ }
+ }
+
+ return nua_base_client_check_restart(cr, status, phrase, sip);
+}
+
+/** Check that received Session-Expires is longer than Min-SE */
+static
+int session_timer_check_min_se(msg_t *msg,
+ sip_t *sip,
+ sip_t const *request,
+ unsigned long min)
+{
+ if (min == 0)
+ min = 1;
+
+ /*
+ If an incoming request contains a Supported header field with a value
+ 'timer' and a Session Expires header field, the UAS MAY reject the
+ INVITE request with a 422 (Session Interval Too Small) response if
+ the session interval in the Session-Expires header field is smaller
+ than the minimum interval defined by the UAS' local policy. When
+ sending the 422 response, the UAS MUST include a Min-SE header field
+ with the value of its minimum interval. This minimum interval MUST
+ NOT be lower than 90 seconds.
+ */
+ if (request->sip_session_expires &&
+ sip_has_feature(request->sip_supported, "timer") &&
+ request->sip_session_expires->x_delta < min) {
+ sip_min_se_t min_se[1];
+
+ if (min < 90)
+ min = 90;
+
+ sip_min_se_init(min_se)->min_delta = min;
+
+ /* Include extension parameters, if any */
+ if (request->sip_min_se)
+ min_se->min_params = request->sip_min_se->min_params;
+
+ sip_add_dup(msg, sip, (sip_header_t *)min_se);
+
+ return 422;
+ }
+
+ return 0;
+}
+
+/** Store session timer parameters in request from uac / response from uas */
+static
+void session_timer_store(struct session_timer *t,
+ sip_t const *sip)
+{
+ sip_require_t const *require = sip->sip_require;
+ sip_supported_t const *supported = sip->sip_supported;
+ sip_session_expires_t const *x = sip->sip_session_expires;
+
+ t->remote.require = require && sip_has_feature(require, "timer");
+ t->remote.supported =
+ t->remote.supported || (supported && sip_has_feature(supported, "timer"));
+
+ t->remote.expires = 0;
+ t->remote.refresher = nua_any_refresher;
+ t->remote.min_se = 0;
+
+ if (x) {
+ t->remote.expires = x->x_delta;
+
+ if (x->x_refresher) {
+ int uas = sip->sip_request != NULL;
+
+ if (strcasecmp(x->x_refresher, "uac") == 0)
+ t->remote.refresher = uas ? nua_remote_refresher : nua_local_refresher;
+ else if (strcasecmp(x->x_refresher, "uas") == 0)
+ t->remote.refresher = uas ? nua_local_refresher : nua_remote_refresher;
+ }
+ }
+
+ if (sip->sip_min_se)
+ t->remote.min_se = sip->sip_min_se->min_delta;
+}
+
+/** Add timer feature and Session-Expires/Min-SE headers to request/response
+ *
+ */
+static int
+session_timer_add_headers(struct session_timer *t,
+ int initial,
+ msg_t *msg, sip_t *sip)
+{
+ unsigned long expires, min;
+ sip_min_se_t min_se[1];
+ sip_session_expires_t x[1];
+ int uas;
+
+ enum nua_session_refresher refresher = nua_any_refresher;
+
+ static sip_param_t const x_params_uac[] = {"refresher=uac", NULL};
+ static sip_param_t const x_params_uas[] = {"refresher=uas", NULL};
+
+ if (!t->local.supported)
+ return 0;
+
+ uas = sip->sip_status != NULL;
+
+ min = t->local.min_se;
+ if (min < t->remote.min_se)
+ min = t->remote.min_se;
+
+ if (uas) {
+ session_timer_negotiate(t);
+
+ refresher = t->refresher;
+ expires = t->interval;
+ }
+ else {
+ /* RFC 4028:
+ * The UAC MAY include the refresher parameter with value 'uac' if it
+ * wants to perform the refreshes. However, it is RECOMMENDED that the
+ * parameter be omitted so that it can be selected by the negotiation
+ * mechanisms described below.
+ */
+ if (t->local.refresher == nua_local_refresher)
+ refresher = nua_local_refresher;
+
+ expires = t->local.expires;
+ if (expires != 0 && expires < min)
+ expires = min;
+ }
+
+ sip_min_se_init(min_se)->min_delta = min;
+
+ sip_session_expires_init(x)->x_delta = expires;
+ if (refresher == nua_remote_refresher)
+ x->x_params = uas ? x_params_uac : x_params_uas;
+ else if (refresher == nua_local_refresher)
+ x->x_params = uas ? x_params_uas : x_params_uac;
+
+ sip_add_tl(msg, sip,
+ TAG_IF(expires != 0, SIPTAG_SESSION_EXPIRES(x)),
+ TAG_IF(min != 0
+ /* Min-SE: 0 is optional with initial INVITE */
+ || !initial,
+ SIPTAG_MIN_SE(min_se)),
+ TAG_IF(refresher == nua_remote_refresher && expires != 0,
+ SIPTAG_REQUIRE_STR("timer")),
+ TAG_END());
+
+ return 1;
+}
+
+static
+void session_timer_negotiate(struct session_timer *t)
+{
+ if (!t->local.supported)
+ t->refresher = nua_no_refresher;
+ else if (!t->remote.supported)
+ t->refresher = nua_local_refresher;
+ else if (t->remote.refresher == nua_local_refresher)
+ t->refresher = nua_local_refresher;
+ else if (t->remote.refresher == nua_remote_refresher)
+ t->refresher = nua_remote_refresher;
+ else if (t->local.refresher == nua_local_refresher)
+ t->refresher = nua_local_refresher;
+ else
+ t->refresher = nua_remote_refresher;
+
+ t->interval = t->remote.expires;
+ if (t->interval == 0)
+ t->interval = t->local.expires;
+ if (t->local.expires != 0 && t->interval > t->local.expires)
+ t->interval = t->local.expires;
+ if (t->local.defaults != 0 && t->interval > t->local.defaults)
+ t->interval = t->local.defaults;
+
+ if (t->interval != 0) {
+ if (t->interval < t->local.min_se)
+ t->interval = t->local.min_se;
+ if (t->interval < t->remote.min_se)
+ t->interval = t->remote.min_se;
+ }
+
+ if (t->interval == 0)
+ t->refresher = nua_no_refresher;
+}
+
+static void
+session_timer_set(nua_session_usage_t *ss)
+{
+ nua_dialog_usage_t *du = nua_dialog_usage_public(ss);
+ struct session_timer *t;
+
+ if (ss == NULL)
+ return;
+
+ t = ss->ss_timer;
+
+ session_timer_negotiate(t);
+
+ if (t->refresher == nua_local_refresher) {
+ unsigned low = t->interval / 2, high = t->interval / 2;
+
+ if (t->interval >= 90)
+ low -=5, high += 5;
+
+ nua_dialog_usage_refresh_range(du, low, high);
+ t->timer_set = 1;
+ }
+ else if (t->refresher == nua_remote_refresher) {
+ /* if the side not performing refreshes does not receive a
+ session refresh request before the session expiration, it SHOULD send
+ a BYE to terminate the session, slightly before the session
+ expiration. The minimum of 32 seconds and one third of the session
+ interval is RECOMMENDED. */
+ unsigned interval = t->interval;
+
+ interval -= 32 > interval / 6 ? interval / 3 : 32 + interval / 3;
+
+ nua_dialog_usage_refresh_range(du, interval, interval);
+ t->timer_set = 1;
+ }
+ else {
+ nua_dialog_usage_reset_refresh(du);
+ t->timer_set = 0;
+ }
+}
+
+static inline int
+session_timer_has_been_set(struct session_timer const *t)
+{
+ return t->timer_set;
+}
+
+/* ======================================================================== */
/** Get SDP from a SIP message.
*
@@ -4020,6 +4204,8 @@
return retval;
}
+/* ====================================================================== */
+
/** @NUA_EVENT nua_i_options
*
* Incoming OPTIONS request. The user-agent should respond to an OPTIONS
@@ -4093,4 +4279,3 @@
return nua_base_server_respond(sr, tags);
}
-
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c Fri Apr 13 10:33:30 2007
@@ -989,11 +989,10 @@
nua_stack_authenticate(nua_t *nua, nua_handle_t *nh, nua_event_t e,
tagi_t const *tags)
{
+ nua_client_request_t *cr = nh->nh_ds->ds_cr;
int status = nh_authorize(nh, TAG_NEXT(tags));
if (status > 0) {
- nua_client_request_t *cr = nh->nh_ds->ds_cr;
-
if (cr && cr->cr_wait_for_cred) {
nua_client_restart_request(cr, cr->cr_terminating, tags);
}
@@ -1003,6 +1002,14 @@
NULL);
}
}
+ else if (cr && cr->cr_wait_for_cred) {
+ cr->cr_wait_for_cred = 0;
+
+ if (status < 0)
+ nua_client_response(cr, 900, "Cannot add credentials", NULL);
+ else
+ nua_client_response(cr, 904, "No matching challenge", NULL);
+ }
else if (status < 0) {
nua_stack_event(nua, nh, NULL, e, 900, "Cannot add credentials", NULL);
}
@@ -1049,6 +1056,7 @@
nua_server_methods_t const *sm;
nua_server_request_t *sr, sr0[1];
int status, initial = 1;
+ int create_dialog;
char const *user_agent = NH_PGET(nh, user_agent);
sip_supported_t const *supported = NH_PGET(nh, supported);
@@ -1135,11 +1143,15 @@
return 481;
}
+ create_dialog = sm->sm_flags.create_dialog;
+ if (method == sip_method_message && NH_PGET(nh, win_messenger_enable))
+ create_dialog = 1;
sr = memset(sr0, 0, (sizeof sr0));
sr->sr_methods = sm;
sr->sr_method = method = sip->sip_request->rq_method;
sr->sr_add_contact = sm->sm_flags.add_contact;
+ sr->sr_target_refresh = sm->sm_flags.target_refresh;
sr->sr_owner = nh;
sr->sr_initial = initial;
@@ -1171,12 +1183,12 @@
}
if (sr->sr_status < 300 && sm->sm_preprocess && sm->sm_preprocess(sr)) {
- if (sr->sr_status < 200) /* Preprocess may have set response status */
+ if (sr->sr_status < 200) /* Set response status if preprocess did not */
SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
}
if (sr->sr_status < 300) {
- if (sm->sm_flags.target_refresh)
+ if (sr->sr_target_refresh)
nua_dialog_uas_route(nh, nh->nh_ds, sip, 1); /* Set route and tags */
nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
}
@@ -1273,7 +1285,7 @@
* content negotiation fails.
*
* When responding to an incoming INVITE request, the nua_respond() can be
- * called without NUTAG_WITH() (or NUTAG_WITH_CURRENT() or
+ * called without NUTAG_WITH() (or NUTAG_WITH_THIS() or
* NUTAG_WITH_SAVED()). Otherwise, NUTAG_WITH() will contain an indication
* of the request being responded.
*
@@ -1302,7 +1314,7 @@
* nothing
*
* @par Related Tags:
- * NUTAG_WITH(), NUTAG_WITH_CURRENT(), NUTAG_WITH_SAVED() \n
+ * NUTAG_WITH(), NUTAG_WITH_THIS(), NUTAG_WITH_SAVED() \n
* NUTAG_EARLY_ANSWER() \n
* SOATAG_ADDRESS() \n
* SOATAG_AF() \n
@@ -1696,6 +1708,7 @@
cr->cr_method = method;
cr->cr_method_name = name;
cr->cr_contactize = methods->crm_flags.target_refresh;
+ cr->cr_dialog = methods->crm_flags.create_dialog;
cr->cr_auto = 1;
if (su_msg_is_non_null(nh->nh_nua->nua_signal)) {
@@ -1927,6 +1940,10 @@
has_contact = 1;
else if (t->t_tag == nutag_url)
url = (url_string_t const *)t->t_value;
+ else if (t->t_tag == nutag_dialog) {
+ cr->cr_dialog = t->t_value > 1;
+ cr->cr_contactize = t->t_value >= 1;
+ }
else if (t->t_tag == nutag_auth && t->t_value) {
/* XXX ignoring errors */
if (nh->nh_auth)
@@ -1965,7 +1982,7 @@
sip_add_dup(msg, sip, (sip_header_t *)nua->nua_from) < 0)
goto error;
- if (cr->cr_methods->crm_flags.create_dialog) {
+ if (cr->cr_dialog) {
ds->ds_leg = nta_leg_tcreate(nua->nua_nta,
nua_stack_process_request, nh,
SIPTAG_CALL_ID(sip->sip_call_id),
@@ -2030,7 +2047,6 @@
if (sip_add_tagis(cr->cr_msg, NULL, &tags) < 0)
/* XXX */;
- cr->cr_retry_count = 0;
cr->cr_terminating = terminating;
return nua_client_request_try(cr);
@@ -2125,6 +2141,8 @@
assert(cr->cr_orq == NULL);
+ cr->cr_retry_count++;
+
if (ds->ds_leg)
leg = ds->ds_leg;
else
@@ -2161,7 +2179,7 @@
* are used: @Allow, @Supported, @Organization, and @UserAgent headers are
* added to the request if they are not already set.
*/
- if (!sip->sip_allow && !ds->ds_route)
+ if (!sip->sip_allow)
sip_add_dup(msg, sip, (sip_header_t*)NH_PGET(nh, allow));
if (!sip->sip_supported && NH_PGET(nh, supported))
@@ -2337,7 +2355,7 @@
}
else {
if (sip) {
- if (cr->cr_methods->crm_flags.target_refresh)
+ if (cr->cr_contactize)
nua_dialog_uac_route(nh, nh->nh_ds, sip, 1);
nua_dialog_store_peer_info(nh, nh->nh_ds, sip);
}
@@ -2392,7 +2410,7 @@
assert(cr && status >= 200 && phrase && sip);
- if (cr->cr_retry_count >= NH_PGET(nh, retry_count))
+ if (cr->cr_retry_count > NH_PGET(nh, retry_count))
return 0;
if (cr->cr_methods->crm_check_restart)
@@ -2482,7 +2500,6 @@
orq = cr->cr_orq, cr->cr_orq = NULL;
cr->cr_wait_for_cred = 1;
- cr->cr_retry_count++;
nua_client_report(cr, status, phrase, NULL, orq, NULL);
nta_outgoing_destroy(orq);
@@ -2507,7 +2524,7 @@
msg_t *msg;
sip_t *sip;
- if (++cr->cr_retry_count > NH_PGET(nh, retry_count))
+ if (cr->cr_retry_count > NH_PGET(nh, retry_count))
return 0;
orq = cr->cr_orq, cr->cr_orq = NULL; assert(orq);
@@ -2641,22 +2658,23 @@
if (cr->cr_terminated < 0) {
/* XXX - dialog has been terminated */;
- nua_dialog_deinit(nh, nh->nh_ds);
+ nua_dialog_deinit(nh, nh->nh_ds), cr->cr_usage = NULL;
}
else if (du) {
if (cr->cr_terminated ||
(!du->du_ready && status >= 300 && nua_client_is_bound(cr))) {
/* Usage has been destroyed */
- nua_dialog_usage_remove(nh, nh->nh_ds, du);
+ nua_dialog_usage_remove(nh, nh->nh_ds, du), cr->cr_usage = NULL;
}
else if (cr->cr_graceful) {
/* Terminate usage gracefully */
- nua_dialog_usage_shutdown(nh, nh->nh_ds, du);
+ if (nua_dialog_usage_shutdown(nh, nh->nh_ds, du) > 0)
+ cr->cr_usage = NULL;
}
}
else if (cr->cr_terminated) {
if (nh->nh_ds->ds_usage == NULL)
- nua_dialog_remove(nh, nh->nh_ds, NULL);
+ nua_dialog_remove(nh, nh->nh_ds, NULL), cr->cr_usage = NULL;
}
cr->cr_reporting = 0, nh->nh_ds->ds_reporting = 0;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h Fri Apr 13 10:33:30 2007
@@ -336,8 +336,6 @@
sip_t const *sip,
int create_dialog);
-enum { create_dialog = 1 };
-
int nua_stack_init_handle(nua_t *nua, nua_handle_t *nh,
tag_type_t tag, tag_value_t value, ...);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c Fri Apr 13 10:33:30 2007
@@ -61,6 +61,7 @@
enum nua_substate eu_substate; /**< Subscription state */
sip_time_t eu_expires; /**< Proposed expiration time */
unsigned eu_notified; /**< Number of NOTIFYs received */
+ unsigned eu_unsolicited:1; /**< Not SUBSCRIBEd or REFERed */
unsigned eu_refer:1; /**< Implied subscription by refer */
unsigned eu_final_wait:1; /**< Waiting for final NOTIFY */
unsigned eu_no_id:1; /**< Do not use "id" (even if we have one) */
@@ -443,11 +444,12 @@
*/
}
- nua_stack_tevent(nh->nh_nua, nh, NULL,
- nua_i_notify, NUA_INTERNAL_ERROR,
- NUTAG_SUBSTATE(nua_substate_terminated),
- SIPTAG_EVENT(du->du_event),
- TAG_END());
+ if (!eu->eu_unsolicited)
+ nua_stack_tevent(nh->nh_nua, nh, NULL,
+ nua_i_notify, NUA_INTERNAL_ERROR,
+ NUTAG_SUBSTATE(nua_substate_terminated),
+ SIPTAG_EVENT(du->du_event),
+ TAG_END());
nua_dialog_usage_remove(nh, ds, du);
}
@@ -504,10 +506,10 @@
SIP_METHOD_NOTIFY,
nua_i_notify, /* Event */
{
- 1, /* Do create dialog */
- 0, /* Not always in-dialog request */
- 1, /* Target refresh request */
- 1, /* Add Contact to response */
+ /* create_dialog: */ 1, /* Do create dialog */
+ /* in_dialog: */ 0, /* Not always in-dialog request */
+ /* target_refresh: */ 1, /* Target refresh request */
+ /* add_contact: */ 1, /* Add Contact to response */
},
nua_notify_server_init,
nua_notify_server_preprocess,
@@ -557,17 +559,21 @@
enum nua_substate substate = nua_substate_terminated;
sip_subscription_state_t *subs = sip->sip_subscription_state;
char const *what = "", *reason = NULL;
+ int solicited = 1;
du = nua_dialog_usage_get(ds, nua_subscribe_usage, o);
- sr->sr_usage = du;
if (du == NULL) {
if (!sip_is_allowed(NH_PGET(sr->sr_owner, appl_method), SIP_METHOD_NOTIFY))
return SR_STATUS(sr, 481, "Subscription Does Not Exist");
- /* Let application to handle unsolicited NOTIFY */
- return 0;
+
+ solicited = 0; /* Let application to handle unsolicited NOTIFY */
+ du = nua_dialog_usage_add(sr->sr_owner, ds, nua_subscribe_usage, o);
+ if (!du)
+ return SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
}
+ sr->sr_usage = du;
eu = nua_dialog_usage_private(du); assert(eu);
eu->eu_notified++;
if (!o->o_id)
@@ -602,12 +608,17 @@
}
eu->eu_substate = substate;
+ if (!solicited)
+ eu->eu_unsolicited = 1;
SU_DEBUG_5(("nua(%p): %s: %s (%s)\n",
(void *)sr->sr_owner, "nua_notify_server_preprocess",
what, reason ? reason : ""));
- return SR_STATUS1(sr, SIP_200_OK);
+ if (solicited)
+ return SR_STATUS1(sr, SIP_200_OK);
+
+ return 0;
}
@@ -656,10 +667,13 @@
NUTAG_SUBSTATE(substate),
TAG_NEXT(tags));
- if (retval >= 2 || du == NULL)
+ if (retval != 1 || du == NULL)
return retval;
- if (retry >= 0) { /* Try to subscribe again */
+ if (eu->eu_unsolicited) {
+ /* Xyzzy */;
+ }
+ else if (retry >= 0) { /* Try to subscribe again */
/* XXX - this needs through testing */
nua_dialog_remove(nh, nh->nh_ds, du); /* tear down */
nua_dialog_usage_refresh_range(du, retry, retry + 5);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c Fri Apr 13 10:33:30 2007
@@ -149,3 +149,4 @@
tag_typedef_t nutag_detect_network_updates = UINTTAG_TYPEDEF(detect_network_updates);
tag_typedef_t nutag_with = PTRTAG_TYPEDEF(with);
+tag_typedef_t nutag_dialog = UINTTAG_TYPEDEF(dialog);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua.h Fri Apr 13 10:33:30 2007
@@ -346,6 +346,9 @@
tag_type_t, tag_value_t,
...);
+/** Check if event can be responded with nua_respond() */
+SOFIAPUBFUN int nua_event_is_incoming_request(nua_event_t e);
+
#define nua_handle_home(nh) ((su_home_t *)(nh))
/** Generate an instance identifier */
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h Fri Apr 13 10:33:30 2007
@@ -157,6 +157,9 @@
*/
#define NUTAG_WITH_THIS(nua) nutag_with, tag_ptr_v(nua_current_request((nua)))
+#define NUTAG_WITH_CURRENT(nua) \
+ nutag_with, tag_ptr_v(nua_current_request((nua)))
+
/**Specify request to respond to.
*
* @par Used with
@@ -174,6 +177,26 @@
*/
#define NUTAG_WITH_SAVED(e) nutag_with, tag_ptr_v(nua_saved_event_request((e)))
+/**An (extension) method is used to create dialog or refresh target.
+ *
+ * @par Used with
+ * nua_method()
+ *
+ * @par Parameter type
+ * unsigned int (0, 1, 2)
+ *
+ * @par Values
+ * - 0 if dialog target is not refreshed
+ * - 1 if dialog target is refreshed
+ * - > 1 if dialog is to be created
+ *
+ * @NEW_1_12_6.
+ *
+ * @sa nua_method(), #nua_i_method
+ */
+#define NUTAG_DIALOG(b) nutag_dialog, tag_uint_v((b))
+SOFIAPUBVAR tag_typedef_t nutag_dialog;
+
/**Set request retry count.
*
* Retry count determines how many times stack will automatically retry
@@ -471,40 +494,48 @@
/**Default session timer in seconds.
*
- * Set default session timer in seconds when using session timer extension.
- * The value given here is the proposed session expiration time in seconds.
- * Note that the session timer extension is ponly used
+ * Set default value for session timer in seconds when the session timer
+ * extension is used. The tag value is the proposed session expiration time
+ * in seconds, the session is refreshed twice during the expiration time.
*
* @par Sending INVITE and UPDATE Requests
*
- * If NUTAG_SESSION_TIMER() is used with non-zero value, the value is
- * used in the @SessionExpires header included in the INVITE or UPDATE
- * requests. The intermediate proxies or the ultimate destination can lower
- * the interval in @SessionExpires header. If the value is too low, they can
+ * If NUTAG_SESSION_TIMER() is used with non-zero value, the value is used
+ * in the @SessionExpires header included in the INVITE or UPDATE requests.
+ * The intermediate proxies or the ultimate destination can lower the
+ * interval in @SessionExpires header. If the value is too low, they can
* reject the request with the status code <i>422 Session Timer Too
- * Small</i>. When Re-INVITE will be sent in given intervals. In that case,
- * @b nua retries the request automatically.
- *
- * @par Returning Response to the INVITE and UPDATE Requests
+ * Small</i>. In that case, @b nua increases the value of @SessionExpires
+ * header and retries the request automatically.
+ *
+ * @par Returning a Response to the INVITE and UPDATE Requests
*
* The NUTAG_SESSION_TIMER() value is also used when sending the final
* response to the INVITE or UPDATE requests. If the NUTAG_SESSION_TIMER()
- * value is 0 or the value in the @SessionExpires header of the requeast is
+ * value is 0 or the value in the @SessionExpires header of the request is
* lower than the value in NUTAG_SESSION_TIMER(), the value from the
* incoming @SessionExpires header is used. However, if the value in
* @SessionExpires is lower than the minimal acceptable session expiration
* interval specified with the tag NUTAG_MIN_SE() the request is
* automatically rejected with <i>422 Session Timer Too Small</i>.
*
+ * @par Refreshes
+ *
+ * After the initial INVITE request, the SIP session is refreshed at the
+ * intervals indicated by the @SessionExpires header returned in the 2XX
+ * response. The party indicated with the "refresher" parameter of the
+ * @SessionExpires header sends a re-INVITE requests (or an UPDATE
+ * request if NUTAG_UPDATE_REFRESH(1) parameter tag has been set).
+ *
* @par When to Use NUTAG_SESSION_TIMER()?
*
* The session time extension is enabled ("timer" feature tag is included in
* @Supported header) but not activated by default (no @SessionExpires
* header is included in the requests or responses by default). Using
- * non-zero value with NUTAG_SESSION_TIMER() activates it. When the
- * extension is activated, @nua refreshes the call state by sending periodic
- * re-INVITE or UPDATE requests unless the remote end indicated that it will
- * take care of refreshes.
+ * non-zero value with NUTAG_SESSION_TIMER() or NUTAG_SESSION_REFRESHER()
+ * activates it. When the extension is activated, @nua refreshes the call
+ * state by sending periodic re-INVITE or UPDATE requests unless the remote
+ * end indicated that it will take care of refreshes.
*
* The session timer extension is mainly useful for proxies or back-to-back
* user agents that keep call state. The call state is "soft" meaning that
@@ -512,6 +543,10 @@
* will be destroyed. An ordinary user-agent can also make use of session
* timer if it cannot get any activity feedback from RTP or other media.
*
+ * @note The session timer extension is used only if the feature
+ * tag "timer" is listed in the @Supported header, set by NUTAG_SUPPORTED(),
+ * SIPTAG_SUPPORTED(), or SIPTAG_SUPPORTED_STR() tags.
+ *
* @par Used with
* nua_invite(), nua_update(), nua_respond() \n
* nua_set_params() or nua_set_hparams() \n
@@ -530,8 +565,8 @@
* Corresponding tag taking reference parameter is NUTAG_SESSION_TIMER_REF()
*
* @sa NUTAG_SUPPORTED(), NUTAG_MIN_SE(), NUTAG_SESSION_REFRESHER(),
- * nua_invite(), #nua_r_invite, #nua_i_invite, nua_update(), #nua_r_update,
- * #nua_i_update,
+ * nua_invite(), #nua_r_invite, #nua_i_invite, nua_respond(),
+ * nua_update(), #nua_r_update, #nua_i_update,
* NUTAG_UPDATE_REFRESH(), @RFC4028, @SessionExpires, @MinSE
*/
#define NUTAG_SESSION_TIMER(x) nutag_session_timer, tag_uint_v((x))
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_100rel.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_100rel.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_100rel.c Fri Apr 13 10:33:30 2007
@@ -163,6 +163,7 @@
nua_set_params(ctx->b.nua,
NUTAG_EARLY_MEDIA(1),
+ NUTAG_SESSION_TIMER(180),
TAG_END());
run_b_until(ctx, nua_r_set_params, until_final_response);
@@ -970,6 +971,8 @@
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_update);
TEST(e->data->e_status, 200);
+ TEST_1(sip = sip_object(e->data->e_msg));
+ TEST_1(sip->sip_session_expires);
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_proceeding);
@@ -1197,14 +1200,14 @@
nua_set_params(ctx->a.nua,
NUTAG_EARLY_MEDIA(1),
- SIPTAG_SUPPORTED_STR("100rel, precondition"),
+ SIPTAG_SUPPORTED_STR("100rel, precondition, timer"),
TAG_END());
run_a_until(ctx, nua_r_set_params, until_final_response);
nua_set_params(ctx->b.nua,
NUTAG_EARLY_MEDIA(1),
NUTAG_ONLY183_100REL(1),
- SIPTAG_SUPPORTED_STR("100rel, precondition"),
+ SIPTAG_SUPPORTED_STR("100rel, precondition, timer"),
TAG_END());
run_b_until(ctx, nua_r_set_params, until_final_response);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c Fri Apr 13 10:33:30 2007
@@ -205,9 +205,16 @@
sip_replaces_t *repa, *repb;
nua_handle_t *nh;
+ static int once = 0;
+ sip_time_t se, min_se;
+
if (print_headings)
printf("TEST NUA-3.1: Basic call\n");
+ /* Disable session timer from proxy */
+ test_proxy_get_session_timer(ctx->p, &se, &min_se);
+ test_proxy_set_session_timer(ctx->p, 0, 0);
+
a_call->sdp = "m=audio 5008 RTP/AVP 8";
b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
@@ -272,6 +279,10 @@
TEST_1(sip->sip_contact);
TEST_S(sip->sip_contact->m_display, "Bob");
TEST_S(sip->sip_contact->m_url->url_user, "b+b");
+ if (!once) {
+ /* The session expiration is not used by default. */
+ TEST_1(sip->sip_session_expires == NULL);
+ }
/* Test that B uses application-specific contact */
if (ctx->proxy_tests)
TEST_1(sip->sip_contact->m_url->url_user);
@@ -293,6 +304,10 @@
TEST_1(sip->sip_contact);
TEST_S(sip->sip_contact->m_display, "Alice");
TEST_S(sip->sip_contact->m_url->url_user, "a+a");
+ if (!once++) {
+ /* The Session-Expires header is not used by default. */
+ TEST_1(sip->sip_session_expires == NULL);
+ }
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
TEST_1(is_offer_recv(e->data->e_tags));
@@ -342,6 +357,8 @@
nua_handle_destroy(a_call->nh), a_call->nh = NULL;
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
+ test_proxy_set_session_timer(ctx->p, se, min_se);
+
if (print_headings)
printf("TEST NUA-3.1: PASSED\n");
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_call_reject.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_call_reject.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_call_reject.c Fri Apr 13 10:33:30 2007
@@ -262,6 +262,7 @@
/* ------------------------------------------------------------------------ */
int reject_302(CONDITION_PARAMS), reject_305(CONDITION_PARAMS);
+int redirect_always(CONDITION_PARAMS);
int reject_604(CONDITION_PARAMS);
/*
@@ -336,6 +337,26 @@
}
}
+int redirect_always(CONDITION_PARAMS)
+{
+ if (!(check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR)))
+ return 0;
+
+ if (event == nua_i_invite) {
+ char user[30];
+ sip_contact_t m[1];
+ *m = *ep->contact;
+ snprintf(user, sizeof user, "user-%u", ep->flags.n++);
+ m->m_url->url_user = user;
+ RESPOND(ep, call, nh, SIP_302_MOVED_TEMPORARILY,
+ SIPTAG_CONTACT(m), TAG_END());
+ nua_handle_destroy(nh);
+ call->nh = NULL;
+ return 1;
+ }
+
+ return 0;
+}
int reject_604(CONDITION_PARAMS)
{
@@ -476,6 +497,25 @@
if (print_headings)
printf("TEST NUA-4.3: PASSED\n");
+ if (print_headings)
+ printf("TEST NUA-4.3.1: redirect until retry count is exceeded\n");
+
+ TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
+ INVITE(a, a_call, a_call->nh,
+ TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
+ SIPTAG_SUBJECT_STR("redirect always"),
+ SOATAG_USER_SDP_STR(a_call->sdp),
+ TAG_END());
+ run_ab_until(ctx, -1, until_terminated, -1, redirect_always);
+
+ free_events_in_list(ctx, a->events);
+ nua_handle_destroy(a_call->nh), a_call->nh = NULL;
+ free_events_in_list(ctx, b->events);
+ nua_handle_destroy(b_call->nh), b_call->nh = NULL;
+
+ if (print_headings)
+ printf("TEST NUA-4.3: PASSED\n");
+
END();
}
@@ -874,7 +914,7 @@
}
}
-int authenticate_once(CONDITION_PARAMS)
+int authenticate_bad(CONDITION_PARAMS)
{
if (!(check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR)))
return 0;
@@ -882,13 +922,8 @@
save_event_in_list(ctx, event, ep, call);
if (event == nua_r_invite && status == 401) {
- if (ep->flags.bit0) {
- nua_handle_destroy(nh); if (call) call->nh = NULL;
- return 1;
- }
- ep->flags.bit0 = 1;
AUTHENTICATE(ep, call, nh, NUTAG_AUTH("Digest:\"No hope\":jaska:secret"),
- SIPTAG_SUBJECT_STR("Got 401"),
+ SIPTAG_SUBJECT_STR("Bad password"),
TAG_END());
return 0;
}
@@ -925,7 +960,8 @@
SOATAG_USER_SDP_STR(a_call->sdp),
TAG_END());
- run_ab_until(ctx, -1, authenticate_once, -1, reject_401_bad);
+
+ run_ab_until(ctx, -1, authenticate_bad, -1, reject_401_bad);
/*
Client transitions
@@ -941,7 +977,12 @@
TEST_1(is_offer_sent(e->data->e_tags));
TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
TEST(sip_object(e->data->e_msg)->sip_status->st_status, 401);
- TEST_1(!e->next);
+ /* nua_authenticate() fails and INVITE returns an internal error response */
+ TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+ TEST(e->data->e_status, 904);
+ TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+ TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
+ TEST_1(!e->next);
free_events_in_list(ctx, a->events);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c Fri Apr 13 10:33:30 2007
@@ -871,13 +871,12 @@
return len;
}
-int test_early_bye(struct context *ctx)
+int test_bye_before_200(struct context *ctx)
{
BEGIN();
struct endpoint *a = &ctx->a, *b = &ctx->b;
struct call *a_call = a->call, *b_call = b->call;
struct event *e;
- struct nat_filter *f = NULL;
a_call->sdp = "m=audio 5008 RTP/AVP 8";
b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
@@ -950,6 +949,41 @@
if (print_headings)
printf("TEST NUA-6.1: PASSED\n");
+ END();
+}
+
+
+int bye_when_completing(CONDITION_PARAMS)
+{
+ if (!(check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR)))
+ return 0;
+
+ save_event_in_list(ctx, event, ep, call);
+
+ switch (callstate(tags)) {
+ case nua_callstate_completing:
+ ack_sent = 0;
+ BYE(ep, call, nh, TAG_END());
+ return 0;
+ case nua_callstate_terminated:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+
+int test_bye_before_ack(struct context *ctx)
+{
+ BEGIN();
+ struct endpoint *a = &ctx->a, *b = &ctx->b;
+ struct call *a_call = a->call, *b_call = b->call;
+ struct event *e;
+ struct nat_filter *f = NULL;
+
+ a_call->sdp = "m=audio 5008 RTP/AVP 8";
+ b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
+
/* Early BYE 2
A B
@@ -1048,21 +1082,275 @@
END();
}
-int bye_when_completing(CONDITION_PARAMS)
+int reject_reinvite_401(CONDITION_PARAMS);
+
+int test_bye_after_receiving_401(struct context *ctx)
{
- if (!(check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR)))
- return 0;
+ BEGIN();
+ struct endpoint *a = &ctx->a, *b = &ctx->b;
+ struct call *a_call = a->call, *b_call = b->call;
+ struct event *e;
+
+ a_call->sdp = "m=audio 5008 RTP/AVP 8";
+ b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
+
+/* BYE after receiving 401
+
+ A B
+ |-------INVITE------>|
+ |<----100 Trying-----|
+ | |
+ |<----180 Ringing----|
+ |<-------200---------|
+ |--------ACK-------->|
+ | |
+ |<------INVITE-------|
+ |--------401-------->|
+ |<--------ACK--------|
+ | |
+ |<--------BYE--------|
+ |------200 OK------->|
+ | |
+*/
+ if (print_headings)
+ printf("TEST NUA-6.3: BYE after receiving 401\n");
+
+ TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
+
+ INVITE(a, a_call, a_call->nh,
+ TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
+ SIPTAG_SUBJECT_STR("NUA-6.3"),
+ SOATAG_USER_SDP_STR(a_call->sdp),
+ NUTAG_AUTOANSWER(0),
+ TAG_END());
+
+ run_ab_until(ctx, -1, until_ready, -1, accept_call);
+
+ free_events_in_list(ctx, a->events);
+
+ TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
+ free_events_in_list(ctx, b->events);
+
+ /* re-INVITE A. */
+ INVITE(b, b_call, b_call->nh,
+ SIPTAG_SUBJECT_STR("NUA-6.3 re-INVITE"),
+ TAG_END());
+ run_ab_until(ctx, -1, reject_reinvite_401, -1, until_final_response);
+
+ TEST_1(nua_handle_has_active_call(a_call->nh));
+ TEST_1(nua_handle_has_active_call(b_call->nh));
+
+ free_events_in_list(ctx, a->events);
+ free_events_in_list(ctx, b->events);
+
+ BYE(b, b_call, b_call->nh, TAG_END());
+
+ run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
+
+ free_events_in_list(ctx, a->events);
+ nua_handle_destroy(a_call->nh), a_call->nh = NULL;
+
+ free_events_in_list(ctx, b->events);
+ nua_handle_destroy(b_call->nh), b_call->nh = NULL;
+
+ if (print_headings)
+ printf("TEST NUA-6.3: PASSED\n");
+
+ END();
+}
+
+int test_bye_after_sending_401(struct context *ctx)
+{
+ BEGIN();
+ struct endpoint *a = &ctx->a, *b = &ctx->b;
+ struct call *a_call = a->call, *b_call = b->call;
+ struct event *e;
+
+ a_call->sdp = "m=audio 5008 RTP/AVP 8";
+ b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
+
+/* BYE after sending 401
+
+ A B
+ |-------INVITE------>|
+ |<----100 Trying-----|
+ | |
+ |<----180 Ringing----|
+ |<-------200---------|
+ |--------ACK-------->|
+ | |
+ |<------INVITE-------|
+ |--------401-------->|
+ |<--------ACK--------|
+ | |
+ |--------BYE-------->|
+ |<------200 OK-------|
+ | |
+*/
+ if (print_headings)
+ printf("TEST NUA-6.4: BYE after sending 401\n");
+
+ TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
+
+ INVITE(a, a_call, a_call->nh,
+ TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
+ SIPTAG_SUBJECT_STR("NUA-6.4"),
+ SOATAG_USER_SDP_STR(a_call->sdp),
+ NUTAG_AUTOANSWER(0),
+ TAG_END());
+
+ run_ab_until(ctx, -1, until_ready, -1, accept_call);
+
+ free_events_in_list(ctx, a->events);
+
+ TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
+ free_events_in_list(ctx, b->events);
+
+ /* re-INVITE A. */
+ INVITE(b, b_call, b_call->nh,
+ SIPTAG_SUBJECT_STR("NUA-6.4 re-INVITE"),
+ TAG_END());
+ run_ab_until(ctx, -1, reject_reinvite_401, -1, until_final_response);
+
+ TEST_1(nua_handle_has_active_call(a_call->nh));
+ TEST_1(nua_handle_has_active_call(b_call->nh));
+
+ free_events_in_list(ctx, a->events);
+ free_events_in_list(ctx, b->events);
+
+ BYE(a, a_call, a_call->nh, TAG_END());
+
+ run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
+
+ free_events_in_list(ctx, a->events);
+ nua_handle_destroy(a_call->nh), a_call->nh = NULL;
+
+ free_events_in_list(ctx, b->events);
+ nua_handle_destroy(b_call->nh), b_call->nh = NULL;
+
+ if (print_headings)
+ printf("TEST NUA-6.4: PASSED\n");
+
+ END();
+}
+
+int test_bye_after_receiving_401_to_update(struct context *ctx)
+{
+ BEGIN();
+ struct endpoint *a = &ctx->a, *b = &ctx->b;
+ struct call *a_call = a->call, *b_call = b->call;
+ struct event *e;
+
+ a_call->sdp = "m=audio 5008 RTP/AVP 8";
+ b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
+
+/* BYE after receiving 401
+
+ A B
+ |-------INVITE------>|
+ |<----100 Trying-----|
+ | |
+ |<----180 Ringing----|
+ |<-------200---------|
+ |--------ACK-------->|
+ | |
+ |<------UPDATE-------|
+ |--------401-------->|
+ | |
+ |<--------BYE--------|
+ |------200 OK------->|
+ | |
+*/
+ if (print_headings)
+ printf("TEST NUA-6.5: BYE after receiving 401 to UPDATE\n");
+
+ TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
+
+ INVITE(a, a_call, a_call->nh,
+ TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
+ SIPTAG_SUBJECT_STR("NUA-6.5"),
+ SOATAG_USER_SDP_STR(a_call->sdp),
+ NUTAG_AUTOANSWER(0),
+ NUTAG_APPL_METHOD("UPDATE"),
+ TAG_END());
+
+ run_ab_until(ctx, -1, until_ready, -1, accept_call);
+
+ free_events_in_list(ctx, a->events);
+
+ TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
+ free_events_in_list(ctx, b->events);
+
+ /* UPDATE A. */
+ UPDATE(b, b_call, b_call->nh,
+ SIPTAG_SUBJECT_STR("NUA-6.4 UPDATE"),
+ TAG_END());
+ BYE(b, b_call, b_call->nh, TAG_END()); /* Queued until nua_authenticate */
+ run_ab_until(ctx, -1, reject_reinvite_401, -1, until_final_response);
+
+ TEST_1(nua_handle_has_active_call(a_call->nh));
+ TEST_1(nua_handle_has_active_call(b_call->nh));
+
+ free_events_in_list(ctx, a->events);
+ free_events_in_list(ctx, b->events);
+
+ AUTHENTICATE(b, b_call, b_call->nh, TAG_END());
+
+ run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
+
+ free_events_in_list(ctx, a->events);
+ nua_handle_destroy(a_call->nh), a_call->nh = NULL;
+
+ free_events_in_list(ctx, b->events);
+ nua_handle_destroy(b_call->nh), b_call->nh = NULL;
+
+ if (print_headings)
+ printf("TEST NUA-6.3: PASSED\n");
+
+ END();
+}
+
+int reject_reinvite_401(CONDITION_PARAMS)
+{
+ void *request = nua_current_request(nua);
save_event_in_list(ctx, event, ep, call);
- switch (callstate(tags)) {
- case nua_callstate_completing:
- ack_sent = 0;
- BYE(ep, call, nh, TAG_END());
+ if (!(check_handle(ep, call, nh, SIP_500_INTERNAL_SERVER_ERROR)))
+ return 0;
+
+ if (status < 200 && (event == nua_i_invite || event == nua_i_update)) {
+ RESPOND(ep, call, nh, SIP_401_UNAUTHORIZED,
+ NUTAG_WITH(request),
+ SIPTAG_WWW_AUTHENTICATE_STR("Digest realm=\"test_nua\", "
+ "nonce=\"nsdhfuds\", algorithm=MD5, "
+ "qop=\"auth\""),
+ TAG_END());
return 0;
+ }
+
+ if (event == nua_i_state) switch (callstate(tags)) {
+ case nua_callstate_ready:
+ return 1;
case nua_callstate_terminated:
+ if (call)
+ nua_handle_destroy(call->nh), call->nh = NULL;
return 1;
default:
return 0;
}
+
+ return 0;
+}
+
+
+int test_early_bye(struct context *ctx)
+{
+ return
+ test_bye_before_200(ctx) ||
+ test_bye_before_ack(ctx) ||
+ test_bye_after_receiving_401(ctx) ||
+ test_bye_after_sending_401(ctx) ||
+ test_bye_after_receiving_401_to_update(ctx) ||
+ 0;
}
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c Fri Apr 13 10:33:30 2007
@@ -248,8 +248,15 @@
}
#if HAVE_ALARM
else if (o_alarm) {
- alarm(o_expensive ? 60 : 120);
signal(SIGALRM, sig_alarm);
+ if (o_expensive) {
+ printf("%s: extending timeout to %u because expensive tests\n",
+ name, 240);
+ alarm(240);
+ }
+ else {
+ alarm(120);
+ }
}
#endif
@@ -316,8 +323,8 @@
retval |= test_session_timer(ctx); SINGLE_FAILURE_CHECK();
retval |= test_refer(ctx); SINGLE_FAILURE_CHECK();
retval |= test_100rel(ctx); SINGLE_FAILURE_CHECK();
- retval |= test_events(ctx); SINGLE_FAILURE_CHECK();
retval |= test_simple(ctx); SINGLE_FAILURE_CHECK();
+ retval |= test_events(ctx); SINGLE_FAILURE_CHECK();
retval |= test_extension(ctx); SINGLE_FAILURE_CHECK();
if (!o_loop)
break;
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_offer_answer.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_offer_answer.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_offer_answer.c Fri Apr 13 10:33:30 2007
@@ -86,7 +86,7 @@
sip_t *sip;
if (print_headings)
- printf("TEST NUA-6.3: No SDP answer from callee\n");
+ printf("TEST NUA-6.5: No SDP answer from callee\n");
a_call->sdp = "m=audio 5008 RTP/AVP 8";
b_call->sdp = NULL;
@@ -184,7 +184,7 @@
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
if (print_headings)
- printf("TEST NUA-6.3: PASSED\n");
+ printf("TEST NUA-6.5: PASSED\n");
END();
}
@@ -229,7 +229,7 @@
sip_t const *sip;
if (print_headings)
- printf("TEST NUA-6.4: No SDP offer from caller\n");
+ printf("TEST NUA-6.6: No SDP offer from caller\n");
a_call->sdp = "v=0\r\n"
"o=- 1 1 IN IP4 127.0.0.1\r\n"
@@ -330,7 +330,7 @@
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
if (print_headings)
- printf("TEST NUA-6.4: PASSED\n");
+ printf("TEST NUA-6.6: PASSED\n");
END();
}
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c Fri Apr 13 10:33:30 2007
@@ -375,6 +375,27 @@
}
}
+void test_proxy_set_session_timer(struct proxy *p,
+ sip_time_t session_expires,
+ sip_time_t min_se)
+{
+ if (p) {
+ p->prefs.session_expires = session_expires;
+ p->prefs.min_se = min_se;
+ }
+}
+
+void test_proxy_get_session_timer(struct proxy *p,
+ sip_time_t *return_session_expires,
+ sip_time_t *return_min_se)
+{
+ if (p) {
+ if (return_session_expires)
+ *return_session_expires = p->prefs.session_expires;
+ if (return_min_se) *return_min_se = p->prefs.min_se;
+ }
+}
+
/* ---------------------------------------------------------------------- */
static sip_contact_t *create_transport_contacts(struct proxy *p)
@@ -427,6 +448,7 @@
sip_session_expires_t *x = NULL, x0[1];
sip_min_se_t *min_se = NULL, min_se0[1];
+ char const *require = NULL;
mf = sip->sip_max_forwards;
@@ -447,24 +469,33 @@
}
if (method == sip_method_invite) {
- if (!sip->sip_min_se ||
- sip->sip_min_se->min_delta < proxy->prefs.min_se) {
- min_se = sip_min_se_init(min_se0);
- min_se->min_delta = proxy->prefs.min_se;
- }
-
- if (!sip->sip_session_expires) {
- x = sip_session_expires_init(x0);
- x->x_delta = proxy->prefs.session_expires;
- }
- else if (sip->sip_session_expires->x_delta < proxy->prefs.min_se
- && sip_has_supported(sip->sip_supported, "timer")) {
- if (min_se == NULL)
- min_se = sip->sip_min_se; assert(min_se);
- nta_incoming_treply(irq, SIP_422_SESSION_TIMER_TOO_SMALL,
- SIPTAG_MIN_SE(min_se),
- TAG_END());
- return 422;
+ if (proxy->prefs.min_se) {
+ if (!sip->sip_min_se ||
+ sip->sip_min_se->min_delta < proxy->prefs.min_se) {
+ min_se = sip_min_se_init(min_se0);
+ min_se->min_delta = proxy->prefs.min_se;
+ }
+
+ if (sip->sip_session_expires
+ && sip->sip_session_expires->x_delta < proxy->prefs.min_se
+ && sip_has_supported(sip->sip_supported, "timer")) {
+ if (min_se == NULL)
+ min_se = sip->sip_min_se; assert(min_se);
+ nta_incoming_treply(irq, SIP_422_SESSION_TIMER_TOO_SMALL,
+ SIPTAG_MIN_SE(min_se),
+ TAG_END());
+ return 422;
+ }
+ }
+
+ if (proxy->prefs.session_expires) {
+ if (!sip->sip_session_expires ||
+ sip->sip_session_expires->x_delta > proxy->prefs.session_expires) {
+ x = sip_session_expires_init(x0);
+ x->x_delta = proxy->prefs.session_expires;
+ if (!sip_has_supported(sip->sip_supported, "timer"))
+ require = "timer";
+ }
}
}
@@ -528,6 +559,7 @@
SIPTAG_REQUEST(rq),
SIPTAG_SESSION_EXPIRES(x),
SIPTAG_MIN_SE(min_se),
+ SIPTAG_REQUIRE_STR(require),
TAG_END());
if (t->client == NULL) {
proxy_transaction_destroy(t);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.h (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.h Fri Apr 13 10:33:30 2007
@@ -48,6 +48,14 @@
sip_time_t *return_expires,
sip_time_t *return_max_expires);
+void test_proxy_set_session_timer(struct proxy *p,
+ sip_time_t session_expires,
+ sip_time_t min_se);
+
+void test_proxy_get_session_timer(struct proxy *p,
+ sip_time_t *return_session_expires,
+ sip_time_t *return_min_se);
+
SOFIA_END_DECLS
#endif
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c Fri Apr 13 10:33:30 2007
@@ -685,6 +685,10 @@
run_a_until(ctx, -1, save_until_final_response);
TEST_1(e = a->events->head);
TEST_E(e->data->e_event, nua_r_unregister);
+ if (e->data->e_status == 100) {
+ TEST_1(e = e->next);
+ TEST_E(e->data->e_event, nua_r_unregister);
+ }
TEST(e->data->e_status, 200);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(!sip->sip_contact);
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_session_timer.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_session_timer.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_session_timer.c Fri Apr 13 10:33:30 2007
@@ -22,7 +22,7 @@
*
*/
-/**@CFILE test_nua_re_invite.c
+/**@CFILE test_session_timer.c
* @brief NUA-8 tests: Session timer, UPDATE
*
* @author Pekka Pessi <Pekka.Pessi(a)nokia.com>
@@ -40,11 +40,13 @@
#elif HAVE_FUNCTION
#define __func__ __FUNCTION__
#else
-#define __func__ "test_call_hold"
+#define __func__ "test_session_timer"
#endif
/* ======================================================================== */
+static size_t remove_update(void *a, void *message, size_t len);
+
int test_session_timer(struct context *ctx)
{
BEGIN();
@@ -69,22 +71,6 @@
|--INVITE->| |
|<--422----| |
|---ACK--->| |
- | |
- |-------INVITE------>|
- |<-------422---------|
- |--------ACK-------->|
- | |
- |-------INVITE------>|
- |<----100 Trying-----|
- | |
- |<----180 Ringing----|
- | |
- |<------200 OK-------|
- |--------ACK-------->|
- | |
- |<-------BYE---------|
- |-------200 OK-------|
- | |
*/
@@ -94,8 +80,15 @@
a_call->sdp = "m=audio 5008 RTP/AVP 8";
b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
+ /* We negotiate session timer of 6 second */
+ /* Disable session timer from proxy */
+ test_proxy_set_session_timer(ctx->p, 0, 0);
+
nua_set_params(ctx->b.nua,
NUTAG_SESSION_REFRESHER(nua_any_refresher),
+ NUTAG_MIN_SE(1),
+ NUTAG_SESSION_TIMER(6),
+ NTATAG_SIP_T1X64(8000),
TAG_END());
run_b_until(ctx, nua_r_set_params, until_final_response);
@@ -159,23 +152,132 @@
if (print_headings)
printf("TEST NUA-8.1.1: PASSED\n");
+ if (ctx->expensive) {
+ nua_set_hparams(a_call->nh,
+ NUTAG_SUPPORTED("timer"),
+ NUTAG_MIN_SE(1),
+ NUTAG_SESSION_TIMER(5),
+ TAG_END());
+ run_a_until(ctx, nua_r_set_params, until_final_response);
+
+ if (print_headings)
+ printf("TEST NUA-8.1.2: Wait for refresh using INVITE\n");
+
+ run_ab_until(ctx, -1, until_ready, -1, until_ready);
+
+ free_events_in_list(ctx, a->events);
+ free_events_in_list(ctx, b->events);
+
+ if (print_headings)
+ printf("TEST NUA-8.1.2: PASSED\n");
+
+ nua_set_hparams(b_call->nh,
+ NUTAG_UPDATE_REFRESH(1),
+ TAG_END());
+ run_b_until(ctx, nua_r_set_params, until_final_response);
+
+ if (print_headings)
+ printf("TEST NUA-8.1.3: Wait for refresh using UPDATE\n");
+
+ run_ab_until(ctx, -1, until_ready, -1, until_ready);
+
+ TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_update);
+
+ free_events_in_list(ctx, a->events);
+ free_events_in_list(ctx, b->events);
+
+ if (print_headings)
+ printf("TEST NUA-8.1.3: PASSED\n");
+
+ if (ctx->nat) {
+ struct nat_filter *f;
+
+ if (print_headings)
+ printf("TEST NUA-8.1.4: filter UPDATE, wait until session expires\n");
+
+ f = test_nat_add_filter(ctx->nat, remove_update, NULL, nat_inbound);
+ TEST_1(f);
+
+ run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
+
+ TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_r_bye);
+
+ free_events_in_list(ctx, a->events);
+ free_events_in_list(ctx, b->events);
+
+ nua_handle_destroy(a_call->nh), a_call->nh = NULL;
+ nua_handle_destroy(b_call->nh), b_call->nh = NULL;
+
+ test_nat_remove_filter(ctx->nat, f);
+
+ if (print_headings)
+ printf("TEST NUA-8.1.4: PASSED\n");
+ }
+ }
+
+ if (b_call->nh) {
+ if (print_headings)
+ printf("TEST NUA-8.1.9: Terminate first session timer call\n");
+
+ BYE(b, b_call, b_call->nh, TAG_END());
+ run_ab_until(ctx, -1, until_terminated, -1, until_terminated);
+ free_events_in_list(ctx, a->events);
+ free_events_in_list(ctx, b->events);
+
+ nua_handle_destroy(a_call->nh), a_call->nh = NULL;
+ nua_handle_destroy(b_call->nh), b_call->nh = NULL;
+
+ if (print_headings)
+ printf("TEST NUA-8.1.9: PASSED\n");
+ }
+
+ /*
+ | |
+ |-------INVITE------>|
+ |<-------422---------|
+ |--------ACK-------->|
+ | |
+ |-------INVITE------>|
+ |<----100 Trying-----|
+ | |
+ |<----180 Ringing----|
+ | |
+ |<------200 OK-------|
+ |--------ACK-------->|
+ | |
+ |<-------BYE---------|
+ |-------200 OK-------|
+ | |
+ */
+
if (print_headings)
- printf("TEST NUA-8.1.2: Session timers negotiation\n");
+ printf("TEST NUA-8.2: Session timers negotiation\n");
+
+ test_proxy_set_session_timer(ctx->p, 180, 90);
+
+ nua_set_params(a->nua,
+ NUTAG_SUPPORTED("timer"),
+ TAG_END());
+
+ run_a_until(ctx, nua_r_set_params, until_final_response);
- nua_set_hparams(b_call->nh,
- NUTAG_AUTOANSWER(0),
- NUTAG_MIN_SE(120),
- TAG_END());
+ nua_set_params(b->nua,
+ NUTAG_AUTOANSWER(0),
+ NUTAG_MIN_SE(120),
+ NTATAG_SIP_T1X64(2000),
+ TAG_END());
run_b_until(ctx, nua_r_set_params, until_final_response);
+ TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to),
+ TAG_END()));
INVITE(a, a_call, a_call->nh,
TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
SOATAG_USER_SDP_STR(a_call->sdp),
SIPTAG_SUPPORTED_STR("100rel, timer"),
- NUTAG_SESSION_TIMER(15),
- NUTAG_MIN_SE(5),
+ NUTAG_SESSION_TIMER(4),
+ NUTAG_MIN_SE(3),
TAG_END());
run_ab_until(ctx, -1, until_ready, -1, accept_call);
@@ -252,17 +354,17 @@
free_events_in_list(ctx, b->events);
if (print_headings)
- printf("TEST NUA-8.1: PASSED\n");
+ printf("TEST NUA-8.2: PASSED\n");
if (print_headings)
- printf("TEST NUA-8.2: use UPDATE\n");
+ printf("TEST NUA-8.3: UPDATE with session timer headers\n");
UPDATE(b, b_call, b_call->nh, TAG_END());
run_ab_until(ctx, -1, until_ready, -1, until_ready);
/* Events from B (who sent UPDATE) */
TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_state);
- TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
+ TEST(callstate(e->data->e_tags), nua_callstate_calling); /* CALLING */
TEST_1(is_offer_sent(e->data->e_tags));
if (!e->next)
run_b_until(ctx, -1, until_ready);
@@ -313,7 +415,20 @@
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
if (print_headings)
- printf("TEST NUA-8.2: PASSED\n");
+ printf("TEST NUA-8.3: PASSED\n");
END();
}
+
+static
+size_t remove_update(void *a, void *message, size_t len)
+{
+ (void)a;
+
+ if (strncmp("UPDATE ", message, 7) == 0) {
+ return 0;
+ }
+
+ return len;
+}
+
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_simple.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_simple.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_simple.c Fri Apr 13 10:33:30 2007
@@ -972,6 +972,7 @@
return ep->flags.bit0 && ep->flags.bit1;
}
+
/* ---------------------------------------------------------------------- */
/* Unsolicited NOTIFY */
@@ -1122,7 +1123,7 @@
nua_handle_destroy(b_call->nh), b_call->nh = NULL;
if (print_headings)
- printf("TEST NUA-11.6: PASSED\n");
+ printf("TEST NUA-11.7: PASSED\n");
END();
}
@@ -1144,6 +1145,155 @@
}
/* ======================================================================== */
+
+int save_until_subscription_terminated(CONDITION_PARAMS);
+int accept_subscription_until_terminated(CONDITION_PARAMS);
+
+/* Timeout subscription */
+int test_subscription_timeout(struct context *ctx)
+{
+ BEGIN();
+
+ struct endpoint *a = &ctx->a, *b = &ctx->b;
+ struct call *a_call = a->call, *b_call = b->call;
+ struct event *e;
+ sip_t const *sip;
+ tagi_t const *n_tags, *r_tags;
+
+ if (print_headings)
+ printf("TEST NUA-11.8: subscribe and wait until subscription times out\n");
+
+ TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
+
+ METHOD(a, a_call, a_call->nh,
+ NUTAG_METHOD("SUBSCRIBE"),
+ NUTAG_URL(b->contact->m_url),
+ SIPTAG_EVENT_STR("presence"),
+ SIPTAG_ACCEPT_STR("application/xpidf, application/pidf+xml"),
+ SIPTAG_EXPIRES_STR("2"),
+ NUTAG_APPL_METHOD("NOTIFY"),
+ NUTAG_DIALOG(2),
+ TAG_END());
+
+ run_ab_until(ctx,
+ -1, save_until_subscription_terminated,
+ -1, accept_subscription_until_terminated);
+
+ /* Client events:
+ nua_method(), nua_i_notify/nua_r_method, nua_i_notify
+ */
+ TEST_1(e = a->events->head);
+ if (e->data->e_event == nua_i_notify) {
+ TEST_E(e->data->e_event, nua_i_notify);
+ TEST_1(sip = sip_object(e->data->e_msg));
+ n_tags = e->data->e_tags;
+ TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_subscribe);
+ r_tags = e->data->e_tags;
+ }
+ else {
+ TEST_E(e->data->e_event, nua_r_method);
+ TEST(e->data->e_status, 202);
+ r_tags = e->data->e_tags;
+ TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_notify);
+ TEST_1(sip = sip_object(e->data->e_msg));
+ n_tags = e->data->e_tags;
+ }
+ TEST_1(sip->sip_event); TEST_S(sip->sip_event->o_type, "presence");
+ TEST_1(sip->sip_content_type);
+ TEST_S(sip->sip_content_type->c_type, "application/pidf+xml");
+ TEST_1(sip->sip_subscription_state);
+ TEST_S(sip->sip_subscription_state->ss_substate, "pending");
+ TEST_1(sip->sip_subscription_state->ss_expires);
+ TEST_1(tl_find(n_tags, nutag_substate));
+ TEST(tl_find(n_tags, nutag_substate)->t_value, nua_substate_pending);
+
+ TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_notify);
+ n_tags = e->data->e_tags;
+ TEST_1(tl_find(n_tags, nutag_substate));
+ TEST(tl_find(n_tags, nutag_substate)->t_value, nua_substate_terminated);
+ TEST_1(sip = sip_object(e->data->e_msg));
+ TEST_1(sip->sip_event);
+ TEST_1(sip->sip_subscription_state);
+ TEST_S(sip->sip_subscription_state->ss_substate, "terminated");
+ TEST_1(!sip->sip_subscription_state->ss_expires);
+ TEST_1(!e->next);
+
+ free_events_in_list(ctx, a->events);
+
+ /* Server events: nua_i_subscribe, nua_r_notify */
+ TEST_1(e = b->events->head);
+ TEST_E(e->data->e_event, nua_i_subscribe);
+ TEST_E(e->data->e_status, 100);
+ TEST_1(sip = sip_object(e->data->e_msg));
+
+ TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_notify);
+ r_tags = e->data->e_tags;
+ TEST_1(tl_find(r_tags, nutag_substate));
+ TEST(tl_find(r_tags, nutag_substate)->t_value, nua_substate_pending);
+
+ /* Notifier events: 2nd nua_r_notify */
+ TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_notify);
+ TEST_1(e->data->e_status >= 200);
+ r_tags = e->data->e_tags;
+ TEST_1(tl_find(r_tags, nutag_substate));
+ TEST(tl_find(r_tags, nutag_substate)->t_value, nua_substate_terminated);
+
+ free_events_in_list(ctx, b->events);
+
+ nua_handle_destroy(a_call->nh), a_call->nh = NULL;
+ nua_handle_destroy(b_call->nh), b_call->nh = NULL;
+
+ if (print_headings)
+ printf("TEST NUA-11.8: PASSED\n");
+
+ END();
+}
+
+int save_until_subscription_terminated(CONDITION_PARAMS)
+{
+ void *with = nua_current_request(nua);
+
+ save_event_in_list(ctx, event, ep, call);
+
+ if (event == nua_i_notify) {
+ if (status < 200)
+ RESPOND(ep, call, nh, SIP_200_OK, NUTAG_WITH(with), TAG_END());
+
+ tags = tl_find(tags, nutag_substate);
+ return tags && tags->t_value == nua_substate_terminated;
+ }
+
+ return 0;
+}
+
+int accept_subscription_until_terminated(CONDITION_PARAMS)
+{
+ void *with = nua_current_request(nua);
+
+ save_event_in_list(ctx, event, ep, call);
+
+ if (event == nua_i_subscribe && status < 200) {
+ RESPOND(ep, call, nh, SIP_202_ACCEPTED,
+ NUTAG_WITH(with),
+ SIPTAG_EXPIRES_STR("360"),
+ TAG_END());
+ NOTIFY(ep, call, nh,
+ SIPTAG_EVENT(sip->sip_event),
+ SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"),
+ SIPTAG_PAYLOAD_STR(presence_closed),
+ NUTAG_SUBSTATE(nua_substate_pending),
+ TAG_END());
+ }
+ else if (event == nua_r_notify) {
+ tags = tl_find(tags, nutag_substate);
+ return tags && tags->t_value == nua_substate_terminated;
+ }
+
+ return 0;
+}
+
+
+/* ======================================================================== */
/* Test simple methods: MESSAGE, PUBLISH, SUBSCRIBE/NOTIFY */
int test_simple(struct context *ctx)
@@ -1154,5 +1304,6 @@
|| test_subscribe_notify(ctx)
|| test_subscribe_notify_graceful(ctx)
|| test_newsub_notify(ctx)
+ || test_subscription_timeout(ctx)
;
}
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sdp/run_test_sdp
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sdp/run_test_sdp (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sdp/run_test_sdp Fri Apr 13 10:33:30 2007
@@ -6,7 +6,8 @@
#
test_sdp="${1:-./test_sdp}"
-tests="${2:-${0%/*}/tests}"
+sdp_path=`dirname $0`
+tests="${2:-${sdp_path}/tests}"
if test -r $tests/message-1.sdp ; then
@@ -20,4 +21,3 @@
echo "sdp run-tests: no tests found in $tests, skipping."
exit 77
fi
-
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/sip_feature.c Fri Apr 13 10:33:30 2007
@@ -336,7 +336,7 @@
return msg_list_e(b, bsiz, h, f);
}
-/** Check if required feature is supported.
+/** Check if required feature is not supported.
*
* @retval NULL if all the required features are supported
* @retval pointer to a @Unsupported header or
@@ -351,7 +351,7 @@
}
-/** Check if required feature is supported.
+/** Check if required feature is not supported.
*
* @retval NULL if all the required features are supported
* @retval pointer to a @Unsupported header or
@@ -370,7 +370,7 @@
}
-/** Ensure that required features are supported.
+/** Check if required features are not supported.
*
* The supported features can be listed in @Supported, @Require or
* @ProxyRequire headers (in @a supported, @a by_require, or @a
Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c (original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c Fri Apr 13 10:33:30 2007
@@ -354,7 +354,7 @@
su_home_t home[1] = { SU_HOME_INIT(home) };
char const *display;
url_t url[1];
- char const * const *params;
+ msg_param_t const *params;
char const *comment;
char const na[] = "Raaka Arska <tel:+358501970>;param=1;humppa (test) ";
char const na2[] = "tel:+358501970;param=1;humppa (test) ";
@@ -744,8 +744,6 @@
}
END();
-
- return 0;
}
msg_t *read_message(int flags, char const buffer[])
1
0
Author: mikej
Date: Thu Apr 12 16:09:23 2007
New Revision: 4922
Modified:
freeswitch/trunk/src/switch_core_session.c
Log:
do destructive session destroy in debug mode.
Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c (original)
+++ freeswitch/trunk/src/switch_core_session.c Thu Apr 12 16:09:23 2007
@@ -671,6 +671,9 @@
switch_channel_uninit((*session)->channel);
pool = (*session)->pool;
+#ifndef NDEBUG
+ memset(*session, 0, sizeof(switch_core_session_t));
+#endif
*session = NULL;
apr_pool_destroy(pool);
pool = NULL;
1
0
[commit] r4921 - in freeswitch/trunk/src: . include mod/languages/mod_spidermonkey_core_db
by Freeswitch SVN 12 Apr '07
by Freeswitch SVN 12 Apr '07
12 Apr '07
Author: mikej
Date: Thu Apr 12 14:22:09 2007
New Revision: 4921
Modified:
freeswitch/trunk/src/include/switch_core_db.h
freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
freeswitch/trunk/src/switch_core_db.c
Log:
MODLANG-10 Modify Javascript exec function to return number of changed rows, thanks Dale.
Modified: freeswitch/trunk/src/include/switch_core_db.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core_db.h (original)
+++ freeswitch/trunk/src/include/switch_core_db.h Thu Apr 12 14:22:09 2007
@@ -457,6 +457,11 @@
*/
SWITCH_DECLARE(void) switch_core_db_free(char *z);
+/**
+ * Call this routine to find the number of rows changed by the last statement.
+ */
+SWITCH_DECLARE(int) switch_core_db_changes(switch_core_db_t *db);
+
/** Return values for switch_core_db_exec() and switch_core_db_step()*/
#define SWITCH_CORE_DB_OK 0 /* Successful result */
/* beginning-of-error-codes */
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c Thu Apr 12 14:22:09 2007
@@ -117,7 +117,7 @@
static JSBool db_exec(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
struct db_obj *dbo = JS_GetPrivate(cx, obj);
- *rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+ *rval = INT_TO_JSVAL(0);
if (argc > 0) {
char *sql = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
@@ -137,7 +137,11 @@
if (err) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error %s\n", err);
switch_core_db_free(err);
- *rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+ *rval = INT_TO_JSVAL(-1);
+ } else {
+ int count = switch_core_db_changes(dbo->db);
+
+ *rval = INT_TO_JSVAL(count);
}
}
return JS_TRUE;
Modified: freeswitch/trunk/src/switch_core_db.c
==============================================================================
--- freeswitch/trunk/src/switch_core_db.c (original)
+++ freeswitch/trunk/src/switch_core_db.c Thu Apr 12 14:22:09 2007
@@ -142,6 +142,10 @@
sqlite3_free(z);
}
+SWITCH_DECLARE(int) switch_core_db_changes(switch_core_db_t *db) {
+ return sqlite3_changes(db);
+}
+
SWITCH_DECLARE(char *) switch_mprintf(const char *zFormat, ...)
{
va_list ap;
1
0