[asterisk-users] Alcatel OXO Sip

Brian Candler B.Candler at pobox.com
Tue Sep 19 06:25:12 MST 2006

On Tue, Sep 19, 2006 at 04:41:42AM -0700, Steve Langstaff wrote:
> Oops! Yes, I was confusing strcmp and strcasecmp, sorry - too little
> coffee.
> However, it's funny that the strcasecmp of "SIP/2.0/UDP" fails to match
> with "SIP/2.0/udp".

cat <<END >foo.c
#include <stdio.h>
#include <string.h>
int main(void)
    char *via = "SIP/2.0/udp";
    printf("Answer=%d\n", strcasecmp(via, "SIP/2.0/UDP"));
    return 0;
gcc -Wall -o foo foo.c

for me prints "Answer=0"

Are you sure that the value for "via" should match? Perhaps it includes some
hidden control characters which the log message is hiding.

You could try adding something like this (untested):

> > > 		if (strcasecmp(via, "SIP/2.0/UDP")) {
> > > 			ast_log(LOG_WARNING, "Don't know how to respond via '%s'\n", via);

                  ast_log(LOG_WARNING, "strlen(via)=%d", (int)strlen(via));
                      int i;
                      for (i=0; i<strlen(via); i++)
                          ast_log(LOG_WARNING, "via[%d] = %02X\n", i, via[i]);

> > > 			return -1;
> > > 		}

Then paste the log messages here. If you make an extraordinary claim (that
the libc strcasecmp() function is failing) then you need extraordinary
evidence :-)



More information about the asterisk-users mailing list