From 648a9333e547add1665d7bbb29b0ec75d5ace3a9 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sun, 6 Jul 2014 12:34:14 +0200 Subject: add ua_unregister() to un-REGISTER client --- include/baresip.h | 1 + src/ua.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/baresip.h b/include/baresip.h index f2d871d..b0f81f2 100644 --- a/include/baresip.h +++ b/include/baresip.h @@ -497,6 +497,7 @@ int ua_print_calls(struct re_printf *pf, const struct ua *ua); int ua_print_status(struct re_printf *pf, const struct ua *ua); int ua_print_supported(struct re_printf *pf, const struct ua *ua); int ua_register(struct ua *ua); +void ua_unregister(struct ua *ua); bool ua_isregistered(const struct ua *ua); const char *ua_aor(const struct ua *ua); const char *ua_cuser(const struct ua *ua); diff --git a/src/ua.c b/src/ua.c index c30be6a..2a1e1c3 100644 --- a/src/ua.c +++ b/src/ua.c @@ -191,6 +191,28 @@ int ua_register(struct ua *ua) } +/** + * Unregister all Register clients of a User-Agent + * + * @param ua User-Agent + */ +void ua_unregister(struct ua *ua) +{ + struct le *le; + + if (!ua) + return; + + ua_event(ua, UA_EVENT_UNREGISTERING, NULL, NULL); + + for (le = ua->regl.head; le; le = le->next) { + struct reg *reg = le->data; + + reg_unregister(reg); + } +} + + bool ua_isregistered(const struct ua *ua) { struct le *le; -- cgit v1.2.3