[asterisk-commits] oej: branch oej/pgtips-srv-and-outbound-stuff-1.8 r389205 - in /team/oej/pgti...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon May 20 09:05:44 CDT 2013
Author: oej
Date: Mon May 20 09:05:40 2013
New Revision: 389205
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389205
Log:
Trying to prepare for failing over. Right now just falling.
Modified:
team/oej/pgtips-srv-and-outbound-stuff-1.8/README.pgtips-srv-records
team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/chan_sip.c
team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/sip/include/sip.h
team/oej/pgtips-srv-and-outbound-stuff-1.8/include/asterisk/srv.h
team/oej/pgtips-srv-and-outbound-stuff-1.8/main/srv.c
Modified: team/oej/pgtips-srv-and-outbound-stuff-1.8/README.pgtips-srv-records
URL: http://svnview.digium.com/svn/asterisk/team/oej/pgtips-srv-and-outbound-stuff-1.8/README.pgtips-srv-records?view=diff&rev=389205&r1=389204&r2=389205
==============================================================================
--- team/oej/pgtips-srv-and-outbound-stuff-1.8/README.pgtips-srv-records (original)
+++ team/oej/pgtips-srv-and-outbound-stuff-1.8/README.pgtips-srv-records Mon May 20 09:05:40 2013
@@ -31,14 +31,15 @@
hosts with only IPv6 records and move on in the process of selecting a server and
vice versa for IPv6 only hosts.
+This project is funded by Inteno Broadband Solutions AB, Sweden. http://www.intenogroup.com
+
Happy Earballs
==============
Dual stack hosts needs to contact both address families at the same time to minimize timeout effects on caller's
call setup time.
+
This is not in scope for this project. Work is in progress in the SIP Forum IPv6 wg
to define a process for this situation.
-
-This work is funded by Inteno Broadband Solutions AB, Sweden. http://www.intenogroup.com
Asterisk changes (brainstorm suggestion)
========================================
@@ -46,6 +47,7 @@
- Make sure that the SIP channel gets a list on a SRV lookup, not a single host.
- Add failover based on that list
- Make sure the list is searched on every transaction and have failover in a call
+- Add peer matching (see below)
Peer matching
@@ -94,11 +96,12 @@
6. Add the same IPs to the AO2object for IP matching
7. Make sure the ACL list is updated by DNS manager
8. Change peer match by ip/port to use ACL list if available
-9. Avoid testing. Real developers don't test.
-10. Don't open a bug tracker issue on this project.
-11. De-install GDB. GDB is for weak developers.
-12. Do not write any documentation, regardless of what people say. It's a SEP.
-13. Stay calm and carry on.
+9. Fix outbound proxy SRV support (proxy_update)
+10. Avoid testing. Real developers don't test.
+11. Don't open a bug tracker issue on this project.
+12. De-install GDB. GDB is for weak developers.
+13. Do not write any documentation, regardless of what people say. It's a SEP.
+14. Stay calm and carry on.
Query on AO2 object stuff:
Modified: team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/chan_sip.c?view=diff&rev=389205&r1=389204&r2=389205
==============================================================================
--- team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/chan_sip.c (original)
+++ team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/chan_sip.c Mon May 20 09:05:40 2013
@@ -3377,7 +3377,9 @@
dialog->alreadygone = 1;
}
-/*! Resolve DNS srv name or host name in a sip_proxy structure */
+/*! Resolve DNS srv name or host name in a sip_proxy structure
+ OEJ: XXX Needs to update SRV records
+*/
static int proxy_update(struct sip_proxy *proxy)
{
/* if it's actually an IP address and not a name,
Modified: team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/sip/include/sip.h?view=diff&rev=389205&r1=389204&r2=389205
==============================================================================
--- team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/sip/include/sip.h (original)
+++ team/oej/pgtips-srv-and-outbound-stuff-1.8/channels/sip/include/sip.h Mon May 20 09:05:40 2013
@@ -657,14 +657,14 @@
char name[MAXHOSTNAMELEN]; /*!< DNS name of domain/host or IP */
struct ast_sockaddr ip; /*!< Currently used IP address and port */
int port;
- unsigned int priority; /*!< Priority from SRV */
- unsigned int weight; /*!< Weight from SRV */
time_t last_dnsupdate; /*!< When this was resolved */
enum sip_transport transport; /*!< TCP, UDP or TCP/TLS - possibly WS in the future */
int force; /*!< If it's an outbound proxy, Force use of this outbound proxy for all outbound requests */
/* Room for a SRV record chain based on the name */
struct sip_proxy *next;
-};
+ struct srv_context *srvlist; /*!< List of DNs entries */
+};
+
/*! \brief argument for the 'show channels|subscriptions' callback. */
struct __show_chan_arg {
Modified: team/oej/pgtips-srv-and-outbound-stuff-1.8/include/asterisk/srv.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/pgtips-srv-and-outbound-stuff-1.8/include/asterisk/srv.h?view=diff&rev=389205&r1=389204&r2=389205
==============================================================================
--- team/oej/pgtips-srv-and-outbound-stuff-1.8/include/asterisk/srv.h (original)
+++ team/oej/pgtips-srv-and-outbound-stuff-1.8/include/asterisk/srv.h Mon May 20 09:05:40 2013
@@ -90,6 +90,30 @@
unsigned int ast_srv_get_record_count(struct srv_context *context);
/*!
+ * \brief Retrieve details from the next SRV record
+ *
+ * \details
+ * After calling ast_srv_lookup, the srv_context will contain
+ * the data from several records. There is a pointer to the current
+ * used record in the srv_context. This function selects the
+ * next record if it exists.
+ * The records are sorted based on priority and secondarily based on
+ * weight. See RFC 2782 for the exact sorting rules.
+ *
+ * \param context The context returned by ast_srv_lookup
+ * \param record_num The 1-indexed record number to retrieve
+ * \param[out] host The host portion of the record
+ * \param[out] port The port portion of the record
+ * \param[out] priority The priority portion of the record
+ * \param[out] weight The weight portion of the record
+ * \retval -1 Failed to retrieve information. Likely due to an out of
+ * range record_num
+ * \retval 0 Success
+ */
+int ast_srv_get_next_record(struct srv_context *context, const char **host,
+ unsigned short *port, unsigned short *priority, unsigned short *weight);
+
+/*!
* \brief Retrieve details from a specific SRV record
*
* \details
Modified: team/oej/pgtips-srv-and-outbound-stuff-1.8/main/srv.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/pgtips-srv-and-outbound-stuff-1.8/main/srv.c?view=diff&rev=389205&r1=389204&r2=389205
==============================================================================
--- team/oej/pgtips-srv-and-outbound-stuff-1.8/main/srv.c (original)
+++ team/oej/pgtips-srv-and-outbound-stuff-1.8/main/srv.c Mon May 20 09:05:40 2013
@@ -261,6 +261,7 @@
(*context)->prev = AST_LIST_FIRST(&(*context)->entries);
*host = (*context)->prev->host;
*port = (*context)->prev->port;
+ (*context)-> current = (*context)->prev;
return 0;
}
@@ -268,6 +269,7 @@
/* Retrieve next item in result */
*host = (*context)->prev->host;
*port = (*context)->prev->port;
+ (*context)-> current = (*context)->prev;
return 0;
} else {
/* No more results */
@@ -389,6 +391,44 @@
return context->num_records;
}
+int ast_srv_get_next_record(struct srv_context *context, const char **host,
+ unsigned short *port, unsigned short *priority, unsigned short *weight)
+{
+ int i = 1;
+ int res = -1;
+ struct srv_entry *entry = NULL;
+
+ if (context == NULL) {
+ return res;
+ }
+
+ AST_LIST_TRAVERSE(&context->entries, entry, list) {
+ int this_is_it = 0;
+ if (context->current == NULL) {
+ /* Pick the first one */
+ this_is_it = 2;
+ }
+ if (this_is_it == 1) {
+ this_is_it = 2;
+ }
+ if (!this_is_it && context->current == entry) {
+ this_is_it = 1; /* Take the next one */
+ }
+ if (this_is_it == 2) {
+ *host = entry->host;
+ *port = entry->port;
+ *priority = entry->priority;
+ *weight = entry->weight;
+ res = 0;
+ break;
+ }
+ ++i;
+ }
+ context->current = entry;
+
+ return res;
+}
+
int ast_srv_get_nth_record(struct srv_context *context, int record_num, const char **host,
unsigned short *port, unsigned short *priority, unsigned short *weight)
{
@@ -415,6 +455,7 @@
}
++i;
}
+ context->current = entry;
return res;
}
More information about the asterisk-commits
mailing list