Fri Aug 24 02:27:31 2007

Asterisk developer's documentation


srv.h File Reference

Support for DNS SRV records, used in to locate SIP services. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int ast_get_srv (struct ast_channel *chan, char *host, int hostlen, int *port, const char *service)


Detailed Description

Support for DNS SRV records, used in to locate SIP services.

Note:
Note: The Asterisk DNS SRV record support is broken, it only supports the first DNS SRV record and will give no load balancing or failover support.

Definition in file srv.h.


Function Documentation

int ast_get_srv ( struct ast_channel chan,
char *  host,
int  hostlen,
int *  port,
const char *  service 
)

Parameters:
chan Ast channel
host host name (return value)
hostlen Length of string "host"
port Port number (return value)
service Service tag for SRV lookup (like "_sip._udp" or "_stun._udp"

Definition at line 117 of file srv.c.

References ast_autoservice_start(), ast_autoservice_stop(), ast_search_dns(), context, and srv_callback().

Referenced by ast_get_ip_or_srv(), and create_addr().

00118 {
00119    struct srv_context context;
00120    int ret;
00121 
00122    context.host = host;
00123    context.hostlen = hostlen;
00124    context.port = port;
00125 
00126    if (chan && ast_autoservice_start(chan) < 0)
00127       return -1;
00128 
00129    ret = ast_search_dns(&context, service, C_IN, T_SRV, srv_callback);
00130 
00131    if (chan)
00132       ret |= ast_autoservice_stop(chan);
00133 
00134    if (ret <= 0) {
00135       host[0] = '\0';
00136       *port = -1;
00137       return ret;
00138    }
00139    return ret;
00140 }


Generated on Fri Aug 24 02:27:31 2007 for Asterisk - the Open Source PBX by  doxygen 1.5.1