[asterisk-commits] rizzo: branch rizzo/astobj2 r47715 -
/team/rizzo/astobj2/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Nov 15 17:54:18 MST 2006
Author: rizzo
Date: Wed Nov 15 18:54:17 2006
New Revision: 47715
URL: http://svn.digium.com/view/asterisk?view=rev&rev=47715
Log:
one more handler to map string to integers
Modified:
team/rizzo/astobj2/channels/chan_sip.c
Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=47715&r1=47714&r2=47715
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Wed Nov 15 18:54:17 2006
@@ -15657,16 +15657,25 @@
/*! \brief generic block */
#define M_F(tag, f) if (!strcasecmp((__s), tag)) { f; } else
+
/* set a boolean */
#define M_BOOL(tag, dst) M_F(tag, (dst) = ast_true(__val) )
+
/* set a given flag if true */
#define M_FLAG(tag, dst, flag) M_F(tag, { if (ast_true(__val)) ast_set_flag(&dst, flag); } )
+
/* set unsigned integer */
#define M_UINT(tag, dst) M_F(tag, (dst) = strtoul(__val, NULL, 0) )
+
/* set a static string */
#define M_STR(tag, dst) M_F(tag, ast_copy_string(dst, __val, sizeof(dst)))
+
+/* map a string to an integer value */
+#define M_MAPSTR(tag, dst, func) M_F(tag, {dst = func(__val); if (dst == -1) dst = atoi(__val);})
+
/* set integer if >= min, otherwise use dflt */
#define M_INT_GE(tag, dst, min, dflt) M_F(tag, dst = __def_int(__s, __val, v->lineno, min, dflt))
+
/* set integer if >= 0, otherwise use dflt */
#define M_INT_GE0(tag, dst, dflt) M_INT_GE(tag, dst, 0, dflt)
@@ -16049,10 +16058,7 @@
M_F("allow", ast_parse_allow_disallow(&user->prefs, &user->capability, v->value, 1))
M_F("disallow", ast_parse_allow_disallow(&user->prefs, &user->capability, v->value, 0))
M_BOOL("autoframing", user->autoframing)
- M_F("callingpres", {
- user->callingpres = ast_parse_caller_presentation(v->value);
- if (user->callingpres == -1)
- user->callingpres = atoi(v->value);} )
+ M_MAPSTR("callingpres", user->callingpres, ast_parse_caller_presentation)
M_INT_GE0("maxcallbitrate", user->maxcallbitrate, default_maxcallbitrate)
M_F("t38pt_udptl", ast_set2_flag(&user->flags[1], ast_true(v->value), SIP_PAGE2_T38SUPPORT_UDPTL))
#ifdef WHEN_WE_HAVE_T38_FOR_OTHER_TRANSPORTS
@@ -16265,10 +16271,7 @@
peer->defaddr.sin_port = htons(atoi(v->value));
else
peer->addr.sin_port = htons(atoi(v->value)); } )
- M_F("callingpres", {
- peer->callingpres = ast_parse_caller_presentation(v->value);
- if (peer->callingpres == -1)
- peer->callingpres = atoi(v->value); } )
+ M_MAPSTR("callingpres", peer->callingpres, ast_parse_caller_presentation)
M_STR("username", peer->username)
M_STR("language", peer->language)
M_STR("regexten", peer->regexten)
More information about the asterisk-commits
mailing list