Module: sip-router
Branch: master
Commit: 3d33733f299dda595704108aef73a2912dc3069f
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3d33733f299dda595704108aef73a2912dc3069f

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date:   Fri Jul 26 14:52:21 2013 +0200

uac_redirect: fixup for using acc table parameter

- set reason parameter for acc function
- based on a patch by  Federico Cabiddu, FS#327

---

 modules/uac_redirect/rd_funcs.c |    4 +++
 modules/uac_redirect/redirect.c |   40 +++++++++++++++++++++++---------------
 2 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/modules/uac_redirect/rd_funcs.c b/modules/uac_redirect/rd_funcs.c
index 89917f7..ca34e0c 100644
--- a/modules/uac_redirect/rd_funcs.c
+++ b/modules/uac_redirect/rd_funcs.c
@@ -57,6 +57,7 @@ int get_redirect( struct sip_msg *msg , int maxt, int maxb,
        int n;
        int i;
        int first_branch;
+       char code_buf[INT2STR_MAX_LEN];
 
        /* get transaction */
        t = rd_tmb.t_gett();
@@ -95,6 +96,9 @@ int get_redirect( struct sip_msg *msg , int maxt, int maxb,
                }
                if (max==0)
                        continue;
+               /* put the response code into the acc_param reason struct */
+               reason->code = t->uac[i].last_received;
+               reason->code_s.s = int2bstr((unsigned long)reason->code, 
code_buf, &reason->code_s.len);
                /* get the contact from it */
                n = shmcontact2dset( msg, t->uac[i].reply, max, reason, bflags);
                if ( n<0 ) {
diff --git a/modules/uac_redirect/redirect.c b/modules/uac_redirect/redirect.c
index b4e55d1..48dec84 100644
--- a/modules/uac_redirect/redirect.c
+++ b/modules/uac_redirect/redirect.c
@@ -164,25 +164,24 @@ static int get_redirect_fixup(void** param, int param_no)
 
                pkg_free(*param);
                *param=(void*)(long)( (((unsigned short)maxt)<<8) | maxb);
-
        } else if (param_no==2) {
                /* acc function loaded? */
-               if (rd_acc_fct!=0)
-                       return 0;
-               /* must import the acc stuff */
-               if (acc_fct_s==0 || acc_fct_s[0]==0) {
-                       LM_ERR("acc support enabled, but no acc function 
defined\n");
-                       return E_UNSPEC;
-               }
-               fct = find_export(acc_fct_s, 2, REQUEST_ROUTE);
-               if ( fct==0 )
-                       fct = find_export(acc_fct_s, 1, REQUEST_ROUTE);
-               if ( fct==0 ) {
-                       LM_ERR("cannot import %s function; is acc loaded and 
proper "
-                               "compiled?\n", acc_fct_s);
-                       return E_UNSPEC;
+               if (rd_acc_fct==0) {
+                       /* must import the acc stuff */
+                       if (acc_fct_s==0 || acc_fct_s[0]==0) {
+                               LM_ERR("acc support enabled, but no acc 
function defined\n");
+                               return E_UNSPEC;
+                       }
+                       fct = find_export(acc_fct_s, 2, REQUEST_ROUTE);
+                       if ( fct==0 )
+                               fct = find_export(acc_fct_s, 1, REQUEST_ROUTE);
+                       if ( fct==0 ) {
+                               LM_ERR("cannot import %s function; is acc 
loaded and proper "
+                                       "compiled?\n", acc_fct_s);
+                               return E_UNSPEC;
+                       }
+                       rd_acc_fct = fct;
                }
-               rd_acc_fct = fct;
                /* set the reason str */
                accp = (struct acc_param*)pkg_malloc(sizeof(struct acc_param));
                if (accp==0) {
@@ -264,6 +263,7 @@ static int regexp_compile(char *re_s, regex_t **re)
 static int redirect_init(void)
 {
        regex_t *filter;
+       void *p;
 
        /* load the TM API */
        if (load_tm_api(&rd_tmb)!=0) {
@@ -271,6 +271,14 @@ static int redirect_init(void)
                goto error;
        }
 
+       p = (void*)acc_db_table;
+       /* fixup table name */
+       if(fixup_var_pve_str_12(&p, 1)<0) {
+               LM_ERR("failed to fixup acc db table\n");
+               goto error;
+       }
+       acc_db_table = p;
+
        /* init filter */
        init_filters();
 


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to