1sip_add_from(3SIP)Session Initiation Protocol Library Functionssip_add_from(3SIP)
2
3
4
6 sip_add_from, sip_add_to, sip_add_contact, sip_add_via, sip_add_maxfor‐
7 ward, sip_add_callid, sip_add_cseq, sip_add_content_type, sip_add_con‐
8 tent, sip_add_accept, sip_add_accept_enc, sip_add_accept_lang,
9 sip_add_alert_info, sip_add_allow, sip_add_call_info, sip_add_con‐
10 tent_disp, sip_add_content_enc, sip_add_content_lang, sip_add_date,
11 sip_add_error_info, sip_add_expires, sip_add_in_reply_to,
12 sip_add_mime_version, sip_add_min_expires, sip_add_org, sip_add_prior‐
13 ity, sip_add_reply_to, sip_add_passertedid, sip_add_ppreferredid,
14 sip_add_require, sip_add_retry_after, sip_add_route,
15 sip_add_record_route, sip_add_server, sip_add_subject, sip_add_sup‐
16 ported, sip_add_tstamp, sip_add_unsupported, sip_add_user_agent,
17 sip_add_warning, sip_add_rseq, sip_add_privacy, sip_add_rack,
18 sip_add_author, sip_add_authen_info, sip_add_proxy_authen,
19 sip_add_proxy_author, sip_add_proxy_require, sip_add_www_authen,
20 sip_add_allow_events, sip_add_event, sip_add_substate - add specific
21 SIP headers to the SIP message
22
24 cc [ flag ... ] file ... -lsip [ library ... ]
25 #include <sip.h>
26
27 int sip_add_from(sip_msg_t sip_msg, char *display_name, char *from_uri,
28 char *from_tag, boolean_t add_aquot, char *from_params);
29
30
31 int sip_add_to(sip_msg_t sip_msg, char *display_name, char *to_uri,
32 char *to_tag, boolean_t add_aquot, char *to_params);
33
34
35 int sip_add_contact(sip_msg_t sip_msg, char *display_name,
36 char *contact_uri, boolean_t add_aquot, char *contact_params);
37
38
39 int sip_add_via(sip_msg_t sip_msg, char *sent_protocol_transport,
40 char *sent_by_host, int sent_by_port, char *via_params);
41
42
43 int sip_add_maxforward(sip_msg_t sip_msg, uint_t maxforward);
44
45
46 int sip_add_callid(sip_msg_t sip_msg, char *callid);
47
48
49 int sip_add_cseq(sip_msg_t sip_msg, sip_method_t method, uint32_t cseq);
50
51
52 int sip_add_content_type(sip_msg_t sip_msg, char * type, char *subtype);
53
54
55 int sip_add_content(sip_msg_t sip_msg, char * content);
56
57
58 int sip_add_accept(sip_msg_t sip_msg, char *type, char *subtype,
59 char *media_param, char *accept_param);
60
61
62 int sip_add_accept_enc(sip_msg_t sip_msg, char *code,
63 char *param);
64
65
66 int sip_add_accept_lang(sip_msg_t sip_msg, char *lang,
67 char *param);
68
69
70 int sip_add_alert_info(sip_msg_t sip_msg, char *alert,
71 char *param);
72
73
74 int sip_add_allow(sip_msg_t sip_msg, sip_method_t method_name);
75
76
77 int sip_add_call_info(sip_msg_t sip_msg, char *uri,
78 char *param);
79
80
81 int sip_add_content_disp(sip_msg_t sip_msg, char *dis_type, char *param);
82
83
84 int sip_add_content_enc(sip_msg_t sip_msg, char *code);
85
86
87 int sip_add_content_lang(sip_msg_t sip_msg, char *lang);
88
89
90 int sip_add_date(sip_msg_t sip_msg, char *date);
91
92
93 int sip_add_error_info(sip_msg_t sip_msg, char *uri, char *param);
94
95
96 int sip_add_expires(sip_msg_t sip_msg, int secs);
97
98
99 int sip_add_in_reply_to(sip_msg_t sip_msg, char *reply_id);
100
101
102 int sip_add_mime_version(sip_msg_t sip_msg, char *version);
103
104
105 int sip_add_min_expires(sip_msg_t sip_msg, int secs);
106
107
108 int sip_add_org(sip_msg_t sip_msg, char *org);
109
110
111 int sip_add_priority(sip_msg_t sip_msg, char *prio);
112
113
114 int sip_add_reply_to(sip_msg_t sip_msg, char *display_name,
115 char *addr, char *param, boolean_t add_aquot);
116
117
118 int sip_add_passertedid(sip_msg_t sip_msg, char *display_name,
119 char *addr, boolean_t add_aqout);
120
121
122 int sip_add_ppreferredid(sip_msg_t sip_msg, char *display_name,
123 char *addr, boolean_t add_aquot);
124
125
126 int sip_add_require(sip_msg_t sip_msg, char *req);
127
128
129 int sip_add_retry_after(sip_msg_t sip_msg, int secs, char *cmt,
130 char *param);
131
132
133 int sip_add_route(sip_msg_t sip_msg, char *display_name, char *uri,
134 char *route_params);
135
136
137 int sip_add_record_route(sip_msg_t sip_msg, char *display_name,
138 char *uri, char *route_params);
139
140
141 int sip_add_server(sip_msg_t sip_msg, char *svr);
142
143
144 int sip_add_subject(sip_msg_t sip_msg, char *subject);
145
146
147 int sip_add_supported(sip_msg_t sip_msg, char *support);
148
149
150 int sip_add_tstamp(sip_msg_t sip_msg, char *time, char *delay);
151
152
153 int sip_add_unsupported(sip_msg_t sip_msg, char *unsupport);
154
155
156 int sip_add_user_agent(sip_msg_t sip_msg, char *usr);
157
158
159 int sip_add_warning(sip_msg_t sip_msg, int code, char *addr, char *msg);
160
161
162 int sip_add_privacy(sip_msg_t sip_msg, char *priv_val);
163
164
165 int sip_add_rseq(sip_msg_t sip_msg, int resp_num);
166
167
168 int sip_add_rack(sip_msg_t sip_msg, int resp_num, int cseq,
169 sip_method_t method);
170
171
172 int sip_add_author(sip_msg_t sip_msg, char *scheme, char *param);
173
174
175 int sip_add_authen_info(sip_msg_t sip_msg, char *ainfo);
176
177
178 int sip_add_proxy_authen(sip_msg_t sip_msg, char *pascheme,
179 char *param);
180
181
182 int sip_add_proxy_author(sip_msg_t sip_msg, char *pascheme,
183 char *param);
184
185
186 int sip_add_proxy_require(sip_msg_t sip_msg, char *opt);
187
188
189 int sip_add_www_authen(sip_msg_t sip_msg, char *wascheme,
190 char *param);
191
192
193 int sip_add_allow_events(sip_msg_t sip_msg, char *events);
194
195
196 int sip_add_event(sip_msg_t sip_msg, char *event, char *param);
197
198
199 int sip_add_substate(sip_msg_t sip_msg, char *sub, char *param);
200
201
203 For each of the following functions that add a header to a SIP message,
204 the function adds a CRLF before appending the header to the SIP mes‐
205 sage.
206
207
208 The sip_add_from() and sip_add_to() functions appends a FROM and TO
209 header respectively to the SIP message sip_msg. The header is created
210 using the display_name, if non-null, and the uri values. The add_aquot
211 parameter is used to specify whether the uri should be enclosed within
212 '<>'. If a display_name is provided then add_aquot cannot be B_FALSE.
213 The display_name parameter, if provided, is enclosed within quotes
214 before creating to the SIP header. Tag value for the FROM/TO header can
215 be specified which will be added to the SIP header by prefixing it with
216 "TAG=". Any generic parameters can be specified as the last argument,
217 which will be added, as is, to the SIP header.
218
219
220 Either the tag or the generic parameter can be specified not both, if
221 both are specified, the resulting header contains only the tag parame‐
222 ter.
223
224
225 The sip_add_contact() function appends a CONTACT header to the SIP mes‐
226 sage sip_msg using the display_name and contact_uri. The add_aquot
227 parameter has the same semantics as in sip_add_from()/sip_add_to(). Any
228 contact parameters specified in contact_param is added to the CONTACT
229 header before appending the header to the message.
230
231
232 The sip_add_via() function appends a VIA header to the SIP message
233 sip_msg. The VIA header is constructed using sent_protocol_transport,
234 sent_by_host and sent_by_port. A value of 0 for sent_by_port means that
235 the port information is not present in the resulting VIA header. The
236 VIA header that is created has the protocol set to "SIP" and version
237 set to "2.0". Any parameters specific in via_params is added to the VIA
238 header before appending the header to the SIP message.
239
240
241 The sip_add_maxforward() function appends a MAX-FORWARDS header to the
242 SIP message sip_msg using the value in maxforward. The maxforward value
243 is a positive integer.
244
245
246 The sip_add_callid() function appends a CALL-ID header to the SIP mes‐
247 sage sip_msg using the value in callid, if non-null. If callid is null,
248 this function creates a CALL-ID header using a randomly generated
249 value.
250
251
252 The sip_add_cseq() function appends a CSEQ header to the SIP message
253 using the values in method and cseq. Permissible values for method
254 include:
255 INVITE
256 ACK
257 OPTIONS
258 BYE
259 CANCEL
260 REGISTER
261 REFER
262 SUBSCRIBE
263 NOTIFY
264 PRACK
265 INFO
266
267
268 The cseq value is a positive integer.
269
270
271 The sip_add_content_type() function appends a CONTENT-TYPE to the SIP
272 message sip_msg. The CONTENT-TYPE is created using the type and sub‐
273 type, both should be non-null.
274
275
276 The sip_add_content() function adds a message body to the SIP message
277 sip_msg. The message body is given by the null terminated string con‐
278 tents. Once the function returns, the caller may reuse or delete con‐
279 tents as sip_add_content() creates a new buffer and copies over con‐
280 tents for its use.
281
282
283 The sip_add_accept() function appends an ACCEPT header to the SIP mes‐
284 sage sip_msg. The ACCEPT header is created using type and subtype. If
285 both type and subtype are null, then an empty ACCEPT header is added to
286 the SIP message. If type is non-null, but subtype is null, then the
287 ACCEPT header has the specified type and sets the subtype in the header
288 to '*'. Any accept_param or media_param, if provided, are added to the
289 ACCEPT header before appending the header to the SIP message.
290
291
292 The sip_add_accept_enc() function appends an ACCEPT-ENCODING header to
293 the SIP message sip_msg. The ACCEPT-ENCODING is created using code. Any
294 parameter specified in param is added to the ACCEPT-ENCODING header
295 before appending the header to the SIP message.
296
297
298 The sip_add_accept_lang() function appends an ACCEPT-LANGUAGE header to
299 the SIP message sip_msg. The ACCEPT-LANGUAGE header is created using
300 lang. Any parameter specified in param is added to the ACCEPT-LANGUAGE
301 header before appending the header to the SIP message.
302
303
304 The sip_add_alert_info() function appends an ALERT-INFO header to the
305 SIP message sip_msg. The ALERT-INFO header is created using alert. Any
306 parameter specified in param is added to the ALERT-INFO header before
307 appending the header to the SIP message.
308
309
310 The sip_add_allow() function appends an ALLOW header to the SIP message
311 sip_msg. The ALLOW header is created using alert and method. Permissi‐
312 ble values for method include:
313 INVITE
314 ACK
315 OPTIONS
316 BYE
317 CANCEL
318 REGISTER
319 REFER
320 INFO
321 SUBSCRIBE
322 NOTIFY
323 PRACK
324
325
326 The sip_add_call_info() function appends a CALL-INFO header to the SIP
327 message sip_msg. The CALL-INFO header is created using uri. Any parame‐
328 ter specified in param is added to the CALL-INFO before appending the
329 header to the SIP message.
330
331
332 The sip_add_content_disp() function appends a CONTENT-DISPOSITION
333 header to the SIP message sip_msg. The CONTENT-DISPOSITION header is
334 created using disp_type. Any parameter specified in param is added to
335 the CONTENT-DISPOSITION header before appending the header to the SIP
336 message.
337
338
339 The sip_add_content_enc() function appends a CONTENT-ENCODING header to
340 the SIP message sip_msg. The CONTENT-ENCODING header is created using
341 code.
342
343
344 The sip_add_content_lang() function appends a CONTENT-LANGUAGE header
345 to the SIP message sip_msg. The CONTENT-LANGUAGE header is created
346 using lang.
347
348
349 The sip_add_date() appends a DATE header to the SIP message sip_msg.
350 The DATE header is created using the date information specified in
351 date. The semantics for the date string is given is RFC 3261, section
352 25.1.
353
354
355 The sip_add_error_info() function appends an ERROR-INFO header to the
356 SIP message sip_msg. The ERROR-INFO header is created using uri. An
357 parameters specified in param is added to the ERROR-INFO header before
358 adding the header to the SIP message.
359
360
361 The sip_add_expires() function appends an EXPIRES header to the SIP
362 message sip_msg. The EXPIRES header is created using the seconds speci‐
363 fied in secs.
364
365
366 The sip_add_in_reply_to() function appends a IN-REPLY-TO header to the
367 SIP message sip_msg. The IN-REPLY-TO header is created using the call-
368 id value specified in reply_id.
369
370
371 The sip_add_mime_version() function appends a MIME-VERSION header to
372 the SIP message sip_msg. The MIME-VERSION header is created using ver‐
373 sion.
374
375
376 The sip_add_min_expires() function appends a MIN-EXPIRES header to the
377 SIP message sip_msg. The MIN-EXPIRES is created using the time in sec‐
378 onds specified in secs.
379
380
381 The sip_add_org() function appends a ORGANIZATION header to the SIP
382 message sip_msg. The ORGANIZATION header is created using the informa‐
383 tion specified in org.
384
385
386 The sip_add_priority() function appends a PRIORITY header to the SIP
387 message sip_msg. The PRIORITY header is created using the value speci‐
388 fied in prio.
389
390
391 The sip_add_reply_to() function appends a REPLY-TO header to the SIP
392 message sip_msg. The REPLY-TO header is created using the display_name,
393 if provided, and addr. The add_aquot parameter has the same semantics
394 as in sip_add_from()/sip_add_to(). Any parameters specified in param is
395 added to the REPLY-TO header before appending the header to the SIP
396 message.
397
398
399 The sip_add_passertedid() function appends a P-ASSERTED-IDENTITY header
400 to the SIP message sip_msg. The P-ASSERTED-IDENTITY header is created
401 using the display_name, if provided, and the addr. The add_aquot param‐
402 eter has the same semantics as in sip_add_from()/sip_add_to().
403
404
405 The sip_add_ppreferredid() function appends a P-PREFERRED-IDENTITY
406 header to the SIP message sip_msg. The P-PREFERRED-IDENTITY header is
407 created using the display_name, if provided, and the addr. The
408 add_aquot parameter has the same semantics as in
409 sip_add_from()/sip_add_to().
410
411
412 The sip_add_require() function appends a REQUIRE header to the SIP mes‐
413 sage sip_msg. The REQUIRE header is created using the information in
414 req.
415
416
417 The sip_add_retry_after() function appends a RETRY-AFTER header to the
418 SIP message sip_msg. The RETRY-AFTER is created using the time in sec‐
419 onds specified in secs comments, if any, in cmt. Any parameters speci‐
420 fied in param, if provided, is added to the RETRY-AFTER header before
421 appending the header to the SIP message.
422
423
424 The sip_add_route() function appends a ROUTE header to the SIP message
425 sip_msg. The ROUTE header is created using the display_name, if any,
426 and the uri. The uri is enclosed in '<>' before adding to the header.
427 Parameters specified in route_params are added to the ROUTE header
428 before appending the header to the SIP message.
429
430
431 The sip_add_record_route() function appends a RECORD-ROUTE header to
432 the SIP message sip_msg. The RECORD-ROUTE header is created using the
433 display_name, if any, and the uri. The uri parameter is enclosed in
434 '<>' before adding to the header. Any parameters specified in
435 route_params is added to the ROUTE header before appending the header
436 to the SIP message.
437
438
439 The sip_add_server() function appends a SERVER header to the SIP mes‐
440 sage sip_msg. The SERVER header is created using the information in
441 srv.
442
443
444 The sip_add_subject() function appends a SUBJECT header to the SIP mes‐
445 sage sip_msg. The SUBJECT header is created using the information in
446 subject.
447
448
449 The sip_add_supported() function appends a SUPPORTED header to the SIP
450 message sip_msg. The SUPPORTED header is created using the information
451 in support.
452
453
454 The sip_add_tstamp() function appends a TIMESTAMP header to the SIP
455 message sip_msg. The TIMESTAMP header is created using the time value
456 in time and the delay value, if provided, in delay.
457
458
459 The sip_add_unsupported() function appends an UNSUPPORTED header to the
460 SIP message sip_msg. The UNSUPPORTED header is created using the
461 option-tag value in unsupport.
462
463
464 The sip_add_user_agent() function appends an USER-AGENT header to the
465 SIP message sip_msg. The USER-AGENT header is created using the server-
466 val specified in usr.
467
468
469 The sip_add_warning() function appends a WARNING header to the SIP mes‐
470 sage sip_msg. The WARNING header is created using the warn-code in
471 code, warn-agent in addr and warn-test in msg.
472
473
474 The sip_add_privacy() function appends a PRIVACY header to the SIP mes‐
475 sage sip_msg. The PRIVACY header is created using the privacy value
476 specified in priv_val.
477
478
479 The sip_add_rseq() function appends a RSEQ header to the SIP message
480 sip_msg. The RSEQ header is created using the sequence number specified
481 in resp_num.
482
483
484 The sip_add_rack() function appends a RACK header to the SIP message
485 sip_msg. The RACK header is created using the sequence number in
486 resp_num, the SIP method in method and the CSEQ number in cseq. Permis‐
487 sible values for method include: INVITE, ACK, OPTIONS, BYE, CANCEL,
488 REGISTER, REFER, INFO, SUBSCRIBE, NOTIFY, PRACK.
489
490
491 The sip_add_author() function appends an AUTHORIZATION header to the
492 SIP message sip_msg. The AUTHORIZATION header is created using scheme.
493 Any parameter specified in param is added to the AUTHORIZATION header
494 before the header is appended to the SIP message.
495
496
497 The sip_add_authen_info() function appends an AUTHENTICATION-INFO()
498 header to the SIP message sip_msg. The AUTHENTICATION-INFO header is
499 created using the authentication information in ainfo.
500
501
502 The sip_add_proxy_authen() function appends a PROXY-AUTHENTICATE header
503 to the SIP message sip_msg. The PROXY-AUTHENTICATE is created using the
504 value specified in psacheme. Any parameter in param is added to the
505 PROXY-AUTHENTICATE header before adding the header to the SIP message.
506
507
508 The sip_add_proxy_author() function appends a PROXY-AUTHORIZATION
509 header to the SIP message sip_msg. The PROXY-AUTHORIZATION header is
510 created using the value specified in pascheme. Any parameter in param
511 is added to the PROXY-AUTHORIZATION header before adding the header to
512 the SIP message.
513
514
515 The sip_add_proxy_require() function appends a PROXY-REQUIRE header to
516 the SIP message sip_msg. The PROXY-REQUIRE header is created using the
517 option-tag in opt.
518
519
520 The sip_add_www_authen() function appends a WWW-AUTHENTICATE header to
521 the SIP message sip_msg. The WWW-AUTHENTICATE header is created using
522 the challenge in wascheme. Any parameter in param is added to the WWW-
523 AUTHENTICATE header before adding the header to the SIP message.
524
525
526 The sip_add_allow_events() function appends an ALLOW-EVENTS header to
527 the SIP message The ALLOW-EVENTS header is created using the event
528 specified in events.
529
530
531 The sip_add_event() function appends an EVENT header to the SIP mes‐
532 sage. The EVENT header is created using the value specified in event.
533 Any parameter in param is added to the EVENT header before appending
534 the header to the SIP message.
535
536
537 The sip_add_substate() function appends a SUBSCRIPTION-STATE header to
538 the SIP message. The SUBSCRIPTION-STATE header is created using the
539 state specified in sub. Any parameter in param is added to the SUB‐
540 SCRIPTION-STATE header before appending the header to the SIP message.
541
543 These functions return 0 on success and the appropriate error value on
544 failure.
545
547 On failure, functions that return an error value can return one of the
548 following:
549
550 EINVAL Mandatory parameters are not provided, i.e. null.
551
552 For sip_add_from(), sip_add_to(), sip_add_contact(),
553 sip_add_reply_to(), sip_add_passertedid(), sip_add_ppreferre‐
554 did() if display_name is non-null and add_aquot is B_FALSE.
555
556 For sip_add_branchid_to_via() the topmost VIA header already
557 has a branch param or the SIP message does not have a VIA
558 header.
559
560
561 EPERM The message cannot be modified.
562
563
564 ENOMEM There is an error allocating memory for creating head‐
565 ers/parameters.
566
567
569 See attributes(5) for descriptions of the following attributes:
570
571
572
573
574 ┌─────────────────────────────┬─────────────────────────────┐
575 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
576 ├─────────────────────────────┼─────────────────────────────┤
577 │Interface Stability │Committed │
578 ├─────────────────────────────┼─────────────────────────────┤
579 │MT-Level │MT-Safe │
580 └─────────────────────────────┴─────────────────────────────┘
581
583 libsip(3LIB)
584
585
586
587SunOS 5.11 09 Feb 2007 sip_add_from(3SIP)