34 #include "asterisk/module.h"
102 if (!(srds =
ast_calloc(1,
sizeof(*srds) + strlen(service)))) {
115 strcpy(srds->
id, service);
123 datastore->
data = srds;
177 unsigned short port, priority, weight;
212 srds = datastore->
data;
216 if (!strcasecmp(
args.resultnum,
"getnum")) {
226 if (sscanf(
args.resultnum,
"%30u", &num) != 1) {
236 if (!strcasecmp(
args.field,
"host")) {
238 }
else if (!strcasecmp(
args.field,
"port")) {
239 snprintf(buf, len,
"%d", port);
240 }
else if (!strcasecmp(
args.field,
"priority")) {
241 snprintf(buf, len,
"%d", priority);
242 }
else if (!strcasecmp(
args.field,
"weight")) {
243 snprintf(buf, len,
"%d", weight);
struct srv_context * context
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
Asterisk main include file. File version handling, generic pbx functions.
static int srv_result_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
int ast_autoservice_start(struct ast_channel *chan)
Automatically service a channel for us...
Support for DNS SRV records, used in to locate SIP services.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
void ast_srv_cleanup(struct srv_context **context)
Cleanup resources associated with ast_srv_lookup.
enum ast_cc_service_type service
Structure for a data store type.
static int srv_query_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
Structure for a data store object.
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
static struct srv_context * srv_datastore_setup(const char *service, struct ast_channel *chan)
static int unload_module(void)
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
Asterisk datastore objects.
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)
Retrieve details from a specific SRV record.
General Asterisk PBX channel definitions.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Data structure associated with a custom dialplan function.
Core PBX routines and definitions.
int ast_autoservice_stop(struct ast_channel *chan)
Stop servicing a channel for us...
#define ast_strdupa(s)
duplicate a string in memory from the stack
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
struct ast_datastore * ast_datastore_alloc(const struct ast_datastore_info *info, const char *uid)
#define ast_channel_unlock(chan)
static void parse(struct mgcp_request *req)
static void srds_destroy_cb(void *data)
unsigned int ast_srv_get_record_count(struct srv_context *context)
Get the number of records for a given SRV context.
static struct ast_custom_function srv_result_function
int ast_srv_lookup(struct srv_context **context, const char *service, const char **host, unsigned short *port)
Retrieve set of SRV lookups, in order.
static struct ast_custom_function srv_query_function
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
#define AST_APP_ARG(name)
Define an application argument.
static struct ast_datastore_info srv_result_datastore_info
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
Remove a datastore from a channel.
#define ast_custom_function_register(acf)
Register a custom function.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
static int load_module(void)