summaryrefslogtreecommitdiff
path: root/src/ua.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ua.c')
-rw-r--r--src/ua.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/ua.c b/src/ua.c
index 575c752..6c7c758 100644
--- a/src/ua.c
+++ b/src/ua.c
@@ -57,6 +57,8 @@ static struct {
bool use_tls; /**< Use TLS transport */
bool prefer_ipv6; /**< Force IPv6 transport */
sip_msg_h *subh;
+ ua_exit_h *exith; /**< UA Exit handler */
+ void *arg; /**< UA Exit handler argument */
char *eprm; /**< Extra UA parameters */
#ifdef USE_TLS
struct tls *tls; /**< TLS Context */
@@ -76,6 +78,8 @@ static struct {
false,
NULL,
NULL,
+ NULL,
+ NULL,
#ifdef USE_TLS
NULL,
#endif
@@ -98,7 +102,8 @@ static void exit_handler(void *arg)
debug("ua: sip-stack exit\n");
module_app_unload();
- re_cancel();
+ if (uag.exith)
+ uag.exith(uag.arg);
}
@@ -1454,6 +1459,20 @@ void ua_stop_all(bool forced)
/**
+ * Set the global UA exit handler. The exit handler will be called
+ * asyncronously when the SIP stack has exited.
+ *
+ * @param exith Exit handler
+ * @param arg Handler argument
+ */
+void uag_set_exit_handler(ua_exit_h *exith, void *arg)
+{
+ uag.exith = exith;
+ uag.arg = arg;
+}
+
+
+/**
* Reset the SIP transports for all User-Agents
*
* @param reg True to reset registration