Suppose that a soft-phone (named A) wants to control and watch a desk-phone (named B). This control means A aware of call states of B. It is possible through subscribe and notify concept that described in RFC 3265-(SIP)-Specific Event Notification and specific event package described in An INVITE-Initiated Dialog Event Package for the SIP. Simply we need to request from server that A to be subscribe of B and set the Event header field of request to dialog and server will be respond a message (named NOTIFY) consists information of call state with XML format in message body. The SIP message header for requesting a subscription is:
Via: SIP/2.0/UDP 192.168.100.212:5060;rport;branch=z9hG4bK2522767409
From: <sip:A@192.168.102.20>;tag=1005210864
To: <sip:B@192.168.102.20>
Call-ID: 1389263473
[Generated Call-ID: 1389263473]
CSeq: 20 SUBSCRIBE
Contact: <sip:A@192.168.100.212:5060>
Accept: application/dialog-info+xml
Max-Forwards: 70
User-Agent: NOSA
Expires: 3600
Event: dialog
Content-Length: 0
After that when server respond 200OK that means subscription is accepted, whenever call state of B will be changed (for example C calling to B) server send a NOTIFY message like this:
Message Header:
Via: SIP/2.0/UDP 192.168.102.20:5060;branch=z9hG4bK220fd028;rport
Max-Forwards: 70
From: <sip:B@192.168.102.20>;tag=as79c9c0a0
To: <sip:A@192.168.102.20>;tag=1005210864
Contact: <sip:B@192.168.102.20:5060>
Call-ID: 1389263473
[Generated Call-ID: 1389263473]
CSeq: 107 NOTIFY
User-Agent: GHX-(6.1.47)
Subscription-State: active
Event: dialog
Content-Type: application/dialog-info+xml
Content-Length: 204
Message Body:
<?xml version="1.0"?>\n
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="5" state="full" entity="sip:B@192.168.102.20">\n
<dialog id="222">\n
<state>early</state>\n
</dialog>\n
</dialog-info>\n
As you can see in the response body, the <state> element value is early that means B is ringing. This is the call state of B and everything till now is ok for us. But we need the contact information of C that is not appeared in any NOTIFY response.
We have studied the RFC 3265 and RFC 4235 several times, and we have expected that the contact information of C should be exists in a <remote> element in body notify response message as described in RFC 4235- Local and Remote Elements
The question is how to get caller-id or contact information of third party or remote user agent through SIP event packages? Are we using a proper SIP event package for that or not?