Skip to content

Commit

Permalink
Remove the deprecated function is_other_contact()
Browse files Browse the repository at this point in the history
Replaced by  is_ip_registered() !
  • Loading branch information
bogdan-iancu committed Oct 12, 2016
1 parent e3cbc54 commit 1884088
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 104 deletions.
63 changes: 18 additions & 45 deletions modules/registrar/README
Expand Up @@ -53,13 +53,12 @@ Bogdan-Andrei Iancu
1.4.1. save(domain [,flags ,[aor]])
1.4.2. remove(domain, AOR[, target])
1.4.3. lookup(domain [, flags [, aor]])
1.4.4. is_other_contact(domain , IPs)
1.4.5. is_registered(domain ,[AOR])
1.4.6. is_contact_registered(domain
1.4.4. is_registered(domain ,[AOR])
1.4.5. is_contact_registered(domain
,[AOR],[contact],[callid])

1.4.7. is_ip_registered(domain ,[AOR],IPvar)
1.4.8. add_sock_hdr(hdr_name)
1.4.6. is_ip_registered(domain ,[AOR],IPvar)
1.4.7. add_sock_hdr(hdr_name)

1.5. Exported Statistics

Expand Down Expand Up @@ -92,11 +91,10 @@ Bogdan-Andrei Iancu
1.17. save usage
1.18. remove usage
1.19. lookup usage
1.20. is_other_contact usage
1.21. is_registered usage
1.22. is_contact_registered usage
1.23. is_ip_registered usage
1.24. add_sock_hdr usage
1.20. is_registered usage
1.21. is_contact_registered usage
1.22. is_ip_registered usage
1.23. add_sock_hdr usage

Chapter 1. Admin Guide

Expand Down Expand Up @@ -642,32 +640,7 @@ switch ($retcode) {
};
...

1.4.4. is_other_contact(domain , IPs)

This function returns true if there are any other contacts
registered, different from the ones from the IPs avp.

Meaning of the parameters is as follows:
* domain - Name of table that should be used for contacts
lookup.
* IPs - an AVP containing the IP's that will be compared with
the contacts from usrloc.

This function can be used from REQUEST_ROUTE.

WARNING: THIS FUNCTION IS DEPRECATED! USE is_ip_registered()
INSTEAD.

Example 1.20. is_other_contact usage
...

if (is_other_contact("location", "$avp(ips)")) {
sl_send_reply("403", "Forbidden");
...
};
...

1.4.5. is_registered(domain ,[AOR])
1.4.4. is_registered(domain ,[AOR])

The function returns true if an AOR is registered, false
otherwise. The function does not modify the message being
Expand All @@ -685,7 +658,7 @@ if (is_other_contact("location", "$avp(ips)")) {
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
BRANCH_ROUTE, ONREPLY_ROUTE, LOCAL_ROUTE.

Example 1.21. is_registered usage
Example 1.20. is_registered usage
...
/**/
if (is_method("REGISTER")) {
Expand All @@ -701,7 +674,7 @@ if (is_registered("location","$fu")) {
}
...

1.4.6. is_contact_registered(domain ,[AOR],[contact],[callid])
1.4.5. is_contact_registered(domain ,[AOR],[contact],[callid])

The function returns true if a contact and/or a callid from a
certain AOR is registered, false otherwise. The function does
Expand All @@ -726,7 +699,7 @@ if (is_registered("location","$fu")) {
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
BRANCH_ROUTE, ONREPLY_ROUTE, LOCAL_ROUTE.

Example 1.22. is_contact_registered usage
Example 1.21. is_contact_registered usage
...
/*let's say you want to block users that are not registered*/
if (is_method("INVITE")) {
Expand All @@ -743,12 +716,12 @@ if(is_method("INVITE")) {
}
...

1.4.7. is_ip_registered(domain ,[AOR],IPvar)
1.4.6. is_ip_registered(domain ,[AOR],IPvar)

The function returns true if at least a contact has an IP from
the IPavp in it's received parameter,otherwise returns false.
the IPavp in it's received parameter, otherwise returns false.
The function does not modify the message being process. This
function replaces the "is_other_contact" function.
function replaces the old "is_other_contact" function.

Meaning of the parameters is as follows:
* domain - Name of table that should be used for the lookup.
Expand All @@ -761,7 +734,7 @@ if(is_method("INVITE")) {
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
BRANCH_ROUTE, ONREPLY_ROUTE, LOCAL_ROUTE.

Example 1.23. is_ip_registered usage
Example 1.22. is_ip_registered usage
...
/* check the source ip whether it is already registered */
if (is_method("REGISTER")) {
Expand All @@ -772,7 +745,7 @@ if (is_method("REGISTER")) {
};
...

1.4.8. add_sock_hdr(hdr_name)
1.4.7. add_sock_hdr(hdr_name)

Adds to the current REGISTER request a new header with
“hdr_name” which contains the description of the received
Expand All @@ -785,7 +758,7 @@ if (is_method("REGISTER")) {

This function can be used from REQUEST_ROUTE.

Example 1.24. add_sock_hdr usage
Example 1.23. add_sock_hdr usage
...
add_sock_hdr("Sock-Info");
...
Expand Down
51 changes: 4 additions & 47 deletions modules/registrar/doc/registrar_admin.xml
Expand Up @@ -906,50 +906,6 @@ switch ($retcode) {
</example>
</section>

<section>
<title>
<function moreinfo="none">is_other_contact(domain , IPs)</function>
</title>
<para>
This function returns true if there are any other contacts registered,
different from the ones from the IPs avp.
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
<listitem>
<para>
<emphasis>domain</emphasis> - Name of table that should be
used for contacts lookup.
</para>
</listitem>
<listitem>
<para>
<emphasis>IPs</emphasis> - an AVP containing the IP's that
will be compared with the contacts from usrloc.
</para>
</listitem>
</itemizedlist>
<para>
This function can be used from REQUEST_ROUTE.
</para>
<para>
WARNING: THIS FUNCTION IS DEPRECATED! USE
<emphasis>is_ip_registered()</emphasis> INSTEAD.
</para>
<example>
<title><function>is_other_contact</function> usage</title>
<programlisting format="linespecific">
...

if (is_other_contact("location", "$avp(ips)")) {
sl_send_reply("403", "Forbidden");
...
};
...
</programlisting>
</example>
</section>

<section>
<title>
<function moreinfo="none">is_registered(domain ,[AOR])</function>
Expand Down Expand Up @@ -1078,9 +1034,10 @@ if(is_method("INVITE")) {
<function moreinfo="none">is_ip_registered(domain ,[AOR],IPvar)</function>
</title>
<para>
The function returns true if at least a contact has an IP from the IPavp in it's received parameter,otherwise
returns false. The function does not modify the message being process. This function replaces the "is_other_contact"
function.
The function returns true if at least a contact has an IP from the
IPavp in it's received parameter, otherwise returns false. The
function does not modify the message being process. This function
replaces the old "is_other_contact" function.
</para>
<para>Meaning of the parameters is as follows:</para>
<itemizedlist>
Expand Down
2 changes: 0 additions & 2 deletions modules/registrar/reg_mod.c
Expand Up @@ -160,8 +160,6 @@ static cmd_export_t cmds[] = {
REQUEST_ROUTE | FAILURE_ROUTE },
{"add_sock_hdr", (cmd_function)add_sock_hdr, 1, fixup_str_null, 0,
REQUEST_ROUTE },
{"is_other_contact", (cmd_function)is_other_contact_f, 2,
fixup_is_aor_registered/*same # of params*/, 0, REQUEST_ROUTE},
{"is_registered", (cmd_function)is_registered, 1,
fixup_is_aor_registered, 0,
REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE},
Expand Down
5 changes: 0 additions & 5 deletions modules/registrar/save.c
Expand Up @@ -1222,8 +1222,3 @@ int _remove(struct sip_msg *msg, char *udomain, char *aor_gp, char *contact_gp)
return err;
}

int is_other_contact_f(struct sip_msg* msg, char* _d, char *_s)
{
LM_WARN("Deprecated! Use is_ip_registered() instead!\n");
return is_ip_registered(msg, _d, NULL, _s);
}
5 changes: 0 additions & 5 deletions modules/registrar/save.h
Expand Up @@ -56,9 +56,4 @@ int save(struct sip_msg* _m, char* _d, char* _cflags, char* _s);
*/
int _remove(struct sip_msg *msg, char *domain, char *aor, char *fixed_uri_param);

/*
* checks if there is another contact except the ones specified in the avp
*/
int is_other_contact_f(struct sip_msg* msg, char* _d, char *_s);

#endif /* SAVE_H */

0 comments on commit 1884088

Please sign in to comment.