[asterisk-commits] rizzo: branch rizzo/astobj2 r76225 - /team/rizzo/astobj2/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jul 20 20:37:04 CDT 2007
Author: rizzo
Date: Fri Jul 20 20:37:03 2007
New Revision: 76225
URL: http://svn.digium.com/view/asterisk?view=rev&rev=76225
Log:
more diff reduction and a bug fix: use !ast_strlen_zero(x) to check
for a non-empty string.
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=76225&r1=76224&r2=76225
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Fri Jul 20 20:37:03 2007
@@ -1758,12 +1758,7 @@
static struct ast_udptl *sip_get_udptl_peer(struct ast_channel *chan);
static int sip_set_udptl_peer(struct ast_channel *chan, struct ast_udptl *udptl);
-/*! \brief Definition of this channel for PBX channel registration
- * Note, in the load function we will define another ast_channel_tech
- * entry, not registered and to be used with SIP INFO DTMF frames,
- * which has send_digit_begin = NULL to inform the core that
- * the channel doesn't want DTMF BEGIN frames.
- */
+/*! \brief Definition of this channel for PBX channel registration */
static const struct ast_channel_tech sip_tech = {
.type = "SIP",
.description = "Session Initiation Protocol (SIP)",
@@ -1789,6 +1784,9 @@
.func_channel_read = acf_channel_read,
};
+/*! \brief This version of the sip channel tech has no send_digit_begin
+ * callback. This is for use with channels using SIP INFO DTMF so that
+ * the core knows that the channel doesn't want DTMF BEGIN frames. */
static const struct ast_channel_tech sip_tech_info = {
.type = "SIP",
.description = "Session Initiation Protocol (SIP)",
@@ -1812,6 +1810,7 @@
.send_text = sip_sendtext, /* called with chan locked */
};
+/* wrapper macro to tell whether t points to one of the sip_tech descriptors */
#define IS_SIP_TECH(t) ((t) == &sip_tech || (t) == &sip_tech_info)
/*! \begin map from an integer value to a string */
@@ -5287,7 +5286,7 @@
regobjs++;
ASTOBJ_INIT(reg);
ast_string_field_set(reg, callback, callback);
- if (username)
+ if (!ast_strlen_zero(username))
ast_string_field_set(reg, username, username);
if (hostname)
ast_string_field_set(reg, hostname, hostname);
@@ -5449,7 +5448,6 @@
return 0;
search += 10;
-
if (ast_strlen_zero(search))
return 0;
@@ -5458,6 +5456,7 @@
search++;
boundaryisquoted = TRUE;
}
+
/* make a duplicate of the string, with two extra characters
at the beginning */
boundary = ast_strdupa(search - 2);
@@ -6617,6 +6616,7 @@
p->sa = *sin;
ast_sip_ouraddrfor(&p->sa.sin_addr, &p->ourip);
}
+
p->branch = ast_random();
make_our_tag(p->tag, sizeof(p->tag));
p->ocseq = INITIAL_CSEQ;
@@ -15475,7 +15475,7 @@
AST_STANDARD_APP_ARGS(args, parse);
/* Sanity check */
- if (chan->tech != &sip_tech && chan->tech != &sip_tech_info) {
+ if (!IS_SIP_TECH(chan->tech)) {
ast_log(LOG_ERROR, "Cannot call %s on a non-SIP channel\n", funcname);
return 0;
}
More information about the asterisk-commits
mailing list