]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix chan_dahdi option ringtimeout
authorJeff Peeler <jpeeler@digium.com>
Wed, 12 Aug 2009 20:47:45 +0000 (20:47 +0000)
committerJeff Peeler <jpeeler@digium.com>
Wed, 12 Aug 2009 20:47:45 +0000 (20:47 +0000)
dahdi_read relies on the dahdi_pvt copy of ringt which was not getting set
in sig_analog. This patch adds a callback to do so.

(closes issue #15288)
Reported by: alecdavis
Patches:
      chan_dahdi.ringtimeout.diff.txt uploaded by alecdavis (license 585)
Tested by: alecdavis

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@211908 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_dahdi.c
channels/sig_analog.c
channels/sig_analog.h

index c11cc0cb210da04331a9cc9fb6179df1395c6767..84229a127fb5d85d909908b79b8f20b26484f409 100644 (file)
@@ -2049,6 +2049,12 @@ static void my_set_dialing(void *pvt, int flag)
        p->dialing = flag;
 }
 
+static void my_set_ringtimeout(void *pvt, int ringt)
+{
+       struct dahdi_pvt *p = pvt;
+       p->ringt = ringt;
+}
+
 static void my_increase_ss_count(void)
 {
        ast_mutex_lock(&ss_thread_lock);
@@ -2772,6 +2778,7 @@ static struct analog_callback dahdi_analog_callbacks =
        .get_sub_fd = my_get_sub_fd,
        .set_cadence = my_set_cadence,
        .set_dialing = my_set_dialing,
+       .set_ringtimeout = my_set_ringtimeout,
 };
 
 static struct dahdi_pvt *round_robin[32];
index 8bcd88ba292c62f693e2dfb62dbea305e6ea5f85..6678f3fa83008d288aed1169e8cb4f03b649acae 100644 (file)
@@ -707,6 +707,15 @@ static void analog_set_dialing(struct analog_pvt *p, int flag)
        }
 }
 
+static void analog_set_ringtimeout(struct analog_pvt *p, int ringt)
+{
+       p->ringt = ringt;
+       if (!p->calls->set_ringtimeout) {
+               return;
+       }
+       p->calls->set_ringtimeout(p->chan_pvt, ringt);
+}
+
 int analog_call(struct analog_pvt *p, struct ast_channel *ast, char *rdest, int timeout)
 {
        int res, index,mysig;
@@ -1060,7 +1069,7 @@ int analog_hangup(struct analog_pvt *p, struct ast_channel *ast)
 
        if (!p->subs[ANALOG_SUB_REAL].owner && !p->subs[ANALOG_SUB_CALLWAIT].owner && !p->subs[ANALOG_SUB_THREEWAY].owner) {
                p->owner = NULL;
-               p->ringt = 0;
+               analog_set_ringtimeout(p, 0);
                p->outgoing = 0;
                p->onhooktime = time(NULL);
                p->cidrings = 1;
@@ -1130,7 +1139,7 @@ int analog_answer(struct analog_pvt *p, struct ast_channel *ast)
        case ANALOG_SIG_FXSLS:
        case ANALOG_SIG_FXSGS:
        case ANALOG_SIG_FXSKS:
-               p->ringt = 0;
+               analog_set_ringtimeout(p, 0);
                /* Fall through */
        case ANALOG_SIG_EM:
        case ANALOG_SIG_EM_E1:
@@ -2093,7 +2102,7 @@ static void *__analog_ss_thread(void *data)
 
                ast_setstate(chan, AST_STATE_RING);
                chan->rings = 1;
-               p->ringt = p->ringt_base;
+               analog_set_ringtimeout(p, p->ringt_base);
                res = ast_pbx_run(chan);
                if (res) {
                        ast_hangup(chan);
@@ -2413,7 +2422,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
                case ANALOG_SIG_FXSGS:
                case ANALOG_SIG_FXSKS:
                        if (ast->_state == AST_STATE_RING) {
-                               p->ringt = p->ringt_base;
+                               analog_set_ringtimeout(p, p->ringt_base);
                        }
 
                        /* Fall through */
@@ -2457,7 +2466,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
                case ANALOG_SIG_FXSGS:
                case ANALOG_SIG_FXSKS:
                        if (ast->_state == AST_STATE_RING) {
-                               p->ringt = p->ringt_base;
+                               analog_set_ringtimeout(p, p->ringt_base);
                        }
                        break;
                }
@@ -3007,7 +3016,7 @@ int analog_handle_init_event(struct analog_pvt *i, int event)
                case ANALOG_SIG_FXSLS:
                case ANALOG_SIG_FXSGS:
                case ANALOG_SIG_FXSKS:
-                               i->ringt = i->ringt_base;
+                               analog_set_ringtimeout(i, i->ringt_base);
                                /* Fall through */
                case ANALOG_SIG_EMWINK:
                case ANALOG_SIG_FEATD:
index 93e9efa7a856401aaeef9fa735565c61f9ae6890..f33f417b750224b9570eb017472aed8f03884a74 100644 (file)
@@ -193,6 +193,7 @@ struct analog_callback {
        int (* const get_sub_fd)(void *pvt, enum analog_sub sub);
        void (* const set_cadence)(void *pvt, int *cidrings, struct ast_channel *chan);
        void (* const set_dialing)(void *pvt, int flag);
+       void (* const set_ringtimeout)(void *pvt, int ringt);
 };