Zhanchang / imsdroid

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

Which method of MsrpSession should I call for sending a chat message? #119

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.How to call sendLMessage method of MsrpSession class to send a chat message ?
2.sendLMessage(byte[] payload, String ContentType) of MyMsrpSession class is 
not finished,could you give me a code or pseudocode for showing how to call 
method of MsrpSession class in order to finish a chat?
3.I see sendFile method of MyMsrpSession class calls 
callMsrp(actionConfig).Chat message ,such as "Hello Alice!",How should I pass 
"Hello Alice!",ActionConfig only have setMediaString and setMediaInt method.
By the way,please describe callMsrp,sendLMessage and sendFile method of 
MsrpSession class,including overload version.Specially,sendLMessage() have no 
argument and how to pass payload:byte[] ("Hello Alice!")?

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
IMSDroid 1.1.327  ,on Android 2.2

Please provide any additional information below.

For example,I want to send Request Message as follow
---------------------------------------------------------------------------
INVITE sip:192.168.253.3 SIP/2.0
To: <tel:+8521341041108>
From: <sip:nemo@ims.chinamobile.com>;tag=fy8bsg8q-6i
Call-ID: 10.170.32.117_83_5516001569175573513
CSeq: 1 INVITE
Max-Forwards: 64
Content-Length: 442
Via: SIP/2.0/TCP 
10.170.32.11:5062;branch=z9hG4bK4b9e42f6fd4df179310c943a4054d663jaaaaaaiaaaaaafo
ml5ha3Zqkv7fc433vmcw5fuja
Record-Route: 
<sip:3Zqkv7%0BaGqh4aaaadysip%3Asimba%40ims.chinamobile.com@pcscf.ims.chinamobile
.com:5060;maddr=10.170.32.11;lr>
Contact: 
<sip:10.170.32.117:5065;transport=tcp;fid=imsm_instance_PL_2_4_1>;+g.oma.sip-im
Content-Type: application/sdp
Allow: INVITE, ACK, BYE, CANCEL
Accept-Contact: *;+g.oma.sip-im
Supported: timer
Require: pref
Subject:Hello
P-Asserted-Identity: sip:nemo@ims.chinamobile.com
P-Asserted-Identity: tel:+8521341041107
Min-SE: 3600
P-Access-Network-Info: 3GPP-UTRAN-FDD;utran-cell-id-3gpp=2620209329320065
User-Agent: IM-Serv/OMA1.0/v3.0_IMSM_R1C02
Session-Expires: 3600;refresher=uac
P-Called-Party-ID: <sip:simba@ims.chinamobile.com>

v=0
o=- 1250012797 1250012797 IN IP4 10.170.32.117
s=none
c=IN IP4 10.170.32.117
t=0 0
m=message 4000 TCP/MSRP *
a=accept-types:message/cpim;text/plain;charset=UTF-8;application/im-iscomposing+
xml;image/png;image/x-png;image/jpeg;image/gif;audio/mpeg;audio/x-mpeg;audio/mid
i;x-music/x-midi;audio/wav;audio/x-wav;video/3gpp;video/mp4
a=path:msrp://10.170.32.117:4000/VL1SmRjx0qhi;tcp
a=sendrecv
a=max-size:51200
a=setup:active
a=connection:new
---------------------------------------------------------------------------

Response message as follow
---------------------------------------------------------------------------
SIP/2.0 200 OK
Via: SIP/2.0/TCP 
10.170.32.11:5062;branch=z9hG4bK4b9e42f6fd4df179310c943a4054d663jaaaaaaiaaaaaafo
ml5ha3Zqkv7fc433vmcw5fuja
Record-Route: 
<sip:3Zqkv7%0BaGqh4aaaadysip%3Asimba%40ims.chinamobile.com@pcscf.ims.chinamobile
.com:5060;maddr=10.170.32.11;lr>
From: <sip:nemo@ims.chinamobile.com>;tag=fy8bsg8q-6i
To: <tel:+8521341041108>;tag=2604935847
Call-ID: 10.170.32.117_83_5516001569175573513
CSeq: 1 INVITE
Contact: <sip:192.168.253.3>;+g.oma.sip-im
P-Access-Network-Info: 3GPP-UTRAN-FDD;utran-cell-id-3gpp=2620209329320065
Content-Length: 437
Content-Type: application/sdp
Allow: INVITE,OPTIONS,BYE,CANCEL,ACK,SUBSCRIBE,NOTIFY,PUBLISH,MESSAGE,REFER
Session-Expires: 3600;refresher=uac
Supported: timer
Require: timer
Server: SEMC_IMS_R3

v=0
o=- 1250012847 1250012847 IN IP4 192.168.253.3
s=none
c=IN IP4 192.168.253.3
t=0 0
m=message 4322 TCP/MSRP *
a=accept-types:message/cpim;text/plain;charset=UTF-8;application/im-iscomposing+
xml;image/png;image/x-png;image/jpeg;image/gif;audio/mpeg;audio/x-mpeg;audio/mid
i;x-music/x-midi;audio/wav;audio/x-wav;video/3gpp;video/mp4
a=sendrecv
a=max-size:51200
a=connection:new
a=path:msrp://192.168.253.3:4322/1314866162;tcp
---------------------------------------------------------------------------

MSRP SEND message as follow
---------------------------------------------------------------------------
MSRP 466215851 SEND
To-Path: msrp://192.168.245.23:4000/amFDknQZ7OIi;tcp
From-Path: msrp://192.168.245.235:59962/1811611648;tcp
Message-ID: ZdmAg13857-ID00000005-H12M011S2
Byte-Range: 1-9/9
Success-Report: no
Failure-Report: yes
Content-Type: text/plain;charset=utf-8

Hi buddy!
-------466215851$
---------------------------------------------------------------------------

MSRP response message as follow
---------------------------------------------------------------------------
MSRP 466215851 200 OK
To-Path: msrp://192.168.245.235:59962/1811611648;tcp
From-Path: msrp://192.168.245.23:4000/amFDknQZ7OIi;tcp
-------466215851$
---------------------------------------------------------------------------

Original issue reported on code.google.com by yuwenbin...@gmail.com on 9 Dec 2010 at 7:21

GoogleCodeExporter commented 9 years ago
In addition,I captured the SIP/SDP message package by using Wireshark and find 
that "o=doubango 1983 678901 IN IP4 10.0.2.15".I want to set "o=- 1983 678901 
IN IP4 10.0.2.15",how to do it?

Original comment by yuwenbin...@gmail.com on 9 Dec 2010 at 8:25

GoogleCodeExporter commented 9 years ago
First update the source code to SVN revision 343.
sendLMessage() is now implemented.
To achieve your workflow:

 // establish an MSRP session
        ActionConfig sessionConfig = new ActionConfig();
        MyMsrpSession msrpSession = MyMsrpSession.createOutgoingSession(sipStack, MediaType.Chat);
        sessionConfig.addHeader("Subject","Hello");
        msrpSession.session.callMsrp("+8521341041108", sessionConfig);
        sessionConfig.delete();

        // Once the session is established
        if(msrpSession.isConnected())
        {
            byte[] content = "Hi buddy!".getBytes();
            final ByteBuffer payload = ByteBuffer.allocateDirect(content.length);
            payload.put(content);

            ActionConfig messageConfig = new ActionConfig();
            messageConfig.setMediaString(twrap_media_type_t.twrap_media_msrp, "content-type", "text/plain;charset=utf-8");
            msrpSession.session.sendMessage(payload, (long)payload.capacity(), messageConfig);
        }

Original comment by boss...@yahoo.fr on 9 Dec 2010 at 4:34

GoogleCodeExporter commented 9 years ago
Thank you for your help!

Original comment by yuwenbin...@gmail.com on 9 Dec 2010 at 5:10

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Dear  yuwenbin...@gmail.com is the  code  of  chat messaging work ?
Please answer .
It's only call and doesn't send message .
Please help .

Original comment by Arian.Sa...@gmail.com on 13 Feb 2011 at 7:41

GoogleCodeExporter commented 9 years ago
Yes,the code works.establish an MSRP session and send MSRP message must be 
asynchronous 

Original comment by Splash.P...@gmail.com on 15 Feb 2011 at 3:15

GoogleCodeExporter commented 9 years ago
Thanks for your answer,but I have some difficults.
I want to know except the code of top and the changes of revision 343,there are 
not any changes in the  other part of imsdroid project or there is no any 
additional code which you didnn't write here.
Please help.I have already some days trying this ,but widthout any result.

Original comment by Arian.Sa...@gmail.com on 16 Feb 2011 at 2:19

GoogleCodeExporter commented 9 years ago
(msrpSession.isConnected()) its always return false .

Original comment by Arian.Sa...@gmail.com on 16 Feb 2011 at 2:44

GoogleCodeExporter commented 9 years ago

            byte[] content = "Hi buddy!".getBytes();
            final ByteBuffer payload = ByteBuffer.allocateDirect(content.length);
            payload.put(content);

            ActionConfig messageConfig = new ActionConfig();
            messageConfig.setMediaString(twrap_media_type_t.twrap_media_msrp, "content-type", "text/plain;charset=utf-8");
            msrpSession.session.sendMessage(payload, (long)payload.capacity(), messageConfig);

These code MUST be put when receiving 200OK(SIP).
for example,in SipService::OnInviteEvent method.

establish an MSRP session and send MSRP message must be asynchronous,this is 
very importment.

Original comment by Splash.P...@gmail.com on 16 Feb 2011 at 3:23

GoogleCodeExporter commented 9 years ago

If it isn't difficult for you please write down the whole 
SipService::OnInviteEvent method.
Please .
Thanks in advance.

Original comment by Arian.Sa...@gmail.com on 16 Feb 2011 at 4:24

GoogleCodeExporter commented 9 years ago
No problem.But you have to wait 2 days.

Original comment by Splash.P...@gmail.com on 16 Feb 2011 at 4:37

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
addition.
Dear Splash.P...@gmail.com
Please write here any changes you done in your project for imsdroid chat 
messaging 
Thanks in advance .I will wait.
It's very important for me.

Original comment by Arian.Sa...@gmail.com on 17 Feb 2011 at 12:50

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Dear Splash.P...@gmail.com please answer is it possible to have 
SipService::OnInviteEvent method tomorrow(on Friday)?

Original comment by Arian.Sa...@gmail.com on 17 Feb 2011 at 7:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]