mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-04 18:27:36 +00:00
8ff384d36f
Mon May 14 12:43:07 EDT 2007 martti.mela@nokia.com * su_base_port.c: fixed a double free in su_base_port_start_shared(). Fri May 25 13:56:23 EDT 2007 Pekka.Pessi@nokia.com * soa: added SOATAG_ORDERED_USER(), SOATAG_REUSE_REJECTED(). Allow replacing existing m=lines. Sun May 27 14:52:13 EDT 2007 Pekka.Pessi@nokia.com * msg_parser.c: fixed bug #1726034 Mon May 28 04:57:08 EDT 2007 Pekka.Pessi@nokia.com * test_nth.c: using non-blocking connect in test program, too. Mon May 28 04:58:05 EDT 2007 Pekka.Pessi@nokia.com * su.c: making all sockets non-blocking by default. Mon May 28 04:59:28 EDT 2007 Pekka.Pessi@nokia.com * m4/sac-su.m4: moved contents into sac-s2.m4 Mon May 28 05:32:26 EDT 2007 Pekka.Pessi@nokia.com * RELEASE: updated. Wed May 30 10:37:53 EDT 2007 Pekka.Pessi@nokia.com * m4/sac-su2.m4: added configure option --disable-tag-cast. Added SU_INLINE_TAG_CAST into sofia-sip/su_configure.h{,.in}. Using SU_INLINE_TAG_CAST in sofia-sip/sip_tag.h{,.in} sofia-sip/http_tag.h{,.in} sofia-sip/su_tag.h sofia-sip/su_tag_io.h sofia-sip/auth_module.h sofia-sip/nth_tag.h sofia-sip/nua_tag.h Fri Jun 1 15:11:52 EDT 2007 Pekka.Pessi@nokia.com * tport.c: fixed tport_set_params() with secondary transports Fri Jun 1 15:13:23 EDT 2007 Pekka.Pessi@nokia.com * tport_type_tcp.c: checking for end-of-stream even if su_getmsgsize() promised more data Fri Jun 1 15:15:34 EDT 2007 Pekka.Pessi@nokia.com * tport: added tport_is_clear_to_send(), allow use of tport_pending() without msg The error callback from tport can now be registered even if there is no request pending on transport (e.g., when keeping a transport connection open for inbound messages). Fri Jun 1 15:16:43 EDT 2007 Pekka.Pessi@nokia.com * nta: not retrying after an transport error if application provided the transport Fri Jun 1 15:17:23 EDT 2007 Pekka.Pessi@nokia.com * sip: do not accept empty URIs (<>) in From, To, and other headers expecting name-addr format Fri Jun 1 15:17:43 EDT 2007 Pekka.Pessi@nokia.com * torture_url.c: added test for parsing empty URLs. Fri Jun 1 15:19:27 EDT 2007 Pekka.Pessi@nokia.com * nua/test_proxy.[hc]: use registered connections for outbound with TCP. Added test_proxy_close_tports() used testing recovering from TCP failures. Fri Jun 1 15:20:33 EDT 2007 Pekka.Pessi@nokia.com * test_nua.c: added --print-tags and --tags-a, --tags=b and --tags=c options Added more functions for handling events Fri Jun 1 15:22:08 EDT 2007 Pekka.Pessi@nokia.com * test_nua: fixed some tests depending on delivery of responses in correct order Reordering might happen if some messages are sent over TCP, other over UDP. Fri Jun 1 15:27:55 EDT 2007 Pekka.Pessi@nokia.com * nua_register.c: re-registering in case the TCP connection towards proxy is closed In test_nua, Mr. B is now using TCP with the test proxy. Fri Jun 1 15:35:39 EDT 2007 Pekka.Pessi@nokia.com * nua/test_refer.c: fixed SIP payload checks Fri Jun 1 15:36:08 EDT 2007 Pekka.Pessi@nokia.com * nta_internal.h: added orq_user_tport field Tue Jun 5 06:16:43 EDT 2007 Pekka.Pessi@nokia.com * hide_email.sh: now fixing links, too. Fri Jun 15 05:34:29 EDT 2007 Pekka.Pessi@nokia.com * nua: fixed documentation entries for API functions left out from doxygen Thanks for Jerry Ricahrds for pointing this out. Wed May 23 10:26:26 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev@nokia.com> * Correct documentation for parameter type of NUTAG_WITH_SAVED Mon Jun 18 12:34:58 EDT 2007 Mikhail Zabaluev <mikhail.zabaluev@nokia.com> * Make nua_saved_event_request() and hence NUTAG_WITH_SAVED resilient to a NULL event content git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5413 d0543943-73ff-0310-b7d9-9358b9ac24b2
191 lines
5.2 KiB
C
191 lines
5.2 KiB
C
/*
|
|
* This file is part of the Sofia-SIP package
|
|
*
|
|
* Copyright (C) 2006 Nokia Corporation.
|
|
*
|
|
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public License
|
|
* as published by the Free Software Foundation; either version 2.1 of
|
|
* the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
|
* 02110-1301 USA
|
|
*
|
|
*/
|
|
|
|
/**@CFILE nua_message.c
|
|
* @brief MESSAGE method
|
|
*
|
|
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
|
*
|
|
* @date Created: Wed Mar 8 17:01:22 EET 2006 ppessi
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#include <stddef.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <limits.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <sofia-sip/string0.h>
|
|
#include <sofia-sip/sip_protos.h>
|
|
#include <sofia-sip/sip_status.h>
|
|
|
|
#include "nua_stack.h"
|
|
|
|
/* ======================================================================== */
|
|
/* MESSAGE */
|
|
|
|
/**@fn void nua_message( \
|
|
* nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...);
|
|
*
|
|
* Send an instant message.
|
|
*
|
|
* Send an instant message using SIP MESSAGE method.
|
|
*
|
|
* @param nh Pointer to operation handle
|
|
* @param tag, value, ... List of tagged parameters
|
|
*
|
|
* @return
|
|
* nothing
|
|
*
|
|
* @par Related Tags:
|
|
* NUTAG_URL() \n
|
|
* Tags of nua_set_hparams() \n
|
|
* Tags in <sip_tag.h>
|
|
*
|
|
* @par Events:
|
|
* #nua_r_message
|
|
*
|
|
* @sa #nua_i_message, @RFC3428
|
|
*/
|
|
|
|
static int nua_message_client_init(nua_client_request_t *cr,
|
|
msg_t *, sip_t *,
|
|
tagi_t const *tags);
|
|
|
|
static nua_client_methods_t const nua_message_client_methods = {
|
|
SIP_METHOD_MESSAGE,
|
|
0,
|
|
{
|
|
/* create_dialog */ 0,
|
|
/* in_dialog */ 0,
|
|
/* target refresh */ 0
|
|
},
|
|
/* nua_message_client_template */ NULL,
|
|
nua_message_client_init,
|
|
/*nua_message_client_request*/ NULL,
|
|
/* nua_message_client_check_restart */ NULL,
|
|
/*nua_message_client_response*/ NULL
|
|
};
|
|
|
|
int
|
|
nua_stack_message(nua_t *nua,
|
|
nua_handle_t *nh,
|
|
nua_event_t e,
|
|
tagi_t const *tags)
|
|
{
|
|
return nua_client_create(nh, e, &nua_message_client_methods, tags);
|
|
}
|
|
|
|
static int nua_message_client_init(nua_client_request_t *cr,
|
|
msg_t *msg, sip_t *sip,
|
|
tagi_t const *tags)
|
|
{
|
|
if (NH_PGET(cr->cr_owner, win_messenger_enable))
|
|
cr->cr_contactize = 1;
|
|
return 0;
|
|
}
|
|
|
|
/** @NUA_EVENT nua_r_message
|
|
*
|
|
* Response to an outgoing @b MESSAGE request.
|
|
*
|
|
* @param status response status code
|
|
* (if the request is retried, @a status is 100, the @a
|
|
* sip->sip_status->st_status contain the real status code
|
|
* from the response message, e.g., 302, 401, or 407)
|
|
* @param phrase a short textual description of @a status code
|
|
* @param nh operation handle associated with the message
|
|
* @param hmagic application context associated with the handle
|
|
* @param sip response to MESSAGE request or NULL upon an error
|
|
* (status code is in @a status and
|
|
* descriptive message in @a phrase parameters)
|
|
* @param tags empty
|
|
*
|
|
* @sa nua_message(), #nua_i_message, @RFC3428
|
|
*
|
|
* @END_NUA_EVENT
|
|
*/
|
|
|
|
/** @NUA_EVENT nua_i_message
|
|
*
|
|
* @brief Incoming @b MESSAGE request.
|
|
*
|
|
* The @b MESSAGE request does not create a dialog. If the incoming @b
|
|
* MESSAGE request is not assiciated with an existing dialog the stack
|
|
* creates a new handle for it. If the handle @a nh is not bound, you should
|
|
* probably destroy it after responding to the MESSAGE request.
|
|
*
|
|
* @param status status code of response sent automatically by stack
|
|
* @param phrase a short textual description of @a status code
|
|
* @param nh operation handle associated with the message
|
|
* @param hmagic application context associated with the handle
|
|
* (maybe NULL if outside session)
|
|
* @param sip incoming MESSAGE request
|
|
* @param tags empty
|
|
*
|
|
* @sa nua_message(), #nua_r_message, @RFC3428, @RFC3862
|
|
*
|
|
* @END_NUA_EVENT
|
|
*/
|
|
|
|
int nua_message_server_init(nua_server_request_t *sr);
|
|
int nua_message_server_params(nua_server_request_t *, tagi_t const *);
|
|
|
|
nua_server_methods_t const nua_message_server_methods =
|
|
{
|
|
SIP_METHOD_MESSAGE,
|
|
nua_i_message, /* Event */
|
|
{
|
|
0, /* Do not create dialog */
|
|
0, /* Can be initial request */
|
|
0, /* Perhaps a target refresh request? */
|
|
0, /* Do not add contact by default */
|
|
},
|
|
nua_message_server_init,
|
|
nua_base_server_preprocess,
|
|
nua_message_server_params,
|
|
nua_base_server_respond,
|
|
nua_base_server_report,
|
|
};
|
|
|
|
int nua_message_server_init(nua_server_request_t *sr)
|
|
{
|
|
if (!NH_PGET(sr->sr_owner, message_enable))
|
|
return SR_STATUS1(sr, SIP_403_FORBIDDEN);
|
|
|
|
return 0;
|
|
}
|
|
|
|
int nua_message_server_params(nua_server_request_t *sr,
|
|
tagi_t const *tags)
|
|
{
|
|
if (NH_PGET(sr->sr_owner, win_messenger_enable))
|
|
sr->sr_add_contact = 1;
|
|
|
|
return 0;
|
|
}
|