[svn-commits] jpeeler: branch jpeeler/asterisk-sigwork-trunk r206454 - /team/jpeeler/asteri...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Jul 14 11:07:58 CDT 2009
Author: jpeeler
Date: Tue Jul 14 11:07:54 2009
New Revision: 206454
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=206454
Log:
Readd code in dahdi_hangup dealing with analog signaling, as sig_analog does
not handle signaling when using radio.
Modified:
team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c
team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c
team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h
Modified: team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c?view=diff&rev=206454&r1=206453&r2=206454
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c Tue Jul 14 11:07:54 2009
@@ -2308,7 +2308,7 @@
return dahdievent_to_analogevent(res);
}
-static int my_is_off_hook(void *pvt, int debug)
+static int my_is_off_hook(void *pvt)
{
struct dahdi_pvt *p = pvt;
int res;
@@ -2323,9 +2323,6 @@
}
if (res) {
ast_log(LOG_WARNING, "Unable to check hook state on channel %d: %s\n", p->channel, strerror(errno));
- }
- if (debug) {
- ast_debug(1, "Channel %d, offhook = %d\n", p->channel, par.rxisoffhook);
}
return (par.rxbits > -1) || par.rxisoffhook;
@@ -4851,6 +4848,7 @@
struct dahdi_pvt *p = ast->tech_pvt;
struct dahdi_pvt *tmp = NULL;
struct dahdi_pvt *prev = NULL;
+ struct dahdi_params par;
ast_debug(1, "dahdi_hangup(%s)\n", ast->name);
if (!ast->tech_pvt) {
@@ -5131,6 +5129,38 @@
res = dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_ONHOOK);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to hangup line %s\n", ast->name);
+ }
+ switch (p->sig) {
+ case SIG_FXOGS:
+ case SIG_FXOLS:
+ case SIG_FXOKS:
+ memset(&par, 0, sizeof(par));
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, &par);
+ if (!res) {
+ struct analog_pvt *analog_p = p->sig_pvt;
+#if 0
+ ast_debug(1, "Hanging up channel %d, offhook = %d\n", p->channel, par.rxisoffhook);
+#endif
+ /* If they're off hook, try playing congestion */
+ if ((par.rxisoffhook) && (!(p->radio || (p->oprmode < 0))))
+ tone_zone_play_tone(p->subs[SUB_REAL].dfd, DAHDI_TONE_CONGESTION);
+ else
+ tone_zone_play_tone(p->subs[SUB_REAL].dfd, -1);
+ analog_p->fxsoffhookstate = par.rxisoffhook;
+ }
+ break;
+ case SIG_FXSGS:
+ case SIG_FXSLS:
+ case SIG_FXSKS:
+ /* Make sure we're not made available for at least two seconds assuming
+ we were actually used for an inbound or outbound call. */
+ if (ast->_state != AST_STATE_RESERVED) {
+ time(&p->guardtime);
+ p->guardtime += 2;
+ }
+ break;
+ default:
+ tone_zone_play_tone(p->subs[SUB_REAL].dfd, -1);
}
if (p->sig)
dahdi_disable_ec(p);
Modified: team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c?view=diff&rev=206454&r1=206453&r2=206454
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c Tue Jul 14 11:07:54 2009
@@ -38,6 +38,7 @@
#include "asterisk/astdb.h"
#include "asterisk/features.h"
#include "asterisk/cel.h"
+#include "asterisk/causes.h"
#include "sig_analog.h"
@@ -384,10 +385,10 @@
return -1;
}
-static int analog_is_off_hook(struct analog_pvt *p, int debug)
+static int analog_is_off_hook(struct analog_pvt *p)
{
if (p->calls->is_off_hook)
- return p->calls->is_off_hook(p->chan_pvt, debug);
+ return p->calls->is_off_hook(p->chan_pvt);
else
return -1;
}
@@ -621,7 +622,7 @@
if (p->sig == ANALOG_SIG_FXSLS)
return 1;
- offhook = analog_is_off_hook(p, 0);
+ offhook = analog_is_off_hook(p);
if ((p->sig == ANALOG_SIG_FXSKS) || (p->sig == ANALOG_SIG_FXSGS)) {
/* When "onhook" that means no battery on the line, and thus
@@ -1067,7 +1068,7 @@
case ANALOG_SIG_FXOLS:
case ANALOG_SIG_FXOKS:
/* If they're off hook, try playing congestion */
- if (analog_is_off_hook(p, 1))
+ if (analog_is_off_hook(p))
analog_play_tone(p, ANALOG_SUB_REAL, ANALOG_TONE_CONGESTION);
else
analog_play_tone(p, ANALOG_SUB_REAL, -1);
@@ -2253,7 +2254,7 @@
/* It hasn't been long enough since the last flashook. This is probably a bounce on
hanging up. Hangup both channels now */
if (p->subs[ANALOG_SUB_THREEWAY].owner)
- ast_queue_hangup(p->subs[ANALOG_SUB_THREEWAY].owner);
+ ast_queue_hangup_with_cause(p->subs[ANALOG_SUB_THREEWAY].owner, AST_CAUSE_NO_ANSWER);
ast_softhangup_nolock(p->subs[ANALOG_SUB_THREEWAY].owner, AST_SOFTHANGUP_DEV);
ast_debug(1, "Looks like a bounced flash, hanging up both calls on %d\n", p->channel);
ast_channel_unlock(p->subs[ANALOG_SUB_THREEWAY].owner);
Modified: team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h?view=diff&rev=206454&r1=206453&r2=206454
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.h Tue Jul 14 11:07:54 2009
@@ -123,7 +123,7 @@
int (* const get_event)(void *pvt);
int (* const wait_event)(void *pvt);
- int (* const is_off_hook)(void *pvt, int debug);
+ int (* const is_off_hook)(void *pvt);
int (* const is_dialing)(void *pvt, enum analog_sub sub);
/* Start a trunk type signalling protocol (everything except phone ports basically */
int (* const start)(void *pvt);
More information about the svn-commits
mailing list