1sip_enable_trans_lSoegsgsiinogn(3ISnIiPt)iation Protocol Librsairpy_eFnuanbcltei_otnrsans_logging(3SIP)
2
3
4
6 sip_enable_trans_logging, sip_enable_dialog_logging, sip_disable_dia‐
7 log_logging, sip_disable_trans_logging - transaction and dialog logging
8 operations
9
11 cc [ flag... ] file... -lsip [ library... ]
12 #include <sip.h>
13
14 int sip_enable_trans_logging(FILE *logfile, int flags);
15
16
17 int sip_enable_dialog_logging(FILE *logfile, int flags);
18
19
20 void sip_disable_dialog_logging();
21
22
23 void sip_disable_trans_logging();
24
25
27 The sip_enable_trans_logging() and sip_enable_dialog_logging() func‐
28 tions enable transaction and dialog logging respectively. The logfile
29 argument points to a file to which the SIP messages are logged. The
30 flags argument controls the amount of logging. The only flag defined in
31 <sip.h> is SIP_DETAIL_LOGGING. Either transaction or dialog logging, or
32 both, can be enabled at any time. For dialog logging to work, the SIP
33 stack must be enabled to manage dialogs (using SIP_STACK_DIALOGS, see
34 sip_stack_init(3SIP)) when the stack is initialized.
35
36
37 All the messages exchanged within a transaction/dialog is captured and
38 later dumped to a log file when the transaction or dialog is deleted or
39 terminated. Upon termination, each dialog writes to the file the mes‐
40 sages that were processed in its context. Similarly, upon termination
41 each transaction writes to the file the messages that were processed in
42 its context.
43
44
45 The sip_disable_trans_logging() and sip_disable_dialog_logging() func‐
46 tions disable the transaction or dialog logging. These functions do not
47 close the files. It is the responsibility of the application to close
48 them.
49
50
51 The log contains the state of the transaction or dialog at the time the
52 message was processed.
53
55 Upon successful completion, sip_enable_trans_logging() and
56 sip_enable_dialog_logging() return 0. They return EINVAL if logfile is
57 NULL or flags is unrecognized.
58
60 Example 1 Dialog logging
61
62
63 The following is an example of dialog logging.
64
65
66 FILE *logfile;
67
68 logfile = fopen("/tmp/ApplicationA", "a+");
69 sip_enable_dialog_logging(logfile, SIP_DETAIL_LOGGING);
70
71 /* Application sends INVITE, recieves 180 and 200 response and dialog is
72 created. */
73 /* Application sends ACK request */
74 /* Application sends BYE and recieves 200 response */
75
76 /* Application disables logging */
77 sip_disable_dialog_logging();
78
79 The log file will be of the following format.
80
81
82 ************* Begin Dialog *************
83 Digest : 43854 43825 26120 9475 5415 21595 25658 18538
84
85 -----------------------------
86 Dialog State : SIP_DLG_NEW
87
88 Tue Nov 27 15:53:34 2007| Message - 1
89 INVITE sip:user@example.com SIP/2.0
90 From: "Me" < sip:me@mydomain.com > ; TAG=tag-from-01
91 To: "You" < sip:you@yourdomain.com >
92 Contact: < sip:myhome.host.com >
93 MAX-FORWARDS: 70
94 Call-ID: 1261K6A6492KF33549XM
95 CSeq: 111 INVITE
96 CONTENT-TYPE: application/sdp
97 Via: SIP/2.0/UDP 192.0.0.1 : 5060 ;branch=z9hG4bK-via-EVERYTHINGIDO-05
98 Record-Route: <sip:server1.com;lr>
99 Record-Route: <sip:server2.com;lr>
100 CONTENT-LENGTH : 0
101
102 Tue Nov 27 15:53:34 2007| Message - 2
103 SIP/2.0 180 Ringing
104 Via: SIP/2.0/UDP 192.0.0.1 : 5060 ;branch=z9hG4bK-via-EVERYTHINGIDO-05
105 From: "Me" < sip:me@mydomain.com > ; TAG=tag-from-01
106 To: "You" < sip:you@yourdomain.com >;tag=1
107 Call-ID: 1261K6A6492KF33549XM
108 CSeq: 111 INVITE
109 Contact: <sip:whitestar2-0.East.Sun.COM:5060;transport=UDP>
110 Record-Route: <sip:server1.com;lr>
111 Record-Route: <sip:server2.com;lr>
112 Content-Length: 0
113
114 -----------------------------
115 Dialog State : SIP_DLG_EARLY
116
117 /* Entire 200 OK SIP Response */
118
119 -----------------------------
120 Dialog State : SIP_DLG_CONFIRMED
121
122 /* Entire ACK Request */
123
124 /* Entire BYE Request */
125 /* Entire 200 OK Response */
126 -----------------------------
127 ************* End Dialog *************
128
129
131 See attributes(5) for descriptions of the following attributes:
132
133
134
135
136 ┌─────────────────────────────┬─────────────────────────────┐
137 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
138 ├─────────────────────────────┼─────────────────────────────┤
139 │Interface Stability │Committed │
140 ├─────────────────────────────┼─────────────────────────────┤
141 │MT-Level │MT-Safe │
142 └─────────────────────────────┴─────────────────────────────┘
143
145 sip_stack_init(3SIP), attributes(5)
146
147
148
149SunOS 5.11 11 Jan 2008 sip_enable_trans_logging(3SIP)