[sr-dev] git:master:5c3df566: uac: call event route for uac_req_send() for second response

Daniel-Constantin Mierla miconda at gmail.com
Mon Jul 23 13:59:50 CEST 2018


Module: kamailio
Branch: master
Commit: 5c3df566887e8c37d3144d4191b36fc9eba24c34
URL: https://github.com/kamailio/kamailio/commit/5c3df566887e8c37d3144d4191b36fc9eba24c34

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-07-23T13:59:28+02:00

uac: call event route for uac_req_send() for second response

- done in case the request is resent after a 401/407
- GH #1598

---

Modified: src/modules/uac/uac_send.c

---

Diff:  https://github.com/kamailio/kamailio/commit/5c3df566887e8c37d3144d4191b36fc9eba24c34.diff
Patch: https://github.com/kamailio/kamailio/commit/5c3df566887e8c37d3144d4191b36fc9eba24c34.patch

---

diff --git a/src/modules/uac/uac_send.c b/src/modules/uac/uac_send.c
index 5db66bd1a2..1d939dc815 100644
--- a/src/modules/uac/uac_send.c
+++ b/src/modules/uac/uac_send.c
@@ -656,7 +656,35 @@ void uac_req_run_event_route(sip_msg_t *msg, uac_send_info_t *tp, int rcode)
 }
 
 /**
- * TM callback function
+ * TM resend callback function
+ */
+void uac_resend_tm_callback(struct cell *t, int type, struct tmcb_params *ps)
+{
+	uac_send_info_t *tp = NULL;
+
+	LM_DBG("tm callback with status %d\n", ps->code);
+
+	if(ps->param==NULL || *ps->param==0)
+	{
+		LM_DBG("callback param with message id not received\n");
+		goto done;
+	}
+	tp = (uac_send_info_t*)(*ps->param);
+
+	if(tp->evroute!=0) {
+		uac_req_run_event_route((ps->rpl==FAKED_REPLY)?NULL:ps->rpl,
+				tp, ps->code);
+	}
+
+done:
+	if(tp!=NULL)
+		shm_free(tp);
+	return;
+
+}
+
+/**
+ * TM send callback function
  */
 void uac_send_tm_callback(struct cell *t, int type, struct tmcb_params *ps)
 {
@@ -753,6 +781,12 @@ void uac_send_tm_callback(struct cell *t, int type, struct tmcb_params *ps)
 	uac_r.ssock = (tp->s_sock.len <= 0) ? NULL : &tp->s_sock;
 	uac_r.dialog = &tmdlg;
 	uac_r.cb_flags = TMCB_LOCAL_COMPLETED;
+	if(tp->evroute!=0) {
+		/* Callback function */
+		uac_r.cb  = uac_resend_tm_callback;
+		/* Callback parameter */
+		uac_r.cbp = (void*)tp;
+	}
 	ret = tmb.t_request_within(&uac_r);
 
 	if(ret<0) {
@@ -760,6 +794,10 @@ void uac_send_tm_callback(struct cell *t, int type, struct tmcb_params *ps)
 		goto error;
 	}
 
+	if(tp->evroute!=0) {
+		return;
+	}
+
 done:
 error:
 	if(tp!=NULL)




More information about the sr-dev mailing list