[asterisk-commits] kpfleming: branch 1.6.0 r200724 - in /branches/1.6.0: ./ channels/ configs/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jun 15 16:29:36 CDT 2009
Author: kpfleming
Date: Mon Jun 15 16:29:27 2009
New Revision: 200724
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=200724
Log:
Merged revisions 165180,200689 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r165180 | mnicholson | 2008-12-17 12:49:12 -0600 (Wed, 17 Dec 2008) | 14 lines
This patch adds a new 'ignoresdpversion' option to sip.conf. When this is
enabled (either globally or for a specific peer), chan_sip will treat any SDP
data it receives as new data and update the media stream accordingly. By
default, Asterisk will only modify the media stream if the SDP session version
received is different from the current SDP session version. This option is
required to interoperate with devices that have non-standard SDP session
version implementations (observed by toc on the bug tracker with Microsoft OCS
which always uses 0 as the session version).
http://reviewboard.digium.com/r/94/
(closes issue #13958)
Reported by: toc
Tested by: toc
........
r200689 | kpfleming | 2009-06-15 15:42:38 -0500 (Mon, 15 Jun 2009) | 12 lines
Accept T.38 re-INVITE responses with invalid SDP versions.
This commit changes the 'incoming SDP version' check logic a bit more; when
'ignoresdpversion' is *not* set for a peer, if we initiate a re-INVITE to
switch to T.38, we'll always accept the peer's SDP response, even if they
don't properly increment the SDP version number as they should. If this situation
occurs, a warning message will be generated suggesting that the peer's
configuration be changed to include the 'ignoresdpversion' configuration option
(although ideally they'd fix their SIP implementation to be RFC compliant).
AST-221
........
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/channels/chan_sip.c
branches/1.6.0/configs/sip.conf.sample
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.0/channels/chan_sip.c?view=diff&rev=200724&r1=200723&r2=200724
==============================================================================
--- branches/1.6.0/channels/chan_sip.c (original)
+++ branches/1.6.0/channels/chan_sip.c Mon Jun 15 16:29:27 2009
@@ -981,6 +981,7 @@
#define SIP_PAGE2_ALLOWSUBSCRIBE (1 << 16) /*!< GP: Allow subscriptions from this peer? */
#define SIP_PAGE2_ALLOWOVERLAP (1 << 17) /*!< DP: Allow overlap dialing ? */
#define SIP_PAGE2_SUBSCRIBEMWIONLY (1 << 18) /*!< GP: Only issue MWI notification if subscribed to */
+#define SIP_PAGE2_IGNORESDPVERSION (1 << 19) /*!< GDP: Ignore the SDP session version number we receive and treat all sessions as new */
#define SIP_PAGE2_T38SUPPORT (7 << 20) /*!< GDP: T38 Fax Passthrough Support */
#define SIP_PAGE2_T38SUPPORT_UDPTL (1 << 20) /*!< GDP: T38 Fax Passthrough Support */
@@ -999,9 +1000,9 @@
#define SIP_PAGE2_UDPTL_DESTINATION (1 << 30) /*!< DP: Use source IP of RTP as destination if NAT is enabled */
#define SIP_PAGE2_FLAGS_TO_COPY \
- (SIP_PAGE2_ALLOWSUBSCRIBE | SIP_PAGE2_ALLOWOVERLAP | SIP_PAGE2_VIDEOSUPPORT | \
- SIP_PAGE2_T38SUPPORT | SIP_PAGE2_RFC2833_COMPENSATE | SIP_PAGE2_BUGGY_MWI | \
- SIP_PAGE2_TEXTSUPPORT | SIP_PAGE2_UDPTL_DESTINATION)
+ (SIP_PAGE2_ALLOWSUBSCRIBE | SIP_PAGE2_ALLOWOVERLAP | SIP_PAGE2_IGNORESDPVERSION | \
+ SIP_PAGE2_VIDEOSUPPORT | SIP_PAGE2_T38SUPPORT | SIP_PAGE2_RFC2833_COMPENSATE | \
+ SIP_PAGE2_BUGGY_MWI | SIP_PAGE2_TEXTSUPPORT | SIP_PAGE2_UDPTL_DESTINATION)
/*@}*/
@@ -6761,13 +6762,39 @@
return -1;
}
- if (p->sessionversion_remote < 0 || p->sessionversion_remote != rua_version) {
- p->sessionversion_remote = rua_version;
+ /* we need to check the SDP version number the other end sent us;
+ * our rules for deciding what to accept are a bit complex.
+ *
+ * 1) if 'ignoresdpversion' has been set for this dialog, then
+ * we will just accept whatever they sent and assume it is
+ * a modification of the session, even if it is not
+ * 2) otherwise, if this is the first SDP we've seen from them
+ * we accept it
+ * 3) otherwise, if the new SDP version number is higher than the
+ * old one, we accept it
+ * 4) otherwise, if this SDP is in response to us requesting a switch
+ * to T.38, we accept the SDP, but also generate a warning message
+ * that this peer should have the 'ignoresdpversion' option set,
+ * because it is not following the SDP offer/answer RFC; if we did
+ * not request a switch to T.38, then we stop parsing the SDP, as it
+ * has not changed from the previous version
+ */
+
+ if (ast_test_flag(&p->flags[1], SIP_PAGE2_IGNORESDPVERSION) ||
+ (p->sessionversion_remote < 0) ||
+ (p->sessionversion_remote < rua_version)) {
+ p->sessionversion_remote = rua_version;
p->session_modify = TRUE;
- } else if (p->sessionversion_remote == rua_version) {
- p->session_modify = FALSE;
- ast_debug(2, "SDP version number same as previous SDP\n");
- return 0;
+ } else {
+ if (p->t38.state == T38_LOCAL_REINVITE) {
+ p->sessionversion_remote = rua_version;
+ p->session_modify = TRUE;
+ ast_log(LOG_WARNING, "Call %s responded to our T.38 reinvite without changing SDP version; 'ignoresdpversion' should be set for this peer.\n", p->callid);
+ } else {
+ p->session_modify = FALSE;
+ ast_debug(2, "Call %s responded to our reinvite without changing SDP version; ignoring SDP.\n", p->callid);
+ return 0;
+ }
}
/* Try to find first media stream */
@@ -13237,6 +13264,7 @@
ast_cli(fd, " User=Phone : %s\n", cli_yesno(ast_test_flag(&peer->flags[0], SIP_USEREQPHONE)));
ast_cli(fd, " Video Support: %s\n", cli_yesno(ast_test_flag(&peer->flags[1], SIP_PAGE2_VIDEOSUPPORT)));
ast_cli(fd, " Text Support : %s\n", cli_yesno(ast_test_flag(&peer->flags[1], SIP_PAGE2_TEXTSUPPORT)));
+ ast_cli(fd, " Ign SDP ver : %s\n", cli_yesno(ast_test_flag(&peer->flags[1], SIP_PAGE2_IGNORESDPVERSION)));
ast_cli(fd, " Trust RPID : %s\n", cli_yesno(ast_test_flag(&peer->flags[0], SIP_TRUSTRPID)));
ast_cli(fd, " Send RPID : %s\n", cli_yesno(ast_test_flag(&peer->flags[0], SIP_SENDRPID)));
ast_cli(fd, " Subscriptions: %s\n", cli_yesno(ast_test_flag(&peer->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)));
@@ -13439,6 +13467,7 @@
ast_cli(a->fd, " Sess-Refresh : %s\n", strefresher2str(user->stimer.st_ref));
ast_cli(a->fd, " Sess-Expires : %d secs\n", user->stimer.st_max_se);
ast_cli(a->fd, " Sess-Min-SE : %d secs\n", user->stimer.st_min_se);
+ ast_cli(a->fd, " Ign SDP ver : %s\n", cli_yesno(ast_test_flag(&user->flags[1], SIP_PAGE2_IGNORESDPVERSION)));
ast_cli(a->fd, " Codec Order : (");
print_codec_to_cli(a->fd, &user->prefs);
@@ -13590,6 +13619,7 @@
ast_cli(a->fd, " Videosupport: %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_VIDEOSUPPORT)));
ast_cli(a->fd, " Textsupport: %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_TEXTSUPPORT)));
ast_cli(a->fd, " AutoCreate Peer: %s\n", cli_yesno(autocreatepeer));
+ ast_cli(a->fd, " Ignore SDP sess. ver.: %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_IGNORESDPVERSION)));
ast_cli(a->fd, " Match Auth Username: %s\n", cli_yesno(global_match_auth_username));
ast_cli(a->fd, " Allow unknown access: %s\n", cli_yesno(global_allowguest));
ast_cli(a->fd, " Allow subscriptions: %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)));
@@ -20496,6 +20526,9 @@
} else if (!strcasecmp(v->name, "allowsubscribe")) {
ast_set_flag(&mask[1], SIP_PAGE2_ALLOWSUBSCRIBE);
ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_ALLOWSUBSCRIBE);
+ } else if (!strcasecmp(v->name, "ignoresdpversion")) {
+ ast_set_flag(&mask[1], SIP_PAGE2_IGNORESDPVERSION);
+ ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_IGNORESDPVERSION);
} else if (!strcasecmp(v->name, "t38pt_udptl")) {
ast_set_flag(&mask[1], SIP_PAGE2_T38SUPPORT_UDPTL);
ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_T38SUPPORT_UDPTL);
@@ -21613,6 +21646,7 @@
ast_clear_flag(&global_flags[1], SIP_PAGE2_VIDEOSUPPORT);
ast_clear_flag(&global_flags[1], SIP_PAGE2_TEXTSUPPORT);
+ ast_clear_flag(&global_flags[1], SIP_PAGE2_IGNORESDPVERSION);
/* Read the [general] config section of sip.conf (or from realtime config) */
for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
Modified: branches/1.6.0/configs/sip.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.0/configs/sip.conf.sample?view=diff&rev=200724&r1=200723&r2=200724
==============================================================================
--- branches/1.6.0/configs/sip.conf.sample (original)
+++ branches/1.6.0/configs/sip.conf.sample Mon Jun 15 16:29:27 2009
@@ -570,6 +570,15 @@
; instead of INVITE. This can be combined with 'nonat', as
; 'canreinvite=update,nonat'. It implies 'yes'.
+;ignoresdpversion=yes ; By default, Asterisk will honor the session version
+ ; number in SDP packets and will only modify the SDP
+ ; session if the version number changes. This option will
+ ; force asterisk to ignore the SDP session version number
+ ; and treat all SDP data as new data. This is required
+ ; for devices that send us non standard SDP packets
+ ; (observed with Microsoft OCS). By default this option is
+ ; off.
+
;----------------------------------------- REALTIME SUPPORT ------------------------
; For additional information on ARA, the Asterisk Realtime Architecture,
; please read realtime.txt and extconfig.txt in the /doc directory of the
@@ -729,12 +738,19 @@
; subscribecontext subscribecontext
; videosupport videosupport
; maxcallbitrate maxcallbitrate
-; rfc2833compensate mailbox
-; session-timers busylevel
-; session-expires
-; session-minse template
-; session-refresher fromdomain
-; t38pt_usertpsource regexten
+; rfc2833compensate rfc2833compensate
+; ignoresdpversion ignoresdpversion
+; session-timers session-timers
+; session-expires session-expires
+; session-minse session-minse
+; session-refresher session-refresher
+; t38pt_usertpsource t38pt_usertpsource
+; regexten
+; template
+; fromdomain
+; regexten
+; mailbox
+; busylevel
; fromuser
; host
; port
@@ -745,17 +761,11 @@
; rtpholdtimeout
; sendrpid
; outboundproxy
-; rfc2833compensate
; callbackextension
; registertrying
-; session-timers
-; session-expires
-; session-minse
-; session-refresher
; timert1
; timerb
; qualifyfreq
-; t38pt_usertpsource
; contactpermit ; Limit what a host may register as (a neat trick
; contactdeny ; is to register at the same IP as a SIP provider,
; ; then call oneself, and get redirected to that
More information about the asterisk-commits
mailing list