[asterisk-commits] mmichelson: branch 1.4 r78826 - /branches/1.4/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Aug 9 14:52:44 CDT 2007
Author: mmichelson
Date: Thu Aug 9 14:52:43 2007
New Revision: 78826
URL: http://svn.digium.com/view/asterisk?view=rev&rev=78826
Log:
I broke canreinvite...Now I'm fixing it. I put some new code in the wrong place and so I've reverted the canreinvite section to how it was and put my new code where it should be.
Modified:
branches/1.4/channels/chan_sip.c
Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=78826&r1=78825&r2=78826
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Thu Aug 9 14:52:43 2007
@@ -15683,10 +15683,28 @@
*/
static void set_insecure_flags(struct ast_flags *flags, const char *value, int lineno)
{
- if (!strcasecmp(value, "very"))
+ static int dep_insecure_very = 0;
+ static int dep_insecure_yes = 0;
+ if (!strcasecmp(value, "very")) {
ast_set_flag(flags, SIP_INSECURE_PORT | SIP_INSECURE_INVITE);
- else if (ast_true(value))
+ if(!dep_insecure_very) {
+ if(lineno != -1)
+ ast_log(LOG_WARNING, "insecure=very at line %d is deprecated; use insecure=port,invite instead\n", lineno);
+ else
+ ast_log(LOG_WARNING, "insecure=very is deprecated; use insecure=port,invite instead\n");
+ dep_insecure_very = 1;
+ }
+ }
+ else if (ast_true(value)) {
ast_set_flag(flags, SIP_INSECURE_PORT);
+ if(!dep_insecure_yes) {
+ if(lineno != -1)
+ ast_log(LOG_WARNING, "insecure=%s at line %d is deprecated; use insecure=port instead\n", value, lineno);
+ else
+ ast_log(LOG_WARNING, "insecure=%s is deprecated; use insecure=port instead\n", value);
+ dep_insecure_yes = 1;
+ }
+ }
else if (!ast_false(value)) {
char buf[64];
char *word, *next;
@@ -15713,8 +15731,6 @@
static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask, struct ast_variable *v)
{
int res = 1;
- static int dep_insecure_very = 0;
- static int dep_insecure_yes = 0;
if (!strcasecmp(v->name, "trustrpid")) {
ast_set_flag(&mask[0], SIP_TRUSTRPID);
@@ -15757,39 +15773,28 @@
} else if (!strcasecmp(v->name, "canreinvite")) {
ast_set_flag(&mask[0], SIP_REINVITE);
ast_clear_flag(&flags[0], SIP_REINVITE);
- set_insecure_flags(flags, v->value, v->lineno);
+ if(ast_true(v->value)) {
+ ast_set_flag(&flags[0], SIP_CAN_REINVITE | SIP_CAN_REINVITE_NAT);
+ } else if (!ast_false(v->value)) {
+ char buf[64];
+ char *word, *next = buf;
+
+ ast_copy_string(buf, v->value, sizeof(buf));
+ while ((word = strsep(&next, ","))) {
+ if(!strcasecmp(word, "update")) {
+ ast_set_flag(&flags[0], SIP_REINVITE_UPDATE | SIP_CAN_REINVITE);
+ } else if(!strcasecmp(word, "nonat")) {
+ ast_set_flag(&flags[0], SIP_CAN_REINVITE);
+ ast_clear_flag(&flags[0], SIP_CAN_REINVITE_NAT);
+ } else {
+ ast_log(LOG_WARNING, "Unknown canreinvite mode '%s' on line %d\n", v->value, v->lineno);
+ }
+ }
+ }
} else if (!strcasecmp(v->name, "insecure")) {
ast_set_flag(&mask[0], SIP_INSECURE_PORT | SIP_INSECURE_INVITE);
ast_clear_flag(&flags[0], SIP_INSECURE_PORT | SIP_INSECURE_INVITE);
- if (!strcasecmp(v->value, "very")) {
- ast_set_flag(&flags[0], SIP_INSECURE_PORT | SIP_INSECURE_INVITE);
- if (!dep_insecure_very) {
- ast_log(LOG_WARNING, "insecure=very at line %d is deprecated; use insecure=port,invite instead\n", v->lineno);
- dep_insecure_very = 1;
- }
- }
- else if (ast_true(v->value)) {
- ast_set_flag(&flags[0], SIP_INSECURE_PORT);
- if (!dep_insecure_yes) {
- ast_log(LOG_WARNING, "insecure=%s at line %d is deprecated; use insecure=port instead\n", v->value, v->lineno);
- dep_insecure_yes = 1;
- }
- }
- else if (!ast_false(v->value)) {
- char buf[64];
- char *word, *next;
-
- ast_copy_string(buf, v->value, sizeof(buf));
- next = buf;
- while ((word = strsep(&next, ","))) {
- if (!strcasecmp(word, "port"))
- ast_set_flag(&flags[0], SIP_INSECURE_PORT);
- else if (!strcasecmp(word, "invite"))
- ast_set_flag(&flags[0], SIP_INSECURE_INVITE);
- else
- ast_log(LOG_WARNING, "Unknown insecure mode '%s' on line %d\n", v->value, v->lineno);
- }
- }
+ set_insecure_flags(flags, v->value, v->lineno);
} else if (!strcasecmp(v->name, "progressinband")) {
ast_set_flag(&mask[0], SIP_PROG_INBAND);
ast_clear_flag(&flags[0], SIP_PROG_INBAND);
More information about the asterisk-commits
mailing list