[svn-commits] file: branch group/pimp_my_sip r381150 - in /team/group/pimp_my_sip: include/...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Feb 10 15:10:24 CST 2013


Author: file
Date: Sun Feb 10 15:10:20 2013
New Revision: 381150

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381150
Log:
Add a session supplement callback for when the session is being destroyed.

Modified:
    team/group/pimp_my_sip/include/asterisk/res_sip_session.h
    team/group/pimp_my_sip/res/res_sip_session.c

Modified: team/group/pimp_my_sip/include/asterisk/res_sip_session.h
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/include/asterisk/res_sip_session.h?view=diff&rev=381150&r1=381149&r2=381150
==============================================================================
--- team/group/pimp_my_sip/include/asterisk/res_sip_session.h (original)
+++ team/group/pimp_my_sip/include/asterisk/res_sip_session.h Sun Feb 10 15:10:20 2013
@@ -41,8 +41,8 @@
  * \brief A structure containing SIP session media information
  */
 struct ast_sip_session_media {
-    /* RTP instance for audio */
-    struct ast_rtp_instance *audio;
+	/* RTP instance for audio */
+	struct ast_rtp_instance *audio;
 };
 
 /*!
@@ -56,18 +56,18 @@
 struct ast_sip_session {
 	/* Dialplan extension where incoming call is destined */
 	char exten[AST_MAX_EXTENSION];
-    /* The endpoint with which Asterisk is communicating */
-    struct ast_sip_endpoint *endpoint;
-    /* The PJSIP details of the session, which includes the dialog */
-    struct pjsip_inv_session *inv_session;
-    /* The Asterisk channel associated with the session */
-    struct ast_channel *channel;
+	/* The endpoint with which Asterisk is communicating */
+	struct ast_sip_endpoint *endpoint;
+	/* The PJSIP details of the session, which includes the dialog */
+	struct pjsip_inv_session *inv_session;
+	/* The Asterisk channel associated with the session */
+	struct ast_channel *channel;
 	/* Registered session supplements */
 	AST_LIST_HEAD(, ast_sip_session_supplement) supplements;
-    /* Datastores added to the session by supplements to the session */
+	/* Datastores added to the session by supplements to the session */
 	struct ao2_container *datastores;
-    /* Media information */
-    struct ast_sip_session_media media;
+	/* Media information */
+	struct ast_sip_session_media media;
 	/* Workspace for tasks relating to this SIP session */
 	struct ast_sip_work *work;
 };
@@ -78,25 +78,28 @@
  * These can be registered by any module in order to add
  * processing to incoming and outgoing SIP requests and responses
  */
-struct ast_sip_session_supplement {
-    /*! Method on which to call the callbacks. If NULL, call on all methods */
-    const char *method;
-    /*! Notification that the session has begun */
-    void (*session_begin)(struct ast_sip_session *session);
-    /*! Notification that the session has ended */
-    void (*session_end)(struct ast_sip_session *session);
-    /*!
-     * \brief Called on incoming SIP request
-     * This method can indicate a failure in processing in its return. If there
-     * is a failure, it is required that this method sends a response to the request.
-     */
-    int (*incoming_request)(struct ast_sip_session *session, struct pjsip_rx_data *rdata);
-    /*! Called on an incoming SIP response */
-    void (*incoming_response)(struct ast_sip_session *session, struct pjsip_rx_data *rdata);
-    /*! Called on an outgoing SIP request */
-    void (*outgoing_request)(struct ast_sip_session *session, struct pjsip_tx_data *tdata);
-    /*! Called on an outgoing SIP response */
-    void (*outgoing_response)(struct ast_sip_session *session, struct pjsip_tx_data *tdata);
+struct ast_sip_session_supplement{
+	/*! Method on which to call the callbacks. If NULL, call on all methods */
+	const char *method;
+	/*! Notification that the session has begun */
+	void (*session_begin)(struct ast_sip_session *session);
+	/*! Notification that the session has ended */
+	void (*session_end)(struct ast_sip_session *session);
+	/*! Notification that the session is being destroyed */
+	void (*session_destroy)(struct ast_sip_session *session);
+	/*!
+	 * \brief Called on incoming SIP request
+	 * This method can indicate a failure in processing in its return. If there
+	 * is a failure, it is required that this method sends a response to the request.
+
+	 */
+	int (*incoming_request)(struct ast_sip_session *session, struct pjsip_rx_data *rdata);
+	/*! Called on an incoming SIP response */
+	void (*incoming_response)(struct ast_sip_session *session, struct pjsip_rx_data *rdata);
+	/*! Called on an outgoing SIP request */
+	void (*outgoing_request)(struct ast_sip_session *session, struct pjsip_tx_data *tdata);
+	/*! Called on an outgoing SIP response */
+	void (*outgoing_response)(struct ast_sip_session *session, struct pjsip_tx_data *tdata);
 	/*! Next item in the list */
 	AST_LIST_ENTRY(ast_sip_session_supplement) next;
 };
@@ -110,25 +113,25 @@
 struct ast_sip_session_sdp_handler {
 	/*! An identifier for this handler */
 	const char *id;
-    /*!
-     * \brief Set session details based on a stream in an incoming SDP offer or answer
-     * \param session The session for which the media is being negotiated
+	/*!
+	 * \brief Set session details based on a stream in an incoming SDP offer or answer
+	 * \param session The session for which the media is being negotiated
 	 * \param sdp The entire SDP. Useful for getting "global" information, such as connections or attributes
-     * \param stream The stream on which to operate
-     * \retval 0 The stream was not handled by this handler. If there are other registered handlers for this stream type, they will be called.
-     * \retval <0 There was an error encountered. No further operation will take place and the current negotiation will be abandoned.
-     * \retval >0 The stream was handled by this handler. No further handler of this stream type will be called.
-     */
-    int (*handle_incoming_sdp_stream)(struct ast_sip_session *session, const struct pjmedia_sdp_session *sdp, struct pjmedia_sdp_media *stream);
-    /*!
-     * \brief Create an SDP media stream and add it to the outgoing SDP offer or answer
-     * \param session The session for which media is being added
+	 * \param stream The stream on which to operate
+	 * \retval 0 The stream was not handled by this handler. If there are other registered handlers for this stream type, they will be called.
+	 * \retval <0 There was an error encountered. No further operation will take place and the current negotiation will be abandoned.
+	 * \retval >0 The stream was handled by this handler. No further handler of this stream type will be called.
+	 */
+	int (*handle_incoming_sdp_stream)(struct ast_sip_session *session, const struct pjmedia_sdp_session *sdp, struct pjmedia_sdp_media *stream);
+	/*!
+	 * \brief Create an SDP media stream and add it to the outgoing SDP offer or answer
+	 * \param session The session for which media is being added
 	 * \param sdp The entire SDP as currently built
-     * \retval 0 This handler has no stream to add. If there are other registered handlers for this stream type, they will be called.
-     * \retval <0 There was an error encountered. No further operation will take place and the current SDP negotiation will be abandoned.
-     * \retval >0 The handler has a stream to be added to the SDP. No further handler of this stream type will be called.
-     */
-    int (*create_outgoing_sdp_stream)(struct ast_sip_session *session, struct pjmedia_sdp_session *sdp);
+	 * \retval 0 This handler has no stream to add. If there are other registered handlers for this stream type, they will be called.
+	 * \retval <0 There was an error encountered. No further operation will take place and the current SDP negotiation will be abandoned.
+	 * \retval >0 The handler has a stream to be added to the SDP. No further handler of this stream type will be called.
+	 */
+	int (*create_outgoing_sdp_stream)(struct ast_sip_session *session, struct pjmedia_sdp_session *sdp);
 	/*! Next item int he list. */
 	AST_LIST_ENTRY(ast_sip_session_sdp_handler) next;
 };

Modified: team/group/pimp_my_sip/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip_session.c?view=diff&rev=381150&r1=381149&r2=381150
==============================================================================
--- team/group/pimp_my_sip/res/res_sip_session.c (original)
+++ team/group/pimp_my_sip/res/res_sip_session.c Sun Feb 10 15:10:20 2013
@@ -424,6 +424,9 @@
 
 	ast_debug(3, "Destroying SIP session\n");
 	while ((supplement = AST_LIST_REMOVE_HEAD(&session->supplements, next))) {
+		if (supplement->session_destroy) {
+			supplement->session_destroy(session);
+		}
 		ast_free(supplement);
 	}
 	ast_sip_destroy_work(session->work);




More information about the svn-commits mailing list