[asterisk-commits] oej: branch oej/darjeeling-prack-1.8 r369430 - in /team/oej/darjeeling-prack-...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jun 27 10:42:43 CDT 2012
Author: oej
Date: Wed Jun 27 10:42:41 2012
New Revision: 369430
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369430
Log:
Oops. We do not bother with Required header in responses. Bad. Especially for SIP session timers.
Modified:
team/oej/darjeeling-prack-1.8/channels/chan_sip.c
team/oej/darjeeling-prack-1.8/channels/sip/include/reqresp_parser.h
team/oej/darjeeling-prack-1.8/channels/sip/reqresp_parser.c
Modified: team/oej/darjeeling-prack-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/chan_sip.c?view=diff&rev=369430&r1=369429&r2=369430
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/chan_sip.c (original)
+++ team/oej/darjeeling-prack-1.8/channels/chan_sip.c Wed Jun 27 10:42:41 2012
@@ -4161,9 +4161,12 @@
{
int res;
- /* Room for PRACK */
if (ast_test_flag(&p->flags[2], SIP_PAGE3_PRACK)) {
- ast_debug(2, "=!=!=!=!=!=!=!= PRACK SHOULD BE USED HERE. Exactly HERE\n");
+ if (reliable == XMIT_PRACK) {
+ ast_debug(2, "=!=!=!=!=!=!=!= PRACK WILL BE USED HERE. Exactly HERE\n");
+ } else {
+ ast_debug(2, "=!=!=!=!=!=!=!= PRACK COULD BE USED HERE. Exactly HERE\n");
+ }
}
finalize_content(req);
@@ -21082,6 +21085,8 @@
struct ast_channel *owner;
int sipmethod;
const char *c = get_header(req, "Cseq");
+ const char *required = get_header(req, "Required");
+
/* GCC 4.2 complains if I try to cast c as a char * when passing it to ast_skip_nonblanks, so make a copy of it */
char *c_copy = ast_strdupa(c);
/* Skip the Cseq and its subsequent spaces */
@@ -21113,6 +21118,19 @@
owner->hangupcause = hangup_sip2cause(resp);
}
+ /* If we have a required header in the response, the other side have activated an extension
+ we said that we do support */
+ if (!ast_strlen_zero(required)) {
+ int activeextensions = parse_required_sip_options(required);
+ if (activeextensions & SIP_OPT_100REL) {
+ ast_debug(3, "!=!=!=!=!=! Response relies on PRACK! \n");
+ /* DO Something here !!! */
+ }
+ if (activeextensions & SIP_OPT_TIMER) {
+ ast_debug(3, "!=!=!=!=!=! The other side activated Session timers! \n");
+ }
+ }
+
if (p->socket.type == SIP_TRANSPORT_UDP) {
int ack_res = FALSE;
@@ -21168,6 +21186,7 @@
pvt_set_needdestroy(p, "received 4XX response to a BYE");
return;
}
+
if (p->relatedpeer && sipmethod == SIP_OPTIONS) {
/* We don't really care what the response is, just that it replied back.
Modified: team/oej/darjeeling-prack-1.8/channels/sip/include/reqresp_parser.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/sip/include/reqresp_parser.h?view=diff&rev=369430&r1=369429&r2=369430
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/sip/include/reqresp_parser.h (original)
+++ team/oej/darjeeling-prack-1.8/channels/sip/include/reqresp_parser.h Wed Jun 27 10:42:41 2012
@@ -143,6 +143,14 @@
* \param unsupported out buffer length (optional)
*/
unsigned int parse_sip_options(const char *options, char *unsupported, size_t unsupported_len);
+
+/*!
+ * \brief Parse required header in incoming packet or response
+ * returns bitmap
+ *
+ * \param option list
+ */
+unsigned int parse_required_sip_options(const char *options);
/*!
* \brief Compare two URIs as described in RFC 3261 Section 19.1.4
Modified: team/oej/darjeeling-prack-1.8/channels/sip/reqresp_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/sip/reqresp_parser.c?view=diff&rev=369430&r1=369429&r2=369430
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/sip/reqresp_parser.c (original)
+++ team/oej/darjeeling-prack-1.8/channels/sip/reqresp_parser.c Wed Jun 27 10:42:41 2012
@@ -1516,18 +1516,13 @@
}
/*!
- * \brief Parse supported header in incoming packet
- *
- * \details This function parses through the options parameters and
- * builds a bit field representing all the SIP options in that field. When an
- * item is found that is not supported, it is copied to the unsupported
- * out buffer.
- *
+ * \brief Parse supported or required header in incoming packet
* \param option list
* \param unsupported out buffer (optional)
* \param unsupported out buffer length (optional)
+ * \param response True if this is a required header from a response
*/
-unsigned int parse_sip_options(const char *options, char *unsupported, size_t unsupported_len)
+static unsigned int _parse_sip_options(const char *options, char *unsupported, size_t unsupported_len)
{
char *next, *sep;
char *temp;
@@ -1547,7 +1542,7 @@
temp = ast_strdupa(options);
- ast_debug(3, "Begin: parsing SIP \"Supported: %s\"\n", options);
+ ast_debug(3, "Begin: parsing SIP \"Required:\" or \"Supported: %s\"\n", options);
for (next = temp; next; next = sep) {
found = FALSE;
@@ -1742,6 +1737,35 @@
return res;
}
+
+/*!
+ * \brief Parse supported header in incoming packet
+ *
+ * \details This function parses through the options parameters and
+ * builds a bit field representing all the SIP options in that field. When an
+ * item is found that is not supported, it is copied to the unsupported
+ * out buffer.
+ *
+ * \param option list
+ * \param unsupported out buffer (optional)
+ * \param unsupported out buffer length (optional)
+ */
+unsigned int parse_sip_options(const char *options, char *unsupported, size_t unsupported_len)
+{
+ return _parse_sip_options(options, unsupported, unsupported_len);
+}
+
+/*!
+ * \brief required header in incoming packet or response
+ * returns bitmap
+ *
+ * \param option list
+ */
+unsigned int parse_required_sip_options(const char *options)
+{
+ return _parse_sip_options(options, NULL, 0 );
+}
+
/*! \brief helper routine for sip_uri_cmp to compare URI parameters
*
More information about the asterisk-commits
mailing list