Wiki

Clone wiki

libsipc / recv-msg-in-dialog-mode

Receive Message In Dialog Mode

Receive Message In Dialog Mode

Accept the invitation

register sock recv

header

I 333344445 SIP-C/4.0
F: sip:111122223@fetion.com.cn;p=16107
I: -7
K: text/plain
K: text/html-fragment
K: multiparty
K: nudge
XI: 9b844623eb494bc99128fa7676ac447b
L: 111
Q: 200002 I
AL: buddy
A: CS address="58.68.229.49:8080;58.68.229.49:443;221.176.31.10:8080;221.176.31.10:443",credential="1798470167.1339065106"

body

s=session
m=message 
a=user:sip:111122223@fetion.com.cn;p=16107
a=user:sip:333344445@fetion.com.cn;p=16106

register sock is the socket that create a TCP connection to send REGISTER to SIP-C proxy server.

|| field name || desc || | F | invitor's URI | | K | Supported, which kind of content client supported | | A | Address |

Field A

|| name || desc || | address | address for create a connection use in a dialog | | credential | token for create a connection |

Field K generate by CM Fetion Web client looks like

K: text/plain

Field K generate by CM Fetion Windows desktop client looks like

K: text/plain
K: text/html-fragment
K: multiparty
K: nudge

|| name || desc || | text/plain | plain text | | text/html-fragment | rich text | | multiparty | (long text ?) | | nudge | poke, "闪屏" in Chinese |

body

s=session
m=message 
a=user:sip:111122223@fetion.com.cn;p=16107
a=user:sip:333344445@fetion.com.cn;p=16106

|| shorten || desc || | s | session name, (在目前飞信的 INVITE 中,固定值为 s=session ?) | | m | (media name?) | | a | (transport address? ) |

Processing that accept contact's invitation and create a new connection('dialog' in SIP-C term) for communication, register sock should send:

SIP-C/4.0 200 OK
I: -7 
Q: 200002 I
F: sip:111122223@fetion.com.cn;p=16107

|| field name || value || | I | call ID, the same as UA request (SIPC proxy server) | | Q | CSeq, the same as UA request (SIPC proxy server) | | F | invitor's URI |

Create A SIP-C Dialog

You should communicate with your contact in dialog mode while you're online, even through your user presence basic value is INVISIBLE.

If you not willing to expose your user presence basic value, skip following steps, and you also will recives messages in non-dialog from register sock.

dialog sock send:

R fetion.com.cn SIP-C/4.0
F: 333344445
I: -7 
Q: 1 R
A: TICKS auth="1798470167.1339065106"
K: text/html-fragment
K: multiparty
K: nudge
K: share-background
K: fetion-show
K: ExModulesApp
K: FileTransferV4

dialog sock recv:

SIP-C/4.0 200 OK
I: -7
Q: 1 R
XI: 9b844623eb494bc99128fa7676ac447b
X: 1200
K: text/plain
K: text/html-fragment
K: multiparty
K: nudge

Receive BENOTIFY Request

dialog sock recv:

header

BN 333344445 SIP-C/4.0
I: -10
Q: 2 BN
N: Conversation
L: 141

body

<events>
    <event type="Support">text/plain</event>
    <event type="UserEntered">
        <member uri="sip:111122223@fetion.com.cn;p=6089"/>
    </event>
</events>

You should save and remember which kinds of media contact supported in this dialog.

Receive Messages

dialog sock recv:

header

M 333344445 SIP-C/4.0
I: -7
Q: 3 M
C: text/plain
F: sip:111122223@fetion.com.cn;p=16107
K: SaveHistory
L: 5
N: CatMsg
D: Fri, 04 Mar 2011 06:50:28 GMT
XI: 7030DD3D284377DDFE0B487043740558

body

hello

dialog sock should responses ACK, or your will get above message again in next time that you send REGISTER request to SIPC proxy:

SIP-C/4.0 200 OK
I: -7 
Q: 3 M
F: sip:111122223@fetion.com.cn;p=16107

Keep Connection Busy

You must send KeepConnectionBusy request to dialog sock to keep dialog(connection) alives in every 40 seconds.

dialog sock send:

O fetion.com.cn SIP-C/4.0
F: 333344445
I: -7 
Q: 2 O
N: KeepConnectionBusy

dialog sock recv:

SIP-C/4.0 200 OK
I: -7
Q: 2 O

User Left From A Conversation

BN 333344445 SIP-C/4.0
I: -8
Q: 4 BN
N: Conversation
L: 98

<events><event type="UserLeft"><member uri="sip:111122223@fetion.com.cn;p=6089"/></event></events>

Updated