]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Make DAHDISendCallreroutingFacility wait 5 seconds for a reply before disconnecting...
authorRichard Mudgett <rmudgett@digium.com>
Wed, 25 Apr 2012 20:46:15 +0000 (20:46 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 25 Apr 2012 20:46:15 +0000 (20:46 +0000)
Some switches may not handle the call-deflection/call-rerouting message if
the call is disconnected too soon after being sent.  Asteisk was not
waiting for any reply before disconnecting the call.

* Added a 5 second delay before disconnecting the call to wait for a
potential response if the peer does not disconnect first.

(closes issue ASTERISK-19708)
Reported by: mehdi Shirazi
Patches:
      jira_asterisk_19708_v1.8.patch (license #5621) patch uploaded by rmudgett
Tested by: rmudgett

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

channels/chan_dahdi.c
channels/sig_pri.c

index f909ed316291084657a917c3b67601bf1ca12081..a4f27418d75d5a680ebf0b2914524b7bbea424ab 100644 (file)
@@ -5910,7 +5910,7 @@ static int dahdi_send_callrerouting_facility_exec(struct ast_channel *chan, cons
        /* Data will be our digit string */
        struct dahdi_pvt *pvt;
        char *parse;
-       int res = -1;
+       int res;
        AST_DECLARE_APP_ARGS(args,
                AST_APP_ARG(destination);
                AST_APP_ARG(original);
@@ -5957,10 +5957,17 @@ static int dahdi_send_callrerouting_facility_exec(struct ast_channel *chan, cons
                args.reason = NULL;
        }
 
-       pri_send_callrerouting_facility_exec(pvt->sig_pvt, chan->_state, args.destination,
-               args.original, args.reason);
+       res = pri_send_callrerouting_facility_exec(pvt->sig_pvt, chan->_state,
+               args.destination, args.original, args.reason);
+       if (!res) {
+               /*
+                * Wait up to 5 seconds for a reply before hanging up this call
+                * leg if the peer does not disconnect first.
+                */
+               ast_safe_sleep(chan, 5000);
+       }
 
-       return res;
+       return -1;
 }
 #endif /* defined(HAVE_PRI_PROG_W_CAUSE) */
 #endif /* defined(HAVE_PRI) */
index 4a9904589f7838b63a5dd48607ba66a1624e6acc..49073c9ce22ec2f9050e5436f4bff3614396461b 100644 (file)
@@ -8010,7 +8010,7 @@ int pri_send_keypad_facility_exec(struct sig_pri_chan *p, const char *digits)
 
 int pri_send_callrerouting_facility_exec(struct sig_pri_chan *p, enum ast_channel_state chanstate, const char *destination, const char *original, const char *reason)
 {
-       int res = -1;
+       int res;
 
        sig_pri_lock_private(p);