Module: sip-router
Branch: master
Commit: 8863703388f1be349675e4b72329eb702ad33ecd
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8863703…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Aug 19 11:32:00 2014 +0200
tm: more details about processing doen by t_check_trans()
- note that last reply is resent for retransmissions matching a
transaction
---
modules/tm/README | 8 +++++---
modules/tm/doc/functions.xml | 8 +++++---
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/modules/tm/README b/modules/tm/README
index 5ca25af..7952d7f 100644
--- a/modules/tm/README
+++ b/modules/tm/README
@@ -2479,9 +2479,11 @@ Note
not needed for a statefull proxy and it requires additional memory,
tm will not keep this information unless needed by some other
module or callbacks).
- * For other requests (non ACKs and non CANCELs), it will terminate
- the script for retransmissions and return false for new requests
- (for which no transaction exists yet).
+ * For other requests (non ACKs and non CANCELs), in case of a
+ retransmission matching a transaction, it resends the last reply
+ for that transaction and terminates the config execution.
+ Otherwise, it returns false (in case of new requests for which no
+ transaction exists yet).
Note
diff --git a/modules/tm/doc/functions.xml b/modules/tm/doc/functions.xml
index 84751cc..af7d11d 100644
--- a/modules/tm/doc/functions.xml
+++ b/modules/tm/doc/functions.xml
@@ -1381,9 +1381,11 @@ if (t_check_status("(487)|(408)")) {
</note>
</listitem>
<listitem>
- <para>For other requests (non ACKs and non CANCELs), it will
- terminate the script for retransmissions and return false for
- new requests (for which no transaction exists yet).</para>
+ <para>For other requests (non ACKs and non CANCELs), in case of
+ a retransmission matching a transaction, it resends the last
+ reply for that transaction and terminates the config execution.
+ Otherwise, it returns false (in case of new requests for which
+ no transaction exists yet).</para>
</listitem>
</itemizedlist>
</para>
Hi, I want to realise scheme:
Asterisk->Kamailo->provider
I register several provider accounts at Kamailio using UAC module.
When Client Generates call form Asterisk through Kamailio to provider,
provider sends back 407 response. This reponse must be handled by Kamailio
through failure_route using uac_auth().
I try to catch this response at onreply_route by status and route this
response to failure route (t_on_failure("MY_FAILURE_ROUTE"))but Kamailio
ignores t_on_failure and forward this packet to asterisk (As I think
because asterisk generator of session)
So My question is: How to handle this response at kamailio and not forward
to asterisk?
This is invite that forwards to provider:
INVITE sip:11234567890@my.provider.com:5060 SIP/2.0
Record-Route: <sip:my.kamailio.com:5068;nat=yes;ftag=as57a2d34c;lr=on>
Via: SIP/2.0/UDP my.kamailio.com:5068
;branch=z9hG4bK8544.480e25d0e6a328f5f455233d808cda80.0
Via: SIP/2.0/UDP 10.0.1.6:50600;branch=z9hG4bK778521b0;rport=50600
Max-Forwards: 70
From: "John" <sip:my_provider_acc@my.provider.com:50600>;tag=as57a2d34c
To: <sip:11234567890@my.provider.com:5068>
Contact:<my_provider_acc@my.kamailio.com:5068>
Call-ID: 3d8d6c357d69cdd51633b1c125729f44@10.0.1.6:50600
CSeq: 102 INVITE
User-Agent: Asterisk PBX 12.4.0
Date: Sat, 16 Aug 2014 13:18:52 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO,
PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 540
v=0
o=root 1941643043 1941643043 IN my.kamailio.com
s=Asterisk PBX 12.4.0
c=IN IP4 my.kamailio.com
t=0 0
a=ice-lite
m=audio 30108 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
a=rtcp:30109
a=ice-ufrag:jOv9GFqq
a=ice-pwd:wuXGbJ3ZI7MfwM6kwto78s8reEyU
a=candidate:lzqT8la5i9wkzQzB 1 UDP 2130706431 my.kamailio.com 30108 typ host
a=candidate:lzqT8la5i9wkzQzB 2 UDP 2130706430 my.kamailio.com 30109 typ host
Module: sip-router
Branch: master
Commit: bd12eaf0f26cfca55eda063263109d434be31c60
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bd12eaf…
Author: Richard Good <richard.good(a)smilecoms.com>
Committer: Richard Good <richard.good(a)smilecoms.com>
Date: Mon Aug 18 22:21:13 2014 +0200
modules/ims_qos: ignore reply retransmissions if Rx session being processed
On receipt of Rx_AAR command check if session exists and it is not in state open
If so then assume this is a retransmit and ignore
---
modules/ims_qos/mod.c | 47 +++++++++++++++++++++++++++--------------------
1 files changed, 27 insertions(+), 20 deletions(-)
diff --git a/modules/ims_qos/mod.c b/modules/ims_qos/mod.c
index 7605034..4f82adc 100644
--- a/modules/ims_qos/mod.c
+++ b/modules/ims_qos/mod.c
@@ -378,6 +378,7 @@ void callback_pcscf_contact_cb(struct pcontact *c, int type, void *param) {
static int w_rx_aar(struct sip_msg *msg, char *route, char* str1, char* bar) {
int ret = CSCF_RETURN_ERROR;
+ int result = CSCF_RETURN_ERROR;
struct cell *t;
AAASession* auth_session;
@@ -397,19 +398,19 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* str1, char* bar) {
char* direction = str1;
if (fixup_get_svalue(msg, (gparam_t*) route, &route_name) != 0) {
LM_ERR("no async route block for assign_server_unreg\n");
- return -1;
+ return result;
}
LM_DBG("Looking for route block [%.*s]\n", route_name.len, route_name.s);
int ri = route_get(&main_rt, route_name.s);
if (ri < 0) {
LM_ERR("unable to find route block [%.*s]\n", route_name.len, route_name.s);
- return -1;
+ return result;
}
cfg_action = main_rt.rlist[ri];
if (cfg_action == NULL) {
LM_ERR("empty action lists in route block [%.*s]\n", route_name.len, route_name.s);
- return -1;
+ return result;
}
LM_DBG("Rx AAR called\n");
@@ -419,7 +420,7 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* str1, char* bar) {
//We don't ever do AAR on request for calling scenario...
if (msg->first_line.type != SIP_REPLY) {
LM_DBG("Can't do AAR for call session in request\n");
- return CSCF_RETURN_ERROR;
+ return result;
}
//is it appropriate to send AAR at this stage?
@@ -427,7 +428,7 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* str1, char* bar) {
if (t == NULL || t == T_UNDEFINED) {
LM_WARN("Cannot get transaction for AAR based on SIP Request\n");
//goto aarna;
- return CSCF_RETURN_ERROR;
+ return result;
}
//we dont apply QoS if its not a reply to an INVITE! or UPDATE or PRACK!
@@ -438,39 +439,39 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* str1, char* bar) {
|| cscf_get_content_length(t->uas.request) == 0) {
LM_DBG("No SDP offer answer -> therefore we can not do Rx AAR");
//goto aarna; //AAR na if we dont have offer/answer pair
- return CSCF_RETURN_ERROR;
+ return result;
}
} else {
LM_DBG("Message is not response to INVITE, PRACK or UPDATE -> therefore we do not Rx AAR");
- return CSCF_RETURN_ERROR;
+ return result;
}
/* get callid, from and to tags to be able to identify dialog */
callid = cscf_get_call_id(msg, 0);
if (callid.len <= 0 || !callid.s) {
LM_ERR("unable to get callid\n");
- return CSCF_RETURN_ERROR;
+ return result;
}
if (!cscf_get_from_tag(msg, &ftag)) {
LM_ERR("Unable to get ftag\n");
- return CSCF_RETURN_ERROR;
+ return result;
}
if (!cscf_get_to_tag(msg, &ttag)) {
LM_ERR("Unable to get ttag\n");
- return CSCF_RETURN_ERROR;
+ return result;
}
//check to see that this is not a result of a retransmission in reply route only
if (msg->cseq == NULL
&& ((parse_headers(msg, HDR_CSEQ_F, 0) == -1) || (msg->cseq == NULL))) {
LM_ERR("No Cseq header found - aborting\n");
- return CSCF_RETURN_ERROR;
+ return result;
}
saved_t_data = (saved_transaction_t*) shm_malloc(sizeof (saved_transaction_t));
if (!saved_t_data) {
LM_ERR("Unable to allocate memory for transaction data, trying to send AAR\n");
- return CSCF_RETURN_ERROR;
+ return result;
}
memset(saved_t_data, 0, sizeof (saved_transaction_t));
saved_t_data->act = cfg_action;
@@ -480,7 +481,7 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* str1, char* bar) {
if (!saved_t_data->callid.s) {
LM_ERR("no more memory trying to save transaction state : callid\n");
shm_free(saved_t_data);
- return CSCF_RETURN_ERROR;
+ return result;
}
memset(saved_t_data->callid.s, 0, callid.len + 1);
memcpy(saved_t_data->callid.s, callid.s, callid.len);
@@ -491,7 +492,7 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* str1, char* bar) {
if (!saved_t_data->ttag.s) {
LM_ERR("no more memory trying to save transaction state : ttag\n");
shm_free(saved_t_data);
- return CSCF_RETURN_ERROR;
+ return result;
}
memset(saved_t_data->ttag.s, 0, ttag.len + 1);
memcpy(saved_t_data->ttag.s, ttag.s, ttag.len);
@@ -502,7 +503,7 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* str1, char* bar) {
if (!saved_t_data->ftag.s) {
LM_ERR("no more memory trying to save transaction state : ftag\n");
shm_free(saved_t_data);
- return CSCF_RETURN_ERROR;
+ return result;
}
memset(saved_t_data->ftag.s, 0, ftag.len + 1);
memcpy(saved_t_data->ftag.s, ftag.s, ftag.len);
@@ -512,7 +513,7 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* str1, char* bar) {
int branch;
if (tmb.t_check( msg , &branch )==-1){
LOG(L_ERR, "ERROR: t_suspend: failed find UAC branch\n");
- return CSCF_RETURN_ERROR;
+ return result;
}
//Check that we dont already have an auth session for this specific dialog
@@ -624,13 +625,18 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* str1, char* bar) {
} else {
LM_DBG("Update AAR session for this dialog in mode %s\n", direction);
auth_session = cdpb.AAAGetAuthSession(*rx_session_id);
+ if(auth_session->u.auth.state != AUTH_ST_OPEN)
+ {
+ LM_DBG("This session is not state open, packet will be dropped");
+ result = CSCF_RETURN_FALSE; //here we return FALSE this just drops the message in the config file
+ goto error;
+ }
}
LM_DBG("Suspending SIP TM transaction\n");
if (tmb.t_suspend(msg, &saved_t_data->tindex, &saved_t_data->tlabel) < 0) {
LM_ERR("failed to suspend the TM processing\n");
- free_saved_transaction_global_data(saved_t_data);
- return CSCF_RETURN_ERROR;
+ goto error;
}
LM_DBG("Sending Rx AAR");
@@ -644,7 +650,8 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* str1, char* bar) {
} else {
LM_DBG("Successful async send of AAR\n");
- return CSCF_RETURN_BREAK; //on success we break - because rest of cfg file will be executed by async process
+ result = CSCF_RETURN_BREAK;
+ return result; //on success we break - because rest of cfg file will be executed by async process
}
error:
@@ -659,7 +666,7 @@ error:
must_free_asserted_identity = 1;
}
- return CSCF_RETURN_ERROR;
+ return result;
}
/* Wrapper to send AAR from config file - only used for registration */
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#460 - dispatcher doesn't loadbalance correctly if one target is offline
User who did this - Sebastian Damm (sdamm)
----------
Yes, I'm not using round-robin. I'm dispatching based on the user in the To-URI. This is what we need to use so we know later on where the customer is registered.
I haven't actively disabled the proxy in the config (if I remove it from there, everything works as expected), but the dispatcher kamailio detects that the target is offline.
kamcmd> dispatcher.list
{
SET_NO: 1
SET: {
SET_ID: 1
DEST: {
URI: sip:127.0.0.14:5060
FLAGS: IP
PRIORITY: 0
ATTRS:
}
DEST: {
URI: sip:127.0.0.13:5060
FLAGS: AP
PRIORITY: 0
ATTRS:
}
DEST: {
URI: sip:127.0.0.12:5060
FLAGS: AP
PRIORITY: 0
ATTRS:
}
DEST: {
URI: sip:127.0.0.11:5060
FLAGS: AP
PRIORITY: 0
ATTRS:
}
}
}
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=460#comment1598
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task is now closed:
FS#459 - Dispatcher Round Robin Logic not Working with Dispatcher Table with FQDNs
User who did this - Daniel-Constantin Mierla (miconda)
Reason for closing: Not a bug
Additional comments about closing: Good that you found the reason and fixed it. Thanks for reporting back, I am closing this item as no bug.
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=459
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#460 - dispatcher doesn't loadbalance correctly if one target is offline
User who did this - Sebastian Damm (sdamm)
----------
Sorry, the second screenshot was wrong, was the same as the first one. This is the correct screenshot after proxy4 was shut down.
----------
One or more files have been attached.
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=460#comment1597
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.