Bugs item #1721210, was opened at 2007-05-18 13:01 Message generated for change (Comment added) made by bogdan_iancu You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1721210&group_id=139143
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: modules Group: ver 1.1.x Status: Open Resolution: None Priority: 5 Private: No Submitted By: Bernie Hoeneisen (bhoeneis) Assigned to: Bogdan (bogdan_iancu) Summary: Insert Route HF (from Path) messes up if UTF-8 chars around Initial Comment: Hi! I have just submitted a bug report to Debian. For your convenience I mirror it here: Debian Bug report logs - #424984 Package: openser Version: 1.1.0-9etch1 Severity: normal Tags: l10n Hi! I am testing the Path HF usage. When the usage of Path causes a insertion of a Route HF and the (original) SIP INVITE request contains UTF-8 characters, the Route HF gets inserted at the wrong place, e.g. between the <CR> and <LF> (Hexadecimal 0D and 0A) at the end of the From HF: INVITE sip:[EMAIL PROTECTED]:6051;line=nfy9nuy8 SIP/2.0 Record-Route: <sip:127.0.0.1;r2=on;lr=on;ftag=as19d6b213> Record-Route: <sip:130.89.10.194;r2=on;lr=on;ftag=as19d6b213> Remote-Party-ID: "Bernie Höneisen" <sip:[EMAIL PROTECTED]> Via: SIP/2.0/UDP 127.0.0.1;branch=z9hG4bK77a8.e46b2c74.1 Via: SIP/2.0/UDP 130.89.10.195:5060;branch=z9hG4bK53c948e4;rport=5060 From: "Bernie Höneisen" <sip:[EMAIL PROTECTED]>;tag=as19d6b213^MRoute:<sip:130.89.10.194;lr;received=sip:97.56.98.20:3051> To: <sip:[EMAIL PROTECTED]> [....] (This example has been anonymized. Original available on request.) The Hexadecimal code of the UTF-8 char is: C3 B6 (o with Umlaut) I guess the detection for the anchor, where the Route HF has to be inserted gets confused by the UTF-8 character. cheers, Bernie -- System Information: Debian Release: 4.0 APT prefers stable APT policy: (990, 'stable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.18-4-686 Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Versions of packages openser depends on: ii adduser 3.102 Add and remove users and groups ii libc6 2.3.6.ds1-13 GNU C Library: Shared libraries openser recommends no packages. -- no debconf information ---------------------------------------------------------------------- >Comment By: Bogdan (bogdan_iancu) Date: 2007-05-22 22:18 Message: Logged In: YES user_id=1275325 Originator: NO Hi Bernie, I missed your latest comments. With those updates, I think the problem can be easily be avoided by simply not changing the entire FROM header. Use uac_replace_from() for changing the FROM display - the function is safe as it change only the display name and does not alter the entire header. Instead of : subst('/^(From:).*(<sip:[EMAIL PROTECTED]>.*)$/\1 "$avp(s:679) $avp(s:680)" \2/ig') try: if ( $fu=~"sip:[EMAIL PROTECTED]>" ) uac_replace_from("$avp(s:679) $avp(s:680)",""); Anyhow, i will a bit deeper into the problem because in my opinion it should work also with the initial subst - the delete and add lumps for the new from are linked after by the anchor, but the add lump for Route is before the anchor, so not overlapping should occures... Bogdan ---------------------------------------------------------------------- Comment By: Bogdan (bogdan_iancu) Date: 2007-05-21 10:55 Message: Logged In: YES user_id=1275325 Originator: NO Hi Bernie, thanks for the report - could you send me privatly (bogdan at voice-system dot ro) the INVITE before and after the proxy, plus the path string saved in location? I will try to reproduce and fix the problem. Thanks and regards, Bogdan ---------------------------------------------------------------------- Comment By: Andreas Granig (agranig) Date: 2007-05-19 20:37 Message: Logged In: YES user_id=825350 Originator: NO Thanks. I will take care of that. ---------------------------------------------------------------------- Comment By: Bernie Hoeneisen (bhoeneis) Date: 2007-05-19 15:39 Message: Logged In: YES user_id=1441804 Originator: YES Hi (again) I believe to have located the problem an wrote a patch (against the current debian stable, Openser 1.1) to circumvent it: - The Route HF is inserted after the last Via HF, which means right before the From HF (in my case) - If I also change the From HF, I run into the known limitation of OpenSER 'changing a HF twice gets unpredictable results' (lump stuff). It looks like that changing a HF and inserting a HF right before the changed one, ends up in same case as changing the HF twice. - To circumvent the problem I rewrote the file openser/branches/1.1/modules/tm/path.c in such a way, that the Route HF is (if no Route HF present yet) always inserted right before the Call-ID HF, as the Call-ID MUST NOT be changed (unless you are a B2BUA). If there is no Call-ID HF, an error is returned. (This means I presume, that Call-ID must be present and not be changed) Please find the patch in the attachment. I have tested it on my system and it appears to work fine. cheers, Bernie PS: I think this Patch could also be applied to Openser 1.2, but to the new home of insert_path_as_route() (branches/1.2/msg_translator.c) File Added: openser-1.1.0.debian.diff ---------------------------------------------------------------------- Comment By: Bernie Hoeneisen (bhoeneis) Date: 2007-05-18 18:41 Message: Logged In: YES user_id=1441804 Originator: YES I made some further testing. It looks like the reason for the strange behaviour is not the fact, that UTF-8 is around. I figured out, that this behaviour has a different cause. I use a feature, that adds a name to a phone number, when the call is coming from the PSTN and the phonenumber is known (saved in the db). For this I put the following line into the config: subst('/^(From:).*(<sip:[EMAIL PROTECTED]>.*)$/\1 "$avp(s:679) $avp(s:680)" \2/ig') whereas avp(s:679) and avp(s:680) contain first- and lastname from the db. While the above line is commented out, the insertion of the Route HF works correctly. Otherwise it inserts the Route HF between <CR> and <LF>. Thus, it seems that calling the subst() function before the (Path-info) Route HF is inserted causes the problem. cheers, Bernie ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=743020&aid=1721210&group_id=139143 _______________________________________________ Devel mailing list Devel@openser.org http://openser.org/cgi-bin/mailman/listinfo/devel