4.6 AddContact Example

This example demonstrates an AddContact request sent by the client to the server to add a contact to its contact list.

AddContact request example

Figure 6: AddContact request example

The client sends a SERVICE request with a SOAP envelope/xml envelope in the body. The m:setContact element indicates to the server that this request is for adding or modifying a contact. The xml contains the display name and URI of the contact that is being added along with any groups of which this contact is a member and whether the client is subscribed for presence information of this contact.

 SERVICE sip:server.contoso.com;transport=tcp SIP/2.0
 Via: SIP/2.0/TCP 11.22.33.44:13684
 Max-Forwards: 70
 From: <sip:user1@server.contoso.com>
   ;tag=e6b525fb274245a0b61ddbe877b7d0b9;epid=df527db094
   To: <sip:user1@server.contoso.com>
     ;tag=01C341BA
     Call-ID: b7c3b37ba4144a39a9bc82c224147f0c
     CSeq: 2 SERVICE
     Contact: <sip:user1@server.contoso.com:13684;maddr=11.22.33.44;
               transport="tcp">
       ;proxy=replace
       User-Agent: RTC/1.3.5369
       Proxy-Authorization: Kerberos qop="auth", realm="SIP 
          Communications Service", opaque="C71765D4", crand="d48aaa37", 
          cnum="6", targetname="sip/server.contoso.com", 
          response="602306092a864886f71201020201011100
                   ffffffffe25204ecf3fb4be0326639f5ee6f0f44"
       Content-Type: application/SOAP+xml
       Content-Length: 407
       <SOAP-ENV:Envelope 
         xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
         <SOAP-ENV:Body>
           <m:setContact 
            xmlns:m="http://schemas.microsoft.com/winrtc/2002/11/sip">
             <m:displayName>buddy 1</m:displayName>
             <m:groups />
             <m:subscribed>true</m:subscribed>
             <m:URI>sip:user4@server.contoso.com</m:URI>
             <m:externalURI />
             <m:deltaNum>12</m:deltaNum>
           </m:setContact>
         </SOAP-ENV:Body>
       </SOAP-ENV:Envelope>

The server responds to the SERVICE request with a 200 OK to indicate that the AddContact request was successful. The 200 OK response does not have a body.

 SIP/2.0 200 OK
 Authentication-Info: 
    Kerberos rspauth="602306092A864886F71201020201011100
                      FFFFFFFFF545C705C4485BF958371C44ACFE31E3", 
             srand="669CF161", snum="7", opaque="C71765D4", qop="auth", 
             targetname="sip/server.contoso.com", 
             realm="SIP Communications Service"
 Via: SIP/2.0/TCP 11.22.33.44:13684;ms-received-port=1558;
   ms-received-cid=12a00
 From: <sip:user1@server.contoso.com>;
    tag=e6b525fb274245a0b61ddbe877b7d0b9;epid=df527db094
 To: <sip:user1@server.contoso.com>;tag=01C341BA
 Call-ID: b7c3b37ba4144a39a9bc82c224147f0c
 CSeq: 2 SERVICE
 Content-Length: 0