From 292f4e54289da9e7b3b7f541a32cc2fb8b8f4bc1 Mon Sep 17 00:00:00 2001 From: bossiel Date: Wed, 17 Mar 2010 17:50:58 +0000 Subject: [PATCH] Update ICT. --- trunk/tinySDP/include/tsdp.h | 10 + trunk/tinySDP/src/tsdp.c | 50 +++- trunk/tinySDP/test/test.c | 1 + trunk/tinySDP/test/test_parser.h | 21 +- .../tinysip/dialogs/tsip_dialog_invite.h | 56 +++++ .../tinySIP/src/dialogs/tsip_dialog_invite.c | 31 +++ .../src/dialogs/tsip_dialog_publish.client.c | 2 +- .../src/transactions/tsip_transac_ict.c | 194 +++++++++------ .../src/transactions/tsip_transac_nict.c | 12 +- trunk/vs_2005/tinyMSRP/test.vcproj | 224 ++++++++++++++++++ trunk/vs_2005/tinySIP/tinySIP.vcproj | 4 + 11 files changed, 523 insertions(+), 82 deletions(-) create mode 100644 trunk/tinySIP/src/dialogs/tsip_dialog_invite.c create mode 100644 trunk/vs_2005/tinyMSRP/test.vcproj diff --git a/trunk/tinySDP/include/tsdp.h b/trunk/tinySDP/include/tsdp.h index 193668e6..eeb36c47 100644 --- a/trunk/tinySDP/include/tsdp.h +++ b/trunk/tinySDP/include/tsdp.h @@ -31,8 +31,18 @@ #include "tinysdp_config.h" +#include "tinySDP/tsdp_message.h" + TSDP_BEGIN_DECLS +#define TSDP_LINE_S_VALUE_DEFAULT "-" /* as per RFC 3264 subclause 5 */ + +#define TSDP_LINE_O_USERNAME_DEFAULT "doubango" +#define TSDP_LINE_O_SESSION_VER_DEFAULT 2301 +#define TSDP_LINE_O_SESSION_ID_DEFAULT 1983 + + +TINYSDP_API tsdp_message_t* tsdp_create_empty(const char* addr, int isIPv6); TSDP_END_DECLS diff --git a/trunk/tinySDP/src/tsdp.c b/trunk/tinySDP/src/tsdp.c index ed272b38..bfe089be 100644 --- a/trunk/tinySDP/src/tsdp.c +++ b/trunk/tinySDP/src/tsdp.c @@ -26,4 +26,52 @@ * * @date Created: Sat Nov 8 16:54:58 2009 mdiop */ -#include "tsdp.h" \ No newline at end of file +#include "tsdp.h" + +#include "tinySDP/headers/tsdp_header_O.h" +#include "tinySDP/headers/tsdp_header_S.h" +#include "tinySDP/headers/tsdp_header_T.h" +#include "tinySDP/headers/tsdp_header_V.h" + +tsdp_message_t* tsdp_create_empty(const char* addr, int isIPv6) +{ + tsdp_message_t* ret = 0; + + if(!(ret = TSDP_MESSAGE_CREATE())){ + return TSDP_NULL; + } + + /* RFC 3264 - 5 Generating the Initial Offer + The numeric value of the session id and version in the o line MUST be + representable with a 64 bit signed integer. The initial value of the version MUST be less than + (2**62)-1, to avoid rollovers. + */ + TSDP_MESSAGE_ADD_HEADER(ret, TSDP_HEADER_V_VA_ARGS(0)); + TSDP_MESSAGE_ADD_HEADER(ret, TSDP_HEADER_O_VA_ARGS( + TSDP_LINE_O_USERNAME_DEFAULT, + TSDP_LINE_O_SESSION_ID_DEFAULT, + TSDP_LINE_O_SESSION_VER_DEFAULT, + "IN", + isIPv6 ? "IP6" : "IP4", + addr)); + + /* RFC 3264 - 5 Generating the Initial Offer + The SDP "s=" line conveys the subject of the session, which is + reasonably defined for multicast, but ill defined for unicast. For + unicast sessions, it is RECOMMENDED that it consist of a single space + character (0x20) or a dash (-). + + Unfortunately, SDP does not allow the "s=" line to be empty. + */ + TSDP_MESSAGE_ADD_HEADER(ret, TSDP_HEADER_S_VA_ARGS(TSDP_LINE_S_VALUE_DEFAULT)); + + /* RFC 3264 - 5 Generating the Initial Offer + The SDP "t=" line conveys the time of the session. Generally, + streams for unicast sessions are created and destroyed through + external signaling means, such as SIP. In that case, the "t=" line + SHOULD have a value of "0 0". + */ + TSDP_MESSAGE_ADD_HEADER(ret, TSDP_HEADER_T_VA_ARGS(0, 0)); + + return ret; +} \ No newline at end of file diff --git a/trunk/tinySDP/test/test.c b/trunk/tinySDP/test/test.c index f79a8b3f..42a76051 100644 --- a/trunk/tinySDP/test/test.c +++ b/trunk/tinySDP/test/test.c @@ -24,6 +24,7 @@ #include "tsk.h" +#include "tsdp.h" #include "tinySDP/parsers/tsdp_parser_message.h" #include "test_parser.h" diff --git a/trunk/tinySDP/test/test_parser.h b/trunk/tinySDP/test/test_parser.h index a4703482..b7a1f046 100644 --- a/trunk/tinySDP/test/test_parser.h +++ b/trunk/tinySDP/test/test_parser.h @@ -65,7 +65,9 @@ void test_parser() { tsdp_message_t *message = 0; - /* deserialize the message */ + // + // deserialize/serialize the message + // if((message = tsdp_message_parse(SDP_MSG_TO_TEST, strlen(SDP_MSG_TO_TEST)))){ tsk_buffer_t *buffer = TSK_BUFFER_CREATE_NULL(); @@ -74,12 +76,25 @@ void test_parser() TSK_DEBUG_INFO("SDP Message=\n%s", TSK_BUFFER_TO_STRING(buffer)); TSK_OBJECT_SAFE_FREE(buffer); + TSK_OBJECT_SAFE_FREE(message); } else{ TSK_DEBUG_ERROR("Failed to parse SDP message."); - } + } - TSK_OBJECT_SAFE_FREE(message); + // + // create empty message + // + if((message = tsdp_create_empty("127.0.0.1", 0))){ + tsk_buffer_t *buffer = TSK_BUFFER_CREATE_NULL(); + + /* serialize the message */ + tsdp_message_tostring(message, buffer); + TSK_DEBUG_INFO("\n\nEmpty SDP Message=\n%s", TSK_BUFFER_TO_STRING(buffer)); + + TSK_OBJECT_SAFE_FREE(buffer); + TSK_OBJECT_SAFE_FREE(message); + } } #endif /* _TEST_SDPPARSER_H */ diff --git a/trunk/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.h b/trunk/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.h index e69de29b..c6eb750f 100644 --- a/trunk/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.h +++ b/trunk/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.h @@ -0,0 +1,56 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_dialog_invlite.h + * @brief SIP dialog INVITE. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#ifndef TINYSIP_DIALOG_INVITE_H +#define TINYSIP_DIALOG_INVITE_H + +#include "tinySIP_config.h" +#include "tinySIP/dialogs/tsip_dialog.h" + +#include "tsk_fsm.h" + +TSIP_BEGIN_DECLS + +typedef struct tsip_dialog_invite +{ + TSIP_DECLARE_DIALOG; + + tsk_fsm_t *fsm; + + unsigned sender:1; +} +tsip_dialog_message_t; + +int tsip_dialog_invite_start(tsip_dialog_invite_t *self, int isSender); + +TINYSIP_GEXTERN const void *tsip_dialog_invite_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_DIALOG_INVITE_H */ diff --git a/trunk/tinySIP/src/dialogs/tsip_dialog_invite.c b/trunk/tinySIP/src/dialogs/tsip_dialog_invite.c new file mode 100644 index 00000000..31ee9899 --- /dev/null +++ b/trunk/tinySIP/src/dialogs/tsip_dialog_invite.c @@ -0,0 +1,31 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as publishd by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_dialog_invite.c + * @brief SIP dialog INVITE as per RFC 3261. + * The SOA machine is designed as per RFC 3264 and draft-ietf-sipping-sip-offeranswer-12. + * + * @author Mamadou Diop + * + * @date Created: Sat Nov 8 16:54:58 2009 mdiop + */ +#include "tinySIP/dialogs/tsip_dialog_invite.h" \ No newline at end of file diff --git a/trunk/tinySIP/src/dialogs/tsip_dialog_publish.client.c b/trunk/tinySIP/src/dialogs/tsip_dialog_publish.client.c index 010e4f50..8a2fbb15 100644 --- a/trunk/tinySIP/src/dialogs/tsip_dialog_publish.client.c +++ b/trunk/tinySIP/src/dialogs/tsip_dialog_publish.client.c @@ -20,7 +20,7 @@ * */ -/**@file tsip_dialog_publish.c +/**@file tsip_dialog_publish.client.c * @brief SIP dialog PUBLISH as per RFC 3903. * * @author Mamadou Diop diff --git a/trunk/tinySIP/src/transactions/tsip_transac_ict.c b/trunk/tinySIP/src/transactions/tsip_transac_ict.c index fab40f71..a7fda10f 100644 --- a/trunk/tinySIP/src/transactions/tsip_transac_ict.c +++ b/trunk/tinySIP/src/transactions/tsip_transac_ict.c @@ -66,7 +66,7 @@ to take +------------+ - draft-sparks-sip-invfix-02.txt - Figure 3: INVITE client transaction + draft-sparks-sip-invfix-03.txt - Figure 3: INVITE client transaction =============================================================================*/ @@ -102,7 +102,7 @@ int tsip_transac_ict_Proceeding_2_Completed_X_300_to_699(va_list *app); int tsip_transac_ict_Proceeding_2_Accepted_X_2xx(va_list *app); int tsip_transac_ict_Completed_2_Completed_X_300_to_699(va_list *app); int tsip_transac_ict_Completed_2_Terminated_X_timerD(va_list *app); -int tsip_transac_ict_Accepted_2_Accepted_X_1xx(va_list *app); +int tsip_transac_ict_Accepted_2_Accepted_X_2xx(va_list *app); int tsip_transac_ict_Accepted_2_Terminated_X_timerM(va_list *app); int tsip_transac_ict_Any_2_Terminated_X_transportError(va_list *app); int tsip_transac_ict_Any_2_Terminated_X_Error(va_list *app); @@ -152,6 +152,9 @@ int tsip_transac_ict_event_callback(const tsip_transac_ict_t *self, tsip_transac { int ret = 0; + /* draft-sparks-sip-invfix-03 - 7.2. UAC Impacts + Any response received which does not match an existing client transaction state machine is simply dropped. + */ switch(type) { case tsip_transac_incoming_msg: @@ -274,8 +277,8 @@ int tsip_transac_ict_init(tsip_transac_ict_t *self) /*======================= * === Accepted === */ - // Accepted -> (1xx) -> Accepted - TSK_FSM_ADD_ALWAYS(_fsm_state_Accepted, _fsm_action_1xx, _fsm_state_Accepted, tsip_transac_ict_Accepted_2_Accepted_X_1xx, "tsip_transac_ict_Accepted_2_Accepted_X_1xx"), + // Accepted -> (2xx) -> Accepted + TSK_FSM_ADD_ALWAYS(_fsm_state_Accepted, _fsm_action_2xx, _fsm_state_Accepted, tsip_transac_ict_Accepted_2_Accepted_X_2xx, "tsip_transac_ict_Accepted_2_Accepted_X_2xx"), // Accepted -> (timerM) -> Terminated TSK_FSM_ADD_ALWAYS(_fsm_state_Accepted, _fsm_action_timerM, _fsm_state_Terminated, tsip_transac_ict_Accepted_2_Terminated_X_timerM, "tsip_transac_ict_Accepted_2_Terminated_X_timerM"), @@ -433,16 +436,17 @@ int tsip_transac_ict_Calling_2_Completed_X_300_to_699(va_list *app) const tsip_response_t *response = va_arg(*app, const tsip_response_t *); int ret; - /* RFC 3261 - 17.1.1.2 Formal Description - When in either the "Calling" or "Proceeding" states, reception of a - response with status code from 300-699 MUST cause the client + /* draft-sparks-sip-invfix-03 - 8.4. Pages 126 through 128 + When in either the "Calling" or "Proceeding" states, reception of + a response with status code from 300-699 MUST cause the client transaction to transition to "Completed". The client transaction MUST pass the received response up to the TU, and the client transaction MUST generate an ACK request, even if the transport is - reliable (guidelines for constructing the ACK from the response are - given in Section 17.1.1.3) and then pass the ACK to the transport - layer for transmission. The ACK MUST be sent to the same address, - port, and transport to which the original request was sent. + reliable (guidelines for constructing the ACK from the response + are given in Section 17.1.1.3) and then pass the ACK to the + transport layer for transmission. The ACK MUST be sent to the + same address, port, and transport to which the original request + was sent. */ /* Do not retransmit */ if(!TSIP_TRANSAC(self)->reliable){ @@ -450,27 +454,23 @@ int tsip_transac_ict_Calling_2_Completed_X_300_to_699(va_list *app) } TRANSAC_TIMER_CANCEL(B); /* Now it's up to the UAS to update the FSM. */ - /* RFC 3261 - 17.1.1.2 Formal Description - The client transaction SHOULD start timer D when it enters the - "Completed" state, with a value of at least 32 seconds for unreliable - transports, and a value of zero seconds for reliable transports. - Timer D reflects the amount of time that the server transaction can - remain in the "Completed" state when unreliable transports are used. - This is equal to Timer H in the INVITE server transaction, whose - - default is 64*T1. However, the client transaction does not know the - value of T1 in use by the server transaction, so an absolute minimum - of 32s is used instead of basing Timer D on T1. + /* draft-sparks-sip-invfix-03 - 8.4. Pages 126 through 128 + The client transaction MUST start timer D when it enters the + "Completed" state for any reason, with a value of at least 32 + seconds for unreliable transports, and a value of zero seconds for + reliable transports. Timer D reflects the amount of time that the + server transaction can remain in the "Completed" state when + unreliable transports are used. */ TRANSAC_ICT_TIMER_SCHEDULE(D); /* timerD already have the right value (0 if reliable and non-zero otherwise) */ /* Send ACK */ - ret = tsip_transac_ict_send_ack(response); + if((ret = tsip_transac_ict_send_ack(response))){ + return ret; + } /* Pass the response to the dialog. */ - TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_i_msg, response); - - return ret; + return TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_i_msg, response); } /* Calling -> (1xx) -> Proceeding @@ -505,7 +505,23 @@ int tsip_transac_ict_Calling_2_Proceeding_X_1xx(va_list *app) */ int tsip_transac_ict_Calling_2_Accepted_X_2xx(va_list *app) { - return 0; + tsip_transac_ict_t *self = va_arg(*app, tsip_transac_ict_t *); + const tsip_response_t *response = va_arg(*app, const tsip_response_t *); + + /* draft-sparks-sip-invfix-03 - 8.4. Pages 126 through 128 + When a 2xx response is received while in either the "Calling" or + "Proceeding" states, the client transaction MUST transition to the + "Accepted" state, and Timer M MUST be started with a value of + 64*T1. The 2xx response MUST be passed up to the TU. The client + transaction MUST NOT generate an ACK to the 2xx response - its + handling is delegated to the TU. + */ + + /* Schedule timer M */ + TRANSAC_ICT_TIMER_SCHEDULE(M); + + /* pass the response to the TU (dialog) */ + return TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_i_msg, response); } /* Proceeding -> (1xx) -> Proceeding @@ -523,16 +539,17 @@ int tsip_transac_ict_Proceeding_2_Completed_X_300_to_699(va_list *app) const tsip_response_t *response = va_arg(*app, const tsip_response_t *); int ret; - /* RFC 3261 - 17.1.1.2 Formal Description - When in either the "Calling" or "Proceeding" states, reception of a - response with status code from 300-699 MUST cause the client + /* draft-sparks-sip-invfix-03 - 8.4. Pages 126 through 128 + When in either the "Calling" or "Proceeding" states, reception of + a response with status code from 300-699 MUST cause the client transaction to transition to "Completed". The client transaction MUST pass the received response up to the TU, and the client transaction MUST generate an ACK request, even if the transport is - reliable (guidelines for constructing the ACK from the response are - given in Section 17.1.1.3) and then pass the ACK to the transport - layer for transmission. The ACK MUST be sent to the same address, - port, and transport to which the original request was sent. + reliable (guidelines for constructing the ACK from the response + are given in Section 17.1.1.3) and then pass the ACK to the + transport layer for transmission. The ACK MUST be sent to the + same address, port, and transport to which the original request + was sent. */ /* Do not retransmit */ if(!TSIP_TRANSAC(self)->reliable){ @@ -540,25 +557,23 @@ int tsip_transac_ict_Proceeding_2_Completed_X_300_to_699(va_list *app) } TRANSAC_TIMER_CANCEL(B); /* Now it's up to the UAS to update the FSM. */ - /* RFC 3261 - 17.1.1.2 Formal Description - The client transaction SHOULD start timer D when it enters the - "Completed" state, with a value of at least 32 seconds for unreliable - transports, and a value of zero seconds for reliable transports. - Timer D reflects the amount of time that the server transaction can - remain in the "Completed" state when unreliable transports are used. - This is equal to Timer H in the INVITE server transaction, whose - - default is 64*T1. However, the client transaction does not know the - value of T1 in use by the server transaction, so an absolute minimum - of 32s is used instead of basing Timer D on T1. + /* draft-sparks-sip-invfix-03 - 8.4. Pages 126 through 128 + The client transaction MUST start timer D when it enters the + "Completed" state for any reason, with a value of at least 32 + seconds for unreliable transports, and a value of zero seconds for + reliable transports. Timer D reflects the amount of time that the + server transaction can remain in the "Completed" state when + unreliable transports are used. */ TRANSAC_ICT_TIMER_SCHEDULE(D); /* timerD already have the right value (0 if reliable and non-zero otherwise) */ /* Send ACK */ - ret = tsip_transac_ict_send_ack(response); + if((ret = tsip_transac_ict_send_ack(response))){ + return ret; + } /* Pass the response to the dialog. */ - TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_i_msg, response); + return TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_i_msg, response); return ret; } @@ -567,10 +582,23 @@ int tsip_transac_ict_Proceeding_2_Completed_X_300_to_699(va_list *app) */ int tsip_transac_ict_Proceeding_2_Accepted_X_2xx(va_list *app) { - /* draft-sparks-sip-invfix-02 - 8.5. Pages 134 to 135 - ........ TO BE CONTINUED + tsip_transac_ict_t *self = va_arg(*app, tsip_transac_ict_t *); + const tsip_response_t *response = va_arg(*app, const tsip_response_t *); + + /* draft-sparks-sip-invfix-03 - 8.4. Pages 126 through 128 + When a 2xx response is received while in either the "Calling" or + "Proceeding" states, the client transaction MUST transition to the + "Accepted" state, and Timer M MUST be started with a value of + 64*T1. The 2xx response MUST be passed up to the TU. The client + transaction MUST NOT generate an ACK to the 2xx response - its + handling is delegated to the TU. */ - return 0; + + /* Schedule timer M */ + TRANSAC_ICT_TIMER_SCHEDULE(M); + + /* pass the response to the TU (dialog) */ + return TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_i_msg, response); } /* Completed -> (300-699) -> Completed @@ -580,13 +608,11 @@ int tsip_transac_ict_Completed_2_Completed_X_300_to_699(va_list *app) //tsip_transac_ict_t *self = va_arg(*app, tsip_transac_ict_t *); const tsip_response_t *response = va_arg(*app, const tsip_response_t *); - /* RFC 3261 - 17.1.1.2 Formal Description - Any retransmissions of the final response that are received while in - the "Completed" state MUST cause the ACK to be re-passed to the - transport layer for retransmission, but the newly received response - MUST NOT be passed up to the TU. A retransmission of the response is - defined as any response which would match the same client transaction - based on the rules of Section 17.1.3. + /* draft-sparks-sip-invfix-03 - 8.4. Pages 126 through 128 + Any retransmissions of a response with status code 300-699 that + are received while in the "Completed" state MUST cause the ACK to + be re-passed to the transport layer for retransmission, but the + newly received response MUST NOT be passed up to the TU. */ return tsip_transac_ict_send_ack(response); @@ -596,19 +622,33 @@ int tsip_transac_ict_Completed_2_Completed_X_300_to_699(va_list *app) */ int tsip_transac_ict_Completed_2_Terminated_X_timerD(va_list *app) { - /* RFC 3261 - 17.1.1.2 Formal Description - If timer D fires while the client transaction is in the "Completed" - state, the client transaction MUST move to the terminated state. + /* draft-sparks-sip-invfix-03 - 8.4. Pages 126 through 128 + If timer D fires while the client transaction is in the + "Completed" state, the client transaction MUST move to the + "Terminated" state. */ /* Timers will be canceled by "tsip_transac_ict_OnTerminated" */ return 0; } -/* Accepted -> (1xx) -> Accepted +/* Accepted -> (2xx) -> Accepted */ -int tsip_transac_ict_Accepted_2_Accepted_X_1xx(va_list *app) +int tsip_transac_ict_Accepted_2_Accepted_X_2xx(va_list *app) { + tsip_transac_ict_t *self = va_arg(*app, tsip_transac_ict_t *); + const tsip_response_t *response = va_arg(*app, const tsip_response_t *); + + /* draft-sparks-sip-invfix-03 - 7.2. UAC Impacts + A 2xx response received while in the "Accepted" state MUST be passed to the TU and + the machine remains in the "Accepted" state. The client transaction + MUST NOT generate an ACK to any 2xx response on its own. The TU + responsible for the transaction will generate the ACK. + */ + + /* Pass the response to the TU. */ + TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_i_msg, response); + return 0; } @@ -616,6 +656,10 @@ int tsip_transac_ict_Accepted_2_Accepted_X_1xx(va_list *app) */ int tsip_transac_ict_Accepted_2_Terminated_X_timerM(va_list *app) { + /* draft-sparks-sip-invfix-03 - 8.4. Pages 126 through 128 + If timer M fires while the client transaction is in the "Accepted" + state, the client transaction MUST move to the "Terminated" state. + */ return 0; } @@ -623,14 +667,24 @@ int tsip_transac_ict_Accepted_2_Terminated_X_timerM(va_list *app) */ int tsip_transac_ict_Any_2_Terminated_X_transportError(va_list *app) { - return 0; + tsip_transac_ict_t *self = va_arg(*app, tsip_transac_ict_t *); + //const tsip_message_t *message = va_arg(*app, const tsip_message_t *); + + /* Timers will be canceled by "tsip_transac_nict_OnTerminated" */ + + return TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_transport_error, TSIP_NULL); } /* Any -> (Error) -> Terminated */ int tsip_transac_ict_Any_2_Terminated_X_Error(va_list *app) { - return 0; + tsip_transac_ict_t *self = va_arg(*app, tsip_transac_ict_t *); + //const tsip_message_t *message = va_arg(*app, const tsip_message_t *); + + /* Timers will be canceled by "tsip_transac_nict_OnTerminated" */ + + return TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_error, TSIP_NULL); } @@ -649,12 +703,10 @@ int tsip_transac_ict_send_ack(const tsip_response_t* response) */ int tsip_transac_ict_OnTerminated(tsip_transac_ict_t *self) { - /* RFC 3261 - 17.1.1.2 Formal Description - The client transaction MUST be destroyed the instant it enters the - "Terminated" state. This is actually necessary to guarantee correct - operation. + /* draft-sparks-sip-invfix-03 - 8.4. Pages 126 through 128 + The client transaction MUST be destroyed the instant it enters the "Terminated" state. */ - + /* Cancel timers */ if(!TSIP_TRANSAC(self)->reliable){ TRANSAC_TIMER_CANCEL(A); @@ -662,9 +714,9 @@ int tsip_transac_ict_OnTerminated(tsip_transac_ict_t *self) TRANSAC_TIMER_CANCEL(B); TRANSAC_TIMER_CANCEL(D); TRANSAC_TIMER_CANCEL(M); - + TSIP_TRANSAC(self)->running = 0; - + TSK_DEBUG_INFO("=== ICT terminated ==="); /* Remove (and destroy) the transaction from the layer. */ diff --git a/trunk/tinySIP/src/transactions/tsip_transac_nict.c b/trunk/tinySIP/src/transactions/tsip_transac_nict.c index 1716d0d9..f38a78a8 100644 --- a/trunk/tinySIP/src/transactions/tsip_transac_nict.c +++ b/trunk/tinySIP/src/transactions/tsip_transac_nict.c @@ -596,13 +596,11 @@ int tsip_transac_nict_Completed_2_Terminated_X_timerK(va_list *app) int tsip_transac_nict_Any_2_Terminated_X_transportError(va_list *app) { tsip_transac_nict_t *self = va_arg(*app, tsip_transac_nict_t *); - const tsip_message_t *message = va_arg(*app, const tsip_message_t *); + //const tsip_message_t *message = va_arg(*app, const tsip_message_t *); /* Timers will be canceled by "tsip_transac_nict_OnTerminated" */ - TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_transport_error, 0); - - return 0; + return TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_transport_error, TSIP_NULL); } /* Any -> (Error) -> Terminated @@ -610,9 +608,11 @@ int tsip_transac_nict_Any_2_Terminated_X_transportError(va_list *app) int tsip_transac_nict_Any_2_Terminated_X_Error(va_list *app) { tsip_transac_nict_t *self = va_arg(*app, tsip_transac_nict_t *); - const tsip_message_t *message = va_arg(*app, const tsip_message_t *); + //const tsip_message_t *message = va_arg(*app, const tsip_message_t *); - return 0; + /* Timers will be canceled by "tsip_transac_nict_OnTerminated" */ + + return TSIP_TRANSAC(self)->dialog->callback(TSIP_TRANSAC(self)->dialog, tsip_dialog_error, TSIP_NULL); } diff --git a/trunk/vs_2005/tinyMSRP/test.vcproj b/trunk/vs_2005/tinyMSRP/test.vcproj new file mode 100644 index 00000000..94869076 --- /dev/null +++ b/trunk/vs_2005/tinyMSRP/test.vcproj @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trunk/vs_2005/tinySIP/tinySIP.vcproj b/trunk/vs_2005/tinySIP/tinySIP.vcproj index 5a5312b7..2a46951d 100644 --- a/trunk/vs_2005/tinySIP/tinySIP.vcproj +++ b/trunk/vs_2005/tinySIP/tinySIP.vcproj @@ -823,6 +823,10 @@ RelativePath="..\..\tinySIP\src\dialogs\tsip_dialog.c" > + +