[asterisk-commits] mmichelson: branch group/v6-new r274646 - in /team/group/v6-new: ./ channels/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 7 14:17:57 CDT 2010
Author: mmichelson
Date: Wed Jul 7 14:17:52 2010
New Revision: 274646
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=274646
Log:
Resolve conflict and reset automerge.
Modified:
team/group/v6-new/ (props changed)
team/group/v6-new/channels/chan_dahdi.c
team/group/v6-new/channels/chan_sip.c
team/group/v6-new/res/res_fax.c
Propchange: team/group/v6-new/
------------------------------------------------------------------------------
automerge = *
Propchange: team/group/v6-new/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/group/v6-new/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jul 7 14:17:52 2010
@@ -1,1 +1,1 @@
-/trunk:1-270973,270975-274497
+/trunk:1-270973,270975-274642
Modified: team/group/v6-new/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/channels/chan_dahdi.c?view=diff&rev=274646&r1=274645&r2=274646
==============================================================================
--- team/group/v6-new/channels/chan_dahdi.c (original)
+++ team/group/v6-new/channels/chan_dahdi.c Wed Jul 7 14:17:52 2010
@@ -16891,8 +16891,10 @@
confp->mfcr2.forced_release = ast_true(v->value) ? 1 : 0;
} else if (!strcasecmp(v->name, "mfcr2_immediate_accept")) {
confp->mfcr2.immediate_accept = ast_true(v->value) ? 1 : 0;
+#if defined(OR2_LIB_INTERFACE) && OR2_LIB_INTERFACE > 1
} else if (!strcasecmp(v->name, "mfcr2_skip_category")) {
confp->mfcr2.skip_category_request = ast_true(v->value) ? 1 : 0;
+#endif
} else if (!strcasecmp(v->name, "mfcr2_call_files")) {
confp->mfcr2.call_files = ast_true(v->value) ? 1 : 0;
} else if (!strcasecmp(v->name, "mfcr2_max_ani")) {
@@ -17043,6 +17045,7 @@
res = ioctl(ctlfd, DAHDI_SET_DIALPARAMS, &dps);
if (res < 0) {
ast_log(LOG_ERROR, "Invalid tone duration: %d ms at line %d: %s\n", toneduration, v->lineno, strerror(errno));
+ close(ctlfd);
return -1;
}
}
Modified: team/group/v6-new/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/channels/chan_sip.c?view=diff&rev=274646&r1=274645&r2=274646
==============================================================================
--- team/group/v6-new/channels/chan_sip.c (original)
+++ team/group/v6-new/channels/chan_sip.c Wed Jul 7 14:17:52 2010
@@ -3449,10 +3449,8 @@
}
}
- if (p->subscribed == MWI_NOTIFICATION) {
- if (p->relatedpeer) {
- p->relatedpeer = unref_peer(p->relatedpeer, "__sip_autodestruct: unref peer p->relatedpeer"); /* Remove link to peer. If it's realtime, make sure it's gone from memory) */
- }
+ if (p->relatedpeer) {
+ p->relatedpeer = unref_peer(p->relatedpeer, "__sip_autodestruct: unref peer p->relatedpeer"); /* Remove link to peer. If it's realtime, make sure it's gone from memory) */
}
/* Reset schedule ID */
@@ -4664,6 +4662,7 @@
} else
return -1;
+ /* XXX TODO: get flags directly from peer only as they are needed using dialog->relatedpeer */
ast_copy_flags(&dialog->flags[0], &peer->flags[0], SIP_FLAGS_TO_COPY);
ast_copy_flags(&dialog->flags[1], &peer->flags[1], SIP_PAGE2_FLAGS_TO_COPY);
ast_copy_flags(&dialog->flags[2], &peer->flags[2], SIP_PAGE3_FLAGS_TO_COPY);
@@ -4711,6 +4710,7 @@
ast_rtp_instance_set_hold_timeout(dialog->trtp, peer->rtpholdtimeout);
}
+ /* XXX TODO: get fields directly from peer only as they are needed using dialog->relatedpeer */
ast_string_field_set(dialog, peername, peer->name);
ast_string_field_set(dialog, authname, peer->username);
ast_string_field_set(dialog, username, peer->username);
@@ -4829,7 +4829,7 @@
if (!ast_sockaddr_isnull(remote_address)) {
ast_sockaddr_copy(&dialog->sa, remote_address);
}
-
+ dialog->relatedpeer = ref_peer(peer, "create_addr: setting dialog's relatedpeer pointer");
unref_peer(peer, "create_addr: unref peer from find_peer hashtab lookup");
return res;
}
@@ -5272,7 +5272,7 @@
ast_copy_string(name, fup->username, sizeof(name));
/* Check the list of devices */
- if ((p = find_peer(ast_strlen_zero(fup->peername) ? name : fup->peername, NULL, TRUE, FINDALLDEVICES, FALSE, 0))) {
+ if ((p = fup->relatedpeer)) {
inuse = &p->inUse;
call_limit = &p->call_limit;
inringing = &p->inRinging;
@@ -12944,17 +12944,14 @@
/*! \brief Change onhold state of a peer using a pvt structure */
static void sip_peer_hold(struct sip_pvt *p, int hold)
{
- struct sip_peer *peer = find_peer(p->peername, NULL, 1, FINDALLDEVICES, FALSE, 0);
-
- if (!peer)
+ if (!p->relatedpeer)
return;
/* If they put someone on hold, increment the value... otherwise decrement it */
- ast_atomic_fetchadd_int(&peer->onHold, (hold ? +1 : -1));
+ ast_atomic_fetchadd_int(&p->relatedpeer->onHold, (hold ? +1 : -1));
/* Request device state update */
- ast_devstate_changed(AST_DEVICE_UNKNOWN, "SIP/%s", peer->name);
- unref_peer(peer, "sip_peer_hold: from find_peer operation");
+ ast_devstate_changed(AST_DEVICE_UNKNOWN, "SIP/%s", p->relatedpeer->name);
return;
}
@@ -16505,8 +16502,8 @@
#define FORMAT4 "%-15.15s %-15.15s %-15.15s %-15.15s %-13.13s %-15.15s %-10.10s %-6.6d\n"
#define FORMAT3 "%-15.15s %-15.15s %-15.15s %-15.15s %-13.13s %-15.15s %-10.10s %-6.6s\n"
-#define FORMAT2 "%-15.15s %-15.15s %-15.15s %-15.15s %-7.7s %-15.15s %-6.6s\n"
-#define FORMAT "%-15.15s %-15.15s %-15.15s %-15.15s %-3.3s %-3.3s %-15.15s %-10.10s\n"
+#define FORMAT2 "%-15.15s %-15.15s %-15.15s %-15.15s %-7.7s %-15.15s %-10.10s %-10.10s\n"
+#define FORMAT "%-15.15s %-15.15s %-15.15s %-15.15s %-3.3s %-3.3s %-15.15s %-10.10s %-10.10s\n"
/*! \brief callback for show channel|subscription */
static int show_channels_cb(void *__cur, void *__arg, int flags)
@@ -16528,7 +16525,8 @@
AST_CLI_YESNO(ast_test_flag(&cur->flags[1], SIP_PAGE2_CALL_ONHOLD)),
cur->needdestroy ? "(d)" : "",
cur->lastmsg ,
- referstatus
+ referstatus,
+ cur->relatedpeer ? cur->relatedpeer->name : "<guest>"
);
arg->numchans++;
}
@@ -16576,7 +16574,7 @@
return CLI_SHOWUSAGE;
arg.subscriptions = !strcasecmp(a->argv[e->args - 1], "subscriptions");
if (!arg.subscriptions)
- ast_cli(arg.fd, FORMAT2, "Peer", "User/ANR", "Call ID", "Format", "Hold", "Last Message", "Expiry");
+ ast_cli(arg.fd, FORMAT2, "Peer", "User/ANR", "Call ID", "Format", "Hold", "Last Message", "Expiry", "Peer");
else
ast_cli(arg.fd, FORMAT3, "Peer", "User", "Call ID", "Extension", "Last state", "Type", "Mailbox", "Expiry");
@@ -18903,7 +18901,6 @@
char *c_copy = ast_strdupa(c);
/* Skip the Cseq and its subsequent spaces */
const char *msg = ast_skip_blanks(ast_skip_nonblanks(c_copy));
- struct sip_peer *peer;
if (!msg)
msg = "";
@@ -19150,9 +19147,8 @@
case 405:
case 501: /* Not Implemented */
mark_method_unallowed(&p->allowed_methods, sipmethod);
- if ((peer = find_peer(p->peername, 0, 1, FINDPEERS, FALSE, 0))) {
- mark_method_allowed(&peer->disallowed_methods, sipmethod);
- unref_peer(peer, "handle_response: marking a specific method as unallowed");
+ if (p->relatedpeer) {
+ mark_method_allowed(&p->relatedpeer->disallowed_methods, sipmethod);
}
if (sipmethod == SIP_INVITE)
handle_response_invite(p, resp, rest, req, seqno);
@@ -20432,6 +20428,7 @@
const char *required;
unsigned int required_profile = 0;
struct ast_channel *c = NULL; /* New channel */
+ struct sip_peer *authpeer = NULL; /* Matching Peer */
int reinvite = 0;
int rtn;
@@ -20765,7 +20762,7 @@
/* Handle authentication if this is our first invite */
int cc_recall_core_id = -1;
set_pvt_allowed_methods(p, req);
- res = check_user(p, req, SIP_INVITE, e, XMIT_RELIABLE, addr);
+ res = check_user_full(p, req, SIP_INVITE, e, XMIT_RELIABLE, addr, &authpeer);
if (res == AUTH_CHALLENGE_SENT) {
p->invitestate = INV_COMPLETED; /* Needs to restart in another INVITE transaction */
res = 0;
@@ -20785,6 +20782,9 @@
res = 0;
goto request_invite_cleanup;
}
+
+ /* Successful authentication and peer matching so record the peer related to this pvt (for easy access to peer settings) */
+ p->relatedpeer = ref_peer(authpeer, "setting dialog's relatedpeer pointer");
/* If T38 is needed but not present, then make it magically appear */
if (ast_test_flag(&p->flags[1], SIP_PAGE2_T38SUPPORT) && !p->udptl) {
@@ -24137,14 +24137,11 @@
{
if (max == TRUE) {
if (p->stimer->st_cached_max_se) {
- return p->stimer->st_cached_max_se;
- } else if (p->peername) {
- struct sip_peer *pp = find_peer(p->peername, NULL, TRUE, FINDPEERS, FALSE, 0);
- if (pp) {
- p->stimer->st_cached_max_se = pp->stimer.st_max_se;
- unref_peer(pp, "unref peer pointer from find_peer call in st_get_se");
- return (p->stimer->st_cached_max_se);
- }
+ return p->stimer->st_cached_max_se;
+ }
+ if (p->relatedpeer) {
+ p->stimer->st_cached_max_se = p->relatedpeer->stimer.st_max_se;
+ return (p->stimer->st_cached_max_se);
}
p->stimer->st_cached_max_se = global_max_se;
return (p->stimer->st_cached_max_se);
@@ -24153,13 +24150,9 @@
if (p->stimer->st_cached_min_se) {
return p->stimer->st_cached_min_se;
}
- if (p->peername) {
- struct sip_peer *pp = find_peer(p->peername, NULL, TRUE, FINDPEERS, FALSE, 0);
- if (pp) {
- p->stimer->st_cached_min_se = pp->stimer.st_min_se;
- unref_peer(pp, "unref peer pointer from find_peer call in st_get_se (2)");
- return (p->stimer->st_cached_min_se);
- }
+ if (p->relatedpeer) {
+ p->stimer->st_cached_min_se = p->relatedpeer->stimer.st_min_se;
+ return (p->stimer->st_cached_min_se);
}
p->stimer->st_cached_min_se = global_min_se;
return (p->stimer->st_cached_min_se);
@@ -24174,13 +24167,9 @@
if (p->stimer->st_cached_ref != SESSION_TIMER_REFRESHER_AUTO)
return p->stimer->st_cached_ref;
- if (p->peername) {
- struct sip_peer *pp = find_peer(p->peername, NULL, TRUE, FINDPEERS, FALSE, 0);
- if (pp) {
- p->stimer->st_cached_ref = pp->stimer.st_ref;
- unref_peer(pp, "unref peer pointer from find_peer call in st_get_refresher");
- return pp->stimer.st_ref;
- }
+ if (p->relatedpeer) {
+ p->stimer->st_cached_ref = p->relatedpeer->stimer.st_ref;
+ return p->stimer->st_cached_ref;
}
p->stimer->st_cached_ref = global_st_refresher;
@@ -24199,13 +24188,9 @@
if (p->stimer->st_cached_mode != SESSION_TIMER_MODE_INVALID)
return p->stimer->st_cached_mode;
- if (p->peername) {
- struct sip_peer *pp = find_peer(p->peername, NULL, TRUE, FINDPEERS, FALSE, 0);
- if (pp) {
- p->stimer->st_cached_mode = pp->stimer.st_mode_oper;
- unref_peer(pp, "unref peer pointer from find_peer call in st_get_mode");
- return pp->stimer.st_mode_oper;
- }
+ if (p->relatedpeer) {
+ p->stimer->st_cached_mode = p->relatedpeer->stimer.st_mode_oper;
+ return p->stimer->st_cached_mode;
}
p->stimer->st_cached_mode = global_st_mode;
Modified: team/group/v6-new/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/res/res_fax.c?view=diff&rev=274646&r1=274645&r2=274646
==============================================================================
--- team/group/v6-new/res/res_fax.c (original)
+++ team/group/v6-new/res/res_fax.c Wed Jul 7 14:17:52 2010
@@ -278,6 +278,9 @@
d->modems = general_options.modems;
d->minrate = general_options.minrate;
d->maxrate = general_options.maxrate;
+ ast_string_field_set(d, result, "FAILED");
+ ast_string_field_set(d, resultstr, "error starting fax session");
+ ast_string_field_set(d, error, "INIT_ERROR");
return d;
}
@@ -685,11 +688,13 @@
return 0;
}
-#define GENERIC_FAX_EXEC_ERROR(fax, chan, reason) \
+#define GENERIC_FAX_EXEC_ERROR(fax, chan, errorstr, reason) \
do { \
- ast_log(LOG_ERROR, "channel '%s' FAX session '%d' failure, reason: '%s'\n", chan->name, fax->id, reason); \
+ ast_log(LOG_ERROR, "channel '%s' FAX session '%d' failure, reason: '%s' (%s)\n", chan->name, fax->id, reason, errorstr); \
pbx_builtin_setvar_helper(chan, "FAXSTATUSSTRING", reason); \
if (ast_strlen_zero(fax->details->result)) ast_string_field_set(fax->details, result, "FAILED"); \
+ if (ast_strlen_zero(fax->details->resultstr)) ast_string_field_set(fax->details, resultstr, reason); \
+ if (ast_strlen_zero(fax->details->error)) ast_string_field_set(fax->details, error, errorstr); \
res = ms = -1; \
} while (0)
@@ -889,8 +894,15 @@
if (fax->debug_info) {
fax->debug_info->base_tv = ast_tvnow();
}
+
+ /* reset our result fields just in case the fax tech driver wants to
+ * set custom error messages */
+ ast_string_field_set(details, result, "");
+ ast_string_field_set(details, resultstr, "");
+ ast_string_field_set(details, error, "");
+
if (fax->tech->start_session(fax) < 0) {
- GENERIC_FAX_EXEC_ERROR(fax, chan, "failed to start FAX session");
+ GENERIC_FAX_EXEC_ERROR(fax, chan, "INIT_ERROR", "failed to start FAX session");
}
pbx_builtin_setvar_helper(chan, "FAXSTATUS", NULL);
@@ -968,7 +980,7 @@
if (fax->smoother) {
/* push the frame into a smoother */
if (ast_smoother_feed(fax->smoother, frame) < 0) {
- GENERIC_FAX_EXEC_ERROR(fax, chan, "Failed to feed the smoother");
+ GENERIC_FAX_EXEC_ERROR(fax, chan, "UNKNOWN", "Failed to feed the smoother");
}
while ((f = ast_smoother_read(fax->smoother)) && (f->data.ptr)) {
if (fax->debug_info) {
@@ -1021,7 +1033,7 @@
continue;
} else {
ast_log(LOG_WARNING, "channel '%s' timed-out during the FAX transmission.\n", chan->name);
- GENERIC_FAX_EXEC_ERROR(fax, chan, "fax session timed-out");
+ GENERIC_FAX_EXEC_ERROR(fax, chan, "TIMEOUT", "fax session timed-out");
break;
}
}
@@ -1233,7 +1245,17 @@
struct ast_flags opts = { 0, };
struct manager_event_info info;
+ /* Get a FAX session details structure from the channel's FAX datastore and create one if
+ * it does not already exist. */
+ if (!(details = find_or_create_details(chan))) {
+ ast_log(LOG_ERROR, "System cannot provide memory for session requirements.\n");
+ return -1;
+ }
+
+
if (ast_strlen_zero(data)) {
+ ast_string_field_set(details, error, "INVALID_ARGUMENTS");
+ ast_string_field_set(details, resultstr, "invalid arguments");
ast_log(LOG_WARNING, "%s requires an argument (filename[,options])\n", app_receivefax);
return -1;
}
@@ -1254,12 +1276,16 @@
return -1;
}
if (ast_strlen_zero(args.filename)) {
+ ast_string_field_set(details, error, "INVALID_ARGUMENTS");
+ ast_string_field_set(details, resultstr, "invalid arguments");
ast_log(LOG_WARNING, "%s requires an argument (filename[,options])\n", app_receivefax);
return -1;
}
/* check for unsupported FAX application options */
if (ast_test_flag(&opts, OPT_CALLERMODE) || ast_test_flag(&opts, OPT_CALLEDMODE)) {
+ ast_string_field_set(details, error, "INVALID_ARGUMENTS");
+ ast_string_field_set(details, resultstr, "invalid arguments");
ast_log(LOG_WARNING, "%s does not support polling\n", app_receivefax);
return -1;
}
@@ -1277,14 +1303,9 @@
pbx_builtin_setvar_helper(chan, "FAXERROR", "Channel Problems");
pbx_builtin_setvar_helper(chan, "FAXSTATUSSTRING", "Error before FAX transmission started.");
- /* Get a FAX session details structure from the channel's FAX datastore and create one if
- * it does not already exist. */
- if (!(details = find_or_create_details(chan))) {
- ast_log(LOG_ERROR, "System cannot provide memory for session requirements.\n");
- return -1;
- }
-
if (!(doc = ast_calloc(1, sizeof(*doc) + strlen(args.filename) + 1))) {
+ ast_string_field_set(details, error, "MEMORY_ERROR");
+ ast_string_field_set(details, resultstr, "error allocating memory");
ast_log(LOG_ERROR, "System cannot provide memory for session requirements.\n");
ao2_ref(details, -1);
return -1;
@@ -1313,12 +1334,16 @@
}
if (set_fax_t38_caps(chan, details)) {
+ ast_string_field_set(details, error, "T38_NEG_ERROR");
+ ast_string_field_set(details, resultstr, "error negotiating T.38");
ao2_ref(details, -1);
return -1;
}
if (details->caps & AST_FAX_TECH_T38) {
if (receivefax_t38_init(chan, details)) {
+ ast_string_field_set(details, error, "T38_NEG_ERROR");
+ ast_string_field_set(details, resultstr, "error negotiating T.38");
ao2_ref(details, -1);
ast_log(LOG_ERROR, "error initializing channel '%s' in T.38 mode\n", chan->name);
return -1;
@@ -1610,7 +1635,16 @@
struct ast_flags opts = { 0, };
struct manager_event_info info;
+ /* Get a requirement structure and set it. This structure is used
+ * to tell the FAX technology module about the higher level FAX session */
+ if (!(details = find_or_create_details(chan))) {
+ ast_log(LOG_ERROR, "System cannot provide memory for session requirements.\n");
+ return -1;
+ }
+
if (ast_strlen_zero(data)) {
+ ast_string_field_set(details, error, "INVALID_ARGUMENTS");
+ ast_string_field_set(details, resultstr, "invalid arguments");
ast_log(LOG_WARNING, "%s requires an argument (filename[&filename[&filename]][,options])\n", app_sendfax);
return -1;
}
@@ -1631,12 +1665,16 @@
return -1;
}
if (ast_strlen_zero(args.filenames)) {
+ ast_string_field_set(details, error, "INVALID_ARGUMENTS");
+ ast_string_field_set(details, resultstr, "invalid arguments");
ast_log(LOG_WARNING, "%s requires an argument (filename[&filename[&filename]],options])\n", app_sendfax);
return -1;
}
/* check for unsupported FAX application options */
if (ast_test_flag(&opts, OPT_CALLERMODE) || ast_test_flag(&opts, OPT_CALLEDMODE)) {
+ ast_string_field_set(details, error, "INVALID_ARGUMENTS");
+ ast_string_field_set(details, resultstr, "invalid arguments");
ast_log(LOG_WARNING, "%s does not support polling\n", app_sendfax);
return -1;
}
@@ -1654,23 +1692,20 @@
pbx_builtin_setvar_helper(chan, "FAXERROR", "Channel Problems");
pbx_builtin_setvar_helper(chan, "FAXSTATUSSTRING", "Error before FAX transmission started.");
- /* Get a requirement structure and set it. This structure is used
- * to tell the FAX technology module about the higher level FAX session */
- if (!(details = find_or_create_details(chan))) {
- ast_log(LOG_ERROR, "System cannot provide memory for session requirements.\n");
- return -1;
- }
-
file_count = 0;
filenames = args.filenames;
while ((c = strsep(&filenames, "&"))) {
if (access(c, (F_OK | R_OK)) < 0) {
+ ast_string_field_set(details, error, "FILE_ERROR");
+ ast_string_field_set(details, resultstr, "error reading file");
ast_log(LOG_ERROR, "access failure. Verify '%s' exists and check permissions.\n", args.filenames);
ao2_ref(details, -1);
return -1;
}
if (!(doc = ast_calloc(1, sizeof(*doc) + strlen(c) + 1))) {
+ ast_string_field_set(details, error, "MEMORY_ERROR");
+ ast_string_field_set(details, resultstr, "error allocating memory");
ast_log(LOG_ERROR, "System cannot provide memory for session requirements.\n");
ao2_ref(details, -1);
return -1;
@@ -1712,12 +1747,16 @@
}
if (set_fax_t38_caps(chan, details)) {
+ ast_string_field_set(details, error, "T38_NEG_ERROR");
+ ast_string_field_set(details, resultstr, "error negotiating T.38");
ao2_ref(details, -1);
return -1;
}
if (details->caps & AST_FAX_TECH_T38) {
if (sendfax_t38_init(chan, details)) {
+ ast_string_field_set(details, error, "T38_NEG_ERROR");
+ ast_string_field_set(details, resultstr, "error negotiating T.38");
ao2_ref(details, -1);
ast_log(LOG_ERROR, "error initializing channel '%s' in T.38 mode\n", chan->name);
return -1;
More information about the asterisk-commits
mailing list