Module: sip-router
Branch: 3.2
Commit: 17773ed1cbc99f1b61a9920f42e5019336e8b5b3
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=17773ed…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Sun Dec 11 00:02:14 2011 +0100
async: cfg functions cannot be used in branch_route
- that routing block is processing outgoing brnaches, not requests
- reported by Jasmin Schnatterbeck, FS#190
(cherry picked from commit 22278ed608d598ac353b32cd44517e961faa41b3)
---
modules/async/async_mod.c | 4 ++--
modules/async/doc/async_admin.xml | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/modules/async/async_mod.c b/modules/async/async_mod.c
index 17c7179..26e94b7 100644
--- a/modules/async/async_mod.c
+++ b/modules/async/async_mod.c
@@ -56,9 +56,9 @@ struct tm_binds tmb;
static cmd_export_t cmds[]={
{"async_route", (cmd_function)w_async_route, 2, fixup_async_route,
- 0, REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE},
+ 0, REQUEST_ROUTE|FAILURE_ROUTE},
{"async_sleep", (cmd_function)w_async_sleep, 1, fixup_async_sleep,
- 0, REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE},
+ 0, REQUEST_ROUTE|FAILURE_ROUTE},
{0, 0, 0, 0, 0, 0}
};
diff --git a/modules/async/doc/async_admin.xml b/modules/async/doc/async_admin.xml
index 37b9a75..9087f62 100644
--- a/modules/async/doc/async_admin.xml
+++ b/modules/async/doc/async_admin.xml
@@ -112,6 +112,8 @@ modparam("async", "workers", 2)
that the execution of config after resume will end once the
route[routename] is finished.
</para>
+ <para>
+ This function can be used from REQUEST_ROUTE.
<example>
<title><function>async_sleep</function> usage</title>
<programlisting format="linespecific">
@@ -148,6 +150,8 @@ route[RESUME] {
that the execution of config after resume will end once the route block
where async_sleep() is called is finished.
</para>
+ <para>
+ This function can be used from REQUEST_ROUTE.
<example>
<title><function>async_sleep</function> usage</title>
<programlisting format="linespecific">
Module: sip-router
Branch: 3.2
Commit: 047f66369f0c3eaa75592942f56565eb0f39f848
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=047f663…
Author: pd <peter.dunkley(a)crocodile-rcs.com>
Committer: pd <peter.dunkley(a)crocodile-rcs.com>
Date: Fri Jan 27 15:34:16 2012 +0000
modules_k/pua: Fixed race hazard relating to RLS back-end SUBSCRIBEs
- This resulted in the "no presence dialog record for non-TERMINATED state..."
error message coming out of RLS a lot.
- On the sending side you have can have two dialogs (one temporary and one full)
stored for a short period of time. This is because the full dialog is written
before the temporary one is deleted. This can make the lookup when a back-end
NOTIFY is received fail because only one record is expected. This is now
fixed - instead of inserting and then deleting we do a swap (while the hash
table is locked).
- Based on... (cherry picked from commit e627bc31776b521a1078b2a004e8ed179521cae2)
---
modules_k/pua/hash.c | 48 ++++++++++++++++++++++++++-------------
modules_k/pua/hash.h | 1 +
modules_k/pua/send_subscribe.c | 16 ++++++++-----
3 files changed, 43 insertions(+), 22 deletions(-)
diff --git a/modules_k/pua/hash.c b/modules_k/pua/hash.c
index 805be74..1b6784c 100644
--- a/modules_k/pua/hash.c
+++ b/modules_k/pua/hash.c
@@ -215,33 +215,28 @@ void update_htable(ua_pres_t* p, time_t desired_expires, int expires,
}
}
/* insert in front; so when searching the most recent result is returned*/
-void insert_htable(ua_pres_t* presentity)
+void _insert_htable(ua_pres_t* presentity, unsigned int hash_code)
{
ua_pres_t* p= NULL;
- unsigned int hash_code;
-
- hash_code= core_hash(presentity->pres_uri,presentity->watcher_uri,
- HASH_SIZE);
-
- lock_get(&HashT->p_records[hash_code].lock);
-/*
- * useless since always checking before calling insert
- if(get_dialog(presentity, hash_code)!= NULL )
- {
- LM_DBG("Dialog already found- do not insert\n");
- return;
- }
-*/
p= HashT->p_records[hash_code].entity;
presentity->db_flag= INSERTDB_FLAG;
presentity->next= p->next;
p->next= presentity;
+}
- lock_release(&HashT->p_records[hash_code].lock);
+void insert_htable(ua_pres_t* presentity)
+{
+ unsigned int hash_code;
+
+ hash_code= core_hash(presentity->pres_uri,presentity->watcher_uri, HASH_SIZE);
+ lock_get(&HashT->p_records[hash_code].lock);
+
+ _insert_htable(presentity, hash_code);
+ lock_release(&HashT->p_records[hash_code].lock);
}
/* This function used to perform a search to find the hash table
@@ -302,6 +297,27 @@ void destroy_htable(void)
return;
}
+int convert_temporary_dialog(ua_pres_t *dialog)
+{
+ ua_pres_t *temp_dialog;
+ unsigned int hash_code;
+
+ hash_code= core_hash(dialog->pres_uri,dialog->watcher_uri, HASH_SIZE);
+ lock_get(&HashT->p_records[hash_code].lock);
+
+ temp_dialog = get_temporary_dialog(dialog, hash_code);
+ if (temp_dialog)
+ delete_htable(temp_dialog, hash_code);
+ else
+ return -1;
+
+ _insert_htable(dialog, hash_code);
+
+ lock_release(&HashT->p_records[hash_code].lock);
+
+ return 1;
+}
+
/* must lock the record line before calling this function*/
ua_pres_t* get_dialog(ua_pres_t* dialog, unsigned int hash_code)
{
diff --git a/modules_k/pua/hash.h b/modules_k/pua/hash.h
index 141296f..c2204c4 100644
--- a/modules_k/pua/hash.h
+++ b/modules_k/pua/hash.h
@@ -126,6 +126,7 @@ int is_dialog(ua_pres_t* dialog);
ua_pres_t* get_dialog(ua_pres_t* dialog, unsigned int hash_code);
ua_pres_t* get_temporary_dialog(ua_pres_t* dialog, unsigned int hash_code);
+int convert_temporary_dialog(ua_pres_t *dialog);
int get_record_id(ua_pres_t* dialog, str** rec_id);
typedef int (*get_record_id_t)(ua_pres_t* dialog, str** rec_id);
diff --git a/modules_k/pua/send_subscribe.c b/modules_k/pua/send_subscribe.c
index 08e3d3d..c4caad1 100644
--- a/modules_k/pua/send_subscribe.c
+++ b/modules_k/pua/send_subscribe.c
@@ -612,7 +612,11 @@ void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps)
LM_DBG("record for subscribe from %.*s to %.*s inserted in datatbase\n",
presentity->watcher_uri->len, presentity->watcher_uri->s,
presentity->pres_uri->len, presentity->pres_uri->s);
- insert_htable(presentity);
+ if (convert_temporary_dialog(presentity) < 0)
+ {
+ LM_ERR("Could not convert temporary dialog into a dialog\n");
+ goto error;
+ }
done:
if(hentity->ua_flag == REQ_OTHER)
@@ -620,13 +624,13 @@ done:
hentity->flag= flag;
run_pua_callbacks( hentity, msg);
}
+ goto end;
+
error:
- lock_get(&HashT->p_records[hash_code].lock);
- presentity = get_temporary_dialog(hentity, hash_code);
- if (presentity!=NULL)
- delete_htable(presentity, hash_code);
- lock_release(&HashT->p_records[hash_code].lock);
+ if (presentity->remote_contact.s) shm_free(presentity->remote_contact.s);
+ if (presentity) shm_free(presentity);
+end:
if(hentity)
{
shm_free(hentity);
Module: sip-router
Branch: master
Commit: e627bc31776b521a1078b2a004e8ed179521cae2
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e627bc3…
Author: pd <peter.dunkley(a)crocodile-rcs.com>
Committer: pd <peter.dunkley(a)crocodile-rcs.com>
Date: Fri Jan 27 15:34:16 2012 +0000
modules_k/pua: Fixed race hazards relating to RLS back-end SUBSCRIBEs
- These resulted in the "no presence dialog record for non-TERMINATED state..."
error message coming out of RLS a lot.
- When in DB only mode if we receive a back-end NOTIFY we look for a matching
dialog. If we don't find one we search the DB again for a matching temporary
dialog. You can get the situation where both DB queries fail because a 200
OK to a SUBSCRIBE is processed and the dialog made "complete" between the
two searches. This is now fixed.
- On the sending side (for both hash table and DB only mode) you have can have
two dialogs (one temporary and one full) stored for a short period of time.
This is because the full dialog is written before the temporary one is
deleted. This can make the lookup when a back-end NOTIFY is received fail
because only one record is expected. This is now fixed - instead of
inserting and then deleting we do a swap (while the hash table is locked) and
an update operation on the DB.
---
modules_k/pua/hash.c | 48 +++++++---
modules_k/pua/hash.h | 1 +
modules_k/pua/pua_db.c | 200 +++++++++++++++++++++++++++++++++++-----
modules_k/pua/pua_db.h | 1 +
modules_k/pua/send_subscribe.c | 45 ++++------
5 files changed, 226 insertions(+), 69 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=e62…
Module: sip-router
Branch: master
Commit: a684e393bce00a89c9aa66647472b56dea567c2e
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a684e39…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Juha Heinanen <jh(a)tutpro.com>
Date: Fri Jan 27 04:53:47 2012 +0200
modules_k/siputils: allow use of is_uri_user_e164() from any route.
---
modules_k/siputils/README | 2 +-
modules_k/siputils/doc/siputils_admin.xml | 2 +-
modules_k/siputils/siputils.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules_k/siputils/README b/modules_k/siputils/README
index 87b30b1..91335cb 100644
--- a/modules_k/siputils/README
+++ b/modules_k/siputils/README
@@ -547,7 +547,7 @@ if (is_e164("$avp(i:705)") {
Checks if userpart of URI stored in pseudo variable is E164 number.
- This function can be used from REQUEST_ROUTE and FAILURE_ROUTE.
+ This function can be used from ANY_ROUTE.
Example 1.19. is_uri_user_e164 usage
...
diff --git a/modules_k/siputils/doc/siputils_admin.xml b/modules_k/siputils/doc/siputils_admin.xml
index dd7a4ae..06eb130 100644
--- a/modules_k/siputils/doc/siputils_admin.xml
+++ b/modules_k/siputils/doc/siputils_admin.xml
@@ -560,7 +560,7 @@ if (is_e164("$avp(i:705)") {
E164 number.
</para>
<para>
- This function can be used from REQUEST_ROUTE and FAILURE_ROUTE.
+ This function can be used from ANY_ROUTE.
</para>
<example>
<title><function>is_uri_user_e164</function> usage</title>
diff --git a/modules_k/siputils/siputils.c b/modules_k/siputils/siputils.c
index b5c9806..e82be24 100644
--- a/modules_k/siputils/siputils.c
+++ b/modules_k/siputils/siputils.c
@@ -133,7 +133,7 @@ static cmd_export_t cmds[]={
{"is_e164", (cmd_function)is_e164, 1, fixup_pvar_null,
fixup_free_pvar_null, REQUEST_ROUTE|FAILURE_ROUTE|LOCAL_ROUTE},
{"is_uri_user_e164", (cmd_function)w_is_uri_user_e164, 1, fixup_pvar_null,
- fixup_free_pvar_null, REQUEST_ROUTE|FAILURE_ROUTE|LOCAL_ROUTE},
+ fixup_free_pvar_null, ANY_ROUTE},
{"encode_contact", (cmd_function)encode_contact, 2, 0,
0, REQUEST_ROUTE|ONREPLY_ROUTE},
{"decode_contact", (cmd_function)decode_contact, 0, 0,