[svn-commits] mnicholson: branch irroot/t38gateway-trunk r324846 - /team/irroot/t38gateway-...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Jun 24 15:03:18 CDT 2011
Author: mnicholson
Date: Fri Jun 24 15:03:15 2011
New Revision: 324846
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=324846
Log:
populate channel variables and FAXOPT() for gateway operations
Modified:
team/irroot/t38gateway-trunk/res/res_fax.c
Modified: team/irroot/t38gateway-trunk/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/t38gateway-trunk/res/res_fax.c?view=diff&rev=324846&r1=324845&r2=324846
==============================================================================
--- team/irroot/t38gateway-trunk/res/res_fax.c (original)
+++ team/irroot/t38gateway-trunk/res/res_fax.c Fri Jun 24 15:03:15 2011
@@ -2447,8 +2447,12 @@
/* create the FAX session */
if (!(s = fax_session_new(details, chan, gateway->s, gateway->token))) {
gateway->token = NULL;
+ ast_string_field_set(details, result, "FAILED");
+ ast_string_field_set(details, resultstr, "error starting gateway session");
+ ast_string_field_set(details, error, "INIT_ERROR");
+ set_channel_variables(chan, details);
+ report_fax_status(chan, details, "No Available Resource");
ast_log(LOG_ERROR, "Can't create a FAX session, gateway attempt failed.\n");
- report_fax_status(chan, details, "No Available Resource");
return -1;
}
/* release the reference for the reserved session and replace it with
@@ -2458,6 +2462,10 @@
gateway->token = NULL;
if (gateway->s->tech->start_session(gateway->s) < 0) {
+ ast_string_field_set(details, result, "FAILED");
+ ast_string_field_set(details, resultstr, "error starting gateway session");
+ ast_string_field_set(details, error, "INIT_ERROR");
+ set_channel_variables(chan, details);
return -1;
}
@@ -2624,6 +2632,11 @@
ast_framehook_detach(chan, details->gateway_id);
details->gateway_id = -1;
+ ast_string_field_set(details, result, "FAILED");
+ ast_string_field_set(details, resultstr, "unable to negotiate T.38");
+ ast_string_field_set(details, error, "T38_NEG_ERROR");
+ set_channel_variables(chan, details);
+
ao2_ref(details, -1);
return &ast_null_frame;
} else if (gateway->t38_state == T38_STATE_NEGOTIATING
@@ -2780,6 +2793,11 @@
ast_debug(1, "not starting gateway for %s and %s; neither channel supports T.38\n", chan->name, peer->name);
ast_framehook_detach(chan, gateway->framehook);
gateway->s->details->gateway_id = -1;
+
+ ast_string_field_set(gateway->s->details, result, "FAILED");
+ ast_string_field_set(gateway->s->details, resultstr, "neither channel supports T.38");
+ ast_string_field_set(gateway->s->details, error, "T38_NEG_ERROR");
+ set_channel_variables(chan, gateway->s->details);
return f;
}
@@ -2807,6 +2825,11 @@
ast_debug(1, "no fax activity between %s and %s after %d ms, disabling gateway\n", chan->name, peer->name, FAX_GATEWAY_TIMEOUT);
ast_framehook_detach(chan, gateway->framehook);
gateway->s->details->gateway_id = -1;
+
+ ast_string_field_set(gateway->s->details, result, "FAILED");
+ ast_string_field_build(gateway->s->details, resultstr, "no fax activity after %d ms", FAX_GATEWAY_TIMEOUT);
+ ast_string_field_set(gateway->s->details, error, "TIMEOUT");
+ set_channel_variables(chan, gateway->s->details);
return f;
}
}
@@ -2894,9 +2917,18 @@
.destroy_cb = fax_gateway_framehook_destroy,
};
+ ast_string_field_set(details, result, "SUCCESS");
+ ast_string_field_set(details, resultstr, "gateway operation started successfully");
+ ast_string_field_set(details, error, "NO_ERROR");
+ set_channel_variables(chan, details);
+
/* set up the frame hook*/
gateway = fax_gateway_new(details);
if (!gateway) {
+ ast_string_field_set(details, result, "FAILED");
+ ast_string_field_set(details, resultstr, "error initializing gateway session");
+ ast_string_field_set(details, error, "INIT_ERROR");
+ set_channel_variables(chan, details);
report_fax_status(chan, details, "No Available Resource");
return -1;
}
@@ -2908,6 +2940,10 @@
if (gateway->framehook < 0) {
ao2_ref(gateway, -1);
+ ast_string_field_set(details, result, "FAILED");
+ ast_string_field_set(details, resultstr, "error attaching gateway to channel");
+ ast_string_field_set(details, error, "INIT_ERROR");
+ set_channel_variables(chan, details);
return -1;
}
More information about the svn-commits
mailing list