[asterisk-bugs] [Asterisk 0013984]: [patch] Incoming Gtalk calls fail

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Jan 9 12:07:32 CST 2009


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13984 
====================================================================== 
Reported By:                jcovert
Assigned To:                phsultan
====================================================================== 
Project:                    Asterisk
Issue ID:                   13984
Category:                   Channels/chan_gtalk
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     ready for testing
Asterisk Version:           SVN 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): 1.6.0 
SVN Revision (number only!): 159700 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-11-27 16:48 CST
Last Modified:              2009-01-09 12:07 CST
====================================================================== 
Summary:                    [patch] Incoming Gtalk calls fail
Description: 
All incoming Gtalk calls are failing.

It appears that something about the responses Asterisk is sending back to
Gtalk are not making Gtalk happy; Gtalk responds with "unknown session".

The caller (see his Buddy info below) continues to hear ringing until
Gtalk finally abandons the call.

/john
        Buddy:  OnStateGTalkTest at gmail.com
                Resource: Talk.v10496F5B39E
                        node: http://www.google.com/xmpp/client/caps
                        version: 1.0.0.104
                        Jingle capable: yes
                Status: 3
                Priority: 24

====================================================================== 

---------------------------------------------------------------------- 
 (0097328) jcovert (reporter) - 2009-01-09 12:07
 http://bugs.digium.com/view.php?id=13984#c97328 
---------------------------------------------------------------------- 
No, your patch does not work.

It sends initiator='/Talk.v1047A074719'

The main problem is with the line below, or similar lines you used:

while ((lowerto != strchr(lowerto, '/')) && (*lowerto++ =
tolower(*to++)));

This modifies 'lowerto' and leaves it pointing to the '/', making it
unsuitable when building the message.

You need to avoid losing the pointer to the duplicated string to use when
you build the message. This is best done with a local variable right inside
the block that moves the data, so that it isn't even allocated unless
needed (most compilers will optimize it into an available register).

And as long as I'm revising your patch, two important changes for
efficiency:

(1) By using strchr(lowerto, '/') you repeatedly execute strchr to search
shorter and shorter segments of the original string for '/' instead of just
comparing the current character.

(2) Since you've already duplicated the string with ast_strdupa, in the
call to "tolower" you can reference the character just checked for "/"
(which is probably available in a register) rather than maintaining and
incrementing another pointer, fetching a separate byte (which on some
machines is expensive) and possibly doing a cache flush because of
accessing a totally different area of memory.  (Sorry, but I spent 18 years
in the OpenVMS operating system group where we care about every machine
cycle.)

And finally you need a #include <ctype.h> because of tolower.

I've uploaded a new patch which I have tested.

/john 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-01-09 12:07 jcovert        Note Added: 0097328                          
======================================================================




More information about the asterisk-bugs mailing list