summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/baresip.h1
-rw-r--r--modules/b2bua/b2bua.c5
-rw-r--r--src/ua.c25
3 files changed, 30 insertions, 1 deletions
diff --git a/include/baresip.h b/include/baresip.h
index fc675af..11dd294 100644
--- a/include/baresip.h
+++ b/include/baresip.h
@@ -640,6 +640,7 @@ struct list *ua_calls(const struct ua *ua);
enum presence_status ua_presence_status(const struct ua *ua);
void ua_presence_status_set(struct ua *ua, const enum presence_status status);
void ua_set_media_af(struct ua *ua, int af_media);
+void ua_set_catchall(struct ua *ua, bool enabled);
/* One instance */
diff --git a/modules/b2bua/b2bua.c b/modules/b2bua/b2bua.c
index 7386a29..5e2bd1a 100644
--- a/modules/b2bua/b2bua.c
+++ b/modules/b2bua/b2bua.c
@@ -211,10 +211,13 @@ static int module_init(void)
if (err)
return err;
- err = uag_event_register(ua_event_handler, 0);
+ err = uag_event_register(ua_event_handler, NULL);
if (err)
return err;
+ /* The inbound UA will handle all non-matching requests */
+ ua_set_catchall(ua_in, true);
+
debug("b2bua: module loaded\n");
return 0;
diff --git a/src/ua.c b/src/ua.c
index e23d392..6ea69c7 100644
--- a/src/ua.c
+++ b/src/ua.c
@@ -30,6 +30,7 @@ struct ua {
int af; /**< Preferred Address Family */
int af_media; /**< Preferred Address Family for media */
enum presence_status my_status; /**< Presence Status */
+ bool catchall; /**< Catch all inbound requests */
};
struct ua_eh {
@@ -1659,6 +1660,14 @@ struct ua *uag_find(const struct pl *cuser)
return ua;
}
+ /* Last resort, try any catchall UAs */
+ for (le = uag.ual.head; le; le = le->next) {
+ struct ua *ua = le->data;
+
+ if (ua->catchall)
+ return ua;
+ }
+
return NULL;
}
@@ -1896,6 +1905,22 @@ void ua_set_media_af(struct ua *ua, int af_media)
}
+/**
+ * Enable handling of all inbound requests, even if
+ * the request uri is not matching.
+ *
+ * @param ua User-Agent
+ * @param enable True to enable, false to disable
+ */
+void ua_set_catchall(struct ua *ua, bool enabled)
+{
+ if (!ua)
+ return;
+
+ ua->catchall = enabled;
+}
+
+
int uag_set_extra_params(const char *eprm)
{
uag.eprm = mem_deref(uag.eprm);