[Asterisk-code-review] pjsip: For the response priority to the handler (asterisk[18])

Holger Hans Peter Freyther asteriskteam at digium.com
Thu Jan 7 08:35:37 CST 2021


Holger Hans Peter Freyther has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/15306 )


Change subject: pjsip: For the response priority to the handler
......................................................................

pjsip: For the response priority to the handler

Some handlers register for multiple priorities and can have a different
behavior.

ASTERISK-29105

Change-Id: I0232ee602ee1daba0c563a75494a32b7e77222c4
---
M channels/chan_pjsip.c
M include/asterisk/res_pjsip_session.h
M res/res_pjsip_caller_id.c
M res/res_pjsip_diversion.c
M res/res_pjsip_nat.c
M res/res_pjsip_rfc3326.c
M res/res_pjsip_session.c
7 files changed, 8 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/06/15306/1

diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index bb04d73..81d4388 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -136,7 +136,7 @@
 static void chan_pjsip_session_begin(struct ast_sip_session *session);
 static void chan_pjsip_session_end(struct ast_sip_session *session);
 static int chan_pjsip_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata);
-static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata);
+static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata, enum ast_sip_session_response_priority prio);
 
 /*! \brief SIP session supplement structure */
 static struct ast_sip_session_supplement chan_pjsip_supplement = {
@@ -3125,7 +3125,7 @@
 };
 
 /*! \brief Function called when a response is received on the session */
-static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
+static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata, enum ast_sip_session_response_priority prio)
 {
 	struct pjsip_status_line status = rdata->msg_info.msg->line.status;
 	struct ast_control_pvt_cause_code *cause_code;
diff --git a/include/asterisk/res_pjsip_session.h b/include/asterisk/res_pjsip_session.h
index 54c704f..f95c64b 100644
--- a/include/asterisk/res_pjsip_session.h
+++ b/include/asterisk/res_pjsip_session.h
@@ -338,7 +338,7 @@
 	 * \note
 	 * There is no guarantee that a channel will be present on the session when this is called.
 	 */
-	void (*incoming_response)(struct ast_sip_session *session, struct pjsip_rx_data *rdata);
+	void (*incoming_response)(struct ast_sip_session *session, struct pjsip_rx_data *rdata, enum ast_sip_session_response_priority response_priority);
 	/*!
 	 * \brief Called on an outgoing SIP request
 	 * This method is always called from a SIP servant thread.
diff --git a/res/res_pjsip_caller_id.c b/res/res_pjsip_caller_id.c
index 0b16665..00ee9ba 100644
--- a/res/res_pjsip_caller_id.c
+++ b/res/res_pjsip_caller_id.c
@@ -406,7 +406,7 @@
  * \param session The session on which communication is happening
  * \param rdata The incoming INVITE response
  */
-static void caller_id_incoming_response(struct ast_sip_session *session, pjsip_rx_data *rdata)
+static void caller_id_incoming_response(struct ast_sip_session *session, pjsip_rx_data *rdata, enum ast_sip_session_response_priority prio)
 {
 	if (!session->channel) {
 		return;
diff --git a/res/res_pjsip_diversion.c b/res/res_pjsip_diversion.c
index 24d1781..b084761 100644
--- a/res/res_pjsip_diversion.c
+++ b/res/res_pjsip_diversion.c
@@ -433,7 +433,7 @@
 	return 0;
 }
 
-static void diversion_incoming_response(struct ast_sip_session *session, pjsip_rx_data *rdata)
+static void diversion_incoming_response(struct ast_sip_session *session, pjsip_rx_data *rdata, enum ast_sip_session_response_priority prio)
 {
 	static const pj_str_t contact_name = { "Contact", 7 };
 	static const pj_str_t contact_name_s = { "m", 1 };
diff --git a/res/res_pjsip_nat.c b/res/res_pjsip_nat.c
index 3d6f25d..419382e 100644
--- a/res/res_pjsip_nat.c
+++ b/res/res_pjsip_nat.c
@@ -493,7 +493,7 @@
 }
 
 /*! \brief Function called when an INVITE response comes in */
-static void nat_incoming_invite_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
+static void nat_incoming_invite_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata, enum ast_sip_session_response_priority prio)
 {
 	handle_rx_message(session->endpoint, rdata);
 }
diff --git a/res/res_pjsip_rfc3326.c b/res/res_pjsip_rfc3326.c
index 6a02641..7e64edc 100644
--- a/res/res_pjsip_rfc3326.c
+++ b/res/res_pjsip_rfc3326.c
@@ -80,7 +80,7 @@
 	return 0;
 }
 
-static void rfc3326_incoming_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
+static void rfc3326_incoming_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata, enum ast_sip_session_response_priority prio)
 {
 	struct pjsip_status_line status = rdata->msg_info.msg->line.status;
 
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 82ef2aa..a6f52a2 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -4487,7 +4487,7 @@
 			continue;
 		}
 		if (supplement->incoming_response && does_method_match(&rdata->msg_info.cseq->method.name, supplement->method)) {
-			supplement->incoming_response(session, rdata);
+		        supplement->incoming_response(session, rdata, response_priority);
 		}
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15306
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I0232ee602ee1daba0c563a75494a32b7e77222c4
Gerrit-Change-Number: 15306
Gerrit-PatchSet: 1
Gerrit-Owner: Holger Hans Peter Freyther <automatic at freyther.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210107/09960bb1/attachment.html>


More information about the asterisk-code-review mailing list