]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
push 'outgoing' flag from sig_XXX up to chan_dahdi
authorAlec L Davis <sivad.a@paradise.net.nz>
Sat, 18 Feb 2012 07:58:43 +0000 (07:58 +0000)
committerAlec L Davis <sivad.a@paradise.net.nz>
Sat, 18 Feb 2012 07:58:43 +0000 (07:58 +0000)
'p->outgoing' in chan_dahdi and sig_analog wern't kept in sync, particulary FXS ast_hangup didn't clear the 'outgoing' flag.
sig_pri and sig_ss7 were keeping 'outgoing' flag insync.

Now provides a callback for all the low level sig_XXX modules.

(issue ASTERISK-19316)

alecdavis (license 585)
Reported by: Jeremy Pepper
Tested by: alecdavis

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

Merged revisions 355850 from http://svn.asterisk.org/svn/asterisk/branches/1.8

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

channels/chan_dahdi.c
channels/sig_analog.c
channels/sig_analog.h
channels/sig_pri.c
channels/sig_pri.h
channels/sig_ss7.c
channels/sig_ss7.h

index 9e0bf59b363e917498ef51d35b65cc016050ff68..5ae9bc14b2264ed8cc6b0be3d5731042f87e52ab 100644 (file)
@@ -2277,6 +2277,13 @@ static void my_set_dialing(void *pvt, int is_dialing)
        p->dialing = is_dialing;
 }
 
+static void my_set_outgoing(void *pvt, int is_outgoing)
+{
+       struct dahdi_pvt *p = pvt;
+
+       p->outgoing = is_outgoing;
+}
+
 #if defined(HAVE_PRI) || defined(HAVE_SS7)
 static void my_set_digital(void *pvt, int is_digital)
 {
@@ -3400,6 +3407,7 @@ static struct sig_pri_callback dahdi_pri_callbacks =
        .fixup_chans = my_pri_fixup_chans,
        .set_alarm = my_set_alarm,
        .set_dialing = my_set_dialing,
+       .set_outgoing = my_set_outgoing,
        .set_digital = my_set_digital,
        .set_callerid = my_set_callerid,
        .set_dnid = my_set_dnid,
@@ -3571,6 +3579,7 @@ static struct sig_ss7_callback dahdi_ss7_callbacks =
        .handle_link_exception = my_handle_link_exception,
        .set_alarm = my_set_alarm,
        .set_dialing = my_set_dialing,
+       .set_outgoing = my_set_outgoing,
        .set_digital = my_set_digital,
        .set_inservice = my_set_inservice,
        .set_locallyblocked = my_set_locallyblocked,
@@ -3712,6 +3721,7 @@ static struct analog_callback dahdi_analog_callbacks =
        .set_cadence = my_set_cadence,
        .set_alarm = my_set_alarm,
        .set_dialing = my_set_dialing,
+       .set_outgoing = my_set_outgoing,
        .set_ringtimeout = my_set_ringtimeout,
        .set_waitingfordt = my_set_waitingfordt,
        .check_waitingfordt = my_check_waitingfordt,
index edfd0da9ec4c1478b0ccdec61ff19d90b1807bee..92d67be197db880f21d42e76301d5b0cdecb6384 100644 (file)
@@ -512,6 +512,14 @@ static int analog_on_hook(struct analog_pvt *p)
        return -1;
 }
 
+static void analog_set_outgoing(struct analog_pvt *p, int is_outgoing)
+{
+       p->outgoing = is_outgoing;
+       if (p->calls->set_outgoing) {
+               p->calls->set_outgoing(p->chan_pvt, is_outgoing);
+       }
+}
+
 static int analog_check_for_conference(struct analog_pvt *p)
 {
        if (p->calls->check_for_conference) {
@@ -796,11 +804,11 @@ struct ast_channel * analog_request(struct analog_pvt *p, int *callwait, const s
                }
        }
 
-       p->outgoing = 1;
+       analog_set_outgoing(p, 1);
        ast = analog_new_ast_channel(p, AST_STATE_RESERVED, 0,
                p->owner ? ANALOG_SUB_CALLWAIT : ANALOG_SUB_REAL, requestor);
        if (!ast) {
-               p->outgoing = 0;
+               analog_set_outgoing(p, 0);
        }
        return ast;
 }
@@ -1026,7 +1034,7 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, char *rdest, int
        }
 
        p->dialednone = 0;
-       p->outgoing = 1;
+       analog_set_outgoing(p, 1);
 
        mysig = p->sig;
        if (p->outsigmod > -1) {
@@ -1429,7 +1437,7 @@ int analog_hangup(struct analog_pvt *p, struct ast_channel *ast)
                analog_set_ringtimeout(p, 0);
                analog_set_confirmanswer(p, 0);
                analog_set_pulsedial(p, 0);
-               p->outgoing = 0;
+               analog_set_outgoing(p, 0);
                p->onhooktime = time(NULL);
                p->cidrings = 1;
 
index fd19b535282daafcd8244aab8b1272e8c0a48d07..dac5a0b552fadc26ff4f1ddf2dd2b7b3fbfafd39 100644 (file)
@@ -223,6 +223,7 @@ struct analog_callback {
        void (* const set_cadence)(void *pvt, int *cidrings, struct ast_channel *chan);
        void (* const set_alarm)(void *pvt, int in_alarm);
        void (* const set_dialing)(void *pvt, int is_dialing);
+       void (* const set_outgoing)(void *pvt, int is_outgoing);
        void (* const set_ringtimeout)(void *pvt, int ringt);
        void (* const set_waitingfordt)(void *pvt, struct ast_channel *ast);
        int (* const check_waitingfordt)(void *pvt);
index 5f4847425b4fa520b2b6adc69c0b21abaab53423..bb69ca6f91ab5220aafd8e4f5b2b0ead19aa05ef 100644 (file)
@@ -180,6 +180,14 @@ static void sig_pri_set_digital(struct sig_pri_chan *p, int is_digital)
        }
 }
 
+static void sig_pri_set_outgoing(struct sig_pri_chan *p, int is_outgoing)
+{
+       p->outgoing = is_outgoing;
+       if (p->calls->set_outgoing) {
+               p->calls->set_outgoing(p->chan_pvt, is_outgoing);
+       }
+}
+
 void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm)
 {
        /*
@@ -1003,10 +1011,10 @@ struct ast_channel *sig_pri_request(struct sig_pri_chan *p, enum sig_pri_law law
 
        ast_debug(1, "%s %d\n", __FUNCTION__, p->channel);
 
-       p->outgoing = 1;
+       sig_pri_set_outgoing(p, 1);
        ast = sig_pri_new_ast_channel(p, AST_STATE_RESERVED, law, transfercapability, p->exten, requestor);
        if (!ast) {
-               p->outgoing = 0;
+               sig_pri_set_outgoing(p, 0);
        }
        return ast;
 }
@@ -7229,7 +7237,7 @@ int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast)
                return 0;
        }
 
-       p->outgoing = 0;
+       sig_pri_set_outgoing(p, 0);
        sig_pri_set_digital(p, 0);      /* push up to parent for EC*/
 #if defined(HAVE_PRI_CALL_WAITING)
        if (p->is_call_waiting) {
@@ -7441,7 +7449,7 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, i
        }
 
        p->dialdest[0] = '\0';
-       p->outgoing = 1;
+       sig_pri_set_outgoing(p, 1);
 
        ast_copy_string(dest, rdest, sizeof(dest));
        AST_NONSTANDARD_APP_ARGS(args, dest, '/');
index c31a5b194c472383f67123f02a119d39e2287ee8..02e7ce5a955ddbda447b2122308a32852d657bb6 100644 (file)
@@ -192,6 +192,7 @@ struct sig_pri_callback {
        void (* const set_alarm)(void *pvt, int in_alarm);
        void (* const set_dialing)(void *pvt, int is_dialing);
        void (* const set_digital)(void *pvt, int is_digital);
+       void (* const set_outgoing)(void *pvt, int is_outgoing);
        void (* const set_callerid)(void *pvt, const struct ast_party_caller *caller);
        void (* const set_dnid)(void *pvt, const char *dnid);
        void (* const set_rdnis)(void *pvt, const char *rdnis);
index 616d6002a82c8977509b8984aa92a2fd6794113a..a3dd80da5ea1bc471b8b7ebb9b3a3cdfb55aaca1 100644 (file)
@@ -120,6 +120,14 @@ static void sig_ss7_set_digital(struct sig_ss7_chan *p, int is_digital)
        }
 }
 
+static void sig_ss7_set_outgoing(struct sig_ss7_chan *p, int is_outgoing)
+{
+       p->outgoing = is_outgoing;
+       if (p->calls->set_outgoing) {
+               p->calls->set_outgoing(p->chan_pvt, is_outgoing);
+       }
+}
+
 static void sig_ss7_set_inservice(struct sig_ss7_chan *p, int is_inservice)
 {
        if (p->calls->set_inservice) {
@@ -1570,7 +1578,7 @@ int sig_ss7_hangup(struct sig_ss7_chan *p, struct ast_channel *ast)
 
        p->owner = NULL;
        sig_ss7_set_dialing(p, 0);
-       p->outgoing = 0;
+       sig_ss7_set_outgoing(p, 0);
        p->progress = 0;
        p->rlt = 0;
        p->exten[0] = '\0';
@@ -1755,10 +1763,10 @@ struct ast_channel *sig_ss7_request(struct sig_ss7_chan *p, enum sig_ss7_law law
 {
        struct ast_channel *ast;
 
-       p->outgoing = 1;
+       sig_ss7_set_outgoing(p, 1);
        ast = sig_ss7_new_ast_channel(p, AST_STATE_RESERVED, law, transfercapability, p->exten, requestor);
        if (!ast) {
-               p->outgoing = 0;
+               sig_ss7_set_outgoing(p, 0);
 
                /* Release the allocated channel.  Only have to deal with the linkset lock. */
                ast_mutex_lock(&p->ss7->lock);
index 14a9980100357fb3101456f95d86311130e69ae6..496e08abe4d47caf94d10c011f8a1c88e840c21b 100644 (file)
@@ -142,6 +142,7 @@ struct sig_ss7_callback {
        void (* const set_alarm)(void *pvt, int in_alarm);
        void (* const set_dialing)(void *pvt, int is_dialing);
        void (* const set_digital)(void *pvt, int is_digital);
+       void (* const set_outgoing)(void *pvt, int is_outgoing);
        void (* const set_inservice)(void *pvt, int is_inservice);
        void (* const set_locallyblocked)(void *pvt, int is_blocked);
        void (* const set_remotelyblocked)(void *pvt, int is_blocked);