[asterisk-commits] phsultan: branch phsultan/rtmp-support r206804 - in /team/phsultan/rtmp-suppo...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 16 08:32:29 CDT 2009


Author: phsultan
Date: Thu Jul 16 08:32:23 2009
New Revision: 206804

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=206804
Log:
Merged revisions 205770,205776,205780,205840,205878,205939,205985,206021,206049,206092,206094,206127,206185,206225,206280,206341,206386,206455,206489-206490,206566-206567,206603,206636,206702,206707,206767-206768 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r205770 | kpfleming | 2009-07-10 17:28:11 +0200 (Fri, 10 Jul 2009) | 12 lines

Fix some remaining T.38 negotiation problems in app_fax.

Revision 205696 did not quite fix all the issues with the T.38 negotiation
changes and app_fax; this patch corrects them, along with a couple of other
minor issues.

(closes issue #15480)
Reported by: dimas
Patches:
      test2-15480.patch uploaded by dimas (license 88)


................
r205776 | mmichelson | 2009-07-10 17:56:45 +0200 (Fri, 10 Jul 2009) | 16 lines

Merged revisions 205775 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r205775 | mmichelson | 2009-07-10 10:51:36 -0500 (Fri, 10 Jul 2009) | 10 lines
  
  Ensure that outbound NOTIFY requests are properly routed through stateful proxies.
  
  With this change, we make note of Record-Route headers present in any SUBSCRIBE
  request that we receive so that our outbound NOTIFY requests will have the proper
  Route headers in them.
  
  (closes issue #14725)
  Reported by: ibc
........

................
r205780 | kpfleming | 2009-07-10 18:00:44 +0200 (Fri, 10 Jul 2009) | 11 lines

Eliminate extraneous LOG_DEBUG messages generated by app_fax.

The transmit_audio() and transmit_t38() functions in app_fax have processing
loops that are supposed to wait for frames to arrive on the channel and then
handle them, but they also have short timeouts so that the loops can have
watchdog timers and do other required processing. This commit changes the loops
to not actually call ast_read() and attempt to process the returned frame
unless a frame actually arrived, eliminating hundreds of LOG_DEBUG messages
and slightly improving performance.


................
r205840 | dvossel | 2009-07-10 18:42:04 +0200 (Fri, 10 Jul 2009) | 37 lines

Merged revisions 205804 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r205804 | dvossel | 2009-07-10 11:23:59 -0500 (Fri, 10 Jul 2009) | 31 lines
  
  SIP registration auth loop caused by stale nonce
  
  If an endpoint sends two registration requests in a very short
  period of time with the same nonce, both receive 401 responses
  from Asterisk, each with a different nonce (the second 401
  containing the current nonce and the first one being stale).
  If the endpoint responds to the first 401, it does not match
  the current nonce so Asterisk sends a third 401 with a newly
  generated nonce (which updates the current nonce)... Now if
  the endpoint responds to the second 401, it does not match the
  current nonce either and Asterisk sends a fourth 401 with a
  newly generated nonce... This loop goes on and on.
  
  There appears to be a simple fix for this.  If the nonce from
  the request does not match our nonce, but is a good response
  to a previous nonce, instead of sending a 401 with a newly
  generated nonce, use the current one instead.  This breaks
  the loop as the nonce is not updated until a response is
  received. Additional logic has been added to make sure no
  nonce can be responded to twice though.
  
  (closes issue #15102)
  Reported by: Jamuel
  Patches:
        patch-bug_0015102 uploaded by Jamuel (license 809)
        nonce_sip.diff uploaded by dvossel (license 671)
  Tested by: Jamuel
  
  Review: https://reviewboard.asterisk.org/r/289/
........

................
r205878 | mmichelson | 2009-07-10 19:39:57 +0200 (Fri, 10 Jul 2009) | 30 lines

Merged revisions 205877 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
  r205877 | mmichelson | 2009-07-10 12:39:13 -0500 (Fri, 10 Jul 2009) | 23 lines
  
  Merged revisions 205776 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/trunk
  
  ................
    r205776 | mmichelson | 2009-07-10 10:56:45 -0500 (Fri, 10 Jul 2009) | 16 lines
    
    Merged revisions 205775 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r205775 | mmichelson | 2009-07-10 10:51:36 -0500 (Fri, 10 Jul 2009) | 10 lines
      
      Ensure that outbound NOTIFY requests are properly routed through stateful proxies.
      
      With this change, we make note of Record-Route headers present in any SUBSCRIBE
      request that we receive so that our outbound NOTIFY requests will have the proper
      Route headers in them.
      
      (closes issue #14725)
      Reported by: ibc
    ........
  ................
................

................
r205939 | kpfleming | 2009-07-10 20:44:09 +0200 (Fri, 10 Jul 2009) | 1 line

Update comments about the level of T.38 support in Asterisk.
................
r205985 | dvossel | 2009-07-10 23:42:10 +0200 (Fri, 10 Jul 2009) | 16 lines

SIP register not using peer's outbound proxy

If callbackextension is defined for a peer it successfully causes
a registration to occur, but the registration ignores the
outboundproxy settings for the peer.  This patch allows the
peer to be passed to obproxy_get() in transmit_register().

(closes issue #14344)
Reported by: Nick_Lewis
Patches:
      callbackextension_peer_trunk.diff uploaded by dvossel (license 671)
Tested by: dvossel

Review: https://reviewboard.asterisk.org/r/294/


................
r206021 | russell | 2009-07-11 21:15:03 +0200 (Sat, 11 Jul 2009) | 27 lines

Add an API for reporting security events, and a security event logging module.

This commit introduces the security events API.  This API is to be used by
Asterisk components to report events that have security implications.
A simple example is when a connection is made but fails authentication.  These
events can be used by external tools manipulate firewall rules or something
similar after detecting unusual activity based on security events.

Inside of Asterisk, the events go through the ast_event API.  This means that
they have a binary encoding, and it is easy to write code to subscribe to these
events and do something with them.

One module is provided that is a subscriber to these events - res_security_log.
This module turns security events into a parseable text format and sends them
to the "security" logger level.  Using logger.conf, these log entries may be
sent to a file, or to syslog.

One service, AMI, has been fully updated for reporting security events.
AMI was chosen as it was a fairly straight forward service to convert.
The next target will be chan_sip.  That will be more complicated and will
be done as its own project as the next phase of security events work.

For more information on the security events framework, see the documentation
generated from doc/tex/.  "make asterisk.pdf"

Review: https://reviewboard.asterisk.org/r/273/

................
r206049 | russell | 2009-07-11 21:30:19 +0200 (Sat, 11 Jul 2009) | 1 line

note the security events API in CHANGES
................
r206092 | kpfleming | 2009-07-13 15:29:23 +0200 (Mon, 13 Jul 2009) | 3 lines

Make the menuselect category for Add-Ons consistent with the other directories (uppercase).


................
r206094 | kpfleming | 2009-07-13 16:06:37 +0200 (Mon, 13 Jul 2009) | 3 lines

Bump up cleancount so that existing checkouts will update themselves properly for the 'Addons' -> 'ADDONS' change.


................
r206127 | russell | 2009-07-13 17:12:31 +0200 (Mon, 13 Jul 2009) | 13 lines

Blocked revisions 206126 via svnmerge

........
  r206126 | russell | 2009-07-13 10:12:08 -0500 (Mon, 13 Jul 2009) | 7 lines
  
  Print CID match in "show dialplan".
  
  (closes issue #14702)
  Reported by: klaus3000
  Patches:
        patch_asterisk_1.4.23_CID_matching.txt uploaded by klaus3000 (license 65)
........

................
r206185 | tilghman | 2009-07-13 18:23:07 +0200 (Mon, 13 Jul 2009) | 6 lines

Remove reference to non-existent help file
(closes issue #15427)
 Reported by: brushtyler
 Patches: 
       app_voicemail.c.diff uploaded by brushtyler (license 821)

................
r206225 | seanbright | 2009-07-13 20:46:47 +0200 (Mon, 13 Jul 2009) | 5 lines

Make sure that since we are passing -c to asterisk that we have a console.

Without this line, Asterisk will busy-loop trying to read and write to
/dev/null (woops... my bad).

................
r206280 | dvossel | 2009-07-14 01:26:51 +0200 (Tue, 14 Jul 2009) | 9 lines

dns lookup of peername rather than peer's host in transmit_register()

(closes issue #15052)
Reported by: fsantulli
Patches:
      chan_sip_bug_15052_[20090626204511].patch uploaded by fsantulli (license 818)
Tested by: fsantulli


................
r206341 | rmudgett | 2009-07-14 02:48:59 +0200 (Tue, 14 Jul 2009) | 11 lines

Merged revisions 206284 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r206284 | rmudgett | 2009-07-13 19:17:28 -0500 (Mon, 13 Jul 2009) | 4 lines
  
  Fix some memory leaks in chan_misdn.
  
  JIRA ABE-1911
........

................
r206386 | russell | 2009-07-14 16:51:44 +0200 (Tue, 14 Jul 2009) | 20 lines

Merged revisions 206385 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
  r206385 | russell | 2009-07-14 09:48:00 -0500 (Tue, 14 Jul 2009) | 13 lines
  
  Merged revisions 206384 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.2
  
  ........
    r206384 | russell | 2009-07-14 09:45:47 -0500 (Tue, 14 Jul 2009) | 6 lines
    
    Ensure apathetic replies are sent out on the proper socket.
    
    chan_iax2 supports multiple address bindings.  The send_apathetic_reply()
    function did not attempt to send its response on the same socket that the
    incoming message came in on.
  ........
................

................
r206455 | mmichelson | 2009-07-14 18:09:38 +0200 (Tue, 14 Jul 2009) | 9 lines

Reset the sentringing indication when redirects occur.

If a redirecting control frame is processed or a call forward occurs,
we need to reset the sentringing flag so that we can send another ringing
indication to the phone that may contain a connected line update.

AST-164


................
r206489 | rmudgett | 2009-07-14 19:01:48 +0200 (Tue, 14 Jul 2009) | 35 lines

Merged revisions 206487 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r206487 | rmudgett | 2009-07-14 11:44:47 -0500 (Tue, 14 Jul 2009) | 28 lines
  
  Fixes several call transfer issues with chan_misdn.
  
  *  issue #14355 - Crash if attempt to transfer a call to an application.
  Masquerade the other pair of the four asterisk channels involved in the
  two calls.  The held call already must be a bridged call (not an
  applicaton) or it would have been rejected.
  
  *  issue #14692 - Held calls are not automatically cleared after transfer.
  Allow the core to initate disconnect of held calls to the ISDN port.  This
  also fixes a similar case where the party on hold hangs up before being
  transferred or taken off hold.
  
  *  JIRA ABE-1903 - Orphaned held calls left in music-on-hold.
  Do not simply block passing the hangup event on held calls to asterisk
  core.
  
  *  Fixed to allow held calls to be transferred to ringing calls.
  Previously, held calls could only be transferred to connected calls.
  *  Eliminated unused call states to simplify hangup code.
  *  Eliminated most uses of "holded" because it is not a word.
  
  (closes issue #14355)
  (closes issue #14692)
  Reported by: sodom
  Patches:
        misdn_xfer_v14_r205839.patch uploaded by rmudgett (license 664)
  Tested by: rmudgett
........

................
r206490 | mmichelson | 2009-07-14 19:03:58 +0200 (Tue, 14 Jul 2009) | 3 lines

I AM A TERRIBLE PERSON


................
r206566 | jpeeler | 2009-07-14 22:01:10 +0200 (Tue, 14 Jul 2009) | 8 lines

Restore some missing functionality to sig_analog.

The main purpose of this commit is to restore missing functionality present in 
the ss_thread before all the sig related work was done. Two of the biggest
missing things were distinctive ring detection and cid handling for V23.
fxsoffhookstate and associated mwi variables have been moved inside sig_analog
as they were not being set properly as well.

................
r206567 | tilghman | 2009-07-14 22:14:45 +0200 (Tue, 14 Jul 2009) | 6 lines

Document all meetme realtime fields, and in the process, make some field lengths more consistent.
(closes issue #15493)
 Reported by: lasko
 Patches: 
       meetme.diff uploaded by lasko (license 833)

................
r206603 | jpeeler | 2009-07-14 22:38:56 +0200 (Tue, 14 Jul 2009) | 1 line

fix a typo in sample config file for option change
................
r206636 | seanbright | 2009-07-15 18:00:24 +0200 (Wed, 15 Jul 2009) | 9 lines

Merged revisions 206635 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r206635 | seanbright | 2009-07-15 11:57:51 -0400 (Wed, 15 Jul 2009) | 1 line
  
  Only print debug info in codec_dahdi if we are asking for it.
........

................
r206702 | dvossel | 2009-07-15 22:20:01 +0200 (Wed, 15 Jul 2009) | 10 lines

callerid(num) is wrong when username is missing 

A domain only sip uri <sip:123.123.123.123> would return
123.123.123.123 as callid num.  Now, if the username is
missing from a uri, the callerid num field is left empty.

(closes issue #15476)
Reported by: viraptor


................
r206707 | rmudgett | 2009-07-15 23:14:41 +0200 (Wed, 15 Jul 2009) | 33 lines

Merged revisions 206706 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
  r206706 | rmudgett | 2009-07-15 15:44:55 -0500 (Wed, 15 Jul 2009) | 26 lines
  
  Merged revision 206700 from
  https://origsvn.digium.com/svn/asterisk/be/branches/C.2-...
  
  ..........
    Fixed chan_misdn crash because mISDNuser library is not thread safe.
  
    With Asterisk the mISDNuser library is driven by two threads concurrently:
    1. channels/misdn/isdn_lib.c::manager_event_handler()
    2. channels/misdn/isdn_lib.c::misdn_lib_isdn_event_catcher()
  
    Calls into the library are done concurrently and recursively from
    isdn_lib.c.
  
    Both threads can fiddle with the master/child layer3_proc_t lists.  One
    thread may traverse the list when the other interrupts it and then removes
    the list element which the first thread was currently handling.  This is
    exactly what caused the crash.  About 60 calls were needed to a Gigaset
    CX475 before it occurred once.
  
    This patch adds locking when calling into the mISDNuser library.
    This also fixes some cb_log calls with wrong port parameter.
  
    JIRA ABE-1913
        Patches: misdn-locking.patch (Modified with mostly cosmetic changes)
  ..........
................

................
r206767 | jpeeler | 2009-07-16 00:02:55 +0200 (Thu, 16 Jul 2009) | 10 lines

The dialing flag was mistakingly removed from sig_pri.

This readds the proper setting of the flag and is really a continuation of
r205731. The flag was being set properly in sig_analog, but use of the 
newly added set_dialing callback allowed for some simplification in
chan_dahdi.

(closes issue #15486)
Reported by: rmudgett

................
r206768 | dvossel | 2009-07-16 00:04:13 +0200 (Thu, 16 Jul 2009) | 8 lines

Session timer were not activated if Supported header field in INVITE had both "timer" and other options.

(closes issue #15403)
Reported by: makoto
Patches:
      sip-session-timer.patch uploaded by makoto (license 38)


................

Added:
    team/phsultan/rtmp-support/doc/tex/security-events.tex
      - copied unchanged from r206768, trunk/doc/tex/security-events.tex
    team/phsultan/rtmp-support/include/asterisk/security_events.h
      - copied unchanged from r206768, trunk/include/asterisk/security_events.h
    team/phsultan/rtmp-support/include/asterisk/security_events_defs.h
      - copied unchanged from r206768, trunk/include/asterisk/security_events_defs.h
    team/phsultan/rtmp-support/main/security_events.c
      - copied unchanged from r206768, trunk/main/security_events.c
    team/phsultan/rtmp-support/res/res_security_log.c
      - copied unchanged from r206768, trunk/res/res_security_log.c
    team/phsultan/rtmp-support/tests/test_ami_security_events.sh
      - copied unchanged from r206768, trunk/tests/test_ami_security_events.sh
    team/phsultan/rtmp-support/tests/test_security_events.c
      - copied unchanged from r206768, trunk/tests/test_security_events.c
Modified:
    team/phsultan/rtmp-support/   (props changed)
    team/phsultan/rtmp-support/.cleancount
    team/phsultan/rtmp-support/CHANGES
    team/phsultan/rtmp-support/addons/Makefile
    team/phsultan/rtmp-support/apps/app_dial.c
    team/phsultan/rtmp-support/apps/app_fax.c
    team/phsultan/rtmp-support/apps/app_meetme.c
    team/phsultan/rtmp-support/apps/app_voicemail.c
    team/phsultan/rtmp-support/channels/chan_dahdi.c
    team/phsultan/rtmp-support/channels/chan_iax2.c
    team/phsultan/rtmp-support/channels/chan_misdn.c
    team/phsultan/rtmp-support/channels/chan_sip.c
    team/phsultan/rtmp-support/channels/misdn/isdn_lib.c
    team/phsultan/rtmp-support/channels/misdn/isdn_lib.h
    team/phsultan/rtmp-support/channels/misdn/isdn_lib_intern.h
    team/phsultan/rtmp-support/channels/sig_analog.c
    team/phsultan/rtmp-support/channels/sig_analog.h
    team/phsultan/rtmp-support/channels/sig_pri.c
    team/phsultan/rtmp-support/channels/sig_pri.h
    team/phsultan/rtmp-support/codecs/codec_dahdi.c
    team/phsultan/rtmp-support/configs/chan_dahdi.conf.sample
    team/phsultan/rtmp-support/contrib/scripts/meetme.sql
    team/phsultan/rtmp-support/contrib/upstart/asterisk.upstart-0.3.9
    team/phsultan/rtmp-support/doc/tex/asterisk.tex
    team/phsultan/rtmp-support/include/asterisk/autoconfig.h.in
    team/phsultan/rtmp-support/include/asterisk/event_defs.h
    team/phsultan/rtmp-support/main/event.c
    team/phsultan/rtmp-support/main/manager.c
    team/phsultan/rtmp-support/main/udptl.c

Propchange: team/phsultan/rtmp-support/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/phsultan/rtmp-support/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/phsultan/rtmp-support/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jul 16 08:32:23 2009
@@ -1,1 +1,1 @@
-/trunk:1-205761
+/trunk:1-206803

Modified: team/phsultan/rtmp-support/.cleancount
URL: http://svn.asterisk.org/svn-view/asterisk/team/phsultan/rtmp-support/.cleancount?view=diff&rev=206804&r1=206803&r2=206804
==============================================================================
--- team/phsultan/rtmp-support/.cleancount (original)
+++ team/phsultan/rtmp-support/.cleancount Thu Jul 16 08:32:23 2009
@@ -1,1 +1,2 @@
-36
+37
+

Modified: team/phsultan/rtmp-support/CHANGES
URL: http://svn.asterisk.org/svn-view/asterisk/team/phsultan/rtmp-support/CHANGES?view=diff&rev=206804&r1=206803&r2=206804
==============================================================================
--- team/phsultan/rtmp-support/CHANGES (original)
+++ team/phsultan/rtmp-support/CHANGES Thu Jul 16 08:32:23 2009
@@ -207,6 +207,14 @@
    Destination is the IP address and port for the RTP packets.
    Control address is specific to the linksys type and is used for sending the control
    packets unique to them.
+
+Security Events Framework
+-------------------------
+ * Asterisk has a new C API for reporting security events.  The module res_security_log
+   sends these events to the "security" logger level.  Currently, AMI is the only
+   Asterisk component that reports security events.  However, SIP support will be
+   coming soon.  For more information on the security events framework, see the
+   "Security Events" chapter of the included documentation - doc/tex/asterisk.pdf.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.6.1 to Asterisk 1.6.2  -------------

Modified: team/phsultan/rtmp-support/addons/Makefile
URL: http://svn.asterisk.org/svn-view/asterisk/team/phsultan/rtmp-support/addons/Makefile?view=diff&rev=206804&r1=206803&r2=206804
==============================================================================
--- team/phsultan/rtmp-support/addons/Makefile (original)
+++ team/phsultan/rtmp-support/addons/Makefile Thu Jul 16 08:32:23 2009
@@ -11,7 +11,7 @@
 
 -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
 
-MENUSELECT_CATEGORY=Addons
+MENUSELECT_CATEGORY=ADDONS
 MENUSELECT_DESCRIPTION=Add-ons (See README-addons.txt)
 
 H323OBJS:=ooCmdChannel.o ooLogChan.o ooUtils.o ooGkClient.o context.o \

Modified: team/phsultan/rtmp-support/apps/app_dial.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/phsultan/rtmp-support/apps/app_dial.c?view=diff&rev=206804&r1=206803&r2=206804
==============================================================================
--- team/phsultan/rtmp-support/apps/app_dial.c (original)
+++ team/phsultan/rtmp-support/apps/app_dial.c Thu Jul 16 08:32:23 2009
@@ -972,6 +972,7 @@
 				continue;
 			/* here, o->chan == c == winner */
 			if (!ast_strlen_zero(c->call_forward)) {
+				pa->sentringing = 0;
 				do_forward(o, &num, peerflags, single, to);
 				continue;
 			}
@@ -1097,6 +1098,7 @@
 					} else {
 						ast_verb(3, "%s redirecting info has changed, passing it to %s\n", c->name, in->name);
 						ast_indicate_data(in, AST_CONTROL_REDIRECTING, f->data.ptr, f->datalen);
+						pa->sentringing = 0;
 					}
 					break;
 				case AST_CONTROL_PROCEEDING:

Modified: team/phsultan/rtmp-support/apps/app_fax.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/phsultan/rtmp-support/apps/app_fax.c?view=diff&rev=206804&r1=206803&r2=206804
==============================================================================
--- team/phsultan/rtmp-support/apps/app_fax.c (original)
+++ team/phsultan/rtmp-support/apps/app_fax.c Thu Jul 16 08:32:23 2009
@@ -432,14 +432,28 @@
 	ast_activate_generator(s->chan, &generator, &fax);
 
 	while (!s->finished) {
-		res = ast_waitfor(s->chan, 20);
-		if (res < 0)
+		inf = NULL;
+
+		if ((res = ast_waitfor(s->chan, 20)) < 0) {
 			break;
-		else if (res > 0)
-			res = 0;
-
-		inf = ast_read(s->chan);
-		if (inf == NULL) {
+		}
+
+		/* if nothing arrived, check the watchdog timers */
+		if (res == 0) {
+			now = ast_tvnow();
+			if (ast_tvdiff_sec(now, start) > WATCHDOG_TOTAL_TIMEOUT || ast_tvdiff_sec(now, state_change) > WATCHDOG_STATE_TIMEOUT) {
+				ast_log(LOG_WARNING, "It looks like we hung. Aborting.\n");
+				res = -1;
+				break;
+			} else {
+				/* timers have not triggered, loop around to wait
+				 * again
+				 */
+				continue;
+			}
+		}
+
+		if (!(inf = ast_read(s->chan))) {
 			ast_debug(1, "Channel hangup\n");
 			res = -1;
 			break;
@@ -473,7 +487,7 @@
 
 
 		/* Check the frame type. Format also must be checked because there is a chance
-		   that a frame in old format was already queued before we set chanel format
+		   that a frame in old format was already queued before we set channel format
 		   to slinear so it will still be received by ast_read */
 		if (inf->frametype == AST_FRAME_VOICE && inf->subclass == AST_FORMAT_SLINEAR) {
 			if (fax_rx(&fax, inf->data.ptr, inf->samples) < 0) {
@@ -482,8 +496,6 @@
 				res = -1;
 				break;
 			}
-
-			/* Watchdog */
 			if (last_state != t30state->state) {
 				state_change = ast_tvnow();
 				last_state = t30state->state;
@@ -497,6 +509,7 @@
 				res = 1;
 				break;
 			} else if (parameters->request_response == AST_T38_REQUEST_NEGOTIATE) {
+				ast_debug(1, "T38 request received, accepting\n");
 				if (parameters->version > 0) {
 					/* Only T.38 Version 0 is supported at this time */
 					parameters->version = 0;
@@ -508,25 +521,14 @@
 				}
 				/* we only support bit rates up to 9.6kbps */
 				parameters->rate = AST_T38_RATE_9600;
+				/* Complete T38 switchover */
 				ast_indicate_data(s->chan, AST_CONTROL_T38_PARAMETERS, parameters, sizeof(*parameters));
-				/* T38 switchover completed */
-				s->t38parameters = *parameters;
-				ast_debug(1, "T38 negotiated, finishing audio loop\n");
-				res = 1;
-				break;
+				/* Do not break audio loop, wait until channel driver finally acks switchover
+				   with AST_T38_NEGOTIATED */
 			}
 		}
 
 		ast_frfree(inf);
-		inf = NULL;
-
-		/* Watchdog */
-		now = ast_tvnow();
-		if (ast_tvdiff_sec(now, start) > WATCHDOG_TOTAL_TIMEOUT || ast_tvdiff_sec(now, state_change) > WATCHDOG_STATE_TIMEOUT) {
-			ast_log(LOG_WARNING, "It looks like we hung. Aborting.\n");
-			res = -1;
-			break;
-		}
 	}
 
 	ast_debug(1, "Loop finished, res=%d\n", res);
@@ -598,7 +600,8 @@
 	}
 	if (s->t38parameters.transcoding_mmr) {
 		t38_set_mmr_transcoding(t38state, TRUE);
-	} else if (s->t38parameters.transcoding_jbig) {
+	}
+	if (s->t38parameters.transcoding_jbig) {
 		t38_set_jbig_transcoding(t38state, TRUE);
 	}
 
@@ -617,19 +620,31 @@
 	now = start = state_change = ast_tvnow();
 
 	while (!s->finished) {
-
-		res = ast_waitfor(s->chan, 20);
-		if (res < 0)
+		inf = NULL;
+		if ((res = ast_waitfor(s->chan, 20)) < 0) {
 			break;
-		else if (res > 0)
-			res = 0;
+		}
 
 		last_frame = now;
 		now = ast_tvnow();
+		/* if nothing arrived, check the watchdog timers */
+		if (res == 0) {
+			if (ast_tvdiff_sec(now, start) > WATCHDOG_TOTAL_TIMEOUT || ast_tvdiff_sec(now, state_change) > WATCHDOG_STATE_TIMEOUT) {
+				ast_log(LOG_WARNING, "It looks like we hung. Aborting.\n");
+				res = -1;
+				break;
+			} else {
+				/* timers have not triggered, loop around to wait
+				 * again
+				 */
+				t38_terminal_send_timeout(&t38, ast_tvdiff_us(now, last_frame) / (1000000 / 8000));
+				continue;
+			}
+		}
+
 		t38_terminal_send_timeout(&t38, ast_tvdiff_us(now, last_frame) / (1000000 / 8000));
 
-		inf = ast_read(s->chan);
-		if (inf == NULL) {
+		if (!(inf = ast_read(s->chan))) {
 			ast_debug(1, "Channel hangup\n");
 			res = -1;
 			break;
@@ -639,30 +654,19 @@
 
 		if (inf->frametype == AST_FRAME_MODEM && inf->subclass == AST_MODEM_T38) {
 			t38_core_rx_ifp_packet(t38state, inf->data.ptr, inf->datalen, inf->seqno);
-
-			/* Watchdog */
 			if (last_state != t30state->state) {
 				state_change = ast_tvnow();
 				last_state = t30state->state;
 			}
 		} else if (inf->frametype == AST_FRAME_CONTROL && inf->subclass == AST_CONTROL_T38_PARAMETERS) {
 			struct ast_control_t38_parameters *parameters = inf->data.ptr;
-			if (parameters->request_response == AST_T38_TERMINATED || parameters->request_response == AST_T38_REFUSED) {
-				ast_debug(1, "T38 down, terminating\n");
-				res = -1;
+			if (parameters->request_response == AST_T38_TERMINATED) {
+				ast_debug(1, "T38 down, finishing\n");
 				break;
 			}
 		}
 
 		ast_frfree(inf);
-		inf = NULL;
-
-		/* Watchdog */
-		if (ast_tvdiff_sec(now, start) > WATCHDOG_TOTAL_TIMEOUT || ast_tvdiff_sec(now, state_change) > WATCHDOG_STATE_TIMEOUT) {
-			ast_log(LOG_WARNING, "It looks like we hung. Aborting.\n");
-			res = -1;
-			break;
-		}
 	}
 
 	ast_debug(1, "Loop finished, res=%d\n", res);

Modified: team/phsultan/rtmp-support/apps/app_meetme.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/phsultan/rtmp-support/apps/app_meetme.c?view=diff&rev=206804&r1=206803&r2=206804
==============================================================================
--- team/phsultan/rtmp-support/apps/app_meetme.c (original)
+++ team/phsultan/rtmp-support/apps/app_meetme.c Thu Jul 16 08:32:23 2009
@@ -658,7 +658,7 @@
 
 #define MAX_CONFNUM 80
 #define MAX_PIN     80
-#define OPTIONS_LEN 32
+#define OPTIONS_LEN 100
 
 enum announcetypes {
 	CONF_HASJOIN,
@@ -1892,7 +1892,7 @@
 	struct timeval now;
 	struct ast_tm tm;
 	struct ast_variable *var, *orig_var;
-	char bookid[8]; 
+	char bookid[51];
 
 	if (!extendby) {
 		return 0;
@@ -3433,13 +3433,13 @@
 		int maxusers = 0;
 		struct timeval now;
 		char recordingfilename[256] = "";
-		char recordingformat[10] = "";
+		char recordingformat[11] = "";
 		char currenttime[19] = "";
 		char eatime[19] = "";
-		char bookid[19] = "";
+		char bookid[51] = "";
 		char recordingtmp[AST_MAX_EXTENSION] = "";
-		char useropts[OPTIONS_LEN]; /* Used for RealTime conferences */
-		char adminopts[OPTIONS_LEN];
+		char useropts[OPTIONS_LEN + 1]; /* Used for RealTime conferences */
+		char adminopts[OPTIONS_LEN + 1];
 		struct ast_tm tm, etm;
 		struct timeval endtime = { .tv_sec = 0 };
 		const char *var2;
@@ -3503,11 +3503,11 @@
 			} else if (!strcasecmp(var->name, "bookId")) {
 				ast_copy_string(bookid, var->value, sizeof(bookid));
 			} else if (!strcasecmp(var->name, "opts")) {
-				ast_copy_string(useropts, var->value, sizeof(char[OPTIONS_LEN]));
+				ast_copy_string(useropts, var->value, sizeof(char[OPTIONS_LEN + 1]));
 			} else if (!strcasecmp(var->name, "maxusers")) {
 				maxusers = atoi(var->value);
 			} else if (!strcasecmp(var->name, "adminopts")) {
-				ast_copy_string(adminopts, var->value, sizeof(char[OPTIONS_LEN]));
+				ast_copy_string(adminopts, var->value, sizeof(char[OPTIONS_LEN + 1]));
 			} else if (!strcasecmp(var->name, "recordingfilename")) {
 				ast_copy_string(recordingfilename, var->value, sizeof(recordingfilename));
 			} else if (!strcasecmp(var->name, "recordingformat")) {

Modified: team/phsultan/rtmp-support/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/phsultan/rtmp-support/apps/app_voicemail.c?view=diff&rev=206804&r1=206803&r2=206804
==============================================================================
--- team/phsultan/rtmp-support/apps/app_voicemail.c (original)
+++ team/phsultan/rtmp-support/apps/app_voicemail.c Thu Jul 16 08:32:23 2009
@@ -8311,10 +8311,7 @@
 			}
 		}
 		if (!res) {
-			if (skipadvanced)
-				res = ast_play_and_wait(chan, "vm-helpexit-full");
-			else
-				res = ast_play_and_wait(chan, "vm-helpexit");
+			res = ast_play_and_wait(chan, "vm-helpexit");
 		}
 		if (!res)
 			res = ast_waitfordigit(chan, 6000);

Modified: team/phsultan/rtmp-support/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/phsultan/rtmp-support/channels/chan_dahdi.c?view=diff&rev=206804&r1=206803&r2=206804
==============================================================================
--- team/phsultan/rtmp-support/channels/chan_dahdi.c (original)
+++ team/phsultan/rtmp-support/channels/chan_dahdi.c Thu Jul 16 08:32:23 2009
@@ -63,6 +63,11 @@
 #include <dahdi/user.h>
 #include <dahdi/tonezone.h>
 #include "sig_analog.h"
+/* Analog signaling is currently still present in chan_dahdi for use with
+ * radio. Sig_analog does not currently handle any radio operations. If
+ * radio only uses analog signaling, then the radio handling logic could
+ * be placed in sig_analog and the duplicated code could be removed.
+ */
 
 #ifdef HAVE_PRI
 #include "sig_pri.h"
@@ -363,6 +368,37 @@
 #define CALLPROGRESS_FAX_OUTGOING	2
 #define CALLPROGRESS_FAX_INCOMING	4
 #define CALLPROGRESS_FAX		(CALLPROGRESS_FAX_INCOMING | CALLPROGRESS_FAX_OUTGOING)
+
+#define NUM_CADENCE_MAX 25
+static int num_cadence = 4;
+static int user_has_defined_cadences = 0;
+
+static struct dahdi_ring_cadence cadences[NUM_CADENCE_MAX] = {
+	{ { 125, 125, 2000, 4000 } },			/*!< Quick chirp followed by normal ring */
+	{ { 250, 250, 500, 1000, 250, 250, 500, 4000 } }, /*!< British style ring */
+	{ { 125, 125, 125, 125, 125, 4000 } },	/*!< Three short bursts */
+	{ { 1000, 500, 2500, 5000 } },	/*!< Long ring */
+};
+
+/*! \brief cidrings says in which pause to transmit the cid information, where the first pause
+ * is 1, the second pause is 2 and so on.
+ */
+
+static int cidrings[NUM_CADENCE_MAX] = {
+	2,										/*!< Right after first long ring */
+	4,										/*!< Right after long part */
+	3,										/*!< After third chirp */
+	2,										/*!< Second spell */
+};
+
+/* ETSI EN300 659-1 specifies the ring pulse between 200 and 300 mS */
+static struct dahdi_ring_cadence AS_RP_cadence = {{250, 10000}};
+
+#define ISTRUNK(p) ((p->sig == SIG_FXSLS) || (p->sig == SIG_FXSKS) || \
+			(p->sig == SIG_FXSGS) || (p->sig == SIG_PRI))
+
+#define CANBUSYDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) /* || (p->sig & __DAHDI_SIG_FXO) */)
+#define CANPROGRESSDETECT(p) (ISTRUNK(p) || (p->sig & (SIG_EM | SIG_EM_E1 | SIG_SF)) /* || (p->sig & __DAHDI_SIG_FXO) */)
 
 static char defaultcic[64] = "";
 static char defaultozz[64] = "";
@@ -1153,19 +1189,12 @@
 	struct ast_event_sub *mwi_event_sub;
 	/*! \brief Delayed dialing for E911.  Overlap digits for ISDN. */
 	char dialdest[256];
-	/*! \brief Time the interface went on-hook. */
-	int onhooktime;
-	/*! \brief TRUE if the FXS port is off-hook */
-	int fxsoffhookstate;
-	/*! \brief -1 = unknown, 0 = no messages, 1 = new messages available */
-	int msgstate;
 #ifdef HAVE_DAHDI_LINEREVERSE_VMWI
 	struct dahdi_vmwi_info mwisend_setting;				/*!< Which VMWI methods to use */
 	unsigned int mwisend_fsk: 1;		/*! Variable for enabling FSK MWI handling in chan_dahdi */
 	unsigned int mwisend_rpas:1;		/*! Variable for enabling Ring Pulse Alert before MWI FSK Spill */
 #endif
 	int distinctivering;				/*!< Which distinctivering to use */
-	int cidrings;					/*!< Which ring to deliver CID on */
 	int dtmfrelax;					/*!< whether to run in relaxed DTMF mode */
 	/*! \brief Holding place for event injected from outside normal operation. */
 	int fake_event;
@@ -1177,7 +1206,7 @@
 	/*! \brief Start delay time if polarityonanswerdelay is nonzero. */
 	struct timeval polaritydelaytv;
 	/*!
-	 * \brief Send caller ID after this many rings.
+	 * \brief Send caller ID on FXS after this many rings. Set to 1 for US.
 	 * \note Set from the "sendcalleridafter" value read in from chan_dahdi.conf
 	 */
 	int sendcalleridafter;
@@ -1557,6 +1586,7 @@
 static int my_get_callerid(void *pvt, char *namebuf, char *numbuf, enum analog_event *ev, size_t timeout)
 {
 	struct dahdi_pvt *p = pvt;
+	struct analog_pvt *analog_p = p->sig_pvt;
 	struct pollfd poller;
 	char *name, *num;
 	int index = SUB_REAL;
@@ -1578,9 +1608,9 @@
 	if (poller.revents & POLLIN) {
 		/*** NOTES ***/
 		/* Change API: remove cid_signalling from get_callerid, add a new start_cid_detect and stop_cid_detect function
-		 * to enable slin mode and allocate cid detector.  get_callerid should be able to be called any number of times until
-		 * either a timeout occurss or CID is detected (returns 0).  returning 1 should be event received, and -1 should be fail
-		 * and die */
+		 * to enable slin mode and allocate cid detector. get_callerid should be able to be called any number of times until
+		 * either a timeout occurss or CID is detected (returns 0). returning 1 should be event received, and -1 should be
+		 * a failure and die, and returning 2 means no event was received. */
 		res = read(p->subs[index].dfd, buf, sizeof(buf));
 		if (res < 0) {
 			if (errno != ELAST) {
@@ -1589,7 +1619,20 @@
 				return -1;
 			}
 		}
-		res = callerid_feed(p->cs, buf, res, AST_LAW(p));
+
+		if (analog_p->ringt) {
+			analog_p->ringt--;
+		}
+		if (analog_p->ringt == 1) {
+			return -1;
+		}
+
+		if (p->cid_signalling == CID_SIG_V23_JP) {
+			res = callerid_feed_jp(p->cs, buf, res, AST_LAW(p));
+		} else {
+			res = callerid_feed(p->cs, buf, res, AST_LAW(p));
+		}
+
 		if (res < 0) {
 			ast_log(LOG_WARNING, "CallerID feed failed: %s\n", strerror(errno));
 			return -1;
@@ -1608,7 +1651,128 @@
 	}
 
 	*ev = ANALOG_EVENT_NONE;
-	return 1;
+	return 2;
+}
+
+static const char *event2str(int event);
+static int restore_gains(struct dahdi_pvt *p);
+
+static int my_distinctive_ring(struct ast_channel *chan, void *pvt, int idx, int *ringdata)
+{
+	unsigned char buf[256];
+	int distMatches;
+	int curRingData[3];
+	int receivedRingT;
+	int counter1;
+	int counter;
+	int i;
+	int res;
+	int checkaftercid = 0;
+
+	struct dahdi_pvt *p = pvt;
+	struct analog_pvt *analog_p = p->sig_pvt;
+
+	if (ringdata == NULL) {
+		ringdata = curRingData;
+	} else {
+		checkaftercid = 1;
+	}
+
+	/* We must have a ring by now, so, if configured, lets try to listen for
+	 * distinctive ringing */
+	if ((checkaftercid && distinctiveringaftercid) || !checkaftercid) {
+		/* Clear the current ring data array so we dont have old data in it. */
+		for (receivedRingT = 0; receivedRingT < ARRAY_LEN(ringdata); receivedRingT++)
+			ringdata[receivedRingT] = 0;
+		receivedRingT = 0;
+		if (checkaftercid && distinctiveringaftercid)
+			ast_verb(3, "Detecting post-CID distinctive ring\n");
+		/* Check to see if context is what it should be, if not set to be. */
+		else if (strcmp(p->context,p->defcontext) != 0) {
+			ast_copy_string(p->context, p->defcontext, sizeof(p->context));
+			ast_copy_string(chan->context,p->defcontext,sizeof(chan->context));
+		}
+
+		for (;;) {
+			i = DAHDI_IOMUX_READ | DAHDI_IOMUX_SIGEVENT;
+			if ((res = ioctl(p->subs[idx].dfd, DAHDI_IOMUX, &i))) {
+				ast_log(LOG_WARNING, "I/O MUX failed: %s\n", strerror(errno));
+				ast_hangup(chan);
+				return 1;
+			}
+			if (i & DAHDI_IOMUX_SIGEVENT) {
+				res = dahdi_get_event(p->subs[idx].dfd);
+				ast_log(LOG_NOTICE, "Got event %d (%s)...\n", res, event2str(res));
+				res = 0;
+				/* Let us detect distinctive ring */
+
+				ringdata[receivedRingT] = analog_p->ringt;
+
+				if (analog_p->ringt < analog_p->ringt_base/2)
+					break;
+				/* Increment the ringT counter so we can match it against
+				   values in chan_dahdi.conf for distinctive ring */
+				if (++receivedRingT == ARRAY_LEN(ringdata))
+					break;
+			} else if (i & DAHDI_IOMUX_READ) {
+				res = read(p->subs[idx].dfd, buf, sizeof(buf));
+				if (res < 0) {
+					if (errno != ELAST) {
+						ast_log(LOG_WARNING, "read returned error: %s\n", strerror(errno));
+						ast_hangup(chan);
+						return 1;
+					}
+					break;
+				}
+				if (analog_p->ringt)
+					analog_p->ringt--;
+				if (analog_p->ringt == 1) {
+					res = -1;
+					break;
+				}
+			}
+		}
+	}
+	if ((checkaftercid && usedistinctiveringdetection) || !checkaftercid) {
+		/* this only shows up if you have n of the dring patterns filled in */
+		ast_verb(3, "Detected ring pattern: %d,%d,%d\n",ringdata[0],ringdata[1],ringdata[2]);
+		for (counter = 0; counter < 3; counter++) {
+		/* Check to see if the rings we received match any of the ones in chan_dahdi.conf for this channel */
+			distMatches = 0;
+			/* this only shows up if you have n of the dring patterns filled in */
+			ast_verb(3, "Checking %d,%d,%d\n",
+					p->drings.ringnum[counter].ring[0],
+					p->drings.ringnum[counter].ring[1],
+					p->drings.ringnum[counter].ring[2]);
+			for (counter1 = 0; counter1 < 3; counter1++) {
+				ast_verb(3, "Ring pattern check range: %d\n", p->drings.ringnum[counter].range);
+				if (p->drings.ringnum[counter].ring[counter1] == -1) {
+					ast_verb(3, "Pattern ignore (-1) detected, so matching pattern %d regardless.\n",
+					ringdata[counter1]);
+					distMatches++;
+				} else if (ringdata[counter1] <= (p->drings.ringnum[counter].ring[counter1] + p->drings.ringnum[counter].range) &&
+										ringdata[counter1] >= (p->drings.ringnum[counter].ring[counter1] - p->drings.ringnum[counter].range)) {
+					ast_verb(3, "Ring pattern matched in range: %d to %d\n",
+					(p->drings.ringnum[counter].ring[counter1] - p->drings.ringnum[counter].range),
+					(p->drings.ringnum[counter].ring[counter1] + p->drings.ringnum[counter].range));
+					distMatches++;
+				}
+			}
+
+			if (distMatches == 3) {
+				/* The ring matches, set the context to whatever is for distinctive ring.. */

[... 4612 lines stripped ...]



More information about the asterisk-commits mailing list