]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
only alter the gateway_timeout when attching the gateway to a channel
authorMatthew Nicholson <mnicholson@digium.com>
Wed, 31 Aug 2011 16:31:00 +0000 (16:31 +0000)
committerMatthew Nicholson <mnicholson@digium.com>
Wed, 31 Aug 2011 16:31:00 +0000 (16:31 +0000)
ASTERISK-18219

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

res/res_fax.c

index 4f2bcb0f9cf96dbcb48e58cbc08cef1baf5bc8bc..e746650e50a20c05c5d6fecd4bee64ae0962a762 100644 (file)
@@ -3548,19 +3548,22 @@ static int acf_faxopt_write(struct ast_channel *chan, const char *cmd, char *dat
                const char *val = ast_skip_blanks(value);
                char *timeout = strchr(val, ',');
 
-               details->gateway_timeout = 0;
                if (timeout) {
-                       unsigned int gwtimeout;
                        *timeout++ = '\0';
-                       if (sscanf(timeout, "%u", &gwtimeout) == 1) {
-                               details->gateway_timeout = gwtimeout * 1000;
-                       } else {
-                               ast_log(LOG_WARNING, "Unsupported timeout '%s' passed to FAXOPT(%s).\n", timeout, data);
-                       }
                }
 
                if (ast_true(val)) {
                        if (details->gateway_id < 0) {
+                               details->gateway_timeout = 0;
+                               if (timeout) {
+                                       unsigned int gwtimeout;
+                                       if (sscanf(timeout, "%u", &gwtimeout) == 1) {
+                                               details->gateway_timeout = gwtimeout * 1000;
+                                       } else {
+                                               ast_log(LOG_WARNING, "Unsupported timeout '%s' passed to FAXOPT(%s).\n", timeout, data);
+                                       }
+                               }
+
                                details->gateway_id = fax_gateway_attach(chan, details);
                                if (details->gateway_id < 0) {
                                        ast_log(LOG_ERROR, "Error attaching T.38 gateway to channel %s.\n", chan->name);