From df4705eab9c873eae60bada4f2138e6f22a76e11 Mon Sep 17 00:00:00 2001 From: gm209912 Date: Wed, 19 Sep 2007 10:20:24 -0700 Subject: PSARC 2007/447 SIP Contact API 6503334 SIP library should support "*" as a valid contact header value 6587481 add a SIP API to retrieve the the local contact information from sip_dialog structure 6589677 add a SIP API to create a request inside a dialog, without a Contact header --- usr/src/lib/libsip/common/sip_dialog_ui.c | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'usr/src/lib/libsip/common/sip_dialog_ui.c') diff --git a/usr/src/lib/libsip/common/sip_dialog_ui.c b/usr/src/lib/libsip/common/sip_dialog_ui.c index bdbc588e8c..d15d79f56e 100644 --- a/usr/src/lib/libsip/common/sip_dialog_ui.c +++ b/usr/src/lib/libsip/common/sip_dialog_ui.c @@ -118,6 +118,29 @@ err_ret: return (NULL); } +/* + * Create a request using the state maintained in the dialog. The request will + * not have Contact header. + */ +sip_msg_t +sip_create_dialog_req_nocontact(sip_method_t method, sip_dialog_t dialog, + char *transport, char *sent_by, int sent_by_port, char *via_param, + uint32_t maxforward, int cseq) +{ + sip_msg_t sip_msg; + + sip_msg = sip_create_dialog_req(method, dialog, transport, sent_by, + sent_by_port, via_param, maxforward, cseq); + if (sip_msg != NULL) { + if (sip_delete_header_by_name(sip_msg, SIP_CONTACT) != 0) { + sip_free_msg(sip_msg); + return (NULL); + } + } + + return (sip_msg); +} + /* * Get the Dialog method */ @@ -362,6 +385,39 @@ sip_get_dialog_remote_target_uri(sip_dialog_t dialog, int *error) return ((sip_uri_t)rtarg); } +/* + * Return the dialog local contact uri. + */ +const struct sip_uri * +sip_get_dialog_local_contact_uri(sip_dialog_t dialog, int *error) +{ + _sip_dialog_t *_dialog; + const struct sip_uri *lcuri = NULL; + const struct sip_value *val; + + if (error != NULL) + *error = 0; + if (!sip_manage_dialog || dialog == NULL) { + if (error != NULL) + *error = EINVAL; + return (NULL); + } + _dialog = (_sip_dialog_t *)dialog; + (void) pthread_mutex_lock(&_dialog->sip_dlg_mutex); + if (dialog->sip_dlg_local_contact != NULL) { + val = sip_get_header_value(_dialog->sip_dlg_local_contact, + error); + if (val == NULL) { + (void) pthread_mutex_unlock(&_dialog->sip_dlg_mutex); + return (NULL); + } + lcuri = val->sip_value_parse_uri; + } + (void) pthread_mutex_unlock(&_dialog->sip_dlg_mutex); + + return ((sip_uri_t)lcuri); +} + /* * Return the dialog route set */ -- cgit v1.2.3