[asterisk-commits] oej: branch oej/moremanager r89413 - in /team/oej/moremanager: ./ apps/ cdr/ ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Nov 19 08:57:04 CST 2007
Author: oej
Date: Mon Nov 19 08:57:03 2007
New Revision: 89413
URL: http://svn.digium.com/view/asterisk?view=rev&rev=89413
Log:
Update
Modified:
team/oej/moremanager/ (props changed)
team/oej/moremanager/Makefile
team/oej/moremanager/apps/app_meetme.c
team/oej/moremanager/apps/app_queue.c
team/oej/moremanager/apps/app_voicemail.c
team/oej/moremanager/cdr/cdr_tds.c
team/oej/moremanager/channels/chan_iax2.c
team/oej/moremanager/channels/chan_misdn.c
team/oej/moremanager/channels/chan_sip.c
team/oej/moremanager/channels/chan_zap.c
team/oej/moremanager/channels/misdn/chan_misdn_config.h
team/oej/moremanager/channels/misdn/isdn_lib.c
team/oej/moremanager/channels/misdn/isdn_lib.h
team/oej/moremanager/channels/misdn/isdn_lib_intern.h
team/oej/moremanager/channels/misdn/isdn_msg_parser.c
team/oej/moremanager/channels/misdn_config.c
team/oej/moremanager/codecs/codec_zap.c
team/oej/moremanager/configs/extensions.ael.sample
team/oej/moremanager/configs/misdn.conf.sample
team/oej/moremanager/configs/res_odbc.conf.sample
team/oej/moremanager/doc/valgrind.txt
team/oej/moremanager/include/asterisk/lock.h
team/oej/moremanager/main/app.c
team/oej/moremanager/main/channel.c
team/oej/moremanager/main/config.c
team/oej/moremanager/main/manager.c
team/oej/moremanager/main/pbx.c
team/oej/moremanager/main/say.c
team/oej/moremanager/main/srv.c
team/oej/moremanager/main/tdd.c
team/oej/moremanager/main/utils.c
team/oej/moremanager/pbx/pbx_ael.c
team/oej/moremanager/res/res_features.c
team/oej/moremanager/res/res_jabber.c
team/oej/moremanager/res/res_musiconhold.c
Propchange: team/oej/moremanager/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Nov 19 08:57:03 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-89030
+/branches/1.4:1-89408
Modified: team/oej/moremanager/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/Makefile?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/Makefile (original)
+++ team/oej/moremanager/Makefile Mon Nov 19 08:57:03 2007
@@ -652,11 +652,11 @@
if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
elif [ -f /etc/debian_version ]; then \
$(INSTALL) -m 755 contrib/init.d/rc.debian.asterisk $(DESTDIR)/etc/init.d/asterisk; \
- if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; fi; \
+ if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk start 50 2 3 4 5 . stop 91 2 3 4 5 .; fi; \
elif [ -f /etc/gentoo-release ]; then \
$(INSTALL) -m 755 contrib/init.d/rc.gentoo.asterisk $(DESTDIR)/etc/init.d/asterisk; \
if [ -z "$(DESTDIR)" ]; then /sbin/rc-update add asterisk default; fi; \
- elif [ -f /etc/mandrake-release ]; then \
+ elif [ -f /etc/mandrake-release -o -f /etc/mandriva-release ]; then \
$(INSTALL) -m 755 contrib/init.d/rc.mandrake.asterisk $(DESTDIR)/etc/rc.d/init.d/asterisk; \
if [ -z "$(DESTDIR)" ]; then /sbin/chkconfig --add asterisk; fi; \
elif [ -f /etc/SuSE-release -o -f /etc/novell-release ]; then \
Modified: team/oej/moremanager/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/apps/app_meetme.c?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/apps/app_meetme.c (original)
+++ team/oej/moremanager/apps/app_meetme.c Mon Nov 19 08:57:03 2007
@@ -4176,6 +4176,29 @@
trunk_ref->state = SLA_TRUNK_STATE_UP;
ast_device_state_changed("SLA:%s_%s", station->name, trunk_ref->trunk->name);
}
+ } else if (trunk_ref->state == SLA_TRUNK_STATE_RINGING) {
+ struct sla_ringing_trunk *ringing_trunk;
+
+ ast_mutex_lock(&sla.lock);
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_trunks, ringing_trunk, entry) {
+ if (ringing_trunk->trunk == trunk_ref->trunk) {
+ AST_LIST_REMOVE_CURRENT(&sla.ringing_trunks, entry);
+ break;
+ }
+ }
+ AST_LIST_TRAVERSE_SAFE_END
+ ast_mutex_unlock(&sla.lock);
+
+ if (ringing_trunk) {
+ ast_answer(ringing_trunk->trunk->chan);
+ sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS, NULL);
+
+ free(ringing_trunk);
+
+ /* Queue up reprocessing ringing trunks, and then ringing stations again */
+ sla_queue_event(SLA_EVENT_RINGING_TRUNK);
+ sla_queue_event(SLA_EVENT_DIAL_STATE);
+ }
}
trunk_ref->chan = chan;
Modified: team/oej/moremanager/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/apps/app_queue.c?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/apps/app_queue.c (original)
+++ team/oej/moremanager/apps/app_queue.c Mon Nov 19 08:57:03 2007
@@ -2622,6 +2622,8 @@
callcompletedinsl = ((now - qe->start) <= qe->parent->servicelevel);
ast_mutex_unlock(&qe->parent->lock);
member = lpeer->member;
+ /* Increment the refcount for this member, since we're going to be using it for awhile in here. */
+ ao2_ref(member, 1);
hangupcalls(outgoing, peer);
outgoing = NULL;
if (announce || qe->parent->reportholdtime || qe->parent->memberdelay) {
@@ -2668,6 +2670,7 @@
queuename, qe->chan->uniqueid, peer->name, member->interface, member->membername,
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
ast_hangup(peer);
+ ao2_ref(member, -1);
goto out;
} else if (res2) {
/* Caller must have hung up just before being connected*/
@@ -2675,6 +2678,7 @@
ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "ABANDON", "%d|%d|%ld", qe->pos, qe->opos, (long)time(NULL) - qe->start);
record_abandoned(qe);
ast_hangup(peer);
+ ao2_ref(member, -1);
return -1;
}
}
@@ -2690,6 +2694,7 @@
ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", qe->chan->name, peer->name);
record_abandoned(qe);
ast_hangup(peer);
+ ao2_ref(member, -1);
return -1;
}
@@ -2874,6 +2879,7 @@
ast_hangup(peer);
update_queue(qe->parent, member, callcompletedinsl);
res = bridge ? bridge : 1;
+ ao2_ref(member, -1);
}
out:
hangupcalls(outgoing, NULL);
@@ -3751,17 +3757,9 @@
}
lu = ast_module_user_add(chan);
-
- AST_LIST_LOCK(&queues);
- AST_LIST_TRAVERSE(&queues, q, list) {
- if (!strcasecmp(q->name, data)) {
- ast_mutex_lock(&q->lock);
- break;
- }
- }
- AST_LIST_UNLOCK(&queues);
-
- if (q) {
+
+ if((q = load_realtime_queue(data))) {
+ ast_mutex_lock(&q->lock);
mem_iter = ao2_iterator_init(q->members, 0);
while ((m = ao2_iterator_next(&mem_iter))) {
/* Count the agents who are logged in and presently answering calls */
Modified: team/oej/moremanager/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/apps/app_voicemail.c?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/apps/app_voicemail.c (original)
+++ team/oej/moremanager/apps/app_voicemail.c Mon Nov 19 08:57:03 2007
@@ -4677,7 +4677,7 @@
char *cp;
#include "linkage.c"
/* Connect to INBOX first to get folders delimiter */
- imap_mailbox_name(tmp, sizeof(tmp), vms, 0, 0);
+ imap_mailbox_name(tmp, sizeof(tmp), vms, 0, 1);
stream = mail_open (stream, tmp, debug ? OP_DEBUG : NIL);
if (stream == NIL) {
ast_log (LOG_ERROR, "Can't connect to imap server %s\n", tmp);
Modified: team/oej/moremanager/cdr/cdr_tds.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/cdr/cdr_tds.c?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/cdr/cdr_tds.c (original)
+++ team/oej/moremanager/cdr/cdr_tds.c Mon Nov 19 08:57:03 2007
@@ -441,9 +441,11 @@
}
var = ast_variable_browse(cfg, "global");
- if (!var) /* nothing configured */
+ if (!var) /* nothing configured */ {
+ ast_config_destroy(cfg);
return 0;
-
+ }
+
ptr = ast_variable_retrieve(cfg, "global", "hostname");
if (ptr)
hostname = strdup(ptr);
Modified: team/oej/moremanager/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/channels/chan_iax2.c?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/channels/chan_iax2.c (original)
+++ team/oej/moremanager/channels/chan_iax2.c Mon Nov 19 08:57:03 2007
@@ -1580,7 +1580,7 @@
ast_log(LOG_WARNING, "Cannot open '%s': %s\n", s, strerror(errno));
return -1;
}
- fd = open(s2, O_RDWR | O_CREAT | O_EXCL);
+ fd = open(s2, O_RDWR | O_CREAT | O_EXCL, 0600);
if (fd < 0) {
ast_log(LOG_WARNING, "Cannot open '%s' for writing: %s\n", s2, strerror(errno));
close(ifd);
@@ -8375,6 +8375,18 @@
handle_deferred_full_frames(thread);
}
+ /*!\note For some reason, idle threads are exiting without being removed
+ * from an idle list, which is causing memory corruption. Forcibly remove
+ * it from the list, if it's there.
+ */
+ AST_LIST_LOCK(&idle_list);
+ AST_LIST_REMOVE(&idle_list, thread, list);
+ AST_LIST_UNLOCK(&idle_list);
+
+ AST_LIST_LOCK(&dynamic_list);
+ AST_LIST_REMOVE(&dynamic_list, thread, list);
+ AST_LIST_UNLOCK(&dynamic_list);
+
/* I am exiting here on my own volition, I need to clean up my own data structures
* Assume that I am no longer in any of the lists (idle, active, or dynamic)
*/
Modified: team/oej/moremanager/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/channels/chan_misdn.c?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/channels/chan_misdn.c (original)
+++ team/oej/moremanager/channels/chan_misdn.c Mon Nov 19 08:57:03 2007
@@ -684,6 +684,7 @@
misdn_overlap_dial_task_disconnect:
hanguptone_indicate(ch);
ch->bc->out_cause=1;
+ ch->state=MISDN_CLEANING;
misdn_lib_send_event(ch->bc, EVENT_DISCONNECT);
}
ch->overlap_dial_task = -1;
@@ -796,7 +797,6 @@
return 0;
}
-
static int misdn_port_block(int fd, int argc, char *argv[])
{
int port;
@@ -871,7 +871,7 @@
static int misdn_port_down (int fd, int argc, char *argv[])
{
int port;
-
+
if (argc != 4)
return RESULT_SHOWUSAGE;
@@ -2421,7 +2421,7 @@
{
struct chan_list *p;
struct misdn_bchannel *bc=NULL;
-
+
ast_log(LOG_DEBUG, "misdn_hangup(%s)\n", ast->name);
if (!ast || ! (p=MISDN_ASTERISK_TECH_PVT(ast) ) ) return -1;
@@ -2509,7 +2509,8 @@
release_chan(bc);
p->state=MISDN_CLEANING;
- misdn_lib_send_event( bc, EVENT_RELEASE_COMPLETE);
+ if (bc->need_release_complete)
+ misdn_lib_send_event( bc, EVENT_RELEASE_COMPLETE);
break;
case MISDN_HOLDED:
case MISDN_DIALING:
@@ -2552,7 +2553,8 @@
/*p->state=MISDN_CLEANING;*/
break;
case MISDN_DISCONNECTED:
- misdn_lib_send_event( bc, EVENT_RELEASE);
+ if (bc->need_release)
+ misdn_lib_send_event( bc, EVENT_RELEASE);
p->state=MISDN_CLEANING; /* MISDN_HUNGUP_FROM_AST; */
break;
@@ -2570,13 +2572,15 @@
chan_misdn_log(1, bc->port, " --> out_cause %d\n",bc->out_cause);
bc->out_cause=-1;
- misdn_lib_send_event(bc,EVENT_RELEASE);
+ if (bc->need_release)
+ misdn_lib_send_event(bc,EVENT_RELEASE);
p->state=MISDN_CLEANING;
break;
default:
if (bc->nt) {
bc->out_cause=-1;
- misdn_lib_send_event(bc, EVENT_RELEASE);
+ if (bc->need_release)
+ misdn_lib_send_event(bc, EVENT_RELEASE);
p->state=MISDN_CLEANING;
} else {
if (bc->need_disconnect)
@@ -4350,6 +4354,17 @@
break;
}
+
+ /*
+ * When we are NT and overlapdial is set and if
+ * the number is empty, we wait for the ISDN timeout
+ * instead of our own timer.
+ */
+ if (ch->overlap_dial && bc->nt && !bc->dad[0] ) {
+ wait_for_digits(ch, bc, chan);
+ break;
+ }
+
/*
* If overlapdial we will definitely send a SETUP_ACKNOWLEDGE and wait for more
* Infos with a Interdigit Timeout.
@@ -4997,7 +5012,7 @@
chan_misdn_log(0, 0, "Got: %s from get_ports\n",ports);
{
- int ntflags=0;
+ int ntflags=0, ntkc=0;
char ntfile[BUFFERSIZE+1];
struct misdn_lib_iface iface = {
.cb_event = cb_events,
@@ -5010,9 +5025,10 @@
misdn_cfg_get( 0, MISDN_GEN_NTDEBUGFLAGS, &ntflags, sizeof(int));
misdn_cfg_get( 0, MISDN_GEN_NTDEBUGFILE, &ntfile, BUFFERSIZE);
-
misdn_lib_nt_debug_init(ntflags,ntfile);
+ misdn_cfg_get( 0, MISDN_GEN_NTKEEPCALLS, &ntkc, sizeof(int));
+ misdn_lib_nt_keepcalls(ntkc);
}
{
Modified: team/oej/moremanager/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/channels/chan_sip.c?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/channels/chan_sip.c (original)
+++ team/oej/moremanager/channels/chan_sip.c Mon Nov 19 08:57:03 2007
@@ -942,6 +942,7 @@
ast_group_t callgroup; /*!< Call group */
ast_group_t pickupgroup; /*!< Pickup group */
int lastinvite; /*!< Last Cseq of invite */
+ int lastnoninvite; /*!< Last Cseq of non-invite */
struct ast_flags flags[2]; /*!< SIP_ flags */
int timer_t1; /*!< SIP timer T1, ms rtt */
unsigned int sipoptions; /*!< Supported SIP options on the other end */
@@ -2064,6 +2065,14 @@
if (option_debug > 2)
ast_log(LOG_DEBUG, "Re-scheduled destruction of SIP subsription %s\n", p->callid ? p->callid : "<unknown>");
return 10000; /* Reschedule this destruction so that we know that it's gone */
+ }
+
+ /* If there are packets still waiting for delivery, delay the destruction */
+ if (p->packets) {
+ if (option_debug > 2)
+ ast_log(LOG_DEBUG, "Re-scheduled destruction of SIP call %s\n", p->callid ? p->callid : "<unknown>");
+ append_history(p, "ReliableXmit", "timeout");
+ return 10000;
}
/* If we're destroying a subscription, dereference peer object too */
@@ -3889,7 +3898,6 @@
}
-
/*! \brief Initiate a call in the SIP channel
called from sip_request_call (calls from the pbx ) for outbound channels
and from handle_request_invite for inbound channels
@@ -3902,6 +3910,7 @@
int fmt;
int what;
int needvideo = 0, video = 0;
+ char *decoded_exten;
{
const char *my_name; /* pick a good name */
@@ -4014,8 +4023,13 @@
i->owner = tmp;
ast_module_ref(ast_module_info->self);
ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
- ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
-
+ /*Since it is valid to have extensions in the dialplan that have unescaped characters in them
+ * we should decode the uri before storing it in the channel, but leave it encoded in the sip_pvt
+ * structure so that there aren't issues when forming URI's
+ */
+ decoded_exten = ast_strdupa(i->exten);
+ ast_uri_decode(decoded_exten);
+ ast_copy_string(tmp->exten, decoded_exten, sizeof(tmp->exten));
/* Don't use ast_set_callerid() here because it will
* generate an unnecessary NewCallerID event */
@@ -4789,6 +4803,8 @@
char *boundary;
unsigned int x;
int boundaryisquoted = FALSE;
+ int found_application_sdp = FALSE;
+ int found_end_of_headers = FALSE;
content_type = get_header(req, "Content-Type");
@@ -4821,31 +4837,36 @@
at the beginning */
boundary = ast_strdupa(search - 2);
boundary[0] = boundary[1] = '-';
-
/* Remove final quote */
if (boundaryisquoted)
boundary[strlen(boundary) - 1] = '\0';
- /* search for the boundary marker, but stop when there are not enough
- lines left for it, the Content-Type header and at least one line of
- body */
- for (x = 0; x < (req->lines - 2); x++) {
- if (!strncasecmp(req->line[x], boundary, strlen(boundary)) &&
- !strcasecmp(req->line[x + 1], "Content-Type: application/sdp")) {
- x += 2;
- req->sdp_start = x;
-
- /* search for the end of the body part */
- for ( ; x < req->lines; x++) {
- if (!strncasecmp(req->line[x], boundary, strlen(boundary)))
- break;
+ /* search for the boundary marker, the empty line delimiting headers from
+ sdp part and the end boundry if it exists */
+
+ for (x = 0; x < (req->lines ); x++) {
+ if(!strncasecmp(req->line[x], boundary, strlen(boundary))){
+ if(found_application_sdp && found_end_of_headers){
+ req->sdp_end = x-1;
+ return 1;
}
- req->sdp_end = x;
- return 1;
- }
- }
-
- return 0;
+ found_application_sdp = FALSE;
+ }
+ if(!strcasecmp(req->line[x], "Content-Type: application/sdp"))
+ found_application_sdp = TRUE;
+
+ if(strlen(req->line[x]) == 0 ){
+ if(found_application_sdp && !found_end_of_headers){
+ req->sdp_start = x;
+ found_end_of_headers = TRUE;
+ }
+ }
+ }
+ if(found_application_sdp && found_end_of_headers) {
+ req->sdp_end = x;
+ return TRUE;
+ }
+ return FALSE;
}
/*! \brief Change hold state for a call */
@@ -6887,7 +6908,7 @@
if (sipmethod == SIP_NOTIFY && !ast_strlen_zero(p->theirtag)) {
/* If this is a NOTIFY, use the From: tag in the subscribe (RFC 3265) */
- snprintf(to, sizeof(to), "<sip:%s>;tag=%s", p->uri, p->theirtag);
+ snprintf(to, sizeof(to), "<%s%s>;tag=%s", (strncasecmp(p->uri, "sip:", 4) ? "" : "sip:"), p->uri, p->theirtag);
} else if (p->options && p->options->vxml_url) {
/* If there is a VXML URL append it to the SIP URL */
snprintf(to, sizeof(to), "<%s>;%s", p->uri, p->options->vxml_url);
@@ -7083,13 +7104,22 @@
/* Check which device/devices we are watching and if they are registered */
if (ast_get_hint(hint, sizeof(hint), NULL, 0, NULL, p->context, p->exten)) {
char *hint2 = hint, *individual_hint = NULL;
+ int hint_count = 0, unavailable_count = 0;
+
while ((individual_hint = strsep(&hint2, "&"))) {
- /* If they are not registered, we will override notification and show no availability */
- if (ast_device_state(individual_hint) == AST_DEVICE_UNAVAILABLE) {
- local_state = NOTIFY_CLOSED;
- pidfstate = "away";
- pidfnote = "Not online";
- }
+ hint_count++;
+
+ if (ast_device_state(individual_hint) == AST_DEVICE_UNAVAILABLE)
+ unavailable_count++;
+ }
+
+ /* If none of the hinted devices are registered, we will
+ * override notification and show no availability.
+ */
+ if (hint_count > 0 && hint_count == unavailable_count) {
+ local_state = NOTIFY_CLOSED;
+ pidfstate = "away";
+ pidfnote = "Not online";
}
}
@@ -7261,6 +7291,8 @@
if (!p->initreq.headers)
initialize_initreq(p, &req);
+
+ p->lastnoninvite = p->ocseq;
return send_request(p, &req, XMIT_RELIABLE, p->ocseq);
}
@@ -8714,18 +8746,22 @@
} else {
/* Check the dialplan for the username part of the request URI,
the domain will be stored in the SIPDOMAIN variable
+ Since extensions.conf can have unescaped characters, try matching a decoded
+ uri in addition to the non-decoded uri
Return 0 if we have a matching extension */
- if (ast_exists_extension(NULL, p->context, uri, 1, from) ||
+ char *decoded_uri = ast_strdupa(uri);
+ ast_uri_decode(decoded_uri);
+ if (ast_exists_extension(NULL, p->context, uri, 1, S_OR(p->cid_num, from)) || ast_exists_extension(NULL, p->context, decoded_uri, 1, S_OR(p->cid_num, from)) ||
!strcmp(uri, ast_pickup_ext())) {
if (!oreq)
ast_string_field_set(p, exten, uri);
return 0;
- }
+ }
}
/* Return 1 for pickup extension or overlap dialling support (if we support it) */
if((ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOWOVERLAP) &&
- ast_canmatch_extension(NULL, p->context, uri, 1, from)) ||
+ ast_canmatch_extension(NULL, p->context, uri, 1, S_OR(p->cid_num, from))) ||
!strncmp(uri, ast_pickup_ext(), strlen(uri))) {
return 1;
}
@@ -11824,16 +11860,29 @@
transmit_request(p, SIP_CANCEL, p->ocseq, XMIT_RELIABLE, FALSE);
/* Actually don't destroy us yet, wait for the 487 on our original
INVITE, but do set an autodestruct just in case we never get it. */
- else
+ else {
+ /* We have a pending outbound invite, don't send someting
+ new in-transaction */
+ if (p->pendinginvite)
+ return;
+
+ /* Perhaps there is an SD change INVITE outstanding */
transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, TRUE);
+ }
ast_clear_flag(&p->flags[0], SIP_PENDINGBYE);
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
} else if (ast_test_flag(&p->flags[0], SIP_NEEDREINVITE)) {
- if (option_debug)
- ast_log(LOG_DEBUG, "Sending pending reinvite on '%s'\n", p->callid);
- /* Didn't get to reinvite yet, so do it now */
- transmit_reinvite_with_sdp(p);
- ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE);
+ /* if we can't REINVITE, hold it for later */
+ if (p->pendinginvite || p->invitestate == INV_CALLING || p->invitestate == INV_PROCEEDING || p->invitestate == INV_EARLY_MEDIA) {
+ if (option_debug)
+ ast_log(LOG_DEBUG, "NOT Sending pending reinvite (yet) on '%s'\n", p->callid);
+ } else {
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Sending pending reinvite on '%s'\n", p->callid);
+ /* Didn't get to reinvite yet, so do it now */
+ transmit_reinvite_with_sdp(p);
+ ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE);
+ }
}
}
@@ -14991,11 +15040,11 @@
ast_log(LOG_DEBUG, "That's odd... Got a response on a call we dont know about. Cseq %d Cmd %s\n", seqno, cmd);
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
return 0;
- } else if (p->ocseq && (p->ocseq < seqno)) {
+ } else if (p->ocseq && (p->ocseq < seqno) && (seqno != p->lastnoninvite)) {
if (option_debug)
ast_log(LOG_DEBUG, "Ignoring out of order response %d (expecting %d)\n", seqno, p->ocseq);
return -1;
- } else if (p->ocseq && (p->ocseq != seqno)) {
+ } else if (p->ocseq && (p->ocseq != seqno) && (seqno != p->lastnoninvite)) {
/* ignore means "don't do anything with it" but still have to
respond appropriately */
ignore = TRUE;
@@ -15597,7 +15646,7 @@
else {
if (peer->pokeexpire > -1)
ast_sched_del(sched, peer->pokeexpire);
- peer->pokeexpire = ast_sched_add(sched, DEFAULT_MAXMS * 2, sip_poke_noanswer, peer);
+ peer->pokeexpire = ast_sched_add(sched, peer->maxms * 2, sip_poke_noanswer, peer);
}
return 0;
@@ -15682,7 +15731,7 @@
else if (p->call_limit && p->inUse)
/* Not busy, but we do have a call */
res = AST_DEVICE_INUSE;
- else if (p->maxms && (p->lastms > p->maxms))
+ else if (p->maxms && ((p->lastms > p->maxms) || (p->lastms < 0)))
/* We don't have a call. Are we reachable at all? Requires qualify= */
res = AST_DEVICE_UNAVAILABLE;
else /* Default reply if we're registered and have no other data */
@@ -16506,7 +16555,7 @@
if (!strcasecmp(v->value, "no")) {
peer->maxms = 0;
} else if (!strcasecmp(v->value, "yes")) {
- peer->maxms = DEFAULT_MAXMS;
+ peer->maxms = default_qualify ? default_qualify : DEFAULT_MAXMS;
} else if (sscanf(v->value, "%d", &peer->maxms) != 1) {
ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of sip.conf\n", peer->name, v->lineno);
peer->maxms = 0;
Modified: team/oej/moremanager/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/channels/chan_zap.c?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/channels/chan_zap.c (original)
+++ team/oej/moremanager/channels/chan_zap.c Mon Nov 19 08:57:03 2007
@@ -9479,7 +9479,7 @@
if (ast_strlen_zero(argv[4]))
return RESULT_SHOWUSAGE;
- myfd = open(argv[4], O_CREAT|O_WRONLY);
+ myfd = open(argv[4], O_CREAT|O_WRONLY, 0600);
if (myfd < 0) {
ast_cli(fd, "Unable to open '%s' for writing\n", argv[4]);
return RESULT_SUCCESS;
Modified: team/oej/moremanager/channels/misdn/chan_misdn_config.h
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/channels/misdn/chan_misdn_config.h?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/channels/misdn/chan_misdn_config.h (original)
+++ team/oej/moremanager/channels/misdn/chan_misdn_config.h Mon Nov 19 08:57:03 2007
@@ -97,6 +97,7 @@
MISDN_GEN_DYNAMIC_CRYPT, /* int (bool) */
MISDN_GEN_CRYPT_PREFIX, /* char[] */
MISDN_GEN_CRYPT_KEYS, /* char[] */
+ MISDN_GEN_NTKEEPCALLS, /* int (bool) */
MISDN_GEN_NTDEBUGFLAGS, /* int */
MISDN_GEN_NTDEBUGFILE, /* char[] */
MISDN_GEN_LAST
Modified: team/oej/moremanager/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/channels/misdn/isdn_lib.c?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/channels/misdn/isdn_lib.c (original)
+++ team/oej/moremanager/channels/misdn/isdn_lib.c Mon Nov 19 08:57:03 2007
@@ -28,6 +28,8 @@
struct misdn_stack* get_misdn_stack( void );
static int set_chan_in_stack(struct misdn_stack *stack, int channel);
+
+int release_cr(struct misdn_stack *stack, mISDNuser_head_t *hh);
int misdn_lib_port_is_pri(int port)
{
@@ -764,15 +766,12 @@
/* Pull Up L1 */
iframe_t act;
act.prim = PH_DEACTIVATE | REQUEST;
- act.addr = (stack->upper_id | FLG_MSG_DOWN) ;
-
-
+ act.addr = stack->lower_id|FLG_MSG_DOWN;
act.dinfo = 0;
act.len = 0;
+ cb_log(1, stack->port, "SENDING PH_DEACTIVATE | REQ\n");
return mISDN_write(stack->midev, &act, mISDN_HEADER_LEN+act.len, TIMEOUT_1SEC);
-
-
}
@@ -1125,7 +1124,7 @@
/** IFACE **/
int init_bc(struct misdn_stack *stack, struct misdn_bchannel *bc, int midev, int port, int bidx, char *msn, int firsttime)
{
- unsigned char buff[1025];
+ unsigned char buff[1025] = "";
iframe_t *frm = (iframe_t *)buff;
int ret;
@@ -1561,6 +1560,11 @@
bc->channel=0;
if (find_free_chan_in_stack(stack, bc, bc->channel, 0)<0){
+ if (!stack->pri && !stack->ptp) {
+ bc->cw=1;
+ break;
+ }
+
cb_log(0, stack->port, "Any Channel Requested, but we have no more!!\n");
misdn_lib_send_event(bc,EVENT_RELEASE_COMPLETE);
return -1;
@@ -1760,6 +1764,38 @@
}
+int release_cr(struct misdn_stack *stack, mISDNuser_head_t *hh)
+{
+ struct misdn_bchannel *bc=find_bc_by_l3id(stack, hh->dinfo);
+ struct misdn_bchannel dummybc;
+ iframe_t frm; /* fake te frm to remove callref from global callreflist */
+ frm.dinfo = hh->dinfo;
+
+ frm.addr=stack->upper_id | FLG_MSG_DOWN;
+
+ frm.prim = CC_RELEASE_CR|INDICATION;
+ cb_log(4, stack->port, " --> CC_RELEASE_CR: Faking Realease_cr for %x l3id:%x\n",frm.addr, frm.dinfo);
+ /** removing procid **/
+ if (!bc) {
+ cb_log(4, stack->port, " --> Didn't found BC so temporarly creating dummy BC (l3id:%x) on this port.\n", hh->dinfo);
+ make_dummy(&dummybc, stack->port, hh->dinfo, stack->nt, 0);
+ bc=&dummybc;
+ }
+
+ if (bc) {
+ if ( (bc->l3_id & 0xff00) == 0xff00) {
+ cb_log(4, stack->port, " --> Removing Process Id:%x on this port.\n", bc->l3_id&0xff);
+ stack->procids[bc->l3_id&0xff] = 0 ;
+ }
+ }
+ else cb_log(0, stack->port, "Couldnt find BC so I couldnt remove the Process!!!! this is a bad port.\n");
+
+ if (handle_cr(stack, &frm)<0) {
+ }
+
+ return 0 ;
+}
+
int
handle_event_nt(void *dat, void *arg)
{
@@ -1908,43 +1944,23 @@
break;
case CC_RELEASE|CONFIRM:
+ {
+ struct misdn_bchannel *bc=find_bc_by_l3id(stack, hh->dinfo);
+
+ if (bc) {
+ cb_log(1, stack->port, "CC_RELEASE|CONFIRM (l3id:%x), sending RELEASE_COMPLETE\n", hh->dinfo);
+ misdn_lib_send_event(bc, EVENT_RELEASE_COMPLETE);
+ }
+ }
break;
case CC_RELEASE|INDICATION:
break;
case CC_RELEASE_CR|INDICATION:
- {
- struct misdn_bchannel *bc=find_bc_by_l3id(stack, hh->dinfo);
- struct misdn_bchannel dummybc;
- iframe_t frm; /* fake te frm to remove callref from global callreflist */
- frm.dinfo = hh->dinfo;
-
- frm.addr=stack->upper_id | FLG_MSG_DOWN;
-
- frm.prim = CC_RELEASE_CR|INDICATION;
- cb_log(4, stack->port, " --> Faking Realease_cr for %x\n",frm.addr);
- /** removing procid **/
- if (!bc) {
- cb_log(4, stack->port, " --> Didn't found BC so temporarly creating dummy BC (l3id:%x) on this port.\n", hh->dinfo);
- make_dummy(&dummybc, stack->port, hh->dinfo, stack->nt, 0);
- bc=&dummybc;
- }
-
- if (bc) {
- if ( (bc->l3_id & 0xff00) == 0xff00) {
- cb_log(4, stack->port, " --> Removing Process Id:%x on this port.\n", bc->l3_id&0xff);
- stack->procids[bc->l3_id&0xff] = 0 ;
- }
- }
- else cb_log(0, stack->port, "Couldnt find BC so I couldnt remove the Process!!!! this is a bad port.\n");
-
- if (handle_cr(stack, &frm)<0) {
- }
-
+ release_cr(stack, hh);
free_msg(msg);
return 0 ;
- }
break;
case CC_NEW_CR|INDICATION:
@@ -1975,6 +1991,14 @@
if (stack->ptp && stack->l2link) {
cb_log(0, stack->port, "%% GOT L2 Activate Info. but we're activated already.. this l2 is faulty, blocking port\n");
cb_event(EVENT_PORT_ALARM, &stack->bc[0], glob_mgr->user_data);
+ }
+
+ if (stack->ptp && !stack->restart_sent) {
+ /* make sure we restart the interface of the
+ * other side */
+ stack->restart_sent=1;
+ misdn_lib_send_restart(stack->port, -1);
+
}
/* when we get the L2 UP, the L1 is UP definitely too*/
@@ -2078,7 +2102,6 @@
}
cb_event(event, bc, glob_mgr->user_data);
}
-
} else {
cb_log(4, stack->port, "No BC found with l3id: prim %x dinfo %x\n",hh->prim, hh->dinfo);
}
@@ -2743,12 +2766,14 @@
case PH_DEACTIVATE | CONFIRM:
case PH_DEACTIVATE | INDICATION:
cb_log (3, stack->port, "L1: PH L1Link Down! \n");
-
+
+#if 0
for (i=0; i<=stack->b_num; i++) {
if (global_state == MISDN_INITIALIZED) {
cb_event(EVENT_CLEANUP, &stack->bc[i], glob_mgr->user_data);
}
}
+#endif
if (stack->nt) {
if (stack->nst.l1_l2(&stack->nst, msg))
@@ -2850,7 +2875,9 @@
case SSTATUS_L1_DEACTIVATED:
cb_log(3, 0, "MGMT: SSTATUS: L1_DEACTIVATED \n");
stack->l1link=0;
+#if 0
clear_l3(stack);
+#endif
break;
case SSTATUS_L2_ESTABLISHED:
@@ -3667,8 +3694,6 @@
/*Sends Restart message for every bchnanel*/
int misdn_lib_send_restart(int port, int channel)
{
- int max;
- int i;
struct misdn_bchannel dummybc;
struct misdn_stack *stack=find_stack_by_port(port);
cb_log(0, port, "Sending Restarts on this port.\n");
@@ -3676,26 +3701,24 @@
make_dummy(&dummybc, stack->port, MISDN_ID_GLOBAL, stack->nt, 0);
/*default is all channels*/
- max=stack->pri?30:2;
- i=1;
-
+ if (channel <0) {
+ dummybc.channel=-1;
+ cb_log(0, port, "Restarting and all Interfaces\n");
+ misdn_lib_send_event(&dummybc, EVENT_RESTART);
+
+ return 0;
+ }
+
/*if a channel is specified we restart only this one*/
- if (channel > 0) {
- i=channel;
- max=channel;
- }
-
- for (;i<=max;i++) {
+ if (channel >0) {
int cnt;
- dummybc.channel=i;
- cb_log(0, port, "Restarting and cleaning channel %d\n",i);
+ dummybc.channel=channel;
+ cb_log(0, port, "Restarting and cleaning channel %d\n",channel);
misdn_lib_send_event(&dummybc, EVENT_RESTART);
- /*do we need to wait before we get an EVENT_RESTART_ACK ?*/
-
/* clean up chan in stack, to be sure we don't think it's
* in use anymore */
for (cnt=0; cnt<=stack->b_num; cnt++) {
- if (stack->bc[cnt].channel == i) {
+ if (stack->bc[cnt].channel == channel) {
empty_bc(&stack->bc[cnt]);
clean_up_bc(&stack->bc[cnt]);
stack->bc[cnt].in_use=0;
@@ -3857,6 +3880,18 @@
}
+void misdn_lib_nt_keepcalls( int kc)
+{
+#ifdef FEATURE_NET_KEEPCALLS
+ if (kc) {
+ struct misdn_stack *stack=get_misdn_stack();
+ for ( ; stack; stack=stack->next) {
+ stack->nst.feature |= FEATURE_NET_KEEPCALLS;
+ }
+ }
+#endif
+}
+
void misdn_lib_nt_debug_init( int flags, char *file )
{
int static init=0;
Modified: team/oej/moremanager/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/channels/misdn/isdn_lib.h?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/channels/misdn/isdn_lib.h (original)
+++ team/oej/moremanager/channels/misdn/isdn_lib.h Mon Nov 19 08:57:03 2007
@@ -381,6 +381,8 @@
/***** USER IFACE **********/
+void misdn_lib_nt_keepcalls(int kc);
+
void misdn_lib_nt_debug_init( int flags, char *file );
int misdn_lib_init(char *portlist, struct misdn_lib_iface* iface, void *user_data);
Modified: team/oej/moremanager/channels/misdn/isdn_lib_intern.h
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/channels/misdn/isdn_lib_intern.h?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/channels/misdn/isdn_lib_intern.h (original)
+++ team/oej/moremanager/channels/misdn/isdn_lib_intern.h Mon Nov 19 08:57:03 2007
@@ -78,6 +78,9 @@
time_t l2establish;
int l1link;
+
+ int restart_sent;
+
int midev;
int nt;
Modified: team/oej/moremanager/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/channels/misdn/isdn_msg_parser.c?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/channels/misdn/isdn_msg_parser.c (original)
+++ team/oej/moremanager/channels/misdn/isdn_msg_parser.c Mon Nov 19 08:57:03 2007
@@ -840,8 +840,13 @@
#if DEBUG
printf("Building RESTART Msg\n");
#endif
- enc_ie_channel_id(&restart->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
- enc_ie_restart_ind(&restart->RESTART_IND, msg, 0x80, nt, bc);
+
+ if (bc->channel > 0) {
+ enc_ie_channel_id(&restart->CHANNEL_ID, msg, 1,bc->channel, nt,bc);
+ enc_ie_restart_ind(&restart->RESTART_IND, msg, 0x80, nt, bc);
+ } else {
+ enc_ie_restart_ind(&restart->RESTART_IND, msg, 0x87, nt, bc);
+ }
cb_log(0,bc->port, "Restarting channel %d\n", bc->channel);
Modified: team/oej/moremanager/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/channels/misdn_config.c?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/channels/misdn_config.c (original)
+++ team/oej/moremanager/channels/misdn_config.c Mon Nov 19 08:57:03 2007
@@ -358,6 +358,10 @@
{ "crypt_keys", MISDN_GEN_CRYPT_KEYS, MISDN_CTYPE_STR, NO_DEFAULT, NONE,
"Keys for cryption, you reference them in the dialplan\n"
"\tLater also in dynamic encr." },
+ { "ntkeepcalls", MISDN_GEN_NTKEEPCALLS, MISDN_CTYPE_BOOL, "no", NONE,
+ "avoid dropping calls if the L2 goes down. some nortel pbx\n"
+ "do put down the L2/L1 for some milliseconds even if there\n"
+ "are running calls. with this option you can avoid dropping them\n" },
{ "ntdebugflags", MISDN_GEN_NTDEBUGFLAGS, MISDN_CTYPE_INT, "0", NONE,
"No description yet."},
{ "ntdebugfile", MISDN_GEN_NTDEBUGFILE, MISDN_CTYPE_STR, "/var/log/misdn-nt.log", NONE,
Modified: team/oej/moremanager/codecs/codec_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/codecs/codec_zap.c?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/codecs/codec_zap.c (original)
+++ team/oej/moremanager/codecs/codec_zap.c Mon Nov 19 08:57:03 2007
@@ -224,7 +224,6 @@
if (ioctl(ztp->fd, ZT_TRANSCODE_OP, &x))
ast_log(LOG_WARNING, "Failed to release transcoder channel: %s\n", strerror(errno));
- ast_atomic_fetchadd_int(&channels.total, -1);
switch (ztp->hdr->dstfmt) {
case AST_FORMAT_G729A:
case AST_FORMAT_G723_1:
@@ -286,7 +285,6 @@
ztp->fd = fd;
ztp->hdr = hdr;
- ast_atomic_fetchadd_int(&channels.total, +1);
switch (hdr->dstfmt) {
case AST_FORMAT_G729A:
case AST_FORMAT_G723_1:
@@ -442,6 +440,7 @@
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Found transcoder '%s'.\n", info.name);
build_translators(&map, info.dstfmts, info.srcfmts);
+ ast_atomic_fetchadd_int(&channels.total, info.numchannels / 2);
}
close(fd);
Modified: team/oej/moremanager/configs/extensions.ael.sample
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/configs/extensions.ael.sample?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/configs/extensions.ael.sample (original)
+++ team/oej/moremanager/configs/extensions.ael.sample Mon Nov 19 08:57:03 2007
@@ -176,6 +176,7 @@
// ARG1 is the extension to Dial
//
goto ${exten}|1;
+ return;
};
//
@@ -275,7 +276,6 @@
ignorepat => 9;
includes {
ael-default;
- ael-parkedcalls;
ael-trunklocal;
ael-iaxtel700;
ael-trunktollfree;
@@ -318,6 +318,7 @@
VoiceMailMain(${ext});
return;
};
+ return;
};
context ael-demo {
Modified: team/oej/moremanager/configs/misdn.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/configs/misdn.conf.sample?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/configs/misdn.conf.sample (original)
+++ team/oej/moremanager/configs/misdn.conf.sample Mon Nov 19 08:57:03 2007
@@ -56,6 +56,12 @@
ntdebugflags=0
ntdebugfile=/var/log/misdn-nt.log
+
+; some pbx systems do cut the L1 for some milliseconds, to avoid
+; dropping running calls, we can set this flag to yes and tell
+; mISDNuser not to drop the calls on L2_RELEASE
+ntkeepcalls=no
+
; the big trace
;
; default value: [not set]
@@ -236,6 +242,13 @@
; default value: standard
;
method=standard
+
+
+; specify if chan_misdn should collect digits before going into the
+; dialplan, you can choose yes=4 Seconds, no, or specify the amount
+; of seconds you need;
+;
+overlapdial=yes
;
; dialplan means Type Of Number in ISDN Terms (for outgoing calls)
Modified: team/oej/moremanager/configs/res_odbc.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/configs/res_odbc.conf.sample?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/configs/res_odbc.conf.sample (original)
+++ team/oej/moremanager/configs/res_odbc.conf.sample Mon Nov 19 08:57:03 2007
@@ -10,7 +10,7 @@
; All other sections are arbitrary names for database connections.
[asterisk]
-enabled => yes
+enabled => no
dsn => asterisk
;username => myuser
;password => mypass
Modified: team/oej/moremanager/doc/valgrind.txt
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/doc/valgrind.txt?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
--- team/oej/moremanager/doc/valgrind.txt (original)
+++ team/oej/moremanager/doc/valgrind.txt Mon Nov 19 08:57:03 2007
@@ -11,7 +11,7 @@
2. Rebuild and install Asterisk.
3. Run Asterisk as follows:
- valgrind --log-file-exact=valgrind.txt asterisk -vvvvcg 2>malloc_debug.txt
+ valgrind --log-file-exactly=valgrind.txt asterisk -vvvvcg 2>malloc_debug.txt
4. Reproduce the issue. Following the manifestation of the issue (or when
the process crashes), upload the two files, valgrind.txt and
Modified: team/oej/moremanager/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/team/oej/moremanager/include/asterisk/lock.h?view=diff&rev=89413&r1=89412&r2=89413
==============================================================================
[... 613 lines stripped ...]
More information about the asterisk-commits
mailing list