]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Sofia-Sip] Add various accessors and helpers to nua.
authorAndrey Volk <andywolk@gmail.com>
Fri, 31 Jul 2020 22:09:50 +0000 (02:09 +0400)
committerAndrey Volk <andywolk@gmail.com>
Mon, 3 Aug 2020 17:32:35 +0000 (21:32 +0400)
libs/sofia-sip/.update
libs/sofia-sip/libsofia-sip-ua/nua/nua.c
libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua.h

index f2ecef0016c3781777eacb4dca40d1a95a4b6239..67ed62e0fe04bd2558bee482842ef64301f2409d 100644 (file)
@@ -1 +1 @@
-Tue May 12 18:04:14 UTC 2020
+Fri Jul 31 17:46:57 CDT 2020
index 451cebb1344be825fbddeb461594825ef330414a..fdeac3cad988494ab0d8c30f8cca568fc1bf6790 100644 (file)
@@ -234,10 +234,14 @@ void nua_destroy(nua_t *nua)
 #if HAVE_SMIME         /* Start NRC Boston */
     sm_destroy(nua->sm);
 #endif                 /* End NRC Boston */
-    su_home_unref(nua->nua_home);
+       nua_unref(nua);
   }
 }
 
+void nua_unref(nua_t *nua) {
+       if (nua) su_home_unref(nua->nua_home);
+}
+
 /** Fetch callback context from nua.
  *
  * @param nua         Pointer to @nua stack object
@@ -1089,3 +1093,60 @@ nua_handle_t *nua_handle_by_call_id(nua_t *nua, const char *call_id)
   }
   return NULL;
 }
+
+/** Get leg from dialog. */
+const nta_leg_t *nua_get_dialog_state_leg(nua_handle_t *nh)
+{
+       if (nh && nh->nh_ds)
+               return nh->nh_ds->ds_leg;
+       else
+               return NULL;
+}
+
+/** Get su_home_t from nua handle. */
+su_home_t *nua_handle_get_home(nua_handle_t *nh)
+{
+       if (nh && nh->nh_home)
+               return nh->nh_home;
+       else
+               return NULL;
+}
+
+/** Get su_home_t from nua. */
+su_home_t *nua_get_home(nua_t *nua)
+{
+       if (nua && nua->nua_home)
+               return nua->nua_home;
+       else
+               return NULL;
+}
+
+/** Get nta_agent_t from nua. */
+nta_agent_t *nua_get_agent(nua_t *nua)
+{
+       if (nua && nua->nua_nta)
+               return nua->nua_nta;
+       else
+               return NULL;
+}
+
+/** Set has invite of a nua handle */
+void nua_handle_set_has_invite(nua_handle_t *nh, unsigned val)
+{
+       if (nh)
+               nh->nh_has_invite = val;
+}
+
+/** Check if nua handle is destroyed */
+unsigned nua_handle_is_destroyed(nua_handle_t *nh)
+{
+       assert(nh);
+       return nh->nh_destroyed;
+}
+
+void nua_handle_dialog_usage_set_refresh_range(nua_handle_t *nh,
+       unsigned min, unsigned max) {
+       if (nh && nh->nh_ds && nh->nh_ds->ds_usage) {
+               nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, min, max);
+       }
+}
\ No newline at end of file
index 37b7667792dbbabcf44a823c19163d98840d7632..5a698359cbd42fc12415a5832c944c21ce881177 100644 (file)
 #include <sofia-sip/sip.h>
 #endif
 
+#ifndef NTA_H
+#include <sofia-sip/nta.h>
+#endif
+
 #ifndef NUA_TAG_H
 #include <sofia-sip/nua_tag.h>
 #endif
@@ -386,6 +390,16 @@ SOFIAPUBFUN nua_handle_t *nua_handle_by_replaces(nua_t *nua,
 
 nua_handle_t *nua_handle_by_call_id(nua_t *nua, const char *call_id);
 
+SOFIAPUBFUN const nta_leg_t *nua_get_dialog_state_leg(nua_handle_t *nh);
+SOFIAPUBFUN su_home_t *nua_handle_get_home(nua_handle_t *nh);
+SOFIAPUBFUN void nua_unref(nua_t *nua);
+SOFIAPUBFUN su_home_t *nua_get_home(nua_t *nua);
+SOFIAPUBFUN nta_agent_t *nua_get_agent(nua_t *nua);
+SOFIAPUBFUN void nua_handle_set_has_invite(nua_handle_t *nh, unsigned val);
+SOFIAPUBFUN unsigned nua_handle_is_destroyed(nua_handle_t *nh);
+SOFIAPUBFUN void nua_handle_dialog_usage_set_refresh_range(nua_handle_t *nh,
+       unsigned min, unsigned max);
+
 SOFIA_END_DECLS
 
 #endif