hungkhang / sipservlets

Automatically exported from code.google.com/p/sipservlets
0 stars 0 forks source link

Impossible to add address parameter to From Header #245

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
From section "4.1.2 The From and To Header Fields" of "SIP Servlet 
Specification, version 1.1"

This specification allows modifications to all parts of the From and To headers 
except the tag parameter. From and To headers are still considered system 
headers with respect to the tags (tag parameters). Containers should preserve 
any changes to the From and To headers in mid-dialog and use the updated ones 
for any subsequent requests in the dialog.

What steps will reproduce the problem?
1. I need to add "epid" parameter to From header of my request as described in 
http://msdn.microsoft.com/en-us/library/dd921411%28v=office.12%29.aspx
In that case it should looks like:
From: <sip:alice@contoso.com>;tag=33975904fc;epid=01010101

2. My test code:

java.util.Properties jndiProps = new java.util.Properties();
javax.naming.Context initCtx = new javax.naming.InitialContext(jndiProps);
javax.naming.Context envCtx = 
(javax.naming.Context)initCtx.lookup("java:comp/env");
javax.servlet.sip.SipFactory sipFactory = 
(javax.servlet.sip.SipFactory)envCtx.lookup("sip/ClickToCallAsyncApplication/Sip
Factory");

javax.servlet.sip.SipApplicationSession sipApplicationSession =  
sipFactory.createApplicationSession();

javax.servlet.sip.SipServletRequest sipReq = 
sipFactory.createRequest(sipApplicationSession,
                                                     "INVITE",
                                                     "sip:test@example.com",
                                                     "sip:192.168.1.100:5064");
sipReq.getFrom().setDisplayName("Test name");
sipReq.getFrom().setParameter("epid", "00112233");

final Address address = 
sipFactory.createAddress(sipFactory.createURI("sip:test@address.example.com"));
address.setParameter("epid", "bzz");
sipReq.addAddressHeader("TestAddress", address, true);

out.print("" + address);
sipReq.send();

What is the expected output?
From: "Test name" 
<sip:test@example.com>;tag=86901113_73cd66e0_518a13bd-7399-4293-842a-9fb70f61445
6;epid=00112233

What do you see instead?
INVITE sip:192.168.1.100:5064 SIP/2.0
Call-ID: 79f4e14d2943004777ea080607f73b8d@127.0.0.1
CSeq: 1 INVITE
From: "Test name" 
<sip:test@example.com>;tag=86901113_73cd66e0_518a13bd-7399-4293-842a-9fb70f61445
6
To: <sip:192.168.1.100:5064>
Max-Forwards: 70
Contact: <sip:test@127.0.0.1:5080>
Via: SIP/2.0/UDP 
127.0.0.1:5080;branch=z9hG4bK518a13bd-7399-4293-842a-9fb70f614456_73cd66e0_22374
187304547
TestAddress: <sip:test@address.example.com>;epid=bzz
Route: 
<sip:127.0.0.1:5080;transport=udp;lr;directive=NEW;previousappname=ClickToCallAs
yncApplication;previousappid=518a13bd-7399-4293-842a-9fb70f614456>
Content-Length: 0

What version of the product are you using? On what operating system?
mss-3.0.0-SNAPSHOT-apache-tomcat-7.0.42-1311060029.zip from 
https://mobicents.ci.cloudbees.com/job/Mobicents-SipServlets-Release/

Please provide any additional information below.
As you can see additional parameters correctly added to "TestAddress" header, 
but it was removed for "From" header.

Original issue reported on code.google.com by alexander.kozlov.IV@gmail.com on 15 Nov 2013 at 3:24

GoogleCodeExporter commented 9 years ago
P.S. Also I found that req.toString() does not show addresses at all, and if I 
want to log request to log before sending it looks like
......
From: "Test name" ;tag=83925736_73cd66e0_dd3b4c15-357a-4bd8-b106-481c4e3b4a2b
To: 
.......

Original comment by alexander.kozlov.IV@gmail.com on 15 Nov 2013 at 3:31

GoogleCodeExporter commented 9 years ago

Original comment by jean.deruelle on 2 May 2014 at 8:40

GoogleCodeExporter commented 9 years ago
This issue was updated by revision 27350073d9e4.

Fix + non regression test

Original comment by jean.der...@telestax.com on 2 May 2014 at 9:03

GoogleCodeExporter commented 9 years ago

Original comment by jean.deruelle on 2 May 2014 at 9:03

GoogleCodeExporter commented 9 years ago

Original comment by jean.der...@telestax.com on 25 Aug 2014 at 10:52