songmonit / sipml5

Automatically exported from code.google.com/p/sipml5
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Display Name in From header not propagated to getRemoteFriendlyName() #134

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
a) Before posting your issue you MUST answer to the questions otherwise it
will be rejected (invalid status) by us
b) Please check the issue tacker to avoid duplication
c) Please provide network capture (Wireshark) or Javascript console log
if you want quick response

What steps will reproduce the problem?
1. Place an incoming INVITE with a 'Display Name' set in the 'From' header
2. A call to session.getRemoteFriendlyName() will not show the 'Display Name', 
but rather the 'user' field from the sip address in the 'From' header.
3.

What is the expected output? What do you see instead?
Expected output is that getRemoteFriendlyName() should return the 'Display 
Name'. It return the 'user' part from the sip URI instead.

What version of the product are you using? On what operating system?
Chrome 30.0.1599.101 m
OS: Windows 7
Sipml5: trunk/r213

Please provide any additional information below.

The error is only important if the 'Display Name' is different from the 'user' 
field. If using CID prefix in a SIP PBX this functionality will be broken when 
using SIPml5 as a SIP client (since the whole field is simply ignored). 

The issue was detected using FreePBX 2.11.0.11 (basically Asterisk 
functionality) and adding a CID prefix to an incoming queue.

From looking at the SIPml5 source code it seems that the clone function in 
tsip_uri.js ignores the s_display_name field. The following change fixed the 
issue for me (even though probably not the correct way of solving it):

In file ../sipml5/src/tinySIP/src/tsip_uri.js:

tsip_uri.prototype.clone = function (b_with_params, b_quote) {
    var s_str = tsip_uri_tostring(this, b_with_params, b_quote);
    if (s_str) {
        var clonedUri = tsip_uri.prototype.Parse(s_str);
    clonedUri.s_display_name = this.s_display_name;
    return clonedUri;
    }
    return null;
}

instead of 

tsip_uri.prototype.clone = function (b_with_params, b_quote) {
    var s_str = tsip_uri_tostring(this, b_with_params, b_quote);
    if (s_str) {
        return tsip_uri.prototype.Parse(s_str);
    }
    return null;
}

================================
Snips from the Javascript console:

recv=INVITE sip:77904@df7jal23ls0d.invalid;rtcweb-breaker=no;transport=ws 
SIP/2.0
Via: SIP/2.0/WS 1.2.3.4:5060;rport;branch=z9hG4bK01b63a26
From: "LEA:91194712"<sip:91194712@1.2.3.4>;tag=as697548d4
To: <sip:77904@df7jal23ls0d.invalid;rtcweb-breaker=no;transport=ws>
Contact: <sip:91194712@1.2.3.4:5060;transport=WS>
Call-ID: 34e3c005082aa63560fd78886a0420f5@1.2.3.4:5060
CSeq: 102 INVITE
Content-Type: application/sdp
Content-Length: 590
Max-Forwards: 70
User-Agent: FPBX-2.11.0(11.4.0)
Date: 25 Oct 2013 11:21:03 GMT;25
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY,INFO,PUBLISH
Supported: replaces,timer

Original issue reported on code.google.com by leif.ein...@gmail.com on 25 Oct 2013 at 11:51