Module: sip-router Branch: master Commit: bdbacf559134022856f5723a91fe7e130ceada29 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bdbacf55...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Fri Jan 20 19:06:59 2012 +0100
pua_usrloc: added branch_flag parameter
- mark the contact for sending PUBLISH via setbflag(branch_flag)
---
modules_k/pua_usrloc/pua_usrloc.c | 9 ++++++++- modules_k/pua_usrloc/pua_usrloc.h | 3 +++ modules_k/pua_usrloc/ul_publish.c | 14 ++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/modules_k/pua_usrloc/pua_usrloc.c b/modules_k/pua_usrloc/pua_usrloc.c index 9dcf27e..e3d676d 100644 --- a/modules_k/pua_usrloc/pua_usrloc.c +++ b/modules_k/pua_usrloc/pua_usrloc.c @@ -59,7 +59,11 @@ MODULE_VERSION
str default_domain= {NULL, 0}; -int pua_ul_publish= 0; + +int pua_ul_publish = 0; +int pua_ul_bflag = -1; +int pua_ul_bmask = 0; + pua_api_t pua; str pres_prefix= {0, 0};
@@ -85,6 +89,7 @@ static cmd_export_t cmds[]= static param_export_t params[]={ {"default_domain", STR_PARAM, &default_domain.s }, {"entity_prefix", STR_PARAM, &pres_prefix.s }, + {"branch_flag", INT_PARAM, &pua_ul_bflag }, {0, 0, 0 } };
@@ -200,6 +205,8 @@ static int mod_init(void) return -1; }
+ if(pua_ul_bflag!=-1) + pua_ul_bmask = 1 << pua_ul_bflag;
return 0; } diff --git a/modules_k/pua_usrloc/pua_usrloc.h b/modules_k/pua_usrloc/pua_usrloc.h index c8e7c30..76774d2 100644 --- a/modules_k/pua_usrloc/pua_usrloc.h +++ b/modules_k/pua_usrloc/pua_usrloc.h @@ -40,4 +40,7 @@ void ul_publish(ucontact_t* c, int type, void* param); int pua_unset_publish(struct sip_msg* msg, unsigned int flags, void* param);
extern str pres_prefix; +extern int pua_ul_bflag; +extern int pua_ul_bmask; + #endif diff --git a/modules_k/pua_usrloc/ul_publish.c b/modules_k/pua_usrloc/ul_publish.c index d9c4ad0..4eaf7a9 100644 --- a/modules_k/pua_usrloc/ul_publish.c +++ b/modules_k/pua_usrloc/ul_publish.c @@ -39,6 +39,7 @@ #include "../../parser/parse_expires.h" #include "../../parser/msg_parser.h" #include "../../str.h" +#include "../../dset.h" #include "../usrloc/usrloc.h" #include "../usrloc/ul_callback.h" #include "../../modules/tm/tm_load.h" @@ -50,12 +51,16 @@ int pua_set_publish(struct sip_msg* msg , char* s1, char* s2) { LM_DBG("set send publish\n"); pua_ul_publish= 1; + if(pua_ul_bmask!=0) + setbflag(0, pua_ul_bflag); return 1; }
int pua_unset_publish(struct sip_msg* msg, unsigned int flags, void* param) { pua_ul_publish= 0; + if(pua_ul_bmask!=0) + resetbflag(0, pua_ul_bflag); return 1; }
@@ -206,11 +211,16 @@ void ul_publish(ucontact_t* c, int type, void* param) content_type.s= "application/pidf+xml"; content_type.len= 20;
- if(pua_ul_publish== 0) + if(pua_ul_publish==0 && pua_ul_bmask==0) { LM_INFO("should not send ul publish\n"); return; - } + } + if(pua_ul_bmask!=0 && (c->cflags & pua_ul_bmask)==0) + { + LM_INFO("not marked for publish\n"); + return; + }
if(type & UL_CONTACT_DELETE) { LM_DBG("\nDELETE type\n");