[asterisk-commits] file: trunk r104096 - in /trunk: ./ channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 25 15:40:31 CST 2008
Author: file
Date: Mon Feb 25 15:40:30 2008
New Revision: 104096
URL: http://svn.digium.com/view/asterisk?view=rev&rev=104096
Log:
Merged revisions 104095 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r104095 | file | 2008-02-25 17:37:20 -0400 (Mon, 25 Feb 2008) | 6 lines
Make it so a users.conf user creates both a SIP peer and a SIP user. The user will be used for inbound authentication for the device, and peer will be used for placing calls to the device.
(closes issue #9044)
Reported by: queuetue
Patches:
sip-gui-friend.diff uploaded by qwell (license 4)
........
Modified:
trunk/ (props changed)
trunk/channels/chan_sip.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=104096&r1=104095&r2=104096
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Feb 25 15:40:30 2008
@@ -1880,7 +1880,7 @@
/*--- Device object handling */
static struct sip_peer *temp_peer(const char *name);
static struct sip_peer *build_peer(const char *name, struct ast_variable *v, struct ast_variable *alt, int realtime);
-static struct sip_user *build_user(const char *name, struct ast_variable *v, int realtime);
+static struct sip_user *build_user(const char *name, struct ast_variable *v, struct ast_variable *alt, int realtime);
static int update_call_counter(struct sip_pvt *fup, int event);
static void sip_destroy_peer(struct sip_peer *peer);
static void sip_destroy_user(struct sip_user *user);
@@ -3767,7 +3767,7 @@
}
}
- user = build_user(username, var, !ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS));
+ user = build_user(username, var, NULL, !ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS));
if (!user) { /* No user found */
ast_variables_destroy(var);
@@ -19349,7 +19349,7 @@
}
/*! \brief Initiate a SIP user structure from configuration (configuration or realtime) */
-static struct sip_user *build_user(const char *name, struct ast_variable *v, int realtime)
+static struct sip_user *build_user(const char *name, struct ast_variable *v, struct ast_variable *alt, int realtime)
{
struct sip_user *user;
int format;
@@ -19385,7 +19385,7 @@
strcpy(user->language, default_language);
strcpy(user->mohinterpret, default_mohinterpret);
strcpy(user->mohsuggest, default_mohsuggest);
- for (; v; v = v->next) {
+ for (; v || ((v = alt) && !(alt=NULL)); v = v->next) {
if (handle_common_options(&userflags[0], &mask[0], v))
continue;
if (!strcasecmp(v->name, "context")) {
@@ -20522,6 +20522,12 @@
hassip = ast_variable_retrieve(ucfg, cat, "hassip");
registersip = ast_variable_retrieve(ucfg, cat, "registersip");
if (ast_true(hassip) || (!hassip && genhassip)) {
+ user = build_user(cat, gen, ast_variable_browse(ucfg, cat), 0);
+ if (user) {
+ ASTOBJ_CONTAINER_LINK(&userl,user);
+ ASTOBJ_UNREF(user, sip_destroy_user);
+ user_count++;
+ }
peer = build_peer(cat, gen, ast_variable_browse(ucfg, cat), 0);
if (peer) {
ast_device_state_changed("SIP/%s", peer->name);
@@ -20583,7 +20589,7 @@
continue;
}
if (is_user) {
- user = build_user(cat, ast_variable_browse(cfg, cat), 0);
+ user = build_user(cat, ast_variable_browse(cfg, cat), NULL, 0);
if (user) {
ASTOBJ_CONTAINER_LINK(&userl, user);
unref_user(user);
More information about the asterisk-commits
mailing list