[asterisk-commits] mmichelson: branch mmichelson/direct_media r382634 - /team/mmichelson/direct_...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Mar 7 13:58:23 CST 2013
Author: mmichelson
Date: Thu Mar 7 13:58:19 2013
New Revision: 382634
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382634
Log:
Don't send a premature BYE when a transaction state is in "Completed" state.
For an INVITE transaction in the UAC role, the "Completed" state occurs when
a failure response (>=300) is received. However, in the UAR role, the "Completed"
state occurs between sending a final response (whether it is 200 or not) and
reception of the ACK.
For the purposes of reinvites, we only want to terminate the session when we
receive an error response for an INVITE we sent out.
Modified:
team/mmichelson/direct_media/res/res_sip_session.c
Modified: team/mmichelson/direct_media/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/direct_media/res/res_sip_session.c?view=diff&rev=382634&r1=382633&r2=382634
==============================================================================
--- team/mmichelson/direct_media/res/res_sip_session.c (original)
+++ team/mmichelson/direct_media/res/res_sip_session.c Thu Mar 7 13:58:19 2013
@@ -1043,31 +1043,6 @@
dlg = pjsip_tsx_get_dlg(tsx);
inv = pjsip_dlg_get_inv_session(dlg);
print_debug_details(__PRETTY_FUNCTION__, inv, tsx);
- if (tsx->method.id == PJSIP_INVITE_METHOD) {
- struct ast_sip_session *session = inv->mod_data[session_module.id];
- if (!session) {
- /* Transaction likely timed out after the call was hung up. Just
- * ignore such transaction changes
- */
- return;
- }
- if (tsx->state == PJSIP_TSX_STATE_TERMINATED) {
- queue_delayed_request(session);
- if (session->endpoint->direct_media && session->channel) {
- ast_queue_control(session->channel, AST_CONTROL_SRCCHANGE);
- }
- } else if (tsx->state == PJSIP_TSX_STATE_COMPLETED) {
- /* This means we got a non 2XX final response to our outgoing INVITE */
- if (tsx->status_code == PJSIP_SC_REQUEST_PENDING) {
- reschedule_reinvite(session);
- } else {
- /* Other failures result in destroying the session. */
- pjsip_tx_data *tdata;
- pjsip_inv_end_session(inv, 500, NULL, &tdata);
- ast_sip_session_send_request(session, tdata);
- }
- }
- }
}
static void handle_incoming_request(struct ast_sip_session *session, pjsip_rx_data *rdata)
@@ -1230,6 +1205,31 @@
static void session_inv_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e)
{
print_debug_details(__PRETTY_FUNCTION__, inv, tsx);
+ if (tsx->method.id == PJSIP_INVITE_METHOD) {
+ struct ast_sip_session *session = inv->mod_data[session_module.id];
+ if (!session) {
+ /* Transaction likely timed out after the call was hung up. Just
+ * ignore such transaction changes
+ */
+ return;
+ }
+ if (tsx->state == PJSIP_TSX_STATE_TERMINATED) {
+ queue_delayed_request(session);
+ if (session->endpoint->direct_media && session->channel) {
+ ast_queue_control(session->channel, AST_CONTROL_SRCCHANGE);
+ }
+ } else if (tsx->role == PJSIP_ROLE_UAC && tsx->state == PJSIP_TSX_STATE_COMPLETED) {
+ /* This means we got a non 2XX final response to our outgoing INVITE */
+ if (tsx->status_code == PJSIP_SC_REQUEST_PENDING) {
+ reschedule_reinvite(session);
+ } else {
+ /* Other failures result in destroying the session. */
+ pjsip_tx_data *tdata;
+ pjsip_inv_end_session(inv, 500, NULL, &tdata);
+ ast_sip_session_send_request(session, tdata);
+ }
+ }
+ }
}
static int add_sdp_streams(void *obj, void *arg, void *data, int flags)
More information about the asterisk-commits
mailing list