Hi, it would be great if TM implements RFC 3326 by adding a Reason header in
CANCEL. I explain the use cases:
1) Parallel forking:
- alice calls bob through Proxy.
- Proxy does parallel forking to two locations from which bob is registered
(bob1 and bob2).
- Both phones ring. After a while bob2 answers.
- Proxy generates a CANCEL for bob1 and includes a header:
Reason: SIP ;cause=200 ;text="Call completed elsewhere"
- By inspecting such header (cause=200) bob1 device decides not to include
this call in the list of "missed calls".
2) Propagating CANCEL + Reason from an application server or PBX.
- alice calls bob through PBX.
- The PBX "forkes" (no need to really fork as it's a B2BUA/UAC and could just
generate two different INVITE), and calls to bob's SIP phone and bob's mobile
(through a PSTN gateway).
- The INVITE to bob's SIP phone is sent to bob's inbound Proxy. The Proxy
routes the request to the location of bob.
- Bob human was out so answers the call in his mobile.
- The PBX sends a CANCEL to Proxy including the header:
Reason: SIP ;cause=200 ;text="Call completed elsewhere"
- Such CANCEL arrives to Proxy. As CANCEL is hop by hop the Proxy generates
its own CANCEL but due to local policy (i.e. the CANCEL comes from the trusted
PBX) it *propagates* the Reason header.
- Again bob's SIP phone receives the CANCEL with such Reason header and
decides not to include this call in the list of "missed calls".
This is very useful feature IMHO as bob won't waste time by calling to all of
those non real "missed" calls.
At implementation level I would consider the following:
- Case 1 doesn't require parameters or script decissions (IMHO) so it's safe
to add Reason header in a CANCEL when cancelling a branch (in parallel
forking).
- Case 2 requires a local policy as it wouldn't be safe to propagate any
Reason header coming in a CANCEL from any sender (imagine you receive a
malicius call at 5 o'clock in the night and the hacker added "Reason" header
to the CANCEL so you don't find that call in the missed calls list of the
phone).
- This local policy could be implemented as follows:
a) Enabling a flag in t_relay() that only makes sense for CANCEL rather than
INVITE, so:
if (is_method("CANCEL")) {
if ($si == MY_APPLICATION_SERVER_IP)
# Allow propagating "Reason" header.
t_relay(0x12);
else
t_relay();
}
or a explicit flag:
if (is_method("CANCEL")) {
if ($si == MY_APPLICATION_SERVER_IP)
setflag(FLAG_ALLOW_CANCEL_REASON);
t_relay();
}
As a side note, Asterisk does implement this Reason header when calls to
various phones for the same call. Also, this feature is implemented in
OpenSIPS TM module (case 1 is already implemented and case 2 will be
implemented soon).
Do you consider feasible implementing it? opinnions?
I would like to try it by myself, but being the serious TM module I would like
to know your opinnions first :)
Regards.
--
Iñaki Baz Castillo <ibc(a)aliax.net>
Module: sip-router
Branch: kamailio_3.0
Commit: 59907c49af12496af3d85e74ef52e67055cf610f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=59907c4…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Wed Feb 10 07:15:24 2010 +0200
modules_k/permissions: group identifier must be positive integer
- Group Identifier in address permissions must have a positive integer
value.
(cherry picked from commit c67e72eb16f277eeae16182e15e0e8ebf319dce0)
---
modules_k/permissions/README | 4 ++--
modules_k/permissions/address.c | 1 +
modules_k/permissions/doc/permissions_admin.xml | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules_k/permissions/README b/modules_k/permissions/README
index a3406f2..ff0959f 100644
--- a/modules_k/permissions/README
+++ b/modules_k/permissions/README
@@ -276,8 +276,8 @@ Chapter 1. Admin Guide
(allow_source_address) or given as pvar arguments (allow_address).
Addresses stored in cached database table can be grouped together into
- one or more groups specified by a group identifier (unsigned integer).
- Group identifier is given as argument to allow_address and
+ one or more groups specified by a group identifier (positive integer
+ value). Group identifier is given as argument to allow_address and
allow_source_address functions.
1.5. Trusted Requests
diff --git a/modules_k/permissions/address.c b/modules_k/permissions/address.c
index e40e510..126c8d8 100644
--- a/modules_k/permissions/address.c
+++ b/modules_k/permissions/address.c
@@ -114,6 +114,7 @@ int reload_address_table(void)
val = ROW_VALUES(row + i);
if ((ROW_N(row + i) == 4) &&
(VAL_TYPE(val) == DB1_INT) && !VAL_NULL(val) &&
+ (VAL_INT(val) > 0) &&
(VAL_TYPE(val + 1) == DB1_STRING) && !VAL_NULL(val + 1) &&
inet_aton((char *)VAL_STRING(val + 1), &ip_addr) != 0 &&
(VAL_TYPE(val + 2) == DB1_INT) && !VAL_NULL(val + 2) &&
diff --git a/modules_k/permissions/doc/permissions_admin.xml b/modules_k/permissions/doc/permissions_admin.xml
index 4ad28b7..06512a9 100644
--- a/modules_k/permissions/doc/permissions_admin.xml
+++ b/modules_k/permissions/doc/permissions_admin.xml
@@ -179,7 +179,7 @@
<para>
Addresses stored in cached database table can be grouped
together into one or more groups specified by a group
- identifier (unsigned integer). Group
+ identifier (positive integer value). Group
identifier is given as argument to allow_address and
allow_source_address functions.
</para>
Hi all,
we had problems with some callback-functions. The problem is isolated to
the unref_new_dialog function in dlg_handlers.c
If the whole tmcb_params structure is not initialized, we run into
segfaults in a later usage.
here a patch for this problem ("inspired" by openSIPS code)
@@ -417,7 +420,7 @@
void unref_new_dialog(void *dialog)
{
struct tmcb_params p;
-
+ memset(&p, 0, sizeof(struct tmcb_params));
p.param = (void*)&dialog;
dlg_onreply(0, TMCB_TRANS_DELETED, &p);
}
Down below the whole patch for the dlg_handlers.c file, the second thing
is a extra control part for FAKED_REPLY's in the dlg_onreply function.
I hope this is useful.
best regards
Torben Friese
Index: modules/dialog/dlg_handlers.c
===================================================================
--- modules/dialog/dlg_handlers.c (revision 5983)
+++ modules/dialog/dlg_handlers.c (working copy)
@@ -280,24 +280,27 @@
if (new_state==DLG_STATE_CONFIRMED_NA &&
old_state!=DLG_STATE_CONFIRMED_NA && old_state!=DLG_STATE_CONFIRMED )
{
LM_DBG("dialog %p confirmed\n",dlg);
-
- /* get to tag*/
- if ( !rpl->to && ((parse_headers(rpl, HDR_TO_F,0)<0) || !rpl->to) ) {
- LM_ERR("bad reply or missing TO hdr :-/\n");
- tag.s = 0;
- tag.len = 0;
- } else {
- tag = get_to(rpl)->tag_value;
- if (tag.s==0 || tag.len==0) {
- LM_ERR("missing TAG param in TO hdr :-/\n");
+ if (rpl != FAKED_REPLY) {
+ /* get to tag*/
+ if ( !rpl->to && ((parse_headers(rpl, HDR_TO_F,0)<0) || !rpl->to) )
{
+ LM_ERR("bad reply or missing TO hdr :-/\n");
tag.s = 0;
tag.len = 0;
+ } else {
+ tag = get_to(rpl)->tag_value;
+ if (tag.s==0 || tag.len==0) {
+ LM_ERR("missing TAG param in TO hdr :-/\n");
+ tag.s = 0;
+ tag.len = 0;
+ }
}
- }
- /* save callee's tag, cseq, contact and record route*/
- if (populate_leg_info( dlg, rpl, t, DLG_CALLEE_LEG, &tag) !=0) {
- LM_ERR("could not add further info to the dialog\n");
+ /* save callee's tag, cseq, contact and record route*/
+ if (populate_leg_info( dlg, rpl, t, DLG_CALLEE_LEG, &tag) !=0) {
+ LM_ERR("could not add further info to the dialog\n");
+ }
+ } else {
+ LM_ERR("Faked reply!\n");
}
/* set start time */
@@ -417,7 +420,7 @@
void unref_new_dialog(void *dialog)
{
struct tmcb_params p;
-
+ memset(&p, 0, sizeof(struct tmcb_params));
p.param = (void*)&dialog;
dlg_onreply(0, TMCB_TRANS_DELETED, &p);
}