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
November 2007
- 10 participants
- 328 discussions
12 Nov '07
Author: tuyan
Date: Mon Nov 12 18:14:55 2007
New Revision: 6225
Added:
freeswitch/trunk/src/mod/endpoints/mod_opal/fscon.cxx
freeswitch/trunk/src/mod/endpoints/mod_opal/fscon.h
freeswitch/trunk/src/mod/endpoints/mod_opal/fsep.cxx
freeswitch/trunk/src/mod/endpoints/mod_opal/fsep.h
freeswitch/trunk/src/mod/endpoints/mod_opal/fsmanager.cxx
freeswitch/trunk/src/mod/endpoints/mod_opal/fsmanager.h
freeswitch/trunk/src/mod/endpoints/mod_opal/fsmediastream.cxx
freeswitch/trunk/src/mod/endpoints/mod_opal/fsmediastream.h
freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp
freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h
freeswitch/trunk/src/mod/endpoints/mod_opal/opal_h323.cxx
freeswitch/trunk/src/mod/endpoints/mod_opal/opal_h323.h
freeswitch/trunk/src/mod/endpoints/mod_opal/opal_h323con.cxx
freeswitch/trunk/src/mod/endpoints/mod_opal/opal_h323con.h
freeswitch/trunk/src/mod/endpoints/mod_opal/opal_sip.cxx
freeswitch/trunk/src/mod/endpoints/mod_opal/opal_sip.h
Log:
new codebase, does not work for now, but does the things in opal way
and media flows in rtp.
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/fscon.cxx
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/fscon.cxx Mon Nov 12 18:14:55 2007
@@ -0,0 +1,567 @@
+
+#include "fsep.h"
+#include "fscon.h"
+#include "fsmediastream.h"
+
+extern switch_endpoint_interface_t *opalfs_endpoint_interface;
+
+
+
+
+
+FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint, const PString & token, unsigned int options)
+ :OpalConnection(call, endpoint, token, options), FSEndpointInterface(NULL), FSRTPSession(NULL), OpalRTPSession(NULL)
+
+{
+
+ rtpmanager = new RTP_SessionManager();
+ RTPLocalPort = endpoint.GetMediaPort(); // source is opal
+ RTPRemotePort = endpoint.GetMediaPort() + 150; // destination is Freeswitch
+ RTPLocalAddress = endpoint.GetRTPAddress();
+ RTPRemoteAddress = endpoint.GetRTPAddress();
+
+ mediaformats+=endpoint.GetMediaFormats(); // Set mediaformats from owner endpoint
+
+
+}
+
+FSConnection::~FSConnection()
+{
+ delete rtpmanager;
+
+}
+
+
+void FSConnection::InitiateCall(const PString & party)
+{
+ phase = SetUpPhase;
+ PTRACE(1, "FSConnection: \t Initiating Call to " << party);
+ if (!OnIncomingConnection(0, NULL)){
+ PTRACE(1, "FSConnection: \t Releasing the call with CallerAbort");
+ Release(EndedByCallerAbort);
+ }else{
+ PTRACE(1, "FSConnection: \t Setting up the ownerCall");
+ ownerCall.OnSetUp(*this);
+ }
+}
+
+
+switch_call_cause_t FSConnection::SwitchInitiateCall(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t **pool)
+{
+
+ return SWITCH_CAUSE_SUCCESS;
+}
+
+// function name sucks, but lets keep it for now
+// this function gets called when calls come from external opal endpoints
+// and goes to fs
+BOOL FSConnection::CreateIncomingFSConnection()
+{
+
+ OpalCall & call = GetCall();
+ PSafePtr<OpalConnection> OtherConnection = call.GetOtherPartyConnection(*this);
+
+ //ownerCall.GetOtherPartyConnection(*this)->PreviewPeerMediaFormats(mediaformats);
+
+ PString dest(OtherConnection->GetCalledDestinationNumber());
+ //dest = dest.Right(dest.GetLength() - 3); // get destination without 'fs:'
+
+ switch_mutex_t *mut;
+ switch_core_session_t *session = NULL;
+ switch_caller_profile_t *caller_profile = NULL;
+ fs_obj_t *fs_pvt = NULL; // private object
+
+ if (!OtherConnection)
+ return FALSE;
+
+ session = switch_core_session_request(opalfs_endpoint_interface, NULL);
+
+ if(!session){
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not allocate session object\n");
+ call.Clear(EndedByNoEndPoint);
+ }
+
+ fssession = session; // store the fs session there
+ fs_pvt = (fs_obj_t*) switch_core_session_alloc(session, sizeof(fs_obj_t));
+
+ if (!fs_pvt){
+ PTRACE(3, "!fs_pvt");
+ return FALSE;
+ }
+
+
+
+ if (switch_mutex_init(&(fs_pvt->flag_mutex), SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session))){
+ PTRACE(3, "CAnnot init mutex");
+ return FALSE;
+ }
+
+ fs_pvt->ownercall = &call;
+ fs_pvt->Connection = this;
+
+ switch_core_session_set_private(session, fs_pvt);
+
+ frame.data = databuf;
+ switch_set_flag(fs_pvt, TFLAG_INBOUND);
+
+ caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
+ (const char*)GetRemotePartyName(), /** username */
+ "XML", /** TODO -> this should be configurable by core */
+ (const char*)GetRemotePartyName(), /** caller_id_name */
+ (const char*)GetRemotePartyNumber(), /** caller_id_number */
+ (const char*)GetRemotePartyAddress(),/** network addr */
+ NULL, /** ANI */
+ NULL, /** ANI II */
+ NULL, /** RDNIS */
+ "FSOpal", /** source */
+ "10.0.0.1", /** TODO -> set context */
+ (const char*) dest /** destination_number */
+ );
+
+ PWaitAndSignal m(ChannelMutex);
+
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ switch_channel_set_name(channel,(const char*) GetToken());
+ switch_channel_set_caller_profile(channel, caller_profile);
+ switch_core_session_thread_launch(session);
+ switch_channel_set_state(channel, CS_INIT);
+ switch_channel_set_flag(channel, CF_ORIGINATOR);
+ SetConnected();
+
+ return TRUE;
+}
+
+BOOL FSConnection::SetUpConnection()
+{
+
+ OpalCall & call = GetCall();
+ PSafePtr<OpalConnection> OtherConnection = call.GetOtherPartyConnection(*this);
+
+ if (!OtherConnection && !IsOriginating()){
+ PTRACE(3, "FSConn:\t No other connection in the call");
+ return FALSE;
+ }
+
+ if (IsOriginating()){
+ PTRACE(3, "FSConn:\tOutgoing Connection"); // outgoing channel on fs
+ return TRUE;
+ }
+
+ PTRACE(3, "FSConn:\tIncoming Connection for " << OtherConnection->GetCalledDestinationNumber());
+
+ SetPhase(SetUpPhase);
+
+ return CreateIncomingFSConnection();
+}
+
+BOOL FSConnection::OnSetUpConnection()
+{
+ switch_channel_t *channel = switch_core_session_get_channel(fssession);
+ assert(channel);
+
+
+
+ return TRUE;
+}
+
+
+BOOL FSConnection::SetAlerting(const PString& caleeName, BOOL withMedia)
+{
+ switch_channel_t *channel = NULL;
+
+ channel = switch_core_session_get_channel(fssession);
+ fs_obj_t *fs_pvt = (fs_obj_t*) switch_core_session_get_private(fssession);
+ assert(channel);
+
+ if (IsOriginating()) {
+ PTRACE(2, "FSConn\tSetAlerting ignored on call we originated.");
+ return TRUE;
+ }
+
+ if (phase != SetUpPhase)
+ return FALSE;
+
+ SetPhase(AlertingPhase);
+ OnAlerting(*this);
+
+ switch_channel_set_state(channel, CS_RING);
+ switch_set_flag(fs_pvt, TFLAG_IO);
+ return TRUE;
+}
+
+void FSConnection::OnAlerting(OpalConnection & connection)
+{
+ switch_channel_t *channel = NULL;
+
+ channel = switch_core_session_get_channel(fssession);
+ fs_obj_t *fs_pvt = (fs_obj_t*) switch_core_session_get_private(fssession);
+ SetPhase(EstablishedPhase);
+ switch_channel_set_variable(channel, SWITCH_ORIGINATOR_CODEC_VARIABLE, "PCMU@30i,PCMA@30i");
+
+ switch_channel_set_flag(channel, CF_ANSWERED);
+ //
+ //if (!IsOriginating())
+
+ //switch_channel_set_state(channel, CS_RING);
+
+}
+
+BOOL FSConnection::SetConnected()
+{
+ PTRACE(3, "FSConn:\tSetConnected");
+ PINDEX Session = 1;
+ if (!IsOriginating()){
+ if (mediaStreams.IsEmpty()){
+
+ //RTP_Session *rtpsession = rtpmanager->GetSession(sessionID);
+ //Get an rtp session to see if we have some in the manager
+ /*
+ for (; Session <=3 ; Session++){ // We are adding rtpsession to the manager.
+ // we have only rtp over udp for now.
+ PTRACE(3, "Adding a new rtp session to rtpmanager with id " << Session);
+ RTP_UDP *newsession = new RTP_UDP(NULL, Session, FALSE);
+ newsession->Open(RTPLocalAddress, RTPLocalPort, 0, Session, NULL, NULL);
+ newsession->SetLocalAddress(RTPLocalAddress);
+ newsession->SetRemoteSocketInfo(RTPRemoteAddress, RTPRemotePort, FALSE);
+ rtpmanager->AddSession(newsession);
+ }
+ */
+ PTRACE(3, "Mediaformats " << mediaformats);
+ //increments usecount on the rtp session object so, we have to release it after
+ //we are done.
+ //rtpsession = rtpmanager->UseSession(sessionID);
+ //OpalRTPSession = rtpsession;
+ OnConnected();
+ }
+ }
+
+ return TRUE;
+}
+
+void FSConnection::OnConnected()
+{
+ switch_channel_t *channel = NULL;
+
+ channel = switch_core_session_get_channel(fssession);
+ fs_obj_t *fs_pvt = (fs_obj_t*) switch_core_session_get_private(fssession);
+
+ if (!IsOriginating()){
+ switch_channel_set_state(channel, CS_INIT);
+ SetPhase(SetUpPhase);
+ SetAlerting("", FALSE);
+ //switch_set_flag(fs_pvt, TFLAG_IO);
+ }
+
+}
+
+void FSConnection::OnReleased()
+{
+ switch_channel_t *channel = NULL;
+
+ SetPhase(ReleasingPhase);
+
+ CloseMediaStreams();
+
+ channel = switch_core_session_get_channel(fssession);
+ assert(channel);
+ switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+ OpalConnection::OnReleased();
+
+}
+
+OpalMediaFormatList FSConnection::GetMediaFormats() const
+{
+
+ return mediaformats;
+}
+
+BOOL FSConnection::IsMediaBypassPossible(unsigned sessionID)
+{
+ return TRUE;
+}
+
+OpalMediaStream* FSConnection::CreateMediaStream(const OpalMediaFormat & mediaFormat,
+ unsigned sessionID,
+ BOOL isSource)
+{
+ if (sessionID != OpalMediaFormat::DefaultAudioSessionID) // only audio for now
+ return OpalConnection::CreateMediaStream(mediaFormat, sessionID, isSource);
+
+ PTRACE(3, "CODEC NAME from source is " << mediaFormat.GetEncodingName());
+
+ RTP_Session *rtpsession = rtpmanager->GetSession(sessionID); // Get an rtp session
+
+ if (!rtpsession){ // We have to add an rtpsession to the manager.
+ // we have only rtp over udp for now.
+ PTRACE(3, "Adding a new rtp session to rtpmanager");
+ RTP_UDP *newsession = new RTP_UDP(NULL, sessionID, FALSE);
+ newsession->Open(RTPLocalAddress, 44000, 0, sessionID, NULL, NULL);
+ newsession->SetLocalAddress(RTPLocalAddress);
+ newsession->SetRemoteSocketInfo(RTPRemoteAddress, 44501, FALSE);
+ newsession->SetRemoteSocketInfo(RTPRemoteAddress, 44500, TRUE);
+ rtpmanager->AddSession(newsession);
+ }
+
+ rtpsession = rtpmanager->UseSession(sessionID); /*increments usecount on the rtp session object*/
+
+ return CreateMediaStream(*this, mediaFormat, isSource, *rtpsession /*RTPSession*/, 0 /*minjitter delay*/, 0/*maxjitter delay*/);
+}
+
+
+
+OpalMediaStream * FSConnection::CreateMediaStream(OpalConnection & conn,
+ const OpalMediaFormat & mediaFormat,
+ BOOL isSource,
+ RTP_Session &rtpSession,
+ unsigned minAudioJitterDelay,
+ unsigned maxAudioJitterDelay)
+{
+ switch_channel_t *channel;
+ switch_rtp_flag_t flags ;
+ const char *err;
+
+ fs_obj_t *fs_pvt = (fs_obj_t*) switch_core_session_get_private(fssession);
+ channel = switch_core_session_get_channel(fssession);
+
+ PTRACE(3, "Codec name: " << mediaFormat.GetEncodingName() << " " << mediaFormat.GetClockRate() << " " << mediaFormat.GetFrameTime());
+
+ if (isSource) {
+ if (switch_core_codec_init
+ (&write_codec, "L16", NULL, mediaFormat.GetClockRate(), 30, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+ switch_core_session_get_pool(fssession)) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Cannot set write codec\n", switch_channel_get_name(channel));
+ switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+ return NULL;
+ }
+ switch_core_session_set_write_codec(fssession, &write_codec);
+
+ }else{
+ if (switch_core_codec_init
+ (&read_codec, "L16", NULL, mediaFormat.GetClockRate(), 30, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+ switch_core_session_get_pool(fssession)) != 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 NULL;
+ }
+
+ switch_core_session_set_read_codec(fssession, &read_codec);
+
+ frame.rate = mediaFormat.GetClockRate();
+ frame.codec = &read_codec;
+
+
+ }
+
+ FSRTPSession = switch_rtp_new("10.0.0.1",
+ 44500, // Source and destination is switched from opal
+ "10.0.0.1",
+ 44000, //this goes to Opal rtp data port
+ write_codec.implementation->ianacode,
+ write_codec.implementation->samples_per_frame,
+ write_codec.implementation->microseconds_per_frame,
+ flags, NULL, "soft", &err, switch_core_session_get_pool(fssession));
+
+ switch_rtp_set_flag(FSRTPSession, SWITCH_RTP_FLAG_DATAWAIT);
+ //switch_rtp_set_flag(FSRTPSession, SWITCH_RTP_FLAG_USE_TIMER);
+ //switch_rtp_set_flag(FSRTPSession, SWITCH_RTP_FLAG_AUTOADJ);
+
+
+
+ PTRACE(1, "FSConnection: new media stream !!!" << mediaFormat.GetEncodingName());
+ //switch_channel_set_state(channel, CS_UNHOLD);
+ return new FSMediaStream(*this, mediaFormat, isSource, rtpSession /*RTPSession*/, minAudioJitterDelay /*minjitter delay*/, maxAudioJitterDelay/*maxjitter delay*/);
+}
+
+
+switch_status_t FSConnection::callback_on_init(switch_core_session_t *session)
+{
+ return SWITCH_STATUS_SUCCESS;
+ PWaitAndSignal m(ChannelMutex);
+
+ OpalCall & call = GetCall();
+ PSafePtr<OpalConnection> OtherConnection = call.GetOtherPartyConnection(*this);
+
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ assert(channel);
+
+ if (!IsOriginating()) { // incoming call initialize
+ // TODO Set all the Mediaformats from fs endpoint to the
+ // fs codec strings for the channels. be carefull about early media etc.
+ //PTRACE(2, "FSConn:\t Answering Incoming Call");
+ SetConnected();
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSConnection::callback_on_ring(switch_core_session_t *io_session)
+{
+ switch_channel_t *channel = NULL;
+
+ channel = switch_core_session_get_channel(io_session);
+ //switch_channel_set_state(channel, CS_HOLD);
+ OpalConnection::StartMediaStreams();
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSConnection::callback_on_execute(switch_core_session_t *io_session)
+{
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSConnection::callback_on_hangup(switch_core_session_t *io_session)
+{
+ phase = ReleasingPhase;
+ //OpalConnection::CloseMediaStreams();
+ OpalConnection::ownerCall.Clear();
+ OnReleased();
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSConnection::callback_on_loopback(switch_core_session_t *session)
+{
+ OpalCall & call = GetCall();
+ PSafePtr<OpalConnection> OtherConnection = call.GetOtherPartyConnection(*this);
+
+ OtherConnection->AnsweringCall(AnswerCallNow);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSConnection::io_read_frame(switch_core_session_t *session, switch_frame_t **o_frame, int i_timeout, switch_io_flag_t i_flag, int i_streamId)
+{
+ switch_channel_t *channel = NULL;
+ switch_frame_t *pframe;
+ switch_status_t result;
+
+ fs_obj_t *fs_pvt = (fs_obj_t*) switch_core_session_get_private(session);
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+
+ if (!switch_test_flag(fs_pvt, TFLAG_IO)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "read");
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ pframe = &frame;
+ *o_frame = pframe;
+
+ switch_set_flag_locked(fs_pvt, TFLAG_READING);
+ result = switch_rtp_zerocopy_read_frame(FSRTPSession, pframe);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "result from read %i\n", result);
+ switch_clear_flag_locked(fs_pvt, TFLAG_READING);
+
+
+ return result;
+}
+
+switch_status_t FSConnection::io_write_frame(switch_core_session_t *session, switch_frame_t *frame, int i_timeout, switch_io_flag_t i_flag, int i_streamId)
+{
+
+ switch_channel_t *channel = NULL;
+
+ channel = switch_core_session_get_channel(session);
+ fs_obj_t *fs_pvt = (fs_obj_t*) switch_core_session_get_private(session);
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "write \n");
+
+ while(!switch_rtp_ready(FSRTPSession)){
+ if (switch_channel_ready(channel)) {
+ switch_yield(10000);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Yielding\n");
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Yielding\n");
+ return SWITCH_STATUS_GENERR;
+ }
+ }
+
+
+ if (!switch_test_flag(fs_pvt, TFLAG_IO)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "write");
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ switch_set_flag_locked(fs_pvt, TFLAG_WRITING);
+ switch_rtp_write_frame(FSRTPSession, frame, 0);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "write \n");
+ switch_clear_flag_locked(fs_pvt, TFLAG_WRITING);
+ return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t FSConnection::io_receive_message(switch_core_session_t *i_session, switch_core_session_message_t *i_message)
+{
+
+ switch_channel_t *channel = NULL;
+
+ channel = switch_core_session_get_channel(i_session);
+ OpalCall & call = GetCall();
+ PSafePtr<OpalConnection> OtherConnection = call.GetOtherPartyConnection(*this);
+
+
+
+ switch(i_message->message_id)
+ {
+ case SWITCH_MESSAGE_REDIRECT_AUDIO:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG ,"SWITCH_MESSAGE_REDIRECT_AUDIO\n");
+ break;
+ case SWITCH_MESSAGE_TRANSMIT_TEXT:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_TRANSMIT_TEXT\n");
+ break;
+ case SWITCH_MESSAGE_INDICATE_ANSWER:
+ OtherConnection->AnsweringCall(AnswerCallNow);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_INDICATE_ANSWER\n");
+ break;
+ case SWITCH_MESSAGE_INDICATE_PROGRESS:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_INDICATE_PROGRESS\n");
+ break;
+ case SWITCH_MESSAGE_INDICATE_BRIDGE:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_INDICATE_BRIDGE\n");
+ break;
+ case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_INDICATE_UNBRIDGE\n");
+ break;
+ case SWITCH_MESSAGE_INDICATE_TRANSFER:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_INDICATE_TRANSFER\n");
+ break;
+ case SWITCH_MESSAGE_INDICATE_RINGING:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_INDICATE_RINGING\n");
+ break;
+ case SWITCH_MESSAGE_INDICATE_MEDIA:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_INDICATE_MEDIA\n");
+ break;
+ case SWITCH_MESSAGE_INDICATE_NOMEDIA:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_INDICATE_NOMEDIA\n");
+ break;
+ case SWITCH_MESSAGE_INDICATE_HOLD:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_INDICATE_HOLD\n");
+ break;
+ case SWITCH_MESSAGE_INDICATE_UNHOLD:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_INDICATE_UNHOLD\n");
+ break;
+ case SWITCH_MESSAGE_INDICATE_REDIRECT:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_INDICATE_REDIRECT\n");
+ break;
+ case SWITCH_MESSAGE_INDICATE_REJECT:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_INDICATE_REJECT\n");
+ break;
+ case SWITCH_MESSAGE_INDICATE_BROADCAST:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_INDICATE_BROADCAST\n");
+ break;
+ case SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT\n");
+ break;
+ default:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"SWITCH_MESSAGE_???\n");
+ }
+
+ //switch_mutex_unlock(tech_prv->m_mutex);
+ return SWITCH_STATUS_SUCCESS;
+}
+
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/fscon.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/fscon.h Mon Nov 12 18:14:55 2007
@@ -0,0 +1,126 @@
+
+#ifndef __FREESWITCH_OPAL_CONNECTION__
+#define __FREESWITCH_OPAL_CONNECTION__
+
+#include <switch.h>
+#include <ptlib.h>
+#include <ptlib/psync.h>
+#include <opal/buildopts.h>
+#include <opal/endpoint.h>
+#include <opal/connection.h>
+#include <opal/transports.h>
+
+#include "fsep.h"
+#include "fsmediastream.h"
+
+typedef enum {
+ TFLAG_IO = (1 << 0),
+ TFLAG_INBOUND = (1 << 1),
+ TFLAG_OUTBOUND = (1 << 2),
+ TFLAG_READING = (1 << 3),
+ TFLAG_WRITING = (1 << 4)
+} TFLAGS;
+
+
+class FSConnection;
+class FSMediaStream;
+
+typedef struct fs_obj
+{
+ unsigned int flags;
+ switch_mutex_t *flag_mutex;
+ OpalCall *ownercall;
+ FSConnection *Connection;
+
+} fs_obj_t;
+
+
+
+class FSConnection : public OpalConnection
+{
+ PCLASSINFO(FSConnection, OpalConnection);
+ public:
+ FSConnection(OpalCall & call, FSEndPoint & endpoint, const PString & token, unsigned int options);
+ ~FSConnection();
+ virtual OpalMediaFormatList GetMediaFormats() const;
+ virtual OpalMediaStream * CreateMediaStream(OpalConnection & conn,
+ const OpalMediaFormat & mediaFormat,
+ BOOL isSource,
+ RTP_Session &rtpSession,
+ unsigned minAudioJitterDelay,
+ unsigned maxAudioJitterDelay);
+ virtual OpalMediaStream* CreateMediaStream (const OpalMediaFormat & mediaFormat,
+ unsigned sessionID,
+ BOOL isSource);
+
+ void InitiateCall(const PString & party);
+
+
+
+ virtual BOOL SetUpConnection();
+ virtual BOOL OnSetUpConnection();
+ virtual BOOL SetAlerting(const PString& caleeName, BOOL withMedia);
+ virtual BOOL SetConnected();
+ virtual void OnAlerting(OpalConnection & connection);
+ virtual void OnConnected();
+ virtual void OnReleased();
+ virtual BOOL IsMediaBypassPossible(unsigned sessionID);
+
+ switch_status_t callback_on_init(switch_core_session_t *io_session);
+ switch_status_t callback_on_ring(switch_core_session_t *io_session);
+ switch_status_t callback_on_execute(switch_core_session_t *io_session);
+ switch_status_t callback_on_hangup(switch_core_session_t *io_session);
+ switch_status_t callback_on_loopback(switch_core_session_t *session);
+ switch_status_t callback_on_transmit(switch_core_session_t *io_session);
+
+ switch_call_cause_t SwitchInitiateCall(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t **pool);
+
+ switch_status_t io_read_frame(switch_core_session_t *, switch_frame_t **, int, switch_io_flag_t, int);
+ switch_status_t io_write_frame(switch_core_session_t *, switch_frame_t *, int, switch_io_flag_t, int);
+ switch_status_t io_kill_channel(switch_core_session_t *, int);
+ switch_status_t io_waitfor_read(switch_core_session_t *, int, int);
+ switch_status_t io_waitfor_write(switch_core_session_t *, int, int);
+ switch_status_t io_send_dtmf(switch_core_session_t *, char *);
+ switch_status_t io_receive_message(switch_core_session_t *, switch_core_session_message_t *);
+ switch_status_t io_receive_event(switch_core_session_t *, switch_event_t *);
+ switch_status_t io_state_change(switch_core_session_t *);
+ switch_status_t io_read_video_frame(switch_core_session_t *, switch_frame_t **, int, switch_io_flag_t, int);
+ switch_status_t io_write_video_frame(switch_core_session_t *, switch_frame_t *, int, switch_io_flag_t, int);
+
+ private:
+ OpalMediaFormatList mediaformats;
+
+
+ switch_frame_t frame;
+ char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+ switch_codec_t read_codec; /* Read codec*/
+ switch_codec_t write_codec; /* Write codec*/
+ switch_timer_t timer;
+
+
+ protected:
+
+ BOOL CreateIncomingFSConnection();
+
+ switch_endpoint_interface_t *FSEndpointInterface;
+ WORD RTPLocalPort;
+ WORD RTPRemotePort;
+ PIPSocket::Address RTPLocalAddress;
+ PIPSocket::Address RTPRemoteAddress;
+
+ PMutex ChannelMutex;
+
+ RTP_SessionManager *rtpmanager;
+
+ RTP_Session *OpalRTPSession;
+
+ switch_core_session_t *fssession;
+
+
+ switch_rtp_t *FSRTPSession;
+};
+
+
+#endif //__FREESWITCH_OPAL_CONNECTION__
+
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/fsep.cxx
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/fsep.cxx Mon Nov 12 18:14:55 2007
@@ -0,0 +1,107 @@
+
+
+#include "fsep.h"
+#include "fscon.h"
+
+
+static PString MakeToken()
+{
+ return PGloballyUniqueID().AsString();
+}
+
+FSEndPoint::FSEndPoint(OpalManager & manager)
+ :OpalEndPoint(manager, "fs", CanTerminateCall), initialized(TRUE),
+ currentmediaport(MIN_MEDIA_PORT), RTPLocalAddress(PIPSocket::Address::Address())
+{
+
+
+ mediaformats+=OpalPCM16;
+ mediaformats+=OpalG711uLaw;
+ mediaformats+=OpalG711ALaw;
+ mediaformats+=OpalG711_ULAW_64K;
+ mediaformats+=OpalG711_ALAW_64K;
+ mediaformats+=OpalGSM0610;
+ mediaformats+=OpalPCM16_16KHZ;
+ mediaformats+=OPAL_G729;
+ mediaformats+=OPAL_G729A;
+ mediaformats+=OPAL_G729B;
+ mediaformats+=OPAL_G729AB;
+ PTRACE(3, "FSEndPoint: \t FSEndPoint Created!");
+}
+
+FSEndPoint::~FSEndPoint()
+{
+
+}
+
+BOOL FSEndPoint::SetRTPAddress(PIPSocket::Address addr)
+{
+ RTPLocalAddress = addr;
+
+ return TRUE;
+}
+
+PIPSocket::Address FSEndPoint::GetRTPAddress()
+{
+ return RTPLocalAddress;
+}
+
+
+BOOL FSEndPoint::OnOpenMediaStream(OpalConnection & connection, OpalMediaStream & stream)
+{
+ manager.OnOpenMediaStream(connection, stream);
+ return TRUE;
+}
+
+BOOL FSEndPoint::OnIncomingConnection(OpalConnection&, unsigned int, OpalConnection::StringOptions*)
+{
+ return TRUE;
+}
+
+BOOL FSEndPoint::OnSetUpConnection(OpalConnection & connection)
+{
+ return TRUE;
+}
+
+void FSEndPoint::OnEstablished(OpalConnection &connection)
+{
+
+}
+
+BOOL FSEndPoint::MakeConnection (OpalCall & call, const PString & party,
+ void *userData, unsigned int options,
+ OpalConnection::StringOptions* stringOptions)
+{
+ FSConnection *connection;
+ PString token = MakeToken();
+ connection = new FSConnection(call, *this, token, 0);
+ PString dest = PString((const char*) userData);
+
+ if (connection != NULL){
+
+ if (!AddConnection(connection))
+ return FALSE;
+
+ if (call.GetConnection(0) == (OpalConnection*)connection){
+ connection->SetUpConnection();
+ }
+ }
+
+ return TRUE;
+}
+
+OpalMediaFormatList FSEndPoint::GetMediaFormats() const
+{
+ return mediaformats;
+}
+
+
+
+WORD FSEndPoint::GetMediaPort()
+{
+ if (currentmediaport++ >= MAX_MEDIA_PORT) {
+ currentmediaport = MIN_MEDIA_PORT;
+ }
+
+ return currentmediaport;
+}
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/fsep.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/fsep.h Mon Nov 12 18:14:55 2007
@@ -0,0 +1,45 @@
+
+
+#ifndef __FREESWITCH_OPAL_ENDPOINT__
+#define __FREESWITCH_OPAL_ENDPOINT__
+
+#include <switch.h>
+#include <ptlib.h>
+#include <opal/buildopts.h>
+#include <opal/endpoint.h>
+
+#define MAX_MEDIA_PORT 44526
+#define MIN_MEDIA_PORT 44000
+
+class FSEndPoint : public OpalEndPoint
+{
+ PCLASSINFO(FSEndPoint, OpalEndPoint);
+ public:
+ FSEndPoint(OpalManager& manager);
+ ~FSEndPoint();
+
+ virtual BOOL OnIncomingConnection(OpalConnection&, unsigned int, OpalConnection::StringOptions*);
+
+ virtual BOOL MakeConnection(OpalCall & call, const PString & party,
+ void * userData, unsigned int options = 0,
+ OpalConnection::StringOptions* stringOptions = NULL);
+
+ virtual BOOL OnOpenMediaStream(OpalConnection & connection, OpalMediaStream & stream);
+ virtual BOOL OnSetUpConnection(OpalConnection & connection);
+ virtual void OnEstablished(OpalConnection &connection);
+ virtual OpalMediaFormatList GetMediaFormats() const;
+
+ WORD GetMediaPort();
+ BOOL SetRTPAddress(PIPSocket::Address ipaddr);
+ PIPSocket::Address GetRTPAddress();
+
+ private:
+ BOOL initialized;
+ PINDEX maxcalls;
+ OpalMediaFormatList mediaformats;
+ WORD currentmediaport;
+ PIPSocket::Address RTPLocalAddress;
+
+};
+
+#endif //__FREESWITCH_OPAL_ENDPOINT__
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/fsmanager.cxx
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/fsmanager.cxx Mon Nov 12 18:14:55 2007
@@ -0,0 +1,63 @@
+
+#include "fsmanager.h"
+
+FSManager::FSManager()
+ :SessionsHashTable(NULL), SessionsHashTableMutex(NULL),
+ h323ep(NULL), fsep(NULL)
+{
+
+}
+
+FSManager::~FSManager()
+{
+ switch_mutex_destroy(SessionsHashTableMutex);
+ switch_core_hash_destroy(&SessionsHashTable);
+}
+
+BOOL FSManager::Initialize(switch_memory_pool_t* MemoryPool)
+{
+ silenceDetectParams.m_mode = OpalSilenceDetector::NoSilenceDetection;
+ SetAudioJitterDelay(800, 3000);
+
+ if(switch_core_hash_init(&SessionsHashTable,MemoryPool)!=SWITCH_STATUS_SUCCESS)
+ {
+ assert(0);
+ return FALSE;
+ }
+
+ if(switch_mutex_init(&SessionsHashTableMutex,SWITCH_MUTEX_UNNESTED,MemoryPool)!=SWITCH_STATUS_SUCCESS)
+ {
+ assert(0);
+ switch_core_hash_destroy(&SessionsHashTable);
+ return FALSE;
+ }
+
+ sipep = new FSSIPEndPoint( *(static_cast<OpalManager*>(this)));
+ h323ep = new FSH323EndPoint( *(static_cast<OpalManager*>(this)));
+ fsep = new FSEndPoint( *(static_cast<OpalManager*>(this)));
+
+ PIPSocket::Address addr("10.0.0.1");
+
+ OpalTransportAddress sipTransportAddress(addr,5060, "udp");
+ OpalTransportAddress h323TransportAddress(addr,1726);
+
+
+ fsep->SetRTPAddress(addr);
+
+ if(!sipep->StartListeners(sipTransportAddress)){
+ delete sipep;
+ return FALSE;
+ }
+
+ if(!h323ep->StartListeners(h323TransportAddress)){
+ delete h323ep;
+ delete sipep;
+ return FALSE;
+ }
+ SetSTUNServer("stun.voxgratia.org");
+ PStringArray routes;
+ routes += "h323:.* = sip:<da>@fwd.pulver.com";
+ SetRouteTable(routes);
+
+ return TRUE;
+}
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/fsmanager.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/fsmanager.h Mon Nov 12 18:14:55 2007
@@ -0,0 +1,34 @@
+
+#ifndef __FREESWITCH_OPAL_MANAGER__
+#define __FREESWITCH_OPAL_MANAGER__
+
+#include <ptlib.h>
+#include <opal/manager.h>
+#include <h323/h323ep.h>
+#include "fsep.h"
+#include "opal_h323.h"
+#include "opal_sip.h"
+
+class FSH323EndPoint;
+
+class FSManager : public OpalManager
+{
+ PCLASSINFO(FSManager, PObject);
+ public:
+ FSManager();
+ ~FSManager();
+
+ BOOL Initialize(switch_memory_pool_t* MemoryPool);
+
+ private:
+ switch_hash_t *SessionsHashTable;
+ switch_mutex_t *SessionsHashTableMutex;
+ switch_memory_pool_t *MemoryPool;
+
+ protected:
+ FSH323EndPoint *h323ep;
+ FSSIPEndPoint *sipep;
+ FSEndPoint *fsep;
+};
+
+#endif //__FREESWITCH_OPAL_MANAGER__
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/fsmediastream.cxx
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/fsmediastream.cxx Mon Nov 12 18:14:55 2007
@@ -0,0 +1,55 @@
+
+#include "fsmediastream.h"
+
+FSMediaStream::FSMediaStream(FSConnection & connection, const OpalMediaFormat &mediaFormat,
+ BOOL isSource,
+ RTP_Session & rtpSession,
+ unsigned minAudioJitterDelay,
+ unsigned maxAudioJitterDelay)
+
+ :OpalRTPMediaStream(connection, mediaFormat, isSource, rtpSession, minAudioJitterDelay, maxAudioJitterDelay),
+ fsconnection((FSConnection&) connection)
+{
+
+ if (isSource){
+ PTRACE(3, "FSMediaStream: Created SOURCE Media Stream");
+ //channel = fsconnection.writechannel;
+ }else{
+ //channel = fsconnection.readchannel;
+ PTRACE(3, "FSMediaStream: Created SINK Media Stream");
+ }
+
+}
+
+BOOL FSMediaStream::IsSynchronous() const
+{
+ return FALSE; //rtp mediastream
+}
+
+
+FSMediaStream::~FSMediaStream()
+{
+
+}
+
+
+
+FSUDPMediaStream::FSUDPMediaStream(OpalConnection & connection, const OpalMediaFormat &mediaFormat,
+ unsigned sessionID,
+ BOOL isSource,
+ OpalTransportUDP &transport)
+
+ :OpalUDPMediaStream(connection, mediaFormat, sessionID, isSource, transport)
+{
+ if (isSource){
+ PTRACE(3, "FSMediaStream: Created SOURCE Media Stream");
+ }else{
+ PTRACE(3, "FSMediaStream: Created SINK Media Stream");
+ }
+
+}
+
+FSUDPMediaStream::~FSUDPMediaStream()
+{
+
+}
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/fsmediastream.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/fsmediastream.h Mon Nov 12 18:14:55 2007
@@ -0,0 +1,51 @@
+
+#ifndef __FREESWITCH_OPAL_MEDIASTREAM__
+#define __FREESWITCH_OPAL_MEDIASTREAM__
+
+
+#include <ptlib.h>
+#include <opal/buildopts.h>
+#include <opal/connection.h>
+#include <opal/mediastrm.h>
+#include <switch.h>
+#include "fscon.h"
+
+class FSConnection;
+
+class FSMediaStream : public OpalRTPMediaStream
+{
+ PCLASSINFO(FSMediaStream, OpalRTPMediaStream);
+ public:
+ FSMediaStream(FSConnection & connection, const OpalMediaFormat &mediaFormat,
+ BOOL isSource,
+ RTP_Session & rtpSession,
+ unsigned minAudioJitterDelay,
+ unsigned maxAudioJitterDelay);
+
+
+ ~FSMediaStream();
+ //virtual BOOL ReadData(BYTE* data,PINDEX size,PINDEX& length);
+ //virtual BOOL WriteData(const BYTE* data,PINDEX length, PINDEX& written);
+ virtual BOOL IsSynchronous() const;
+
+ FSConnection &fsconnection;
+ protected:
+ PAdaptiveDelay channelDelay;
+ BOOL isSource;
+ PQueueChannel *channel;
+};
+
+class FSUDPMediaStream : public OpalUDPMediaStream
+{
+ PCLASSINFO(FSUDPMediaStream, OpalUDPMediaStream);
+ public:
+ FSUDPMediaStream(OpalConnection & connection, const OpalMediaFormat &mediaFormat,
+ unsigned sessionID,
+ BOOL isSource,
+ OpalTransportUDP &transport);
+
+ ~FSUDPMediaStream();
+
+};
+
+#endif// __FREESWITCH_OPAL_CONNECTION__
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp Mon Nov 12 18:14:55 2007
@@ -0,0 +1,239 @@
+
+#include <switch.h>
+#include <ptlib.h>
+#include <ptlib/svcproc.h>
+#include "mod_opal.h"
+#include "fsmanager.h"
+#include "fscon.h"
+
+
+static switch_call_cause_t opalfs_outgoing_channel(switch_core_session_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **);
+static switch_status_t opalfs_read_frame(switch_core_session_t *, switch_frame_t **, int, switch_io_flag_t, int);
+static switch_status_t opalfs_write_frame(switch_core_session_t *, switch_frame_t *, int, switch_io_flag_t, int);
+static switch_status_t opalfs_kill_channel(switch_core_session_t *, int);
+static switch_status_t opalfs_waitfor_read(switch_core_session_t *, int, int);
+static switch_status_t opalfs_waitfor_write(switch_core_session_t *, int, int);
+static switch_status_t opalfs_send_dtmf(switch_core_session_t *, char *);
+static switch_status_t opalfs_receive_message(switch_core_session_t *, switch_core_session_message_t *);
+static switch_status_t opalfs_receive_event(switch_core_session_t *, switch_event_t *);
+static switch_status_t opalfs_state_change(switch_core_session_t *);
+static switch_status_t opalfs_read_video_frame(switch_core_session_t *, switch_frame_t **, int, switch_io_flag_t, int);
+static switch_status_t opalfs_write_video_frame(switch_core_session_t *, switch_frame_t *, int, switch_io_flag_t, int);
+
+
+
+static switch_status_t opalfs_on_init(switch_core_session_t *session);
+static switch_status_t opalfs_on_ring(switch_core_session_t *session);
+static switch_status_t opalfs_on_execute(switch_core_session_t *session);
+static switch_status_t opalfs_on_hangup(switch_core_session_t *session);
+static switch_status_t opalfs_on_loopback(switch_core_session_t *session);
+static switch_status_t opalfs_on_transmit(switch_core_session_t *session);
+
+
+static switch_memory_pool_t *opal_pool = NULL;
+switch_endpoint_interface_t *opalfs_endpoint_interface = NULL;
+static FSManager *opal_manager = NULL;
+
+
+class _FSOpalProcess : public PProcess
+{
+ PCLASSINFO(_FSOpalProcess, PProcess)
+ public:
+ _FSOpalProcess(){PTrace::SetLevel(PSystemLog::Info);}; //just for fun and eyecandy ;)
+ void Main() {};
+} FSOpalProcess;
+
+
+
+static switch_io_routines_t opalfs_io_routines = {
+ /*.outgoing_channel */ opalfs_outgoing_channel,
+ /*.read_frame */ opalfs_read_frame,
+ /*.write_frame */ opalfs_write_frame,
+ /*.kill_channel */ opalfs_kill_channel,
+ /*.waitfor_read */ opalfs_waitfor_read,
+ /*.waitfor_read */ opalfs_waitfor_write,
+ /*.send_dtmf */ opalfs_send_dtmf,
+ /*.receive_message */ opalfs_receive_message,
+ /*.receive_event */ opalfs_receive_event,
+ /*.state_change*/ opalfs_state_change,
+ /*.read_video_frame*/ opalfs_read_video_frame,
+ /*.write_video_frame*/ opalfs_write_video_frame
+};
+
+static switch_state_handler_table_t opalfs_event_handlers = {
+ /*.on_init */ opalfs_on_init,
+ /*.on_ring */ opalfs_on_ring,
+ /*.on_execute */ opalfs_on_execute,
+ /*.on_hangup */ opalfs_on_hangup,
+ /*.on_loopback */ opalfs_on_loopback,
+ /*.on_transmit */ opalfs_on_transmit
+};
+
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_opal_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_opal_shutdown);
+SWITCH_MODULE_DEFINITION(mod_opal, mod_opal_load, mod_opal_shutdown, NULL);
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_opal_load)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"Starting loading mod_opal\n");
+ opal_pool = pool;
+
+ *module_interface =NULL;
+ *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
+ if(!module_interface){
+ return SWITCH_STATUS_MEMERR;
+ }
+
+ opalfs_endpoint_interface = (switch_endpoint_interface_t*)switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
+ opalfs_endpoint_interface->interface_name = "opalFS";
+ opalfs_endpoint_interface->io_routines = &opalfs_io_routines;
+ opalfs_endpoint_interface->state_handler = &opalfs_event_handlers;
+
+ opal_manager = new FSManager();
+
+ if(!opal_manager) {
+ return SWITCH_STATUS_MEMERR;
+ }
+
+ if(!opal_manager->Initialize(pool)){
+ delete opal_manager;
+ return SWITCH_STATUS_FALSE;
+ }
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Opal manager initilaized and running\n");
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_opal_shutdown)
+{
+ delete opal_manager;
+ opal_manager = NULL;
+ opal_pool = NULL;
+ opalfs_endpoint_interface = NULL;
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+static switch_call_cause_t opalfs_outgoing_channel(switch_core_session_t *session,
+ switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session,
+ switch_memory_pool_t **pool)
+{
+ fs_obj_t* tech_prv = (fs_obj_t*)switch_core_session_get_private(session);
+
+ return SWITCH_CAUSE_SUCCESS;
+
+}
+
+static switch_status_t opalfs_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flags, int stream_id)
+{
+ fs_obj_t* tech_prv = (fs_obj_t*)switch_core_session_get_private(session);
+
+ return tech_prv->Connection->io_read_frame(session, frame, timeout, flags, stream_id);
+}
+
+static switch_status_t opalfs_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flags, int stream_id)
+{
+ fs_obj_t* tech_prv = (fs_obj_t*)switch_core_session_get_private(session);
+
+ return tech_prv->Connection->io_write_frame(session, frame, timeout, flags, stream_id);
+}
+
+static switch_status_t opalfs_kill_channel(switch_core_session_t *session, int sig)
+{
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t opalfs_waitfor_read(switch_core_session_t *session, int ms, int stream_id)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Waitfor read!!!\n");
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t opalfs_waitfor_write(switch_core_session_t *session, int ms, int stream_id)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Waitfor write!!!\n");
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t opalfs_send_dtmf(switch_core_session_t *session, char *dtmf)
+{
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t opalfs_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
+{
+ fs_obj_t* tech_prv = (fs_obj_t*) switch_core_session_get_private(session);
+
+ return tech_prv->Connection->io_receive_message(session, msg);
+}
+
+static switch_status_t opalfs_receive_event(switch_core_session_t *session, switch_event_t *event)
+{
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t opalfs_state_change(switch_core_session_t *session)
+{
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t opalfs_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, switch_io_flag_t flag, int stream_id)
+{
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t opalfs_write_video_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, switch_io_flag_t flag, int stream_id)
+{
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+static switch_status_t opalfs_on_init(switch_core_session_t *session)
+{
+ fs_obj_t* fs_pvt = (fs_obj_t*)switch_core_session_get_private(session);
+ return SWITCH_STATUS_SUCCESS;
+ return fs_pvt->Connection->callback_on_init(session);
+}
+
+static switch_status_t opalfs_on_ring(switch_core_session_t *session)
+{
+ fs_obj_t* tech_prv = (fs_obj_t*)switch_core_session_get_private(session);
+
+ return tech_prv->Connection->callback_on_ring(session);
+}
+
+static switch_status_t opalfs_on_execute(switch_core_session_t *session)
+{
+ fs_obj_t* tech_prv = (fs_obj_t*)switch_core_session_get_private(session);
+
+ return tech_prv->Connection->callback_on_execute(session);
+}
+
+static switch_status_t opalfs_on_hangup(switch_core_session_t *session)
+{
+ fs_obj_t* tech_prv = (fs_obj_t*)switch_core_session_get_private(session);
+
+ return tech_prv->Connection->callback_on_hangup(session);
+}
+
+static switch_status_t opalfs_on_loopback(switch_core_session_t *session)
+{
+ fs_obj_t* tech_prv = (fs_obj_t*)switch_core_session_get_private(session);
+
+ return tech_prv->Connection->callback_on_loopback(session);;
+}
+
+static switch_status_t opalfs_on_transmit(switch_core_session_t *session)
+{
+ return SWITCH_STATUS_SUCCESS;
+}
+
+
+
+
+
+
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h Mon Nov 12 18:14:55 2007
@@ -0,0 +1,12 @@
+
+#ifndef __FREESWITCH_MOD_OPAL__
+#define __FREESWITCH_MOD_OPAL__
+
+#define HAVE_APR
+#include <switch.h>
+#include <switch_version.h>
+#define MODNAME "mod_opal"
+
+
+
+#endif /* __FREESWITCH_MOD_OPAL__ */
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/opal_h323.cxx
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/opal_h323.cxx Mon Nov 12 18:14:55 2007
@@ -0,0 +1,59 @@
+
+#include "opal_h323.h"
+#include "opal_h323con.h"
+
+FSH323EndPoint::FSH323EndPoint(OpalManager & manager)
+ :H323EndPoint(manager), UseH323ExternalRTP(TRUE)
+{
+ //if we have config option for using external rtp for h323,
+ //please set UseH323ExternalRTP to TRUE
+
+ mediaformats+=OpalPCM16;
+ mediaformats+=OpalG711uLaw;
+ mediaformats+=OpalG711ALaw;
+ mediaformats+=OpalG711_ULAW_64K;
+ mediaformats+=OpalG711_ALAW_64K;
+ mediaformats+=OpalGSM0610;
+ mediaformats+=OpalPCM16_16KHZ;
+ mediaformats+=OPAL_G729;
+ mediaformats+=OPAL_G729A;
+ mediaformats+=OPAL_G729B;
+ mediaformats+=OPAL_G729AB;
+}
+
+FSH323EndPoint::~FSH323EndPoint()
+{
+
+}
+
+
+OpalMediaFormatList FSH323EndPoint::GetMediaFormats() const
+{
+ PTRACE(3, "GIMME MEDIA FORMAT");
+ return mediaformats;
+}
+
+
+OpalConnection::AnswerCallResponse FSH323EndPoint::OnAnswerCall(OpalConnection & connection,
+ const PString & caller)
+{
+ return OpalConnection::AnswerCallPending;
+}
+
+
+H323Connection * FSH323EndPoint::CreateConnection(OpalCall & call,
+ const PString & token,
+ void * userData,
+ OpalTransport & transport,
+ const PString & alias,
+ const H323TransportAddress & address,
+ H323SignalPDU * setupPDU,
+ unsigned options,
+ OpalConnection::StringOptions * stringOptions)
+
+{
+ if (UseH323ExternalRTP)
+ return new FSH323Connection(call, *this, token, alias, address, options);
+
+ return new H323Connection(call, *this, token, alias, address, options);
+}
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/opal_h323.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/opal_h323.h Mon Nov 12 18:14:55 2007
@@ -0,0 +1,43 @@
+#ifndef __OPAL_H323_ENDPOINT__
+#define __OPAL_H323_ENDPOINT__
+
+#include <ptlib.h>
+#include <opal/buildopts.h>
+#include <opal/endpoint.h>
+#include <h323/h323ep.h>
+#include <h323/h323con.h>
+#include "opal_h323con.h"
+
+
+
+class FSH323EndPoint : public H323EndPoint
+{
+ PCLASSINFO(FSH323EndPoint, H323EndPoint);
+ public:
+ FSH323EndPoint(OpalManager & manager);
+ ~FSH323EndPoint();
+
+ virtual OpalConnection::AnswerCallResponse OnAnswerCall(OpalConnection & connection,
+ const PString & caller);
+
+ virtual OpalMediaFormatList GetMediaFormats() const;
+
+ H323Connection * CreateConnection(OpalCall & call,
+ const PString & token,
+ void * userData,
+ OpalTransport & transport,
+ const PString & alias,
+ const H323TransportAddress & address,
+ H323SignalPDU * setupPDU,
+ unsigned options,
+ OpalConnection::StringOptions * stringOptions);
+
+ BOOL isExternalRTPEnabled(){return UseH323ExternalRTP;};
+
+ protected:
+ BOOL UseH323ExternalRTP;
+ OpalMediaFormatList mediaformats;
+};
+
+
+#endif //__OPAL_H323_ENDPOINT__
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/opal_h323con.cxx
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/opal_h323con.cxx Mon Nov 12 18:14:55 2007
@@ -0,0 +1,88 @@
+
+#include "opal_h323.h"
+#include "opal_h323con.h"
+
+
+FSExternalRTPChannel::FSExternalRTPChannel(H323Connection & connection, ///< Connection to endpoint for channel
+ const H323Capability & capability, ///< Capability channel is using
+ Directions direction, ///< Direction of channel
+ unsigned sessionID) ///< Session ID for channel)
+
+ : H323_ExternalRTPChannel(connection, capability, direction, sessionID)
+{
+ PTRACE(3,"Creating External RTP Channel");
+
+ PIPSocket::Address addr("10.0.0.1");
+ WORD port = 41004;
+ SetExternalAddress(H323TransportAddress(addr, port), H323TransportAddress(addr, port+1));
+
+ // get the payload code
+ PTRACE(3, "Channel Capability " << capability.GetFormatName());
+ OpalMediaFormat format(capability.GetFormatName());
+ payloadCode = format.GetPayloadType();
+
+ Start();
+}
+
+BOOL FSExternalRTPChannel::Start()
+{
+ if (!H323_ExternalRTPChannel::Start())
+ return FALSE;
+
+ PIPSocket::Address addr;
+ WORD port;
+ GetRemoteAddress(addr, port);
+ PTRACE(3, "External RTP Channel Started ::Start");
+
+ return TRUE;
+}
+
+
+FSH323Connection::FSH323Connection(OpalCall &call,FSH323EndPoint &endpoint,
+ const PString & token,const PString &alias,
+ const H323TransportAddress & address,unsigned options)
+
+ :H323Connection(call,endpoint,token,alias,address,options)
+{
+
+
+}
+
+FSH323Connection::~FSH323Connection()
+{
+
+}
+
+OpalMediaFormatList FSH323Connection::GetMediaFormats()
+{
+ OpalMediaFormatList mediaformats;
+
+ mediaformats+=OpalPCM16;
+ mediaformats+=OpalG711uLaw;
+ mediaformats+=OpalG711ALaw;
+ mediaformats+=OpalG711_ULAW_64K;
+ mediaformats+=OpalG711_ALAW_64K;
+ mediaformats+=OpalGSM0610;
+ mediaformats+=OpalPCM16_16KHZ;
+ mediaformats+=OPAL_G729;
+ mediaformats+=OPAL_G729A;
+ mediaformats+=OPAL_G729B;
+ mediaformats+=OPAL_G729AB;
+ PTRACE(3, "RTP Channel Callback !");
+
+ return mediaformats;
+}
+
+/*
+H323Channel* FSH323Connection::CreateRealTimeLogicalChannel(const H323Capability & capability,
+ H323Channel::Directions dir,
+ unsigned sessionID,
+ const H245_H2250LogicalChannelParameters * param,
+ RTP_QOS * rtpqos)
+{
+
+ PTRACE(3, "RTP Channel Callback !");
+ //h323 external rtp can be set from here
+ return new FSExternalRTPChannel(*this, capability, dir, sessionID);
+}
+*/
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/opal_h323con.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/opal_h323con.h Mon Nov 12 18:14:55 2007
@@ -0,0 +1,51 @@
+
+#ifndef __OPAL_H323_CONNECTION__
+#define __OPAL_H323_CONNECTION__
+
+#include "opal_h323.h"
+#include "fsep.h"
+#include "fsmanager.h"
+
+class FSH323EndPoint;
+
+
+class FSExternalRTPChannel : public H323_ExternalRTPChannel
+{
+ PCLASSINFO(FSExternalRTPChannel, H323_ExternalRTPChannel);
+ public:
+ FSExternalRTPChannel(H323Connection & connection, ///< Connection to endpoint for channel
+ const H323Capability & capability, ///< Capability channel is using
+ Directions direction, ///< Direction of channel
+ unsigned sessionID ); ///< Session ID for channel
+
+ virtual BOOL Start();
+
+ protected:
+ BYTE payloadCode;
+};
+
+
+class FSH323Connection : public H323Connection
+{
+ PCLASSINFO(FSH323Connection, H323Connection);
+ public:
+ FSH323Connection(OpalCall &call, FSH323EndPoint &endpoint,
+ const PString & token,const PString &alias,
+ const H323TransportAddress & address,unsigned options = 0);
+
+ //External H323 RTP
+ /*
+ H323Channel* CreateRealTimeLogicalChannel(const H323Capability & capability,
+ H323Channel::Directions dir,
+ unsigned sessionID,
+ const H245_H2250LogicalChannelParameters * param,
+ RTP_QOS * rtpqos);
+ */
+
+ virtual OpalMediaFormatList GetMediaFormats();
+
+ ~FSH323Connection();
+
+};
+
+#endif // __FREESWITCH_H323_CONNECTION__
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/opal_sip.cxx
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/opal_sip.cxx Mon Nov 12 18:14:55 2007
@@ -0,0 +1,42 @@
+
+#include "opal_sip.h"
+
+FSSIPEndPoint::FSSIPEndPoint(OpalManager & manager)
+ :SIPEndPoint(manager)
+{
+
+}
+
+FSSIPEndPoint::~FSSIPEndPoint()
+{
+
+}
+
+BOOL FSSIPEndPoint::OnIncomingConnection (OpalConnection &connection)
+{
+ const char *destination = connection.GetCalledDestinationNumber();
+
+
+ PTRACE(3, "FSSIPEndPoint: Answering Incomming Call "<< "' To '" << destination << "'");
+
+ GetManager().MakeConnection(connection.GetCall(), "fs:", (void *) destination);
+
+ return TRUE;
+}
+
+OpalConnection::AnswerCallResponse FSSIPEndPoint::OnAnswerCall(OpalConnection & connection,
+ const PString & caller)
+{
+ const char *destination = connection.GetCalledDestinationNumber();
+
+
+ PTRACE(3, "FSSIPEndPoint: Answering Incomming Call from '" << caller << "' To '" << destination << "'");
+
+ //OpalManager &manager = connection.GetEndPoint().GetManager();
+ //OpalCall & call = connection.GetCall();
+
+
+ //manager.MakeConnection(call, "fs", (void *) destination);
+
+ return OpalConnection::AnswerCallPending;
+}
Added: freeswitch/trunk/src/mod/endpoints/mod_opal/opal_sip.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/src/mod/endpoints/mod_opal/opal_sip.h Mon Nov 12 18:14:55 2007
@@ -0,0 +1,25 @@
+
+#ifndef __OPAL_SIP_ENDPOINT__
+#define __OPAL_SIP_ENDPOINT__
+
+#include <ptlib.h>
+#include <opal/buildopts.h>
+#include <opal/endpoint.h>
+#include <sip/sipep.h>
+
+
+
+class FSSIPEndPoint : public SIPEndPoint
+{
+ PCLASSINFO(FSSIPEndPoint, SIPEndPoint);
+ public:
+ FSSIPEndPoint(OpalManager & manager);
+ ~FSSIPEndPoint();
+
+ virtual BOOL OnIncomingConnection (OpalConnection &connection);
+ virtual OpalConnection::AnswerCallResponse OnAnswerCall(OpalConnection & connection,
+ const PString & caller);
+};
+
+
+#endif //__OPAL_SIP_ENDPOINT__
1
0
12 Nov '07
Author: anthm
Date: Mon Nov 12 18:12:19 2007
New Revision: 6224
Modified:
freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
Log:
update
Modified: freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c Mon Nov 12 18:12:19 2007
@@ -390,7 +390,7 @@
}
-#define DB_USAGE "<realm>/<key>/<val>"
+#define DB_USAGE "[add|del]/<realm>/<key>/<val>"
#define DB_DESC "save data"
SWITCH_STANDARD_APP(db_function)
@@ -399,26 +399,39 @@
int argc = 0;
char *argv[3] = { 0 };
char *mydata = NULL;
- char *sql;
+ char *sql = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
-
+
if (!switch_strlen_zero(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, '/', argv, (sizeof(argv) / sizeof(argv[0])));
}
- if (argc < 3) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "USAGE: db_insert %s\n", DB_USAGE);
+ if (argc < 4) {
+ goto error;
+ }
+
+
+ if (!strcasecmp(argv[0], "add")) {
+ sql = switch_mprintf("insert into db_data values('%q','%q','%q','%q');", globals.hostname, argv[1], argv[2], argv[3]);
+ } else if (!strcasecmp(argv[0], "del")) {
+ sql = switch_mprintf("delete from db_data where realm='%q' and data_key='%q'", argv[1], argv[2]);
+ }
+
+
+ if (sql) {
+ limit_execute_sql(sql, globals.mutex);
+ switch_safe_free(sql);
return;
}
+
+ error:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "USAGE: db %s\n", DB_USAGE);
+
- sql = switch_mprintf("insert into db_data values('%q','%q','%q','%q');", globals.hostname, argv[0], argv[1], argv[2]);
- assert(sql);
- limit_execute_sql(sql, globals.mutex);
- switch_safe_free(sql);
}
1
0
12 Nov '07
Author: tuyan
Date: Mon Nov 12 18:11:55 2007
New Revision: 6223
Removed:
freeswitch/trunk/src/mod/endpoints/mod_opal/Makefile.am
freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp
freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h
freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opalh323.cpp
freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opalh323.h
freeswitch/trunk/src/mod/endpoints/mod_opal/opal_backend.cpp
freeswitch/trunk/src/mod/endpoints/mod_opal/opal_backend.h
freeswitch/trunk/src/mod/endpoints/mod_opal/opalh323_backend.cpp
freeswitch/trunk/src/mod/endpoints/mod_opal/opalh323_backend.h
Log:
Cleaning for the new code
1
0
12 Nov '07
Author: anthm
Date: Mon Nov 12 15:36:00 2007
New Revision: 6222
Modified:
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
Log:
add supress-cng param and supress_cng variable
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 Mon Nov 12 15:36:00 2007
@@ -114,7 +114,8 @@
PFLAG_RUNNING = (1 << 8),
PFLAG_RESPAWN = (1 << 9),
PFLAG_GREEDY = (1 << 10),
- PFLAG_MULTIREG = (1 << 11)
+ PFLAG_MULTIREG = (1 << 11),
+ PFLAG_SUPRESS_CNG = (1 << 12)
} PFLAGS;
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Mon Nov 12 15:36:00 2007
@@ -907,6 +907,10 @@
if (switch_true(val)) {
profile->pflags |= PFLAG_MULTIREG;
}
+ } else if (!strcasecmp(var, "supress-cng")) {
+ if (switch_true(val)) {
+ profile->pflags |= PFLAG_SUPRESS_CNG;
+ }
} else if (!strcasecmp(var, "NDLB-to-in-200-contact")) {
if (switch_true(val)) {
profile->ndlb |= PFLAG_NDLB_TO_IN_200_CONTACT;
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Mon Nov 12 15:36:00 2007
@@ -44,6 +44,13 @@
int ptime = 0;
uint32_t rate = 0;
uint32_t v_port;
+ int use_cng = 1;
+ const char *val;
+
+ if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPRESS_CNG) ||
+ ((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val))) {
+ use_cng = 0;
+ }
if (!force && !ip && !sr && switch_channel_test_flag(tech_pvt->channel, CF_BYPASS_MEDIA)) {
return;
@@ -113,8 +120,8 @@
if (tech_pvt->te > 95) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te);
}
-
- if (tech_pvt->cng_pt) {
+
+ if (tech_pvt->cng_pt && use_cng) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt);
}
@@ -163,11 +170,13 @@
if (tech_pvt->te > 95) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te);
}
- if (tech_pvt->cng_pt) {
+ if (tech_pvt->cng_pt && use_cng) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/8000\n", tech_pvt->cng_pt);
if (!tech_pvt->rm_encoding) {
tech_pvt->cng_pt = 0;
}
+ } else {
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=silenceSupp:off - - - -\n");
}
if (ptime) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=ptime:%d\n", ptime);
1
0
[commit] r6221 - freeswitch/trunk/src/mod/dialplans/mod_dialplan_asterisk
by Freeswitch SVN 12 Nov '07
by Freeswitch SVN 12 Nov '07
12 Nov '07
Author: mikej
Date: Mon Nov 12 12:15:02 2007
New Revision: 6221
Removed:
freeswitch/trunk/src/mod/dialplans/mod_dialplan_asterisk/Makefile
Log:
harcoded path, should not be in tree
1
0
12 Nov '07
Author: anthm
Date: Mon Nov 12 11:51:33 2007
New Revision: 6220
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
Log:
fix MODENDP-42
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 Mon Nov 12 11:51:33 2007
@@ -254,7 +254,6 @@
switch_thread_rwlock_t *rwlock;
switch_mutex_t *flag_mutex;
uint32_t inuse;
- uint32_t soft_max;
time_t started;
uint32_t session_timeout;
uint32_t max_proceeding;
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Mon Nov 12 11:51:33 2007
@@ -1917,7 +1917,7 @@
su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
- if ((profile->soft_max && sess_count >= profile->soft_max) || sess_count >= sess_max) {
+ if (sess_count >= sess_max) {
nua_respond(nh, 480, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
return;
}
@@ -2193,19 +2193,18 @@
return;
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "LUKE: I'm hit, but not bad.\n");
-
- switch_mutex_lock(profile->flag_mutex);
-
- profile->soft_max = sess_count - 10;
- switch_core_session_limit(profile->soft_max);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "LUKE'S VOICE: Artoo, see what you can do with it. Hang on back there....\n"
- "Green laserfire moves past the beeping little robot as his head turns. "
- "After a few beeps and a twist of his mechanical arm,\n"
- "Artoo reduces the max sessions to %d thus, saving the switch from certian doom.\n",
- profile->soft_max);
+ if (sess_count > 110) {
+ switch_mutex_lock(profile->flag_mutex);
+ switch_core_session_limit(sess_count - 10);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "LUKE: I'm hit, but not bad.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "LUKE'S VOICE: Artoo, see what you can do with it. Hang on back there....\n"
+ "Green laserfire moves past the beeping little robot as his head turns. "
+ "After a few beeps and a twist of his mechanical arm,\n"
+ "Artoo reduces the max sessions to %d thus, saving the switch from certian doom.\n",
+ sess_count < 10);
- switch_mutex_unlock(profile->flag_mutex);
+ switch_mutex_unlock(profile->flag_mutex);
+ }
if (tech_pvt->hash_key) {
switch_core_hash_delete(tech_pvt->profile->chat_hash, tech_pvt->hash_key);
1
0
12 Nov '07
Author: mikej
Date: Mon Nov 12 11:04:47 2007
New Revision: 6219
Added:
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_htable2.c
freeswitch/trunk/libs/sofia-sip/open_c/Makefile.am
Modified:
freeswitch/trunk/libs/sofia-sip/Makefile.am
freeswitch/trunk/libs/sofia-sip/RELEASE
freeswitch/trunk/libs/sofia-sip/configure.ac
freeswitch/trunk/libs/sofia-sip/docs/release_management.txt
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/Makefile.am
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_class.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua.docs
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_sip_events.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/Makefile.am
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/htable.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/htable2.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/tstdef.h
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_htable.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_su.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_alloc.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c
freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/test_tport.c
freeswitch/trunk/libs/sofia-sip/open_c/build_sources.cmd
freeswitch/trunk/libs/sofia-sip/open_c/config.h.in
freeswitch/trunk/libs/sofia-sip/win32/Makefile.am
freeswitch/trunk/libs/sofia-sip/win32/build_sources.cmd
freeswitch/trunk/libs/sofia-sip/win32/check.cmd
freeswitch/trunk/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.dsp
freeswitch/trunk/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.vcproj
freeswitch/trunk/libs/sofia-sip/win32/tests/torture_su_root/torture_su_root.dsp
freeswitch/trunk/libs/sofia-sip/win32/tests/torture_su_root/torture_su_root.vcproj
freeswitch/trunk/libs/sofia-sip/win32/utils/stunc/stunc.dsp
freeswitch/trunk/libs/sofia-sip/win32/utils/stunc/stunc.vcproj
Log:
merge with sofia darcs trunk:
Fri Oct 12 08:42:17 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* Makefile.am: fixed ordering of SUBDIRS
Fri Oct 12 13:32:02 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* win32/utils/stunc.dsp: fixed include paths
Fri Oct 12 13:32:19 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* win32/tests/torture_su_root: fixed include paths
Fri Oct 12 13:32:52 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* win32: added missing files from Makefile.am, .dsp, vproj
Fri Oct 12 13:33:42 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* win32/build_sources.cmd: added extra headers to sip_tag.c and sip_parser_table.c
Fri Oct 12 13:37:00 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* win32/check.cmd: added option -a to relevant tests.
Optionally check Release build.
Fri Oct 12 13:37:25 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* url.h: silenced warning on URL_INIT_AS()
Fri Oct 12 13:37:43 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* tstdef.h: silenced warnings on TEST_M()
Fri Oct 12 13:38:15 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* nta_internal.h, nua_params.c: fixed NTATAG_UDP_MTU() type
Fri Oct 12 13:39:06 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* test_class.h: fixed test_auth_class, test_numeric_class declaration
Fri Oct 12 13:39:51 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* Fixed various tests on win32.
Fri Oct 12 13:39:58 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* sip_basic.c: removed dead code
Fri Oct 12 14:38:02 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* nea_server.c: avoid raporting un-SUBSCRIBE twice
Fri Oct 12 14:38:31 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* test_sip_events.c: checking some nua_i_notifier/nua_i_subscriber events
Fri Oct 12 14:38:42 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
tagged Release candidate 2 for 1.12.7
Mon Oct 15 04:03:22 EDT 2007 Pekka.Pessi(a)nokia.com
* configure.ac, RELEASE: version 1.12.7
Mon Oct 15 08:27:13 EDT 2007 Pekka.Pessi(a)nokia.com
* open_c: included in the dist
Tue Oct 16 08:07:46 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* nua: Open C fixes
Wed Oct 17 06:50:11 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* nua.docs: replace reference to nua_cli.c with sofsip_cli
Wed Oct 17 08:43:11 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
tagged rel-sofia-sip-1_12_7
Wed Oct 17 08:43:15 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
tagged 1.12.7
Wed Oct 17 11:01:12 EDT 2007 Pekka Pessi <Pekka.Pessi(a)nokia.com>
* libsofia-sip-ua/su/Makefile.am: fixed problem with automake 1.9
Wed Oct 17 11:13:15 EDT 2007 Pekka.Pessi(a)nokia.com
* configure.ac, RELEASE: opened tree for development
Tue Oct 23 10:45:17 EDT 2007 Pekka.Pessi(a)nokia.com
* su_alloc.c: fixed su_home_init() (not initializing pointer to mutexes)
Thu Oct 25 13:15:45 EDT 2007 Pekka.Pessi(a)nokia.com
* nua_notifier.c: updated nua_i_subscribe, nua_notify() and nua_r_notify documentation
Wed Nov 7 07:58:08 EST 2007 Pekka.Pessi(a)nokia.com
* sofia-sip/htable2.h: fixed HTABLE_PROTOS2()
Modified: freeswitch/trunk/libs/sofia-sip/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/Makefile.am (original)
+++ freeswitch/trunk/libs/sofia-sip/Makefile.am Mon Nov 12 11:04:47 2007
@@ -8,7 +8,8 @@
AUTOMAKE_OPTIONS = foreign 1.7
SUBDIRS = libsofia-sip-ua $(GLIB_SUBDIRS) utils packages
-DIST_SUBDIRS = libsofia-sip-ua libsofia-sip-ua-glib utils packages win32
+DIST_SUBDIRS = libsofia-sip-ua libsofia-sip-ua-glib utils packages \
+ win32 open_c
# note: when glib devel files are not available, make should not
# enter the libsofia-sip-ua-glib subdir at all
Modified: freeswitch/trunk/libs/sofia-sip/RELEASE
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/RELEASE (original)
+++ freeswitch/trunk/libs/sofia-sip/RELEASE Mon Nov 12 11:04:47 2007
@@ -4,73 +4,32 @@
Changes since last release
--------------------------
-The stack now compiles and runs on Symbian SDK with Open C support
-enabled.
-The stacksupports specifying the outbound proxy by a set of Route
-headers as recommended by RFC3261. It also supports CR-LF-based keepalives
-on TCP connections.
-
-Bugs in call state machines, URI and SDP handling has been fixed.
+<changes since last written in freshmeat.net "Changes:" style;
+ and in less than 10 lines, written in 3rd person English, with
+ complete sentences />
+Bugs in blaa and foo have been fixed. The stack now supports
+use of foobar...
API/ABI changes and versioning
------------------------------
-New features in API are marked with Doxytag macro @VERSION_1_12_7 or
-@NEW_1_12_7.
+<see previous release notes at
+ http://sofia-sip.sourceforge.net/relnotes/ for examples ;
+ - should include all changes to public headers, and
+ other important information to developers;
+ - and should be updated _continuously_! />
+
+**template**: New features in API are marked with Doxytag macro @VERSION_1_XX_X.
libsofia-sip-ua:
+- **template**: Added foobar() function (sofia-sip/foobar.h).
- This release is ABI/API compatible with applications linked against
any 1.12.x release. However, applications built against this release won't
work against an older library. The ABI has been tested with the nua module
unit test (test_nua) built against original 1.12.0 release.
-libsofia-sip-ua/nua:
-- Added tag NUTAG_INITIAL_ROUTE(), NUTAG_INITIAL_ROUTE_STR()
-
-libsofia-sip-ua/nta:
-- Added nta_incoming_received()
-- Added accessor function nta_outgoing_branch()
-- Added tag NTATAG_TIMER_C()
-- Deprecated nta_msg_ackbye()
-
-libsofia-sip-ua/iptsec:
-- Added tag AUTHTAG_MAX_NCOUNT()
-
-libsofia-sip-ua/sip:
-- Added SIPEXTHDRTAG_TYPEDEF() macro and tag class sipexthdrtag_class[]
-- Added SIP headers Alert-Info, Reply-To. Remote-Party-ID,
- P-Asserted-Identity, and P-Preferred-Identity
-- Added sip_update_default_mclass() and sip_extend_mclass()
-- Added macros SIP_HAVE_XXXX for extra headers, e.g., SIP_HAVE_ALERT_INFO().
-
-libsofia-sip-ua/soa:
-- Added tags SOATAG_ORDERED_USER() and SOATAG_REUSE_REJECTED()
-
-libsofia-sip-ua/tport:
-- Updated transport timers
- - Added TPTAG_KEEPALIVE(), TPTAG_PINGPONG(), TPTAG_PONG2PING()
- - Added tport_is_clear_to_send(), tport_has_queued()
-- Updated timer handling
- - Added abstract type su_timer_queue_t (typedef'd to SU_TIMER_QUEUE_T)
- - Updated su_task_timers() and su_timer_expire() prototypes
-
-libsofia-sip-ua/stun:
-- Removed extra system headers from <sofia-sip/stun_common.h>
-
-libsofia-sip-ua/su:
-- Added su_nanotime_t and functions su_nanotime()/su_monotime()
-- Added function su_getsocktype()
-- Added heap template in <sofia-sip/heap.h>
-- Added configure option --disable-tag-cast and macro SU_INLINE_TAG_CAST
-- Added global variable su_socket_blocking. If it is set to true,
- sockets are created as blocking.
-- Added access point selection functionality for Open C / Symbian
-- Added functions su_root_release(), su_root_obtain() and
- su_root_has_thread(). A thread can release a su_root_t and another one can
- obtain it.
-
libsofia-sip-ua-glib:
- No ABI/API changes, compatible with 1.12.0. Note, libsofia-sip-ua-glib
interface is not considered stable and may change in a future 1.12.x
@@ -79,82 +38,36 @@
Contributors to this release
----------------------------
-- Mikhail Zabaluev (bug fixes)
-- Fabio Margarido (bug fixes)
-- Martti Mela (Open C port and extra functionality, bug fixes)
-- Kai Vehmanen (fixes to win32 VC6/2005 project files)
-- Pekka Pessi (everything else)
+<list of people who contributed to _this_ release
+ - update as people's patches are added, or when you commit stuff
+ - current development team members (see AUTHORS) may be omitted,
+ or listed at the end of the contribur list (depending on the scope
+ of the work done since the last release)
+ - name of the contributor should be enough (email addresses in AUTHORS),
+ plus a _brief_ description of what was contributed
+ - roughly sorted by number of patches accepted
+/>
+
+- **template**: First Surname (patch to nua/soa/msg)
See the AUTHORS file in the distribution package.
Notes on new features
---------------------
-The route to the outbound proxy can now be specified as an explicit route
-set.
-
-The TCP transport can use CR-LF keepalive and CR-LF PING-PONG messages.
-
-IPv6 support can now be disabled in VC6/VC2005 builds, by
-setting SU_HAVE_IN6 to zero `win32/sofia-sip/su_configure.h'.
-
-Symbian Open C build and packaging (SIS) files for libsofia-sip-ua,
-libsofia-sip-ua-glib and for several test apps have been added under
-sofia-sip/open_c.
-
-The SIP headers Alert-Info, Reply-To. Remote-Party-ID, P-Asserted-Identity,
-and P-Preferred-Identity are not not available by default. Application must
-enable them with sip_update_default_mclass() and sip_extend_mclass().
+<information about major new features
+ - new/changed/removed functionality
+ - links to further documentation
+ - section may be omitted for minor releases
+/>
Bugs fixed in this release
--------------------------
-- Fixed sf.net bug #1804248: nua_prack() now works.
- Thanks to Fabio Margarido for sending the patch.
-- Fixed sf.net bug #1810115: crash after failed outgoing request and
- nta_destroy()
- Thanks to Mikhail Zabaluev for reporting the problem.
-- Fixed sf.net bug #1804248: nua_prack() now works.
- Thanks to Fabio Margarido for sending the patch.
-- Fixed sf.net bug 1803686: nua_destroy() can now be called from inside
- nua event callback.
- Thanks to Mikhail Zabaluev for reporting the problem.
-- SIP Content-Length structure was casted to one with 64-bit integer instead
- of 32-bit, so message body was not parsed on 64-bit big-endian platform.
- Thanks to Martin Drasar for hunting down the bug.
-- Authentication scheme token was compared as case-sensitive on client side.
- Thanks to Russell McConnachie for reporting this problem.
-- Fixed sf.net bug #1706629: in-dialog requests not routed according to the
- dialog route. Problem was because the outbound proxy was not handles as
- RECOMMENDED by RFC 3261. The new tag NUTAG_INITIAL_ROUTE() allows correct
- handling of requests.
-- Fixed problems in nua state engines (call setup failing if some messages
- were re-ordered or crashing when they were lost)
- Thanks to Michail Jerris, Anthony Minessale, and others in Freeswitch
- project for hunting down these bugs and reporting them
-- When nua generates Contact URI, the user-specified URI parameters are now
- overriden by actual transport parameters (e.g., transport=tcp)
- Thanks to Mikhail Zabaluev for submitting the patch.
-- Fixed sf.net bug #1750691: used to send ACK&BYE when extra 200 OK is
- received and the 200 OK did not match any client transaction.
- Thanks to Mikhail Zabaluev for reporting the problem.
-- Fixed problem of un-escaping reserved characters in URIs
- Thanks to Jan van den Bosch, Fabio Margarido and Mikhail Zabaluev for
- reporting the problem.
-- Fixed missing links in doxygen-generated documentation
- Thanks to Jerry Richards for reporting this problem.
-- Fixed timing problem with CANCELed INVITE transactions.
- Thanks to Fabio Margarido for reporting this problem.
-- Fixed sf.net bug #1771243: tport_check_trunc() does not block anymore
- Thanks to Erland Lwin for reporting the problem
-- Fixed sf.net bug #1733323: extra tag arguments were used by
- nta_outgoing_tcancel().
- Thanks to Fabio Margarido for reporting this problem.
-- Fixed sf.net bug #1747149: sdp_session_cmp() ignored some m= lines
- (e.g., new SDP in re-INVITE was sometimes ignored)
- Thanks to Mikhail Zabaluev for reporting the problem.
-- Fixed sf.net bug #1726034: crash in msg_as_string() with too large messages
-- Fixed sf.net bug #1472682: ACK did not find INVITE server transaction when
- the To URI had been changed.
-- Do not block when making a TCP connect()ion in tport.
- Thanks to Mikhail Zabaluev for submitting the patch.
+< notable bugs fixed in this release
+ - check the sf.net bug tracker; see closed bugs,
+ sorted by closing date
+ - other bugs as fixed in CVS/darcs
+/>
+
+- **template**: #9499652 sf.net bug item title
Modified: freeswitch/trunk/libs/sofia-sip/configure.ac
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/configure.ac (original)
+++ freeswitch/trunk/libs/sofia-sip/configure.ac Mon Nov 12 11:04:47 2007
@@ -11,7 +11,7 @@
dnl ---------------------------
dnl update both the version for AC_INIT and the LIBSOFIA_SIP_UA_MAJOR_MINOR
-AC_INIT([sofia-sip], [1.12.6work])
+AC_INIT([sofia-sip], [1.12.7devel])
AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
AC_SUBST(VER_LIBSOFIA_SIP_UA_MAJOR_MINOR, [1.12])
dnl Includedir specific to this sofia version
@@ -295,6 +295,8 @@
utils/Doxyfile
win32/Makefile
win32/config.h
+open_c/Makefile
+open_c/config.h
])
AC_CONFIG_COMMANDS([version],,[PACKAGE_VERSION=${PACKAGE_VERSION}])
Modified: freeswitch/trunk/libs/sofia-sip/docs/release_management.txt
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/docs/release_management.txt (original)
+++ freeswitch/trunk/libs/sofia-sip/docs/release_management.txt Mon Nov 12 11:04:47 2007
@@ -79,8 +79,7 @@
- update sfnet_www/index.html to mention the latest
release
- commit the change to sf.net website CVS, and run the
- sfnet_www/put_online.sh script at the sourceforge.net
- shell server
+ sfnet_www/put_online.sh script
Uploading the release to sourceforge.net
========================================
@@ -106,7 +105,7 @@
- replace the RELEASE file with RELEASE.template, and
commit it to master source repository (see sofia-sip/README.developers)
- change version in configure.ac from "X.Y.Z" to
- "X.Y.Zwork" (as it is in many cases unknown what the
+ "X.Y.Zdevel" (as it is in many cases unknown what the
next version will be)
- make a "tree open for development" commit
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/Makefile.am (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/Makefile.am Mon Nov 12 11:04:47 2007
@@ -13,21 +13,25 @@
# in the build
OPT_LIBADD =
OPT_SUBDIRS_STUN =
+OPT_SUBDIRS_HTTP =
OPT_SUBDIRS_NTH =
if HAVE_STUN
OPT_LIBADD += stun/libstun.la
OPT_SUBDIRS_STUN += stun
endif
if HAVE_NTH
-OPT_LIBADD += nth/libnth.la http/libhttp.la
-OPT_SUBDIRS_NTH += nth http
+OPT_LIBADD += http/libhttp.la nth/libnth.la
+OPT_SUBDIRS_HTTP += http
+OPT_SUBDIRS_NTH += nth
endif
# note: order does matter in the subdir list
-SUBDIRS = su features bnf sresolv sdp url msg sip $(OPT_SUBDIRS_STUN) ipt soa \
- tport nta nea iptsec $(OPT_SUBDIRS_NTH) nua
-DIST_SUBDIRS = su features bnf sresolv sdp url msg sip stun ipt soa \
- tport nta nea iptsec nth http nua docs
+SUBDIRS = su features bnf sresolv ipt sdp url msg sip $(OPT_SUBDIRS_HTTP) \
+ $(OPT_SUBDIRS_STUN) soa tport nta $(OPT_SUBDIRS_NTH) \
+ nea iptsec nua
+DIST_SUBDIRS = su features bnf sresolv ipt sdp url msg sip http \
+ stun soa tport nta nth \
+ nea iptsec nua docs
DOXYGEN = doxygen
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_class.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_class.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_class.h Mon Nov 12 11:04:47 2007
@@ -172,7 +172,7 @@
msg_numeric_hash = 24435
};
-SOFIAPUBVAR msg_hclass_t test_auth_class[1], test_numeric_class[1];
+extern msg_hclass_t test_auth_class[1], test_numeric_class[1];
SOFIA_END_DECLS
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c Mon Nov 12 11:04:47 2007
@@ -201,6 +201,8 @@
sip_content_type_t *s_content_type; /** Content-Type of SUBSCRIBE body. */
sip_payload_t *s_payload; /**< Body of SUBSCRIBE. */
+ unsigned s_reported :1 ; /**< Made watcher report upon un-SUBSCRIBE */
+
unsigned s_processing : 1;
unsigned s_rejected : 1;
unsigned s_pending_flush : 1;
@@ -1384,14 +1386,18 @@
int nes_watcher_callback(nea_server_t *nes,
nea_event_t *ev,
nea_sub_t *s,
- sip_t const *sip)
+ sip_t const *sip,
+ sip_time_t now)
{
if (!nes->nes_in_callback) {
nes->nes_in_callback = 1;
- if (ev->ev_callback) {
+ if (ev->ev_callback && !s->s_reported) {
nea_subnode_t sn[1];
- nea_subnode_init(sn, s, sip_now());
+ nea_subnode_init(sn, s, now);
+
+ if (sn->sn_expires == 0 || sn->sn_state == nea_terminated)
+ s->s_reported = 1;
ev->ev_callback(nes, ev->ev_magic, ev, sn, sip);
}
@@ -1908,13 +1914,15 @@
}
/* Callback for checking subscriber authorization */
- if (nes_watcher_callback(nes, ev, s, sip) < 0) {
+ if (nes_watcher_callback(nes, ev, s, sip, now) < 0) {
if (irq) {
nta_incoming_treply(irq, SIP_503_SERVICE_UNAVAILABLE, TAG_END());
nta_incoming_destroy(irq);
}
return -1;
}
+
+
evv = s->s_view; /* Callback can change event view */
@@ -1975,7 +1983,7 @@
{
int notified = 0;
ta_list ta;
- int subscription_state_change = now == 0;
+ int suppress = now != 0;
nea_event_t *ev = s->s_event;
nea_state_t substate = s->s_state;
@@ -1990,7 +1998,7 @@
assert(s->s_view); assert(ev);
- if (!subscription_state_change && s->s_view->evv_updated == s->s_updated)
+ if (suppress && s->s_view->evv_updated == s->s_updated)
return 0;
if (now == 0)
@@ -2069,7 +2077,7 @@
break;
}
- subscription_state_change = (s->s_view->evv_updated == s->s_updated);
+ suppress = (s->s_view->evv_updated == s->s_updated);
n_evq = evq->evq_payload ? evq : evv->evv_primary->evv_head;
@@ -2083,9 +2091,9 @@
SIPTAG_USER_AGENT_STR(nes->nes_server),
SIPTAG_CONTACT(s->s_local),
SIPTAG_EVENT(s->s_id),
- TAG_IF(!subscription_state_change,
+ TAG_IF(!suppress,
SIPTAG_CONTENT_TYPE(n_evq->evq_content_type)),
- TAG_IF(!subscription_state_change,
+ TAG_IF(!suppress,
SIPTAG_PAYLOAD(n_evq->evq_payload)),
ta_tags(ta));
@@ -2104,7 +2112,7 @@
if (callback == NULL) {
nta_outgoing_destroy(s->s_oreq), s->s_oreq = NULL;
/* Inform the application of a subscriber leaving the subscription. */
- nes_watcher_callback(nes, ev, s, NULL);
+ nes_watcher_callback(nes, ev, s, NULL, now);
}
}
ta_end(ta);
@@ -2127,6 +2135,7 @@
{
nea_server_t *nes = s->s_nes;
int status = sip->sip_status->st_status;
+ sip_time_t now = sip_now();
if (status < 200)
return 0;
@@ -2135,8 +2144,6 @@
if (status < 300) {
if (s->s_view->evv_updated != s->s_updated) {
- sip_time_t now = sip_now();
-
if (s->s_notified + s->s_throttle <= now)
nea_sub_notify(nes, s, now, TAG_END());
else
@@ -2148,7 +2155,7 @@
SU_DEBUG_5(("nea_server: removing subscriber " URL_PRINT_FORMAT "\n",
URL_PRINT_ARGS(s->s_from->a_url)));
/* Inform the application of a subscriber leaving the subscription. */
- nes_watcher_callback(nes, s->s_event, s, NULL);
+ nes_watcher_callback(nes, s->s_event, s, NULL, now);
}
return 0;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua.docs
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua.docs (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua.docs Mon Nov 12 11:04:47 2007
@@ -332,15 +332,15 @@
@image html SIP_outgoing_operation_with_auth.gif
-
@section nua_simpleapplication Simple Application
The following sections will present code examples from a simple application
that uses services of NUA. The example is not complete but should present
all relevant details of the basic use of NUA.
-The source distribution of Sofia stack contains in directory nua an example
-application nua_cli.c that can be studied for more complete example.
+On sourceforge.net there is available an example application
+<a href="http://sourceforge.net/project/showfiles.php?group_id=143636&package_id=179…">
+sofisip_cli.c</a> that can be studied for more complete example.
@subsection nua_datastructures Data Structures & Defines
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c Mon Nov 12 11:04:47 2007
@@ -129,35 +129,53 @@
* @b SUBSCRIBE request is used to query SIP event state or establish a SIP
* event subscription.
*
+ * @param status status code of response sent automatically by stack
+ * @param phrase response phrase sent automatically by stack
+ * @param nh operation handle associated with the incoming request
+ * @param hmagic application context associated with the handle
+ * (NULL when handle is created by the stack)
+ * @param sip SUBSCRIBE request headers
+ * @param tags NUTAG_SUBSTATE()
+ *
* Initial SUBSCRIBE requests are dropped with <i>489 Bad Event</i>
* response, unless the application has explicitly included the @Event in
* the list of allowed events with nua_set_params() tag NUTAG_ALLOW_EVENTS()
- * (or SIPTAG_ALLOW_EVENTS() or SIPTAG_ALLOW_EVENTS_STR()). The application
+ * (or SIPTAG_ALLOW_EVENTS() or SIPTAG_ALLOW_EVENTS_STR()).
+ *
+ * If the event has been allowed 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_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
- * response to the SUBSCRIBE request may be lost because the SUBSCRIBE
- * request was forked by an intermediate proxy.
+ * response to the SUBSCRIBE request may be lost by an intermediate proxy
+ * because it had forked the SUBSCRIBE request.
*
* SUBSCRIBE requests modifying (usually refreshing or terminating) an
* existing event subscription are accepted by default and a <i>200 OK</i>
* response along with a copy of previously sent NOTIFY is sent
- * automatically.
+ * automatically to the subscriber.
*
* By default, only event subscriptions accepted are those created
* implicitly by REFER request. See #nua_i_refer how the application must
* handle the REFER requests.
*
- * @param status status code of response sent automatically by stack
- * @param phrase response phrase sent automatically by stack
- * @param nh operation handle associated with the incoming request
- * @param hmagic application context associated with the handle
- * (NULL when handle is created by the stack)
- * @param sip SUBSCRIBE request headers
- * @param tags NUTAG_SUBSTATE()
+ * @par Subscription Lifetime and Terminating Subscriptions
+ *
+ * Accepting the SUBSCRIBE request creates a dialog with a <i>notifier
+ * dialog usage</i> on the handle. The dialog usage is active, until the
+ * subscriber terminates the subscription, it times out or the application
+ * terminates the usage with nua_notify() call containing the tag
+ * NUTAG_SUBSTATE(nua_substate_terminated) or @SubscriptionState header with
+ * state "terminated" and/or expiration time 0.
+ *
+ * When the subscriber terminates the subscription, the application is
+ * notified of an termination by a #nua_i_subscribe event with
+ * NUTAG_SUBSTATE(nua_substate_terminated) tag. When the subscription times
+ * out, nua automatically initiates a NOTIFY transaction. When it is
+ * terminated, the application is sent a #nua_r_notify event with
+ * NUTAG_SUBSTATE(nua_substate_terminated) tag.
*
* @sa @RFC3265, nua_notify(), NUTAG_SUBSTATE(), @SubscriptionState,
* @Event, nua_subscribe(), #nua_r_subscribe, #nua_i_refer, nua_refer()
@@ -351,11 +369,22 @@
*
* This function is used when the application implements itself the
* notifier. The application must provide valid @SubscriptionState and
- * @Event headers using SIP tags. If there is no @SubscriptionState header,
- * the subscription state can be modified with NUTAG_SUBSTATE().
+ * @Event headers using SIP tags. The subscription state can be modified
+ * with NUTAG_SUBSTATE(), however, its effect is overriden by
+ * @SubscriptionState header included in the nua_notify() tags.
*
* @bug If the @Event is not given by application, stack uses the @Event
* header from the first subscription usage on handle.
+ *
+ * If there is no active <i>notifier dialog usage</i> or no notifier dialog
+ * usage matches the @Event header given by the application the nua_notify()
+ * request is rejected locally by the stack with status code 481. The local
+ * rejection can be bypassed if NUTAG_NEWSUB(1) is included in tags.
+ *
+ * Please note that including NUTAG_NEWSUB(1) in nua_notify() tags if there
+ * is a valid subscription may lead to an extra NOTIFY sent to subscriber if
+ * the subscription had been terminated by the subscriber or by a timeout
+ * before the nua_notify() is processed.
*
* @param nh Pointer to operation handle
* @param tag, value, ... List of tagged parameters
@@ -365,6 +394,7 @@
*
* @par Related Tags:
* NUTAG_SUBSTATE() \n
+ * NUTAG_NEWSUB() \n
* Tags of nua_set_hparams() \n
* Header tags defined in <sofia-sip/sip_tag.h>
*
@@ -461,8 +491,11 @@
if (now + expires < now)
expires = SIP_TIME_MAX - now - 1;
- /* Notifier can only shorten the subscription time */
- if (nu->nu_requested == 0 || nu->nu_requested >= now + expires)
+ /* We can change the lifetime of unsolicited subscription at will */
+ if (nu->nu_requested == 0)
+ nu->nu_expires = nu->nu_requested = now + expires;
+ /* Notifier can only shorten the subscribed time */
+ else if (nu->nu_requested >= now + expires)
nu->nu_expires = nu->nu_requested = now + expires;
}
}
@@ -648,7 +681,12 @@
* The @b NOTIFY may be sent explicitly by nua_notify() or implicitly by NUA
* state machine. Implicit @b NOTIFY is sent when an established dialog is
* refreshed by client or it is terminated (either by client or because of a
- * timeout)
+ * timeout).
+ *
+ * The current subscription state is included in NUTAG_SUBSTATE() tag. The
+ * nua_substate_terminated indicates that the subscription is terminated,
+ * the notifier usage has been removed and when there was no other usages of
+ * the dialog the dialog state is also removed.
*
* @param status response status code
* (if the request is retried, @a status is 100, the @a
@@ -663,7 +701,7 @@
* @param tags NUTAG_SUBSTATE() indicating subscription state
* SIPTAG_EVENT() indicating subscription event
*
- * @sa nua_notify(), @RFC3265, #nua_i_subscribe, #nua_i_refer
+ * @sa nua_notify(), @RFC3265, #nua_i_subscribe, #nua_i_refer, NUTAG_SUBSTATE()
*
* @END_NUA_EVENT
*/
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c Mon Nov 12 11:04:47 2007
@@ -1525,7 +1525,7 @@
sip_contact_t const *m;
/* nta */
- usize_t udp_mtu = 0;
+ unsigned udp_mtu = 0;
usize_t max_proceeding = 0;
unsigned sip_t1 = 0, sip_t2 = 0, sip_t4 = 0, sip_t1x64 = 0;
unsigned debug_drop_prob = 0;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c Mon Nov 12 11:04:47 2007
@@ -1003,6 +1003,7 @@
msg_t *msg,
int error)
{
+ nua_dialog_usage_t *du = nua_dialog_usage_public(nr);
tp_name_t const *tpn;
int pending = nr->nr_error_report_id;
@@ -1018,7 +1019,7 @@
tpn = tport_name(nr->nr_tport);
SU_DEBUG_5(("nua_register(%p): tport to %s/%s:%s%s%s closed %s\n",
- nua_dialog_usage_public(nr)->du_dialog->ds_owner,
+ du->du_dialog->ds_owner,
tpn->tpn_proto, tpn->tpn_host, tpn->tpn_port,
tpn->tpn_comp ? ";comp=" : "",
tpn->tpn_comp ? tpn->tpn_comp : "",
@@ -1027,7 +1028,7 @@
tport_unref(nr->nr_tport), nr->nr_tport = NULL;
/* Schedule re-REGISTER immediately */
- nua_dialog_usage_set_refresh_range(nua_dialog_usage_public(nr), 0, 0);
+ nua_dialog_usage_set_refresh_range(du, 0, 0);
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c Mon Nov 12 11:04:47 2007
@@ -330,8 +330,6 @@
ctx->a.printer = o_events_init ? print_event : NULL;
- sleep(2);
-
retval |= test_nua_api_errors(ctx); SINGLE_FAILURE_CHECK();
retval |= test_tag_filter(); SINGLE_FAILURE_CHECK();
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c Mon Nov 12 11:04:47 2007
@@ -86,7 +86,7 @@
} \
extern int LIST_DUMMY_VARIABLE
-#include <test_proxy.h>
+#include "test_proxy.h"
#include <sofia-sip/auth_module.h>
struct proxy {
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_sip_events.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_sip_events.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_sip_events.c Mon Nov 12 11:04:47 2007
@@ -99,6 +99,7 @@
sip_t const *sip;
tagi_t const *t, *n_tags, *r_tags;
url_t b_url[1];
+ enum nua_substate substate;
nea_sub_t *sub = NULL;
char const open[] =
@@ -207,7 +208,7 @@
TAG_END());
run_ab_until(ctx, -1, save_until_notified_and_responded,
- -1, NULL /* XXX save_until_received */);
+ -1, save_until_received);
/* Client events:
nua_subscribe(), nua_i_notify/nua_r_subscribe
@@ -242,6 +243,9 @@
TEST_1(!en->next || !es->next);
free_events_in_list(ctx, a->events);
+ /* XXX --- Do not check server side events */
+ free_events_in_list(ctx, b->events);
+
if (print_headings)
printf("TEST NUA-12.2: PASSED\n");
@@ -266,8 +270,7 @@
SIPTAG_PAYLOAD_STR(open),
TAG_END());
- run_ab_until(ctx, -1, save_until_notified,
- -1, NULL /* XXX save_until_received */);
+ run_ab_until(ctx, -1, save_until_notified, -1, save_until_received);
/* subscriber events:
nua_i_notify
@@ -287,6 +290,9 @@
TEST_1(!e->next);
free_events_in_list(ctx, a->events);
+ /* XXX --- Do not check server side events */
+ free_events_in_list(ctx, b->events);
+
if (print_headings)
printf("TEST NUA-12.3: PASSED\n");
@@ -308,7 +314,7 @@
UNSUBSCRIBE(a, a_call, a_call->nh, TAG_END());
run_ab_until(ctx, -1, save_until_final_response,
- -1, NULL /* XXX save_until_received */);
+ -1, save_until_subscription);
/* Client events:
nua_unsubscribe(), nua_i_notify/nua_r_unsubscribe
@@ -335,6 +341,19 @@
/* TEST_1(!e->next); */
free_events_in_list(ctx, a->events);
+ /* Server events: nua_i_subscription with terminated status */
+ TEST_1(e = b->events->head);
+ TEST_E(e->data->e_event, nua_i_subscription);
+ TEST(tl_gets(e->data->e_tags,
+ NEATAG_SUB_REF(sub),
+ NUTAG_SUBSTATE_REF(substate),
+ TAG_END()), 2);
+ TEST_1(sub);
+ TEST(substate, nua_substate_terminated);
+ TEST_1(!e->next);
+
+ free_events_in_list(ctx, b->events);
+
if (print_headings)
printf("TEST NUA-12.5: PASSED\n");
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/Makefile.am (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/Makefile.am Mon Nov 12 11:04:47 2007
@@ -18,7 +18,7 @@
check_PROGRAMS = torture_su torture_su_port \
torture_su_alloc torture_su_time torture_su_tag \
- test_htable torture_rbtree torture_heap \
+ test_htable test_htable2 torture_rbtree torture_heap \
test_memmem torture_su_bm \
torture_su_root torture_su_timer \
test_su su_proxy test_poll $(OSXPROGS)
@@ -28,7 +28,7 @@
TESTS = torture_su torture_su_port \
torture_su_alloc torture_su_time torture_su_tag \
- test_htable torture_rbtree torture_heap \
+ test_htable test_htable2 torture_rbtree torture_heap \
test_memmem torture_su_bm \
torture_su_root torture_su_timer \
run_addrinfo run_localinfo run_test_su \
@@ -80,7 +80,11 @@
memmem.c strtoull.c strcasestr.c \
memspn.c memcspn.c memccpy.c \
inet_ntop.c inet_pton.c poll.c getopt.c \
- su_tag_ref.c su_win32_port.c
+ su_tag_ref.c
+
+# Automake 1.9 complains about missing CXX
+EXTRA_DIST = su_win32_port.c \
+ su_open_c_localinfo.cpp
libsu_la_LIBADD = $(REPLACE_LIBADD)
libsu_la_DEPENDENCIES = $(REPLACE_LIBADD)
@@ -92,7 +96,7 @@
# ----------------------------------------------------------------------
# Install and distribution rules
-EXTRA_DIST = su.docs \
+EXTRA_DIST += su.docs \
run_addrinfo run_localinfo run_test_su
dist_pkgdata_SCRIPTS = tag_dll.awk
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/htable.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/htable.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/htable.h Mon Nov 12 11:04:47 2007
@@ -141,6 +141,8 @@
new_size = 2 * pr->pr##_size + 1; \
if (new_size < HTABLE_MIN_SIZE) \
new_size = HTABLE_MIN_SIZE; \
+ if (new_size < 5 * pr->pr##_used / 4) \
+ new_size = 5 * pr->pr##_used / 4; \
\
if (!(new_hash = su_zalloc(home, sizeof(*new_hash) * new_size))) \
return -1; \
@@ -170,6 +172,8 @@
\
assert(pr->pr##_used == used); \
\
+ su_free(home, old_hash); \
+\
return 0; \
} \
\
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/htable2.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/htable2.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/htable2.h Mon Nov 12 11:04:47 2007
@@ -30,8 +30,9 @@
*
* Hash tables templates, take 2.
*
- * Note: this version can handle structures as entries, and it can be used
- * without <sofia-sip/su_alloc.h>.
+ * Note: this version stores the given element types as entries (instead of
+ * always storing a pointer to element). It can be used without
+ * <sofia-sip/su_alloc.h>.
*
* This file contain a hash table template for C. The hash tables are
* resizeable, and they usually contain pointers to entries. The
@@ -66,21 +67,24 @@
/** Declare hash table structure type.
*
- * The macro HTABLE2_DECLARE() expands to a declaration for hash table
- * structure. The its typedef will be <em>prefix</em><code>_t</code>, the
- * field names start with @a pr. The entry type is @a entrytype.
+ * The macro HTABLE2_DECLARE2() expands to a declaration for hash table
+ * structure. The its typedef will be @a type, the field names start with @a
+ * pr. The entry type is @a entrytype.
*
+ * @param type hash table typedef
* @param sname name of struct
- * @param prefix hash table type and function prefix
* @param pr hash table field prefix
* @param entrytype entry type
*/
+#define HTABLE2_DECLARE2(type, sname, pr, entrytype, size_t) \
+typedef struct sname { \
+ size_t pr##size; \
+ size_t pr##used; \
+ entrytype *pr##table; \
+} type
+
#define HTABLE2_DECLARE(sname, prefix, pr, entrytype) \
-struct sname { \
- unsigned pr##size; \
- unsigned pr##used; \
- entrytype *pr##table; /**< Hash table itself */ \
-}
+ HTABLE2_DECLARE2(prefix##t, sname, pr, entrytype, unsigned)
#ifndef HTABLE2_SCOPE
/** Default scope for hash table functions. */
@@ -89,27 +93,30 @@
/** Prototypes for hash table
*
- * The macro HTABLE2_PROTOS() expands to the prototypes of hash table
+ * The macro HTABLE2_PROTOS2() expands to the prototypes of hash table
* functions. The function and type names start with @a prefix, the field
* names start with @a pr. The entry type is @a entrytype.
-
+ *
* @param type hash table typedef
* @param prefix function prefix
- * @param pr hash table field prefix
+ * @param pr hash table field prefix (not used)
* @param entrytype entry type
*/
-#define HTABLE2_PROTOS(type, prefix, pr, entrytype) \
-HTABLE2_SCOPE int prefix##_resize(void *a, type pr[1], unsigned); \
+#define HTABLE2_PROTOS2(type, prefix, pr, entrytype, size_t) \
+HTABLE2_SCOPE int prefix##_resize(void *a, type *, size_t); \
HTABLE2_SCOPE int prefix##_is_full(type const *); \
-HTABLE2_SCOPE entrytype *prefix##_hash(type const *, hash_value_t hv); \
-HTABLE2_SCOPE entrytype *prefix##_next(type const *, entrytype *ee); \
-HTABLE2_SCOPE void prefix##_append(type *pr, entrytype e); \
-HTABLE2_SCOPE void prefix##_insert(type *pr, entrytype e); \
-HTABLE2_SCOPE int prefix##_remove(type *, entrytype const e)
+HTABLE2_SCOPE entrytype *prefix##_hash(type const *, hash_value_t); \
+HTABLE2_SCOPE entrytype *prefix##_next(type const *, entrytype *); \
+HTABLE2_SCOPE entrytype *prefix##_append(type *, entrytype); \
+HTABLE2_SCOPE entrytype *prefix##_insert(type *, entrytype); \
+HTABLE2_SCOPE int prefix##_remove(type *, entrytype const)
+
+#define HTABLE2_PROTOS(type, prefix, pr, entrytype) \
+ HTABLE2_PROTOS2(type, prefix, pr, entrytype, unsigned)
/** Hash table implementation.
*
- * The macro HTABLE2_BODIES() expands the hash table functions. The function
+ * The macro HTABLE2_BODIES2() expands the hash table functions. The function
* and type names start with @a prefix, the field names start with @a pr.
* The entry type is @a entrytype. The function (or macro) name returning
* hash value of each entry is given as @a hfun.
@@ -118,25 +125,26 @@
* @param prefix function prefix for hash table
* @param pr field prefix for hash table
* @param entrytype type of entry element
+ * @param size_t size_t type
* @param hfun function or macro returning hash value of entry
* @param is_used function or macro returning true if entry is occupied
* @param reclaim function or macro zeroing entry
* @param is_equal equality test
* @param halloc function allocating or freeing memory
*/
-#define HTABLE2_BODIES(type, prefix, pr, entrytype, \
- hfun, is_used, reclaim, is_equal, halloc) \
+#define HTABLE2_BODIES2(type, prefix, pr, entrytype, size_t, \
+ hfun, is_used, reclaim, is_equal, halloc) \
/** Reallocate new hash table */ \
HTABLE2_SCOPE \
int prefix##_resize(void *realloc_arg, \
type pr[1], \
- unsigned new_size) \
+ usize_t new_size) \
{ \
entrytype *new_hash; \
entrytype *old_hash = pr->pr##table; \
- unsigned old_size; \
- unsigned i, j, i0; \
- unsigned again = 0, used = 0, collisions = 0; \
+ usize_t old_size; \
+ usize_t i, j, i0; \
+ usize_t again = 0, used = 0, collisions = 0; \
\
(void)realloc_arg; \
\
@@ -144,11 +152,15 @@
new_size = 2 * pr->pr##size + 1; \
if (new_size < HTABLE2_MIN_SIZE) \
new_size = HTABLE2_MIN_SIZE; \
+ if (new_size < 5 * pr->pr##used / 4) \
+ new_size = 5 * pr->pr##used / 4; \
\
if (!(new_hash = halloc(realloc_arg, NULL, sizeof(*new_hash) * new_size))) \
return -1; \
\
- memset(new_hash, 0, sizeof(*new_hash) * new_size); \
+ for (i = 0; i < new_size; i++) { \
+ (reclaim(&new_hash[i])); \
+ } \
old_size = pr->pr##size; \
\
do for (j = 0; j < old_size; j++) { \
@@ -202,24 +214,34 @@
} \
\
HTABLE2_SCOPE \
-void prefix##_append(type *pr, entrytype e) \
+entrytype *prefix##_append(type *pr, entrytype e) \
{ \
entrytype *ee; \
\
+ assert(pr->pr##used < pr->pr##size); \
+ if (pr->pr##used == pr->pr##size) \
+ return (entrytype *)0; \
+\
pr->pr##used++; \
for (ee = prefix##_hash(pr, hfun(e)); \
is_used(*ee); \
ee = prefix##_next(pr, ee)) \
; \
*ee = e; \
+\
+ return ee; \
} \
\
HTABLE2_SCOPE \
-void prefix##_insert(type *pr, entrytype e) \
+entrytype *prefix##_insert(type *pr, entrytype e) \
{ \
entrytype e0; \
entrytype *ee; \
\
+ assert(pr->pr##used < pr->pr##size); \
+ if (pr->pr##used == pr->pr##size) \
+ return (entrytype *)0; \
+\
pr->pr##used++; \
/* Insert entry into hash table (before other entries with same hash) */ \
for (ee = prefix##_hash(pr, hfun(e)); \
@@ -227,12 +249,14 @@
ee = prefix##_next(pr, ee)) \
*ee = e, e = e0; \
*ee = e; \
+\
+ return ee; \
} \
\
HTABLE2_SCOPE \
int prefix##_remove(type *pr, entrytype const e) \
{ \
- unsigned i, j, k, size = pr->pr##size; \
+ usize_t i, j, k, size = pr->pr##size; \
entrytype *htable = pr->pr##table; \
\
/* Search for entry */ \
@@ -263,4 +287,10 @@
} \
extern int const prefix##_dummy
+#define HTABLE2_BODIES(type, prefix, pr, entrytype, \
+ hfun, is_used, reclaim, is_equal, halloc) \
+ HTABLE2_BODIES2(type, prefix, pr, entrytype, unsigned, \
+ hfun, is_used, reclaim, is_equal, halloc)
+
+
#endif /** !defined(HTABLE2_H) */
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/tstdef.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/tstdef.h (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/tstdef.h Mon Nov 12 11:04:47 2007
@@ -319,13 +319,13 @@
/** @HIDE */
#define TEST_M_(flags, suite, expect, len) do { \
void const * _value, * _expect; \
- int _len; \
+ size_t _len; \
if (flags & tst_verbatim) { \
printf("%s: %s%stesting %s is %s\n", TSTNAME, #suite, #expect); \
fflush(stdout); } \
_value = (suite); \
_expect = (expect); \
- _len = (len); \
+ _len = (size_t)(len); \
if (((_value == NULL || _expect == NULL) && _value == _expect) || \
memcmp(_value, _expect, _len) == 0) \
{ if (flags & tst_verbatim) \
@@ -333,7 +333,8 @@
fprintf(stderr, "%s:%u: %s %s%sFAILED: %s != %s "\
"or \"%.*s\" != \"%.*s\"\n", \
__FILE__, __LINE__, TSTNAME, \
- #suite, #expect, _len, (char *)_value, _len, (char *)_expect); \
+ #suite, #expect, (int)_len, \
+ (char *)_value, (int)_len, (char *)_expect); \
fflush(stderr); \
TEST_FAILED(flags); \
} while(0)
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c Mon Nov 12 11:04:47 2007
@@ -915,6 +915,11 @@
* @retval -1 upon an error.
*
* @sa SU_HOME_INIT(), su_home_deinit(), su_home_new(), su_home_clone()
+ *
+ * @bug
+ * Prior to @VERSION_1_12_8 the su_home_t structure should have been
+ * initialized with SU_HOME_INIT() or otherwise zeroed before calling
+ * su_home_init().
*/
int su_home_init(su_home_t *home)
{
@@ -924,6 +929,8 @@
return -1;
home->suh_blocks = sub = su_hash_alloc(SUB_N);
+ home->suh_lock = NULL;
+
if (!sub)
return -1;
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_htable.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_htable.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_htable.c Mon Nov 12 11:04:47 2007
@@ -157,18 +157,23 @@
su_free(c->c_home, e);
}
+/*
+ * Check that all n entries with hash h are in hash table
+ * and they are stored in same order
+ * in which they were added to the hash
+ */
static unsigned long count(context_t *c, hash_value_t h)
{
entry_t *e, **ee;
- unsigned long n;
+ unsigned long n, expect = 1;
for (ee = htable_hash(c->c_hash, h), n = 0;
(e = *ee);
ee = htable_next(c->c_hash, ee)) {
if (e->e_value != h)
continue;
- if (e->e_n == n)
- n++;
+ if (e->e_n == expect)
+ n++, expect++;
}
return n;
@@ -218,9 +223,9 @@
for correct ordering */
hash_value_t size = c->c_hash->ht_size, h = size - 1;
- TEST_1(add(c, h, 0)); TEST_1(add(c, h, 1)); TEST_1(add(c, h, 2));
- TEST_1(add(c, h, 3)); TEST_1(add(c, h, 4)); TEST_1(add(c, h, 5));
- TEST_1(add(c, h, 6)); TEST_1(add(c, h, 7)); TEST_1(add(c, h, 8));
+ TEST_1(add(c, h, 1)); TEST_1(add(c, h, 2)); TEST_1(add(c, h, 3));
+ TEST_1(add(c, h, 4)); TEST_1(add(c, h, 5)); TEST_1(add(c, h, 6));
+ TEST_1(add(c, h, 7)); TEST_1(add(c, h, 8)); TEST_1(add(c, h, 9));
TEST(count(c, h), 9);
Added: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_htable2.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_htable2.c Mon Nov 12 11:04:47 2007
@@ -0,0 +1,267 @@
+/*
+ * This file is part of the Sofia-SIP package
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ * Contact: Pekka Pessi <pekka.pessi(a)nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**@ingroup su_htable
+ *
+ * @CFILE test_htable.c
+ *
+ * Test functions for the @b su library hash table implementation.
+ *
+ * @internal
+ *
+ * @author Pekka Pessi <Pekka.Pessi(a)nokia.com>
+ *
+ * @date Created: Tue Aug 21 15:18:26 2001 ppessi
+ */
+
+#include "config.h"
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <stdio.h>
+#include <assert.h>
+
+#include "sofia-sip/su_alloc.h"
+#include "sofia-sip/htable2.h"
+
+#define TSTFLAGS flags
+#include <sofia-sip/tstdef.h>
+
+char const name[] = "test_htable2";
+
+void usage(int exitcode)
+{
+ fprintf(stderr, "usage: %s [-v|--verbatim] [-a|--abort]\n", name);
+ exit(exitcode);
+}
+
+static int table2_test(int flags);
+
+int main(int argc, char *argv[])
+{
+ int flags = 0;
+
+ int retval = 0;
+ int i;
+
+ for (i = 1; argv[i]; i++) {
+ if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--verbatim") == 0)
+ flags |= tst_verbatim;
+ else if (strcmp(argv[i], "-a") == 0 || strcmp(argv[i], "--abort") == 0)
+ flags |= tst_abort;
+ else
+ usage(1);
+ }
+
+ retval |= table2_test(flags); fflush(stdout);
+
+ return retval;
+}
+
+typedef struct hentry_s entry_t;
+
+HTABLE2_DECLARE2(htable2_t, htable2_s, ht2_, entry_t, size_t);
+HTABLE2_PROTOS2(htable2_t, htable2, ht2_, entry_t, size_t);
+
+struct hentry_s
+{
+ unsigned long e_hash;
+ unsigned long e_n;
+};
+
+#define HENTRY_HASH(e) ((e).e_hash)
+#define HENTRY_IS_USED(e) ((e).e_n != 0)
+#define HENTRY_REMOVE(e) ((e)->e_n = 0, (e)->e_hash = 0)
+#define HENTRY_IS_EQUAL(a, b) ((a).e_n == (b).e_n)
+#define HALLOC(home, old, newsize) (su_realloc(home, old, newsize))
+
+HTABLE2_BODIES2(htable2_t, htable2, ht2_, entry_t, size_t,
+ HENTRY_HASH, HENTRY_IS_USED, HENTRY_REMOVE, HENTRY_IS_EQUAL,
+ HALLOC);
+
+typedef struct context_s
+{
+ su_home_t c_home[1];
+ htable2_t c_hash[1];
+} context_t;
+
+context_t *context_create(void)
+{
+ context_t *c = su_home_clone(NULL, sizeof(*c));
+
+ if (c)
+ htable2_resize(c->c_home, c->c_hash, 0);
+
+ return c;
+}
+
+static
+entry_t *search(context_t *c, unsigned long value, unsigned long n, int add)
+{
+ htable2_t *ht = c->c_hash;
+ entry_t *e;
+ unsigned long hash = value;
+
+ /* Search for entry in hash table */
+ for (e = htable2_hash(ht, hash);
+ e->e_n != 0;
+ e = htable2_next(ht, e)) {
+ if (e->e_hash == value && e->e_n == n)
+ return e;
+ }
+
+ if (add) {
+ entry_t entry;
+
+ /* Resize hash table */
+ if (htable2_is_full(ht)) {
+ htable2_resize(c->c_home, ht, 0);
+ fprintf(stderr, "htable: resized to "MOD_ZU" with "MOD_ZU" entries\n",
+ ht->ht2_size, ht->ht2_used);
+ }
+
+ /* Add an entry */
+ e = &entry, e->e_hash = value, e->e_n = n;
+
+ return htable2_append(ht, *e);
+ }
+
+ return NULL;
+}
+
+static int add(context_t *c, unsigned long value, unsigned long n)
+{
+ return search(c, value, n, 1) != NULL;
+}
+
+static
+void zap(context_t *c, entry_t e)
+{
+ htable2_remove(c->c_hash, e);
+}
+
+/*
+ * Check that all n entries with hash h are in hash table
+ * and they are stored in same order
+ * in which they were added to the hash
+ */
+static unsigned long count(context_t *c, hash_value_t h)
+{
+ entry_t *e;
+ unsigned long n;
+ unsigned long expect = 1;
+
+ for (e = htable2_hash(c->c_hash, h), n = 0;
+ e->e_n != 0;
+ e = htable2_next(c->c_hash, e)) {
+ if (e->e_hash != h)
+ continue;
+ if (e->e_n == expect)
+ n++, expect++;
+ }
+
+ return n;
+}
+
+int table2_test(int flags)
+{
+ context_t *c;
+ entry_t *e, e0;
+
+ BEGIN();
+
+ TEST_1(c = context_create());
+ TEST_1(add(c, 0, 1)); TEST_1(c->c_hash->ht2_table[0].e_n == 1);
+ TEST_1(add(c, 1, 2)); TEST_1(c->c_hash->ht2_table[1].e_n == 2);
+ TEST_1(add(c, 2, 3)); TEST_1(c->c_hash->ht2_table[2].e_n == 3);
+ TEST_1(add(c, 0, 4)); TEST_1(c->c_hash->ht2_table[3].e_n == 4);
+ TEST_1(add(c, 2, 5)); TEST_1(c->c_hash->ht2_table[4].e_n == 5);
+
+ TEST_1(e = search(c, 1, 2, 0));
+ e0 = *e;
+ TEST(htable2_remove(c->c_hash, e0), 0);
+ TEST(htable2_remove(c->c_hash, e0), -1);
+
+ /* after remove , 4 is mode to [1], 5 to [4] */
+ TEST(c->c_hash->ht2_table[0].e_n, 1);
+ TEST(c->c_hash->ht2_table[1].e_n, 4);
+ TEST(c->c_hash->ht2_table[2].e_n, 3);
+ TEST(c->c_hash->ht2_table[3].e_n, 5);
+ TEST(c->c_hash->ht2_table[4].e_n, 0);
+
+ zap(c, c->c_hash->ht2_table[0]);
+
+ /* after remove , 4 is mode to [1], 5 to [4] */
+ TEST(c->c_hash->ht2_table[0].e_n, 4);
+ TEST(c->c_hash->ht2_table[1].e_n, 0);
+ TEST(c->c_hash->ht2_table[2].e_n, 3);
+ TEST(c->c_hash->ht2_table[3].e_n, 5);
+ TEST(c->c_hash->ht2_table[4].e_n, 0);
+
+ TEST_1(add(c, 0, 6)); TEST(c->c_hash->ht2_table[1].e_n, 6);
+ TEST_1(add(c, 1, 7)); TEST(c->c_hash->ht2_table[4].e_n, 7);
+
+ /* Test that zapping entry 0 does not move 2 and 3 */
+ zap(c, c->c_hash->ht2_table[0]);
+ TEST(c->c_hash->ht2_table[4].e_n, 0);
+
+ {
+ /* Insert entries at the end of hash, then resize and check
+ for correct ordering */
+ size_t size = c->c_hash->ht2_size;
+ hash_value_t h = (hash_value_t)size - 1;
+
+ TEST_1(add(c, h, 1)); TEST_1(add(c, h, 2)); TEST_1(add(c, h, 3));
+ TEST_1(add(c, h, 4)); TEST_1(add(c, h, 5)); TEST_1(add(c, h, 6));
+ TEST_1(add(c, h, 7)); TEST_1(add(c, h, 8)); TEST_1(add(c, h, 9));
+
+ TEST(count(c, h), 9);
+
+ TEST(htable2_resize(c->c_home, c->c_hash, ++size), 0);
+ TEST(count(c, h), 9);
+ TEST(htable2_resize(c->c_home, c->c_hash, ++size), 0);
+ TEST(count(c, h), 9);
+ TEST(htable2_resize(c->c_home, c->c_hash, ++size), 0);
+ TEST(count(c, h), 9);
+ TEST(htable2_resize(c->c_home, c->c_hash, ++size), 0);
+ TEST(count(c, h), 9);
+ TEST(htable2_resize(c->c_home, c->c_hash, ++size), 0);
+ TEST(count(c, h), 9);
+ TEST(htable2_resize(c->c_home, c->c_hash, ++size), 0);
+ TEST(count(c, h), 9);
+ TEST(htable2_resize(c->c_home, c->c_hash, ++size), 0);
+ TEST(count(c, h), 9);
+ TEST(htable2_resize(c->c_home, c->c_hash, ++size), 0);
+ TEST(count(c, h), 9);
+ TEST(htable2_resize(c->c_home, c->c_hash, ++size), 0);
+ TEST(count(c, h), 9);
+ }
+
+ TEST_VOID(su_home_unref(c->c_home));
+
+ END();
+}
+
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_su.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_su.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_su.c Mon Nov 12 11:04:47 2007
@@ -52,7 +52,7 @@
#include <assert.h>
-char const name[] = "su_test";
+char const name[] = "test_su";
#if HAVE_FUNC
#define enter (void)SU_DEBUG_9(("%s: %s: entering\n", name, __func__))
@@ -64,7 +64,7 @@
#else
#define enter ((void)0)
#define nh_enter ((void)0)
-#define __func__ "su_test"
+#define __func__ "test_su"
#endif
struct pinger {
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_alloc.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_alloc.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_alloc.c Mon Nov 12 11:04:47 2007
@@ -69,6 +69,7 @@
{
exhome_t *h0, *h1, *h2, *h3;
su_home_t home[1] = { SU_HOME_INIT(home) };
+ su_home_t home0[1];
enum { N = 40 };
void *m0[N], *m1[N], *m;
char *c, *c0, *p0, *p1;
@@ -78,6 +79,11 @@
BEGIN();
+ /* su_home_init() was not initializing suh_locks */
+ memset(home0, 0xff, sizeof home0);
+ TEST(su_home_init(home0), 0);
+ TEST_VOID(su_home_deinit(home0));
+
TEST_1(h0 = su_home_new(sizeof(*h0)));
TEST_1(h1 = su_home_clone(h0->home, sizeof(*h1)));
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_root.c Mon Nov 12 11:04:47 2007
@@ -165,6 +165,8 @@
{
root_test_t *rt = _rt;
+ su_init();
+
pthread_mutex_lock(rt->rt_sr.mutex);
rt->rt_root = su_root_create(rt);
rt->rt_sr.done = 1;
@@ -177,6 +179,9 @@
su_root_destroy(rt->rt_root);
rt->rt_root = NULL;
pthread_mutex_unlock(rt->rt_sr.deinit);
+
+ su_deinit();
+
return NULL;
}
#endif
@@ -192,8 +197,6 @@
BEGIN();
- su_init();
-
su_port_prefer(create, start);
#if SU_HAVE_PTHREADS
@@ -257,8 +260,6 @@
TEST_VOID(su_root_destroy(rt->rt_root)); rt->rt_root = NULL;
#endif
- su_deinit();
-
END();
}
@@ -724,6 +725,8 @@
i = 0;
+ su_init();
+
do {
rt = rt1, *rt = *rt0;
@@ -739,5 +742,7 @@
retval |= deinit_test(rt);
} while (prefer[++i].create);
+ su_deinit();
+
return retval;
}
Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/test_tport.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/test_tport.c (original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/test_tport.c Mon Nov 12 11:04:47 2007
@@ -824,7 +824,7 @@
BEGIN();
msg_t *msg = NULL;
- int i;
+ int i, N;
tport_t *tp, *tp0;
char ident[16];
su_time_t started;
@@ -853,12 +853,15 @@
pending_server_close = tport_pend(tp, NULL, server_closed_callback, NULL);
TEST_1(pending_server_close > 0);
+ N = 0; tt->tt_received = 0;
+
#ifndef WIN32 /* Windows seems to be buffering too much */
/* Create a large message, just to force queueing in sending end */
TEST(new_test_msg(tt, &msg, "tcp-0", 1, 16 * 64 * 1024), 0);
test_create_md5(tt, msg);
TEST_1(tp = tport_tsend(tt->tt_tports, msg, tt->tt_tcp_name, TAG_END()));
+ N++;
TEST_S(tport_name(tp)->tpn_ident, "client");
TEST_P(tport_incref(tp), tp0); tport_decref(&tp);
msg_destroy(msg);
@@ -869,6 +872,7 @@
TEST(new_test_msg(tt, &msg, ident, 1, 64 * 1024), 0);
TEST_1(tp = tport_tsend(tt->tt_tports, msg, tt->tt_tcp_name, TAG_END()));
+ N++;
TEST_S(tport_name(tp)->tpn_ident, "client");
TEST_P(tport_incref(tp), tp0); tport_decref(&tp);
msg_destroy(msg);
@@ -879,8 +883,6 @@
TEST_1(!tport_tsend(tt->tt_tports, msg, tt->tt_tcp_name, TAG_END()));
msg_destroy(msg);
- tt->tt_received = 0;
-
TEST(tport_test_run(tt, 60), 1);
TEST_1(!check_msg(tt, tt->tt_rmsg, "tcp-0"));
test_check_md5(tt, tt->tt_rmsg);
@@ -892,13 +894,15 @@
TEST_1(!check_msg(tt, tt->tt_rmsg, ident));
msg_destroy(tt->tt_rmsg), tt->tt_rmsg = NULL;
}
-
+#else
+ (void)i; (void)ident;
#endif
/* This uses a new connection */
TEST_1(!new_test_msg(tt, &msg, "tcp-no-reuse", 1, 1024));
TEST_1(tp = tport_tsend(tt->tt_tports, msg, tt->tt_tcp_name,
TPTAG_REUSE(0), TAG_END()));
+ N++;
TEST_S(tport_name(tp)->tpn_ident, "client");
TEST_1(tport_incref(tp) != tp0); tport_decref(&tp);
msg_destroy(msg);
@@ -907,12 +911,13 @@
TEST_1(!new_test_msg(tt, &msg, "tcp-reuse", 1, 1024));
TEST_1(tp = tport_tsend(tt->tt_tports, msg, tt->tt_tcp_name,
TPTAG_REUSE(1), TAG_END()));
+ N++;
TEST_S(tport_name(tp)->tpn_ident, "client");
TEST_1(tport_incref(tp) == tp0); tport_decref(&tp);
msg_destroy(msg);
/* Receive every message from queue */
- while (tt->tt_received < TPORT_QUEUESIZE + 2) {
+ while (tt->tt_received < N) {
TEST(tport_test_run(tt, 5), 1);
/* Validate message */
TEST_1(!check_msg(tt, tt->tt_rmsg, NULL));
@@ -1005,7 +1010,7 @@
s = su_socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
TEST_1(s != SOCKET_ERROR);
- connected = connect(s, ai->ai_addr, ai->ai_addrlen);
+ connected = connect(s, ai->ai_addr, (socklen_t)ai->ai_addrlen);
su_root_step(tt->tt_root, 50);
Added: freeswitch/trunk/libs/sofia-sip/open_c/Makefile.am
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/sofia-sip/open_c/Makefile.am Mon Nov 12 11:04:47 2007
@@ -0,0 +1,46 @@
+#
+# Makefile.am for sofia-sip/open_c
+#
+# This is used for including Open C files in dist
+#
+# Copyright (C) 2007 Nokia Corporation
+# Contact: Pekka Pessi <pekka.pessi(a)nokia.com>
+# Licensed under LGPL. See file COPYING.
+#
+# ref: http://www.gnu.org/software/automake/manual/automake.html
+
+EXTRA_DIST = autogen.cmd build_sources.cmd version.awk version_files.cmd
+
+EXTRA_DIST += config.h.in config.h sofia-sip/su_configure.h
+
+EXTRA_DIST += group/bld.inf
+EXTRA_DIST += group/libsofia-sip-ua-glib.mmp
+EXTRA_DIST += group/libsofia-sip-ua.mmp
+EXTRA_DIST += group/su_source_test.mmp
+EXTRA_DIST += group/su_source_test_reg.rss
+EXTRA_DIST += group/test_http.mmp
+EXTRA_DIST += group/test_http_reg.rss
+EXTRA_DIST += group/test_msg.mmp
+EXTRA_DIST += group/test_msg_reg.rss
+EXTRA_DIST += group/test_nua.mmp
+EXTRA_DIST += group/test_nua_reg.rss
+EXTRA_DIST += group/test_tport.mmp
+EXTRA_DIST += group/test_tport_reg.rss
+EXTRA_DIST += group/torture_sip.mmp
+EXTRA_DIST += group/torture_sip_reg.rss
+EXTRA_DIST += group/torture_su_alloc.mmp
+EXTRA_DIST += group/torture_su_alloc_reg.rss
+EXTRA_DIST += group/torture_su_port.mmp
+EXTRA_DIST += group/torture_su_port_reg.rss
+EXTRA_DIST += group/torture_su_root.mmp
+EXTRA_DIST += group/torture_su_root_reg.rss
+EXTRA_DIST += group/torture_su_tag.mmp
+EXTRA_DIST += group/torture_su_tag_reg.rss
+EXTRA_DIST += group/torture_url.mmp
+EXTRA_DIST += group/torture_url_reg.rss
+
+EXTRA_DIST += sis/libsofia-sip-ua-glib.pkg
+EXTRA_DIST += sis/libsofia-sip-ua.pkg
+EXTRA_DIST += sis/su_source_test.pkg
+EXTRA_DIST += sis/test_nua.pkg
+EXTRA_DIST += sis/test_tport.pkg
Modified: freeswitch/trunk/libs/sofia-sip/open_c/build_sources.cmd
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/open_c/build_sources.cmd (original)
+++ freeswitch/trunk/libs/sofia-sip/open_c/build_sources.cmd Mon Nov 12 11:04:47 2007
@@ -44,6 +44,8 @@
PT=%PT% %IN% < NUL
%CHECK%
+@set AWK_SIP_AWK=%MSG_AWK% module=sip
+
@set IN=../libsofia-sip-ua/sip/sofia-sip/sip.h
@set PR=../libsofia-sip-ua/sip/sip_tag.c
@set PR2=../libsofia-sip-ua/sip/sofia-sip/sip_hclasses.h
@@ -53,20 +55,25 @@
@set SIPEXTRA=../libsofia-sip-ua/sip/sip_extra_headers.txt
@set PT=../libsofia-sip-ua/sip/sip_parser_table.c
-%MSG_AWK% module=sip PR=%PR% %IN% < NUL
+%AWK_SIP_AWK% PR=%PR% %IN% %SIPEXTRA% < NUL
%CHECK%
-%MSG_AWK% module=sip PR=%PR2% %IN% < NUL
+%AWK_SIP_AWK% PR=%PR2% %IN% < NUL
%CHECK%
-%MSG_AWK% module=sip PR=%PR3% %IN% < NUL
+%AWK_SIP_AWK% PR=%PR3% %IN% < NUL
%CHECK%
-%MSG_AWK% module=sip PR=%PR4% %IN% < NUL
+%AWK_SIP_AWK% PR=%PR4% %IN% < NUL
%CHECK%
-%MSG_AWK% module=sip PR=%PR5% TEMPLATE1=%PR2%.in TEMPLATE2=%PR3%.in TEMPLATE=%PR5%.in NO_FIRST=1 NO_LAST=1 < NUL %SIPEXTRA%
+%AWK_SIP_AWK% PR=%PR5% NO_FIRST=1 NO_LAST=1 ^
+ TEMPLATE1=%PR2%.in ^
+ TEMPLATE2=%PR3%.in ^
+ TEMPLATE3=%PR4%.in ^
+ TEMPLATE=%PR5%.in %SIPEXTRA% < NUL
%CHECK%
-%MSG_AWK% module=sip MC_HASH_SIZE=127 MC_SHORT_SIZE=26 ^
+%AWK_SIP_AWK% PT=%PT% TEMPLATE=%PT%.in ^
FLAGFILE=../libsofia-sip-ua/sip/sip_bad_mask ^
- PT=%PT% %IN% < NUL
+ MC_HASH_SIZE=127 MC_SHORT_SIZE=26 ^
+ %IN% %SIPEXTRA% < NUL
%CHECK%
@set IN=../libsofia-sip-ua/http/sofia-sip/http.h
@@ -110,8 +117,6 @@
%CHECK%
%TAG_AWK% NO_DLL=1 %P%/tport/tport_tag.c < NUL
%CHECK%
-%TAG_AWK% NO_DLL=1 %P%/su/su_tag.c < NUL
-%CHECK%
%TAG_AWK% NO_DLL=1 %P%/url/url_tag.c < NUL
%CHECK%
Modified: freeswitch/trunk/libs/sofia-sip/open_c/config.h.in
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/open_c/config.h.in (original)
+++ freeswitch/trunk/libs/sofia-sip/open_c/config.h.in Mon Nov 12 11:04:47 2007
@@ -1,10 +1,4 @@
-/* config.h. Generated by configure. */
-/* config.h.in. Generated from configure.ac by autoheader. */
-
-/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
- systems. This function is required for `alloca.c' support on those systems.
- */
-/* #undef CRAY_STACKSEG_END */
+/* config.h.in. Template for Open C */
/* Define to 1 if using `alloca.c'. */
/* #undef C_ALLOCA */
@@ -441,4 +435,4 @@
/* #undef size_t */
/* Define to 1 if compiling on Open C environment */
-#define HAVE_OPEN_C 1
\ No newline at end of file
+#define HAVE_OPEN_C 1
Modified: freeswitch/trunk/libs/sofia-sip/win32/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/win32/Makefile.am (original)
+++ freeswitch/trunk/libs/sofia-sip/win32/Makefile.am Mon Nov 12 11:04:47 2007
@@ -37,6 +37,7 @@
tests/torture_su_port/torture_su_port.dsp \
utils/localinfo/localinfo.dsp \
utils/sip_options/sip_options.dsp \
+ utils/sip_options_static/sip_options_static.dsp \
utils/sip_dig/sip_dig.dsp \
utils/stunc/stunc.dsp \
$(PTHREAD_DIST) \
Modified: freeswitch/trunk/libs/sofia-sip/win32/build_sources.cmd
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/win32/build_sources.cmd (original)
+++ freeswitch/trunk/libs/sofia-sip/win32/build_sources.cmd Mon Nov 12 11:04:47 2007
@@ -44,6 +44,8 @@
PT=%PT% %IN% < NUL
%CHECK%
+@set AWK_SIP_AWK=%MSG_AWK% module=sip
+
@set IN=../libsofia-sip-ua/sip/sofia-sip/sip.h
@set PR=../libsofia-sip-ua/sip/sip_tag.c
@set PR2=../libsofia-sip-ua/sip/sofia-sip/sip_hclasses.h
@@ -53,20 +55,25 @@
@set SIPEXTRA=../libsofia-sip-ua/sip/sip_extra_headers.txt
@set PT=../libsofia-sip-ua/sip/sip_parser_table.c
-%MSG_AWK% module=sip PR=%PR% %IN% < NUL
+%AWK_SIP_AWK% PR=%PR% %IN% %SIPEXTRA% < NUL
%CHECK%
-%MSG_AWK% module=sip PR=%PR2% %IN% < NUL
+%AWK_SIP_AWK% PR=%PR2% %IN% < NUL
%CHECK%
-%MSG_AWK% module=sip PR=%PR3% %IN% < NUL
+%AWK_SIP_AWK% PR=%PR3% %IN% < NUL
%CHECK%
-%MSG_AWK% module=sip PR=%PR4% %IN% < NUL
+%AWK_SIP_AWK% PR=%PR4% %IN% < NUL
%CHECK%
-%MSG_AWK% module=sip PR=%PR5% TEMPLATE1=%PR2%.in TEMPLATE2=%PR3%.in TEMPLATE3=%PR4%.in TEMPLATE=%PR5%.in NO_FIRST=1 NO_LAST=1 < NUL %SIPEXTRA%
+%AWK_SIP_AWK% PR=%PR5% NO_FIRST=1 NO_LAST=1 ^
+ TEMPLATE1=%PR2%.in ^
+ TEMPLATE2=%PR3%.in ^
+ TEMPLATE3=%PR4%.in ^
+ TEMPLATE=%PR5%.in %SIPEXTRA% < NUL
%CHECK%
-%MSG_AWK% module=sip TEMPLATE=%PT%.in MC_HASH_SIZE=127 MC_SHORT_SIZE=26 ^
+%AWK_SIP_AWK% PT=%PT% TEMPLATE=%PT%.in ^
FLAGFILE=../libsofia-sip-ua/sip/sip_bad_mask ^
- PT=%PT% %IN% %SIPEXTRA% < NUL
+ MC_HASH_SIZE=127 MC_SHORT_SIZE=26 ^
+ %IN% %SIPEXTRA% < NUL
%CHECK%
@set IN=../libsofia-sip-ua/http/sofia-sip/http.h
Modified: freeswitch/trunk/libs/sofia-sip/win32/check.cmd
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/win32/check.cmd (original)
+++ freeswitch/trunk/libs/sofia-sip/win32/check.cmd Mon Nov 12 11:04:47 2007
@@ -21,47 +21,51 @@
:: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
:: 02110-1301 USA
::
-tests\torture_su_alloc\Debug\torture_su_alloc.exe
+
+set config=\Debug\
+:: set config=\Release\
+
+tests\torture_su_alloc%config%torture_su_alloc.exe -a
@if errorlevel 1 ( echo torture_su_alloc: FAIL ) else echo torture_su_alloc: PASS
-tests\torture_su_root\Debug\torture_su_root.exe
+tests\torture_su_root%config%torture_su_root.exe -a
@if errorlevel 1 ( echo torture_su_root: FAIL ) else echo torture_su_root: PASS
-tests\torture_su_tag\Debug\torture_su_tag.exe
+tests\torture_su_tag%config%torture_su_tag.exe -a
@if errorlevel 1 ( echo torture_su_tag: FAIL ) else echo torture_su_tag: PASS
-tests\test_su\Debug\test_su.exe
+tests\test_su%config%test_su.exe
@if errorlevel 1 ( echo test_su: FAIL ) else echo test_su: PASS
-tests\torture_su_time\Debug\torture_su_time.exe
+tests\torture_su_time%config%torture_su_time.exe -a
@if errorlevel 1 ( echo torture_su_time: FAIL ) else echo torture_su_time: PASS
-tests\torture_su_timer\Debug\torture_su_timer.exe
+tests\torture_su_timer%config%torture_su_timer.exe
@if errorlevel 1 ( echo torture_su_timer: FAIL ) else echo torture_su_timer: PASS
-tests\torture_su\Debug\torture_su.exe
+tests\torture_su%config%torture_su.exe -a
@if errorlevel 1 ( echo torture_su: FAIL ) else echo torture_su: PASS
-tests\test_memmem\Debug\test_memmem.exe
+tests\test_memmem%config%test_memmem.exe -a
@if errorlevel 1 ( echo test_memmem: FAIL ) else echo test_memmem: PASS
-tests\test_tport\Debug\test_tport.exe
+tests\test_tport%config%test_tport.exe -a
@if errorlevel 1 ( echo test_tport: FAIL ) else echo test_tport: PASS
-tests\test_nta\Debug\test_nta.exe
+tests\test_nta%config%test_nta.exe -a
@if errorlevel 1 ( echo test_nta: FAIL ) else echo test_nta: PASS
-tests\test_nua\Debug\test_nua.exe
+tests\test_nua%config%test_nua.exe -a
@if errorlevel 1 ( echo test_nua: FAIL ) else echo test_nua: PASS
-tests\test_htable\Debug\test_htable.exe
+tests\test_htable%config%test_htable.exe -a
@if errorlevel 1 ( echo test_htable: FAIL ) else echo test_htable: PASS
-tests\torture_rbtree\Debug\torture_rbtree.exe
+tests\torture_rbtree%config%torture_rbtree.exe -a
@if errorlevel 1 ( echo torture_rbtree: FAIL ) else echo torture_rbtree: PASS
-tests\torture_su_bm\Debug\torture_su_bm.exe
+tests\torture_su_bm%config%torture_su_bm.exe -a
@if errorlevel 1 ( echo torture_su_bm: FAIL ) else echo torture_su_bm: PASS
-:: tests\torture_su_port\Debug\torture_su_port.exe
+:: tests\torture_su_port%config%torture_su_port.exe -a
:: @if errorlevel 1 ( echo torture_su_port: FAIL ) else echo torture_su_port: PASS
Modified: freeswitch/trunk/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.dsp
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.dsp (original)
+++ freeswitch/trunk/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.dsp Mon Nov 12 11:04:47 2007
@@ -109,6 +109,10 @@
# End Source File
# Begin Source File
+SOURCE="..\..\libsofia-sip-ua\su\smoothsort.c"
+# End Source File
+# Begin Source File
+
SOURCE="..\..\libsofia-sip-ua\su\string0.c"
# End Source File
# Begin Source File
@@ -837,10 +841,6 @@
# End Source File
# Begin Source File
-SOURCE="..\..\libsofia-sip-ua\soa\sofia-sip\soa_session.h"
-# End Source File
-# Begin Source File
-
SOURCE="..\..\libsofia-sip-ua\soa\soa_static.c"
# End Source File
# Begin Source File
@@ -861,6 +861,10 @@
# PROP Default_Filter "su*.h"
# Begin Source File
+SOURCE="..\..\libsofia-sip-ua\su\sofia-sip\heap.h"
+# End Source File
+# Begin Source File
+
SOURCE="..\..\libsofia-sip-ua\su\sofia-sip\htable.h"
# End Source File
# Begin Source File
@@ -1389,6 +1393,10 @@
# End Source File
# Begin Source File
+SOURCE="..\..\libsofia-sip-ua\soa\sofia-sip\soa_session.h"
+# End Source File
+# Begin Source File
+
SOURCE="..\..\libsofia-sip-ua\soa\sofia-sip\soa_tag.h"
# End Source File
# End Group
Modified: freeswitch/trunk/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.vcproj
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.vcproj (original)
+++ freeswitch/trunk/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.vcproj Mon Nov 12 11:04:47 2007
@@ -272,6 +272,10 @@
</FileConfiguration>
</File>
<File
+ RelativePath="..\..\libsofia-sip-ua\su\smoothsort.c"
+ >
+ </File>
+ <File
RelativePath="..\..\libsofia-sip-ua\su\string0.c"
>
</File>
@@ -3758,10 +3762,6 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\libsofia-sip-ua\soa\sofia-sip\soa_session.h"
- >
- </File>
- <File
RelativePath="..\..\libsofia-sip-ua\soa\soa_static.c"
>
<FileConfiguration
@@ -3838,6 +3838,10 @@
Filter="su*.h"
>
<File
+ RelativePath="..\..\libsofia-sip-ua\su\sofia-sip\heap.h"
+ >
+ </File>
+ <File
RelativePath="..\..\libsofia-sip-ua\su\sofia-sip\htable.h"
>
</File>
@@ -4373,6 +4377,10 @@
>
</File>
<File
+ RelativePath="..\..\libsofia-sip-ua\soa\sofia-sip\soa_session.h"
+ >
+ </File>
+ <File
RelativePath="..\..\libsofia-sip-ua\soa\sofia-sip\soa_tag.h"
>
</File>
Modified: freeswitch/trunk/libs/sofia-sip/win32/tests/torture_su_root/torture_su_root.dsp
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/win32/tests/torture_su_root/torture_su_root.dsp (original)
+++ freeswitch/trunk/libs/sofia-sip/win32/tests/torture_su_root/torture_su_root.dsp Mon Nov 12 11:04:47 2007
@@ -42,7 +42,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /WX /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /WX /GX /O2 /I "..\.." /I "..\..\..\libsofia-sip-ua\su" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
+# ADD CPP /nologo /MD /W3 /WX /GX /O2 /I "..\.." /I "..\..\..\libsofia-sip-ua\su" /I "..\..\pthread" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
# ADD BASE RSC /l 0x40b /d "NDEBUG"
# ADD RSC /l 0x40b /d "NDEBUG"
BSC32=bscmake.exe
@@ -66,7 +66,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /WX /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /WX /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\libsofia-sip-ua\su" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /WX /Gm /GX /ZI /Od /I "..\.." /I "..\..\..\libsofia-sip-ua\su" /I "..\..\pthread" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x40b /d "_DEBUG"
# ADD RSC /l 0x40b /d "_DEBUG"
Modified: freeswitch/trunk/libs/sofia-sip/win32/tests/torture_su_root/torture_su_root.vcproj
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/win32/tests/torture_su_root/torture_su_root.vcproj (original)
+++ freeswitch/trunk/libs/sofia-sip/win32/tests/torture_su_root/torture_su_root.vcproj Mon Nov 12 11:04:47 2007
@@ -44,7 +44,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="..\..,..\..\..\libsofia-sip-ua\su"
+ AdditionalIncludeDirectories="..\..,..\..\..\libsofia-sip-ua\su,..\..\pthread"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -140,7 +140,7 @@
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..\..,..\..\..\libsofia-sip-ua\su"
+ AdditionalIncludeDirectories="..\..,..\..\..\libsofia-sip-ua\su,..\..\pthread"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="true"
RuntimeLibrary="2"
Modified: freeswitch/trunk/libs/sofia-sip/win32/utils/stunc/stunc.dsp
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/win32/utils/stunc/stunc.dsp (original)
+++ freeswitch/trunk/libs/sofia-sip/win32/utils/stunc/stunc.dsp Mon Nov 12 11:04:47 2007
@@ -43,7 +43,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /WX /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_CONFIG_H" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /WX /GX /O2 /I ".." /I "..\.." /I "..\..\..\libsofia-sip-ua\su" /I "..\..\..\libsofia-sip-ua\features" /I "..\..\..\libsofia-sip-ua\tport" /I "..\..\..\libsofia-sip-ua\iptsec" /I "..\..\..\libsofia-sip-ua\ipt" /I "..\..\..\libsofia-sip-ua\url" /I "..\..\..\libsofia-sip-ua\nta" /I "..\..\..\libsofia-sip-ua\msg" /I "..\..\..\libsofia-sip-ua\sip" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /WX /GX /O2 /I ".." /I "..\.." /I "..\..\..\libsofia-sip-ua\su" /I "..\..\..\libsofia-sip-ua\features" /I "..\..\..\libsofia-sip-ua\tport" /I "..\..\..\libsofia-sip-ua\iptsec" /I "..\..\..\libsofia-sip-ua\ipt" /I "..\..\..\libsofia-sip-ua\url" /I "..\..\..\libsofia-sip-ua\nta" /I "..\..\..\libsofia-sip-ua\stun" /I "..\..\..\libsofia-sip-ua\msg" /I "..\..\..\libsofia-sip-ua\sip" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -70,7 +70,7 @@
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /WX /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "HAVE_CONFIG_H" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /WX /Gm /GX /ZI /Od /I ".." /I "..\.." /I "..\..\..\libsofia-sip-ua\su" /I "..\..\..\libsofia-sip-ua\features" /I "..\..\..\libsofia-sip-ua\tport" /I "..\..\..\libsofia-sip-ua\iptsec" /I "..\..\..\libsofia-sip-ua\ipt" /I "..\..\..\libsofia-sip-ua\url" /I "..\..\..\libsofia-sip-ua\nta" /I "..\..\..\libsofia-sip-ua\msg" /I "..\..\..\libsofia-sip-ua\sip" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /WX /Gm /GX /ZI /Od /I ".." /I "..\.." /I "..\..\..\libsofia-sip-ua\su" /I "..\..\..\libsofia-sip-ua\features" /I "..\..\..\libsofia-sip-ua\tport" /I "..\..\..\libsofia-sip-ua\iptsec" /I "..\..\..\libsofia-sip-ua\ipt" /I "..\..\..\libsofia-sip-ua\url" /I "..\..\..\libsofia-sip-ua\nta" /I "..\..\..\libsofia-sip-ua\stun" /I "..\..\..\libsofia-sip-ua\msg" /I "..\..\..\libsofia-sip-ua\sip" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
Modified: freeswitch/trunk/libs/sofia-sip/win32/utils/stunc/stunc.vcproj
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/win32/utils/stunc/stunc.vcproj (original)
+++ freeswitch/trunk/libs/sofia-sip/win32/utils/stunc/stunc.vcproj Mon Nov 12 11:04:47 2007
@@ -147,7 +147,7 @@
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="..,..\..,..\..\..\libsofia-sip-ua\su,..\..\..\libsofia-sip-ua\features,..\..\..\libsofia-sip-ua\tport,..\..\..\libsofia-sip-ua\iptsec,..\..\..\libsofia-sip-ua\ipt,..\..\..\libsofia-sip-ua\url,..\..\..\libsofia-sip-ua\nta,..\..\..\libsofia-sip-ua\msg,..\..\..\libsofia-sip-ua\sip"
+ AdditionalIncludeDirectories="..;..\..;"..\..\..\libsofia-sip-ua\su";"..\..\..\libsofia-sip-ua\features";"..\..\..\libsofia-sip-ua\tport";"..\..\..\libsofia-sip-ua\iptsec";"..\..\..\libsofia-sip-ua\ipt";"..\..\..\libsofia-sip-ua\url";"..\..\..\libsofia-sip-ua\nta";"..\..\..\libsofia-sip-ua\msg";"..\..\..\libsofia-sip-ua\sip";"..\..\..\libsofia-sip-ua\stun""
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS"
StringPooling="true"
RuntimeLibrary="2"
1
0
[commit] r6218 - in freeswitch/trunk/src: . include mod/applications/mod_limit
by Freeswitch SVN 10 Nov '07
by Freeswitch SVN 10 Nov '07
10 Nov '07
Author: mikej
Date: Sat Nov 10 07:25:54 2007
New Revision: 6218
Modified:
freeswitch/trunk/src/include/switch_regex.h
freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_regex.c
Log:
fix windows build.
Modified: freeswitch/trunk/src/include/switch_regex.h
==============================================================================
--- freeswitch/trunk/src/include/switch_regex.h (original)
+++ freeswitch/trunk/src/include/switch_regex.h Sat Nov 10 07:25:54 2007
@@ -51,7 +51,7 @@
SWITCH_DECLARE(int) switch_regex_perform(const char *field, const char *expression, switch_regex_t **new_re, int *ovector, uint32_t olen);
SWITCH_DECLARE(void) switch_perform_substitution(switch_regex_t *re, int match_count, const char *data, const char *field_data,
- char *substituted, uint32_t len, int *ovector);
+ char *substituted, switch_size_t len, int *ovector);
/*!
\brief Function to evaluate an expression against a string
Modified: freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c Sat Nov 10 07:25:54 2007
@@ -471,10 +471,10 @@
goto done;
} else if (!strcasecmp(argv[0], "call")) {
char buf[4096] = "";
+ char *how = ",";
callback_t cbt = { 0 };
cbt.buf = buf;
cbt.len = sizeof(buf);
- char *how = ",";
if (argc > 2) {
if (!strcasecmp(argv[2], "order")) {
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Sat Nov 10 07:25:54 2007
@@ -1421,11 +1421,11 @@
if (offset >= 0) {
sub_val += offset;
- } else if (abs(offset) <= strlen(sub_val)) {
+ } else if ((size_t)abs(offset) <= strlen(sub_val)) {
sub_val = cloned_sub_val + (strlen(cloned_sub_val) + offset);
}
- if (ooffset > 0 && ooffset < strlen(sub_val)) {
+ if (ooffset > 0 && (size_t)ooffset < strlen(sub_val)) {
if ((p = (char *)sub_val + ooffset)) {
*p = '\0';
}
Modified: freeswitch/trunk/src/switch_regex.c
==============================================================================
--- freeswitch/trunk/src/switch_regex.c (original)
+++ freeswitch/trunk/src/switch_regex.c Sat Nov 10 07:25:54 2007
@@ -98,11 +98,12 @@
SWITCH_DECLARE(void) switch_perform_substitution(switch_regex_t *re, int match_count, const char *data, const char *field_data,
- char *substituted, uint32_t len, int *ovector)
+ char *substituted, switch_size_t len, int *ovector)
{
char index[10] = "";
char replace[1024] = "";
- uint32_t x, y = 0, z = 0, num = 0;
+ switch_size_t x, y = 0, z = 0;
+ int num = 0;
for (x = 0; x < (len - 1) && x < strlen(data);) {
if (data[x] == '$') {
@@ -122,7 +123,7 @@
num = atoi(index);
if (pcre_copy_substring(field_data, ovector, match_count, num, replace, sizeof(replace)) > 0) {
- unsigned int r;
+ switch_size_t r;
for (r = 0; r < strlen(replace); r++) {
substituted[y++] = replace[r];
}
1
0
10 Nov '07
Author: anthm
Date: Fri Nov 9 20:48:42 2007
New Revision: 6217
Modified:
freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
Log:
add some more stuff
Modified: freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c Fri Nov 9 20:48:42 2007
@@ -68,6 +68,14 @@
");\n";
+static char group_sql[] =
+ "CREATE TABLE group_data (\n"
+ " hostname VARCHAR(255),\n"
+ " groupname VARCHAR(255),\n"
+ " url VARCHAR(255)\n"
+ ");\n";
+
+
static switch_status_t limit_execute_sql(char *sql, switch_mutex_t *mutex)
{
@@ -240,11 +248,17 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
}
}
+ if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from group_data", NULL) != SWITCH_STATUS_SUCCESS) {
+ if (switch_odbc_handle_exec(globals.master_odbc, group_sql, NULL) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
+ }
+ }
} else {
#endif
if ((db = switch_core_db_open_file(globals.dbname))) {
switch_core_db_test_reactive(db, "select * from limit_data", NULL, limit_sql);
switch_core_db_test_reactive(db, "select * from db_data", NULL, db_sql);
+ switch_core_db_test_reactive(db, "select * from group_data", NULL, group_sql);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database!\n");
status = SWITCH_STATUS_FALSE;
@@ -308,6 +322,15 @@
}
+static int group_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+ callback_t *cbt = (callback_t *) pArg;
+ snprintf(cbt->buf + strlen(cbt->buf), cbt->len - strlen(cbt->buf), "%s%c", argv[0], *argv[1]);
+ cbt->matches++;
+ return 0;
+}
+
+
SWITCH_STANDARD_API(db_api_function)
{
int argc = 0;
@@ -398,6 +421,125 @@
switch_safe_free(sql);
}
+
+
+SWITCH_STANDARD_API(group_api_function)
+{
+ int argc = 0;
+ char *argv[4] = { 0 };
+ char *mydata = NULL;
+ char *sql;
+
+ switch_mutex_lock(globals.mutex);
+
+ if (!switch_strlen_zero(cmd)) {
+ mydata = strdup(cmd);
+ argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])));
+ }
+
+ if (argc < 2) {
+ goto error;
+ }
+
+ if (!strcasecmp(argv[0], "add")) {
+ if (argc < 3) {
+ goto error;
+ }
+ sql = switch_mprintf("delete from group_data where groupname='%q' and url='%q';", argv[1], argv[2]);
+ assert(sql);
+ limit_execute_sql(sql, NULL);
+ switch_safe_free(sql);
+ sql = switch_mprintf("insert into group_data values('%q','%q','%q');", globals.hostname, argv[1], argv[2]);
+ assert(sql);
+ limit_execute_sql(sql, NULL);
+ switch_safe_free(sql);
+ stream->write_function(stream, "+OK");
+ goto done;
+ } else if (!strcasecmp(argv[0], "del")) {
+ if (argc < 3) {
+ goto error;
+ }
+ if (!strcmp(argv[2], "*")) {
+ sql = switch_mprintf("delete from group_data where groupname='%q';", argv[1]);
+ } else {
+ sql = switch_mprintf("delete from group_data where groupname='%q' and url='%q';", argv[1], argv[2]);
+ }
+ assert(sql);
+ limit_execute_sql(sql, NULL);
+ switch_safe_free(sql);
+ stream->write_function(stream, "+OK");
+ goto done;
+ } else if (!strcasecmp(argv[0], "call")) {
+ char buf[4096] = "";
+ callback_t cbt = { 0 };
+ cbt.buf = buf;
+ cbt.len = sizeof(buf);
+ char *how = ",";
+
+ if (argc > 2) {
+ if (!strcasecmp(argv[2], "order")) {
+ how = "|";
+ }
+ }
+
+ sql = switch_mprintf("select url,'%q' from group_data where groupname='%q'", how, argv[1]);
+ assert(sql);
+
+ limit_execute_sql_callback(NULL, sql, group_callback, &cbt);
+ *(buf + (strlen(buf) - 1)) = '\0';
+ stream->write_function(stream, "%s", buf);
+ goto done;
+ }
+
+ error:
+ stream->write_function(stream, "!err!");
+
+ done:
+
+ switch_mutex_unlock(globals.mutex);
+ switch_safe_free(mydata);
+ return SWITCH_STATUS_SUCCESS;
+
+}
+
+#define GROUP_USAGE "[add|del]:<group name>:<val>"
+#define GROUP_DESC "save data"
+
+SWITCH_STANDARD_APP(group_function)
+{
+ switch_channel_t *channel;
+ int argc = 0;
+ char *argv[3] = { 0 };
+ char *mydata = NULL;
+ char *sql;
+
+ channel = switch_core_session_get_channel(session);
+ assert(channel != NULL);
+
+ if (!switch_strlen_zero(data)) {
+ mydata = switch_core_session_strdup(session, data);
+ argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])));
+ }
+
+ if (argc < 3) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "USAGE: group %s\n", DB_USAGE);
+ return;
+ }
+
+ if (!strcasecmp(argv[0], "add")) {
+ sql = switch_mprintf("insert into group_data values('%q','%q','%q');", globals.hostname, argv[1], argv[2]);
+ assert(sql);
+ limit_execute_sql(sql, globals.mutex);
+ switch_safe_free(sql);
+ } else if (!strcasecmp(argv[0], "del")) {
+ sql = switch_mprintf("delete from group_data where groupname='%q' and url='%q';", argv[1], argv[2]);
+ assert(sql);
+ limit_execute_sql(sql, globals.mutex);
+ switch_safe_free(sql);
+ }
+
+}
+
#define LIMIT_USAGE "<realm> <id> <max>"
#define LIMIT_DESC "limit access to an extension"
@@ -489,8 +631,10 @@
SWITCH_ADD_APP(app_interface, "limit", "Limit", LIMIT_DESC, limit_function, LIMIT_USAGE, SAF_NONE);
SWITCH_ADD_APP(app_interface, "db_insert", "Insert to the db", DB_DESC, db_function, DB_USAGE, SAF_NONE);
+ SWITCH_ADD_APP(app_interface, "group", "Manage a group", GROUP_DESC, group_function, GROUP_USAGE, SAF_NONE);
SWITCH_ADD_API(commands_api_interface, "db", "db get/set", db_api_function, "[get|set]/<realm>/<key>/<value>");
+ SWITCH_ADD_API(commands_api_interface, "group", "group [add|del|call]", group_api_function, "[add|del|call] <group name> <url>");
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
1
0
Author: brian
Date: Fri Nov 9 19:51:14 2007
New Revision: 6216
Modified:
freeswitch/trunk/conf/freeswitch.xml
freeswitch/trunk/conf/sofia.conf.xml
Log:
lets be specific now
Modified: freeswitch/trunk/conf/freeswitch.xml
==============================================================================
--- freeswitch/trunk/conf/freeswitch.xml (original)
+++ freeswitch/trunk/conf/freeswitch.xml Fri Nov 9 19:51:14 2007
@@ -92,13 +92,13 @@
</section>
<section name="dialplan" description="Regex/XML Dialplan">
- <!--#include "dialplan/*"-->
+ <!--#include "dialplan/*.xml"-->
</section>
<!-- mod_dingaling is reliant on the vcard data in the "directory" section. -->
<!-- mod_sofia is reliant on the user data for authorization -->
<section name="directory" description="User Directory">
- <!--#include "directory/*"-->
+ <!--#include "directory/*.xml"-->
</section>
<!-- phrases section (under development still) -->
Modified: freeswitch/trunk/conf/sofia.conf.xml
==============================================================================
--- freeswitch/trunk/conf/sofia.conf.xml (original)
+++ freeswitch/trunk/conf/sofia.conf.xml Fri Nov 9 19:51:14 2007
@@ -1,5 +1,5 @@
<configuration name="sofia.conf" description="sofia Endpoint">
<profiles>
- <!--#include "sip_profiles/*" -->
+ <!--#include "sip_profiles/*.xml" -->
</profiles>
</configuration>
1
0