Index: main/channel.c =================================================================== --- main/channel.c (revision 94396) +++ main/channel.c (working copy) @@ -4827,3 +4827,21 @@ snprintf(buf, sizeof(buf), "%d", num); return ast_say_digit_str_full(chan, buf, ints, lang, audiofd, ctrlfd); } + +static t38_request_func_t ast_t38_request_func = NULL; + +void ast_reset_t38_handler() +{ + ast_t38_request_func = NULL; +} + +void ast_set_t38_handler(t38_request_func_t t38_request_func) +{ + ast_t38_request_func = t38_request_func; +} + +void ast_request_t38(struct ast_channel *chan) +{ + if (ast_t38_request_func) + ast_t38_request_func(chan); +} Index: include/asterisk/channel.h =================================================================== --- include/asterisk/channel.h (revision 94396) +++ include/asterisk/channel.h (working copy) @@ -1125,6 +1125,13 @@ struct ast_channel *ast_walk_channel_by_exten_locked(const struct ast_channel *chan, const char *exten, const char *context); + +typedef int (*t38_request_func_t)(const struct ast_channel *chan); + +void ast_reset_t38_handler(void); +void ast_set_t38_handler(t38_request_func_t t38_request_func); +void ast_request_t38(struct ast_channel *chan); + /*! ! \brief Waits for a digit * \param c channel to wait for a digit on * \param ms how many milliseconds to wait Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 94396) +++ channels/chan_sip.c (working copy) @@ -19463,6 +19463,22 @@ AST_CLI_DEFINE(sip_reload, "Reload SIP configuration"), }; +static int t38_request_handler(const struct ast_channel *chan) +{ + struct sip_pvt *p; + if (strcmp(chan->tech->type, "SIP")) { + ast_log(LOG_WARNING, "t38_request_handler on non-SIP channel\n"); + return -1; + } + + p = (struct sip_pvt *) chan->tech_pvt; + + p->t38.state = T38_LOCAL_REINVITE; + transmit_reinvite_with_sdp(p, TRUE); + + return 0; +} + /*! \brief PBX load module - initialization */ static int load_module(void) { @@ -19534,6 +19550,8 @@ /* And start the monitor for the first time */ restart_monitor(); + ast_set_t38_handler(t38_request_handler); + return AST_MODULE_LOAD_SUCCESS; } @@ -19542,6 +19560,8 @@ { struct sip_pvt *p, *pl; struct ast_context *con; + + ast_reset_t38_handler(); /* First, take us out of the channel type list */ ast_channel_unregister(&sip_tech);