Mon Mar 20 08:20:31 2006

Asterisk developer's documentation


Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

srv.h File Reference

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

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 114 of file srv.c.

References ast_autoservice_start(), ast_autoservice_stop(), ast_search_dns(), srv_context::host, srv_context::hostlen, srv_context::port, and srv_callback().

Referenced by ast_get_ip_or_srv(), and create_addr().

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


Generated on Mon Mar 20 08:20:31 2006 for Asterisk - the Open Source PBX by  doxygen 1.3.9.1