Hi.

I think there is a bug in function search_hf_f() in textops.c

Here is what I do

      if ( method == SUBSCRIBE ) {
                if ( !search_hf("Event", "call-completion", "f") ) {
                        sl_send_reply("489","Bad Event");
                        exit;
                }
        }

But here is a SUBSCRIBE that do pass the proxy.


SUBSCRIBE sip:101@192.168.1.50 SIP/2.0
Via: SIP/2.0/UDP 77.10.66.72:59793;branch=z9hG4bKPj.O5IXVtDsImPNfCGnDkvj91INsEfvZsm
Max-Forwards: 70
From: <sip:101@192.168.1.50>;tag=8-cXkrmwx5WGSIAYgYaXW0oTTsEAEM1S
To: <sip:101@192.168.1.50>
Contact: <sip:101@192.168.1.8:59793;ob>
Call-ID: O12dPIx7Wiih2b.o36UFmMdXr6RE-8Jl
CSeq: 24359 SUBSCRIBE
Route: <sip:192.168.1.50;transport=udp;lr>
Event: message-summary
Expires: 3600
Supported: replaces, 100rel, timer, norefersub
Accept: application/simple-message-summary
Allow-Events: presence, message-summary, refer
User-Agent: CSipSimple_mako-21/r2457
Content-Length:  0


As you can see the Event header doesn't contain "call-completition".


Looking at function search_hf_f() i saw that if nothing  is found value -1 will be returned. if there is the match then 1 is returned. (see line 2779 and 2797)
But in line 2782 the function will return 1 instead of -1


index 50a6f07..a945937 100644
--- a/modules/textops/textops.c
+++ b/modules/textops/textops.c
@@ -2779,7 +2779,7 @@ static int search_hf_f(struct sip_msg* msg, char* str_hf, char* re, char *flags)
                                        return 1;
                        } else {
                                if(flags!=NULL && *flags=='f')
-                                       return 1;
+                                       return -1;
                        }
                } else {
                        hfl = hf;


I am no programmer so it's possible that I misunderstood something.


greetz
Paolo