[asterisk-commits] mmichelson: branch mmichelson/direct_media r382987 - /team/mmichelson/direct_...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 12 17:22:57 CDT 2013
Author: mmichelson
Date: Tue Mar 12 17:22:54 2013
New Revision: 382987
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382987
Log:
Add documentation for parts that may need further explanations.
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=382987&r1=382986&r2=382987
==============================================================================
--- team/mmichelson/direct_media/res/res_sip_session.c (original)
+++ team/mmichelson/direct_media/res/res_sip_session.c Tue Mar 12 17:22:54 2013
@@ -349,10 +349,21 @@
return 0;
}
+/*!
+ * \brief Structure used for sending delayed requests
+ *
+ * Requests are typically delayed because the current transaction
+ * state of an INVITE. Once the pending INVITE transaction terminates,
+ * the delayed request will be sent
+ */
struct ast_sip_session_delayed_request {
+ /*! Method of the request */
char method[15];
+ /*! Callback to call when the delayed request is created. */
ast_sip_session_request_creation_cb on_request_creation;
+ /*! Callback to call when the delayed request receives a response */
ast_sip_session_response_cb on_response;
+ /*! Request to send */
pjsip_tx_data *tdata;
AST_LIST_ENTRY(ast_sip_session_delayed_request) next;
};
@@ -1288,6 +1299,11 @@
}
switch (e->body.tsx_state.type) {
case PJSIP_EVENT_TX_MSG:
+ /* When we create an outgoing request, we do not have access to the transaction that
+ * is created. Instead, We have to place transaction-specific data in the tdata. Here,
+ * we transfer the data into the transaction. This way, when we receive a response, we
+ * can dig this data out again
+ */
tsx->mod_data[session_module.id] = e->body.tsx_state.src.tdata->mod_data[session_module.id];
break;
case PJSIP_EVENT_RX_MSG:
@@ -1318,6 +1334,9 @@
break;
}
+ /* Terminated INVITE transactions always should result in queuing delayed requests,
+ * no matter what event caused the transaction to terminate
+ */
if (tsx->method.id == PJSIP_INVITE_METHOD && tsx->state == PJSIP_TSX_STATE_TERMINATED) {
queue_delayed_request(session);
}
More information about the asterisk-commits
mailing list